Ver Fonte

设备档案卡导入导出增加检定/校准单位字段

luoaoxuan há 1 ano atrás
pai
commit
8eef46925f
1 ficheiros alterados com 21 adições e 1 exclusões
  1. 21 1
      src/views/component/device/index.vue

+ 21 - 1
src/views/component/device/index.vue

@@ -544,7 +544,8 @@ export default {
                 biXuDeHuanJin: '核查人',
                 biXuSheShi: '核查日期',
                 weiHuFangShi: '设备分组',
-                heChaXiaoZhun: '使用年限(年)'
+                heChaXiaoZhun: '使用年限(年)',
+                shiYongKeShi: '检定/校准单位'
             },
             projectColums: {
                 yuanSheBeiBian: '设备编号*',
@@ -959,7 +960,9 @@ export default {
         },
         async switchExportData (data) {
             const deviceGroupSql = `select id_,wei_hu_gang_wei_ from t_sbwhgwpzb` // 设备分组信息
+            const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb` // 供应商信息
             const { variables: { data: deviceGroupData }} = await this.$common.request('sql', deviceGroupSql)
+            const { variables: { data: gysData }} = await this.$common.request('sql', supplierSql)
             const exportData = JSON.parse(JSON.stringify(data))
             for (let i = 0; i < exportData.length; i++) {
                 const item = exportData[i]
@@ -967,6 +970,7 @@ export default {
                 item.guanLiRen = this.switchIdToUserName(item.guanLiRen.split(',')[0])
                 item.biXuDeHuanJin = this.switchIdToUserName(item.biXuDeHuanJin.split(',')[0])
                 item.weiHuFangShi = this.switchDeviceIdToName(item.weiHuFangShi, deviceGroupData)
+                item.shiYongKeShi = this.switchGYSIdToName(item.shiYongKeShi, gysData)
             }
             return exportData
         },
@@ -977,6 +981,11 @@ export default {
             valList.forEach(item => result.push((deviceGroupList?.find(i => i.id_ === item)?.wei_hu_gang_wei_) || ''))
             return result.join(',')
         },
+        // 供应商id 转 供应商名称 检定/校准单位
+        switchGYSIdToName (val, gysList) {
+            const result = gysList.find(item => item.id_ === val)?.gong_ying_shang_m || ''
+            return result
+        },
         // 部门id 转 部门名称
         switchIdToDept (id) {
             const { deptList } = this.$store.getters
@@ -1294,6 +1303,17 @@ export default {
                 } else {
                     element.shiFouQiJianH = ''
                 }
+
+                if (element.shiYongKeShi.trim()) {
+                    const supplier = supplierList.find(i => i.gong_ying_shang_m === element.shiYongKeShi.trim())
+                    if (supplier) {
+                        element.shiYongKeShi = supplier.id_
+                    } else {
+                        element.shiYongKeShi = ''
+                    }
+                } else {
+                    element.shiYongKeShi = ''
+                }
             })
         },
         /**