Bladeren bron

优化维修计时功能

guarantee-lsq 2 weken geleden
bovenliggende
commit
119119a749

+ 86 - 27
src/api/repair/application-form.js

@@ -7,7 +7,7 @@ import { stringify } from 'qs'
  * @param parameter
  * @returns {*}
  */
-export function getRepairApplicationFormPage (parameter) {
+export function getRepairApplicationFormPage(parameter) {
   return axios({
     url: '/repair/application-forms/page?' + stringify(parameter),
     method: 'get',
@@ -23,7 +23,7 @@ export function getRepairApplicationFormPage (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function addRepairApplicationForm (parameter) {
+export function addRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms',
     method: 'POST',
@@ -41,7 +41,7 @@ export function addRepairApplicationForm (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function saveFormByApplication (parameter) {
+export function saveFormByApplication(parameter) {
   return axios({
     url: '/repair/application-forms/' + parameter.id,
     method: 'POST',
@@ -55,7 +55,7 @@ export function saveFormByApplication (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function updateRepairApplicationForm (parameter) {
+export function updateRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms/' + parameter.id,
     method: 'PUT',
@@ -69,7 +69,7 @@ export function updateRepairApplicationForm (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function fetchRepairApplicationForm (parameter) {
+export function fetchRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms/' + parameter.id,
     method: 'get',
@@ -85,7 +85,7 @@ export function fetchRepairApplicationForm (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function queryRepairApplicationForm (parameter) {
+export function queryRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms?' + stringify(parameter),
     method: 'get',
@@ -101,7 +101,7 @@ export function queryRepairApplicationForm (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function deleteRepairApplicationForms (parameter) {
+export function deleteRepairApplicationForms(parameter) {
   return axios({
     url: '/repair/application-forms',
     method: 'DELETE',
@@ -115,7 +115,7 @@ export function deleteRepairApplicationForms (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function deleteRepairApplicationForm (parameter) {
+export function deleteRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms/' + parameter.id,
     method: 'DELETE',
@@ -129,7 +129,7 @@ export function deleteRepairApplicationForm (parameter) {
  * @param parameter :
  * @returns {*}
  */
-export function exportRepairApplicationForm (parameter) {
+export function exportRepairApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms/export?' + stringify(parameter),
     method: 'get',
@@ -139,13 +139,14 @@ export function exportRepairApplicationForm (parameter) {
     responseType: 'blob'
   })
 }
+
 /**
  * export file
  * parameter: { }
  * @param parameter :
  * @returns {*}
  */
-export function exportRepairApplicationForm2 (parameter) {
+export function exportRepairApplicationForm2(parameter) {
   return axios({
     url: '/repair/application-forms/export2?' + stringify(parameter),
     method: 'get',
@@ -155,13 +156,14 @@ export function exportRepairApplicationForm2 (parameter) {
     responseType: 'blob'
   })
 }
+
 /**
  * finish func
  * parameter: { }
  * @param parameter
  * @returns {*}
  */
-export function changeApplicationForm (parameter) {
+export function changeApplicationForm(parameter) {
   return axios({
     url: '/repair/application-forms/change/' + parameter.id,
     method: 'PUT',
@@ -175,7 +177,7 @@ export function changeApplicationForm (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function finish (parameter) {
+export function finish(parameter) {
   return axios({
     url: '/repair/application-forms/finish/' + parameter.id,
     method: 'PUT',
@@ -189,7 +191,7 @@ export function finish (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function examine (parameter) {
+export function examine(parameter) {
   return axios({
     url: '/repair/application-forms/examine/' + parameter.id,
     method: 'PUT',
@@ -203,7 +205,7 @@ export function examine (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function examineOk (result, parameter) {
+export function examineOk(result, parameter) {
   return axios({
     url: '/repair/application-forms/examined/' + parameter.id + '/' + result,
     method: 'PUT',
@@ -217,7 +219,7 @@ export function examineOk (result, parameter) {
  * @param parameter
  * @returns {*}
  */
-export function dispatchModelByDTO (parameter) {
+export function dispatchModelByDTO(parameter) {
   return axios({
     url: '/repair/application-forms/dispatch/' + parameter.id,
     method: 'PUT',
@@ -231,7 +233,7 @@ export function dispatchModelByDTO (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function receive (parameter) {
+export function receive(parameter) {
   return axios({
     url: '/repair/application-forms/deal/' + parameter.id,
     method: 'PUT',
@@ -245,7 +247,7 @@ export function receive (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function approve (parameter) {
+export function approve(parameter) {
   return axios({
     url: '/repair/application-forms/approve/' + parameter.id,
     method: 'PUT',
@@ -259,20 +261,21 @@ export function approve (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function returnRepair (parameter) {
+export function returnRepair(parameter) {
   return axios({
     url: '/repair/application-forms/returnRepair/' + parameter.id,
     method: 'PUT',
     data: parameter
   })
 }
+
 /**
-   * update func
-   * parameter: { }
-   * @param parameter
-   * @returns {*}
-   */
-export function rejectRepair (parameter) {
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function rejectRepair(parameter) {
   return axios({
     url: '/repair/application-forms/refuse/order',
     method: 'PUT',
@@ -286,7 +289,7 @@ export function rejectRepair (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function transfer (parameter) {
+export function transfer(parameter) {
   return axios({
     url: '/repair/application-forms/transfer/' + parameter.id,
     method: 'PUT',
@@ -300,7 +303,7 @@ export function transfer (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function transferApprove (parameter) {
+export function transferApprove(parameter) {
   return axios({
     url: '/repair/application-forms/transfer-approve/' + parameter.id,
     method: 'PUT',
@@ -314,10 +317,66 @@ export function transferApprove (parameter) {
  * @param parameter
  * @returns {*}
  */
-export function transferReject (parameter) {
+export function transferReject(parameter) {
   return axios({
     url: '/repair/application-forms/transfer-reject/' + parameter.id,
     method: 'PUT',
     data: parameter
   })
 }
+
+/**
+ * 开始维修
+ * parameter: { id, repairUserId, repairDispatchRemark }
+ * @param parameter
+ * @returns {*}
+ */
+export function startRepair(parameter) {
+  return axios({
+    url: '/repair/application-forms/start/repair/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * 暂停维修
+ * parameter: { id, repairUserId, repairDispatchRemark }
+ * @param parameter
+ * @returns {*}
+ */
+export function pauseRepair(parameter) {
+  return axios({
+    url: '/repair/application-forms/pause/repair/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * 继续维修
+ * parameter: { id, repairUserId, repairDispatchRemark }
+ * @param parameter
+ * @returns {*}
+ */
+export function continueRepair(parameter) {
+  return axios({
+    url: '/repair/application-forms/continue/repair/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * 结束维修
+ * parameter: { id, repairUserId, repairDispatchRemark }
+ * @param parameter
+ * @returns {*}
+ */
+export function endRepair(parameter) {
+  return axios({
+    url: '/repair/application-forms/end/repair/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}

+ 9 - 0
src/utils/dict.js

@@ -818,6 +818,15 @@ DictCache.VALUE = {
     TRANSFER_APPROVAL: 8 // 转派审批中
   },
   /**
+   * 维修辅助状态
+   */
+  REPAIR_ASSISTANT_STATUS: {
+    init: 'init', // 初始化
+    repair: 'repair', // 维修中
+    pause: 'pause', // 暂停
+    end: 'end' // 完成维修
+  },
+  /**
    * 维修状态
    */
   REPAIR_FORM_STATUS: {

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

@@ -180,19 +180,29 @@ export default {
           dataIndex: 'index',
           checked: true,
           width: '70px',
+          align: 'center',
           customRender: (text, record, index) => {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
         {
+          title: '报修单号',
+          checked: true,
+          align: 'center',
+          width: '200px',
+          dataIndex: 'no'
+        },
+        {
           title: '设备编号',
           checked: true,
+          align: 'center',
           width: '100px',
           dataIndex: 'sbNo'
         },
         {
           title: '设备名称',
           checked: true,
+          align: 'center',
           width: '150px',
           dataIndex: 'sbId',
           customRender: (text, record, index) => {
@@ -200,34 +210,8 @@ export default {
           }
         },
         {
-          title: '紧急程度',
-          checked: true,
-          width: '120px',
-          dataIndex: 'level',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.levelMap, text)
-          }
-        },
-        {
-          title: '故障类型',
-          checked: true,
-          width: '120px',
-          dataIndex: 'repairErrorTypeId',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.faultTypeMap, text)
-          }
-        },
-        {
-          title: '工单类型',
-          checked: true,
-          width: '100px',
-          dataIndex: 'category',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.planFlagMap, text)
-          }
-        },
-        {
           title: '报修时间',
+          align: 'center',
           checked: true,
           width: '200px',
           dataIndex: 'applyTime'
@@ -251,23 +235,57 @@ export default {
         }, */
         {
           title: '创建日期',
+          align: 'center',
           width: '200px',
           dataIndex: 'createdTime'
         },
         {
           title: '报修人',
+          align: 'center',
           checked: true,
           width: '120px',
           dataIndex: 'actualUser'
         },
         {
           title: '维修人',
+          align: 'center',
           checked: true,
-          width: '120px',
+          width: '100px',
           dataIndex: 'repairUserName'
         },
         {
+          title: '紧急程度',
+          checked: true,
+          align: 'center',
+          width: '120px',
+          dataIndex: 'level',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '故障类型',
+          checked: true,
+          align: 'center',
+          width: '120px',
+          dataIndex: 'repairErrorTypeId',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.faultTypeMap, text)
+          }
+        },
+        {
+          title: '工单类型',
+          align: 'center',
+          checked: true,
+          width: '150px',
+          dataIndex: 'category',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.planFlagMap, text)
+          }
+        },
+        {
           title: '报修状态',
+          align: 'center',
           checked: true,
           width: '100px',
           fixed: 'right',

+ 86 - 10
src/views/repair/application-form/modules/DetailRepair.vue

@@ -24,13 +24,22 @@
               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>
+              style="margin-left: 8px" type="default" @click="handleDispatch">二次派工</a-button>
             <a-button
               v-if="$auth('repair-application-forms-transfer') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status"
               style="margin-left: 8px" type="default" @click="handleTransfer">转派</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>
+            <!-- 新增维修开始、暂停、继续维修、结束按钮 -->
+            <a-button v-if=" DictCache.VALUE.REPAIR_ASSISTANT_STATUS.init === model.assistantStatus "
+              style="margin-left: 8px" @click="handleStartRepair">开始维修</a-button>
+            <a-button v-if=" DictCache.VALUE.REPAIR_ASSISTANT_STATUS.repair === model.assistantStatus "
+                      style="margin-left: 8px" @click="handlePauseRepair">暂停维修</a-button>
+            <a-button v-if=" DictCache.VALUE.REPAIR_ASSISTANT_STATUS.pause === model.assistantStatus "
+                      style="margin-left: 8px" @click="handleContinueRepair">继续维修</a-button>
+            <a-button v-if=" DictCache.VALUE.REPAIR_ASSISTANT_STATUS.pause === model.assistantStatus "
+                      style="margin-left: 8px" @click="handleEndRepair">结束维修</a-button>
             <!-- 隐藏查看工单中的修改按钮 -->
             <!-- <a-button v-if="$auth('repair-application-forms-edit')" style="margin-left: 8px" type="default" @click="handleEdit()">修改</a-button> -->
             <a-popconfirm v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT === model.status"
@@ -88,9 +97,10 @@
           <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.repairDispatchTime }}</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>
+            <detail-list-item term="维修耗时">{{ model.repairMinutes ? model.repairMinutes + '小时' : '/' }}</detail-list-item>
             <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
             <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
           </detail-list>
@@ -110,7 +120,7 @@
           </detail-list>
           <a-divider orientation="left">委外记录</a-divider>
           <a-table :data-source="entrustList" :columns="columnsEntrust" tableLayout="auto" rowKey="id"
-            v-if="entrustList.length > 0">
+            v-if="entrustList != null && entrustList.length > 0">
             <span slot="entrustStatus" slot-scope="text">
               <badge :text="text === 1 ? '委外维修中' : '已完成'" :status="text === 1 ? 'processing' : 'success'" />
             </span>
@@ -121,12 +131,21 @@
               <a @click="handleViewEntrust(record)">查看</a>
             </span>
           </a-table>
-          <div v-if="entrustList.length === 0" style="margin-bottom: 16px; color: #999;">暂无委外记录</div>
-          <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
+          <div v-if="entrustList == null || entrustList.length === 0" style="margin-bottom: 16px; color: #999;">暂无委外记录</div>
+          <a-divider v-if="dispatchList != null" orientation="left">派工记录</a-divider>
           <detail-list v-for="(item, index) in dispatchList" title="" :key="index" :col="3">
-            <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
+            <detail-list-item term="派工人">{{ item.operatorName }}</detail-list-item>
+            <detail-list-item term="派工时间">{{ item.time }}</detail-list-item>
+            <detail-list-item term="派工备注">{{ item.remark }}</detail-list-item>
+            <detail-list-item v-if="item.approverName" term="派工对象">{{ item.username }}</detail-list-item>
+          </detail-list>
+          <div v-if="dispatchList == null || dispatchList.length === 0" style="margin-bottom: 16px; color: #999;">暂无派工记录</div>
+          <a-divider v-if="transferList != null" orientation="left">转派记录</a-divider>
+          <detail-list v-for="(item, index) in transferList" title="" :key="index" :col="3">
+            <detail-list-item term="转派人">{{ item.operatorName }}</detail-list-item>
             <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
             <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
+            <detail-list-item term="转派对象">{{ item.username }}</detail-list-item>
             <detail-list-item term="审批状态" v-if="item.type === 'transfer'">
               <badge :text="getTransferStatusText(item.status)" :status="getTransferBadgeStatus(item.status)" />
             </detail-list-item>
@@ -134,6 +153,7 @@
             <detail-list-item v-if="item.approveTime" term="审批时间">{{ item.approveTime }}</detail-list-item>
             <detail-list-item v-if="item.approveRemark" term="审批意见">{{ item.approveRemark }}</detail-list-item>
           </detail-list>
+          <div v-if="transferList == null || transferList.length === 0" style="margin-bottom: 16px; color: #999;">暂无转派记录</div>
           <a-divider orientation="left">审核详情</a-divider>
           <detail-list title="" :col="3">
             <detail-list-item term="审核开始时间">{{ model.checkStartTime }}</detail-list-item>
@@ -149,6 +169,7 @@
           <div style="margin-top: 30px;margin-left: 30px;">
             <a-steps progress-dot :current="6" direction="vertical">
               <a-step title="报修时间:" :description="'' + model.applyTime ? model.applyTime : ''" />
+              <a-step title="派工/接单时间:" :description="'' + model.repairDispatchTime ? model.repairDispatchTime : ''" />
               <a-step title="维修开始时间:" :description="'' + model.repairStartTime ? model.repairStartTime : ''" />
               <a-step title="维修结束时间:" :description="'' + model.repairEndTime ? model.repairEndTime : ''" />
               <a-step title="审核开始时间:" :description="'' + model.checkStartTime ? model.checkStartTime : ''" />
@@ -260,7 +281,14 @@
 
 <script>
 import DetailList from '@/components/tools/DetailList'
-import { fetchRepairApplicationForm, examine, approve, receive } from '@/api/repair/application-form'
+import {
+  fetchRepairApplicationForm,
+  examine,
+  approve,
+  receive,
+  startRepair,
+  pauseRepair, continueRepair, endRepair
+} from '@/api/repair/application-form'
 import { getRepairEntrustByRepairId } from '@/api/repair/entrust'
 import DetailOut from './DetailRepairOut'
 import CheckForm from './CheckForm'
@@ -336,6 +364,7 @@ export default {
       needStopMap: {},
       planFlagMap: {},
       dispatchList: [],
+      transferList: [],
       visible: false,
       showSbFlag: false,
       sbInfo: {},
@@ -576,6 +605,7 @@ export default {
         updateUserName: null,
         repairFormVO: null,
         repairCheckVO: null,
+        repairDispatchTime: null
       },
     }
   },
@@ -606,7 +636,8 @@ export default {
       this.entrustList = []
       // 收起上一条工单可能残留的委外详情卡片
       this.closeEntrustDetail()
-      this.dispatchList = JSON.parse(record.repairDispatchList)
+      this.dispatchList = JSON.parse(record.repairDispatchList || '[]')
+      this.transferList = JSON.parse(record.repairTransferList || '[]')
       const sbId = record.sbId
       if (sbId) {
         fetchSbInfo({ id: sbId }).then((res) => {
@@ -790,7 +821,8 @@ export default {
         this.loading = false
         this.model = res.data
         this.visible = true
-        this.dispatchList = JSON.parse(this.model.repairDispatchList)
+        this.dispatchList = JSON.parse(this.model.repairDispatchList || '[]')
+        this.transferList = JSON.parse(this.model.repairTransferList || '[]')
       })
       this.init()
     },
@@ -807,7 +839,51 @@ export default {
       })
       this.init()
     },
-    handleDispatch() {
+    // 开始维修
+    handleStartRepair () {
+      startRepair({ id: this.model.id }).then((res) => {
+        this.loading = false
+        this.visible = true
+        this.model.assistantStatus = this.DictCache.VALUE.REPAIR_ASSISTANT_STATUS.repair
+        this.$message.info('维修开始计时')
+      })
+      this.init()
+    },
+
+    // 暂停维修
+    handlePauseRepair () {
+      pauseRepair({ id: this.model.id }).then((res) => {
+        this.loading = false
+        this.visible = true
+        this.model.assistantStatus = this.DictCache.VALUE.REPAIR_ASSISTANT_STATUS.pause
+        this.$message.info('维修暂停计时')
+      })
+      this.init()
+    },
+
+    // 继续维修
+    handleContinueRepair () {
+      continueRepair({ id: this.model.id }).then((res) => {
+        this.loading = false
+        this.visible = true
+        this.model.assistantStatus = this.DictCache.VALUE.REPAIR_ASSISTANT_STATUS.repair
+        this.$message.info('维修继续计时')
+      })
+      this.init()
+    },
+
+    // 结束维修
+    handleEndRepair () {
+      endRepair({ id: this.model.id }).then((res) => {
+        this.loading = false
+        this.visible = true
+        this.model.assistantStatus = this.DictCache.VALUE.REPAIR_ASSISTANT_STATUS.end
+        this.$message.info('维修结束计时')
+      })
+      this.init()
+    },
+
+    handleDispatch () {
       const modal = this.$refs.dispatchForm
       modal.base(this.model)
     },