guarantee-lsq 2 years ago
parent
commit
402bf5bfec

+ 21 - 0
src/api/sqarepartmanage/sparepartused.js

@@ -204,6 +204,27 @@ export function statisticsByGroupBySparePage (parameter) {
   })
 }
 
+export function updateSpareAlertPage (parameter) {
+  return axios({
+    url: '/sqarepartmanage/spare-part-used/update/alert/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+export function exportSpareUpdateAlert (parameter) {
+  return axios({
+    url: '/sqarepartmanage/spare-part-used/update/alert/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+
 export function updateSpare (parameter) {
   return axios({
     url: '/sqarepartmanage/spare-part-used/update/spare',

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

@@ -85,6 +85,7 @@ const constantRouterComponents = {
   'SparePartTotal': () => import('@/views/sqarepartmanage/sparepartinfo/SparePartTotal'),
   'SparePartTotalMinStock': () => import('@/views/sqarepartmanage/sparepartinfo/SparePartTotalMinStock'),
   'SparePartTotalCheckStock': () => import('@/views/sqarepartmanage/sparepartinfo/SparePartTotalCheckStock'),
+  'SpareUpdateAlert': () => import('@/views/sqarepartmanage/sparepartinfo/SpareUpdateAlert'),
 
   // 仓库汇总、仓库备件库存汇总(单个仓库的)
   'SpareStoreTotal': () => import('@/views/store/sparestore/SpareStoreTotal'),

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

@@ -17,20 +17,15 @@
             <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="部位名称">{{ model.partName }}</detail-list-item>-->
             <detail-list-item term="工单类别">{{ BaseTool.Object.getField(planFlagMap,model.category) }}</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>-->
             <detail-list-item term="报修时间">{{ model.applyTime }}</detail-list-item>
             <detail-list-item term="报修状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[model.status]"/></detail-list-item>
             <detail-list-item term="要求时间">{{ model.limitHours }}小时</detail-list-item>
             <detail-list-item term="要求日期">{{ model.limitDate }}</detail-list-item>
           </detail-list>
           <detail-list title="" :col="1">
-            <!--<detail-list-item term="故障描述">{{ BaseTool.Object.getField(this.descripitionMap, model.content) }}</detail-list-item>-->
             <detail-list-item term="故障描述">{{ model.content }}</detail-list-item>
           </detail-list>
           <title-divider title="报修图片" width="90px"></title-divider>
@@ -46,12 +41,10 @@
           </detail-list>
           <a-divider orientation="left">维修详情</a-divider>
           <detail-list title="" :col="3">
-            <!--            <detail-list-item term="故障类别">{{ model.repairErrorTypeName }}</detail-list-item>-->
             <detail-list-item term="维修开始时间">{{ model.repairStartTime }}</detail-list-item>
             <detail-list-item term="维修结束时间">{{ model.repairEndTime }}</detail-list-item>
             <detail-list-item term="维修耗时">{{ model.repairMinutes }}小时</detail-list-item>
             <detail-list-item term="维修人员">{{ model.repairUserName }}</detail-list-item>
-          <!--<detail-list-item term="维修次数">{{ model.repairTimes }}</detail-list-item>-->
           </detail-list>
           <detail-list title="" :col="1">
             <detail-list-item term="维修描述">{{ model.repairContent }}</detail-list-item>

+ 1 - 4
src/views/repair/application-form/modules/DetailRepair.vue

@@ -137,9 +137,6 @@
               <template>
                 <a @click="handleViewRecord(record)">维修详情</a>
                 <operation-button @click="handleEditRecord(record)" >编辑</operation-button>
-<!--                               <operation-button
-                                  title="确认该条维修记录?"
-                                  @confirm="deleteRecord(record.id)" >删除</operation-button>-->
               </template>
             </span>
           </a-table>
@@ -1111,7 +1108,7 @@ export default {
     handleSpareStoreSelected (record, keys, rows) {
       const data = []
       for (let i = 0; i < rows.length; i++) {
-        data.push({ isSpecial: record.isSpecial, sbId: this.model.sbId, spareId: rows[i].spareId, repairId: this.model.id, num: 1, price: rows[i].price, totalPrice: rows[i].price, startDate: BaseTool.Date.formatter(new Date(), BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
+        data.push({ isSpecial: record.isSpecial, sbId: this.model.sbId, spareId: rows[i].spareId, repairNo: this.model.no, repairId: this.model.id, num: 1, price: rows[i].price, totalPrice: rows[i].price, startDate: BaseTool.Date.formatter(new Date(), BaseTool.Date.PICKER_NORM_DATE_PATTERN) })
       }
       if (record.isSpecial === 1) {
         updateSpare(data)

+ 225 - 0
src/views/sqarepartmanage/sparepartinfo/SpareUpdateAlert.vue

@@ -0,0 +1,225 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="关键字">
+              <a-input v-model.trim="queryParam.keyword" 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="spareTypeTreeData"
+                :treeNodeFilterProp="'title'"
+                :showSearch="true"
+                v-model="queryParam.typeId"
+                placeholder="请选择"
+              >
+              </a-tree-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" style="margin-bottom: 8px;">
+      <a-button style="margin-left: 8px" v-if="$auth('store-spare-stores-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+    </div>
+
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="spareId"
+      :columns="columns"
+      :data="loadData"
+      :alert="options.alert"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+<!--      <span slot="action" slot-scope="record">
+        <template>
+          <a v-if="record.warnStatus == 1" @click="handleNumSelect(record, 1)">加入采购单</a>
+        </template>
+      </span>
+      <span slot="status" slot-scope="text">
+        <badge
+          :status="DictCache.COLOR.SPARE_WARN_STATUS[text]"
+          :text="warnStatusMap[text]" />
+      </span>-->
+    </s-table>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
+import { updateSpareAlertPage, exportSpareUpdateAlert } from '@/api/sqarepartmanage/sparepartused'
+
+export default {
+  name: 'SpareUpdateAlert',
+  components: {
+    STable,
+    Ellipsis
+  },
+  props: {
+  },
+  data () {
+    return {
+      spareTypeTreeData: [],
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          checked: true,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备',
+          checked: true,
+          dataIndex: 'sbName'
+        },
+        {
+          title: '预警备件',
+          checked: true,
+          dataIndex: 'spareName'
+        },
+        {
+          title: '上次更换时间',
+          checked: true,
+          dataIndex: 'startDate'
+        },
+        {
+          title: '下次更换时间',
+          checked: true,
+          dataIndex: 'changeDate'
+        },
+        {
+          title: '关联维修单',
+          checked: true,
+          dataIndex: 'repairNo'
+        },
+        {
+          title: '更换人',
+          checked: true,
+          dataIndex: '更换人'
+        },
+        {
+          title: '预警天数',
+          dataIndex: 'id',
+          width: 100,
+          fixed: 'right',
+          checked: true,
+          customRender: (text, record, index) => {
+            if (record.changeDate == null) {
+              return '未知'
+            } else {
+              return this.BaseTool.Date.getCountBetween(new Date(), record.changeDate, 1) + '天'
+            }
+          }
+        }
+      ],
+      // 下拉框map
+      delFlagMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+          }
+        }
+        return updateSpareAlertPage(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()
+    fetchSpareTypeTree({}).then(res => {
+      this.spareTypeTreeData = res.data
+    })
+  },
+  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
+      }
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+        filter: this.filter,
+        warnStatusList: this.warnStatusList,
+        forecastStatusList: this.forecastStatusList
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportSpareUpdateAlert(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>