123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <template>
- <a-card :bordered="false" :title="modalTitle" v-show="visible">
- <a-row :gutter="48" slot="extra">
- <a-col :md="48" :sm="48">
- <span class="table-page-search-submitButtons" style="float: right" >
- <a-button style="margin-left: 8px" type="primary" @click="finish()">完成</a-button>
- <a-button style="margin-left: 8px" type="primary" @click="save()">保存</a-button>
- <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
- </span>
- </a-col>
- </a-row>
- <title-divider title="基本信息" width="90px"></title-divider>
- <a-form :form="form">
- <a-form-item v-show="false" >
- <a-input v-decorator="['id']" type="hidden"/>
- <a-input v-decorator="['sbId']" type="hidden"/>
- <a-input v-decorator="['repairId']" type="hidden"/>
- </a-form-item>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="编号"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-input
- disabled="disabled"
- v-decorator="['no']"
- />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="分析时间"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-date-picker
- style="width: 100%"
- v-decorator="['analyzeTime', {rules: [{required: true, message: '分析时间不能为空'}]}]"
- :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="故障现象"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2">
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['problemDesc', {rules: [{required: true, message: '分析时间不能为空'}]}]"
- />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- label="检查处理过程"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['checkProcess', {rules: [{required: true, message: '检查处理过程不能为空'}]}]"/>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- label="原因分析">
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['reasonAnalysis', {rules: [{required: true, message: '原因分析不能为空'}]}]" />
- </a-form-item>
- </a-col>
- </a-row>
- <title-divider title="改进措施" width="90px"></title-divider>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="更新维修计划"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-checkbox :checked="changeRepairPlan" v-model="changeRepairPlan"></a-checkbox>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="内容"
- v-show="changeRepairPlan"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['changeRepairPlanContent']" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="更新备件计划"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-checkbox :checked="changeSparePlan" v-model="changeSparePlan"></a-checkbox>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="内容"
- v-show="changeSparePlan"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['changeSparePlanContent']" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="人员培训"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-checkbox :checked="userTeach" v-model="userTeach"></a-checkbox>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="内容"
- v-show="userTeach"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['userTeachContent']" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="设备改造升级"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-checkbox :checked="sbChange" v-model="sbChange"></a-checkbox>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="内容"
- v-show="sbChange"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['sbChangeContent']" />
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="12" :md="24" :sm="24">
- <a-form-item
- label="其他"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol">
- <a-checkbox :checked="otherChange" v-model="otherChange"></a-checkbox>
- </a-form-item>
- </a-col>
- </a-row>
- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
- <a-col :lg="24" :md="24" :sm="24">
- <a-form-item
- label="内容"
- v-show="otherChange"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :auto-size="{ minRows: 5 }"
- v-decorator="['otherChangeContent']" />
- </a-form-item>
- </a-col>
- </a-row>
- </a-form>
- </a-card>
- </template>
- <script>
- import { addRepairReason, updateRepairReason, finishRepairReason} from '@/api/repair/repair-reason'
- import pick from 'lodash.pick'
- export default {
- name: 'BaseRepairReason',
- data () {
- return {
- confirmLoading: false,
- modalTitle: null,
- currentTab: 0,
- changeRepairPlan: false,
- changeSparePlan: false,
- userTeach: false,
- sbChange: false,
- otherChange: false,
- addFlag: false,
- statusMap: {},
- form: this.$form.createForm(this),
- visible: false
- // 下拉框map
- }
- },
- props: {},
- created () {
- // 下拉框map
- this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_REASON_STATUS)
- },
- methods: {
- base (record, repairForm = {}) {
- this.visible = true
- this.currentTab = 0
- const { form: { setFieldsValue } } = this
- // 如果是空标识添加
- if (this.BaseTool.Object.isBlank(record)) {
- this.addFlag = true
- this.modalTitle = '添加'
- repairForm.repairId = repairForm.id
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(repairForm, [
- 'repairId',
- 'sbId',
- 'no'
- ])))
- })
- return
- }
- this.addFlag = false
- record.analyzeTime = this.BaseTool.Moment(record.analyzeTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- this.changeRepairPlan = record.changeRepairPlan
- this.changeSparePlan = record.changeSparePlan
- this.userTeach = record.userTeach
- this.sbChange = record.sbChange
- this.otherChange = record.otherChange
- this.modalTitle = '编辑'
- // 日期处理
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'id',
- 'sbId',
- 'repairId',
- 'no',
- 'analyzeTime',
- 'problemDesc',
- 'checkProcess',
- 'reasonAnalysis',
- 'improveMeasure',
- 'changeRepairPlan: null',
- 'changeRepairPlanContent',
- 'changeSparePlan',
- 'changeSparePlanContent',
- 'userTeach',
- 'userTeachContent',
- 'sbChange',
- 'sbChangeContent',
- 'otherChange',
- 'otherChangeContent',
- 'status'
- ])))
- })
- },
- next () {
- this.currentTab += 1
- },
- prev () {
- this.currentTab -= 1
- },
- save () {
- const { form: { validateFieldsAndScroll } } = this
- this.confirmLoading = true
- validateFieldsAndScroll((errors, values) => {
- if (errors) {
- this.confirmLoading = false
- return
- }
- // 日期处理
- values.changeRepairPlan = this.changeRepairPlan
- values.changeSparePlan = this.changeSparePlan
- values.userTeach = this.userTeach
- values.sbChange = this.sbChange
- values.otherChange = this.otherChange
- values.analyzeTime = this.BaseTool.Date.formatter(values.analyzeTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- if (this.addFlag) {
- addRepairReason(values)
- .then((res) => {
- this.confirmLoading = false
- this.handleCancel()
- }).catch(() => {
- this.confirmLoading = false
- })
- } else {
- updateRepairReason(values)
- .then(() => {
- this.handleCancel()
- }).catch(() => {
- this.confirmLoading = false
- })
- }
- })
- },
- finish(){
- const { form: { validateFieldsAndScroll } } = this
- this.confirmLoading = true
- validateFieldsAndScroll((errors, values) => {
- if (errors) {
- this.confirmLoading = false
- return
- }
- // 日期处理
- values.changeRepairPlan = this.changeRepairPlan
- values.changeSparePlan = this.changeSparePlan
- values.userTeach = this.userTeach
- values.sbChange = this.sbChange
- values.otherChange = this.otherChange
- values.analyzeTime = this.BaseTool.Date.formatter(values.analyzeTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
- finishRepairReason(values)
- .then((res) => {
- this.confirmLoading = false
- this.handleCancel()
- }).catch(() => {
- this.confirmLoading = false
- })
- })
- },
- handleCancel (values) {
- this.visible = false
- this.confirmLoading = false
- this.form.resetFields()
- this.$emit('ok', values)
- }
- }
- }
- </script>
- <style>
- .ant-steps-item-process .ant-steps-item-icon>.ant-steps-icon {
- color: #fff !important;
- }
- </style>
|