|
|
@@ -28,7 +28,7 @@
|
|
|
v-model="row.bianZhiBuMen"
|
|
|
type="position"
|
|
|
readonly-text="text"
|
|
|
- :multiple="true"
|
|
|
+ :multiple="false"
|
|
|
:disabled="true"
|
|
|
/>
|
|
|
|
|
|
@@ -69,7 +69,13 @@
|
|
|
slot="deviceStateSlot"
|
|
|
slot-scope="{row}"
|
|
|
>
|
|
|
- <span>{{ stateList[row.sheBeiZhuangTa] || row.sheBeiZhuangTa }}</span>
|
|
|
+ <span>{{ stateList[row.sheBeiZhuangTa] || row.sheBeiZhuangTa || '' }}</span>
|
|
|
+ </template>
|
|
|
+ <template
|
|
|
+ slot="deviceTypeSlot"
|
|
|
+ slot-scope="{row}"
|
|
|
+ >
|
|
|
+ <span>{{ typeList[row.sheBeiLeiXing] || row.sheBeiLeiXing || '' }}</span>
|
|
|
</template>
|
|
|
|
|
|
<template
|
|
|
@@ -94,7 +100,7 @@
|
|
|
slot="customButton"
|
|
|
slot-scope="{row}"
|
|
|
>
|
|
|
- <el-button type="text" icon="el-icon-edit-outline" @click="goEdit(row)">修改</el-button>
|
|
|
+ <el-button type="text" :icon="hasRole?'el-icon-edit-outline':'ibps-icon-eye'" @click="goEdit(row)">{{ hasRole?'修改':'查阅' }}</el-button>
|
|
|
<!-- <el-button type="text" icon="el-icon-view" @click="goLook(row)">查阅</el-button> -->
|
|
|
<el-button type="text" icon="ibps-icon-table" @click="goLookForm(row)">表单</el-button>
|
|
|
|
|
|
@@ -262,10 +268,10 @@
|
|
|
<template slot="deviceType">
|
|
|
<el-select v-model="search.deviceType" placeholder="请选择" size="mini" :clearable="true">
|
|
|
<el-option
|
|
|
- v-for="item in ['检验系统','通用设备','软件','信息系统']"
|
|
|
- :key="item"
|
|
|
- :label="item"
|
|
|
- :value="item"
|
|
|
+ v-for="(v,k) in typeList"
|
|
|
+ :key="k"
|
|
|
+ :label="v"
|
|
|
+ :value="k"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
@@ -309,7 +315,16 @@
|
|
|
</ibps-crud>
|
|
|
</template>
|
|
|
</ibps-container>
|
|
|
- <DeviceDialog v-if="deviceDialogShow" :params="params" :state-list="stateList" @close="close" />
|
|
|
+ <DeviceDialog
|
|
|
+ v-if="deviceDialogShow"
|
|
|
+ :params="params"
|
|
|
+ :state-list="stateList"
|
|
|
+ :type-list="typeList"
|
|
|
+ :tab-list="tabList"
|
|
|
+ :hide-sys-device-no="hideSysDeviceNo"
|
|
|
+ :readonly="!hasRole"
|
|
|
+ @close="close"
|
|
|
+ />
|
|
|
<input id="" ref="file1" type="file" name="" accept=".xlsx,.xls" @change="handleUploadChange1">
|
|
|
<input id="" ref="file2" type="file" name="" accept=".xlsx,.xls" @change="handleUploadChange2">
|
|
|
|
|
|
@@ -349,6 +364,7 @@ import image02 from '@/assets/images/device/02.png'
|
|
|
import image03 from '@/assets/images/device/03.png'
|
|
|
import image04 from '@/assets/images/device/04.png'
|
|
|
import { getImage } from '@/api/platform/file/attachment'
|
|
|
+import { download } from '@/api/platform/file/attachment'
|
|
|
|
|
|
import xlsx from 'xlsx'
|
|
|
import fs from 'file-saver'
|
|
|
@@ -465,7 +481,7 @@ export default {
|
|
|
{ key: 'customExport', label: '导出数据', icon: 'ibps-icon-sign-in', type: 'primary' },
|
|
|
{ key: 'customImport', label: '导入数据', icon: 'ibps-icon-sign-in', type: 'primary' },
|
|
|
{ key: 'customSetting', label: '设置分组配置', icon: 'ibps-icon-cogs', type: 'info' },
|
|
|
- { key: 'customRemove', label: '删除', icon: 'ibps-icon-close', type: 'danger' }
|
|
|
+ { key: 'customRemove', label: '删除', icon: 'ibps-icon-close', type: 'danger', hidden: () => { return !this.hasRole } }
|
|
|
],
|
|
|
// 查询条件
|
|
|
searchForm: {
|
|
|
@@ -491,7 +507,7 @@ export default {
|
|
|
{ prop: 'sheBeiShiBieH', label: '设备编号', sortable: true },
|
|
|
{ prop: 'yuanSheBeiBian', label: '原设备编号', sortable: true },
|
|
|
{ prop: 'sheBeiMingCheng', label: '设备名称', sortable: true },
|
|
|
- { prop: 'sheBeiLeiXing', label: '设备类型', sortable: true },
|
|
|
+ { prop: 'sheBeiLeiXing', label: '设备类型', sortable: true, slotName: 'deviceTypeSlot' },
|
|
|
{ prop: 'guiGeXingHao', label: '规格型号', sortable: true },
|
|
|
{ prop: 'sheBeiZhuangTa', label: '设备状态', sortable: true, slotName: 'deviceStateSlot' },
|
|
|
{ prop: 'guanLiRen', label: '保管人', slotName: 'userSlot', sortable: true },
|
|
|
@@ -509,51 +525,53 @@ export default {
|
|
|
deviceColumns: {
|
|
|
bianZhiBuMen: '部门',
|
|
|
sheBeiMingCheng: '设备名称',
|
|
|
- sheBeiShiBieH: '设备编号(导入无需填写)',
|
|
|
+ // sheBeiShiBieH: '设备编号(导入无需填写)',
|
|
|
yuanSheBeiBian: '原设备编号(必填,且不可重复)',
|
|
|
sheBeiZhuangTa: '设备状态(合格/停用/限用)',
|
|
|
sheBeiLeiXing: '设备类型(检验系统/通用设备/软件/信息系统)',
|
|
|
+ shiFouWeiHu: '是否维护(是/否)',
|
|
|
+ shiFouXiaoZhun: '是否校准(是/否)',
|
|
|
+ weiHuFangShi: '设备分组',
|
|
|
guiGeXingHao: '规格型号',
|
|
|
- cunFangDiDian: '存放地点',
|
|
|
+ cunFangDiDian: '存放地点(格式:房间号+空格+房间名)',
|
|
|
guanLiRen: '保管人',
|
|
|
ziChanBianHao: '资产编号',
|
|
|
+ ziChanYuanZhi: '资产原值(元)',
|
|
|
gongYingShang: '供应商',
|
|
|
lianXiFangShi: '联系方式',
|
|
|
changShang: '厂商',
|
|
|
- chuChangRiQi: '出厂日期',
|
|
|
jiShenXuHao: '机身序号',
|
|
|
zhuCeZhengHao: '注册证号',
|
|
|
- ceLiangGongZuo: '测量范围',
|
|
|
- huanJingYaoQiu: '环境要求',
|
|
|
- dianYuanYaoQiu: '电源要求',
|
|
|
+ heChaXiaoZhun: '使用年限(年)',
|
|
|
+ chuChangRiQi: '出厂日期',
|
|
|
yanShouRiQi: '验收日期',
|
|
|
jieShouRiQi: '接收日期',
|
|
|
- jieShouZhuangTai: '接收时状态(新设备/二手或翻新设备)',
|
|
|
qiYongRiQi: '投入日期',
|
|
|
- shiFouXiaoZhun: '是否校准(是/否)',
|
|
|
yiXiaoRiQi: '已校日期',
|
|
|
xiaoZhunZQ: '检定/校准周期(以月为单位)',
|
|
|
xiaoZhunYouXia: '校准有效期至',
|
|
|
+ shiYongKeShi: '检定/校准单位',
|
|
|
+ ceLiangGongZuo: '测量/工作范围',
|
|
|
+ huanJingYaoQiu: '环境要求',
|
|
|
+ dianYuanYaoQiu: '电源要求',
|
|
|
+ jieShouZhuangTai: '接收时状态(新设备/二手或翻新设备)',
|
|
|
jianDingXiao: '检定/校准参数',
|
|
|
zuiDaYunCha: 'U/精确度/最大允差',
|
|
|
zhengShuBianHa: '证书编号',
|
|
|
xiuZhengZhiXiu: '修正值/修正因子',
|
|
|
- // wenDuYingYong:'温度应用修正值',
|
|
|
- // shiDuYingYong:'湿度应用修正值',
|
|
|
- shiFouWeiHu: '是否维护(是/否)',
|
|
|
- biXuDeHuanJin: '核查人',
|
|
|
- biXuSheShi: '核查日期',
|
|
|
- weiHuFangShi: '设备分组',
|
|
|
- heChaXiaoZhun: '使用年限(年)'
|
|
|
+ wenDuYingYong: '温度应用修正值',
|
|
|
+ shiDuYingYong: '湿度应用修正值'
|
|
|
+ // biXuDeHuanJin: '核查人',
|
|
|
+ // biXuSheShi: '核查日期',
|
|
|
},
|
|
|
projectColums: {
|
|
|
- yuanSheBeiBian: '设备编号*',
|
|
|
+ yuanSheBeiBian: '原设备编号*',
|
|
|
sheBeiMingCheng: '设备名称*',
|
|
|
weiHuLeiXing: '维护类型*(日保养/周保养/月保养/季度保养/半年保养/年保养/按需保养)',
|
|
|
weiHuRiQi: '维护日期*',
|
|
|
weiHuXiangMuC: '维护项目*'
|
|
|
},
|
|
|
- dateFieldRange: ['chuChangRiQi', 'yanShouRiQi', 'jieShouRiQi', 'qiYongRiQi', 'yiXiaoRiQi', 'xiaoZhunYouXia', 'biXuSheShi'],
|
|
|
+ dateFieldRange: ['chuChangRiQi', 'yanShouRiQi', 'jieShouRiQi', 'qiYongRiQi', 'yiXiaoRiQi', 'xiaoZhunYouXia'],
|
|
|
requiredFieldMap: {
|
|
|
bianZhiBuMen: '部门',
|
|
|
sheBeiMingCheng: '设备名称',
|
|
|
@@ -569,8 +587,8 @@ export default {
|
|
|
'jieShouRiQi': '接收日期',
|
|
|
'qiYongRiQi': '投入日期',
|
|
|
'yiXiaoRiQi': '已校日期',
|
|
|
- 'xiaoZhunYouXia': '校准有效期至',
|
|
|
- 'biXuSheShi': '核查日期'
|
|
|
+ 'xiaoZhunYouXia': '校准有效期至'
|
|
|
+ // 'biXuSheShi': '核查日期'
|
|
|
},
|
|
|
validationRules: {
|
|
|
'设备状态': {
|
|
|
@@ -596,7 +614,8 @@ export default {
|
|
|
},
|
|
|
numberFieldsMap: {
|
|
|
'xiaoZhunZQ': '检定/校准周期(以月为单位)',
|
|
|
- 'heChaXiaoZhun': '使用年限(年)'
|
|
|
+ 'heChaXiaoZhun': '使用年限(年)',
|
|
|
+ 'ziChanYuanZhi': '资产原值(元)'
|
|
|
},
|
|
|
maintenanceRequiredFieldMap: {
|
|
|
yuanSheBeiBian: '原设备编号',
|
|
|
@@ -620,15 +639,41 @@ export default {
|
|
|
'年保养': this.generateRule(12, `每年第`, `个月`),
|
|
|
'按需保养': ['/']
|
|
|
},
|
|
|
- stateList: { '停用': '停用', '报废': '报废', '合格': '合格' }
|
|
|
+ stateList: { '停用': '停用', '报废': '报废', '合格': '合格' },
|
|
|
+ hideSysDeviceNo: false,
|
|
|
+ tabList: {},
|
|
|
+ hasRole: true,
|
|
|
+ typeList: { '检验系统': '检验系统', '通用设备': '通用设备', '软件': '软件', '信息系统': '信息系统' }
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
- const stateList = await getSetting('device', 'stateList')
|
|
|
+ const { stateList, hideSysDeviceNo, tabList, hasDeviceRole, typeList } = await getSetting('device') || {}
|
|
|
+ if (hasDeviceRole) {
|
|
|
+ console.debug('hasDeviceRole', hasDeviceRole)
|
|
|
+ const { role, isSuper } = this.$store.getters || {}
|
|
|
+ this.hasRole = isSuper || role.some(r => hasDeviceRole.includes(r.alias))
|
|
|
+ }
|
|
|
if (stateList) {
|
|
|
- console.debug(stateList)
|
|
|
+ console.debug('stateList', stateList)
|
|
|
this.stateList = stateList
|
|
|
}
|
|
|
+ if (typeList) {
|
|
|
+ console.debug('typeList', typeList)
|
|
|
+ this.typeList = typeList
|
|
|
+ }
|
|
|
+ if (hideSysDeviceNo) {
|
|
|
+ this.hideSysDeviceNo = hideSysDeviceNo
|
|
|
+ // 列表隐藏设备编号 将原设备编号改为设备编号
|
|
|
+ this.listConfig.columns = this.listConfig.columns.filter(i => i.prop !== 'sheBeiShiBieH')
|
|
|
+ this.listConfig.columns.find(i => i.prop === 'yuanSheBeiBian').label = '设备编号'
|
|
|
+ // 查询条件隐藏设备编号 将原设备编号改为设备编号
|
|
|
+ this.listConfig.searchForm.forms = this.listConfig.searchForm.forms.filter(i => i.slotName !== 'nowNumber')
|
|
|
+ this.listConfig.searchForm.forms.find(i => i.slotName === 'preNumber').label = '设备编号'
|
|
|
+ }
|
|
|
+ if (tabList) {
|
|
|
+ console.debug('tabList', tabList)
|
|
|
+ this.tabList = tabList
|
|
|
+ }
|
|
|
this.getDatas()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -842,6 +887,7 @@ export default {
|
|
|
this.customDialogVisible = true
|
|
|
},
|
|
|
handleCustomRemove (selection) {
|
|
|
+ if (!this.hasRole) return
|
|
|
console.log('selection', selection)
|
|
|
if (!selection || selection.length === 0) {
|
|
|
return this.$message.warning('请选择要删除的数据!')
|
|
|
@@ -959,14 +1005,23 @@ 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]
|
|
|
item.bianZhiBuMen = this.switchIdToDept(item.bianZhiBuMen.split(',')[0])
|
|
|
item.guanLiRen = this.switchIdToUserName(item.guanLiRen.split(',')[0])
|
|
|
- item.biXuDeHuanJin = this.switchIdToUserName(item.biXuDeHuanJin.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]
|
|
|
+ }
|
|
|
+ if (this.typeList[item.sheBeiLeiXing]) {
|
|
|
+ item.sheBeiLeiXing = this.typeList[item.sheBeiLeiXing]
|
|
|
+ }
|
|
|
}
|
|
|
return exportData
|
|
|
},
|
|
|
@@ -977,6 +1032,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
|
|
|
@@ -1015,8 +1075,25 @@ export default {
|
|
|
const sql = `select b.yuan_she_bei_bian as yuanSheBeiBian,b.she_bei_ming_cheng_ as sheBeiMingCheng,a.parent_id_,a.wei_hu_xiang_mu_c as weiHuXiangMuC,a.wei_hu_ri_qi_ as weiHuRiQi,a.wei_hu_lei_xing_ as weiHuLeiXing,a.ri_qi_shu_zi_ as riQiShuZi from t_whzqjxm a,t_sbdj b where a.parent_id_=b.id_ and a.parent_id_ in (${selection.map(i => `'${i}'`).join(',')})`
|
|
|
const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
exportData = data
|
|
|
+ this.xlsx(exportData, this.projectColums, '设备维护项目数据' + this.getTimeStamp())
|
|
|
+ } else {
|
|
|
+ const attachmentId = 'device_maintainProject'
|
|
|
+ const res = await download({ attachmentId })
|
|
|
+ // 判断 ArrayBuffer 的大小,主要用于兼容没有文件的情况
|
|
|
+ if (res.data?.byteLength === 0) {
|
|
|
+ this.xlsx([], this.projectColums, '设备维护项目模板' + this.getTimeStamp())
|
|
|
+ } else {
|
|
|
+ // const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.style.display = 'none'
|
|
|
+ // a.href = URL.createObjectURL(blob)
|
|
|
+ a.href = res.request.responseURL
|
|
|
+ // a.download = '设备维护项目导入模板'
|
|
|
+ document.body.appendChild(a)
|
|
|
+ a.click()
|
|
|
+ document.body.removeChild(a)
|
|
|
+ }
|
|
|
}
|
|
|
- this.xlsx(exportData, this.projectColums, '设备维护项目数据' + this.getTimeStamp())
|
|
|
this.$message.success('导出维护项目成功!')
|
|
|
},
|
|
|
// value 转 key
|
|
|
@@ -1294,6 +1371,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 = ''
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -1332,17 +1420,17 @@ export default {
|
|
|
element.guanLiRen = ''
|
|
|
}
|
|
|
// 处理核查人
|
|
|
- if (element.biXuDeHuanJin !== '') {
|
|
|
- const checkPerson = employeeList.find(i => i.userName === element.biXuDeHuanJin.trim())
|
|
|
- if (checkPerson) {
|
|
|
- const checkPersonId = checkPerson.userId
|
|
|
- element.biXuDeHuanJin = checkPersonId
|
|
|
- } else {
|
|
|
- element.biXuDeHuanJin = ''
|
|
|
- }
|
|
|
- } else {
|
|
|
- element.biXuDeHuanJin = ''
|
|
|
- }
|
|
|
+ // if (element.biXuDeHuanJin !== '') {
|
|
|
+ // const checkPerson = employeeList.find(i => i.userName === element.biXuDeHuanJin.trim())
|
|
|
+ // if (checkPerson) {
|
|
|
+ // const checkPersonId = checkPerson.userId
|
|
|
+ // element.biXuDeHuanJin = checkPersonId
|
|
|
+ // } else {
|
|
|
+ // element.biXuDeHuanJin = ''
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // element.biXuDeHuanJin = ''
|
|
|
+ // }
|
|
|
})
|
|
|
},
|
|
|
handleDeviceGroupInfo (list, deviceGroupList) {
|
|
|
@@ -1363,7 +1451,15 @@ 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 keyFound2 = Object.entries(this.typeList).find(([key, value]) => value === i.sheBeiLeiXing)
|
|
|
+ if (keyFound2) {
|
|
|
+ i.sheBeiLeiXing = keyFound2[0]
|
|
|
+ }
|
|
|
})
|
|
|
const currentPosition = this.level
|
|
|
const { userList = [], deptList = [] } = this.$store.getters || {}
|
|
|
@@ -1371,7 +1467,7 @@ export default {
|
|
|
const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb where di_dian_ = ${currentPosition}` // 供应商信息
|
|
|
const deviceGroupSql = `select id_,suo_shu_bu_men_,wei_hu_gang_wei_ from t_sbwhgwpzb where di_dian_ = ${currentPosition}` // 设备分组信息
|
|
|
const currentTime = dayjs().format('YYYY-MM-DD HH:mm')
|
|
|
- const currentApartment = this.$store.getters.userInfo.employee.positions
|
|
|
+ const currentApartment = this.$store.getters.userInfo.employee.positions.split(',').at(-1) || ''
|
|
|
const currentUser = this.userId
|
|
|
|
|
|
const partOneInvalidResult = this.deviceInvalidPartOne(importData)
|