移动端
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

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