¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="width" |
| | | :visible="visible" |
| | | switchFullscreen |
| | | @ok="handleOk" |
| | | :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
| | | @cancel="handleCancel" |
| | | cancelText="å
³é"> |
| | | |
| | | <a-spin :spinning="spinning"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="8"> |
| | | <a-form-model-item prop="standardCode" label="å·¥åå·"> |
| | | <a-input placeholder="å·¥åå·èªå¨çæ" v-model="model.orderNum" readOnly/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="8"> |
| | | <a-form-model-item prop="equipmentId" label="设å¤ç¼å·"> |
| | | <a-select placeholder="è¯·éæ©è®¾å¤" v-model="model.equipmentId" :options="inspectionEquipmentOptions" @change="handleEquipmentChange"></a-select> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="8"> |
| | | <a-form-model-item prop="standardName" label="æ ååç§°"> |
| | | <a-input placeholder="éæ©è®¾å¤åèªå¨å¸¦åº" readOnly v-model="model.standardName"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="8"> |
| | | <a-form-model-item prop="standardCode" label="æ åç¼ç "> |
| | | <a-input placeholder="éæ©è®¾å¤åèªå¨å¸¦åº" readOnly v-model="model.standardCode"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="8"> |
| | | <a-form-model-item label="ä¿å
»å¨æ"> |
| | | <a-input placeholder="éæ©è®¾å¤åèªå¨å¸¦åº" v-model="model.maintenancePeriod" readOnly/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <vxe-table |
| | | ref="table" |
| | | border |
| | | show-overflow |
| | | show-header-overflow |
| | | :scroll-x="{enabled: true}" |
| | | :data="dataSource" |
| | | :edit-config="{trigger: 'click', mode: 'cell'}" |
| | | :edit-rules="editRules" |
| | | > |
| | | <vxe-table-column title="åºå·" field="itemCode" width="50" align="center"></vxe-table-column> |
| | | <vxe-table-column title="é¨ä½" field="itemPart" align="center"></vxe-table-column> |
| | | <vxe-table-column title="ä¿å
»é¡¹ç®" field="itemName" align="center"></vxe-table-column> |
| | | <vxe-table-column title="æ£æ¥æ åæè¦æ±" field="itemDemand" align="center"></vxe-table-column> |
| | | <vxe-table-column title="ä¿å
»è¦æ±" field="itemDemandAlias" align="center"></vxe-table-column> |
| | | <vxe-table-column title="æ£æ¥æ¹æ³" field="checkMethod" align="center"></vxe-table-column> |
| | | <vxe-table-column title="ç¹æ£ç»æ" field="inspectionResult" align="center" |
| | | :edit-render="{name: '$select', options: inspectionResultOptions}"> |
| | | <template #default="{ row }"> |
| | | <span v-if="row.inspectionResult">{{ getInspectionResultLabel(row.inspectionResult) }}</span> |
| | | <span v-else class="placeholder-text">è¯·éæ©ç¹æ£ç»æ</span> |
| | | </template> |
| | | </vxe-table-column> |
| | | <vxe-table-column title="å¼å¸¸æè¿°" field="exceptionDescription" align="center" |
| | | :edit-render="{name: '$input', placeholder: '请è¾å
¥å¼å¸¸æè¿°'}"> |
| | | <template #default="{ row }"> |
| | | <span v-if="row.inspectionResult === '2' && !row.exceptionDescription" class="placeholder-text">请è¾å
¥å¼å¸¸æè¿°</span> |
| | | <span v-else-if="row.exceptionDescription">{{ row.exceptionDescription }}</span> |
| | | </template> |
| | | <template #edit="{ row }"> |
| | | <vxe-input v-if="row.inspectionResult === '2'" v-model="row.exceptionDescription" placeholder="请è¾å
¥å¼å¸¸æè¿°" /> |
| | | </template> |
| | | </vxe-table-column> |
| | | </vxe-table> |
| | | </a-row> |
| | | </a-form-model> |
| | | </a-spin> |
| | | </j-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { postAction, getAction, putAction } from '@api/manage' |
| | | |
| | | export default { |
| | | name: 'MesProductionWorkOrderReportModal', |
| | | data () { |
| | | return { |
| | | title: '设å¤ç¹æ£', |
| | | width: 1200, |
| | | visible: false, |
| | | loading: false, |
| | | disableSubmit: false, |
| | | model: {}, |
| | | spinning: false, |
| | | validatorRules: { |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 6 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 18 }, |
| | | }, |
| | | inspectionResultOptions: [ |
| | | { |
| | | label: 'æ£å¸¸', |
| | | value: '1' |
| | | }, |
| | | { |
| | | label: 'å¼å¸¸', |
| | | value: '2' |
| | | } |
| | | ], |
| | | dataSource: [], |
| | | editRules: { |
| | | inspectionResult: [ |
| | | { required: true, message: 'æ£æ¥ç»æå¿
须鿩' } |
| | | ], |
| | | exceptionDescription: [ |
| | | { |
| | | required: true, |
| | | message: 'å¼å¸¸æè¿°ä¸è½ä¸ºç©º', |
| | | validator: ({ cellValue, row }) => { |
| | | // å½ç¹æ£ç»æä¸ºå¼å¸¸æ¶ï¼å¼å¸¸æè¿°å¿
å¡« |
| | | if (row.inspectionResult === '2') { |
| | | return cellValue && cellValue.trim() !== '' ? true : new Error('å¼å¸¸æè¿°å¿
须填å'); |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | url: { |
| | | report: '/mesworkreporting/mesWorkReporting/add', |
| | | listInspectionEquipment: '/eam/equipment/listProductionLineInspectionEquipment', |
| | | queryByEquipmentId: '/eam/maintenanceStandard/queryByEquipmentId', |
| | | addInspectionOrder: '/eam/eamInspectionOrder/add', |
| | | updateOrderInspectionStatus: '/mes/mesProductionWorkOrder/edit' |
| | | }, |
| | | inspectionEquipmentOptions: [], |
| | | workOrderId: null |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | } |
| | | }, |
| | | methods: { |
| | | getInspectionResultLabel(value) { |
| | | const option = this.inspectionResultOptions.find(item => item.value === value); |
| | | return option ? option.label : value; |
| | | }, |
| | | inspect (record) { |
| | | this.resetFormData() |
| | | this.workOrderId = record.id |
| | | getAction(this.url.listInspectionEquipment, {orderId: record.id}).then(res => { |
| | | if (res.success) { |
| | | this.inspectionEquipmentOptions = res.result |
| | | } |
| | | }) |
| | | this.visible = true |
| | | }, |
| | | close () { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | handleEquipmentChange(id) { |
| | | getAction(this.url.queryByEquipmentId, {equipmentId: id}).then(res => { |
| | | if (res.success) { |
| | | console.log(res.result) |
| | | this.model = { |
| | | ...this.model, |
| | | standardId: res.result.id, |
| | | standardName: res.result.standardName, |
| | | standardCode: res.result.standardCode, |
| | | maintenancePeriod: res.result.maintenancePeriod |
| | | } |
| | | this.dataSource = res.result.maintenanceStandardDetailList |
| | | } |
| | | }) |
| | | }, |
| | | handleOk () { |
| | | this.$refs.table.validate((valid) => { |
| | | if (valid) { |
| | | this.$message.error("è¯·å®æææå¿
å¡«ä¿¡æ¯ååæäº¤ï¼") |
| | | } else { |
| | | let tableData = this.$refs.table.getTableData().fullData |
| | | const data = { |
| | | ...this.model, |
| | | workOrderId: this.workOrderId, |
| | | tableDetailList: tableData |
| | | } |
| | | postAction(this.url.addInspectionOrder, data).then(res=> { |
| | | if (res.success) { |
| | | this.$message.success(res.message) |
| | | getAction(this.url.listInspectionEquipment, {orderId: this.workOrderId}).then(res => { |
| | | if (res.success) { |
| | | if (res.result && res.result.length > 0) { |
| | | // è¿æè®¾å¤éè¦ç¹æ£ï¼æ¸
空表ååè¡¨æ ¼æ°æ® |
| | | this.inspectionEquipmentOptions = res.result |
| | | this.resetFormData() |
| | | } else { |
| | | // 没æéè¦ç¹æ£ç设å¤ï¼æ´æ°ç¹æ£ç¶æ |
| | | putAction(this.url.updateOrderInspectionStatus, {id: this.workOrderId, equipmentInspectionFlag: '1'}).then(res => { |
| | | if (res.success) { |
| | | this.$message.success('设å¤ç¹æ£å®æ') |
| | | this.submitCallback() |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | this.submitCallback() |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | resetFormData() { |
| | | this.$refs.form.resetFields() |
| | | this.model = {} |
| | | this.dataSource = [] |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | | this.visible = false; |
| | | }, |
| | | handleCancel () { |
| | | this.close() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | .placeholder-text { |
| | | color: #999; |
| | | font-style: italic; |
| | | } |
| | | |
| | | </style> |