移动端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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