Ver código fonte

修改设备档案卡导入导出模板

cyy 16 horas atrás
pai
commit
8409e33a10
1 arquivos alterados com 74 adições e 24 exclusões
  1. 74 24
      src/views/component/device/index.vue

+ 74 - 24
src/views/component/device/index.vue

@@ -802,7 +802,7 @@ export default {
       sqlWhere: {},
       searchWhere: {},
       deviceColumns: {
-        bianZhiBuMen: '部门',
+        bianZhiBuMen: '建档部门',
         sheBeiMingCheng: '设备名称',
         // sheBeiShiBieH: '设备编号(导入无需填写)',
         yuanSheBeiBian: setting?.device?.hideSysDeviceNo
@@ -817,23 +817,23 @@ export default {
         shiFouXiaoZhun: '是否校准(是/否)',
         weiHuFangShi: '岗位/分组',
         guiGeXingHao: '规格型号',
-        cunFangDiDian: '存放地点(格式:房间号+空格+房间名)',
+        cunFangDiDian: '放置地点(格式:房间号+空格+房间名)',
         guanLiRen: '保管人',
-        ziChanBianHao: '资产编号',
+        ziChanBianHao: '固定资产号',
         ziChanYuanZhi: '资产原值(元)',
         gongYingShang: '供应商',
-        lianXiFangShi: '联系方式',
-        changShang: '厂商',
-        jiShenXuHao: '机身序号',
+        lianXiFangShi: '供应商电话',
+        changShang: '厂家/品牌',
+        jiShenXuHao: '出厂编号',
         zhuCeZhengHao: '注册证号',
-        heChaXiaoZhun: '使用年限(年)',
+        heChaXiaoZhun: '使用年限(年)',
         chuChangRiQi: '出厂日期',
         yanShouRiQi: '验收日期',
         jieShouRiQi: '接收日期',
         qiYongRiQi: '投入日期',
-        yiXiaoRiQi: '已校日期',
+        yiXiaoRiQi: '最近校准时间',
         xiaoZhunZQ: '检定/校准周期(以月为单位)',
-        xiaoZhunYouXia: '校准有效期至',
+        xiaoZhunYouXia: '检定/校准有效期至',
         shiYongKeShi: '检定/校准单位',
         ceLiangGongZuo: '预期测量范围',
         huanJingYaoQiu: '环境要求',
@@ -841,13 +841,11 @@ export default {
         jieShouZhuangTai: '接收时状态(新设备/二手或翻新设备)',
         jianDingXiao: '检定/校准参数',
         zuiDaYunCha: '测量准确度/U',
-        zhengShuBianHa: '证书编号',
+        zhengShuBianHa: '检定/校准证书编号',
         xiuZhengZhiXiu: '修正值/修正因子',
-        wenDuYingYong: '温度应用修正值',
-        shiDuYingYong: '湿度应用修正值',
         // biXuDeHuanJin: '核查人',
         // biXuSheShi: '核查日期',
-        shiFouHeCha: '是否核查(是/否)',
+        shiFouHeCha: '是否期间核查(是/否)',
         shangCiHeChaRiQi: '上次核查日期',
         heChaZhouQi: '核查周期(以月为单位)',
         heChaCanShu: '核查参数',
@@ -875,7 +873,7 @@ export default {
         'shangCiHeChaRiQi'
       ],
       requiredFieldMap: {
-        bianZhiBuMen: '部门',
+        bianZhiBuMen: '建档部门',
         sheBeiMingCheng: '设备名称',
         yuanSheBeiBian: setting?.device?.hideSysDeviceNo
           ? '设备编号'
@@ -890,8 +888,8 @@ export default {
         yanShouRiQi: '验收日期',
         jieShouRiQi: '接收日期',
         qiYongRiQi: '投入日期',
-        yiXiaoRiQi: '已校日期',
-        xiaoZhunYouXia: '校准有效期至',
+        yiXiaoRiQi: '最近校准时间',
+        xiaoZhunYouXia: '检定/校准有效期至',
         shangCiHeChaRiQi: '上次核查日期'
         // 'biXuSheShi': '核查日期'
       },
@@ -1521,6 +1519,12 @@ export default {
         key: 'getSupplierList',
         params: [second || first]
       })
+      // 房间信息(放置地点 id -> 房间号+房间名)
+      const roomRes = await this.$common.request('query', {
+        key: 'getRoomData',
+        params: [second || first]
+      })
+      const roomData = (roomRes.variables || {}).data || []
       const exportData = JSON.parse(JSON.stringify(data))
       for (let i = 0; i < exportData.length; i++) {
         const item = exportData[i]
@@ -1534,6 +1538,11 @@ export default {
         if (this.projectName != 'dev4') {
           item.shiYongKeShi = this.switchGYSIdToName(item.shiYongKeShi, gysData)
         }
+        // 放置地点:优先按 cunFangWeiZhi(房间id)解析房间号+房间名,解析不到时回退到列表已有的 cunFangDiDian
+        item.cunFangDiDian = this.switchRoomIdToName(
+          item.cunFangWeiZhi,
+          roomData
+        ) || (item.cunFangDiDian || '')
 
         // if (this.stateList[item.sheBeiZhuangTa]) {
         //   item.sheBeiZhuangTa = this.stateList[item.sheBeiZhuangTa]
@@ -1562,6 +1571,18 @@ export default {
         gysList.find((item) => item.id_ === val)?.gong_ying_shang_m || ''
       return result
     },
+    // 房间id 转 房间号+空格+房间名
+    switchRoomIdToName(val, roomList = []) {
+      if (!val) return ''
+      const idList = String(val).split(',').filter((i) => i)
+      const result = idList
+        .map((id) => {
+          const room = roomList.find((i) => i.id_ === id)
+          return room ? this.getRoomText(room) : ''
+        })
+        .filter((i) => i)
+      return result.join(',')
+    },
     // 部门id 转 部门名称
     switchIdToDept(id) {
       const { deptList } = this.$store.getters
@@ -2008,15 +2029,19 @@ export default {
      */
     handlePositionInfo(list, positionList) {
       list.forEach((element) => {
-        if (element.cunFangDiDian !== '') {
-          const postion = positionList.find(
-            (i) =>
-              (i.fang_jian_ming_ha.trim() || '') ===
-              element.cunFangDiDian.trim()
-          )
+        const value = (element.cunFangDiDian || '').trim()
+        if (value !== '') {
+          // 优先按「房间号+空格+房间名」匹配,其次按房间名匹配
+          const postion =
+            positionList.find(
+              (i) => this.getRoomText(i).trim() === value
+            ) ||
+            positionList.find(
+              (i) => (i.fang_jian_ming_ha || '').trim() === value
+            )
           if (postion) {
-            const positionId = postion.id_
-            element.cunFangWeiZhi = positionId
+            element.cunFangWeiZhi = postion.id_
+            element.cunFangDiDian = this.getRoomText(postion)
           } else {
             element.cunFangWeiZhi = ''
             element.cunFangDiDian = ''
@@ -2026,6 +2051,31 @@ export default {
         }
       })
     },
+    // 房间信息 -> 房间号+空格+房间名
+    getRoomText(room = {}) {
+      const roomNo = this.getRoomNo(room)
+      const roomName = room.fang_jian_ming_ha || room.fangJianMingHa || ''
+      return [roomNo, roomName].filter((i) => i).join(' ')
+    },
+    // 房间号(兼容多种字段命名)
+    getRoomNo(room = {}) {
+      const direct =
+        room.fang_jian_hao ||
+        room.fangJianHao ||
+        room.fang_jian_bian_hao_ ||
+        room.fangJianBianHao ||
+        room.fang_jian_bian_hao ||
+        room.fangJianCode
+      if (direct) return direct
+      // 兜底:查找形如 fang_jian_xxx_hao / fangJianXxxHao 的字段(排除房间名称字段)
+      const key = Object.keys(room).find(
+        (k) =>
+          /^fang_?jian/i.test(k) &&
+          /(hao|code)/i.test(k) &&
+          !/(ming_?ha|mc|name)/i.test(k)
+      )
+      return key ? room[key] : ''
+    },
     handlePersonInfo(list, employeeList) {
       list.forEach((element) => {
         // 处理保管人