Bladeren bron

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/repair/application-form/modules/DetailRepair.vue
xiongchao 4 jaren geleden
bovenliggende
commit
4b11adb2e7

+ 128 - 0
src/api/repair/repair-reason.js

@@ -0,0 +1,128 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getRepairReasonPage (parameter) {
+    return axios({
+        url: '/repair/repair-reasons/page?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons',
+        method: 'POST',
+        headers: {
+            'Accept': 'application/json',
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        data: parameter
+    })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons/' + parameter.id,
+        method: 'PUT',
+        data: parameter
+    })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons/' + parameter.id,
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteRepairReasons (parameter) {
+    return axios({
+        url: '/repair/repair-reasons',
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons/' + parameter.id,
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportRepairReason (parameter) {
+    return axios({
+        url: '/repair/repair-reasons/export?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        responseType: 'blob'
+    })
+}

+ 1 - 0
src/router/generator-platform-routers.js

@@ -179,6 +179,7 @@ const constantRouterComponents = {
   'RepairFee': () => import('@/views/repair/fee/RepairFee'),
   // 维修项目
   'RepairProject': () => import('@/views/repair/repairproject/RepairProject'),
+  'RepairReason': () => import('@/views/repair/repair-reason/RepairReason'),
   // 生产商
   'FirmProducer': () => import('@/views/firm/producer/FirmProducer'),
   // 报表管理

+ 1 - 0
src/utils/dict.js

@@ -115,6 +115,7 @@ DictCache.TYPE = {
   REPAIR_FORM_STATUS: 'REPAIR_FORM_STATUS', // 维修状态
   REPAIR_CHECK_STATUS: 'REPAIR_CHECK_STATUS', // 验收状态
   REPAIR_FEE_TYPE: 'REPAIR_FEE_TYPE', // 费用类别
+  REPAIR_OUT_TYPE: 'REPAIR_OUT_TYPE', // 费用类别
   REPAIR_PROJECT_TYPE: 'REPAIR_PROJECT_TYPE', // 费用类别
   REPAIR_TECHNOLOGY_TYPE: 'REPAIR_TECHNOLOGY_TYPE', // 费用类别
   /* 点巡检模块 */

+ 8 - 3
src/views/repair/application-form/MyRepairForm.vue

@@ -20,7 +20,8 @@
       </div>
 
       <div class="table-operator">
-<!--        <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base({},{filter: -1})">新增</a-button>-->
+        <!--        <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base({},{filter: -1})">新增</a-button>-->
+        <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseOutModal.base()">新增委外</a-button>
         <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
         <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-application-forms-del')">
           <a-menu slot="overlay">
@@ -71,6 +72,7 @@
     </div>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
+    <detail-out ref="detailOutModal" @ok="handleOk"/>
     <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
   </a-card>
 </template>
@@ -79,6 +81,7 @@
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
 import Detail from './modules/DetailRepair'
+import DetailOut from './modules/DetailRepairOut'
 import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
 import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
 
@@ -89,6 +92,7 @@ export default {
     Ellipsis,
     BaseForm,
     Detail,
+    DetailOut,
     DispatchBaseForm
   },
   data () {
@@ -148,7 +152,7 @@ export default {
           checked: true,
           dataIndex: 'needStop',
           customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.needStopMap,text)
+            return this.BaseTool.Object.getField(this.needStopMap, text)
           }
         },
         {
@@ -265,7 +269,8 @@ export default {
     handleView (record) {
       fetchRepairApplicationForm({ id: record.id }).then(res => {
         this.visible = false
-        const modal = this.$refs.detailModal
+        const type = res.data.type
+        const modal = type === 2 ? this.$refs.detailOutModal : this.$refs.detailModal
         modal.base(res.data)
       })
     },

+ 1 - 0
src/views/repair/application-form/RepairApplicationForm.vue

@@ -186,6 +186,7 @@ export default {
         parameter = {
           ...parameter,
           ...this.queryParam,
+          type: 1,
           dataScope: {
             sortBy: 'desc',
             sortName: 'update_time'

+ 19 - 10
src/views/repair/application-form/RepairForm.vue

@@ -21,6 +21,7 @@
 
       <div class="table-operator">
         <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base({},{filter: -1})">新增</a-button>
+        <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseOutModal.base()">新增委外</a-button>
         <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
         <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-application-forms-del')">
           <a-menu slot="overlay">
@@ -50,17 +51,17 @@
             <operation-button
               v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
               @click="handleEdit(record)" >修改</operation-button>
-<!--            <operation-button-->
-<!--              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"-->
-<!--              :type="2"-->
-<!--              title="是否要删除该条数据?"-->
-<!--              @confirm="batchDelete(record.id)">删除</operation-button>-->
+            <!--            <operation-button-->
+            <!--              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"-->
+            <!--              :type="2"-->
+            <!--              title="是否要删除该条数据?"-->
+            <!--              @confirm="batchDelete(record.id)">删除</operation-button>-->
             <!--<operation-button
               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-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
-               @click="handleAssign(record)" >派工</operation-button>
+            <operation-button
+              v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
+              @click="handleAssign(record)" >派工</operation-button>
           </template>
         </span>
         <span slot="status" slot-scope="text">
@@ -72,7 +73,9 @@
       </s-table>
     </div>
     <base-form ref="baseModal" @ok="handleOk"/>
+    <base-out-form ref="baseOutModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
+    <detail-out ref="detailOutModal" @ok="handleOk"/>
     <assign-form ref="assignForm" @ok="handleOk" />
     <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
   </a-card>
@@ -81,8 +84,10 @@
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+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 DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
 
@@ -92,6 +97,8 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
+    BaseOutForm,
+    DetailOut,
     AssignForm,
     Detail,
     DispatchBaseForm
@@ -263,14 +270,16 @@ export default {
     },
     handleEdit (record) {
       fetchRepairApplicationForm({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
+        const type = res.data.type
+        const modal = type === 2 ? this.$refs.baseOutModal : this.$refs.baseModal
         modal.base(res.data)
       })
     },
     handleView (record) {
       fetchRepairApplicationForm({ id: record.id }).then(res => {
         this.visible = false
-        const modal = this.$refs.detailModal
+        const type = res.data.type
+        const modal = type === 2 ? this.$refs.detailOutModal : this.$refs.detailModal
         modal.base(res.data)
       })
     },

+ 3 - 3
src/views/repair/application-form/modules/BaseForm.vue

@@ -155,7 +155,7 @@
               :treeData="treeData"
               :treeNodeFilterProp="'title'"
               :showSearch="true"
-              v-decorator="['repairErrorTypeId', {rules: [{required: true, message: '故障类别不能为空'}]}]"
+              v-decorator="['repairErrorTypeId']"
               placeholder="请选择"
             >
             </a-tree-select>
@@ -218,13 +218,13 @@
         </row-item>-->
         <row-item>
           <a-form-item
-            label="备注"
+            label="故障描述"
             :labelCol="BaseTool.Constant.labelCol2"
             :wrapperCol="BaseTool.Constant.wrapperCol2"
           >
             <a-textarea
               :rows="4"
-              v-decorator="['remark']"/>
+              v-decorator="['content']"/>
           </a-form-item>
         </row-item>
       </row-list>

+ 205 - 0
src/views/repair/application-form/modules/BaseOutForm.vue

@@ -0,0 +1,205 @@
+<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="['mainRepairId']" type="hidden"/>
+      </a-form-item>
+
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="委外订单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['no', {rules: [{required: false, message: '委外订单号不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="委外类别"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['outType']" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in outTypeMap"
+                :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.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['repairUserId', {rules: [{required: true, message: '维修人负责人不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="item in deptUserList"
+                :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="['content']"/>
+          </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 { queryUserDept } from '@/api/upms/user-dept'
+import { addRepairApplicationForm, updateRepairApplicationForm } from '@/api/repair/application-form'
+import PartInfoSelectModal from '@/views/part/info/modules/PartInfoSelectModal'
+import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
+
+export default {
+  name: 'BaseRepairApplicationForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      sourceMap: {},
+      outTypeMap: {},
+      levelMap: {},
+      questionMap: {},
+      needStopMap: {},
+      statusMap: {},
+      userInfo: this.$store.getters.userInfo,
+      deptUserList: []
+    }
+  },
+  components: {
+    SbInfoSelectModal,
+    PartInfoSelectModal
+  },
+  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.questionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_QUESTION)
+    this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
+    this.outTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_OUT_TYPE)
+    this.getDeptUsers()
+  },
+  methods: {
+    base (record, mainForm = {}) {
+      this.visible = true
+      // 如果是空标识添加
+      const { form: { setFieldsValue } } = this
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        if (mainForm != null && mainForm.id != null) {
+          this.$nextTick(() => {
+            setFieldsValue({
+              mainRepairId: mainForm.id
+            })
+          })
+        }
+        return
+      }
+      this.modalTitle = '编辑'
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'sbId',
+          'partId',
+          'type',
+          'outType',
+          'mainRepairId',
+          'repairUserId',
+          'no',
+          'source',
+          'level',
+          'content',
+          'status',
+          'sbName',
+          'partName',
+          'remark'
+        ])))
+      })
+    },
+    getDeptUsers () {
+      queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.XIAN_CHANG_WEI_XIU_ZU, userStatus: 1 }).then(res => {
+        queryUserDept({ deptCode: this.DictCache.VALUE.SYS_DEPT_CODE.CHANG_NEI_WEI_XIU_ZU, userStatus: 1 }).then(res2 => {
+          this.deptUserList = res.data.concat(res2.data)
+        })
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        values.type = 2
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addRepairApplicationForm(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateRepairApplicationForm(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', values)
+      }
+    }
+
+  }
+}
+</script>

+ 255 - 131
src/views/repair/application-form/modules/Detail.vue

@@ -1,135 +1,136 @@
 <template>
-  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
-    <a-row :gutter="48" slot="extra">
-      <a-col :md="48" :sm="48">
-        <span class="table-page-search-submitButtons" style="float: right">
-          <a-button v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="primary" @click="handleApprove()">验收</a-button>
-          <a-button v-if="$auth('repair-application-forms-reback') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="danger" @click="handleReturn()">驳回</a-button>
-          <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
-        </span>
-      </a-col>
-    </a-row>
-    <a-layout>
-      <a-layout-content style="background-color: rgb(255, 255, 255)">
-        <a-divider orientation="left">报修详情</a-divider>
-        <detail-list title="" :col="3">
-          <detail-list-item term="报修单号">{{ model.no }}</detail-list-item>
-          <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
-          <!--<detail-list-item term="部件名称">{{ model.partName }}</detail-list-item>-->
-          <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
-          <detail-list-item term="报修人">{{ model.userName }}</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>
-        </detail-list>
-        <detail-list title="" :col="1">
-          <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
-          <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
-        </detail-list>
-        <detail-list title="报修图片:" :col="6">
-          <upload-image-detail :images-list="model.applicationFileList"/>
-        </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.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.repairUserName }}</detail-list-item>
+  <div>
+    <a-card :bordered="false" :loading="loading" v-show="visible" class="card" :title="modalTitle">
+      <a-row :gutter="48" slot="extra">
+        <a-col :md="48" :sm="48">
+          <span class="table-page-search-submitButtons" style="float: right">
+            <a-button v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="primary" @click="handleApprove()">验收</a-button>
+            <a-button v-if="$auth('repair-application-forms-reback') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" style="margin-left: 8px" type="danger" @click="handleReturn()">驳回</a-button>
+            <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
+          </span>
+        </a-col>
+      </a-row>
+      <a-layout>
+        <a-layout-content style="background-color: rgb(255, 255, 255)">
+          <a-divider orientation="left">报修详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="报修单号">{{ model.no }}</detail-list-item>
+            <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
+            <!--<detail-list-item term="部件名称">{{ model.partName }}</detail-list-item>-->
+            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
+            <detail-list-item term="报修人">{{ model.userName }}</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>
+          </detail-list>
+          <detail-list title="" :col="1">
+            <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
+            <detail-list-item term="故障描述">{{ model.content }}</detail-list-item>
+          </detail-list>
+          <detail-list title="报修图片:" :col="6">
+            <upload-image-detail :images-list="model.applicationFileList"/>
+          </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.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.repairUserName }}</detail-list-item>
           <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
-        </detail-list>
-        <detail-list title="" :col="1">
-          <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
-        </detail-list>
-        <detail-list title="维修图片:" :col="6">
-          <upload-image-detail :images-list="model.repairFileList"/>
-        </detail-list>
-        <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
-        <detail-list v-for="item in dispatchList" title="" :col="3">
-          <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
-          <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
-          <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
-        </detail-list>
-        <a-divider orientation="left">验收详情</a-divider>
-        <detail-list title="" :col="3">
-          <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
-          <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
-          <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
-          <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
-        </detail-list>
-        <detail-list title="验收图片:" :col="6">
-          <upload-image-detail :images-list="model.checkFileList"/>
-        </detail-list>
-      </a-layout-content>
-      <a-layout-sider style="background-color: rgb(255, 255, 255)">
-        <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.repairStartTime?model.repairStartTime:''" />
-            <a-step title="维修结束时间:" :description="''+model.repairEndTime?model.repairEndTime:''" />
-            <a-step title="验收开始时间:" :description="''+model.checkStartTime?model.checkStartTime:''" />
-            <a-step title="验收结束时间:" :description="''+model.checkEndTime?model.checkEndTime:''" />
-          </a-steps>
-        </div>
-      </a-layout-sider>
-    </a-layout>
-    <title-divider title="维修项目" width="90px"></title-divider>
-    <div class="table-operator" 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)">
-      <a-button type="primary" @click="handleRepairProjectSelect">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="data"
-      :columns="columns"
-      tableLayout="auto"
-      rowKey="id">
-    </a-table>
-    <title-divider title="配件清单" width="90px"></title-divider>
-    <div class="table-operator" 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)">
-      <a-button type="primary" @click="handleSpareSelect">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="dataSpare"
-      :columns="columnsSpare"
-      tableLayout="auto"
-      rowKey="id">
+          </detail-list>
+          <detail-list title="" :col="1">
+            <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="维修图片:" :col="6">
+            <upload-image-detail :images-list="model.repairFileList"/>
+          </detail-list>
+          <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
+          <detail-list v-for="item in dispatchList" title="" :col="3">
+            <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
+            <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
+            <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
+          </detail-list>
+          <a-divider orientation="left">验收详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
+            <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
+            <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
+            <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="验收图片:" :col="6">
+            <upload-image-detail :images-list="model.checkFileList"/>
+          </detail-list>
+        </a-layout-content>
+        <a-layout-sider style="background-color: rgb(255, 255, 255)">
+          <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.repairStartTime?model.repairStartTime:''" />
+              <a-step title="维修结束时间:" :description="''+model.repairEndTime?model.repairEndTime:''" />
+              <a-step title="验收开始时间:" :description="''+model.checkStartTime?model.checkStartTime:''" />
+              <a-step title="验收结束时间:" :description="''+model.checkEndTime?model.checkEndTime:''" />
+            </a-steps>
+          </div>
+        </a-layout-sider>
+      </a-layout>
+      <!--    <title-divider title="维修项目" width="90px"></title-divider>-->
+      <!--    <div class="table-operator" 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)">-->
+      <!--      <a-button type="primary" @click="handleRepairProjectSelect">-->
+      <!--        <a-icon type="plus"/>-->
+      <!--        添加-->
+      <!--      </a-button>-->
+      <!--    </div>-->
+      <!--    <a-table-->
+      <!--      :data-source="data"-->
+      <!--      :columns="columns"-->
+      <!--      tableLayout="auto"-->
+      <!--      rowKey="id">-->
+      <!--    </a-table>-->
+      <title-divider title="配件清单" width="90px"></title-divider>
+      <!--      <div class="table-operator" 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)">-->
+      <!--        <a-button type="primary" @click="handleSpareSelect">-->
+      <!--          <a-icon type="plus"/>-->
+      <!--          添加-->
+      <!--        </a-button>-->
+      <!--      </div>-->
+      <a-table
+        :data-source="dataSpare"
+        :columns="columnsSpare"
+        tableLayout="auto"
+        rowKey="id">
 
-    </a-table>
+      </a-table>
 
-    <title-divider title="费用清单" width="90px"></title-divider>
-    <div class="table-operator" 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)">
-      <a-button type="primary" @click="handleAddFee">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="dataFee"
-      :columns="columnsFee"
-      tableLayout="auto"
-      rowKey="id">
-      <span slot="action" slot-scope="record">
-        <template>
-          <a @click="handleViewFee(record)">查看</a>
-          <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="handleEditFee(record)" >修改</operation-button>
+      <title-divider title="费用清单" width="90px"></title-divider>
+      <!--      <div class="table-operator" 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)">-->
+      <!--        <a-button type="primary" @click="handleAddFee">-->
+      <!--          <a-icon type="plus"/>-->
+      <!--          添加-->
+      <!--        </a-button>-->
+      <!--      </div>-->
+      <a-table
+        :data-source="dataFee"
+        :columns="columnsFee"
+        tableLayout="auto"
+        rowKey="id">
+<!--        <span slot="action" slot-scope="record">-->
+<!--          <template>-->
+<!--            <a @click="handleViewFee(record)">查看</a>-->
+<!--            <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="handleEditFee(record)" >修改</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)"
-            :type="2"
-            title="确认删除该笔费用?"
-            @confirm="batchDeleteFee(record.id)" >删除</operation-button>
-        </template>
-      </span>
-    </a-table>
-    <!--<q-tabs :activeKey="activeKey" @change="changeTab">
+<!--            <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)"-->
+<!--              :type="2"-->
+<!--              title="确认删除该笔费用?"-->
+<!--              @confirm="batchDeleteFee(record.id)" >删除</operation-button>-->
+<!--          </template>-->
+<!--        </span>-->
+      </a-table>
+      <!--<q-tabs :activeKey="activeKey" @change="changeTab">
       <q-tab-pane key="a" tab="配件更换">
         <spare-part-used-select-table :type="1" :table-params="{sbId: model.sbId, modelId: model.modelId, repairId: model.id}" ref="sparePartUsedSelectTable"/>
       </q-tab-pane>
@@ -137,12 +138,43 @@
         <spare-pick-form-select-table :type="1" :table-params="{repairId: model.id, repairNo: model.no}" ref="sparePickFormSelectTable"/>
       </q-tab-pane>
     </q-tabs>-->
+      <title-divider title="原因分析" width="90px"></title-divider>
+      <!--      <div class="table-operator" 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)">-->
+      <!--        <a-button type="primary" @click="handleAddReason">-->
+      <!--          <a-icon type="plus"/>-->
+      <!--          添加-->
+      <!--        </a-button>-->
+      <!--      </div>-->
+      <a-table
+        :data-source="dataReason"
+        :columns="columnsReason"
+        tableLayout="fixed"
+        rowKey="id">
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleViewReason(record)">查看</a>
+            <!--            <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="handleEditReason(record)" >修改</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)"-->
+            <!--              :type="2"-->
+            <!--              title="确认删除该记录?"-->
+            <!--              @confirm="batchDeleteReason(record.id)" >删除</operation-button>-->
+          </template>
+        </span>
+      </a-table>
+
+    </a-card>
     <check-form ref="checkForm" @ok="handleOk" />
     <fee-base-form ref="feeForm" @ok="handleOk" />
+    <reason-base-form ref="reasonForm" @ok="handleOk" />
     <finish-form ref="finishForm" @ok="handleOk" />
     <dispatch-form ref="dispatchForm" @ok="handleCancel" />
     <fee-detail ref="feeDetail" @ok="handleOk" />
-  </a-card>
+    <reason-detail ref="reasonDetail" @ok="handleOk" />
+  </div>
 </template>
 
 <script>
@@ -156,8 +188,11 @@ import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SpareP
 import { selectSparePartUsedListByRepairId } from '@/api/sqarepartmanage/sparepartused'
 import { selectRepairProjectListByRepairId } from '@/api/repair/repairprojectrelation'
 import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import ReasonBaseForm from '@/views/repair/repair-reason/modules/BaseForm'
 import FeeDetail from '@/views/repair/fee/modules/Detail'
-import { deleteRepairFees, fetchRepairFee } from '@/api/repair/fee'
+import ReasonDetail from '@/views/repair/repair-reason/modules/Detail'
+import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
+import { deleteRepairReasons, fetchRepairReason, queryRepairReason } from '@/api/repair/repair-reason'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -168,7 +203,9 @@ export default {
     DetailListItem,
     FinishForm,
     FeeDetail,
+    ReasonDetail,
     FeeBaseForm,
+    ReasonBaseForm,
     DispatchForm,
     SparePartUsedSelectTable,
     SparePickFormSelectTable
@@ -182,6 +219,7 @@ export default {
       dispatchList: [],
       activeKey: 'a',
       visible: false,
+      loading: false,
       // 下拉框map
       sourceMap: {},
       levelMap: {},
@@ -193,6 +231,7 @@ export default {
       data: [],
       dataSpare: [],
       dataFee: [],
+      dataReason: [],
       // 表头
       columns: [
         {
@@ -298,6 +337,39 @@ export default {
         {
           title: '备注',
           dataIndex: 'remark'
+        }
+      ],
+      columnsReason: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: '70',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '分析时间',
+          dataIndex: 'analyzeTime',
+          width: '200px'
+        },
+        {
+          title: '问题描述',
+          dataIndex: 'problemDesc',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '原因分析',
+          dataIndex: 'reasonAnalysis',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '改进措施',
+          dataIndex: 'improveMeasure',
+          ellipsis: true,
+          width: '200px'
         },
         {
           title: '操作',
@@ -351,12 +423,21 @@ export default {
       this.modalTitle = '详情'
       this.model = record
       this.dispatchList = JSON.parse(record.repairDispatchList)
-      selectRepairProjectListByRepairId({ id: record.id }).then(res => {
+      this.init()
+    },
+    init () {
+      selectRepairProjectListByRepairId({ id: this.model.id }).then(res => {
         this.data = res.data
       })
-      selectSparePartUsedListByRepairId({ id: record.id }).then(res => {
+      selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
         this.dataSpare = res.data
       })
+      queryRepairFee({ repairId: this.model.id }).then(res => {
+        this.dataFee = res.data
+      })
+      queryRepairReason({ repairId: this.model.id }).then(res => {
+        this.dataReason = res.data
+      })
     },
     handleCancel () {
       this.visible = false
@@ -403,6 +484,42 @@ export default {
         modal.base(res.data)
       })
     },
+    batchDeleteReason (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairReasons(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAddReason () {
+      const modal = this.$refs.reasonForm
+      this.visible = false
+      modal.base(null, this.model)
+    },
+    handleEditReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonForm
+        this.visible = false
+        modal.base(res.data, this.model)
+      })
+    },
+    handleViewReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonDetail
+        modal.base(res.data)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')
@@ -414,15 +531,22 @@ export default {
       modal.base(this.model)
     },
     handleOk () {
+      this.loading = true
       fetchRepairApplicationForm({ id: this.model.id }).then(res => {
+        this.loading = false
         this.model = res.data
+        this.visible = true
         this.dispatchList = JSON.parse(this.model.repairDispatchList)
+        this.init()
       })
     },
     handleFinish () {
       const modal = this.$refs.finishForm
       modal.base(this.model)
     },
+    handleSpareSelect () {
+      this.$refs.spareSelectModal.base()
+    },
     handleDispatch () {
       const modal = this.$refs.dispatchForm
       modal.base(this.model)

+ 284 - 161
src/views/repair/application-form/modules/DetailRepair.vue

@@ -1,154 +1,183 @@
 <template>
-  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
-    <a-row :gutter="48" slot="extra">
-      <a-col :md="48" :sm="48">
-        <span class="table-page-search-submitButtons" style="float: right">
-          <a-button v-if="$auth('repair-application-forms-assign') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status" type="primary" @click="handleAssign">派工</a-button>
-          <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.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
-            <a-button>接收</a-button>
-          </a-popconfirm>
-          <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" type="primary" @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="primary" @click="handleFinish()">维修完成</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="primary" @click="handleSparePick">领用备件</a-button>-->
-          <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
-        </span>
-      </a-col>
-    </a-row>
-    <a-layout>
-      <a-layout-content style="background-color: rgb(255, 255, 255)">
-        <a-divider orientation="left">报修详情</a-divider>
-        <detail-list title="" :col="3">
-          <detail-list-item term="报修单号">{{ model.no }}</detail-list-item>
-          <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
-          <!--<detail-list-item term="部件名称">{{ model.partName }}</detail-list-item>-->
-          <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
-          <detail-list-item term="报修人">{{ model.userName }}</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>
-        </detail-list>
-        <detail-list title="" :col="1">
-          <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
-          <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
-        </detail-list>
-        <detail-list title="报修图片:" :col="6">
-          <upload-image-detail :images-list="model.applicationFileList"/>
-        </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.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.repairUserName }}</detail-list-item>
+  <div>
+    <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+      <a-row :gutter="48" slot="extra">
+        <a-col :md="48" :sm="48">
+          <span class="table-page-search-submitButtons" style="float: right">
+            <a-button v-if="$auth('repair-application-forms-assign') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === model.status" type="primary" @click="handleAssign">派工</a-button>
+            <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.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
+              <a-button>接收</a-button>
+            </a-popconfirm>
+            <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="primary" @click="handleOut">委外</a-button>
+            <a-button v-if="$auth('repair-application-forms-dispatch') && (DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" style="margin-left: 8px" type="primary" @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="primary" @click="handleFinish()">维修完成</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="primary" @click="handleSparePick">领用备件</a-button>-->
+            <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
+          </span>
+        </a-col>
+      </a-row>
+      <a-layout>
+        <a-layout-content style="background-color: rgb(255, 255, 255)">
+          <a-divider orientation="left">报修详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="报修单号">{{ model.no }}</detail-list-item>
+            <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
+            <!--<detail-list-item term="部件名称">{{ model.partName }}</detail-list-item>-->
+            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
+            <detail-list-item term="报修人">{{ model.userName }}</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>
+          </detail-list>
+          <detail-list title="" :col="1">
+            <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
+            <detail-list-item term="故障描述">{{ model.content }}</detail-list-item>
+          </detail-list>
+          <detail-list title="维修图片:" :col="6">
+            <upload-image-detail :images-list="model.repairFileList"/>
+          </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.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.repairUserName }}</detail-list-item>
           <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
-        </detail-list>
-        <detail-list title="" :col="1">
-          <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
-        </detail-list>
-        <detail-list title="维修图片:" :col="6">
-          <upload-image-detail :images-list="model.repairFileList"/>
-        </detail-list>
-        <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
-        <detail-list v-for="item in dispatchList" title="" :col="3">
-          <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
-          <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
-          <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
-        </detail-list>
-        <a-divider orientation="left">验收详情</a-divider>
-        <detail-list title="" :col="3">
-          <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
-          <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
-          <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
-          <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
-        </detail-list>
-        <detail-list title="验收图片:" :col="6">
-          <upload-image-detail :images-list="model.checkFileList"/>
-        </detail-list>
-      </a-layout-content>
-      <a-layout-sider style="background-color: rgb(255, 255, 255)">
-        <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.repairStartTime?model.repairStartTime:''" />
-            <a-step title="维修结束时间:" :description="''+model.repairEndTime?model.repairEndTime:''" />
-            <a-step title="验收开始时间:" :description="''+model.checkStartTime?model.checkStartTime:''" />
-            <a-step title="验收结束时间:" :description="''+model.checkEndTime?model.checkEndTime:''" />
-          </a-steps>
-        </div>
-      </a-layout-sider>
-    </a-layout>
-    <title-divider title="维修项目" width="90px"></title-divider>
-    <div class="table-operator" v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status">
-      <a-button type="primary" @click="handleRepairProjectSelect">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="data"
-      :columns="columns"
-      tableLayout="auto"
-      rowKey="id">
-      <span slot="action" slot-scope="record">
-        <template>
-          <a-popconfirm 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)" title="是否要删除该条数据?" @confirm="batchDelete(record.relationId)">
-            <a>删除</a>
-          </a-popconfirm>
-        </template>
-      </span>
-    </a-table>
-    <title-divider title="备件清单" width="90px"></title-divider>
-    <div class="table-operator" v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status">
-      <a-button type="primary" @click="handleSpareStoreSelect">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="dataSpare"
-      :columns="columnsSpare"
-      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-      tableLayout="auto"
-      rowKey="id">
-      <span slot="actionSpare" slot-scope="record">
-        <template>
-          <a 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="handleEditSpare(record)">修改</a>
-          <a-divider type="vertical" />
-          <a-popconfirm 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)" title="是否要删除该条数据?" @confirm="batchDeleteSpare(record.id)">
-            <a>删除</a>
-          </a-popconfirm>
-        </template>
-      </span>
-    </a-table>
-    <title-divider title="费用清单" width="90px"></title-divider>
-    <div class="table-operator" 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)">
-      <a-button type="primary" @click="handleAddFee">
-        <a-icon type="plus"/>
-        添加
-      </a-button>
-    </div>
-    <a-table
-      :data-source="dataFee"
-      :columns="columnsFee"
-      tableLayout="auto"
-      rowKey="id">
-      <span slot="action" slot-scope="record">
-        <template>
-          <a @click="handleViewFee(record)">查看</a>
-          <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="handleEditFee(record)" >修改</operation-button>
+          </detail-list>
+          <detail-list title="" :col="1">
+            <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="维修图片:" :col="6">
+            <upload-image-detail :images-list="model.repairFileList"/>
+          </detail-list>
+          <a-divider v-if="dispatchList != null" orientation="left">转派详情</a-divider>
+          <detail-list v-for="item in dispatchList" title="" :col="3">
+            <detail-list-item term="转派人">{{ item.username }}</detail-list-item>
+            <detail-list-item term="转派时间">{{ item.time }}</detail-list-item>
+            <detail-list-item term="转派备注">{{ item.remark }}</detail-list-item>
+          </detail-list>
+          <a-divider orientation="left">验收详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
+            <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
+            <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
+            <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="验收图片:" :col="6">
+            <upload-image-detail :images-list="model.checkFileList"/>
+          </detail-list>
+        </a-layout-content>
+        <a-layout-sider style="background-color: rgb(255, 255, 255)">
+          <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.repairStartTime?model.repairStartTime:''" />
+              <a-step title="维修结束时间:" :description="''+model.repairEndTime?model.repairEndTime:''" />
+              <a-step title="验收开始时间:" :description="''+model.checkStartTime?model.checkStartTime:''" />
+              <a-step title="验收结束时间:" :description="''+model.checkEndTime?model.checkEndTime:''" />
+            </a-steps>
+          </div>
+        </a-layout-sider>
+      </a-layout>
+      <!--    <title-divider title="维修项目" width="90px"></title-divider>-->
+      <!--    <div class="table-operator" v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status">-->
+      <!--      <a-button type="primary" @click="handleRepairProjectSelect">-->
+      <!--        <a-icon type="plus"/>-->
+      <!--        添加-->
+      <!--      </a-button>-->
+      <!--    </div>-->
+      <!--    <a-table-->
+      <!--      :data-source="data"-->
+      <!--      :columns="columns"-->
+      <!--      tableLayout="auto"-->
+      <!--      rowKey="id">-->
+      <!--      <span slot="action" slot-scope="record">-->
+      <!--        <template>-->
+      <!--          <a-popconfirm 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)" title="是否要删除该条数据?" @confirm="batchDelete(record.relationId)">-->
+      <!--            <a>删除</a>-->
+      <!--          </a-popconfirm>-->
+      <!--        </template>-->
+      <!--      </span>-->
+      <!--    </a-table>-->
+      <title-divider title="备件清单" width="90px"></title-divider>
+      <div class="table-operator" v-if="$auth('repair-application-forms-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status">
+        <a-button type="primary" @click="handleSpareStoreSelect">
+          <a-icon type="plus"/>
+          添加
+        </a-button>
+      </div>
+      <a-table
+        :data-source="dataSpare"
+        :columns="columnsSpare"
+        :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+        tableLayout="auto"
+        rowKey="id">
+        <span slot="actionSpare" slot-scope="record">
+          <template>
+            <a 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="handleEditSpare(record)">修改</a>
+            <a-divider type="vertical" />
+            <a-popconfirm 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)" title="是否要删除该条数据?" @confirm="batchDeleteSpare(record.id)">
+              <a>删除</a>
+            </a-popconfirm>
+          </template>
+        </span>
+      </a-table>
+      <title-divider title="费用清单" width="90px"></title-divider>
+      <div class="table-operator" 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)">
+        <a-button type="primary" @click="handleAddFee">
+          <a-icon type="plus"/>
+          添加
+        </a-button>
+      </div>
+      <a-table
+        :data-source="dataFee"
+        :columns="columnsFee"
+        tableLayout="auto"
+        rowKey="id">
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleViewFee(record)">查看</a>
+            <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="handleEditFee(record)" >修改</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)"
-            :type="2"
-            title="确认删除该笔费用?"
-            @confirm="batchDeleteFee(record.id)" >删除</operation-button>
-        </template>
-      </span>
-    </a-table>
+            <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)"
+              :type="2"
+              title="确认删除该笔费用?"
+              @confirm="batchDeleteFee(record.id)" >删除</operation-button>
+          </template>
+        </span>
+      </a-table>
+      <title-divider title="原因分析" width="90px"></title-divider>
+      <div class="table-operator" 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)">
+        <a-button type="primary" @click="handleAddReason">
+          <a-icon type="plus"/>
+          添加
+        </a-button>
+      </div>
+      <a-table
+        :data-source="dataReason"
+        :columns="columnsReason"
+        tableLayout="fixed"
+        rowKey="id">
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleViewReason(record)">查看</a>
+            <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="handleEditReason(record)" >修改</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)"
+              :type="2"
+              title="确认删除该记录?"
+              @confirm="batchDeleteReason(record.id)" >删除</operation-button>
+          </template>
+        </span>
+      </a-table>
     <!--    <q-tabs :activeKey="activeKey" @change="changeTab">
       <q-tab-pane key="a" tab="配件更换">
        <spare-part-used-select-table :type="2" :table-params="{sbId: model.sbId, modelId: model.modelId, repairId: model.id}" ref="sparePartUsedSelectTable"/>
@@ -157,7 +186,10 @@
         <spare-pick-form-select-table :type="2" :table-params="{repairId: model.id, repairNo: model.no}" ref="sparePickFormSelectTable"/>
       </q-tab-pane>
     </q-tabs>-->
+
+    </a-card>
     <check-form ref="checkForm" @ok="handleOk" />
+    <base-out-form ref="outForm" @ok="handleOk" />
     <finish-form ref="finishForm" @ok="handleOk" />
     <dispatch-form ref="dispatchForm" @ok="handleCancel" />
     <assign-form ref="assignForm" @ok="handleCancel" />
@@ -168,13 +200,16 @@
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
     <fee-base-form ref="feeForm" @ok="handleOk" />
     <fee-detail ref="feeDetail" @ok="handleOk" />
-  </a-card>
+    <reason-base-form ref="reasonForm" @ok="handleOk" />
+    <reason-detail ref="reasonDetail" @ok="handleOk" />
+  </div>
 </template>
 
 <script>
 import DetailList from '@/components/tools/DetailList'
 import { fetchRepairApplicationForm, approve, receive } from '@/api/repair/application-form'
 import CheckForm from './CheckForm'
+import BaseOutForm from './BaseOutForm'
 import FinishForm from './FinishForm'
 import DispatchForm from './DispatchForm'
 import AssignForm from './AssignForm'
@@ -191,6 +226,9 @@ import BaseTool from '@/utils/tool'
 import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
 import FeeDetail from '@/views/repair/fee/modules/Detail'
 import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
+import ReasonBaseForm from '@/views/repair/repair-reason/modules/BaseForm'
+import ReasonDetail from '@/views/repair/repair-reason/modules/Detail'
+import { deleteRepairReasons, fetchRepairReason, queryRepairReason } from '@/api/repair/repair-reason'
 
 const DetailListItem = DetailList.Item
 
@@ -199,8 +237,11 @@ export default {
   components: {
     CheckForm,
     DetailList,
+    ReasonBaseForm,
+    ReasonDetail,
     DetailListItem,
     FinishForm,
+    BaseOutForm,
     DispatchForm,
     FeeDetail,
     AssignForm,
@@ -234,6 +275,7 @@ export default {
       data: [],
       dataSpare: [],
       dataFee: [],
+      dataReason: [],
       // 表头
       columns: [
         {
@@ -366,6 +408,46 @@ export default {
           scopedSlots: { customRender: 'action' }
         }
       ],
+      columnsReason: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: '70',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '分析时间',
+          dataIndex: 'analyzeTime',
+          width: '200px'
+        },
+        {
+          title: '问题描述',
+          dataIndex: 'problemDesc',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '原因分析',
+          dataIndex: 'reasonAnalysis',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '改进措施',
+          dataIndex: 'improveMeasure',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
       model: {
         'id': null,
         'sbId': null,
@@ -411,15 +493,21 @@ export default {
       this.model = record
       this.activeKey = 'a'
       this.dispatchList = JSON.parse(record.repairDispatchList)
-      selectRepairProjectListByRepairId({ id: record.id }).then(res => {
+      this.init()
+    },
+    init () {
+      selectRepairProjectListByRepairId({ id: this.model.id }).then(res => {
         this.data = res.data
       })
-      selectSparePartUsedListByRepairId({ id: record.id }).then(res => {
+      selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
         this.dataSpare = res.data
       })
-      queryRepairFee({ repairId: record.id }).then(res => {
+      queryRepairFee({ repairId: this.model.id }).then(res => {
         this.dataFee = res.data
       })
+      queryRepairReason({ repairId: this.model.id }).then(res => {
+        this.dataReason = res.data
+      })
     },
     handleCancel () {
       this.visible = false
@@ -450,6 +538,10 @@ export default {
         this.handleOk()
       })
     },
+    handleOut () {
+      const modal = this.$refs.outForm
+      modal.base(null, this.model)
+    },
     handleAddFee () {
       const modal = this.$refs.feeForm
       modal.base(null, this.model)
@@ -468,6 +560,42 @@ export default {
         modal.base(res.data)
       })
     },
+    batchDeleteReason (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairReasons(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAddReason () {
+      const modal = this.$refs.reasonForm
+      this.visible = false
+      modal.base(null, this.model)
+    },
+    handleEditReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonForm
+        this.visible = false
+        modal.base(res.data, this.model)
+      })
+    },
+    handleViewReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonDetail
+        modal.base(res.data)
+      })
+    },
     handleApprove () {
       approve(this.model).then(() => {
         this.$message.info('操作成功')
@@ -479,19 +607,14 @@ export default {
       modal.base(this.model)
     },
     handleOk () {
+      this.loading = true
       fetchRepairApplicationForm({ id: this.model.id }).then(res => {
+        this.loading = false
         this.model = res.data
+        this.visible = true
         this.dispatchList = JSON.parse(this.model.repairDispatchList)
       })
-      selectRepairProjectListByRepairId({ id: this.model.id }).then(res => {
-        this.data = res.data
-      })
-      selectSparePartUsedListByRepairId({ id: this.model.id }).then(res => {
-        this.dataSpare = res.data
-      })
-      queryRepairFee({ repairId: this.model.id }).then(res => {
-        this.dataFee = res.data
-      })
+      this.init()
     },
     handleFinish () {
       const modal = this.$refs.finishForm

+ 544 - 0
src/views/repair/application-form/modules/DetailRepairOut.vue

@@ -0,0 +1,544 @@
+<template>
+  <div>
+    <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+      <a-row :gutter="48" slot="extra">
+        <a-col :md="48" :sm="48">
+          <span class="table-page-search-submitButtons" style="float: right">
+            <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.ALLOCATED === model.status || DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.REBACK === model.status)" title="是否要接收?" @confirm="receive">
+              <a-button>接收</a-button>
+            </a-popconfirm>
+<!--            <a-button v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING === model.status" style="margin-left: 8px" type="primary" @click="handleEdit()">编辑</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="primary" @click="handleFinish()">委外维修完成</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="primary" @click="handleSparePick">领用备件</a-button>-->
+            <a-button style="margin-left: 8px" @click="handleCancel">返回</a-button>
+          </span>
+        </a-col>
+      </a-row>
+      <a-layout>
+        <a-layout-content style="background-color: rgb(255, 255, 255)">
+          <a-divider orientation="left">委外详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="委外单号">{{ model.no }}</detail-list-item>
+            <detail-list-item term="委外类别">{{ outTypeMap[model.outType] }}</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>
+          </detail-list>
+          <detail-list title="" :col="1">
+            <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
+            <detail-list-item term="故障描述">{{ model.content }}</detail-list-item>
+          </detail-list>
+          <detail-list title="" :col="1">
+            <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="维修图片:" :col="6">
+            <upload-image-detail :images-list="model.repairFileList"/>
+          </detail-list>
+          <a-divider orientation="left">验收详情</a-divider>
+          <detail-list title="" :col="3">
+            <detail-list-item term="验收开始时间">{{ model.checkStartTime }}</detail-list-item>
+            <detail-list-item term="验收结束时间">{{ model.checkEndTime }}</detail-list-item>
+            <detail-list-item term="验收人员">{{ model.checkUserName }}</detail-list-item>
+            <detail-list-item term="验收描述">{{ model.checkContent }}</detail-list-item>
+          </detail-list>
+          <detail-list title="验收图片:" :col="6">
+            <upload-image-detail :images-list="model.checkFileList"/>
+          </detail-list>
+        </a-layout-content>
+      </a-layout>
+      <title-divider title="费用清单" width="90px"></title-divider>
+      <div class="table-operator" 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)">
+        <a-button type="primary" @click="handleAddFee">
+          <a-icon type="plus"/>
+          添加
+        </a-button>
+      </div>
+      <a-table
+        :data-source="dataFee"
+        :columns="columnsFee"
+        tableLayout="auto"
+        rowKey="id">
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleViewFee(record)">查看</a>
+            <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="handleEditFee(record)" >修改</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)"
+              :type="2"
+              title="确认删除该笔费用?"
+              @confirm="batchDeleteFee(record.id)" >删除</operation-button>
+          </template>
+        </span>
+      </a-table>
+      <title-divider title="原因分析" width="90px"></title-divider>
+      <div class="table-operator" 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)">
+        <a-button type="primary" @click="handleAddReason">
+          <a-icon type="plus"/>
+          添加
+        </a-button>
+      </div>
+      <a-table
+        :data-source="dataReason"
+        :columns="columnsReason"
+        tableLayout="fixed"
+        rowKey="id">
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleViewReason(record)">查看</a>
+            <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="handleEditReason(record)" >修改</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)"
+              :type="2"
+              title="确认删除该记录?"
+              @confirm="batchDeleteReason(record.id)" >删除</operation-button>
+          </template>
+        </span>
+      </a-table>
+
+    </a-card>
+    <check-form ref="checkForm" @ok="handleOk" />
+    <base-out-form ref="outForm" @ok="handleOk" />
+    <finish-form ref="finishForm" @ok="handleOk" />
+    <dispatch-form ref="dispatchForm" @ok="handleCancel" />
+    <assign-form ref="assignForm" @ok="handleCancel" />
+    <spare-pick-base-form ref="baseModal" @ok="handleOk"/>
+    <repair-project-select-Modal :type="'checkbox'" ref="repairProjectSelectModal" @selected="handleRepairProjectSelected"/>
+    <!--    <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
+    <base-form-for-repair ref="baseFormForRepair" @ok="handleOk" />
+    <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
+    <fee-base-form ref="feeForm" @ok="handleOk" />
+    <fee-detail ref="feeDetail" @ok="handleOk" />
+    <reason-base-form ref="reasonForm" @ok="handleOk" />
+    <reason-detail ref="reasonDetail" @ok="handleOk" />
+  </div>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+import { fetchRepairApplicationForm, approve, receive } from '@/api/repair/application-form'
+import CheckForm from './CheckForm'
+import BaseOutForm from './BaseOutForm'
+import FinishForm from './FinishOutForm'
+import DispatchForm from './DispatchForm'
+import AssignForm from './AssignForm'
+import SparePickBaseForm from '../../../store/sparepickform/modules/BaseForm'
+import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'
+import SparePickFormSelectTable from '@/views/store/sparepickform/modules/SparePickFormSelectTable'
+import RepairProjectSelectModal from '@/views/repair/repairproject/modules/RepairProjectSelectModal'
+import { selectRepairProjectListByRepairId, addRepairProjectRelationBatch, deleteRepairProjectRelations } from '@/api/repair/repairprojectrelation'
+import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
+import BaseFormForRepair from '@/views/sqarepartmanage/sparepartused/modules/BaseFormForRepair'
+import { selectSparePartUsedListByRepairId, addSparePartUsedBatch, deleteSparePartUseds } from '@/api/sqarepartmanage/sparepartused'
+import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
+import BaseTool from '@/utils/tool'
+import FeeBaseForm from '@/views/repair/fee/modules/BaseForm'
+import FeeDetail from '@/views/repair/fee/modules/Detail'
+import { deleteRepairFees, fetchRepairFee, queryRepairFee } from '@/api/repair/fee'
+import ReasonBaseForm from '@/views/repair/repair-reason/modules/BaseForm'
+import ReasonDetail from '@/views/repair/repair-reason/modules/Detail'
+import { deleteRepairReasons, fetchRepairReason, queryRepairReason } from '@/api/repair/repair-reason'
+
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'RepairApplicationFormDetail',
+  components: {
+    CheckForm,
+    DetailList,
+    ReasonBaseForm,
+    ReasonDetail,
+    DetailListItem,
+    FinishForm,
+    BaseOutForm,
+    DispatchForm,
+    FeeDetail,
+    AssignForm,
+    FeeBaseForm,
+    SparePickBaseForm,
+    SparePartUsedSelectTable,
+    SparePickFormSelectTable,
+    RepairProjectSelectModal,
+    SparePartInfoSelectModal,
+    BaseFormForRepair,
+    SpareStoreSelectModal
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      needStopMap: {},
+      dispatchList: [],
+      visible: false,
+      // 下拉框map
+      sourceMap: {},
+      outTypeMap: {},
+      typeMap: {},
+      levelMap: {},
+      descripitionMap: {},
+      selectedRowKeys: [],
+      statusMap: {},
+      repairProjectMap: {},
+      repairTechnologyMap: {},
+      activeKey: 'a',
+      data: [],
+      dataSpare: [],
+      dataFee: [],
+      dataReason: [],
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '编码',
+          dataIndex: 'no'
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '维修类别',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.repairProjectMap, text)
+          }
+        },
+        {
+          title: '维修工艺',
+          dataIndex: 'technology',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.repairTechnologyMap, text)
+          }
+        },
+        {
+          title: '标准工时',
+          dataIndex: 'standardHours'
+        },
+        {
+          title: '标准费用',
+          dataIndex: 'standardMoney'
+        },
+        {
+          title: '考核工时',
+          dataIndex: 'checkHours'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      columnsSpare: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '备件名称',
+          dataIndex: 'spareId',
+          customRender: (text, record, index) => {
+            return record.spareName
+          }
+        },
+        {
+          title: '数量',
+          dataIndex: 'num'
+        },
+        {
+          title: '价格',
+          dataIndex: 'price'
+        },
+        {
+          title: '总价',
+          dataIndex: 'totalPrice'
+        },
+        {
+          title: '更换日期',
+          dataIndex: 'startDate'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'actionSpare' }
+        }
+      ],
+      columnsFee: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '费用金额',
+          dataIndex: 'fee',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '费用类别',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.typeMap, text)
+          }
+        },
+        {
+          title: '费用原因',
+          dataIndex: 'reason'
+        },
+        {
+          title: '费用描述',
+          dataIndex: 'descripition'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      columnsReason: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: '70',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '分析时间',
+          dataIndex: 'analyzeTime',
+          width: '200px'
+        },
+        {
+          title: '问题描述',
+          dataIndex: 'problemDesc',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '原因分析',
+          dataIndex: 'reasonAnalysis',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '改进措施',
+          dataIndex: 'improveMeasure',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      model: {
+        'id': null,
+        'sbId': null,
+        'partId': null,
+        'repairUserId': null,
+        'needStop': null,
+        'no': null,
+        'source': null,
+        'applyTime': null,
+        'level': null,
+        'content': null,
+        'status': null,
+        'remark': null,
+        'updateTime': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'createdUserName': null,
+        'sbName': null,
+        'partName': null,
+        'updateUserName': null,
+        'repairFormVO': null,
+        'repairCheckVO': null
+      }
+    }
+  },
+  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.statusRepairMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FORM_STATUS)
+    this.statusCheckMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_CHECK_STATUS)
+    this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
+    this.repairProjectMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PROJECT_TYPE)
+    this.repairTechnologyMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_TECHNOLOGY_TYPE)
+    this.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIRE_ACTION)
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
+    this.outTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_OUT_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+      this.activeKey = 'a'
+      this.dispatchList = JSON.parse(record.repairDispatchList)
+      this.init()
+    },
+    init () {
+      queryRepairFee({ repairId: this.model.id }).then(res => {
+        this.dataFee = res.data
+      })
+      queryRepairReason({ repairId: this.model.id }).then(res => {
+        this.dataReason = res.data
+      })
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.$emit('ok')
+    },
+    receive () {
+      this.model.status = 3
+      receive(this.model).then(() => {
+        // const modal = this.$refs.finishForm
+        // modal.base(that.model)
+      })
+    },
+    batchDeleteFee (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairFees(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+      })
+    },
+    handleAddFee () {
+      const modal = this.$refs.feeForm
+      modal.base(null, this.model)
+    },
+    handleEditFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeForm
+        const data = res.data
+        data.repairNo = this.model.no
+        modal.base(data, this.model)
+      })
+    },
+    handleViewFee (record) {
+      fetchRepairFee({ id: record.id }).then(res => {
+        const modal = this.$refs.feeDetail
+        modal.base(res.data)
+      })
+    },
+    batchDeleteReason (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairReasons(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAddReason () {
+      const modal = this.$refs.reasonForm
+      this.visible = false
+      modal.base(null, this.model)
+    },
+    handleEditReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonForm
+        this.visible = false
+        modal.base(res.data, this.model)
+      })
+    },
+    handleViewReason (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.reasonDetail
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.loading = true
+      fetchRepairApplicationForm({ id: this.model.id }).then(res => {
+        this.loading = false
+        this.model = res.data
+        this.visible = true
+        this.dispatchList = JSON.parse(this.model.repairDispatchList)
+      })
+      this.init()
+    },
+    handleEdit () {
+      const modal = this.$refs.finishForm
+      modal.base(this.model)
+    },
+    handleFinish () {
+      const modal = this.$refs.finishForm
+      modal.base(this.model)
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairProjectRelations(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+      })
+    },
+    onSelectChange (selectedRowKeys) {
+      console.log('selectedRowKeys changed: ', selectedRowKeys)
+      this.selectedRowKeys = selectedRowKeys
+    }
+  }
+}
+</script>

+ 93 - 12
src/views/repair/application-form/modules/FinishForm.vue

@@ -13,6 +13,38 @@
       </a-form-item>
 
       <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="是否停机"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['needStop', {initialValue: DictCache.VALUE.YES_NO.NO,rules: [{required: true, message: '是否停机不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in needStopMap"
+                :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.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['level', {initialValue: 1, rules: [{required: true, message: '紧急等级不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in levelMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
         <row-item>
           <a-form-item
             label="故障类别"
@@ -25,7 +57,7 @@
               :treeData="treeData"
               :treeNodeFilterProp="'title'"
               :showSearch="true"
-              v-decorator="['repairErrorTypeId', {rules: [{required: true, message: '故障类别不能为空'}]}]"
+              v-decorator="['repairErrorTypeId']"
               placeholder="请选择"
             >
             </a-tree-select>
@@ -57,16 +89,35 @@
           </a-form-item>
         </row-item>-->
       </row-list>
-      <row-list>
+      <row-list :col="1">
         <row-item>
           <a-form-item
             label="维修描述"
-            :labelCol="BaseTool.Constant.labelCol"
-            :wrapperCol="BaseTool.Constant.wrapperCol"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
           >
             <a-textarea v-decorator="['repairContent', {rules: [{required: true, message: '维修描述不能为空'}]}]"/>
           </a-form-item>
         </row-item>
+        <row-item>
+          <a-form-item
+            label="维修图片"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              list-type="picture"
+              :file-list="defaultRepairFileList"
+              @change="handleRepairFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 上传图片 </a-button>
+            </a-upload>
+          </a-form-item>
+        </row-item>
       </row-list>
     </a-form>
     <spare-part-used-select-modal ref="sparePartUsedSelectModal" />
@@ -82,6 +133,9 @@ import { finish } from '@/api/repair/application-form'
 import { queryUser } from '@/api/upms/user'
 import { fetchErrorTypeTree } from '@/api/repair/errortype'
 import SparePartUsedSelectModal from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectModal'
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
 
 export default {
   name: 'BaseRepairApplicationForm',
@@ -95,10 +149,16 @@ export default {
       // 下拉框map
       treeData: [],
       descripitionMap: {},
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
       sourceMap: {},
       levelMap: {},
       needStopMap: {},
       statusMap: {},
+      uploadUrl: uploadUrl,
+      defaultRepairFileList: [],
+      repairFileList: [], // 维修图片,
       userList: []
     }
   },
@@ -125,13 +185,17 @@ export default {
         this.modalTitle = '添加'
         return
       }
-      this.modalTitle = '编辑'
+      this.modalTitle = '维修完成'
       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'
+          'id',
+          'needStop',
+          'level',
+          'repairErrorTypeId'
+
         ])))
       })
     },
@@ -140,6 +204,22 @@ export default {
         this.userList = res.data
       })
     },
+    handleRepairFileChange (info) {
+      this.defaultRepairFileList = info.fileList
+      this.repairFileList = this.setFileList(info, 12)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    },
     save () {
       const { form: { validateFieldsAndScroll } } = this
       this.confirmLoading = true
@@ -149,11 +229,12 @@ export default {
           return
         }
         // 日期处理
+        values.repairFileList = this.repairFileList
         finish(values).then(() => {
-            this.handleCancel(values)
-          }).catch(() => {
-            this.confirmLoading = false
-          })
+          this.handleCancel(values)
+        }).catch(() => {
+          this.confirmLoading = false
+        })
       })
     },
     handleCancel (values) {
@@ -165,7 +246,7 @@ export default {
       }
     },
     handleSbSelect () {
-      this.$refs.sbInfoSelectModal.base({},{filter: 0, status: 2})
+      this.$refs.sbInfoSelectModal.base({}, { filter: 0, status: 2 })
     },
     handleSbSelectd (keys, rows) {
       const [ key ] = keys
@@ -206,7 +287,7 @@ export default {
       /* const modal = this.$refs.repairFeeModal
       modal.base(null, record) */
       this.$refs.sparePartUsedSelectModal.base(this.model, { sbId: this.model.sbId, modelId: this.model.modelId })
-    } ,
+    }
 
   }
 }

+ 258 - 0
src/views/repair/application-form/modules/FinishOutForm.vue

@@ -0,0 +1,258 @@
+<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>
+
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="委外订单号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled="disabled"
+              v-decorator="['no', {rules: [{required: false, message: '委外订单号不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="委外类别"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select v-decorator="['outType']" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in outTypeMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </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 v-decorator="['content', {rules: [{required: true, message: '故障描述不能为空'}]}]"/>
+          </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 v-decorator="['repairContent', {rules: [{required: true, message: '维修描述不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="维修图片"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              list-type="picture"
+              :file-list="defaultRepairFileList"
+              @change="handleRepairFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 上传图片 </a-button>
+            </a-upload>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <spare-part-used-select-modal ref="sparePartUsedSelectModal" />
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { finish } from '@/api/repair/application-form'
+import { queryUser } from '@/api/upms/user'
+import { fetchErrorTypeTree } from '@/api/repair/errortype'
+import SparePartUsedSelectModal from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectModal'
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+
+export default {
+  name: 'BaseRepairApplicationForm',
+  data () {
+    return {
+      model: null,
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      treeData: [],
+      descripitionMap: {},
+      sourceMap: {},
+      outTypeMap: {},
+      levelMap: {},
+      needStopMap: {},
+      statusMap: {},
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      uploadUrl: uploadUrl,
+      defaultRepairFileList: [],
+      repairFileList: [], // 维修图片,
+      userList: []
+    }
+  },
+  components: {
+    SparePartUsedSelectModal
+  },
+  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.descripitionMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIRE_ACTION)
+    this.outTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_OUT_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.setTree()
+      this.visible = true
+      this.model = record
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '委外完成'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'no',
+          'outType',
+          'content'
+        ])))
+      })
+    },
+    getUsers () {
+      queryUser({ status: 1 }).then(res => {
+        this.userList = res.data
+      })
+    },
+    handleRepairFileChange (info) {
+      this.defaultRepairFileList = info.fileList
+      this.repairFileList = this.setFileList(info, 12)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        values.repairFileList = this.repairFileList
+        console.log(values)
+        finish(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')
+      }
+    },
+    handleSbSelect () {
+      this.$refs.sbInfoSelectModal.base({}, { filter: 0, status: 2 })
+    },
+    handleSbSelectd (keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'sbId': key,
+          'sbName': row.name
+        }))
+      })
+    },
+    handlePartSelect () {
+      const sbId = this.form.getFieldValue('sbId')
+      this.$refs.partInfoSelectModal.base({ sbId })
+    },
+    handlePartSelected (keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'partId': key,
+          'partName': row.name
+        }))
+      })
+    },
+    /**
+     * 设置类别树
+     */
+    setTree (record = {}) {
+      fetchErrorTypeTree({ id: record.id }).then(res => {
+        this.treeData = res.data
+      })
+    },
+    handleAddPartUsed () {
+      /* const modal = this.$refs.repairFeeModal
+      modal.base(null, record) */
+      this.$refs.sparePartUsedSelectModal.base(this.model, { sbId: this.model.sbId, modelId: this.model.modelId })
+    }
+
+  }
+}
+</script>

+ 243 - 0
src/views/repair/repair-reason/RepairReason.vue

@@ -0,0 +1,243 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="8" :sm="24">
+            <a-form-item label="关键字">
+              <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8 || 24" :sm="24">
+            <span class="table-page-search-submitButtons">
+              <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <div class="table-operator">
+<!--      <a-button v-if="$auth('repair-repair-reasons-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>-->
+<!--      <a-button style="margin-left: 8px" v-if="$auth('repair-repair-reasons-export')" type="primary" icon="download" @click="doExport">导出</a-button>-->
+      <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-repair-reasons-del')">
+        <a-menu slot="overlay">
+          <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+            <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+          </a-popconfirm>
+        </a-menu>
+        <a-button style="margin-left: 8px">
+          批量操作 <a-icon type="down" />
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      :columns="columns"
+      tableLayout="fixed"
+      :data="loadData"
+      :alert="options.alert"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            v-if="$auth('repair-repair-reasons-edit')"
+            @click="handleEdit(record)"
+          >修改</operation-button>
+          <operation-button
+            v-if="$auth('repair-repair-reasons-del')"
+            :type="2"
+            title="是否要删除该条数据?"
+            @confirm="batchDelete(record.id)">删除</operation-button>
+        </template>
+      </span>
+    </s-table>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import { getRepairReasonPage, deleteRepairReasons, fetchRepairReason, exportRepairReason } from '@/api/repair/repair-reason'
+
+export default {
+  name: 'RepairReasonList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '编号',
+          dataIndex: 'no'
+        },
+        {
+          title: '分析时间',
+          dataIndex: 'analyzeTime',
+          width: '200px'
+        },
+        {
+          title: '问题描述',
+          dataIndex: 'problemDesc',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '原因分析',
+          dataIndex: 'reasonAnalysis',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '改进措施',
+          dataIndex: 'improveMeasure',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getRepairReasonPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairReasons(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportRepairReason(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 175 - 0
src/views/repair/repair-reason/modules/BaseForm.vue

@@ -0,0 +1,175 @@
+<template>
+  <a-card :bordered="false" :title="modalTitle" v-show="visible">
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right" >
+          <a-button v-show="currentTab!== 0" style="margin-left: 8px" @click="prev()">上一步</a-button>
+          <a-button style="margin-left: 8px" v-show="currentTab!== 2" type="primary" @click="next()">下一步</a-button>
+          <a-button style="margin-left: 8px" type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <a-steps :current="currentTab" >
+      <a-step title="问题描述" />
+      <a-step title="原因分析" />
+      <a-step title="改进措施" />
+    </a-steps>
+    <a-form-model ref="form" :model="model" :rules="rules">
+
+      <row-list :col="1">
+        <row-item v-show="currentTab=== 0">
+          <a-form-model-item required label="编号" prop="no">
+            <a-input
+              disabled="disabled"
+              v-model="model.no"
+            />
+          </a-form-model-item>
+        </row-item>
+        <row-item v-show="currentTab=== 0">
+          <a-form-model-item required label="分析时间" prop="analyzeTime">
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-model="model.analyzeTime"/>
+          </a-form-model-item>
+        </row-item>
+        <row-item v-show="currentTab=== 0">
+          <a-form-model-item required label="问题描述" prop="problemDesc">
+            <a-textarea
+              :auto-size="{ minRows: 30 }"
+              v-model="model.problemDesc"/>
+          </a-form-model-item>
+        </row-item>
+        <row-item v-show="currentTab=== 1">
+          <a-form-model-item label="原因分析" prop="reasonAnalysis">
+            <a-textarea
+              :auto-size="{ minRows: 30 }"
+              v-model="model.reasonAnalysis"/>
+          </a-form-model-item>
+        </row-item>
+        <row-item v-show="currentTab=== 2">
+          <a-form-model-item label="改进措施" prop="reasonAnalysis">
+            <a-textarea
+              :auto-size="{ minRows: 30 }"
+              v-model="model.improveMeasure"/>
+          </a-form-model-item>
+        </row-item>
+      </row-list>
+    </a-form-model>
+  </a-card>
+</template>
+
+<script>
+import { addRepairReason, updateRepairReason } from '@/api/repair/repair-reason'
+
+export default {
+  name: 'BaseRepairReason',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      currentTab: 0,
+      model: {
+        id: '',
+        repairId: '',
+        no: '',
+        analyzeTime: null,
+        problemDesc: '',
+        reasonAnalysis: '',
+        improveMeasure: ''
+      },
+      addFlag: false,
+      form: this.$form.createForm(this),
+      visible: false,
+      rules: {
+        no: [
+          { required: true, message: '请输入编号', trigger: 'blur' }
+        ],
+        analyzeTime: [
+          { required: true, message: '请输入分析时间', trigger: 'blur' }
+        ],
+        problemDesc: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ],
+        reasonAnalysis: [
+          { message: '请输入', trigger: 'blur' }
+        ],
+        improveMeasure: [
+          { message: '请输入', trigger: 'blur' }
+        ]
+      }
+      // 下拉框map
+    }
+  },
+  props: {},
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record, repairForm = {}) {
+      this.visible = true
+      this.$refs.form.resetFields()
+      this.currentTab = 0
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.addFlag = true
+        this.model.repairId = repairForm.id
+        this.model.no = repairForm.no
+        this.modalTitle = '添加'
+        return
+      }
+      this.addFlag = false
+      record.analyzeTime = this.BaseTool.Moment(record.analyzeTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      this.modalTitle = '编辑'
+      // 日期处理
+      this.model = record
+    },
+    next () {
+      this.currentTab += 1
+    },
+    prev () {
+      this.currentTab -= 1
+    },
+    save () {
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          // 日期处理
+          this.model.analyzeTime = this.BaseTool.Date.formatter(this.model.analyzeTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+          if (this.addFlag) {
+            addRepairReason(this.model)
+              .then((res) => {
+                this.confirmLoading = false
+                this.handleCancel({})
+              }).catch(() => {
+                this.confirmLoading = false
+              })
+          } else {
+            updateRepairReason(this.model)
+              .then(() => {
+                this.handleCancel(this.model)
+              }).catch(() => {
+                this.confirmLoading = false
+              })
+          }
+        } else {
+          this.confirmLoading = false
+          return false
+        }
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      this.$emit('ok', values)
+    }
+
+  }
+}
+</script>
+<style>
+  .ant-steps-item-process .ant-steps-item-icon>.ant-steps-icon {
+    color: #fff !important;
+  }
+</style>

+ 96 - 0
src/views/repair/repair-reason/modules/Detail.vue

@@ -0,0 +1,96 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1200"
+    :visible="visible"
+    class="ant-modal2"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <detail-list title="" :col="2">
+      <detail-list-item term="编号">{{ model.no }}</detail-list-item>
+      <detail-list-item term="分析时间">{{ model.analyzeTime }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+      <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
+      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
+    </detail-list>
+
+    <a-row>
+      <a-col style="margin-top: 10px">
+        <div class="term">问题描述:</div>
+        <div class="content">{{ model.problemDesc }}</div>
+      </a-col>
+    </a-row>
+    <a-row>
+      <a-col style="margin-top: 10px">
+        <div class="term">原因分析:</div>
+        <div class="content">{{ model.reasonAnalysis }}</div>
+      </a-col>
+    </a-row>
+    <a-row>
+      <a-col style="margin-top: 10px">
+        <div class="term">改进措施:</div>
+        <div class="content">{{ model.improveMeasure }}</div>
+      </a-col>
+    </a-row>
+
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'RepairReasonDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      model: {
+        'no': null,
+        'repairId': null,
+        'analyzeTime': null,
+        'problemDesc': null,
+        'reasonAnalysis': null,
+        'improveMeasure': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+
+  }
+}
+</script>
+<style scoped>
+  .term {
+    color: rgba(0, 0, 0, .85);
+    display: table-cell;
+    line-height: 20px;
+    margin-right: 8px;
+    padding-bottom: 16px;
+    white-space: nowrap;
+  }
+</style>

+ 281 - 0
src/views/repair/repair-reason/modules/RepairReasonSelectModal.vue

@@ -0,0 +1,281 @@
+<template>
+    <a-modal
+            :title="modalTitle"
+            :width="1000"
+            :visible="visible"
+            :confirmLoading="confirmLoading"
+            class="ant-modal2"
+            @cancel="handleCancel"
+    >
+        <a-card :bordered="false">
+            <div class="table-page-search-wrapper">
+                <a-form layout="inline">
+                    <a-row :gutter="48">
+                        <a-col :md="8" :sm="24">
+                            <a-form-item label="关键字">
+                                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="8 || 24" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+                </span>
+                        </a-col>
+                    </a-row>
+                </a-form>
+            </div>
+
+            <div class="table-operator">
+            </div>
+
+            <s-table
+                    ref="table"
+                    size="default"
+                    rowKey="id"
+                    :columns="columns"
+                    :data="loadData"
+                    :alert="options.alert"
+                    :customRow="options.customRow"
+                    :rowSelection="options.rowSelection"
+                    showPagination="auto"
+            >
+                <span slot="action" slot-scope="record1">
+                  <template>
+                    <a @click="handleView(record1)">查看</a>
+                  </template>
+                </span>
+            </s-table>
+            <detail ref="detailModal"/>
+        </a-card>
+        <template slot="footer">
+            <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+            <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">确定</a-button>
+        </template>
+    </a-modal>
+</template>
+
+<script>
+    import { STable, Ellipsis } from '@/components'
+    import Detail from './Detail'
+    import { getRepairReasonPage, fetchRepairReason } from '@/api/repair/repair-reason'
+
+    export default {
+        name: 'RepairReasonSelectModal',
+        components: {
+            STable,
+            Ellipsis,
+            Detail
+        },
+        props: {
+            type: {
+                type: String,
+                default: 'radio'
+            },
+            selectedRowKey: {
+                type: Array,
+                default: () => {
+                    return []
+                }
+            },
+            selectedRow: {
+                type: Array,
+                default: () => {
+                    return []
+                }
+            }
+        },
+        data () {
+            return {
+                confirmLoading: false,
+                mdl: {},
+                modalTitle: null,
+                visible: false,
+                record: null,
+                // 查询参数
+                queryParam: {
+                },
+                extraQueryParam: {
+                },
+                // 表头
+                columns: [
+                    {
+                        title: '序号',
+                        dataIndex: 'index',
+                        customRender: (text, record, index) => {
+                            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+                        }
+                    },
+                                                                                                                                                {
+                                title: '编号',
+                                dataIndex: 'no'
+                            },
+                                                                                                                                                        {
+                                title: '维修编号ID',
+                                dataIndex: 'repairId'
+                            },
+                                                                                                                                                        {
+                                title: '分析时间',
+                                dataIndex: 'analyzeTime'
+                            },
+                                                                                                                                                        {
+                                title: '问题描述',
+                                dataIndex: 'problemDesc'
+                            },
+                                                                                                                                                        {
+                                title: '原因分析',
+                                dataIndex: 'reasonAnalysis'
+                            },
+                                                                                                                                                        {
+                                title: '改进措施',
+                                dataIndex: 'improveMeasure'
+                            },
+                                                                                            {
+                        title: '操作',
+                        key: 'action',
+                        width: '200px',
+                        align: 'center',
+                        scopedSlots: { customRender: 'action' }
+                    }
+                ],
+                // 下拉框map
+                                // 加载数据方法 必须为 Promise 对象
+                loadData: parameter => {
+                    parameter = {
+                        ...parameter,
+                        ...this.queryParam,
+                        ...this.extraQueryParam,
+                        dataScope: {
+                            sortBy: 'desc',
+                            sortName: 'update_time'
+                        }
+                    }
+                    return getRepairReasonPage(Object.assign(parameter, this.queryParam))
+                            .then(res => {
+                                return res.data
+                            })
+                },
+                selectedRowKeys: [],
+                selectedRows: [],
+
+                options: {
+                    alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+                    rowSelection: {
+                        selectedRowKeys: this.selectedRowKeys,
+                        onChange: this.onSelectChange
+                    }
+                },
+                optionAlertShow: false,
+                isCreated: false
+            }
+        },
+        created () {
+            // 下拉框map
+                    },
+        methods: {
+            tableOption () {
+                if (!this.optionAlertShow) {
+                    this.options = {
+                        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+                        rowSelection: {
+                            selectedRowKeys: this.selectedRowKeys,
+                            onChange: this.onSelectChange,
+                            type: this.type,
+                            getCheckboxProps: record => ({
+                                props: {
+                                    disabled: false,
+                                    name: record.id
+                                }
+                            })
+                        },
+                        customRow: (record) => {
+                            return {
+                                on: { // 事件
+                                    click: (event) => { // 点击行
+                                        // 选择对象
+                                        this.mySelect([record.id], [record])
+                                    },
+                                    dblclick: (event) => {
+                                        this.mySelect([record.id], [record])
+                                        this.handleSelect()
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    this.optionAlertShow = true
+                } else {
+                    this.options = {
+                        alert: false,
+                        rowSelection: null
+                    }
+                    this.optionAlertShow = false
+                }
+            },
+            handleView (record) {
+                fetchRepairReason({ id: record.id }).then(res => {
+                    const modal = this.$refs.detailModal
+                    modal.base(res.data)
+                })
+            },
+            handleOk () {
+                this.$refs.table.refresh()
+            },
+            onSelectChange (selectedRowKeys, selectedRows) {
+                this.selectedRowKeys = selectedRowKeys
+                this.selectedRows = selectedRows
+            },
+            resetSearchForm () {
+                this.queryParam = {
+                }
+                this.$refs.table.refresh(true)
+            },
+            base (record, queryParam = {}) {
+                this.visible = true
+                this.modalTitle = '选择信息'
+                this.extraQueryParam = queryParam
+                this.record = record
+                if (this.isCreated) {
+                    this.$refs.table.clearSelected()
+                    this.options.rowSelection.type = this.type
+                    this.handleOk()
+                } else {
+                    this.tableOption()
+                    this.isCreated = true
+                }
+            },
+            handleCancel () {
+                this.visible = false
+                this.confirmLoading = false
+            },
+            handleSelect () {
+                if (this.selectedRowKeys.length === 0) {
+                    this.$message.warn('请至少选择一项信息')
+                } else {
+                    this.confirmLoading = true
+                    this.$emit('selected', this.record, this.selectedRowKeys, this.selectedRows)
+                    this.confirmLoading = false
+                    this.visible = false
+                }
+            },
+            mySelect(selectedRowKeys, selectedRows) {
+                if (this.type === 'radio') {
+                    this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+                            this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+                } else {
+                    let mySelectedRowKeys
+                    let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+                    if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+                        mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+                    } else {
+                        mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+                        mySelectedRows = [...mySelectedRows, ...selectedRows]
+                    }
+                    this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+                            this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+                }
+
+            }
+        }
+    }
+</script>