xiongchao 3 năm trước cách đây
mục cha
commit
1d62de48c8

+ 3 - 12
src/views/repair/fee/modules/RepairFeeTable.vue

@@ -20,12 +20,10 @@
 
     <div class="table-operator">
       <a-button
-        v-if="[2,3].includes(type) &&[DictCache.VALUE.REPAIR_FORM_STATUS.YES_DEAL,DictCache.VALUE.REPAIR_FORM_STATUS.RETURN].includes(modelParams.status)
-          && $auth('repair-fees-add')"
         type="primary"
         icon="plus"
         @click="$refs.baseModal.base(null,modelParams)">新增</a-button>
-      <a-dropdown v-action:edit v-if="[2,3].includes(type) && [DictCache.VALUE.REPAIR_FORM_STATUS.YES_DEAL,DictCache.VALUE.REPAIR_FORM_STATUS.RETURN].includes(modelParams.status) && selectedRowKeys.length > 0 && $auth('repair-fees-del')">
+      <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>
@@ -50,19 +48,12 @@
       <span slot="action" slot-scope="record">
         <template>
           <a @click="handleView(record)">查看</a>
-
           <operation-button
-            v-if="[2,3].includes(type) &&[DictCache.VALUE.REPAIR_FORM_STATUS.YES_DEAL,DictCache.VALUE.REPAIR_FORM_STATUS.RETURN].includes(modelParams.status)
-              && $auth('repair-fees-edit')"
             @click="handleEdit(record)" >修改</operation-button>
-
           <operation-button
-            v-if="[2,3].includes(type) &&[DictCache.VALUE.REPAIR_FORM_STATUS.YES_DEAL,DictCache.VALUE.REPAIR_FORM_STATUS.RETURN].includes(modelParams.status)
-              && $auth('repair-fees-del')"
             :type="2"
-            title="确认接收该维修任务?"
+            title="确认删除该费用?"
             @confirm="batchDelete(record.id)" >删除</operation-button>
-
         </template>
       </span>
     </s-table>
@@ -114,7 +105,7 @@ export default {
           }
         },
         {
-          title: '维修单id',
+          title: '维修单',
           dataIndex: 'repairId',
           customRender: (text, record, index) => {
             return record.repairNo

+ 0 - 7
src/views/repair/repair-reason/modules/DetailRepairReason.vue

@@ -75,9 +75,6 @@ export default {
       },
       modalTitle: null,
       visible: false,
-      typeMap: {},
-      statusMap: {},
-      actionTypeMap: {},
       // 表头
       columns: [
         {
@@ -124,10 +121,6 @@ export default {
   },
   created () {
     // 下拉框map
-    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_STANDARD_TYPE)
-    this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
-    this.actionTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_ACTION_TYPE)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_JOB_STATUS)
 
   },
   methods: {

+ 252 - 0
src/views/repair/repair-reason/modules/RepairReasonTable.vue

@@ -0,0 +1,252 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="8 || 24" :sm="24">
+            <span class="table-page-search-submitButtons">
+              <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <div class="table-operator">
+      <!--      <a-button v-if="$auth('check-jobs-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>-->
+      <a-button style="margin-left: 8px" v-if="($auth('check-spot-jobs-export') || $auth('check-polling-jobs-export'))" type="primary" icon="download" @click="doExport">导出</a-button>
+      <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && ($auth('check-spot-jobs-finish') || $auth('check-polling-jobs-finish'))">
+        <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>
+        </template>
+      </span>
+    </s-table>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './BaseForm'
+import Detail from './Detail'
+import { deleteRepairReasons, getRepairReasonPage, fetchRepairReason, exportRepairReason } from '@/api/repair/repair-reason'
+
+export default {
+  name: 'RepairReasonTable',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  props: {
+    /**
+     * 检查类型: 1-负责 2-巡检
+     */
+    checkType: {
+      type: Number,
+      default: 1
+    },
+    type: {
+      type: Number,
+      default: 1
+    },
+    status: {
+      type: Number,
+      default: null
+    },
+    tableParams: {
+      type: Object,
+      default: () => ({})
+    },
+    modelParams: {
+      type: Object,
+      default: () => ({})
+    }
+  },
+  watch: {
+    tableParams: {
+      // deep: true, // 深度监听
+      handler (newVal, oldVal) {
+        if (newVal.sbId !== oldVal.sbId) {
+          this.handleOk()
+        }
+      }
+    }
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: '70px',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '分析时间',
+          dataIndex: 'analyzeTime',
+          width: '200px'
+        },
+        {
+          title: '故障现象',
+          dataIndex: 'problemDesc',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '检查处理过程',
+          dataIndex: 'checkProcess',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '原因分析',
+          dataIndex: 'reasonAnalysis',
+          ellipsis: true,
+          width: '200px'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.tableParams,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getRepairReasonPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteRepairReasons(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleView (record) {
+      fetchRepairReason({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam,
+        ...this.tableParams
+      }
+      exportRepairReason(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    }
+  }
+}
+</script>

+ 14 - 41
src/views/sb/info/modules/Detail.vue

@@ -19,9 +19,6 @@
             <a-badge :count="numCheckjob" title="待保养项目总数" :number-style="{ backgroundColor: '#52c41a' }">
               <a-button style="margin-left: 8px" type="default" @click="handleViewCheckJob()">保养任务</a-button>
             </a-badge>
-            <a-badge :count="numRepairReason" title="历史故障分析总数" :number-style="{ backgroundColor: '#52c41a' }">
-              <a-button style="margin-left: 8px" type="default" @click="handleViewRepairReason()">历史故障分析</a-button>
-            </a-badge>
             <a-button v-show="model.useType==4" style="margin-left: 8px" type="default" @click="handleMeasure()">检定记录</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="handleCancel()">返回</a-button>
           </span>
@@ -141,6 +138,12 @@
         <q-tab-pane key="3" tab="保养任务">
           <check-job-table :type="2" :check-type="2" :table-params="{sbId: model.id}" ref="spotJobTable" />
         </q-tab-pane>
+        <q-tab-pane key="4" tab="历史故障分析">
+          <repair-reason-table :table-params="{sbId: model.id}" ref="repairReasonTable" />
+        </q-tab-pane>
+        <q-tab-pane key="5" tab="历史费用">
+          <repair-fee-table :table-params="{sbId: model.id}" ref="repairFeeTable" />
+        </q-tab-pane>
       </q-tabs>
     </div>
     <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
@@ -148,7 +151,6 @@
     <detail-sb-check-job ref="detailSbCheckJobModal" @ok="handleOk"/>
     <detail-sb-measure ref="detailSbMeasureModal" @ok="handleOk"/>
     <detail-sb-info ref="detailSbInfoModal" @ok="handleOk"/>
-    <detail-repair-reason ref="detailRepairReasonModal" @ok="handleOk"/>
     <part-info-list ref="partInfoList" />
     <!--    <check-job-table-wait-do :type="2" :check-type="2" ref="checkJobTableWaitDo" @ok="handleOk"/>-->
   </a-card>
@@ -175,7 +177,8 @@ import DetailSbCheck from '@/views/check/checkstandard/modules/DetailSbCheck'
 import DetailSbCheckJob from '@/views/check/checkjob/modules/DetailSbCheckJob'
 import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheck'
 import DetailSbInfo from '@/views/sb/info/modules/DetailSbInfo'
-import DetailRepairReason from '@/views/repair/repair-reason/modules/DetailRepairReason'
+import RepairReasonTable from '@/views/repair/repair-reason/modules/RepairReasonTable'
+import RepairFeeTable from '@/views/repair/fee/modules/RepairFeeTable'
 import PartInfoList from '@/views/part/info/modules/PartInfoList'
 const DetailListItem = DetailList.Item
 
@@ -196,7 +199,8 @@ export default {
     PartInfoList,
     DetailSbMeasure,
     DetailSbInfo,
-    DetailRepairReason
+    RepairReasonTable,
+    RepairFeeTable
   },
   data () {
     return {
@@ -327,15 +331,6 @@ export default {
   methods: {
     inited (viewer) {
       this.$viewer = viewer
-      // this.$viewer.index = 0
-      // // 不要他的按钮
-      // this.$viewer.options.button = false
-      // // 不要他的底部缩略图
-      // this.$viewer.options.navbar = false
-      // // 不要他的底部标题
-      // this.$viewer.options.title = false
-      // // 不要他的底部工具栏
-      // this.$viewer.options.toolbar = false
     },
     handleViewBom (record) {
       this.visible = false
@@ -357,11 +352,6 @@ export default {
       const modal = this.$refs.detailSbCheckJobModal
       modal.base(this.model)
     },
-    handleViewRepairReason (record) {
-      this.visible = false
-      const modal = this.$refs.detailRepairReasonModal
-      modal.base(this.model)
-    },
     handleMeasure (record) {
       this.visible = false
       const modal = this.$refs.detailSbMeasureModal
@@ -402,10 +392,6 @@ export default {
     },
     changeTab (activeKey) {
       this.activeKey = activeKey
-      if (this.activeKey === '1' && this.BaseTool.Object.isNotBlank(this.$refs.repairApplicationFormTable)) {
-        this.$refs.repairApplicationFormTable.handleOk()
-        return
-      }
       if (this.activeKey === '2' && this.BaseTool.Object.isNotBlank(this.$refs.sparePartUsedSelectTable)) {
         this.$refs.sparePartUsedSelectTable.handleOk()
         return
@@ -414,24 +400,11 @@ export default {
         this.$refs.spotJobTable.handleOk()
         return
       }
-      if (this.activeKey === '4' && this.BaseTool.Object.isNotBlank(this.$refs.pollingJobTable)) {
-        this.$refs.pollingJobTable.handleOk()
-        return
-      }
-      if (this.activeKey === '5' && this.BaseTool.Object.isNotBlank(this.$refs.spotCheckJobTable)) {
-        this.$refs.spotCheckJobTable.handleOk()
-        return
-      }
-      if (this.activeKey === '6' && this.BaseTool.Object.isNotBlank(this.$refs.spotCheckJobTable)) {
-        this.$refs.spotCheckJobTable.handleOk()
-        return
-      }
-      if (this.activeKey === '7' && this.BaseTool.Object.isNotBlank(this.$refs.sbOilPageTable)) {
-        this.$refs.sbOilPageTable.handleOk()
-        return
+      if (this.activeKey === '4' && this.BaseTool.Object.isNotBlank(this.$refs.repairReasonTable)) {
+        this.$refs.repairReasonTable.handleOk()
       }
-      if (this.activeKey === '8' && this.BaseTool.Object.isNotBlank(this.$refs.sbInspectionFillPageTable)) {
-        this.$refs.sbInspectionFillPageTable.handleOk()
+      if (this.activeKey === '5' && this.BaseTool.Object.isNotBlank(this.$refs.repairFeeTable)) {
+        this.$refs.repairFeeTable.handleOk()
       }
     },
     getQrcodeSrc: (dom) => {