移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

503 rivejä
16 KiB

  1. <template>
  2. <div class="home_wrapper">
  3. <div class="header_main">
  4. 资源管理
  5. <div class="return_btn" @click="onClickLeft"></div>
  6. <div class="add_btn" @click="goAdd"></div>
  7. </div>
  8. <div class="search_info">
  9. <div class="search_block">
  10. <i class="icon"></i>
  11. <input type="text" class="ipt" v-model="queryParams.name" placeholder="搜索" @input="getSearchList">
  12. <!-- -->
  13. </div>
  14. <div class="total">共{{listLength}}个资产</div>
  15. </div>
  16. <div class="list_main">
  17. <van-list
  18. v-model="loading"
  19. :finished="finished"
  20. finished-text="没有更多了"
  21. @load="getList"
  22. >
  23. <!--1-->
  24. <van-swipe-cell right-width="200" class="item" v-for="(item,index) in applicationList" :key="index">
  25. <div class="item_box" @click="$router.push({name:'sunVillageInfoListResourceDetail',query:{id:item.id}})">
  26. <div class="head_block">
  27. <i class="icon"></i>
  28. <div class="title">{{item.name}}</div>
  29. <div class="describe">{{item.useType}}</div>
  30. </div>
  31. <div class="order_block">
  32. <div class="order">{{item.code}}</div>
  33. <div class="describe">{{item.resourceSort}}</div>
  34. </div>
  35. </div>
  36. <template #right>
  37. <div @click="handleDelete(item,index)" style="background-color: #ee0a24;height: 100%">删除</div>
  38. <router-link :to="{name:'sunVillageInfoListResourceEdit',query:{id:item.id}}" style="background-color: #07c160">修改</router-link>
  39. <div @click="openLoader(item.id,0)" style="background-color: rgb(98,173,102,0.2);color: #62AD66;">附件</div>
  40. <div @click="openMap(item.id, item.theGeom,index)" style="background-color: #62AD66;color: #ffffff;">地图</div>
  41. </template>
  42. </van-swipe-cell>
  43. </van-list>
  44. </div>
  45. <!-- <div class="bottom_tips">-->
  46. <!-- <span class="xs">已经到底啦</span>-->
  47. <!-- </div>-->
  48. <van-popup v-model="showMap" lock-scroll position="top" :style="{ height: '80%' }" >
  49. <div style="padding: 0;text-align: center">
  50. <MapGisLine ref="clickLoading" :message="theGeom" v-on:formSubmit="MapTag" :resourceId="resourceId" :resourceList="resourceList"></MapGisLine>
  51. <!-- <div>地图信息:绿色地块表示该地块,蓝色表示本账套已标记的其他地块</div>-->
  52. <div style="margin-top: 1.5vh">
  53. <van-button type="info" size="small" @click="saveGeom">保存</van-button>
  54. <van-button type="danger" size="small" @click="clearLayer">清除图层</van-button>
  55. <van-button plain type="info" size="small" @click="showMap = false">取消</van-button>
  56. </div>
  57. </div>
  58. </van-popup>
  59. <van-popup v-model="show" lock-scroll closeable position="top" :style="{ height: '30%' }" >
  60. <div style="padding: 0 13% 0 5%;">
  61. <van-divider>附件</van-divider>
  62. <van-uploader v-model="fileList" :after-read="afterRead" @delete="deleteFile1" multiple />
  63. </div>
  64. </van-popup>
  65. </div>
  66. </template>
  67. <script>
  68. import {
  69. listResource,
  70. commonAttach,
  71. attachmentList,
  72. systemAttachment,
  73. delResource,
  74. updateResource,
  75. getResource,
  76. clearResourceGeom
  77. } from "@/api/sunVillage_info/fixedAssets";
  78. import request from '@/utils/request'
  79. import MapGisLine from "@/components/Map/MapGisLine";
  80. export default {
  81. name: "certificateList",
  82. components: { MapGisLine,},
  83. data() {
  84. return {
  85. theGeom:'',
  86. applicationList:[],
  87. applicationListSecond:[],
  88. assetStatusOptions:[],
  89. auditStatus:[],
  90. loading: false,
  91. finished: false,
  92. show: false,
  93. showMap: false,
  94. fileList:[],
  95. listLength:'0',
  96. searchInput:'',
  97. queryParams:{
  98. pageNum:1,
  99. pageSize:10,
  100. orderByColumn:'createTime',
  101. isAsc:'desc',
  102. translate_dict:1,
  103. name:''
  104. },
  105. uploadFiles1:[],
  106. projectId:'',
  107. projectIndex:'',
  108. showBtn:true,
  109. listMap: 0,
  110. resourceId: null, // 资源ID,记录当前资源的ID
  111. resourceList: [] // 资源列表,存储本账套下所有的资源信息
  112. };
  113. },
  114. created() {
  115. this.houseGetDicts("asset_status").then((response) => {
  116. this.assetStatusOptions = response.data;
  117. });
  118. this.houseGetDicts("asset_type").then((response) => {
  119. this.assetTypeOptions = response.data;
  120. });
  121. this.houseGetDicts("use_type").then((response) => {
  122. this.useTypeOptions = response.data;
  123. });
  124. },
  125. methods: {
  126. saveGeom(){
  127. var that = this;
  128. updateResource({id: this.resourceId, theGeom: this.theGeom}).then((response) => {
  129. if (response.code == 200){
  130. this.$notify({ type: 'success', message: '修改成功' });
  131. setTimeout(function(){
  132. that.showMap = false;
  133. getResource(that.resourceId).then(response => {
  134. that.applicationList[that.listMap].theGeom = response.data.theGeom;
  135. });
  136. },500)
  137. }
  138. });
  139. },
  140. clearLayer() {
  141. this.$dialog.confirm({
  142. message: '是否清除图层?',
  143. }).then(() => {
  144. // on confirm
  145. clearResourceGeom(this.resourceId).then(res => {
  146. if (res.code === 200) {
  147. this.$notify({ type: 'success', message: '清除成功' });
  148. this.showMap = false;
  149. this.applicationList[this.listMap].theGeom = null;
  150. }
  151. });
  152. }).catch(() => {
  153. // on cancel
  154. });
  155. },
  156. openMap(id, theGeom,index){
  157. listResource().then(response => {
  158. this.showMap = true;
  159. this.resourceId = id;
  160. this.theGeom = theGeom;
  161. this.listMap = index;
  162. this.resourceList = response.rows;
  163. this.mapClickLoading();
  164. });
  165. },
  166. //每个查看修改,新增 方法下引用下面方法
  167. mapClickLoading(){
  168. setTimeout(() => {
  169. this.$refs.clickLoading.drawingPaceCountryLine();
  170. }, 1000);
  171. },
  172. /** 查找地图中定位点 */
  173. MapTag: function (data) {
  174. // this.applicationList[this.listMap].theGeom = data;
  175. this.theGeom = data;
  176. },
  177. guidProduct(){
  178. return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  179. var r = Math.random() * 16 | 0,
  180. v = c == 'x' ? r : (r & 0x3 | 0x8);
  181. return v.toString(16);
  182. });
  183. },
  184. getList(){
  185. this.loading = true;
  186. listResource(this.queryParams).then(response => {
  187. this.listLength = response.total;
  188. response.rows.forEach(item => {
  189. this.applicationList.push(item);
  190. });
  191. if(this.applicationList.length >= response.total){
  192. this.finished = true;
  193. return;
  194. }else{
  195. this.loading = false;
  196. this.queryParams.pageNum += 1 ;
  197. }
  198. });
  199. },
  200. afterRead(file) {
  201. // 此时可以自行将文件上传至服务器
  202. console.log(file)
  203. this.uploadFiles1.push(file.file);
  204. let params1 = new FormData();
  205. params1.append("tableId", this.projectId);
  206. params1.append("tableName", "t_asset_resource");
  207. params1.append("bizPath", "asset");
  208. params1.append("fileType", this.projectIndex);
  209. params1.append("file", file.file);
  210. commonAttach(params1).then((r1) => {
  211. this.$notify({ type: 'success', message: '上传成功' });
  212. })
  213. },
  214. openLoader(id,index){
  215. this.show = true;
  216. this.projectId = id;
  217. this.projectIndex = index;
  218. this.fileList = [];
  219. let oData1= {
  220. tableId: id,
  221. tableName: "t_asset_resource",
  222. bizPath: "asset",
  223. fileType: '',
  224. }
  225. attachmentList(oData1).then(res => {
  226. res.rows.map(r => {
  227. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  228. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id})
  229. })
  230. })
  231. },
  232. /** 删除按钮操作 */
  233. handleDelete(row,index) {
  234. let useType = row.useType;
  235. if(useType == 3) {
  236. this.$notify({
  237. message: "出租或出借的资产不允许删除",
  238. type: "warning",
  239. });
  240. return ;
  241. }
  242. const ids = row.id || this.ids;
  243. this.$dialog.alert(
  244. {
  245. message:'是否确认删除资源资产?',
  246. title:"警告",
  247. showCancelButton:true,
  248. confirmButtonText: "确定",
  249. cancelButtonText: "取消",
  250. }
  251. )
  252. .then(function () {
  253. return delResource(ids);
  254. })
  255. .then(() => {
  256. this.applicationList.splice(index, 1);
  257. this.$notify({ type: 'success', message: '删除成功' });
  258. });
  259. },
  260. getSearchList(){
  261. this.applicationList = [];
  262. this.queryParams.pageNum = 1;
  263. this.finished = false;
  264. this.getList();
  265. },
  266. deleteFile1(file){
  267. console.log(file)
  268. systemAttachment(file.id).then(res => {
  269. this.$notify({ type: 'success', message: '删除成功' });
  270. })
  271. },
  272. goAdd(){
  273. this.$router.push('/sunVillage_info/resourceAdd')
  274. },
  275. },
  276. }
  277. </script>
  278. <style scoped lang="scss">
  279. .home_wrapper{
  280. background: #e9e9e9;
  281. min-height: 100vh;
  282. width: 100vw;
  283. .header_main {
  284. height: 116px;
  285. background: url('../../assets/images/sunVillage_info/list_head.png') no-repeat;
  286. background-size: 100% 100%;
  287. position: fixed;
  288. top: 0;
  289. left: 0;
  290. width: 100%;
  291. font-size: 36px;
  292. line-height: 116px;
  293. text-align: center;
  294. color: #fff;
  295. position: relative;
  296. .return_btn {
  297. width: 24px;
  298. height: 43.2px;
  299. background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  300. background-size: 20px 36px;
  301. position: absolute;
  302. left: 38px;
  303. top: 36px;
  304. }
  305. .add_btn {
  306. width: 56.4px;
  307. height: 40.8px;
  308. background: url('../../assets/images/sunVillage_info/list_icon_9.png') center center no-repeat;
  309. background-size: 47px 34px;
  310. position: absolute;
  311. right: 38px;
  312. top: 36px;
  313. }
  314. }
  315. .search_info{
  316. padding:20px 23px;
  317. display: flex;
  318. .search_block{
  319. height: 59px;
  320. width: 535px;
  321. border-radius: 59px;
  322. background: #fff;
  323. display: flex;
  324. border:2px solid #3494ff;
  325. padding-right: 35px;
  326. align-items: center;
  327. .icon{
  328. width: 30px;
  329. height: 30px;
  330. background: url('../../assets/images/sunVillage_info/fixedAssets_icon_1.png') no-repeat;
  331. background-size: 100% 100%;
  332. display: block;
  333. margin:0 8px 0 26px;
  334. }
  335. .ipt{
  336. flex: 1;
  337. font-size: 26px;
  338. background: none;
  339. border:0 none;
  340. line-height: 59px;
  341. }
  342. }
  343. .total{
  344. flex: 1;
  345. display: flex;
  346. align-items: center;
  347. justify-content: center;
  348. font-size: 26px;
  349. color: #858585;
  350. }
  351. }
  352. .list_main{
  353. padding:0 22px;
  354. .item{
  355. /*height: 198px;*/
  356. border-radius: 30px;
  357. background: #fff;
  358. box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
  359. margin-bottom: 20px;
  360. .item_box{
  361. padding:25px 32px;
  362. }
  363. .head_block{
  364. height: 56px;
  365. display: flex;
  366. align-items: center;
  367. width: 100%;
  368. .icon{
  369. width: 34px;
  370. height: 30px;
  371. background: url('../../assets/images/sunVillage_info/fixedAssets_icon_2.png') no-repeat;
  372. background-size: 100% 100%;
  373. display: block;
  374. margin-right: 12px;
  375. }
  376. .title{
  377. flex:1;
  378. font-size: 32px;
  379. color: #252525;
  380. overflow: hidden;
  381. text-overflow: ellipsis;
  382. white-space: nowrap;
  383. padding-right: 20px;
  384. }
  385. .describe{
  386. height: 34px;
  387. padding: 0 15px;
  388. font-size: 24px;
  389. color: #3494ff;
  390. background: #e6f2ff;
  391. border-radius: 8px;
  392. }
  393. }
  394. .order_block{
  395. height: 50px;
  396. display: flex;
  397. align-items: center;
  398. width: 100%;
  399. .order{
  400. flex: 1;
  401. font-size: 26px;
  402. color: #252525;
  403. }
  404. .describe{
  405. font-size: 26px;
  406. color: #3494ff;
  407. }
  408. }
  409. .function_block{
  410. height: 46px;
  411. display: flex;
  412. align-items: center;
  413. .time{
  414. display: flex;
  415. flex: 1;
  416. align-items: center;
  417. font-size: 24px;
  418. color: #858585;
  419. .icon{
  420. width: 25px;
  421. height: 25px;
  422. background: url('../../assets/images/sunVillage_info/fixedAssets_icon_3.png') no-repeat;
  423. background-size: 100% 100%;
  424. display: block;
  425. margin-right: 8px;
  426. }
  427. }
  428. .state{
  429. /*flex: 1;*/
  430. display: flex;
  431. justify-content: center;
  432. align-items: center;
  433. &.sell{
  434. color: #f69600;
  435. }
  436. &.scrap{
  437. color: #858585;
  438. }
  439. &.normal{
  440. color: #68c000;
  441. }
  442. }
  443. .value{
  444. flex:1;
  445. display: flex;
  446. align-items: center;
  447. justify-content:flex-end;
  448. font-size: 24px;
  449. color: #858585;
  450. .amount{
  451. color: #eb1616;
  452. }
  453. }
  454. }
  455. }
  456. }
  457. .bottom_tips{
  458. font-size: 24px;
  459. color: #a7a6a6;
  460. text-align: center;
  461. margin-top: 32px;
  462. background: url('../../assets/images/sunVillage_info/list_icon_8.png') center center no-repeat;
  463. background-size: 260px 2px;
  464. .xs{
  465. padding:0 8px;
  466. background: #e9e9e9;
  467. }
  468. }
  469. /deep/ .van-swipe-cell__right{
  470. display: flex;
  471. align-items: center;
  472. width: 200PX;
  473. margin-left: 5PX;
  474. a,div{
  475. margin: 0;
  476. display: flex;
  477. align-items: center;
  478. justify-content: center;
  479. color: #ffffff;
  480. font-size: 14PX;
  481. height: 100%;
  482. flex: 1;
  483. }
  484. }
  485. }
  486. </style>