Browse Source

科研仪器设备和房屋建筑物新增、删除接口联调

ljb 10 months ago
parent
commit
1e85d978f7

+ 12 - 2
src/api/yfCostManage/basicDataSetting/houseDetailList.js

@@ -12,14 +12,24 @@ export const getList = (current, size, params) => {
   })
 }
 
-export const remove = data => {
+export const add = data => {
   return request({
-    url: '/api/kd-scientific/asset/fangwujianzhuwu/remove',
+    url: '/kd-scientific/asset/fangwujianzhuwu/save',
     method: 'post',
     data
   })
 }
 
+export const remove = (ids) => {
+  return request({
+    url: '/api/kd-scientific/asset/fangwujianzhuwu/remove',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}
+
 export const fetchDeviceData = params => {
   return request({
     url: '/api/kd-scientific/asset/fangwujianzhuwu/fetchData',

+ 13 - 3
src/api/yfCostManage/basicDataSetting/kyDeviceList.js

@@ -12,17 +12,27 @@ export const getList = (current, size, params) => {
   })
 }
 
-export const remove = data => {
+export const add = data => {
   return request({
-    url: '/api/kd-scientific/asset/keyanyiqishebeimingxibiao/remove',
+    url: '/api/kd-scientific/asset/keyanyiqishebeimingxibiao/save',
     method: 'post',
     data
   })
 }
 
+export const remove = ids => {
+  return request({
+    url: '/api/kd-scientific/asset/keyanyiqishebeimingxibiao/remove',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}
+
 export const fetchDeviceData = params => {
   return request({
-    url: '/api/kd-scientific/asset/xm/fetchData',
+    url: '/api/kd-scientific/asset/keyanyiqishebeimingxibiao/fetchData',
     method: 'get',
     params
   })

+ 3 - 0
src/components/asset-select/index.vue

@@ -57,7 +57,10 @@ export default {
       })
     },
     handleChange(val) {
+      let objData = this.listData.find(item => item.id === val);
+
       this.$emit('input', val);
+      this.$emit('change', objData);
     },
   }
 }

+ 16 - 5
src/views/yf-cost-manage/basic-data-setting/hourse-details-list.vue

@@ -85,11 +85,15 @@
       </template>
 
       <template slot="xmIdForm">
-        <project-select v-model="form.xmId" multiple :params="{ yearAndMonth: params.yearAndMonth }"></project-select>
+        <project-select v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }"></project-select>
       </template>
 
       <template slot="assetIdForm">
-        <asset-select v-model="form.assetId" :params="{ yearAndMonth: params.yearAndMonth, zclb: '房屋建筑物' }"></asset-select>
+        <asset-select
+          v-model="form.assetId"
+          :params="{ yearAndMonth: params.yearAndMonth, zclb: '房屋建筑物' }"
+          @change="handleAssetChange"
+        ></asset-select>
       </template>
       
     </avue-crud>
@@ -158,14 +162,14 @@ export default window.$crudCommon({
   methods: {
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('/api/kd-scientific/fangwujianzhuwu/import', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/asset/fangwujianzhuwu/import', excelParams);
     },
     uploadAfter() {
       this.page.currentPage = 1;
       this.getList(this.page);
     },
     handleExport() {
-      exportBloByPost(`/api/kd-scientific/fangwujianzhuwu/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBloByPost(`/api/kd-scientific/asset/fangwujianzhuwu/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `科研房屋建筑物明细表${this.params.yearAndMonth}.xlsx`);
       });
     },
@@ -190,7 +194,14 @@ export default window.$crudCommon({
           this.getList(this.page);
         }
       });
-    }
+    },
+    handleAssetChange({ zcbm }) {
+      this.form = { ...this.form, zcbm };
+    },
+    getFormData() {
+      const { xmId, assetId, zcbm } = this.form;
+      return { xmId, assetId, zcbm, yearAndMonth: this.params.yearAndMonth };
+    },
   },
 }, {
   // 模块路径

+ 16 - 5
src/views/yf-cost-manage/basic-data-setting/ky-device-list.vue

@@ -85,11 +85,15 @@
       </template>
 
       <template slot="xmIdForm">
-        <project-select v-model="form.xmId" multiple :params="{ yearAndMonth: params.yearAndMonth }"></project-select>
+        <project-select v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }"></project-select>
       </template>
 
       <template slot="assetIdForm">
-        <asset-select v-model="form.assetId" :params="{ yearAndMonth: params.yearAndMonth, zclb: '仪器设备' }"></asset-select>
+        <asset-select
+          v-model="form.assetId"
+          :params="{ yearAndMonth: params.yearAndMonth, zclb: '仪器设备' }"
+          @change="handleAssetChange"
+        ></asset-select>
       </template>
       
     </avue-crud>
@@ -158,14 +162,14 @@ export default window.$crudCommon({
   methods: {
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
-      this.$refs.uploadExcelDialog.open('/api/kd-scientific/keyanyiqishebeimingxibiao/import', excelParams);
+      this.$refs.uploadExcelDialog.open('/api/kd-scientific/asset/keyanyiqishebeimingxibiao/import', excelParams);
     },
     uploadAfter() {
       this.page.currentPage = 1;
       this.getList(this.page);
     },
     handleExport() {
-      exportBloByPost(`/api/kd-scientific/keyanyiqishebeimingxibiao/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+      exportBloByPost(`/api/kd-scientific/asset/keyanyiqishebeimingxibiao/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
         downloadXls(res.data, `科研仪器设备明细表${this.params.yearAndMonth}.xlsx`);
       });
     },
@@ -190,7 +194,14 @@ export default window.$crudCommon({
           this.getList(this.page);
         }
       });
-    }
+    },
+    handleAssetChange({ zcbm }) {
+      this.form = { ...this.form, zcbm };
+    },
+    getFormData() {
+      const { xmId, assetId, zcbm } = this.form;
+      return { xmId, assetId, zcbm, yearAndMonth: this.params.yearAndMonth };
+    },
   },
 }, {
   // 模块路径