123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <a-modal
- title="报修审核"
- :width="800"
- :visible="visible"
- :confirmLoading="confirmLoading"
- class="ant-modal2"
- @cancel="handleCancel"
- >
- <a-form :form="form">
- <a-form-item v-show="false" >
- <a-input v-decorator="['id']" type="hidden"/>
- </a-form-item>
- <row-list :col="1">
- <row-item>
- <a-form-item
- label="审核"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-radio-group v-model="value" >
- <a-radio-button :value="1">
- 通过
- </a-radio-button>
- <a-radio-button :value="23">
- 拒绝
- </a-radio-button>
- </a-radio-group>
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="维修专业"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-tree-select
- tree-checkable
- :show-checked-strategy="SHOW_PARENT"
- v-decorator="['repairProfessor', { rules: [{required: true, message: '检修专业不能为空'}]}]"
- placeholder="请选择">
- <a-tree-select-node
- v-for="(label,value) in professorMap"
- :key="value"
- :title="label"
- :value="parseInt(value)">{{ label }}
- </a-tree-select-node>
- </a-tree-select>
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="车间具体位置"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-input
- placeholder="比如:甲七车间北侧"
- v-decorator="['sbCph']" />
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="工单类别"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-select @change="changePlanFlag" v-decorator="['category', {initialValue: 2, rules: [{required: true, message: '工单类别不能为空'}]}]" placeholder="请选择">
- <a-select-option
- v-for="(label,value) in categoryMap"
- :key="value"
- :label="label"
- :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="维修部门"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-select v-decorator="['repairDeptId', {rules: [{required: true, message: '维修部门不能为空'}]}]" placeholder="请选择">
- <a-select-option
- v-for="(label,value) in repairDeptMap"
- :key="value"
- :label="label"
- :value="value">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="委托内容描述"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :rows="4"
- v-decorator="['content', {rules: [{required: true, message: '委托内容描述不能为空'}]}]"/>
- </a-form-item>
- </row-item>
- <row-item>
- <a-form-item
- label="备注"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :rows="4"
- v-decorator="['verifyRepairRemark']"/>
- </a-form-item>
- </row-item>
- </row-list>
- </a-form>
- <template slot="footer">
- <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
- </template>
- </a-modal>
- </template>
- <script>
- import pick from 'lodash.pick'
- import { repairVerify } from '@/api/repair/application-form'
- export default {
- name: 'BaseRepairApplicationForm',
- data () {
- return {
- confirmLoading: false,
- modalTitle: null,
- form: this.$form.createForm(this),
- visible: false,
- // 下拉框map
- sourceMap: {},
- value: 1,
- levelMap: {},
- needStopMap: {},
- descripitionMap: {},
- statusMap: {},
- repairDeptMap: {},
- professorMap: {},
- categoryMap: {},
- model: null,
- userList: []
- }
- },
- components: {
- },
- props: {
- },
- created () {
- // 下拉框map
- this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
- this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
- this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
- this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
- this.repairDeptMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_DEPT_CATEGORY)
- this.professorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_PROFESSOR)
- this.categoryMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_CATEGORY)
- },
- methods: {
- base (record) {
- this.visible = true
- this.model = record
- // 如果是空标识添加
- const { form: { setFieldsValue } } = this
- // 日期处理
- record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'id',
- 'category',
- 'sbCph',
- 'repairProfessor',
- 'repairDeptId',
- 'content'
- ])))
- })
- },
- save () {
- const { form: { validateFieldsAndScroll } } = this
- this.confirmLoading = true
- validateFieldsAndScroll((errors, values) => {
- if (errors) {
- this.confirmLoading = false
- return
- }
- // 日期处理
- values.status = this.value
- console.log(values)
- repairVerify(values)
- .then(() => {
- this.handleCancel(values)
- }).catch(() => {
- this.confirmLoading = false
- })
- })
- },
- handleCancel (values) {
- this.visible = false
- this.confirmLoading = false
- this.form.resetFields()
- if (this.BaseTool.Object.isNotBlank(values)) {
- this.$emit('ok')
- }
- }
- }
- }
- </script>
|