<template>
|
<a-modal
|
:width="1000"
|
:visible="visible"
|
@ok="submitForm"
|
@cancel="handCancel"
|
:mask-closable="false"
|
centered
|
>
|
<a-card :bordered="false">
|
<div>
|
<b>{{ selectShenpiData.title }}</b>
|
<br>
|
<br>
|
<a-tag color="blue">
|
当前处理人 {{ selectShenpiData.assignee_dictText }}
|
</a-tag>
|
<a-tag color="blue">
|
任务创建时间 {{ selectShenpiData.createTime }}
|
</a-tag>
|
<br>
|
<br>
|
<a-button @click="fetchAndShowBmp" class="btn-custom" :loading="showBmpButtonLoading">流程图</a-button>
|
<div v-if="imageSrc&&isDisplayBmp">
|
<img :src="imageSrc" alt="Fetched Image"/>
|
</div>
|
<!--<hr class="shallow-hr">-->
|
</div>
|
|
<a-spin :spinning="spinning">
|
<a-tabs default-active-key='1'>
|
<a-tab-pane key='1' tab='基本信息'>
|
<a-form-model ref='form' :model='tableRowRecord' :labelCol="labelCol"
|
:wrapperCol="wrapperCol">
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="工单号">
|
<a-input readOnly v-model="tableRowRecord.orderNum"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="设备编号">
|
<MaintenanceEquipmentSelect v-model="tableRowRecord.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="tableRowRecord.standardName"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="标准编码">
|
<a-input readOnly v-model="tableRowRecord.standardCode"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="保养周期">
|
<a-input v-model="tableRowRecord.maintenancePeriod" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="点检人">
|
<a-input v-model="tableRowRecord.operator" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span='span'>
|
<a-form-model-item label="点检日期" prop="inspectionDate">
|
<a-input v-model="tableRowRecord.inspectionDate" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='span'>
|
<a-form-model-item label="点检过期时间">
|
<a-input v-model="tableRowRecord.expirationTime" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label="备注" :labelCol="{span:3}" :wrapperCol="{span:20}">
|
<a-textarea v-model="tableRowRecord.remark" rows="3" readOnly/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-tab-pane>
|
<a-tab-pane key='2' tab='流程节点'>
|
<a-card :bordered="false">
|
<a-timeline>
|
<a-timeline-item v-for="(item,index) in hitaskDataSource" :key="index">
|
<div>
|
<h3 style="font-weight: bold;">{{item.taskName}}</h3>
|
<div>处理人:{{item.assignee_dictText}}</div>
|
<div v-if="index !==0">处理时长:{{item.duration}}</div>
|
<div v-if="item.name !== '提交申请'">处理类型:{{item.sequenceFlowName}}</div>
|
<div v-if="item.description">处理意见:{{item.description}}</div>
|
</div>
|
</a-timeline-item>
|
</a-timeline>
|
</a-card>
|
</a-tab-pane>
|
</a-tabs>
|
|
<a-tabs default-active-key='1'>
|
<a-tab-pane key="1" tab="保养项明细">
|
<j-vxe-table
|
ref="editableDetailTable"
|
:rowNumber="false"
|
:rowSelection="true"
|
:bordered="true"
|
:alwaysEdit="true"
|
:toolbar="false"
|
keep-source
|
:height="300"
|
:loading="detail.loading"
|
:dataSource="detail.dataSource"
|
:columns="detail.columns"
|
@selectRowChange="handleTableSelectRowChange"
|
>
|
<template v-slot:inspectionResult="props">
|
<j-dict-select-tag v-model="props.row.inspectionResult" dictCode="eam_inspection_result"
|
placeholder="请选择点检结果"
|
@change="handleInspectionResultSelectChange($event,props.row)"
|
style="width: 100%"/>
|
</template>
|
|
<template v-slot:exceptionDescription="props">
|
<a-textarea style="height: 32px" v-model="props.row.exceptionDescription"
|
:disabled="!props.row.inspectionResult||props.row.inspectionResult==='1'"/>
|
</template>
|
|
<template v-slot:reportFlag="props">
|
<j-dict-select-tag v-model="props.row.reportFlag"
|
:disabled="!props.row.inspectionResult||props.row.inspectionResult==='1'"
|
dictCode="yn"
|
style="width: 100%"/>
|
</template>
|
</j-vxe-table>
|
</a-tab-pane>
|
|
<a-button v-if="selectedRowKeys.length>0" slot="tabBarExtraContent" type="primary"
|
@click="handleSelectAllInspectionResult">批量点检正常
|
</a-button>
|
|
<!--<a-dropdown slot="tabBarExtraContent" v-if="selectedRowKeys.length>0">-->
|
<!--<a-menu slot="overlay">-->
|
<!--<a-menu-item key="1" @click="handleSelectAllInspectionResult('正常')">正常</a-menu-item>-->
|
<!--<a-menu-item key="2" @click="handleSelectAllInspectionResult('异常')">异常</a-menu-item>-->
|
<!--</a-menu>-->
|
|
<!--<a-button> 批量选择点检结果-->
|
<!--<a-icon type="down"/>-->
|
<!--</a-button>-->
|
<!--</a-dropdown>-->
|
</a-tabs>
|
</a-spin>
|
</a-card>
|
</a-modal>
|
</template>
|
|
<script>
|
import '@assets/less/TableExpand.less'
|
import { getAction, deleteAction, postAction, downFile, httpAction } from '@api/manage'
|
import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect.vue'
|
import { JVXETypes } from '@comp/jeecg/JVxeTable'
|
|
export default {
|
name: 'InspectionOrderHandle',
|
components: { MaintenanceEquipmentSelect },
|
props: {
|
selectShenpiData: {
|
type: Object,
|
required: true
|
}
|
},
|
data() {
|
return {
|
span: 12,
|
spinning: false,
|
tableRowRecord: {},
|
hitaskDataSource: [],
|
imageSrc: null,
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 }
|
},
|
wrapperCol: {
|
xs: { span: 30 },
|
sm: { span: 16 }
|
},
|
visible: false,
|
// 表头
|
url: {
|
queryBomDataById: '/eam/eamInspectionOrder/selectVoById',
|
diagramView: '/assign/flow/diagramView',
|
queryHisTaskList: '/assign/flow/queryHisTaskList',
|
approve: '/eam/eamInspectionOrder/approval'
|
},
|
detail: {
|
loading: false,
|
dataSource: [],
|
columns: [
|
{
|
title: '序号',
|
key: 'itemCode',
|
type: JVXETypes.normal,
|
width: '10%',
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '保养项',
|
key: 'itemName',
|
type: JVXETypes.normal,
|
width: '20%',
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '保养要求',
|
key: 'itemDemand',
|
type: JVXETypes.normal,
|
width: '30%',
|
align: 'center',
|
fixed: 'left'
|
},
|
{
|
title: '点检结果',
|
key: 'inspectionResult',
|
type: JVXETypes.slot,
|
slotName: 'inspectionResult',
|
width: '20%',
|
align: 'center'
|
},
|
{
|
title: '异常描述',
|
key: 'exceptionDescription',
|
type: JVXETypes.slot,
|
slotName: 'exceptionDescription',
|
width: '30%',
|
align: 'center'
|
},
|
{
|
title: '异常是否报修',
|
key: 'reportFlag',
|
type: JVXETypes.slot,
|
slotName: 'reportFlag',
|
width: '20%',
|
align: 'center'
|
}
|
]
|
},
|
isDisplayBmp: false,
|
showBmpButtonLoading: false,
|
selectedRowKeys: []
|
}
|
},
|
methods: {
|
/**
|
* 获取流程节点
|
* @param record 待办记录信息
|
*/
|
getAllApproveData(record) {
|
const param = { 'procInstId': record.procInstId }
|
getAction(this.url.queryHisTaskList, param)
|
.then(res => {
|
this.hitaskDataSource = res.result
|
})
|
},
|
|
/**
|
* 获取待办记录的基本信息
|
* @param record 待办记录信息
|
*/
|
getBasicInformation(record) {
|
this.tableRowRecord = {}
|
this.detail.dataSource = []
|
this.spinning = true
|
const param = { id: record.dataId }
|
const that = this
|
getAction(this.url.queryBomDataById, param)
|
.then((res => {
|
if (res.success) {
|
that.tableRowRecord = res.result[0]
|
that.detail.dataSource = res.result[0].tableDetailList
|
console.log('that.tableRowRecord----->', that.tableRowRecord)
|
}
|
}))
|
},
|
|
// 获取并展开流程图
|
fetchAndShowBmp() {
|
this.isDisplayBmp = !this.isDisplayBmp
|
if (!this.imageSrc) {
|
const { processDefinitionId, processInstanceId, processDefinitionKey } = this.selectShenpiData
|
let param = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey }
|
this.showBmpButtonLoading = true
|
const that = this
|
downFile(this.url.diagramView, param, 'get')
|
.then((res => {
|
const urlObject = window.URL.createObjectURL(new Blob([res]))
|
this.imageSrc = urlObject
|
}))
|
.catch(err => {
|
that.$notification.error({
|
message: '消息',
|
description: res.message
|
})
|
})
|
.finally(() => {
|
this.showBmpButtonLoading = false
|
})
|
}
|
},
|
|
submitForm() {
|
const flowTaskVo = {}
|
flowTaskVo.dataId = this.selectShenpiData.dataId
|
flowTaskVo.taskId = this.selectShenpiData.id
|
flowTaskVo.userId = this.selectShenpiData.assignee
|
flowTaskVo.instanceId = this.selectShenpiData.procInstId
|
flowTaskVo.values = this.selectShenpiData.variables
|
flowTaskVo.tableDetailList = this.$refs.editableDetailTable.getTableData()
|
const that = this
|
this.confirmLoading = true
|
console.log('表单提交数据', flowTaskVo)
|
// httpAction(this.url.approve, flowTaskVo, 'post')
|
// .then((res) => {
|
// if (res.success) {
|
// that.$message.success(res.message)
|
// //刷新表格
|
// that.$emit('searchReset')
|
// that.handleCancel()
|
// } else {
|
// that.$message.warning(res.message)
|
// }
|
// })
|
// .finally(() => {
|
// that.confirmLoading = false
|
// })
|
},
|
|
autoCompleteForm({ standardName, maintenancePeriod, standardCode }) {
|
this.$set(this.tableRowRecord, 'standardName', standardName)
|
this.$set(this.tableRowRecord, 'maintenancePeriod', maintenancePeriod)
|
this.$set(this.tableRowRecord, 'standardCode', standardCode)
|
this.spinning = false
|
},
|
|
// 批量选择所有点检结果
|
handleSelectAllInspectionResult() {
|
this.selectedRowKeys.forEach(key => {
|
const dataItem = this.detail.dataSource.find(item => item.id === key)
|
if (dataItem && dataItem.inspectionResult !== '1') {
|
console.log('dataItem', dataItem)
|
delete dataItem.exceptionDescription
|
delete dataItem.reportFlag
|
dataItem.inspectionResult = '1'
|
}
|
})
|
this.$refs.editableDetailTable.clearCheckboxRow()
|
this.selectedRowKeys = []
|
},
|
|
/**
|
* 表格多选框发生改变时触发
|
* @param {selectedRowIds} 表格中已选择的ID列表
|
*/
|
handleTableSelectRowChange({ selectedRowIds }) {
|
this.selectedRowKeys = selectedRowIds
|
},
|
|
/**
|
* 点检结果选择器发生改变时触发
|
* @param value 改变后的值
|
* @param record 保养明细行记录
|
*/
|
handleInspectionResultSelectChange(value, record) {
|
if (record.exceptionDescription) delete record.exceptionDescription
|
if (record.reportFlag) delete record.reportFlag
|
},
|
|
handCancel() {
|
this.selectedRowKeys = []
|
this.visible = false
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.btn-custom {
|
background-color: #4CAF50; /* 绿色背景 */
|
color: #fff; /* 白色文字 */
|
}
|
|
/deep/ .ant-select-dropdown-menu {
|
text-align: left;
|
}
|
|
@import '~@assets/less/common.less';
|
</style>
|