Browse Source

校正记录

master
han\hanst 3 weeks ago
parent
commit
ccb94f7ab1
  1. 6
      src/api/eam/eam_object_list.js
  2. 106
      src/views/modules/eam/com_eam_object_add_update.vue
  3. 770
      src/views/modules/eam/eam_device_list.vue

6
src/api/eam/eam_object_list.js

@ -22,6 +22,12 @@ export const getHistoryOrderList = data => createAPI('pms/eamObject/getHistoryOr
export const getFaultBehaviorList = data => createAPI('pms/eamObject/getFaultBehaviorList','post',data)
/*删除当前设备*/
export const deleteEamObject = data => createAPI('pms/eamObject/deleteEamObject','post',data)
/*查询设备校正记录*/
export const getCalibrationRecordList = data => createAPI('pms/eamObject/getCalibrationRecordList','post',data)
/*新增/修改设备校正记录*/
export const saveCalibrationRecord = data => createAPI('pms/eamObject/saveCalibrationRecord','post',data)
/*删除设备校正记录*/
export const deleteCalibrationRecord = data => createAPI('pms/eamObject/deleteCalibrationRecord','post',data)
/*图片上传*/
export const uploadEamObjectFile = data => createAPI('/sys/file/upload','post',data)

106
src/views/modules/eam/com_eam_object_add_update.vue

@ -17,10 +17,13 @@
</el-select>
</el-form-item>
<el-form-item label="设备编码" prop="objectID" :rules="rules.objectIdType">
<el-input v-model="pageData.objectID" style="width: 120px"></el-input>
<el-input v-model="pageData.objectID" style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="设备名称" prop="objectDesc" :rules="rules.objectDesc" style="margin-left: -10px">
<el-input v-model="pageData.objectDesc" style="width: 300px"></el-input>
<el-input v-model="pageData.objectDesc" style="width: 185px"></el-input>
</el-form-item>
<el-form-item label="设备型号" >
<el-input v-model="pageData.modelNo" style="width: 100px;"></el-input>
</el-form-item>
<el-form-item label="序列号" style="margin-left: -10px">
<el-input v-model="pageData.seqNo" style="width: 163px;"></el-input>
@ -112,6 +115,30 @@
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.timeOutMaintenanceDuration" style="width: 137px;"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="pageData" style="margin-left: 7px" v-if="isOutsourceCalibrationDevice">
<el-form-item label="是否启用校正">
<el-select v-model="pageData.calibrationEnableFlag" style="width: 120px;">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item label="校正周期(天)" style="margin-left: -10px">
<el-input-number
:controls="false"
:step="1"
:min="1"
:disabled="pageData.calibrationEnableFlag !== 'Y'"
v-model="pageData.calibrationPeriod"
style="width: 120px;">
</el-input-number>
</el-form-item>
<el-form-item label="上一次校正日期" style="margin-left: -10px">
<el-input :value="formatDateValue(pageData.lastCalibrationDate)" disabled style="width: 170px;"></el-input>
</el-form-item>
<el-form-item label="预计下一次校正日期" style="margin-left: -10px">
<el-input :value="formatDateValue(pageData.nextCalibrationDate)" disabled style="width: 170px;"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="pageData" v-if="this.pageData.addFlag == 'N'" style="margin-left: 7px">
<el-form-item label="设备负责人" >
<span slot="label" @click="addDeviceManager()"><a herf="#">设备负责人</a></span>
@ -253,6 +280,7 @@ export default {
deptID: '',
deptName: '',
assetNo: '',
modelNo: '',
assetRemark: '',
standardMaintenanceDuration: '',
timeOutMaintenanceDuration: '',
@ -260,7 +288,11 @@ export default {
timeOutResponseDuration: '',
cycleTimeSend: undefined,
mesType: '',
mesTypeList: []
mesTypeList: [],
calibrationEnableFlag: 'N',
calibrationPeriod: undefined,
lastCalibrationDate: '',
nextCalibrationDate: ''
},
dataListLoading: false,
rules:{
@ -325,6 +357,12 @@ export default {
modalDisableFlag: false,
}
},
computed: {
//
isOutsourceCalibrationDevice () {
return this.pageData.familyDesc != null && this.pageData.familyDesc.indexOf('委外校正设备') !== -1
}
},
methods: {
// bu
getSiteAndBuByUserName () {
@ -337,6 +375,38 @@ export default {
}
})
},
//
handleCalibrationFamilyChange () {
if (!this.isOutsourceCalibrationDevice) {
this.pageData.calibrationEnableFlag = 'N'
this.pageData.calibrationPeriod = undefined
this.pageData.lastCalibrationDate = ''
this.pageData.nextCalibrationDate = ''
return
}
if (this.pageData.calibrationEnableFlag !== 'Y') {
this.pageData.calibrationEnableFlag = 'N'
}
if (this.pageData.calibrationEnableFlag !== 'Y') {
this.pageData.calibrationPeriod = undefined
}
},
//
formatDateValue (value) {
if (value == null || value === '') {
return ''
}
if (this.dayjs) {
return this.dayjs(value).format('YYYY-MM-DD')
}
let date = new Date(value)
if (isNaN(date.getTime())) {
return value
}
let month = (date.getMonth() + 1 + '').padStart(2, '0')
let day = (date.getDate() + '').padStart(2, '0')
return `${date.getFullYear()}-${month}-${day}`
},
addDeviceManager(){
this.detailData.bu = this.pageData.bu
//
@ -385,18 +455,25 @@ export default {
init (currentRow) {
//
this.pageData = JSON.parse(JSON.stringify(currentRow))
this.pageData.calibrationEnableFlag = this.pageData.calibrationEnableFlag === 'Y' ? 'Y' : 'N'
this.pageData.calibrationPeriod = this.pageData.calibrationPeriod == null || this.pageData.calibrationPeriod === '' ? undefined : Number(this.pageData.calibrationPeriod)
this.pageData.lastCalibrationDate = this.pageData.lastCalibrationDate || ''
this.pageData.nextCalibrationDate = this.pageData.nextCalibrationDate || ''
//
this.visible = true
//
if (this.pageData.addFlag === 'Y') {
this.modalDisableFlag = false
this.pageData.bu = this.userBuList[0].buNo
if (this.userBuList.length > 0) {
this.pageData.bu = this.userBuList[0].buNo
}
} else {
this.pageData.bu = this.pageData.site + '_' + this.pageData.buNo
this.modalDisableFlag = true
}
//
this.pageData.username = this.userId
this.handleCalibrationFamilyChange()
},
//
@ -433,6 +510,18 @@ export default {
this.$message.warning("所属部门不能为空!");
return false
}
if (this.isOutsourceCalibrationDevice) {
if (this.pageData.calibrationEnableFlag !== 'Y') {
this.pageData.calibrationEnableFlag = 'N'
this.pageData.calibrationPeriod = undefined
} else if (this.pageData.calibrationPeriod == null || this.pageData.calibrationPeriod === '' || this.pageData.calibrationPeriod <= 0) {
this.$message.warning("启用校正时,校正周期必须大于0天!");
return false
}
} else {
this.pageData.calibrationEnableFlag = 'N'
this.pageData.calibrationPeriod = undefined
}
this.pageData.mesType = this.pageData.mesTypeList.join(',')
for (let i = 0; i < this.pageData.mesType.length; i++) {
if(this.pageData.mesType[i] == 'D'){
@ -511,6 +600,7 @@ export default {
//
this.pageData.familyID = val.FamilyID;
this.$set(this.pageData,'familyDesc',val.FamilyDesc)
this.handleCalibrationFamilyChange()
} else if (this.tagNo === 28) {
//
this.pageData.groupID = val.GroupID;
@ -623,6 +713,14 @@ export default {
this.pageData.manufacturerID = this.pageData.manufacturerID.toUpperCase();
}
},
'pageData.familyDesc': function () {
this.handleCalibrationFamilyChange()
},
'pageData.calibrationEnableFlag': function (newVal) {
if (newVal !== 'Y') {
this.pageData.calibrationPeriod = undefined
}
},
},
created() {
// site bu

770
src/views/modules/eam/eam_device_list.vue

@ -42,6 +42,12 @@
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="'启用校正'">
<el-select v-model="searchData.calibrationEnableFlag" clearable style="width: 80px">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="' '">
<el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
<el-button v-if="!authSave" type="primary" @click="addEamObjectModal()">新增</el-button>
@ -372,6 +378,82 @@
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane v-if="isOutsourceCalibrationDevice" label="校正记录" name="calibration_record">
<el-form :inline="true" label-position="left" class="calibration-record-toolbar" style="margin-top: 5px">
<el-button type="primary" @click="addCalibrationRecordModal()">新增校正记录</el-button>
<span class="calibration-date-inline">
上一次校正日期<span class="calibration-date-value">{{ formatDateValue(currentRow.lastCalibrationDate) || '-' }}</span>
</span>
<span class="calibration-date-inline">
预计下一次校正日期<span class="calibration-date-value">{{ formatDateValue(currentRow.nextCalibrationDate) || '-' }}</span>
</span>
</el-form>
<el-table
:height="330"
:data="calibrationRecordList"
@row-dblclick="openCalibrationAttachmentModal"
border
style="width: 100%;">
<el-table-column
type="index"
header-align="center"
align="center"
width="60"
label="序号">
</el-table-column>
<el-table-column
prop="supplierID"
header-align="center"
align="center"
min-width="120"
label="校正供应商编码">
</el-table-column>
<el-table-column
prop="supplierName"
header-align="center"
align="left"
min-width="180"
label="校正供应商">
</el-table-column>
<el-table-column
prop="calibrationDate"
header-align="center"
align="center"
min-width="120"
label="校正日期">
</el-table-column>
<el-table-column
header-align="center"
align="center"
min-width="110"
label="校验是否合格">
<template slot-scope="scope">
<span
v-if="scope.row.qualifiedFlag === 'Y'"
style="color: #67C23A; font-size: 18px; font-weight: 700; line-height: 1;">
</span>
<span
v-else
style="color: #F56C6C; font-size: 18px; font-weight: 700; line-height: 1;">
</span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
min-width="140"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="updateCalibrationRecordModal(scope.row)">修改</el-link>
<el-link style="cursor: pointer" @click="deleteCalibrationRecordData(scope.row)">删除</el-link>
<el-link style="cursor: pointer" @click="openCalibrationAttachmentModal(scope.row)">附件</el-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<!-- 新增或者修改的modal -->
@ -823,6 +905,144 @@
</el-footer>
</el-dialog>
<el-dialog :title="calibrationRecordModalData.id ? '修改校正记录' : '新增校正记录'" :close-on-click-modal="false" v-drag :visible.sync="calibrationRecordModalFlag" width="560px" @close="closeCalibrationRecordModal">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="设备名称">
<el-input v-model="calibrationRecordModalData.objectDesc" disabled style="width: 250px"></el-input>
</el-form-item>
<el-form-item label="设备编码">
<el-input v-model="calibrationRecordModalData.objectID" disabled style="width: 205px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="校正供应商">
<el-select
v-model="calibrationRecordModalData.supplierID"
filterable
remote
clearable
reserve-keyword
:remote-method="searchCalibrationSupplier"
:loading="calibrationSupplierLoading"
@change="changeCalibrationSupplier"
style="width: 250px">
<el-option
v-for="item in calibrationSupplierList"
:key="item.supplierID"
:label="item.supplierID + ' - ' + item.supplierName"
:value="item.supplierID">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="校正日期">
<el-date-picker
v-model="calibrationRecordModalData.calibrationDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择"
style="width: 120px">
</el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-checkbox v-model="calibrationRecordModalData.qualifiedFlag" :true-label="'Y'" :false-label="'N'">校验合格</el-checkbox>
</el-form-item>
</el-form>
<el-form v-if="!calibrationRecordModalData.id" label-position="top" style="margin: -2px 7px 0 7px;">
<el-form-item label="附件上传(保存时自动上传)">
<el-upload
class="calibration-create-upload"
drag
multiple
:file-list="calibrationCreateAttachmentUploadList"
action="javascript:void(0);"
ref="calibrationCreateAttachmentUpload"
:before-upload="beforeCalibrationAttachmentUpload"
:on-change="changeCalibrationCreateAttachmentUpload"
accept="*"
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-form-item>
</el-form>
<el-footer style="height:40px;margin-top: 120px;text-align:center">
<el-button type="primary" @click="saveCalibrationRecordData()">保存</el-button>
<el-button type="primary" @click="closeCalibrationRecordModal">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="校正记录附件" :close-on-click-modal="false" v-drag :visible.sync="calibrationAttachmentModalFlag" width="600px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="设备编码">
<el-input v-model="calibrationAttachmentModalData.objectID" disabled style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="校正供应商">
<el-input v-model="calibrationAttachmentModalData.supplierName" disabled style="width: 220px"></el-input>
</el-form-item>
<el-form-item label="校正日期">
<el-input :value="formatDateValue(calibrationAttachmentModalData.calibrationDate)" disabled style="width: 120px"></el-input>
</el-form-item>
</el-form>
<div class="calibration-attachment-upload-row">
<el-upload
class="calibration-attachment-upload"
drag
multiple
:file-list="calibrationAttachmentUploadList"
action="javascript:void(0);"
ref="calibrationAttachmentUpload"
:before-upload="beforeCalibrationAttachmentUpload"
:on-change="changeCalibrationAttachmentUpload"
accept="*"
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
<el-button type="primary" class="calibration-upload-btn" @click="saveCalibrationAttachment()">上传附件</el-button>
</div>
<el-table
:height="250"
:data="calibrationAttachmentList"
border
style="width: 100%;">
<el-table-column
prop="fileName"
header-align="center"
align="left"
min-width="220"
label="文件名称">
</el-table-column>
<el-table-column
prop="createdBy"
header-align="center"
align="left"
min-width="70"
label="上传人">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
min-width="120"
label="上传时间">
</el-table-column>
<el-table-column
header-align="center"
align="center"
min-width="120"
label="操作">
<template slot-scope="scope">
<el-link style="cursor:pointer" @click="previewFile(scope.row)">预览</el-link>
<el-link style="cursor:pointer" @click="downloadFile(scope.row)">下载</el-link>
<el-link style="cursor:pointer" @click="deleteCalibrationAttachmentFile(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="calibrationAttachmentModalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
@ -838,6 +1058,9 @@
getHistoryOrderList,
getFaultBehaviorList,
deleteEamObject,
getCalibrationRecordList,
saveCalibrationRecord,
deleteCalibrationRecord,
uploadEamObjectFile,
downLoadObjectFile,
previewOssFileApi
@ -862,7 +1085,8 @@
eamObjectDefectDelete,
deleteObjectFile,
getFamilyTree, //
getSiteAndBuByUserName
getSiteAndBuByUserName,
eamSupplierSearch
} from '@/api/eam/eam.js';
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
import {deleteResourceSpare} from '@/api/partspare/resourcespare.js'
@ -910,6 +1134,7 @@
familyID: '',
familyDesc: '',
active: 'Y',
calibrationEnableFlag: '',
sonId: '',
page: 1,
limit: 10
@ -927,6 +1152,7 @@
maintenancePlanList: [],
historyOrderList: [],
faultBehaviorList: [],
calibrationRecordList: [],
columnFileContentArray: [
{
columnProp: 'fileName',
@ -3296,6 +3522,33 @@
},
objectList: [],
objectSelectionList: [],
calibrationRecordModalFlag: false,
calibrationRecordModalData: {
id: null,
site: '',
buNo: '',
objectID: '',
objectDesc: '',
supplierID: '',
supplierName: '',
calibrationDate: '',
qualifiedFlag: 'Y',
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
},
calibrationSupplierList: [],
calibrationSupplierLoading: false,
calibrationAttachmentModalFlag: false,
calibrationAttachmentModalData: {
id: '',
site: '',
objectID: '',
supplierName: '',
calibrationDate: '',
},
calibrationCreateAttachmentUploadList: [],
calibrationAttachmentUploadList: [],
calibrationAttachmentList: [],
defectModalFlag: false,
defectModalData: {
flag: '',
@ -3328,6 +3581,13 @@
Chooselist,
},
computed: {
//
isOutsourceCalibrationDevice () {
return this.currentRow.familyDesc != null && this.currentRow.familyDesc.indexOf('委外校正设备') !== -1
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight / 2 - 10
@ -3429,6 +3689,413 @@
}
},
//
formatDateValue (value) {
if (value == null || value === '') {
return ''
}
if (this.dayjs) {
return this.dayjs(value).format('YYYY-MM-DD')
}
let date = new Date(value)
if (isNaN(date.getTime())) {
return value
}
let month = (date.getMonth() + 1 + '').padStart(2, '0')
let day = (date.getDate() + '').padStart(2, '0')
return `${date.getFullYear()}-${month}-${day}`
},
//
getCalibrationRecordData () {
if (!this.currentRow.objectID || !this.isOutsourceCalibrationDevice) {
this.calibrationRecordList = []
return
}
let inData = {
site: this.currentRow.site,
buNo: this.currentRow.buNo,
objectID: this.currentRow.objectID,
}
getCalibrationRecordList(inData).then(({data}) => {
if (data && data.code === 0) {
this.calibrationRecordList = data.rows || []
} else {
this.calibrationRecordList = []
}
}).catch(() => {
this.calibrationRecordList = []
})
},
//
addCalibrationRecordModal () {
if (!this.currentRow.objectID) {
this.$message.warning('请先选择设备!')
return
}
this.calibrationRecordModalData = {
id: null,
site: this.currentRow.site,
buNo: this.currentRow.buNo,
objectID: this.currentRow.objectID,
objectDesc: this.currentRow.objectDesc,
supplierID: '',
supplierName: '',
calibrationDate: '',
qualifiedFlag: 'Y',
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
}
this.calibrationCreateAttachmentUploadList = []
this.$nextTick(() => {
if (this.$refs.calibrationCreateAttachmentUpload) {
this.$refs.calibrationCreateAttachmentUpload.clearFiles()
}
})
this.calibrationSupplierList = []
this.searchCalibrationSupplier('')
this.calibrationRecordModalFlag = true
},
//
updateCalibrationRecordModal (row) {
this.calibrationRecordModalData = {
...row,
objectDesc: this.currentRow.objectDesc,
calibrationDate: this.formatDateValue(row.calibrationDate),
qualifiedFlag: row.qualifiedFlag === 'Y' ? 'Y' : 'N',
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
}
this.calibrationCreateAttachmentUploadList = []
this.calibrationSupplierList = row.supplierID ? [{
supplierID: row.supplierID,
supplierName: row.supplierName,
}] : []
this.searchCalibrationSupplier(row.supplierName || '')
this.calibrationRecordModalFlag = true
},
//
closeCalibrationRecordModal () {
this.calibrationRecordModalFlag = false
this.calibrationCreateAttachmentUploadList = []
this.$nextTick(() => {
if (this.$refs.calibrationCreateAttachmentUpload) {
this.$refs.calibrationCreateAttachmentUpload.clearFiles()
}
})
},
//
changeCalibrationCreateAttachmentUpload (file, fileList) {
this.calibrationCreateAttachmentUploadList = fileList
},
// ID
uploadCalibrationAttachmentById (recordId, site, objectID, uploadFileList) {
const formData = new FormData()
for (let i = 0; i < uploadFileList.length; i++) {
formData.append("file", uploadFileList[i].raw)
}
formData.append("folder", 'eamObject')
formData.append("site", site)
formData.append("objectID", String(recordId))
formData.append("orderRef3", 'eamCalibrationRecord')
formData.append("orderRef4", objectID)
return uploadEamObjectFile(formData)
},
// ID
getSavedCalibrationRecordId (inData) {
let queryData = {
site: inData.site,
buNo: inData.buNo,
objectID: inData.objectID,
}
return getCalibrationRecordList(queryData).then(({data}) => {
if (!data || data.code !== 0 || !data.rows || data.rows.length === 0) {
return null
}
const targetDate = this.formatDateValue(inData.calibrationDate)
const targetQualifiedFlag = inData.qualifiedFlag === 'Y' ? 'Y' : 'N'
const targetRow = data.rows.find(item => {
return item.supplierID === inData.supplierID &&
this.formatDateValue(item.calibrationDate) === targetDate &&
(item.qualifiedFlag === 'Y' ? 'Y' : 'N') === targetQualifiedFlag &&
(!inData.createBy || item.createBy === inData.createBy)
})
return targetRow && targetRow.id ? targetRow.id : null
}).catch(() => {
return null
})
},
//
async searchCalibrationSupplier (query) {
if (!this.currentRow.site) {
this.calibrationSupplierList = []
return
}
this.calibrationSupplierLoading = true
let baseData = {
site: this.currentRow.site,
buDesc: this.currentRow.buDesc,
userName: this.$store.state.user.name,
active: 'Y',
page: 1,
limit: 20,
supplierID: '',
supplierName: '',
}
try {
let requestList = []
if (query != null && query !== '') {
requestList.push(eamSupplierSearch({
...baseData,
supplierID: query,
}))
requestList.push(eamSupplierSearch({
...baseData,
supplierName: query,
}))
} else {
requestList.push(eamSupplierSearch(baseData))
}
let responseList = await Promise.all(requestList)
let supplierList = []
responseList.forEach(({data}) => {
if (data && data.code === 0 && data.page) {
supplierList = supplierList.concat(data.page.list || [])
}
})
let supplierMap = {}
this.calibrationSupplierList = supplierList.filter(item => {
if (!item.supplierID) {
return false
}
if (supplierMap[item.supplierID]) {
return false
}
supplierMap[item.supplierID] = true
return true
})
} finally {
this.calibrationSupplierLoading = false
}
},
//
changeCalibrationSupplier (supplierID) {
if (!supplierID) {
this.calibrationRecordModalData.supplierName = ''
return
}
let chooseData = this.calibrationSupplierList.find(item => item.supplierID === supplierID)
this.calibrationRecordModalData.supplierName = chooseData ? chooseData.supplierName : this.calibrationRecordModalData.supplierName
},
//
saveCalibrationRecordData () {
if (!this.calibrationRecordModalData.supplierID) {
this.$message.warning('请选择校正供应商!')
return
}
if (!this.calibrationRecordModalData.calibrationDate) {
this.$message.warning('请选择校正日期!')
return
}
let inData = {
id: this.calibrationRecordModalData.id ? this.calibrationRecordModalData.id : null,
site: this.currentRow.site,
buNo: this.currentRow.buNo,
objectID: this.currentRow.objectID,
supplierID: this.calibrationRecordModalData.supplierID,
supplierName: this.calibrationRecordModalData.supplierName,
calibrationDate: this.calibrationRecordModalData.calibrationDate,
qualifiedFlag: this.calibrationRecordModalData.qualifiedFlag === 'Y' ? 'Y' : 'N',
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
}
let isAddMode = !inData.id
const uploadFileList = this.calibrationCreateAttachmentUploadList ? this.calibrationCreateAttachmentUploadList.slice() : []
saveCalibrationRecord(inData).then(({data}) => {
if (data && data.code === 0) {
let savedRecordId = data.id || inData.id
//
if (isAddMode && uploadFileList.length > 0) {
const uploadWithRecordId = (recordId) => {
this.uploadCalibrationAttachmentById(recordId, inData.site, inData.objectID, uploadFileList).then(({data: uploadData}) => {
if (uploadData && uploadData.code === 0) {
this.$message.success('校正记录与附件保存成功')
} else {
this.$message.error(uploadData.msg || '校正记录已保存,但附件上传失败')
}
this.getCalibrationRecordData()
this.closeCalibrationRecordModal()
}).catch(() => {
this.$message.error('校正记录已保存,但附件上传异常')
this.getCalibrationRecordData()
this.closeCalibrationRecordModal()
})
}
if (savedRecordId) {
uploadWithRecordId(savedRecordId)
return
}
this.getSavedCalibrationRecordId(inData).then((fallbackRecordId) => {
if (!fallbackRecordId) {
this.$message.error('校正记录已保存,但未获取到记录ID,附件未上传')
this.getCalibrationRecordData()
this.closeCalibrationRecordModal()
return
}
uploadWithRecordId(fallbackRecordId)
})
return
}
this.getCalibrationRecordData()
this.closeCalibrationRecordModal()
this.$message.success(data.msg || '操作成功')
} else {
this.$alert(data.msg || '保存失败', '错误', {
confirmButtonText: '确定'
})
}
})
},
//
deleteCalibrationRecordData (row) {
this.$confirm('是否删除该校正记录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCalibrationRecord({
id: row.id,
site: row.site,
}).then(({data}) => {
if (data && data.code === 0) {
if (this.calibrationAttachmentModalData.id === row.id) {
this.calibrationAttachmentModalFlag = false
}
this.getCalibrationRecordData()
this.$message.success(data.msg || '操作成功')
} else {
this.$alert(data.msg || '删除失败', '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
//
openCalibrationAttachmentModal (row) {
this.calibrationAttachmentModalData = {
id: row.id,
site: row.site,
objectID: row.objectID,
supplierName: row.supplierName,
calibrationDate: row.calibrationDate,
}
this.calibrationAttachmentUploadList = []
this.calibrationAttachmentModalFlag = true
this.$nextTick(() => {
if (this.$refs.calibrationAttachmentUpload) {
this.$refs.calibrationAttachmentUpload.clearFiles()
}
})
this.getCalibrationAttachmentList()
},
beforeCalibrationAttachmentUpload () {},
//
changeCalibrationAttachmentUpload (file, fileList) {
this.calibrationAttachmentUploadList = fileList
},
//
saveCalibrationAttachment () {
if (!this.calibrationAttachmentModalData.id) {
this.$message.warning('请先选择校正记录!')
return
}
if (!this.calibrationAttachmentUploadList || this.calibrationAttachmentUploadList.length === 0) {
this.$message.warning('请先上传附件!')
return
}
const formData = new FormData()
for (let i = 0; i < this.calibrationAttachmentUploadList.length; i++) {
formData.append("file", this.calibrationAttachmentUploadList[i].raw)
}
formData.append("folder", 'eamObject')
formData.append("site", this.calibrationAttachmentModalData.site)
formData.append("objectID", this.calibrationAttachmentModalData.id)
formData.append("orderRef3", 'eamCalibrationRecord')
formData.append("orderRef4", this.calibrationAttachmentModalData.objectID)
uploadEamObjectFile(formData).then(({data}) => {
if (data && data.code === 0) {
this.$message.success(data.msg || '上传成功')
this.calibrationAttachmentUploadList = []
if (this.$refs.calibrationAttachmentUpload) {
this.$refs.calibrationAttachmentUpload.clearFiles()
}
this.getCalibrationAttachmentList()
} else {
this.$message.error(data.msg || '上传失败')
}
})
},
//
getCalibrationAttachmentList () {
if (!this.calibrationAttachmentModalData.id) {
this.calibrationAttachmentList = []
return
}
let inData = {
orderRef1: this.calibrationAttachmentModalData.site,
orderRef2: this.calibrationAttachmentModalData.id + '',
orderRef3: 'eamCalibrationRecord',
orderRef4: this.calibrationAttachmentModalData.objectID,
}
getFileContentList(inData).then(({data}) => {
if (data && data.code === 200) {
this.calibrationAttachmentList = data.rows || []
} else {
this.calibrationAttachmentList = []
}
}).catch(() => {
this.calibrationAttachmentList = []
})
},
//
deleteCalibrationAttachmentFile (row) {
this.$confirm('确定要删除此文件?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteObjectFile(row).then(({data}) => {
if (data && data.code === 0) {
this.getCalibrationAttachmentList()
this.$message.success(data.msg || '操作成功')
} else {
this.$alert(data.msg || '删除失败', '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
async exportExcel() {
this.searchData.limit = -1
this.searchData.page = 1
@ -3644,6 +4311,8 @@
}
else if (this.activeTable === 'device_part') {
this.getDevicePartData()
} else if (this.activeTable === 'calibration_record') {
this.getCalibrationRecordData()
}
// else if (this.activeTable === 'check_item') {
// this.getCheckItemData()
@ -3790,6 +4459,7 @@
addFlag: 'Y',
deptID: '',
assetNo: '',
modelNo: '',
assetRemark: '',
deptName: '',
standardMaintenanceDuration: '',
@ -3798,7 +4468,11 @@
timeOutResponseDuration: '',
cycleTimeSend: undefined,
mesType: '',
mesTypeList: []
mesTypeList: [],
calibrationEnableFlag: 'N',
calibrationPeriod: undefined,
lastCalibrationDate: '',
nextCalibrationDate: '',
}
//
this.$nextTick(() => {
@ -3831,6 +4505,10 @@
mesType: row.mesType,
mesTypeList: row.mesType == null || row.mesType === '' ? [] : row.mesType.split(','),
cycleTimeSend: row.cycleTimeSend == null || row.cycleTimeSend === '' ? undefined : row.cycleTimeSend,
calibrationEnableFlag: row.calibrationEnableFlag === 'Y' ? 'Y' : 'N',
calibrationPeriod: row.calibrationPeriod == null || row.calibrationPeriod === '' ? undefined : Number(row.calibrationPeriod),
lastCalibrationDate: row.lastCalibrationDate || '',
nextCalibrationDate: row.nextCalibrationDate || '',
}
//
this.$nextTick(() => {
@ -3874,6 +4552,12 @@
//
if (row) {
this.currentRow = JSON.parse(JSON.stringify(row))
if (!this.isOutsourceCalibrationDevice) {
this.calibrationRecordList = []
if (this.activeTable === 'calibration_record') {
this.activeTable = 'file_content'
}
}
this.eamObjectId = row.objectID
this.uploadUrl = this.$http.adornUrl(`/api/sys/file/upload?token=${this.$cookie.get('token')}&folder=` + this.folder + `&objectId=` + this.eamObjectId)
//
@ -4669,26 +5353,82 @@ padding: 0px !important;
line-height: 20px;
}
/*修改上传框的样式*/
/deep/ .customer-upload .el-upload-dragger {
background-color: #fff;
.calibration-attachment-upload-row{
display: grid;
grid-template-columns: 350px 120px;
column-gap: 18px;
align-items: end;
margin: -2px 7px 8px 7px;
}
.calibration-attachment-upload {
width: 353px;
}
/deep/ .calibration-attachment-upload .el-upload {
display: block;
width: 100%;
}
/deep/ .calibration-attachment-upload .el-upload-dragger {
width: 100%;
height: 52px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-left: 10px;
width: 240px;
height: 42px;
text-align: left;
position: relative;
overflow: hidden;
}
/*修改上传文字的样式*/
.customer-upload .el-upload__text{
margin-top: -32px;
margin-left: 40px;
/deep/ .calibration-attachment-upload .el-upload-dragger .el-icon-upload {
font-size: 26px;
margin: 12px 10px;
}
/deep/ .calibration-attachment-upload .el-upload__text {
margin-top: -30px;
margin-left: 44px;
}
.calibration-upload-btn {
width: 120px;
height: 36px;
}
.calibration-create-upload {
width: 500px;
}
/deep/ .calibration-create-upload .el-upload {
display: block;
width: 100%;
}
/deep/ .calibration-create-upload .el-upload-dragger {
width: 100%;
height: 62px;
box-sizing: border-box;
}
.calibration-record-toolbar {
display: flex;
align-items: center;
flex-wrap: wrap;
column-gap: 16px;
}
.calibration-date-inline {
display: inline-flex;
align-items: center;
font-size: 13px;
color: #606266;
font-weight: 500;
line-height: 32px;
}
.calibration-date-value {
margin-left: 2px;
color: #f9ae06;
font-weight: 600;
}
.down-tree{
height: 470px;

Loading…
Cancel
Save