123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <a-modal
- :title="modalTitle"
- :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-input v-decorator="['category']" type="hidden"/>
- </a-form-item>
- <row-list :col="2" v-if="type!==20">
- <row-item>
- <a-form-item
- label="审核"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select v-model="check" >
- <a-select-option :value="1">
- 通过
- </a-select-option>
- <a-select-option :value="0">
- 拒绝
- </a-select-option>
- </a-select>
- </a-form-item>
- </row-item>
- </row-list>
- <row-list v-if="(this.type === 17 && this.check === 1) || this.type === 20" :col="2">
- <row-item >
- <a-form-item
- label="生产审核人"
- :labelCol="BaseTool.Constant.labelCol"
- :wrapperCol="BaseTool.Constant.wrapperCol"
- >
- <a-select
- v-decorator="['produceVerifyUserId', {rules: [{required: true, message: '生产审核人不能为空'}]}]"
- placeholder="请选择">
- <a-select-option
- v-for="item in userMap"
- :key="item.userId"
- :label="item.realName"
- :value="item.userId">{{ item.realName }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </row-item>
- </row-list>
- <row-list :col="1">
- <row-item>
- <a-form-item
- label="备注"
- :labelCol="BaseTool.Constant.labelCol2"
- :wrapperCol="BaseTool.Constant.wrapperCol2"
- >
- <a-textarea
- :rows="4"
- v-decorator="['remark']"/>
- </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 {
- approve,
- returnRepair,
- verifyPassRepair,
- verifyRefusedRepair,
- verifyProduceRefusedRepair,
- verifyProduceRepair,
- applyVerifyRepair,
- getProducerUser
- } from '@/api/repair/application-form'
- export default {
- name: 'BaseRepairApplicationForm',
- data () {
- return {
- confirmLoading: false,
- modalTitle: '审核',
- form: this.$form.createForm(this),
- visible: false,
- check: 1,
- type: null,
- // 下拉框map
- model: null,
- userMap: []
- }
- },
- components: {
- },
- props: {
- },
- created () {
- // 下拉框map
- },
- methods: {
- base (record, type) {
- this.visible = true
- this.model = record
- this.type = type
- this.getUser()
- const { form: { setFieldsValue } } = this
- // 日期处理
- this.$nextTick(() => {
- setFieldsValue(Object.assign(pick(record, [
- 'id',
- 'category'
- ])))
- })
- },
- getUser () {
- getProducerUser().then(res => {
- this.userMap = res.data
- })
- },
- save () {
- const { form: { validateFieldsAndScroll } } = this
- this.confirmLoading = true
- validateFieldsAndScroll((errors, values) => {
- if (errors) {
- this.confirmLoading = false
- return
- }
- switch (true) {
- case this.type === 15 && this.check === 1:
- approve(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 15 && this.check === 0:
- returnRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 17 && this.check === 1:
- verifyPassRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 17 && this.check === 0:
- verifyRefusedRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 19 && this.check === 1:
- verifyProduceRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 19 && this.check === 0:
- verifyProduceRefusedRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- case this.type === 20:
- applyVerifyRepair(values).then(res => {
- this.$message.success(res.message)
- this.handleCancel()
- })
- break
- }
- })
- },
- handleCancel () {
- this.visible = false
- this.check = 1
- this.type = null
- this.confirmLoading = false
- this.form.resetFields()
- this.$emit('ok')
- }
- }
- }
- </script>
|