Ver Fonte

维修模式-默认模式

guarantee-lsq há 2 anos atrás
pai
commit
8a11e32120
2 ficheiros alterados com 40 adições e 1 exclusões
  1. 12 0
      src/utils/dict.js
  2. 28 1
      src/views/repair/application-form/RepairForm.vue

+ 12 - 0
src/utils/dict.js

@@ -8,9 +8,13 @@ const DictCache = {
   DICT_VALUE_BY_CODE: 'dict:code',
   DICT_OBJ_BY_VALUE: 'dict:value:obj',
   DICT_CHILDREN_ALL: 'dict:children-all',
+  CONFIG_OPEN_VALUE: 'config:open:value',
   baseGet (key) {
     return Vue.ls.get(this.BASE_DATA_CACHE)[key]
   },
+  getConfigValueByType (type) {
+    return this.baseGet(this.CONFIG_OPEN_VALUE)[type]
+  },
   getChildren (type, value, childValue) {
     const children = this.baseGet(this.DICT_CHILDREN)[type]
     const child = children[value]
@@ -65,6 +69,7 @@ const DictCache = {
 
 }
 DictCache.TYPE = {
+  REPAIR_STRATEGY_MODEL: 'REPAIR_STRATEGY_MODEL', // 报修模式选择
   ACTIVITI_USER_MODEL_TYPE: 'ACTIVITI_USER_MODEL_TYPE', // 审批业务用户模型
   SB_QR_CODE_LABEL_WIDTH: 'SB_QR_CODE_LABEL_WIDTH', // 设备标签宽度
   SB_QR_CODE_LABEL_CONTENT_WIDTH: 'SB_QR_CODE_LABEL_CONTENT_WIDTH', // 设备标签表格宽度
@@ -339,6 +344,13 @@ DictCache.VALUE = {
      */
     BACK_PURCHASE_AUDIT: 7
   },
+  /**
+   * 维修模式
+   */
+  REPAIR_MODEL_TYPE: {
+    BASE_MODEL: '1',
+    DISPATCH: '2'
+  },
 
   /**
    * 明细类型

+ 28 - 1
src/views/repair/application-form/RepairForm.vue

@@ -110,8 +110,15 @@
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-dispatch')"
               @click="handleDispatching(record)" >派工</operation-button>-->
             <operation-button
+              v-show='dispatchFlag'
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-dispatch')"
               @click="handleAssign(record)" >派工</operation-button>
+            <operation-button
+              v-show='!dispatchFlag'
+              v-if="$auth('repair-application-forms-deal') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === record.status)"
+              :type='2'
+              title="是否要接收?"
+              @confirm="handleReceive(record)">接收</operation-button>
           </template>
         </span>
         <span slot="status" slot-scope="text">
@@ -138,7 +145,13 @@ import BaseOutForm from './modules/BaseOutForm'
 import AssignForm from './modules/AssignForm'
 import Detail from './modules/DetailRepair'
 import DetailOut from './modules/DetailRepairOut'
-import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
+import {
+  getRepairApplicationFormPage,
+  deleteRepairApplicationForms,
+  fetchRepairApplicationForm,
+  exportRepairApplicationForm,
+  receive
+} from '@/api/repair/application-form'
 import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
 
 export default {
@@ -173,6 +186,7 @@ export default {
 
       },
       visible: true,
+      dispatchFlag: true,
       // 表头
       columns: [
         {
@@ -330,6 +344,10 @@ export default {
     }
   },
   created () {
+    const repairModel = this.DictCache.getConfigValueByType(this.DictCache.TYPE.REPAIR_STRATEGY_MODEL)
+    if (repairModel === this.DictCache.VALUE.REPAIR_MODEL_TYPE.BASE_MODEL) {
+      this.dispatchFlag = false
+    }
     // 下拉框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)
@@ -405,6 +423,15 @@ export default {
       const modal = this.$refs.assignForm
       modal.base(record)
     },
+    handleReceive (record) {
+      const temp = this
+      fetchRepairApplicationForm({ id: record.id }).then(res => {
+        receive(res.data).then(() => {
+          temp.handleOk()
+        })
+      })
+    },
+
     handleOk () {
       this.visible = true
       this.queryParam.searchStartTime = this.queryParam.searchStartTime ? this.BaseTool.Date.formatter(this.queryParam.searchStartTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null