Sfoglia il codice sorgente

设备校准记录导入后更新设备档案卡

cyy 13 ore fa
parent
commit
62feff81f6
1 ha cambiato i file con 34 aggiunte e 7 eliminazioni
  1. 34 7
      src/views/component/device/smallEquipmentImport.vue

+ 34 - 7
src/views/component/device/smallEquipmentImport.vue

@@ -657,6 +657,31 @@ export default {
       })
 
       console.log('处理后导入数据:\n', list)
+      const newArray = list.filter(
+        (item) => item.shu_ju_lai_yuan_ === 'importAssociation'
+      )
+      let updList = []
+      let updateParams = {}
+      if (newArray.length > 0) {
+        newArray.forEach((item) => {
+          let o = {
+            where: {
+              id_: item.she_bei_bian_hao_ || ''
+            },
+            param: {
+              xiao_zhun_z_q_: item.jian_ding_zhou_qi || '',
+              shi_yong_ke_shi_: item.dan_wei_id || '',
+              yi_xiao_ri_qi_: item.shi_shi_ri_qi_ || '',
+              xiao_zhun_you_xia: item.chu_chang_bian_ha || ''
+            }
+          }
+          updList.push(o)
+        })
+        updateParams = {
+          tableName: 't_sbdj',
+          updList
+        }
+      }
 
       // 数据校验
       let index = 0
@@ -705,13 +730,15 @@ export default {
         tableName: 't_mjsbjdxzjhzb',
         paramWhere: list
       }
-      this.$common.request('add', params).then(() => {
-        this.$message.success('导入成功')
-        if (typeof callback === 'function') {
-          callback(list)
-        }
-        this.$emit('confirm', this.paramForm)
-      })
+      await this.$common.request('add', params).then(() => {})
+      if (newArray.length > 0) {
+        await this.$common.request('update', updateParams)
+      }
+      this.$message.success('导入成功')
+      if (typeof callback === 'function') {
+        callback(list)
+      }
+      this.$emit('confirm', this.paramForm)
     },
     dataTransfer(dataset, data, from = 'id_', to = 'name_') {
       const list = data ? data.split(',') : []