¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <a-form-model |
| | | ref="form" |
| | | :model="model" |
| | | :rules="validatorRules" |
| | | slot="detail" |
| | | > |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="卿ç¼ç " |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="code" |
| | | > |
| | | <a-input |
| | | v-model="model.code" |
| | | placeholder="请è¾å
¥å¨æç¼ç " |
| | | :disabled="true" |
| | | ></a-input> |
| | | <!-- :disabled="model.isRevise" --> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="卿" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="cycle" |
| | | > |
| | | <a-input-number |
| | | v-model="model.cycle" |
| | | placeholder="请è¾å
¥å¨æ" |
| | | :min=0 |
| | | style="width: 100%" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="卿åä½" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="cycleUnit" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©å¨æåä½" |
| | | :triggerChange="true" |
| | | dictCode="cycle_unit" |
| | | v-model="model.cycleUnit" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="馿¬¡ç¹æ£æ¶é´" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="firstInspectionTime" |
| | | > |
| | | <j-date |
| | | placeholder="è¯·éæ©é¦æ¬¡ç¹æ£æ¶é´" |
| | | v-model="model.firstInspectionTime" |
| | | style="width: 100%" |
| | | :showTime="true" |
| | | dateFormat="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="æåæ¶é´" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="leadTime" |
| | | > |
| | | <a-input-number |
| | | v-model="model.leadTime" |
| | | placeholder="请è¾å
¥æåæ¶é´" |
| | | :min=0 |
| | | style="width: 100%" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="æææ¶é´" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="effectiveTime" |
| | | > |
| | | <a-input-number |
| | | v-model="model.effectiveTime" |
| | | placeholder="请è¾å
¥æææ¶é´" |
| | | :min=0 |
| | | style="width: 100%" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="æ¶é´åä½" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="unit" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©æ¶é´åä½" |
| | | :triggerChange="true" |
| | | dictCode="cycle_time_unit" |
| | | v-model="model.unit" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="å¼å·¥æ¡ä»¶" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="startCondition" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©å¼å·¥æ¡ä»¶" |
| | | :triggerChange="true" |
| | | dictCode="start_condition" |
| | | v-model="model.startCondition" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="è°æ´æ¹å¼" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="arrangeWay" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©è°æ´æ¹å¼" |
| | | :triggerChange="true" |
| | | dictCode="arrange_way" |
| | | v-model="model.arrangeWay" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="龿å¤çæ¹å¼" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="overdueDisposeMode" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©é¾æå¤çæ¹å¼" |
| | | :triggerChange="true" |
| | | dictCode="overdue_dispose_mode" |
| | | v-model="model.overdueDisposeMode" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="便®æ¥å" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="accordingCalendar" |
| | | > |
| | | <j-dict-select-tag |
| | | placeholder="è¯·éæ©ä¾æ®æ¥å" |
| | | :triggerChange="true" |
| | | dictCode="according_calendar" |
| | | v-model="model.accordingCalendar" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24/2"> |
| | | <a-form-model-item |
| | | label="çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="version" |
| | | > |
| | | <a-input |
| | | v-model="model.version" |
| | | placeholder="请è¾å
¥çæ¬å·" |
| | | :disabled=true |
| | | ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | |
| | | <a-col |
| | | v-if=" model.isRevise == true" |
| | | :span="24/2" |
| | | > |
| | | <a-form-model-item |
| | | label="åå²çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="version" |
| | | > |
| | | <a-input |
| | | v-model="model.historyVersion" |
| | | placeholder="请è¾å
¥åå²çæ¬" |
| | | :disabled=true |
| | | ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction, getAction, requestPut } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import pick from 'lodash.pick' |
| | | |
| | | export default { |
| | | name: 'InspectionCycleForm', |
| | | components: {}, |
| | | props: { |
| | | //表åç¦ç¨ |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | model: {}, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | // code: [ |
| | | // { required: true, message: '请è¾å
¥å¨æç¼ç !' }, |
| | | // ], |
| | | cycle: [ |
| | | { required: true, message: '请è¾å
¥å¨æ!' }, |
| | | ], |
| | | cycleUnit: [ |
| | | { required: true, message: '请è¾å
¥å¨æåä½!' }, |
| | | ], |
| | | firstInspectionTime: [ |
| | | { required: true, message: 'è¯·éæ©é¦æ¬¡ç¹æ£æ¶é´!' }, |
| | | ], |
| | | leadTime: [ |
| | | { required: true, message: '请è¾å
¥æåæ¶é´!' }, |
| | | ], |
| | | effectiveTime: [ |
| | | { required: true, message: '请è¾å
¥æææ¶é´!' }, |
| | | ], |
| | | unit: [ |
| | | { required: true, message: 'è¯·éæ©æ¶é´åä½!' }, |
| | | ], |
| | | arrangeWay: [ |
| | | { required: true, message: 'è¯·éæ©è°æ´æ¹å¼!' }, |
| | | ], |
| | | startCondition: [ |
| | | { required: true, message: 'è¯·éæ©å¼å·¥æ¡ä»¶!' }, |
| | | ], |
| | | version: [ |
| | | { required: true, message: '请è¾å
¥çæ¬å·!' }, |
| | | ], |
| | | overdueDisposeMode: [ |
| | | { required: true, message: 'è¯·éæ©é¾æå¤çæ¹å¼!' }, |
| | | ], |
| | | accordingCalendar: [ |
| | | { required: true, message: 'è¯·éæ©ä¾æ®æ¥å!' }, |
| | | ], |
| | | }, |
| | | url: { |
| | | add: '/eam/inspectionCycle/addNew', |
| | | edit: '/eam/inspectionCycle/edit', |
| | | revise: '/eam/inspectionCycle/revise', |
| | | getReviseVersion: "/eam/inspectionCycle/getReviseVersion", |
| | | }, |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | return this.disabled |
| | | }, |
| | | }, |
| | | created() { |
| | | //å¤ä»½modelåå§å¼ |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | }, |
| | | methods: { |
| | | add() { |
| | | this.edit(this.modelDefault) |
| | | }, |
| | | edit(record) { |
| | | this.model = Object.assign({}, record) |
| | | this.visible = true |
| | | this.model.isRevise = false; |
| | | //ä¿®æ¹æ¶ |
| | | if (record.id) { |
| | | |
| | | //æ°å¢æ¶ |
| | | } else { |
| | | this.model.version = '1.0' |
| | | this.model.versionStatus = '1' |
| | | } |
| | | }, |
| | | |
| | | //åç |
| | | revise(record) { |
| | | let that = this; |
| | | that.visible = true; |
| | | that.model = Object.assign({}, record) |
| | | that.model.isRevise = true; |
| | | that.model.historyVersion = record.version |
| | | that.model.versionStatus = '1' |
| | | requestPut(that.url.getReviseVersion, record).then((res) => { |
| | | if (res.success) { |
| | | that.model.version = res.result; |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | submitForm() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = '' |
| | | let method = '' |
| | | if (!this.model.id) { |
| | | httpurl += this.url.add |
| | | method = 'post' |
| | | } else { |
| | | if (this.model.isRevise) { |
| | | httpurl += this.url.revise |
| | | method = 'post' |
| | | } else { |
| | | httpurl += this.url.edit |
| | | method = 'put' |
| | | } |
| | | } |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |