Przeglądaj źródła

Merge branch 'master' of http://119.23.210.103:3000/wy/zdqy_firm_former

cfort 1 rok temu
rodzic
commit
f31b7f2d7a

+ 40 - 26
src/views/platform/registrationOutsiders/checkOut.vue → src/views/business/registrationOutsiders/checkOut.vue

@@ -5,6 +5,7 @@
         :close-on-click-modal="false"
         :close-on-press-escape="false"
         append-to-body
+        width="500px"
         class="dialog1 test-dialog"
         @close="closeDialog"
     >
@@ -13,7 +14,7 @@
                 label="签出时间"
                 prop="dataTime"
                 :rules="[
-                    { required: true, message: '签出时间不能为空!'},
+                    { required: true, message: '签出时间不能为空!' },
                     { validator: validateDataTime, trigger: 'change' }
                 ]"
             >
@@ -22,7 +23,8 @@
                     type="datetime"
                     placeholder="选择签出时间"
                     value-format="yyyy-MM-dd HH:mm"
-                    style="width: 100%;"
+                    format="yyyy-MM-dd HH:mm"
+                    style="width: 96%"
                 />
             </el-form-item>
         </el-form>
@@ -52,12 +54,9 @@ export default {
             title: '签出',
             dialogVisible: this.visible,
             formList: {
-                dataTime: new Date()
+                dataTime: this.formatDate(new Date())
             },
-            toolbars: [
-                { key: 'confirm' },
-                { key: 'cancel' }
-            ]
+            toolbars: [{ key: 'confirm' }, { key: 'cancel' }]
         }
     },
     watch: {
@@ -70,12 +69,17 @@ export default {
             if (value === '') {
                 callback(new Error('签出时间不能为空!'))
             } else {
-                const joinTime = new Date(this.dataList.jin_ru_shi_jian_.replace(' ', 'T'))
+                const joinTime = new Date(
+                    this.dataList.jin_ru_shi_jian_.replace(' ', 'T')
+                )
                 const selectedTime = new Date(value.replace(' ', 'T'))
                 const currentTime = new Date()
 
                 // 检查日期是否有效
-                if (isNaN(joinTime.getTime()) || isNaN(selectedTime.getTime())) {
+                if (
+                    isNaN(joinTime.getTime()) ||
+                    isNaN(selectedTime.getTime())
+                ) {
                     callback(new Error('进入或签出时间有误!'))
                     return
                 }
@@ -91,7 +95,6 @@ export default {
                     callback(new Error('签出时间不能晚于当前时间!'))
                     return
                 }
-
                 callback()
             }
         },
@@ -101,22 +104,25 @@ export default {
                     const params = { li_kai_shi_jian_: this.formList.dataTime }
                     const updateParamsRecord = {
                         tableName: 't_wlrydjb', // 数据库名
-                        updList: [{
-                            where: {
-                                id_: this.dataList.id_ // 修改数据的id
-                            },
-                            param: params // 要修改的数据
-                        }]
+                        updList: [
+                            {
+                                where: {
+                                    id_: this.dataList.id_ // 修改数据的id
+                                },
+                                param: params // 要修改的数据
+                            }
+                        ]
                     }
-
-                    console.log('updateParamsRecord', updateParamsRecord)
-                    this.$common.request('update', updateParamsRecord).then(res => {
-                        this.$message.success('签出成功!')
-                        this.closeDialog()
-                    }).catch(() => {
-                        this.$message.error('签出失败!')
-                        this.closeDialog()
-                    })
+                    this.$common
+                        .request('update', updateParamsRecord)
+                        .then((res) => {
+                            this.$message.success('签出成功!')
+                            this.closeDialog()
+                        })
+                        .catch(() => {
+                            this.$message.error('签出失败!')
+                            this.closeDialog()
+                        })
                 } else {
                     console.log('校验失败')
                     return false
@@ -137,6 +143,14 @@ export default {
                 default:
                     break
             }
+        },
+        formatDate (date) {
+            const year = date.getFullYear()
+            const month = String(date.getMonth() + 1).padStart(2, '0')
+            const day = String(date.getDate()).padStart(2, '0')
+            const hours = String(date.getHours()).padStart(2, '0')
+            const minutes = String(date.getMinutes()).padStart(2, '0')
+            return `${year}-${month}-${day} ${hours}:${minutes}`
         }
     }
 }
@@ -151,7 +165,7 @@ export default {
         text-align: center !important;
     }
     .el-form-item__error {
-        top: 120%  !important;
+        top: 120% !important;
     }
 }
 </style>

+ 40 - 13
src/views/component/device/index.vue

@@ -509,41 +509,42 @@ export default {
             deviceColumns: {
                 bianZhiBuMen: '部门',
                 sheBeiMingCheng: '设备名称',
-                sheBeiShiBieH: '设备编号(导入无需填写)',
+                // sheBeiShiBieH: '设备编号(导入无需填写)',
                 yuanSheBeiBian: '原设备编号(必填,且不可重复)',
                 sheBeiZhuangTa: '设备状态(合格/停用/限用)',
                 sheBeiLeiXing: '设备类型(检验系统/通用设备/软件/信息系统)',
+                shiFouWeiHu: '是否维护(是/否)',
+                shiFouXiaoZhun: '是否校准(是/否)',
+                weiHuFangShi: '设备分组',
                 guiGeXingHao: '规格型号',
-                cunFangDiDian: '存放地点',
+                cunFangDiDian: '存放地点(格式:房间号+空格+房间名)',
                 guanLiRen: '保管人',
                 ziChanBianHao: '资产编号',
                 gongYingShang: '供应商',
                 lianXiFangShi: '联系方式',
                 changShang: '厂商',
-                chuChangRiQi: '出厂日期',
                 jiShenXuHao: '机身序号',
                 zhuCeZhengHao: '注册证号',
-                ceLiangGongZuo: '测量范围',
-                huanJingYaoQiu: '环境要求',
-                dianYuanYaoQiu: '电源要求',
+                chuChangRiQi: '出厂日期',
                 yanShouRiQi: '验收日期',
                 jieShouRiQi: '接收日期',
-                jieShouZhuangTai: '接收时状态(新设备/二手或翻新设备)',
                 qiYongRiQi: '投入日期',
-                shiFouXiaoZhun: '是否校准(是/否)',
                 yiXiaoRiQi: '已校日期',
                 xiaoZhunZQ: '检定/校准周期(以月为单位)',
                 xiaoZhunYouXia: '校准有效期至',
+                shiYongKeShi: '检定/校准单位',
+                ceLiangGongZuo: '测量/工作范围',
+                huanJingYaoQiu: '环境要求',
+                dianYuanYaoQiu: '电源要求',
+                jieShouZhuangTai: '接收时状态(新设备/二手或翻新设备)',
                 jianDingXiao: '检定/校准参数',
                 zuiDaYunCha: 'U/精确度/最大允差',
                 zhengShuBianHa: '证书编号',
                 xiuZhengZhiXiu: '修正值/修正因子',
-                // wenDuYingYong:'温度应用修正值',
-                // shiDuYingYong:'湿度应用修正值',
-                shiFouWeiHu: '是否维护(是/否)',
+                wenDuYingYong: '温度应用修正值',
+                shiDuYingYong: '湿度应用修正值',
                 biXuDeHuanJin: '核查人',
                 biXuSheShi: '核查日期',
-                weiHuFangShi: '设备分组',
                 heChaXiaoZhun: '使用年限(年)'
             },
             projectColums: {
@@ -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,10 @@ 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)
+                if (this.stateList[item.sheBeiZhuangTa]) {
+                    item.sheBeiZhuangTa = this.stateList[item.sheBeiZhuangTa]
+                }
             }
             return exportData
         },
@@ -977,6 +984,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 +1306,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 = ''
+                }
             })
         },
         /**
@@ -1363,7 +1386,11 @@ export default {
             let importData = this.switchDeviceObj(data, this.deviceColumns)
             importData.forEach(i => {
                 delete i.sheBeiShiBieH // 设备编号需自动生成
-                i.sheBeiZhuangTa = '合格'
+                // i.sheBeiZhuangTa = '合格'
+                const keyFound = Object.entries(this.stateList).find(([key, value]) => value === i.sheBeiZhuangTa)
+                if (keyFound) {
+                    i.sheBeiZhuangTa = keyFound[0]
+                }
             })
             const currentPosition = this.level
             const { userList = [], deptList = [] } = this.$store.getters || {}