whj 6 月之前
父節點
當前提交
69697a0e55

+ 13 - 0
src/api/repair/application-form.js

@@ -266,3 +266,16 @@ export function returnRepair (parameter) {
     data: parameter
   })
 }
+/**
+   * update func
+   * parameter: { }
+   * @param parameter
+   * @returns {*}
+   */
+export function rejectRepair (parameter) {
+  return axios({
+    url: '/repair/application-forms/refuse/order',
+    method: 'PUT',
+    data: parameter
+  })
+}

+ 14 - 6
src/views/repair/application-form/modules/DetailRepair.vue

@@ -10,6 +10,7 @@
             <a-popconfirm v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
               <a-button style="margin-left: 8px">接收</a-button>
             </a-popconfirm>
+            <a-button v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" @click="handleReject">拒单</a-button>
             <a-button v-if="$auth('repair-application-forms-out') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING >= model.status) && model.type != 2" style="margin-left: 8px" type="default" @click="handleOut">委外</a-button>
             <a-button v-if="$auth('repair-application-forms-dispatch') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status" style="margin-left: 8px" type="default" @click="handleDispatch">转派</a-button>
             <a-button v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="default" @click="handleFinish()">完成</a-button>
@@ -31,9 +32,9 @@
             <detail-list-item term="预留维修时间">{{ model.limitHours }}</detail-list-item>
             <detail-list-item term="使用位置">{{ model.sbCph }}</detail-list-item>
             <detail-list-item term="工单类别">{{ BaseTool.Object.getField(planFlagMap,model.category) }}</detail-list-item>
-<!--            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>-->
+            <!--            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>-->
             <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
-<!--            <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
+            <!--            <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
             <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>-->
             <detail-list-item term="报修时间">{{ model.applyTime }}</detail-list-item>
             <detail-list-item term="报修状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[model.status]"/></detail-list-item>
@@ -57,7 +58,7 @@
           </detail-list>
           <a-divider orientation="left">维修详情</a-divider>
           <detail-list title="" :col="3">
-<!--            <detail-list-item term="故障类别">{{ model.repairErrorTypeName }}</detail-list-item>-->
+            <!--            <detail-list-item term="故障类别">{{ model.repairErrorTypeName }}</detail-list-item>-->
             <detail-list-item term="维修开始时间">{{ model.repairStartTime }}</detail-list-item>
             <detail-list-item term="维修结束时间">{{ model.repairEndTime }}</detail-list-item>
             <detail-list-item term="维修耗时">{{ model.repairMinutes }}小时</detail-list-item>
@@ -173,7 +174,7 @@
                 <a @click="handleViewReason(record)">查看</a>
                 <operation-button
                   @click="handleEditReason(record)" >修改</operation-button>
-<!--                <operation-button
+                <!--                <operation-button
                   v-if="$auth('repair-application-forms-finish') && ( DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)"
                   @click="handleCopyReason(record)" >复制</operation-button>-->
                 <operation-button
@@ -218,6 +219,7 @@
     <base-form ref="baseRepairProjectModal" @ok="handleOk"/>
     <detail ref="detailRepairProjectModal"/>
     <edit-form ref="editForm" @ok="handleOk" />
+    <RejectForm ref="rejectForm" @ok="handleOk" />
   </div>
 </template>
 
@@ -225,6 +227,7 @@
 import DetailList from '@/components/tools/DetailList'
 import { fetchRepairApplicationForm, examine, approve, receive } from '@/api/repair/application-form'
 import CheckForm from './CheckForm'
+import RejectForm from './RejectForm'
 import BaseOutForm from './BaseOutForm'
 import FinishForm from './FinishForm'
 import EditForm from './EditForm'
@@ -278,7 +281,8 @@ export default {
     BaseFormForRepair,
     SpareStoreSelectModal,
     BaseForm,
-    Detail
+    Detail,
+    RejectForm
   },
   data () {
     return {
@@ -647,6 +651,10 @@ export default {
       const modal = this.$refs.checkForm
       modal.base(this.model)
     },
+    handleReject () {
+      const modal = this.$refs.rejectForm
+      modal.base(this.model)
+    },
     handleOk () {
       this.loading = true
       fetchRepairApplicationForm({ id: this.model.id }).then(res => {
@@ -808,4 +816,4 @@ export default {
   margin: 5px;
   display: inline-block;
 }
-</style>
+</style>

+ 93 - 0
src/views/repair/application-form/modules/RejectForm.vue

@@ -0,0 +1,93 @@
+<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-form-item>
+
+      <a-form-item
+        label="拒单理由"
+        :labelCol="BaseTool.Constant.labelCol2"
+        :wrapperCol="BaseTool.Constant.wrapperCol2"
+      >
+        <a-textarea
+          :rows="4"
+          v-decorator="['refuseRemark', {rules: [{required: true, message: '拒单理由不能为空'}]}]"/>
+      </a-form-item>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { rejectRepair } from '@/api/repair/application-form'
+
+export default {
+  name: 'BaseRepairApplicationForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      model: null
+    }
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.model = record
+      console.log(record)
+      // 如果是空标识添加
+      this.modalTitle = '拒单'
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue({
+          id: record.id
+        })
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        rejectRepair(values)
+          .then(() => {
+            this.$message.success('操作成功')
+            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>