xiongchao há 3 anos atrás
pai
commit
d3d4cfbaf9

+ 14 - 0
src/api/sb/info.js

@@ -179,6 +179,20 @@ export function updateSbInfo (parameter) {
   })
 }
 
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateSbInfoStatus (parameter) {
+  return axios({
+    url: '/sb/infos/status' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
 /**
  * update func
  * parameter: { }

+ 53 - 54
src/api/sb/status-log.js

@@ -8,13 +8,13 @@ import { stringify } from 'qs'
  * @returns {*}
  */
 export function getSbStatusLogPage (parameter) {
-    return axios({
-        url: '/sb/status-logs/page?' + stringify(parameter),
-        method: 'get',
-        headers: {
-            'Content-Type': 'application/json;charset=UTF-8'
-        }
-    })
+  return axios({
+    url: '/sb/status-logs/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
 }
 
 /**
@@ -24,15 +24,15 @@ export function getSbStatusLogPage (parameter) {
  * @returns {*}
  */
 export function addSbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs',
-        method: 'POST',
-        headers: {
-            'Accept': 'application/json',
-            'Content-Type': 'application/json;charset=UTF-8'
-        },
-        data: parameter
-    })
+  return axios({
+    url: '/sb/status-logs',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
 }
 
 /**
@@ -42,11 +42,11 @@ export function addSbStatusLog (parameter) {
  * @returns {*}
  */
 export function updateSbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs/' + parameter.id,
-        method: 'PUT',
-        data: parameter
-    })
+  return axios({
+    url: '/sb/status-logs/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
 }
 
 /**
@@ -56,13 +56,13 @@ export function updateSbStatusLog (parameter) {
  * @returns {*}
  */
 export function fetchSbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs/' + parameter.id,
-        method: 'get',
-        headers: {
-            'Content-Type': 'application/json;charset=UTF-8'
-        }
-    })
+  return axios({
+    url: '/sb/status-logs/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
 }
 
 /**
@@ -72,13 +72,13 @@ export function fetchSbStatusLog (parameter) {
  * @returns {*}
  */
 export function querySbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs?' + stringify(parameter),
-        method: 'get',
-        headers: {
-            'Content-Type': 'application/json;charset=UTF-8'
-        }
-    })
+  return axios({
+    url: '/sb/status-logs?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
 }
 
 /**
@@ -88,11 +88,11 @@ export function querySbStatusLog (parameter) {
  * @returns {*}
  */
 export function deleteSbStatusLogs (parameter) {
-    return axios({
-        url: '/sb/status-logs',
-        method: 'DELETE',
-        data: parameter
-    })
+  return axios({
+    url: '/sb/status-logs',
+    method: 'DELETE',
+    data: parameter
+  })
 }
 
 /**
@@ -102,14 +102,13 @@ export function deleteSbStatusLogs (parameter) {
  * @returns {*}
  */
 export function deleteSbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs/' + parameter.id,
-        method: 'DELETE',
-        data: parameter
-    })
+  return axios({
+    url: '/sb/status-logs/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
 }
 
-
 /**
  * export file
  * parameter: { }
@@ -117,12 +116,12 @@ export function deleteSbStatusLog (parameter) {
  * @returns {*}
  */
 export function exportSbStatusLog (parameter) {
-    return axios({
-        url: '/sb/status-logs/export?' + stringify(parameter),
-        method: 'get',
-        headers: {
-            'Content-Type': 'application/json;charset=UTF-8'
-        },
-        responseType: 'blob'
-    })
+  return axios({
+    url: '/sb/status-logs/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
 }

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

@@ -300,6 +300,11 @@ const constantRouterComponents = {
   // 设备停机记录表
   'SbStopLog': () => import('@/views/sb/stop-logs/SbStopLog'),
 
+  // 设备安装调试过程记录
+  'SbInfoDebug': () => import('@/views/sb/info/SbInfoDebug'),
+  // 设备试车过程记录
+  'SbInfoTestRun': () => import('@/views/sb/info/SbInfoTestRun'),
+
   // 设备报废
   'SbInfoScrap': () => import('@/views/sb/scrap/SbInfoScrap'),
   // 设备维护标准

+ 2 - 2
src/views/check/checkstandard/CheckStandard.vue

@@ -54,10 +54,10 @@
         icon="download"
         @click="doExport">导出
       </a-button>
-      <a-button :confirmLoading="confirmLoading" style="margin-left:8px;" type="primary" @click="doUpdateNo">
+<!--      <a-button :confirmLoading="confirmLoading" style="margin-left:8px;" type="primary" @click="doUpdateNo">
         <a-icon type="upload"/>
         初始化编码
-      </a-button>
+      </a-button>-->
       <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && ($auth('check-spot-standards-del')||$auth('check-polling-standards-del'))">
         <a-menu slot="overlay">
           <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">

+ 3 - 1
src/views/check/checkstandard/modules/BaseForm.vue

@@ -605,7 +605,9 @@ export default {
       this.$nextTick(() => {
         setFieldsValue(Object.assign({
           'sbId': key,
-          'sbNo': row.no
+          'sbNo': row.no,
+          'part': null,
+          'partName': null
         }))
       })
     },

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

@@ -40,11 +40,27 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="计划性维修"
+            label="是否计划性维修"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-select @change="changeNeedStop" v-decorator="['needStop', {rules: [{required: true, message: '计划性维修不能为空'}]}]" placeholder="请选择">
+            <a-select @change="changePlanFlag" v-decorator="['planFlag', {rules: [{required: true, message: '计划性维修不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in planFlagMap"
+                :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 @change="changeNeedStop" v-decorator="['needStop', {rules: [{required: true, message: '是否停机不能为空'}]}]" placeholder="请选择">
               <a-select-option
                 v-for="(label,value) in needStopMap"
                 :key="value"
@@ -54,7 +70,7 @@
             </a-select>
           </a-form-item>
         </row-item>
-        <row-item v-show="needStop === 0">
+        <row-item v-show="planFlag === 0">
           <a-form-item
             label="要求日期"
             :labelCol="BaseTool.Constant.labelCol"
@@ -250,8 +266,9 @@ export default {
       levelMap: {},
       questionMap: {},
       treeData: [],
-      needStop: 0,
       needStopMap: {},
+      planFlag: 0,
+      planFlagMap: {},
       statusMap: {},
       userInfo: this.$store.getters.userInfo,
       userList: [],
@@ -280,6 +297,7 @@ export default {
     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.planFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.getUsers()
   },
   methods: {
@@ -349,6 +367,8 @@ export default {
           'content',
           'status',
           'sbName',
+          'needStop',
+          'planFlag',
           'partName',
           'remark'
         ])))
@@ -391,8 +411,8 @@ export default {
         }
       })
     },
-    changeNeedStop (value) {
-      this.needStop = value
+    changePlanFlag (value) {
+      this.planFlag = value
     },
     handleCancel (values) {
       this.visible = false

+ 7 - 2
src/views/repair/application-form/modules/Detail.vue

@@ -18,7 +18,9 @@
             <detail-list-item term="预留维修时间">{{ model.limitHours }}</detail-list-item>
             <detail-list-item term="使用位置">{{ model.sbCph }}</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="计划性维修">{{ BaseTool.Object.getField(planFlagMap,model.planFlag) }}</detail-list-item>
+            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
+
             <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
             <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
 <!--            <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>-->
@@ -39,7 +41,7 @@
             <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.repairMinutes }}分钟</detail-list-item>
             <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
           <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
           </detail-list>
@@ -162,6 +164,7 @@ export default {
       mdl: {},
       modalTitle: null,
       needStopMap: {},
+      planFlagMap: {},
       dispatchList: [],
       activeKey: 'a',
       visible: false,
@@ -335,6 +338,7 @@ export default {
         'partId': null,
         'repairUserId': null,
         'needStop': null,
+        'planFlag': null,
         'no': null,
         'source': null,
         'applyTime': null,
@@ -364,6 +368,7 @@ export default {
     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.planFlagMap = 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.REPAIR_QUESTION)

+ 6 - 2
src/views/repair/application-form/modules/DetailCheck.vue

@@ -4,6 +4,7 @@
       <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-finish') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.PROCESSING < model.status" style="margin-left: 8px" type="primary" @click="handleFinish()">修改</a-button>
             <a-popconfirm v-if="$auth('repair-application-forms-approve') && DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ACCEPTANCE === model.status" title="是否要接受?" @confirm="handleApprove">
               <a-button :loading="confirmLoading" style="margin-left: 8px" type="primary">接受</a-button>
             </a-popconfirm>
@@ -23,7 +24,8 @@
             <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
             <detail-list-item term="使用位置">{{ model.sbCph }}</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="计划性维修">{{ BaseTool.Object.getField(planFlagMap,model.planFlag) }}</detail-list-item>
+            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
             <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
             <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
 <!--            <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>-->
@@ -44,7 +46,7 @@
             <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.repairMinutes }}分钟</detail-list-item>
             <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
             <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
           </detail-list>
@@ -198,6 +200,7 @@ export default {
       mdl: {},
       modalTitle: null,
       needStopMap: {},
+      planFlagMap: {},
       dispatchList: [],
       activeKey: 'a',
       visible: false,
@@ -371,6 +374,7 @@ export default {
         'partId': null,
         'repairUserId': null,
         'needStop': null,
+        'planFlag': null,
         'no': null,
         'source': null,
         'applyTime': null,

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

@@ -12,7 +12,8 @@
             </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.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="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="handleFinish()">修改</a-button>
             <a-popconfirm v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.WAIT_SUBMIT === model.status" title="是否要提交审核该条数据?" @confirm="handleExamine">
               <a-button style="margin-left: 8px" type="primary">提交审核</a-button>
             </a-popconfirm>
@@ -29,7 +30,8 @@
             <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
             <detail-list-item term="预留维修时间">{{ model.limitHours }}</detail-list-item>
             <detail-list-item term="使用位置">{{ model.sbCph }}</detail-list-item>
-            <detail-list-item term="计划性维修">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
+            <detail-list-item term="计划性维修">{{ BaseTool.Object.getField(planFlagMap,model.planFlag) }}</detail-list-item>
+            <detail-list-item term="是否停机">{{ BaseTool.Object.getField(needStopMap,model.needStop) }}</detail-list-item>
             <detail-list-item term="报修人">{{ model.actualUser }}</detail-list-item>
             <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.source) }}</detail-list-item>
             <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.level)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>
@@ -50,7 +52,7 @@
             <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.repairMinutes }}分钟</detail-list-item>
             <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
           <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
           </detail-list>
@@ -268,6 +270,7 @@ export default {
       mdl: {},
       modalTitle: null,
       needStopMap: {},
+      planFlagMap: {},
       dispatchList: [],
       visible: false,
       showSbFlag: false,
@@ -444,6 +447,7 @@ export default {
         'partId': null,
         'repairUserId': null,
         'needStop': null,
+        'planFlag': null,
         'no': null,
         'source': null,
         'applyTime': null,

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

@@ -29,6 +29,19 @@
             </a-select>
           </a-form-item>
         </row-item>
+        <row-item>
+          <a-form-item
+            label="完成时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              v-decorator="['repairEndTime']"
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+            />
+          </a-form-item>
+        </row-item>
         <!--        <row-item>
           <a-form-item
             label="紧急等级"
@@ -188,14 +201,14 @@ export default {
       this.modalTitle = '维修完成'
       const { form: { setFieldsValue } } = this
       // 日期处理
-      record.applyTime = this.BaseTool.Moment(record.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+      record.repairEndTime = this.BaseTool.Date.formatter(record.repairEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'needStop',
           'level',
-          'repairErrorTypeId'
-
+          'repairErrorTypeId',
+          'repairEndTime'
         ])))
       })
     },
@@ -230,6 +243,7 @@ export default {
         }
         // 日期处理
         values.repairFileList = this.repairFileList
+        values.repairEndTime = this.BaseTool.Date.formatter(values.repairEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
         finish(values).then(() => {
           this.$message.info('维修完成,请完成后续维修报告,完成后提交审核;')
           this.handleCancel(values)

+ 21 - 8
src/views/sb/info/SbInfo.vue

@@ -157,6 +157,7 @@
       </a-col>
     </a-row>
     <base-form ref="baseModal" @ok="handleOk"/>
+    <base-form-status-log ref="baseModalStatusLog" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
     <download-modal ref="downloadModal"/>
     <preview-modal ref="previewModal"/>
@@ -171,10 +172,11 @@
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
 import Detail from './modules/Detail'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
-import { updateSbInfo, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
+import { updateSbInfoStatus, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
 import { queryDept } from '@/api/upms/dept'
 import { generateSbCodeAll } from '@/api/upms/code'
 import { fetchSbTypeTree } from '@/api/sb/type'
@@ -195,7 +197,8 @@ export default {
     PrintSbCode,
     ImportFormAdd,
     ImportFormUpdate,
-    PrintInSbInfoBatch
+    PrintInSbInfoBatch,
+    BaseFormStatusLog
   },
   props: {
     filter: {
@@ -563,15 +566,25 @@ export default {
       })
     },
     handleStart (record) {
-      record.status = 2
-      updateSbInfo(record).then(res => {
-        this.$message.info('已启用')
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
       })
     },
     handleStop (record) {
-      record.status = 7
-      updateSbInfo(record).then(res => {
-        this.$message.info('已停用')
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
       })
     },
     handleAdd () {

+ 649 - 0
src/views/sb/info/SbInfoDebug.vue

@@ -0,0 +1,649 @@
+<template>
+  <a-card :bordered="false">
+    <a-row :gutter="8" v-show="visible">
+      <!--      <a-col :span="4">
+        <a-tree
+          @expand="onExpand"
+          :expandedKeys="expandedKeys"
+          :autoExpandParent="true"
+          @select="onSelect"
+          :selectedKeys="selectedKeys"
+          :treeData="treeData"
+        />
+      </a-col>-->
+      <a-col :span="24">
+        <div>
+          <div class="table-page-search-wrapper">
+            <a-form layout="inline">
+              <a-row :gutter="48">
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="关键字">
+                    <a-input v-model="queryParam.keyword" placeholder="请输入名称/设备新号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备旧号">
+                    <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备类型">
+                    <a-tree-select
+                      style="width: 100%"
+                      :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                      :treeData="treeData"
+                      :treeNodeFilterProp="'title'"
+                      :showSearch="true"
+                      v-model="queryParam.typeId"
+                      placeholder="请选择"
+                    >
+                    </a-tree-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备状态">
+                    <a-select v-model="queryParam.status" placeholder="请选择">
+                      <a-select-option
+                        v-for="(label,value) in statusMap"
+                        :key="value"
+                        :label="label"
+                        :value="parseInt(value)">{{ label }}
+                      </a-select-option>
+                    </a-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="主子设备">
+                    <a-select v-model="queryParam.isChild" placeholder="请选择">
+                      <a-select-option value="1">子设备</a-select-option>
+                      <a-select-option value="2">父设备</a-select-option>
+                      <a-select-option value="3">普通设备</a-select-option>
+                    </a-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6 || 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('sb-infos-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-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"
+            :widthSpace="true"
+            :columns="columns"
+            :data="loadData"
+            :alert="options.alert"
+            :rowSelection="options.rowSelection"
+            :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
+            showPagination="auto"
+          >
+            <span slot="action" slot-scope="record">
+              <template>
+                <div>
+                  <a-dropdown>
+                    <a-menu slot="overlay">
+                      <a-menu-item key="0">
+                        <a @click="handleView(record)">查看</a>
+                      </a-menu-item>
+                      <a-menu-item key="1">
+                        <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
+                      </a-menu-item>
+                    </a-menu>
+                    <a-button> 操作 <a-icon type="down" /> </a-button>
+                  </a-dropdown>
+                </div>
+              </template>
+            </span>
+            <span slot="status" slot-scope="text">
+              <badge
+                :status="DictCache.COLOR.SB_INFO_STATUS[text]"
+                :text="statusMap[text]" />
+            </span>
+          </s-table>
+        </div>
+      </a-col>
+    </a-row>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <base-form-status-log ref="baseModalStatusLog" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+    <download-modal ref="downloadModal"/>
+    <preview-modal ref="previewModal"/>
+    <import-form-add ref="importModal" @ok="handleOk"/>
+    <import-form-update ref="importModalUpdate" @ok="handleOk"/>
+    <print-sb-code ref="printSbCode"/>
+    <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
+  </a-card>
+
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/DebugForm'
+import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
+import Detail from './modules/Detail'
+import DownloadModal from '@/views/download/DownloadModal'
+import PreviewModal from '@/views/preview/PreviewModal'
+import { updateSbInfoStatus, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
+import { queryDept } from '@/api/upms/dept'
+import { generateSbCodeAll } from '@/api/upms/code'
+import { fetchSbTypeTree } from '@/api/sb/type'
+import ImportFormAdd from './modules/ImportFormAdd'
+import ImportFormUpdate from './modules/ImportFormUpdate'
+import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
+import PrintInSbInfoBatch from '@/views/sb/info/modules/PrintInSbInfoBatch'
+
+export default {
+  name: 'SbInfoList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail,
+    DownloadModal,
+    PreviewModal,
+    PrintSbCode,
+    ImportFormAdd,
+    ImportFormUpdate,
+    PrintInSbInfoBatch,
+    BaseFormStatusLog
+  },
+  props: {
+    filter: {
+      type: Number,
+      default: -1
+    },
+    useType: {
+      type: Number,
+      default: null
+    }
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+        filter: this.filter,
+        useType: this.useType
+      },
+      depreciationTypeMap: {},
+      visible: true,
+      levelMap: {},
+      unitMap: {},
+      areaList: {},
+      companyList: {},
+      projectList: {},
+      isChildMap: {},
+      isShowMap: {},
+      deptList: {},
+      confirmLoading: false,
+      useTypeMap: {},
+      statusMap: {},
+      expandedKeys: [],
+      selectedKeys: [],
+      sourceTypeMap: {},
+      treeData: [],
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备名称',
+          checked: true,
+          width: 200,
+          dataIndex: 'name'
+        },
+        {
+          title: '设备旧号',
+          dataIndex: 'zbh',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备类型',
+          checked: true,
+          dataIndex: 'type',
+          width: 150,
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
+        {
+          title: '设备等级',
+          checked: true,
+          dataIndex: 'level',
+          width: 120,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '规格型号',
+          dataIndex: 'model',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '自定义类型',
+          checked: true,
+          dataIndex: 'useType',
+          width: 150,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.useTypeMap, text)
+          }
+        },
+        {
+          title: '第一维修人',
+          checked: true,
+          width: 150,
+          dataIndex: 'repairUserName'
+        },
+        {
+          title: '第二维修人',
+          checked: true,
+          width: 150,
+          dataIndex: 'repairUserNameSecond'
+        },
+        {
+          title: '使用位置',
+          checked: true,
+          width: 200,
+          dataIndex: 'cph'
+        },
+        {
+          title: '使用部门',
+          checked: true,
+          width: 200,
+          dataIndex: 'saveUserName'
+        },
+        {
+          title: '生产商',
+          dataIndex: 'producerName',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '大小尺寸',
+          dataIndex: 'zz',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '系列号(出厂编号)',
+          dataIndex: 'zzh',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '是否显示',
+          dataIndex: 'isShow',
+          width: 120,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.isShowMap, text)
+          }
+        },
+
+        {
+          title: '是否子设备',
+          dataIndex: 'isChild',
+          width: 120,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.isChildMap, text)
+          }
+        },
+
+        {
+          title: '资产编号1',
+          dataIndex: 'financingNo',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备原值',
+          dataIndex: 'initialValue',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '购置日期',
+          dataIndex: 'buyDate',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '投用日期',
+          dataIndex: 'startDate',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '检定日期',
+          dataIndex: 'checkDate',
+          width: 150,
+          checked: true
+        },
+        {
+          title: '检定周期',
+          dataIndex: 'checkPeriod',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            if (record.nextCheckDate == null) {
+              return '未知'
+            } else {
+              return text + '月'
+            }
+          }
+        },
+        {
+          title: '检定有效期',
+          dataIndex: 'nextCheckDate',
+          width: 150,
+          checked: true
+        },
+        {
+          title: '检定截止',
+          dataIndex: 'restDay',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            if (record.nextCheckDate == null) {
+              return '未知'
+            } else {
+              return this.BaseTool.Date.getCountBetween(new Date(), record.nextCheckDate, 1) + '天'
+            }
+          }
+        },
+        {
+          title: '状态',
+          checked: true,
+          dataIndex: 'status',
+          width: 100,
+          fixed: 'right',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          checked: true,
+          fixed: 'right',
+          align: 'center',
+          width: '200',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'asc',
+            sortName: 'no'
+          }
+        }
+        return getSbInfoPage(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 () {
+    this.tableOption()
+    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
+    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
+    this.isChildMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_CHILD)
+    this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
+  },
+  methods: {
+    tableOption () {
+      this.setTree()
+      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]
+      }
+      deleteSbInfos(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    batchGenerate () {
+      this.confirmLoading = true
+      this.$message.info('正在生成请稍后')
+      generateSbCodeAll().then(res => {
+        this.confirmLoading = false
+        this.$message.info('生成成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchSbInfo({ id: record.id }).then(res => {
+        this.visible = false
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handlePrint (record) {
+      this.visible = false
+      fetchSbInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base([res.data])
+      })
+    },
+    handlePrintBatch () {
+      this.visible = false
+      let ids = []
+      const length = this.selectedRows.length
+      if (length === 0) {
+        this.$message.info('请选择要打印的记录')
+        return
+      }
+      ids = this.selectedRows.map(item => item.id)
+      fetchSbInfos(ids).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base(res.data)
+      })
+    },
+    handleStart (record) {
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
+      })
+    },
+    handleStop (record) {
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      this.$refs.baseModal.base()
+    },
+    handleView (record) {
+      fetchSbInfo({ id: record.id }).then(res => {
+        this.visible = false
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+
+    handleCopy (record) {
+      this.visible = false
+      fetchSbInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data, 1)
+      })
+    },
+    handleOk () {
+      this.visible = true
+      this.setTree()
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+        filter: this.filter,
+        useType: this.useType
+      }
+      this.visible = true
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam,
+        dataScope: {
+          sortBy: 'asc',
+          sortName: 'no'
+        }
+      }
+      exportSbInfo(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    setTree (record = {}) {
+      queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
+        this.areaList = res.data
+      })
+      fetchSbTypeTree().then(res => {
+        this.treeData = res.data
+      })
+    },
+    onSelect: function (selectedKeys, info) {
+      this.selectedKeys = selectedKeys
+      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
+      this.$refs.table.refresh(true)
+    },
+    onExpand (expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    },
+    handleRepairFilePreview (record) {
+      console.log(record, 87878)
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
+    },
+    handleRepairFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
+    },
+    handleUseFilePreview (record) {
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
+    },
+    handleUseFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
+    },
+    handleCheckFilePreview (record) {
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
+    },
+    handleCheckFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
+    },
+    doImport () {
+      this.$refs.importModal.base(null, null)
+    },
+    doImportForUpdate () {
+      this.$refs.importModalUpdate.base(null, null)
+    }
+  }
+}
+</script>

+ 649 - 0
src/views/sb/info/SbInfoTestRun.vue

@@ -0,0 +1,649 @@
+<template>
+  <a-card :bordered="false">
+    <a-row :gutter="8" v-show="visible">
+      <!--      <a-col :span="4">
+        <a-tree
+          @expand="onExpand"
+          :expandedKeys="expandedKeys"
+          :autoExpandParent="true"
+          @select="onSelect"
+          :selectedKeys="selectedKeys"
+          :treeData="treeData"
+        />
+      </a-col>-->
+      <a-col :span="24">
+        <div>
+          <div class="table-page-search-wrapper">
+            <a-form layout="inline">
+              <a-row :gutter="48">
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="关键字">
+                    <a-input v-model="queryParam.keyword" placeholder="请输入名称/设备新号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备旧号">
+                    <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备类型">
+                    <a-tree-select
+                      style="width: 100%"
+                      :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                      :treeData="treeData"
+                      :treeNodeFilterProp="'title'"
+                      :showSearch="true"
+                      v-model="queryParam.typeId"
+                      placeholder="请选择"
+                    >
+                    </a-tree-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="设备状态">
+                    <a-select v-model="queryParam.status" placeholder="请选择">
+                      <a-select-option
+                        v-for="(label,value) in statusMap"
+                        :key="value"
+                        :label="label"
+                        :value="parseInt(value)">{{ label }}
+                      </a-select-option>
+                    </a-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-item label="主子设备">
+                    <a-select v-model="queryParam.isChild" placeholder="请选择">
+                      <a-select-option value="1">子设备</a-select-option>
+                      <a-select-option value="2">父设备</a-select-option>
+                      <a-select-option value="3">普通设备</a-select-option>
+                    </a-select>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6 || 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('sb-infos-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-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"
+            :widthSpace="true"
+            :columns="columns"
+            :data="loadData"
+            :alert="options.alert"
+            :rowSelection="options.rowSelection"
+            :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
+            showPagination="auto"
+          >
+            <span slot="action" slot-scope="record">
+              <template>
+                <div>
+                  <a-dropdown>
+                    <a-menu slot="overlay">
+                      <a-menu-item key="0">
+                        <a @click="handleView(record)">查看</a>
+                      </a-menu-item>
+                      <a-menu-item key="1">
+                        <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
+                      </a-menu-item>
+                    </a-menu>
+                    <a-button> 操作 <a-icon type="down" /> </a-button>
+                  </a-dropdown>
+                </div>
+              </template>
+            </span>
+            <span slot="status" slot-scope="text">
+              <badge
+                :status="DictCache.COLOR.SB_INFO_STATUS[text]"
+                :text="statusMap[text]" />
+            </span>
+          </s-table>
+        </div>
+      </a-col>
+    </a-row>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <base-form-status-log ref="baseModalStatusLog" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+    <download-modal ref="downloadModal"/>
+    <preview-modal ref="previewModal"/>
+    <import-form-add ref="importModal" @ok="handleOk"/>
+    <import-form-update ref="importModalUpdate" @ok="handleOk"/>
+    <print-sb-code ref="printSbCode"/>
+    <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
+  </a-card>
+
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/TestRunForm'
+import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
+import Detail from './modules/Detail'
+import DownloadModal from '@/views/download/DownloadModal'
+import PreviewModal from '@/views/preview/PreviewModal'
+import { updateSbInfoStatus, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
+import { queryDept } from '@/api/upms/dept'
+import { generateSbCodeAll } from '@/api/upms/code'
+import { fetchSbTypeTree } from '@/api/sb/type'
+import ImportFormAdd from './modules/ImportFormAdd'
+import ImportFormUpdate from './modules/ImportFormUpdate'
+import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
+import PrintInSbInfoBatch from '@/views/sb/info/modules/PrintInSbInfoBatch'
+
+export default {
+  name: 'SbInfoList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail,
+    DownloadModal,
+    PreviewModal,
+    PrintSbCode,
+    ImportFormAdd,
+    ImportFormUpdate,
+    PrintInSbInfoBatch,
+    BaseFormStatusLog
+  },
+  props: {
+    filter: {
+      type: Number,
+      default: -1
+    },
+    useType: {
+      type: Number,
+      default: null
+    }
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+        filter: this.filter,
+        useType: this.useType
+      },
+      depreciationTypeMap: {},
+      visible: true,
+      levelMap: {},
+      unitMap: {},
+      areaList: {},
+      companyList: {},
+      projectList: {},
+      isChildMap: {},
+      isShowMap: {},
+      deptList: {},
+      confirmLoading: false,
+      useTypeMap: {},
+      statusMap: {},
+      expandedKeys: [],
+      selectedKeys: [],
+      sourceTypeMap: {},
+      treeData: [],
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备名称',
+          checked: true,
+          width: 200,
+          dataIndex: 'name'
+        },
+        {
+          title: '设备旧号',
+          dataIndex: 'zbh',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备类型',
+          checked: true,
+          dataIndex: 'type',
+          width: 150,
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
+        {
+          title: '设备等级',
+          checked: true,
+          dataIndex: 'level',
+          width: 120,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '规格型号',
+          dataIndex: 'model',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '自定义类型',
+          checked: true,
+          dataIndex: 'useType',
+          width: 150,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.useTypeMap, text)
+          }
+        },
+        {
+          title: '第一维修人',
+          checked: true,
+          width: 150,
+          dataIndex: 'repairUserName'
+        },
+        {
+          title: '第二维修人',
+          checked: true,
+          width: 150,
+          dataIndex: 'repairUserNameSecond'
+        },
+        {
+          title: '使用位置',
+          checked: true,
+          width: 200,
+          dataIndex: 'cph'
+        },
+        {
+          title: '使用部门',
+          checked: true,
+          width: 200,
+          dataIndex: 'saveUserName'
+        },
+        {
+          title: '生产商',
+          dataIndex: 'producerName',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '大小尺寸',
+          dataIndex: 'zz',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '系列号(出厂编号)',
+          dataIndex: 'zzh',
+          width: 120,
+          checked: true
+        },
+
+        {
+          title: '是否显示',
+          dataIndex: 'isShow',
+          width: 120,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.isShowMap, text)
+          }
+        },
+
+        {
+          title: '是否子设备',
+          dataIndex: 'isChild',
+          width: 120,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.isChildMap, text)
+          }
+        },
+
+        {
+          title: '资产编号1',
+          dataIndex: 'financingNo',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '设备原值',
+          dataIndex: 'initialValue',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '购置日期',
+          dataIndex: 'buyDate',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '投用日期',
+          dataIndex: 'startDate',
+          width: 120,
+          checked: true
+        },
+        {
+          title: '检定日期',
+          dataIndex: 'checkDate',
+          width: 150,
+          checked: true
+        },
+        {
+          title: '检定周期',
+          dataIndex: 'checkPeriod',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            if (record.nextCheckDate == null) {
+              return '未知'
+            } else {
+              return text + '月'
+            }
+          }
+        },
+        {
+          title: '检定有效期',
+          dataIndex: 'nextCheckDate',
+          width: 150,
+          checked: true
+        },
+        {
+          title: '检定截止',
+          dataIndex: 'restDay',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            if (record.nextCheckDate == null) {
+              return '未知'
+            } else {
+              return this.BaseTool.Date.getCountBetween(new Date(), record.nextCheckDate, 1) + '天'
+            }
+          }
+        },
+        {
+          title: '状态',
+          checked: true,
+          dataIndex: 'status',
+          width: 100,
+          fixed: 'right',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          checked: true,
+          fixed: 'right',
+          align: 'center',
+          width: '200',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'asc',
+            sortName: 'no'
+          }
+        }
+        return getSbInfoPage(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 () {
+    this.tableOption()
+    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
+    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
+    this.isChildMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_CHILD)
+    this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
+  },
+  methods: {
+    tableOption () {
+      this.setTree()
+      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]
+      }
+      deleteSbInfos(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    batchGenerate () {
+      this.confirmLoading = true
+      this.$message.info('正在生成请稍后')
+      generateSbCodeAll().then(res => {
+        this.confirmLoading = false
+        this.$message.info('生成成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchSbInfo({ id: record.id }).then(res => {
+        this.visible = false
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handlePrint (record) {
+      this.visible = false
+      fetchSbInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base([res.data])
+      })
+    },
+    handlePrintBatch () {
+      this.visible = false
+      let ids = []
+      const length = this.selectedRows.length
+      if (length === 0) {
+        this.$message.info('请选择要打印的记录')
+        return
+      }
+      ids = this.selectedRows.map(item => item.id)
+      fetchSbInfos(ids).then(res => {
+        const modal = this.$refs.printInSbInfoBatch
+        modal.base(res.data)
+      })
+    },
+    handleStart (record) {
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
+      })
+    },
+    handleStop (record) {
+      const modal = this.$refs.baseModalStatusLog
+      modal.base(null, {
+        sbId: record.id,
+        sbNo: record.no,
+        changeUserId: this.$store.getters.userInfo.userId,
+        actualUser: this.$store.getters.userInfo.realName,
+        preStatus: record.status,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      this.$refs.baseModal.base()
+    },
+    handleView (record) {
+      fetchSbInfo({ id: record.id }).then(res => {
+        this.visible = false
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+
+    handleCopy (record) {
+      this.visible = false
+      fetchSbInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data, 1)
+      })
+    },
+    handleOk () {
+      this.visible = true
+      this.setTree()
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+        filter: this.filter,
+        useType: this.useType
+      }
+      this.visible = true
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam,
+        dataScope: {
+          sortBy: 'asc',
+          sortName: 'no'
+        }
+      }
+      exportSbInfo(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    setTree (record = {}) {
+      queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
+        this.areaList = res.data
+      })
+      fetchSbTypeTree().then(res => {
+        this.treeData = res.data
+      })
+    },
+    onSelect: function (selectedKeys, info) {
+      this.selectedKeys = selectedKeys
+      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
+      this.$refs.table.refresh(true)
+    },
+    onExpand (expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    },
+    handleRepairFilePreview (record) {
+      console.log(record, 87878)
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
+    },
+    handleRepairFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
+    },
+    handleUseFilePreview (record) {
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
+    },
+    handleUseFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
+    },
+    handleCheckFilePreview (record) {
+      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
+    },
+    handleCheckFileDownload (record) {
+      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
+    },
+    doImport () {
+      this.$refs.importModal.base(null, null)
+    },
+    doImportForUpdate () {
+      this.$refs.importModalUpdate.base(null, null)
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/sb/info/modules/BaseForm.vue

@@ -885,7 +885,7 @@
           >
             <a-upload
               :action="uploadUrl"
-              :multiple="true"
+              :multiple="false"
               :file-list="this.defaultSbFileList"
               @change="handleSbFileChange"
               accept="image/*"

+ 539 - 0
src/views/sb/info/modules/DebugForm.vue

@@ -0,0 +1,539 @@
+<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 type="primary" @click="save()">提交</a-button>
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+
+    <title-divider title="基本信息" width="90px"></title-divider>
+    <a-form :form="form">
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['parentId']" type="hidden"/>
+      </a-form-item>
+
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备(新号)"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['no', {rules: [{required: true, message: '不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备(旧号)"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['zbh', {rules: [{required: false, message: '不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['name', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="型号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['model', {rules: [{required: true, message: '设备型号不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <title-divider title="安装调试意见" width="120px"></title-divider>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="安装意见"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="调试意见"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['zz']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <title-divider title="安装调试文件" width="120px"></title-divider>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="安装调试单"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              :file-list="this.defaultRepairFileList"
+              @change="handleRepairFileChange"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
+            </a-upload>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="调试照片"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              :file-list="this.defaultSbFileList"
+              @change="handleSbFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
+            </a-upload>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSbInfo, updateSbInfo, fetchSbInfo, copySbInfo } from '@/api/sb/info'
+import BaseTool from '../../../../utils/tool'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import Vue from 'vue'
+import { uploadUrl } from '@/api/upms/file'
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'BaseSbInfo',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      areaList: {},
+      companyList: {},
+      paramList: [],
+      projectList: {},
+      deptList: {},
+      groupList: {},
+      visible: false,
+      sbTypeTreeData: [],
+      // sbInfoTreeData: [],
+      // sourceSbInfoTreeData: [],
+      // sbPositionTreeData: [],
+      depreciationTypeMap: {},
+      sourceTypeMap: {},
+      levelMap: {},
+      rlTypeMap: {},
+      colorMap: {},
+      useTypeMap: {},
+      statusMap: {},
+      isChildMap: {},
+      isShowMap: {},
+      isFinancingMap: {},
+      userList: {},
+      unitMap: {},
+      sbInfoSelectType: null,
+      repairFileList: [], // 维修手册
+      defaultRepairFileList: [],
+      defaultUseFileList: [],
+      defaultRecheckFileList: [],
+      defaultSbFileList: [],
+      useFileList: [], // 使用手册
+      recheckFileList: [], // 验收手册
+      sbFileList: [], // 设备图片,
+      uploadUrl: uploadUrl,
+      qrcodesrc: null,
+      id: null,
+      fileList: [],
+      type: null,
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      }
+    }
+  },
+  props: {
+    useType: {
+      type: Number,
+      default: 3
+    }
+  },
+  created () {
+    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
+    this.colorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_COLOR)
+    this.rlTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.RANLIAO_TYPE)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+  },
+  methods: {
+    base (record, type) {
+      // 清除文件列表
+      this.visible = true
+      // 选择框查询条件
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.qrcodesrc = null
+        this.modalTitle = '添加'
+        this.clearFileList()
+        return
+      }
+      this.useType = record.useType
+      this.modalTitle = '编辑'
+      this.id = record.id
+      this.qrcodesrc = record.qrCode
+      this.repairFileList = record.repairFileList
+      this.useFileList = record.useFileList
+      this.recheckFileList = record.recheckFileList
+      this.sbFileList = record.sbFileList
+      this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
+      this.defaultUseFileList = this.BaseTool.UPLOAD.transImg(this.useFileList)
+      this.defaultRecheckFileList = this.BaseTool.UPLOAD.transImg(this.recheckFileList)
+      this.defaultSbFileList = this.BaseTool.UPLOAD.transImg(this.sbFileList)
+      this.paramList = JSON.parse(record.paramList)
+      if (type === 1) {
+        this.type = type
+        this.modalTitle = '复制'
+        this.qrcodesrc = null
+        record.no = null
+        this.clearFileList()
+      }
+
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      // record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.guaranteeDate = this.BaseTool.Moment(record.guaranteeDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+      // record.lastRepaireTime = this.BaseTool.Moment(record.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.lastBaoyangTime = this.BaseTool.Moment(record.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      if (record.buyDate != null) {
+        record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'buyDate'
+          ])))
+        })
+      }
+      if (record.startDate != null) {
+        record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'startDate'
+          ])))
+        })
+      }
+      if (record.checkDate != null) {
+        record.checkDate = this.BaseTool.Moment(record.checkDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'checkDate'
+          ])))
+        })
+      }
+      if (record.nextCheckDate != null) {
+        record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'nextCheckDate'
+          ])))
+        })
+      }
+      if (record.retirementDate != null) {
+        record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'retirementDate'
+          ])))
+        })
+      }
+      if (record.registerDate != null) {
+        record.registerDate = this.BaseTool.Moment(record.registerDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'registerDate'
+          ])))
+        })
+      }
+      record.unitName = this.BaseTool.Object.getField(this.unitMap, record.unit)
+      record.useTypeName = this.BaseTool.Object.getField(this.useTypeMap, record.useType)
+
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'no',
+          'parentId',
+          'parentSbName',
+          'isChild',
+          'isShow',
+          'isFinancing',
+          'financingNo',
+          'financingNoTwo',
+          'financingNoThird',
+          'financingNoFour',
+          'financingNoFive',
+          'name',
+          'model',
+          'cph',
+          'positionId',
+          'producerName',
+          'useArea',
+          'useCompany',
+          'useProject',
+          'useDept',
+          'saveUser',
+          'repairUser',
+          'useGroup',
+          'typeId',
+          'level',
+          'initialValue',
+          // 'cutValue',
+          'producerId',
+          // 'sourceType',
+          'unit',
+          'buyDate',
+          'startDate',
+          'zbh',
+          // 'wbFile',
+          // 'useFile',
+          // 'checkFile',
+          // 'sbImage',
+          'status',
+          'remark',
+          'zzh',
+          'zz',
+          'zjm',
+          'jbdh',
+          'useType',
+          'cardNo',
+          'fdjxh',
+          'checkDate',
+          'checkPeriod',
+          'nextCheckDate',
+          'dph',
+          'zaiz',
+          'rlType',
+          'color',
+          'sbdh',
+          'seatNumber',
+          'registerNo',
+          'characterType',
+          'usedNo',
+          'supplier',
+          'repairUserSecond',
+          'batchNo',
+          'workYear',
+          'retirementDate',
+          'registerDate'
+
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期数据的处理
+        values.buyDate = BaseTool.Date.formatter(values.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.startDate = BaseTool.Date.formatter(values.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.checkDate = BaseTool.Date.formatter(values.checkDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.nextCheckDate = BaseTool.Date.formatter(values.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.guaranteeDate = BaseTool.Date.formatter(values.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.retirementDate = BaseTool.Date.formatter(values.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+        values.lastRepaireTime = this.BaseTool.Date.formatter(values.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.lastBaoyangTime = this.BaseTool.Date.formatter(values.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.spDate = this.BaseTool.Date.formatter(values.spDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.jbdDate = this.BaseTool.Date.formatter(values.jbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.sbdDate = this.BaseTool.Date.formatter(values.sbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.sbDate = this.BaseTool.Date.formatter(values.sbDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+        // 上传文件
+        values.repairFileList = this.repairFileList
+        values.useFileList = this.useFileList
+        values.recheckFileList = this.recheckFileList
+        values.sbFileList = this.sbFileList
+        values.paramList = JSON.stringify(this.paramList)
+        values.useType = this.useType
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSbInfo(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          if (this.type == null) {
+            updateSbInfo(values)
+              .then(() => {
+                this.handleCancel(values)
+              }).catch(() => {
+                this.confirmLoading = false
+              })
+          } else {
+            copySbInfo(values)
+              .then(() => {
+                this.handleCancel(values)
+              }).catch(() => {
+                this.confirmLoading = false
+              })
+          }
+        }
+      })
+    },
+    getQrcodeSrc () {
+      console.log(111, 22)
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      this.$emit('ok')
+    },
+    handleFresh () {
+      fetchSbInfo({ id: this.id }).then(res => {
+        const { form: { setFieldsValue } } = this
+        const record = res.data
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'zjm',
+            'jbdh'
+          ])))
+        })
+      })
+    },
+
+    beforeRecheckFileListUpload (file) {
+      const reg = /\.(xls|xlsx)(\?.*)?$/
+      return new Promise((resolve, reject) => {
+        if (reg.test(file.name)) {
+          this.recheckFileList = [file]
+          return true
+        } else {
+          this.$message.error(`请上传正确的xls|xlsx文件`)
+          reject(new Error('请上传正确的xls|xlsx文件'))
+          return false
+        }
+      })
+    },
+    beforeUploadPic (file) {
+      const reg = /\.(jpg|jpeg|png)(\?.*)?$/
+      return new Promise((resolve, reject) => {
+        if (reg.test(file.name)) {
+          this.sbFileList = [file]
+          return true
+        } else {
+          this.$message.error(`请上传正确的jpg|jpeg|png文件`)
+          reject(new Error('请上传正确的jpg|jpeg|png文件'))
+          return false
+        }
+      })
+    },
+    clearFileList () {
+      this.repairFileList = []
+      this.useFileList = []
+      this.recheckFileList = []
+      this.sbFileList = []
+    },
+    handleRepairFileChange (info) {
+      this.defaultRepairFileList = info.fileList
+      this.repairFileList = this.setFileList(info, 1)
+    },
+    handleUseFileChange (info) {
+      this.defaultUseFileList = info.fileList
+      this.useFileList = this.setFileList(info, 2)
+    },
+    handleRecheckFileChange (info) {
+      this.defaultRecheckFileList = info.fileList
+      this.recheckFileList = this.setFileList(info, 3)
+    },
+    handleSbFileChange (info) {
+      this.defaultSbFileList = info.fileList
+      this.sbFileList = this.setFileList(info, 4)
+    },
+    setFileList1 (info, type) {
+      const fileList = [...info.fileList]
+      const file = [...info.file]
+      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 []
+      }
+    },
+    clearParent () {
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'parentId': null,
+          'parentSbName': null
+        }))
+      })
+    },
+    setFileList (info, type) {
+      // { file, fileList }
+
+      const file = info.file
+      const fileList = info.fileList
+      // fileList = fileList.slice(-2)
+      // console.log(111, this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type))
+
+      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 null
+      }
+    }
+  }
+}
+</script>

+ 17 - 1
src/views/sb/info/modules/Detail.vue

@@ -149,6 +149,12 @@
         <q-tab-pane key="5" tab="历史费用">
           <repair-fee-table :table-params="{sbId: model.id}" ref="repairFeeTable" />
         </q-tab-pane>
+        <q-tab-pane key="6" tab="状态变更记录">
+          <sb-status-log-table :type="2" :table-params="{sbId: model.id, sbName: model.name}" ref="sbStatusLogTable" />
+        </q-tab-pane>
+        <q-tab-pane key="7" tab="停机记录">
+          <sb-stop-log-table :table-params="{sbId: model.id}" ref="sbStopLogTable" />
+        </q-tab-pane>
       </q-tabs>
     </div>
     <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
@@ -165,6 +171,8 @@
 import DetailList from '@/components/tools/DetailList'
 import RepairApplicationFormTable from '@/views/repair/application-form/modules/RepairApplicationFormTable'
 import CheckJobTable from '@/views/check/checkjob/modules/CheckJobTable'
+import SbStatusLogTable from '@/views/sb/status-log/modules/SbStatusLogTable'
+import SbStopLogTable from '@/views/sb/stop-logs/modules/SbStopLogTable'
 // import CheckJobTableWaitDo from '@/views/check/checkjob/modules/CheckJobTableWaitDo'
 import { fetchFirmProducer } from '@/api/firm/producer'
 import { queryNumCheckStandard } from '@/api/check/checkstandard'
@@ -203,7 +211,9 @@ export default {
     PartInfoList,
     DetailSbMeasure,
     DetailSbInfo,
-    RepairFeeTable
+    RepairFeeTable,
+    SbStatusLogTable,
+    SbStopLogTable
   },
   data () {
     return {
@@ -412,6 +422,12 @@ export default {
       if (this.activeKey === '5' && this.BaseTool.Object.isNotBlank(this.$refs.repairFeeTable)) {
         this.$refs.repairFeeTable.handleOk()
       }
+      if (this.activeKey === '6' && this.BaseTool.Object.isNotBlank(this.$refs.sbStatusLogTable)) {
+        this.$refs.sbStatusLogTable.handleOk()
+      }
+      if (this.activeKey === '7' && this.BaseTool.Object.isNotBlank(this.$refs.sbStopLogTable)) {
+        this.$refs.sbStopLogTable.handleOk()
+      }
     },
     getQrcodeSrc: (dom) => {
       console.log(11, 22)

+ 629 - 0
src/views/sb/info/modules/TestRunForm.vue

@@ -0,0 +1,629 @@
+<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 type="primary" @click="save()">提交</a-button>
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+
+    <title-divider title="基本信息" width="90px"></title-divider>
+    <a-form :form="form">
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['parentId']" type="hidden"/>
+      </a-form-item>
+
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备(新号)"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['no', {rules: [{required: true, message: '不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备(旧号)"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['zbh', {rules: [{required: false, message: '不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="设备名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['name', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="型号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['model', {rules: [{required: true, message: '设备型号不能为空'}]}]" />
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <title-divider title="试车数据记录" width="120px"></title-divider>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="连续运转时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              :rows="4"
+              suffix="分钟"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="启动电流"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              suffix="A"
+              v-decorator="['zz']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="压力"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              :rows="4"
+              suffix="进口"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="压力"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              suffix="出口"
+              v-decorator="['zz']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="轴承温度"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              :rows="4"
+              suffix="前"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="轴承温度"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              suffix="后"
+              v-decorator="['zz']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="电压"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              :rows="4"
+              suffix="V"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="电流"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              suffix="A"
+              v-decorator="['zz']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <title-divider title="试车意见" width="120px"></title-divider>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="24" :md="24" :sm="24">
+          <a-form-item
+            label="试车意见"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['fdjh']"/>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <title-divider title="试车记录文件" width="120px"></title-divider>
+      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="试车文件"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              :file-list="this.defaultRepairFileList"
+              @change="handleRepairFileChange"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
+            </a-upload>
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="试车照片"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              :file-list="this.defaultSbFileList"
+              @change="handleSbFileChange"
+              accept="image/*"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
+            </a-upload>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSbInfo, updateSbInfo, fetchSbInfo, copySbInfo } from '@/api/sb/info'
+import BaseTool from '../../../../utils/tool'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import Vue from 'vue'
+import { uploadUrl } from '@/api/upms/file'
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'BaseSbInfo',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      areaList: {},
+      companyList: {},
+      paramList: [],
+      projectList: {},
+      deptList: {},
+      groupList: {},
+      visible: false,
+      sbTypeTreeData: [],
+      // sbInfoTreeData: [],
+      // sourceSbInfoTreeData: [],
+      // sbPositionTreeData: [],
+      depreciationTypeMap: {},
+      sourceTypeMap: {},
+      levelMap: {},
+      rlTypeMap: {},
+      colorMap: {},
+      useTypeMap: {},
+      statusMap: {},
+      isChildMap: {},
+      isShowMap: {},
+      isFinancingMap: {},
+      userList: {},
+      unitMap: {},
+      sbInfoSelectType: null,
+      repairFileList: [], // 维修手册
+      defaultRepairFileList: [],
+      defaultUseFileList: [],
+      defaultRecheckFileList: [],
+      defaultSbFileList: [],
+      useFileList: [], // 使用手册
+      recheckFileList: [], // 验收手册
+      sbFileList: [], // 设备图片,
+      uploadUrl: uploadUrl,
+      qrcodesrc: null,
+      id: null,
+      fileList: [],
+      type: null,
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      }
+    }
+  },
+  props: {
+    useType: {
+      type: Number,
+      default: 3
+    }
+  },
+  created () {
+    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
+    this.colorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_COLOR)
+    this.rlTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.RANLIAO_TYPE)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+  },
+  methods: {
+    base (record, type) {
+      // 清除文件列表
+      this.visible = true
+      // 选择框查询条件
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.qrcodesrc = null
+        this.modalTitle = '添加'
+        this.clearFileList()
+        return
+      }
+      this.useType = record.useType
+      this.modalTitle = '编辑'
+      this.id = record.id
+      this.qrcodesrc = record.qrCode
+      this.repairFileList = record.repairFileList
+      this.useFileList = record.useFileList
+      this.recheckFileList = record.recheckFileList
+      this.sbFileList = record.sbFileList
+      this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
+      this.defaultUseFileList = this.BaseTool.UPLOAD.transImg(this.useFileList)
+      this.defaultRecheckFileList = this.BaseTool.UPLOAD.transImg(this.recheckFileList)
+      this.defaultSbFileList = this.BaseTool.UPLOAD.transImg(this.sbFileList)
+      this.paramList = JSON.parse(record.paramList)
+      if (type === 1) {
+        this.type = type
+        this.modalTitle = '复制'
+        this.qrcodesrc = null
+        record.no = null
+        this.clearFileList()
+      }
+
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      // record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.guaranteeDate = this.BaseTool.Moment(record.guaranteeDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+      // record.lastRepaireTime = this.BaseTool.Moment(record.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      // record.lastBaoyangTime = this.BaseTool.Moment(record.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      if (record.buyDate != null) {
+        record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'buyDate'
+          ])))
+        })
+      }
+      if (record.startDate != null) {
+        record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'startDate'
+          ])))
+        })
+      }
+      if (record.checkDate != null) {
+        record.checkDate = this.BaseTool.Moment(record.checkDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'checkDate'
+          ])))
+        })
+      }
+      if (record.nextCheckDate != null) {
+        record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'nextCheckDate'
+          ])))
+        })
+      }
+      if (record.retirementDate != null) {
+        record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'retirementDate'
+          ])))
+        })
+      }
+      if (record.registerDate != null) {
+        record.registerDate = this.BaseTool.Moment(record.registerDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'registerDate'
+          ])))
+        })
+      }
+      record.unitName = this.BaseTool.Object.getField(this.unitMap, record.unit)
+      record.useTypeName = this.BaseTool.Object.getField(this.useTypeMap, record.useType)
+
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'no',
+          'parentId',
+          'parentSbName',
+          'isChild',
+          'isShow',
+          'isFinancing',
+          'financingNo',
+          'financingNoTwo',
+          'financingNoThird',
+          'financingNoFour',
+          'financingNoFive',
+          'name',
+          'model',
+          'cph',
+          'positionId',
+          'producerName',
+          'useArea',
+          'useCompany',
+          'useProject',
+          'useDept',
+          'saveUser',
+          'repairUser',
+          'useGroup',
+          'typeId',
+          'level',
+          'initialValue',
+          // 'cutValue',
+          'producerId',
+          // 'sourceType',
+          'unit',
+          'buyDate',
+          'startDate',
+          'zbh',
+          // 'wbFile',
+          // 'useFile',
+          // 'checkFile',
+          // 'sbImage',
+          'status',
+          'remark',
+          'zzh',
+          'zz',
+          'zjm',
+          'jbdh',
+          'useType',
+          'cardNo',
+          'fdjxh',
+          'checkDate',
+          'checkPeriod',
+          'nextCheckDate',
+          'dph',
+          'zaiz',
+          'rlType',
+          'color',
+          'sbdh',
+          'seatNumber',
+          'registerNo',
+          'characterType',
+          'usedNo',
+          'supplier',
+          'repairUserSecond',
+          'batchNo',
+          'workYear',
+          'retirementDate',
+          'registerDate'
+
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期数据的处理
+        values.buyDate = BaseTool.Date.formatter(values.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.startDate = BaseTool.Date.formatter(values.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.checkDate = BaseTool.Date.formatter(values.checkDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.nextCheckDate = BaseTool.Date.formatter(values.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.guaranteeDate = BaseTool.Date.formatter(values.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.retirementDate = BaseTool.Date.formatter(values.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+        values.lastRepaireTime = this.BaseTool.Date.formatter(values.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.lastBaoyangTime = this.BaseTool.Date.formatter(values.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.spDate = this.BaseTool.Date.formatter(values.spDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.jbdDate = this.BaseTool.Date.formatter(values.jbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.sbdDate = this.BaseTool.Date.formatter(values.sbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        values.sbDate = this.BaseTool.Date.formatter(values.sbDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+
+        // 上传文件
+        values.repairFileList = this.repairFileList
+        values.useFileList = this.useFileList
+        values.recheckFileList = this.recheckFileList
+        values.sbFileList = this.sbFileList
+        values.paramList = JSON.stringify(this.paramList)
+        values.useType = this.useType
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSbInfo(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else {
+          if (this.type == null) {
+            updateSbInfo(values)
+              .then(() => {
+                this.handleCancel(values)
+              }).catch(() => {
+              this.confirmLoading = false
+            })
+          } else {
+            copySbInfo(values)
+              .then(() => {
+                this.handleCancel(values)
+              }).catch(() => {
+              this.confirmLoading = false
+            })
+          }
+        }
+      })
+    },
+    getQrcodeSrc () {
+      console.log(111, 22)
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      this.$emit('ok')
+    },
+    handleFresh () {
+      fetchSbInfo({ id: this.id }).then(res => {
+        const { form: { setFieldsValue } } = this
+        const record = res.data
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'zjm',
+            'jbdh'
+          ])))
+        })
+      })
+    },
+
+    beforeRecheckFileListUpload (file) {
+      const reg = /\.(xls|xlsx)(\?.*)?$/
+      return new Promise((resolve, reject) => {
+        if (reg.test(file.name)) {
+          this.recheckFileList = [file]
+          return true
+        } else {
+          this.$message.error(`请上传正确的xls|xlsx文件`)
+          reject(new Error('请上传正确的xls|xlsx文件'))
+          return false
+        }
+      })
+    },
+    beforeUploadPic (file) {
+      const reg = /\.(jpg|jpeg|png)(\?.*)?$/
+      return new Promise((resolve, reject) => {
+        if (reg.test(file.name)) {
+          this.sbFileList = [file]
+          return true
+        } else {
+          this.$message.error(`请上传正确的jpg|jpeg|png文件`)
+          reject(new Error('请上传正确的jpg|jpeg|png文件'))
+          return false
+        }
+      })
+    },
+    clearFileList () {
+      this.repairFileList = []
+      this.useFileList = []
+      this.recheckFileList = []
+      this.sbFileList = []
+    },
+    handleRepairFileChange (info) {
+      this.defaultRepairFileList = info.fileList
+      this.repairFileList = this.setFileList(info, 1)
+    },
+    handleUseFileChange (info) {
+      this.defaultUseFileList = info.fileList
+      this.useFileList = this.setFileList(info, 2)
+    },
+    handleRecheckFileChange (info) {
+      this.defaultRecheckFileList = info.fileList
+      this.recheckFileList = this.setFileList(info, 3)
+    },
+    handleSbFileChange (info) {
+      this.defaultSbFileList = info.fileList
+      this.sbFileList = this.setFileList(info, 4)
+    },
+    setFileList1 (info, type) {
+      const fileList = [...info.fileList]
+      const file = [...info.file]
+      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 []
+      }
+    },
+    clearParent () {
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'parentId': null,
+          'parentSbName': null
+        }))
+      })
+    },
+    setFileList (info, type) {
+      // { file, fileList }
+
+      const file = info.file
+      const fileList = info.fileList
+      // fileList = fileList.slice(-2)
+      // console.log(111, this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type))
+
+      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 null
+      }
+    }
+  }
+}
+</script>

+ 16 - 28
src/views/sb/status-log/SbStatusLog.vue

@@ -98,30 +98,26 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-        {
-          title: '设备名称',
-          dataIndex: 'sbName'
-        },
         {
           title: '设备编号',
           dataIndex: 'sbNo'
         },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
         {
           title: '设备型号',
           dataIndex: 'sbModel'
         },
         {
-          title: '变更时间',
-          dataIndex: 'changeTime'
+          title: '变更原因',
+          dataIndex: 'changeReason'
+        },
+        {
+          title: '变更人',
+          dataIndex: 'actualUser'
         },
-        /*        {
-                 title: '变更原因',
-                 dataIndex: 'changeReason'
-               },
-              {
-                 title: '变更人',
-                 dataIndex: 'changeUserId'
-               },*/
         {
           title: '变更前状态',
           dataIndex: 'preStatus',
@@ -133,12 +129,8 @@ export default {
           scopedSlots: { customRender: 'status' }
         },
         {
-          title: '备注',
-          dataIndex: 'remark'
-        },
-        {
-          title: '创建日期',
-          dataIndex: 'createdTime'
+          title: '变更时间',
+          dataIndex: 'changeTime'
         },
         {
           title: '操作',
@@ -226,16 +218,12 @@ export default {
       })
     },
     handleEdit (record) {
-      fetchSbStatusLog({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        modal.base(res.data)
-      })
+      const modal = this.$refs.baseModal
+      modal.base(record)
     },
     handleView (record) {
-      fetchSbStatusLog({ id: record.id }).then(res => {
-        const modal = this.$refs.detailModal
-        modal.base(res.data)
-      })
+      const modal = this.$refs.detailModal
+      modal.base(record)
     },
     handleOk () {
       this.$refs.table.refresh()

+ 51 - 13
src/views/sb/status-log/modules/BaseForm.vue

@@ -11,18 +11,20 @@
         <row-item>
           <a-form-item>
             <a-input v-decorator="['id']" type="hidden"/>
+            <a-input v-decorator="['sbId']" type="hidden"/>
+            <a-input v-decorator="['changeUserId']" type="hidden"/>
           </a-form-item>
         </row-item>
       </row-list>
       <row-list :col="1">
         <row-item>
           <a-form-item
-            label="设备id"
+            label="设备"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input
-              v-decorator="['sbId', {rules: [{required: true, message: '设备id不能为空'}]}]"/>
+              v-decorator="['sbNo', {rules: [{required: true, message: '设备不能为空'}]}]"/>
           </a-form-item>
         </row-item>
         <row-item>
@@ -31,6 +33,10 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+              v-decorator="['changeTime', {rules: [{required: true, message: '变更时间不能为空'}]}]" />
           </a-form-item>
         </row-item>
         <row-item>
@@ -50,7 +56,7 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input
-              v-decorator="['changeUserId', {rules: [{required: true, message: '变更人不能为空'}]}]"/>
+              v-decorator="['actualUser', {rules: [{required: true, message: '变更人不能为空'}]}]"/>
           </a-form-item>
         </row-item>
         <row-item>
@@ -59,10 +65,14 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-input-number
-              style="width: 100%"
-              :min="1"
-              v-decorator="['preStatus', {rules: [{required: true, message: '变更前状态不能为空'}]}]"/>
+            <a-select v-decorator="['preStatus', {rules: [{required: true, message: '状态不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in statusMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
           </a-form-item>
         </row-item>
         <row-item>
@@ -71,10 +81,14 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-input-number
-              style="width: 100%"
-              :min="1"
-              v-decorator="['afterStatus', {rules: [{required: true, message: '变更后状态不能为空'}]}]"/>
+            <a-select v-decorator="['afterStatus', {rules: [{required: true, message: '状态不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in statusMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
           </a-form-item>
         </row-item>
       </row-list>
@@ -120,21 +134,43 @@ export default {
     // 下拉框map
   },
   methods: {
-    base (record) {
+    base (record, param) {
       this.visible = true
       // 如果是空标识添加
       if (this.BaseTool.Object.isBlank(record)) {
         this.modalTitle = '添加'
+        const { form: { setFieldsValue } } = this
+        if (param != null) {
+          this.$nextTick(() => {
+            setFieldsValue(Object.assign(pick(param, [
+              'sbId',
+              'sbNo',
+              'changeUserId',
+              'actualUser',
+              'preStatus',
+              'changeReason',
+              'afterStatus'
+            ])))
+          })
+        }
         return
       }
       this.modalTitle = '编辑'
       const { form: { setFieldsValue } } = this
+      if (record.changeTime != null) {
+        record.changeTime = this.BaseTool.Moment(record.changeTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'changeTime'
+          ])))
+        })
+      }
       // 日期处理
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'sbId',
-          'changeTime',
+          'sbNo',
           'changeReason',
           'changeUserId',
           'preStatus',
@@ -152,6 +188,8 @@ export default {
           return
         }
         // 日期处理
+        values.changeTime = this.BaseTool.Date.formatter(values.changeTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+
         if (this.BaseTool.String.isBlank(values.id)) {
           addSbStatusLog(values)
             .then(() => {

+ 263 - 0
src/views/sb/status-log/modules/SbStatusLogTable.vue

@@ -0,0 +1,263 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" v-show="[1].includes(type)">
+      <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
+        type="primary"
+        icon="plus"
+        @click="$refs.baseModal.base(null,tableParams)">新增</a-button>
+      <a-dropdown v-action:edit>
+        <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"
+      :data="loadData"
+      :alert="options.alert"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            @click="handleEdit(record)" >修改</operation-button>
+          <operation-button
+            :type="2"
+            title="确认删除?"
+            @confirm="batchDelete(record.id)" >删除</operation-button>
+        </template>
+      </span>
+      <span slot="status" slot-scope="text">
+        <badge
+          :status="DictCache.COLOR.SB_INFO_STATUS[text]"
+          :text="statusMap[text]" />
+      </span>
+    </s-table>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './BaseForm'
+import Detail from './Detail'
+import { getSbStatusLogPage, deleteSbStatusLogs, fetchSbStatusLog, exportSbStatusLog } from '@/api/sb/status-log'
+
+export default {
+  name: 'SbStatusLogTable',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  props: {
+    type: {
+      type: Number,
+      default: 1
+    },
+    tableParams: {
+      type: Object,
+      default: () => ({})
+    },
+    modelParams: {
+      type: Object,
+      default: () => ({})
+    }
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      moneyTypeMap: {},
+      // 表头
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '变更人',
+          dataIndex: 'actualUser'
+        },
+        {
+          title: '变更原因',
+          dataIndex: 'changeReason'
+        },
+        {
+          title: '变更前状态',
+          dataIndex: 'preStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '变更后状态',
+          dataIndex: 'afterStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '变更时间',
+          dataIndex: 'changeTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.tableParams,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSbStatusLogPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+      statusMap: {},
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  watch: {
+    tableParams: {
+      // deep: true, // 深度监听
+      handler (newVal, oldVal) {
+        if (newVal.repairId !== oldVal.repairId) {
+          this.handleOk()
+        }
+      }
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    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]
+      }
+      deleteSbStatusLogs(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      const modal = this.$refs.baseModal
+      modal.base(record)
+    },
+    handleView (record) {
+      const modal = this.$refs.detailModal
+      modal.base(record)
+    },
+    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,
+        ...this.tableParams
+      }
+      exportSbStatusLog(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    }
+  }
+}
+</script>

+ 19 - 31
src/views/sb/stop-logs/SbStopLog.vue

@@ -93,57 +93,49 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-        {
-          title: '设备名称',
-          dataIndex: 'sbName'
-        },
         {
           title: '设备编号',
           dataIndex: 'sbNo'
         },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
         {
           title: '设备型号',
           dataIndex: 'sbModel'
         },
+        {
+          title: '停用人',
+          dataIndex: 'actualUser'
+        },
         {
           title: '停用时间',
           dataIndex: 'stopTime'
         },
- /*       {
+        {
           title: '停用原因',
           dataIndex: 'stopReason'
         },
-        {
-          title: '停用人',
-          dataIndex: 'stopUserId'
-        },*/
         {
           title: '启用时间',
           dataIndex: 'startTime'
         },
-       /* {
+        {
           title: '启用原因',
           dataIndex: 'startReason'
         },
         {
           title: '启用人',
           dataIndex: 'startUserId'
-        },*/
+        },
         {
-          title: '停机时长分钟',
+          title: '停机时长',
           dataIndex: 'stopDuration',
           customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
+            return (text == null ? '无' : (text + '分钟'))
           }
         },
-        {
-          title: '备注',
-          dataIndex: 'remark'
-        },
-        {
-          title: '创建日期',
-          dataIndex: 'createdTime'
-        },
         {
           title: '操作',
           key: 'action',
@@ -159,9 +151,9 @@ export default {
           ...parameter,
           ...this.queryParam,
           dataScope: {
-          sortBy: 'desc',
+            sortBy: 'desc',
             sortName: 'created_time'
-        }
+          }
         }
         return getSbStopLogPage(parameter)
           .then(res => {
@@ -230,16 +222,12 @@ export default {
       })
     },
     handleEdit (record) {
-      fetchSbStopLog({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        modal.base(res.data)
-      })
+      const modal = this.$refs.baseModal
+      modal.base(record)
     },
     handleView (record) {
-      fetchSbStopLog({ id: record.id }).then(res => {
-        const modal = this.$refs.detailModal
-        modal.base(res.data)
-      })
+      const modal = this.$refs.detailModal
+      modal.base(record)
     },
     handleOk () {
       this.$refs.table.refresh()

+ 31 - 5
src/views/sb/stop-logs/modules/BaseForm.vue

@@ -12,6 +12,7 @@
         <row-item>
           <a-form-item>
             <a-input v-decorator="['id']" type="hidden"/>
+            <a-input v-decorator="['sbId']" type="hidden"/>
           </a-form-item>
         </row-item>
       </row-list>
@@ -23,7 +24,7 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input
-              v-decorator="['sbId', {rules: [{required: true, message: '设备id不能为空'}]}]"/>
+              v-decorator="['sbNo', {rules: [{required: true, message: '设备不能为空'}]}]"/>
           </a-form-item>
         </row-item>
         <row-item>
@@ -32,6 +33,10 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+              v-decorator="['stopTime']" />
           </a-form-item>
         </row-item>
         <row-item>
@@ -60,6 +65,10 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
+              v-decorator="['startTime']" />
           </a-form-item>
         </row-item>
         <row-item>
@@ -84,7 +93,7 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="停机时长分钟"
+            label="停机时长"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
@@ -94,7 +103,7 @@
               :step="0.01"
               :formatter="BaseTool.Amount.formatter"
               :parser="BaseTool.Amount.parser"
-              v-decorator="['stopDuration', {rules: [{required: true, message: '停机时长分钟不能为空'}]}]"/>
+              v-decorator="['stopDuration', {rules: [{required: true, message: '停机时长不能为空'}]}]"/>
           </a-form-item>
         </row-item>
       </row-list>
@@ -149,15 +158,30 @@ export default {
       }
       this.modalTitle = '编辑'
       const { form: { setFieldsValue } } = this
+      if (record.stopTime != null) {
+        record.stopTime = this.BaseTool.Moment(record.stopTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'stopTime'
+          ])))
+        })
+      }
+      if (record.startTime != null) {
+        record.startTime = this.BaseTool.Moment(record.startTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        this.$nextTick(() => {
+          setFieldsValue(Object.assign(pick(record, [
+            'startTime'
+          ])))
+        })
+      }
       // 日期处理
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'sbId',
-          'stopTime',
+          'sbNo',
           'stopReason',
           'stopUserId',
-          'startTime',
           'startReason',
           'startUserId',
           'stopDuration',
@@ -173,6 +197,8 @@ export default {
           this.confirmLoading = false
           return
         }
+        values.stopTime = this.BaseTool.Date.formatter(values.stopTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        values.startTime = this.BaseTool.Date.formatter(values.startTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addSbStopLog(values)

+ 275 - 0
src/views/sb/stop-logs/modules/SbStopLogTable.vue

@@ -0,0 +1,275 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" v-show="[1].includes(type)">
+      <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
+        type="primary"
+        icon="plus"
+        @click="$refs.baseModal.base(null,tableParams)">新增</a-button>
+      <a-dropdown v-action:edit>
+        <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"
+      :data="loadData"
+      :alert="options.alert"
+      :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            @click="handleEdit(record)" >修改</operation-button>
+          <operation-button
+            :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 './BaseForm'
+import Detail from './Detail'
+import { getSbStopLogPage, deleteSbStopLogs, fetchSbStopLog, exportSbStopLog } from '@/api/sb/stop-logs'
+
+export default {
+  name: 'SbStopLogTable',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  props: {
+    type: {
+      type: Number,
+      default: 1
+    },
+    tableParams: {
+      type: Object,
+      default: () => ({})
+    },
+    modelParams: {
+      type: Object,
+      default: () => ({})
+    }
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      moneyTypeMap: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 120,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '停用人',
+          width: 120,
+          dataIndex: 'stopUserId'
+        },
+        {
+          title: '停用原因',
+          width: 120,
+          dataIndex: 'stopReason'
+        },
+        {
+          title: '停用时间',
+          width: 200,
+          dataIndex: 'stopTime'
+        },
+        {
+          title: '启用时间',
+          width: 200,
+          dataIndex: 'startTime'
+        },
+        {
+          title: '启用原因',
+          width: 120,
+          dataIndex: 'startReason'
+        },
+        {
+          title: '启用人',
+          width: 120,
+          dataIndex: 'startUserId'
+        },
+        {
+          title: '停机时长',
+          width: 120,
+          dataIndex: 'stopDuration',
+          customRender: (text, record, index) => {
+            return (text == null ? '无' : (text + '分钟'))
+          }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.tableParams,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSbStopLogPage(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
+    }
+  },
+  watch: {
+    tableParams: {
+      // deep: true, // 深度监听
+      handler (newVal, oldVal) {
+        if (newVal.repairId !== oldVal.repairId) {
+          this.handleOk()
+        }
+      }
+    }
+  },
+  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]
+      }
+      deleteSbStopLogs(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      const modal = this.$refs.baseModal
+      modal.base(record)
+    },
+    handleView (record) {
+      const modal = this.$refs.detailModal
+      modal.base(record)
+    },
+    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,
+        ...this.tableParams
+      }
+      exportSbStopLog(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    }
+  }
+}
+</script>