<template>
|
<j-modal :title="title" :width="1200" :visible="visible"
|
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" @ok="submitForm"
|
@cancel="handleCancel" :mask-closable="false" :confirmLoading="confirmLoading" fullscreen>
|
<a-spin :spinning="spinning">
|
<a-form-model ref='form' :model='model' :labelCol="labelCol" :wrapperCol="wrapperCol" :rules="validatorRules">
|
<a-row :gutter="48" id="outer-row">
|
<a-col :span="8" class="scroll-col">
|
<a-tabs>
|
<a-tab-pane tab="基础信息">
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="工单号">
|
<a-input readOnly v-model="model.orderNum"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="设备编号">
|
<MaintenanceEquipmentSelect v-model="model.equipmentId"
|
:maintenanceCategory="'POINT_INSPECTION'"
|
disabled @autocompleteForm="autoCompleteForm"/>
|
</a-form-model-item>
|
</a-col>
|
|
</a-row>
|
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="规范名称">
|
<a-input readOnly v-model="model.standardName"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="规范编码">
|
<a-input readOnly v-model="model.standardCode"/>
|
</a-form-model-item>
|
</a-col>
|
|
</a-row>
|
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="点检日期">
|
<a-input v-model="model.inspectionDate" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="过期时间">
|
<a-input v-model="model.expirationTime" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="保养周期">
|
<a-input v-model="model.maintenancePeriod" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="点检人">
|
<a-input v-model="model.operator_dictText" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span="span*2">
|
<a-form-model-item label="备注" :labelCol="{span:4}" :wrapperCol="{span:20}">
|
<a-textarea v-model="model.remark" rows="3" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-tab-pane>
|
</a-tabs>
|
</a-col>
|
|
<a-col :span="!isDisplayConfirm?16:10" class="scroll-col">
|
<a-tabs :active-key="activeTabKey" @change="handleTabChange">
|
<a-tab-pane key="1" tab="日点检">
|
<j-vxe-table ref="editableDetailTable1" :rowNumber="false" rowSelection bordered
|
alwaysEdit :toolbar="false" keep-source :height="500"
|
:dataSource="detail.dayInspectionList" :columns="detail.columns"
|
@selectRowChange="handleTableSelectRowChange($event,'Day')">
|
<template v-slot:inspectionResult="props">
|
<j-dict-select-tag v-model="props.row.inspectionResult" dictCode="inspection_project_result"
|
:disabled="isDisableOperation" placeholder="请选择点检结果"
|
@change="handleInspectionResultSelectChange($event,props.row)"
|
style="width: 100%"/>
|
</template>
|
|
<template v-slot:exceptionDescription="props">
|
<a-textarea :rows="1" style="resize: none" v-model="props.row.exceptionDescription"
|
:placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'请输入异常描述':''"
|
:disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"/>
|
</template>
|
|
<template v-slot:reportFlag="props">
|
<j-dict-select-tag v-model="props.row.reportFlag"
|
:placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'请选择异常是否报修':''"
|
:disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"
|
dictCode="yn" style="width: 100%"/>
|
</template>
|
</j-vxe-table>
|
</a-tab-pane>
|
|
<a-tab-pane key="2" tab="周点检" forceRender>
|
<j-vxe-table ref="editableDetailTable2" :rowNumber="false" rowSelection bordered
|
alwaysEdit :toolbar="false" keep-source :height="500"
|
:dataSource="detail.weekInspectionList" :columns="detail.columns"
|
@selectRowChange="handleTableSelectRowChange($event,'Week')">
|
<template v-slot:inspectionResult="props">
|
<j-dict-select-tag v-model="props.row.inspectionResult" dictCode="inspection_project_result"
|
:disabled="isDisableOperation||detail.weekInspectionFinishedFlag"
|
placeholder="请选择点检结果"
|
@change="handleInspectionResultSelectChange($event,props.row)"
|
style="width: 100%"/>
|
</template>
|
|
<template v-slot:exceptionDescription="props">
|
<a-textarea :rows="1" style="resize: none" v-model="props.row.exceptionDescription"
|
:placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'请输入异常描述':''"
|
:disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"/>
|
</template>
|
|
<template v-slot:reportFlag="props">
|
<j-dict-select-tag v-model="props.row.reportFlag"
|
:placeholder="props.row.inspectionResult&&props.row.inspectionResult!='NORMAL'?'请选择异常是否报修':''"
|
:disabled="isDisableOperation||!props.row.inspectionResult||props.row.inspectionResult=='NORMAL'"
|
dictCode="yn" style="width: 100%"/>
|
</template>
|
</j-vxe-table>
|
</a-tab-pane>
|
|
<template v-if="selectShenpiData.procInstId">
|
<a-tab-pane key='3' tab='流程图'>
|
<img :src="imageSrc" v-if="imageSrc"/>
|
</a-tab-pane>
|
</template>
|
|
<a-button
|
v-if="activeTabKey=='1'||activeTabKey=='2'"
|
:disabled="(activeTabKey=='1'&&selectedDayInspectionRowKeys.length==0)||(activeTabKey=='2'&&selectedWeekInspectionRowKeys.length==0)||(activeTabKey=='2'&&detail.weekInspectionFinishedFlag)||isDisableOperation"
|
slot="tabBarExtraContent" type="primary"
|
@click="handleSelectAllInspectionResult">批量点检正常
|
</a-button>
|
</a-tabs>
|
</a-col>
|
|
<a-col v-if="isDisplayConfirm" :span="6" class="scroll-col">
|
<a-tabs>
|
<a-tab-pane tab="维修工确认">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="confirmDealType" label="处理类型">
|
<j-dict-select-tag type='radio' v-model='model.confirmDealType'
|
dictCode='approved_rejected'
|
:disabled="disableSubmit||model.inspectionStatus!=='WAIT_CONFIRM'"/>
|
</a-form-model-item>
|
</a-col>
|
|
<a-col :span="24">
|
<a-form-model-item label="处理意见">
|
<a-textarea placeholder="请输入意见"
|
:disabled="disableSubmit||model.inspectionStatus!=='WAIT_CONFIRM'"
|
v-model="model.confirmComment"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-tab-pane>
|
</a-tabs>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
import { getAction, postAction, downFile } from '@api/manage'
|
import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect.vue'
|
import { JVXETypes } from '@comp/jeecg/JVxeTable'
|
import moment from 'moment'
|
|
export default {
|
name: 'InspectionOrderHandle',
|
components: { MaintenanceEquipmentSelect },
|
props: {
|
selectShenpiData: {
|
type: Object
|
}
|
},
|
data() {
|
return {
|
span: 12,
|
confirmLoading: false,
|
spinning: false,
|
model: {},
|
validatorRules: {
|
confirmDealType: [
|
{ required: true, message: '请选择处理类型' }
|
]
|
},
|
imageSrc: null,
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 8 }
|
},
|
wrapperCol: {
|
xs: { span: 30 },
|
sm: { span: 16 }
|
},
|
visible: false,
|
// 表头
|
url: {
|
diagramView: '/assign/flow/diagramView',
|
queryHisTaskList: '/assign/flow/queryHisTaskList',
|
approve: '/eam/eamInspectionOrder/approval',
|
queryById: '/eam/eamInspectionOrder/queryById',
|
detailList: '/eam/eamInspectionOrderDetail/queryList',
|
weekInspectionOrderList: '/eam/eamWeekInspectionDetail/queryStandardList'
|
},
|
detail: {
|
columns: [
|
{
|
title: '序号',
|
key: 'itemCode',
|
type: JVXETypes.normal,
|
width: 60,
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '保养项',
|
key: 'itemName',
|
type: JVXETypes.normal,
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '保养要求',
|
key: 'itemDemand',
|
type: JVXETypes.normal,
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '点检结果',
|
key: 'inspectionResult',
|
type: JVXETypes.slot,
|
slotName: 'inspectionResult',
|
align: 'center',
|
validateRules: [
|
{ required: true, message: '${title}不能为空' }
|
]
|
},
|
{
|
title: '异常描述',
|
key: 'exceptionDescription',
|
type: JVXETypes.slot,
|
slotName: 'exceptionDescription',
|
align: 'center',
|
validateRules: [
|
{ handler: this.customValidator }
|
]
|
},
|
{
|
title: '异常是否报修',
|
key: 'reportFlag',
|
type: JVXETypes.slot,
|
slotName: 'reportFlag',
|
align: 'center',
|
validateRules: [
|
{ handler: this.customValidator }
|
]
|
}
|
],
|
dayInspectionList: [],
|
weekInspectionList: [],
|
weekInspectionFinishedFlag: false
|
},
|
selectedDayInspectionRowKeys: [],
|
selectedWeekInspectionRowKeys: [],
|
disableSubmit: false,
|
activeTabKey: '1',
|
title: ''
|
}
|
},
|
computed: {
|
isDisplayConfirm() {
|
return ['WAIT_CONFIRM', 'COMPLETE'].includes(this.model.inspectionStatus)
|
},
|
isDisableOperation() {
|
return this.disableSubmit || this.model.inspectionStatus !== 'UNDER_INSPECTION'
|
}
|
},
|
methods: {
|
handleApprove(record) {
|
this.spinning = true
|
this.activeTabKey = '1'
|
this.detail.dayInspectionList = this.detail.weekInspectionList = []
|
this.getBasicInformationByApi(record)
|
this.getFlowChartImageByApi(record)
|
},
|
|
handleDetail(record) {
|
this.spinning = true
|
this.activeTabKey = '1'
|
this.detail.dayInspectionList = this.detail.weekInspectionList = []
|
this.model = Object.assign({}, record)
|
this.getDayInspectionOrderListByApi(record.id)
|
this.getWeekInspectionOrderListByApi(record.standardId)
|
},
|
|
/**
|
* 获取基础信息
|
* @param record 主页面列表行记录
|
*/
|
getBasicInformationByApi(record) {
|
const that = this
|
getAction(this.url.queryById, { id: record.dataId })
|
.then(res => {
|
if (res.success) {
|
that.model = Object.assign({}, res.result)
|
that.model.dataId = record.dataId
|
that.model.taskId = record.id
|
that.model.userId = record.assignee
|
that.model.instanceId = record.procInstId
|
this.getDayInspectionOrderListByApi(record.dataId)
|
this.getWeekInspectionOrderListByApi(this.model.standardId)
|
}
|
else {
|
that.$notification.warning({
|
message: '消息',
|
description: res.message
|
})
|
}
|
})
|
},
|
|
/**
|
* 获取流程图
|
* @param record 主页面列表行记录
|
*/
|
getFlowChartImageByApi(record) {
|
const { processDefinitionId, processInstanceId, processDefinitionKey } = record
|
const imageParam = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey }
|
const that = this
|
|
downFile(this.url.diagramView, imageParam, 'get')
|
.then((res => {
|
that.imageSrc = window.URL.createObjectURL(new Blob([res]))
|
}))
|
.catch(err => {
|
that.$notification.error({
|
message: '消息',
|
description: err.message
|
})
|
})
|
},
|
|
/**
|
* 获取点检工单中的日点检列表
|
* @param orderId 工单号
|
*/
|
getDayInspectionOrderListByApi(orderId) {
|
if (orderId) {
|
getAction(this.url.detailList, { orderId })
|
.then(res => {
|
if (res.success) {
|
this.detail.dayInspectionList = res.result
|
}
|
})
|
.finally(() => {
|
this.spinning = false
|
})
|
}
|
},
|
|
/**
|
* 获取点检工单中的周点检列表
|
* @param standardId 规范id
|
*/
|
getWeekInspectionOrderListByApi(standardId) {
|
getAction(this.url.weekInspectionOrderList, { standardId, inspectionDate: this.model.inspectionDate })
|
.then(res => {
|
if (res.success) {
|
this.detail.weekInspectionList = res.result.list
|
this.detail.weekInspectionFinishedFlag = res.result.weekInsFlag
|
}
|
})
|
.finally(() => {
|
this.spinning = false
|
})
|
},
|
|
/**
|
* tab栏切换时触发
|
* @param tabKey 切换后的tabKey
|
*/
|
handleTabChange(tabKey) {
|
if (this.activeTabKey == '1') this.$refs.editableDetailTable1.clearValidate()
|
this.activeTabKey = tabKey
|
},
|
|
// 提交事件
|
async submitForm() {
|
let errMap = await this.$refs.editableDetailTable1.validateTable()
|
if (errMap) {
|
if (this.activeTabKey != '1') {
|
this.activeTabKey = '1'
|
// 内部校验提示因tab切换时定位出现问题因此在此处清楚内部校验提示,增加notification提示
|
this.$refs.editableDetailTable1.clearValidate()
|
this.$notification.warning({
|
message: '消息',
|
description: '日点检结果不能为空'
|
})
|
}
|
return
|
}
|
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
this.confirmLoading = this.spinning = true
|
this.model.tableDetailList = this.$refs.editableDetailTable1.getTableData()
|
if (!this.detail.weekInspectionFinishedFlag) this.model.tableWeekDetailList = this.$refs.editableDetailTable2.getTableData()
|
const that = this
|
postAction(this.url.approve, this.model)
|
.then((res) => {
|
if (res.success) {
|
that.$notification.success({
|
message: '消息',
|
description: res.message
|
})
|
//刷新表格
|
that.$emit('modalFormOk')
|
that.handleCancel()
|
} else {
|
that.$notification.warning({
|
message: '消息',
|
description: res.message
|
})
|
}
|
})
|
.finally(() => {
|
that.confirmLoading = this.spinning = false
|
})
|
} else {
|
return false
|
}
|
})
|
},
|
|
autoCompleteForm({ standardName, maintenancePeriod, standardCode }) {
|
this.$set(this.model, 'standardName', standardName)
|
this.$set(this.model, 'maintenancePeriod', maintenancePeriod)
|
this.$set(this.model, 'standardCode', standardCode)
|
},
|
|
// 批量选择所有点检结果
|
handleSelectAllInspectionResult() {
|
let selectedRowKeys, prefix
|
if (this.activeTabKey == '1') {
|
selectedRowKeys = this.selectedDayInspectionRowKeys
|
prefix = 'day'
|
}
|
else if (this.activeTabKey == '2') {
|
selectedRowKeys = this.selectedWeekInspectionRowKeys
|
prefix = 'week'
|
}
|
else selectedRowKeys = []
|
if (selectedRowKeys.length == 0) return
|
|
selectedRowKeys.forEach(key => {
|
const dataItem = this.detail[prefix + 'InspectionList'].find(item => item.id === key)
|
if (dataItem && dataItem.inspectionResult !== 'NORMAL') {
|
delete dataItem.exceptionDescription
|
delete dataItem.reportFlag
|
dataItem.inspectionResult = 'NORMAL'
|
}
|
})
|
this.$refs['editableDetailTable' + this.activeTabKey].clearCheckboxRow()
|
this['selected' + prefix.charAt(0).toUpperCase() + prefix.slice(1) + 'InspectionRowKeys'] = []
|
},
|
|
/**
|
* 表格多选框发生改变时触发
|
* @param {selectedRowIds} 表格中已选择的ID列表
|
* @param key 点检区分key
|
*/
|
handleTableSelectRowChange({ selectedRowIds }, key) {
|
this['selected' + key + 'InspectionRowKeys'] = selectedRowIds
|
},
|
|
/**
|
* 点检结果选择器发生改变时触发
|
* @param value 改变后的值
|
* @param record 保养明细行记录
|
*/
|
handleInspectionResultSelectChange(value, record) {
|
if (record.exceptionDescription) delete record.exceptionDescription
|
if (record.reportFlag) delete record.reportFlag
|
},
|
|
/**
|
* 异常描述与异常是否保修字段自定义校验方法
|
* @param cellValue 单元格内的值
|
* @param row 当前行记录
|
* @param callback 结果回调函数
|
*/
|
customValidator({ cellValue, row }, callback) {
|
if (this.activeTabKey == '1' && row.inspectionResult != 'NORMAL') {
|
if (!cellValue) {
|
callback(false, '请输入${title}') // false = 未通过,可以跟自定义提示
|
} else {
|
callback(true) // true = 通过验证
|
}
|
} else {
|
callback(true)
|
}
|
},
|
|
handleCancel() {
|
this.selectedDayInspectionRowKeys = this.selectedWeekInspectionRowKeys = []
|
this.visible = false
|
}
|
}
|
}
|
</script>
|
<style scoped lang="less">
|
/deep/ .ant-select-dropdown-menu {
|
text-align: left;
|
}
|
|
/deep/ .ant-spin-nested-loading {
|
height: 100%;
|
|
.ant-spin-container {
|
height: 100%;
|
|
.ant-form {
|
height: 100%;
|
|
#outer-row {
|
height: 100%;
|
|
.scroll-col {
|
height: 100%;
|
overflow: auto;
|
}
|
}
|
}
|
}
|
}
|
</style>
|