whj 1 年之前
父节点
当前提交
960da1b565
共有 2 个文件被更改,包括 469 次插入258 次删除
  1. 277 179
      src/views/sb/info/SbInfo.vue
  2. 192 79
      src/views/sb/info/SbInfoC.vue

+ 277 - 179
src/views/sb/info/SbInfo.vue

@@ -1,64 +1,85 @@
 <template>
   <div>
+    <a-space v-show="visible" :size="50">
+      <div class="filter-icon" :class="current===0?'active':''" @click="handleFilter(0)">
+        <my-icon type="icon-shebeiguanli"></my-icon>
+        <div>全部</div>
+      </div>
+      <div class="filter-icon" :class="current===1?'active':''" @click="handleFilter(1)">
+        <my-icon type="icon-cangkuxinxi"></my-icon>
+        <div>在库</div>
+      </div>
+      <div class="filter-icon" :class="current===2?'active':''" @click="handleFilter(2)">
+        <my-icon type="icon-jijubaofeishenqing"></my-icon>
+        <div>
+          报废
+        </div>
+      </div>
+    </a-space>
     <a-card :bordered="false" v-show="visible">
-      <a-row :gutter="8">
-        <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.trim="queryParam.keyword" placeholder="设备编号" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="车间位置">
-                      <a-select v-model="queryParam.positionId" placeholder="请选择">
-                        <a-select-option v-for="({id,name}) in sbPositionData" :key="id" :label="name" :value="id">{{ name }}
-                        </a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="设备名称">
-                      <a-input v-model.trim="queryParam.name" placeholder="名称" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="父位号">
-                      <a-input v-model.trim="queryParam.ppNo" placeholder="父位号" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="设备位号">
-                      <a-input v-model.trim="queryParam.positionNo" placeholder="设备位号" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="生产商">
-                      <a-input v-model.trim="queryParam.producerId" placeholder="生产商" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="设备编号">
-                      <a-input v-model.trim="queryParam.financingNo" placeholder="设备编号" />
-                    </a-form-item>
-                  </a-col>
-                  <!--                  <a-col :md="6" :sm="24">
+      <a-drawer
+        title="设备筛选"
+        placement="top"
+        :closable="false"
+        :visible="showFilter"
+        :height="330"
+        @close="showFilter=false"
+      >
+        <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.trim="queryParam.keyword" placeholder="设备编号" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="车间位置">
+                  <a-select v-model="queryParam.positionId" placeholder="请选择">
+                    <a-select-option v-for="({id,name}) in sbPositionData" :key="id" :label="name" :value="id">{{ name }}
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备名称">
+                  <a-input v-model.trim="queryParam.name" placeholder="名称" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="父位号">
+                  <a-input v-model.trim="queryParam.ppNo" placeholder="父位号" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备位号">
+                  <a-input v-model.trim="queryParam.positionNo" placeholder="设备位号" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="生产商">
+                  <a-input v-model.trim="queryParam.producerId" placeholder="生产商" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备编号">
+                  <a-input v-model.trim="queryParam.financingNo" 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-select v-model="queryParam.level" placeholder="请选择">
-                        <a-select-option v-for="(label,value) in levelMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
-                        </a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <!--                  <a-col :md="6" :sm="24">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备等级">
+                  <a-select v-model="queryParam.level" placeholder="请选择">
+                    <a-select-option v-for="(label,value) in levelMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <!--                  <a-col :md="6" :sm="24">
                     <a-form-item label="自定义类型">
                       <a-select v-model="queryParam.useType" placeholder="请选择">
                         <a-select-option
@@ -70,57 +91,87 @@
                       </a-select>
                     </a-form-item>
                   </a-col>-->
+              <a-col :md="6" :sm="24">
+                <a-form-item label="检定日期范围">
+                  <a-range-picker v-model="dateRangeCheck" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="有效日期范围">
+                  <a-range-picker v-model="dateRange" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="规格型号">
+                  <a-input v-model="queryParam.model" 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'"
+                    v-model="dd"
+                    :showSearch="true"
+                    placeholder="请选择"
+                    @change="handleChange">
+                  </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" :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE" :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" :sm="24">
+                <a-form-item label="电力线路">
+                  <a-select v-model="queryParam.baoyangTimes" placeholder="请选择">
+                    <a-select-option v-for="(label,value) in lineMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
+                    </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="handleOk">查询</a-button>
+                  <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+      </a-drawer>
+      <a-row :gutter="8">
+        <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-range-picker v-model="dateRangeCheck" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="有效日期范围">
-                      <a-range-picker v-model="dateRange" />
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="规格型号">
-                      <a-input v-model="queryParam.model" 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'" v-model="dd" :showSearch="true" placeholder="请选择" @change="handleChange">
-                      </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" :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE" :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" :sm="24">
-                    <a-form-item label="电力线路">
-                      <a-select v-model="queryParam.baoyangTimes" placeholder="请选择">
-                        <a-select-option v-for="(label,value) in lineMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
-                        </a-select-option>
-                      </a-select>
+                    <a-form-item label="关键字">
+                      <a-input v-model.trim="queryParam.keyword" placeholder="设备编号" />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6 || 24" :sm="24">
-                    <span class="table-page-search-submitButtons">
+                    <a-space>
                       <a-button type="primary" @click="handleOk">查询</a-button>
-                      <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-                    </span>
+                      <a-button type="primary" @click="showFilter=true">筛选</a-button>
+                      <a-button @click="resetSearchForm">重置</a-button>
+                    </a-space>
                   </a-col>
                 </a-row>
               </a-form>
@@ -165,7 +216,18 @@
               </a-dropdown>
             </div>
 
-            <s-table ref="table" @expand="onExpand" 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">
+            <s-table
+              ref="table"
+              @expand="onExpand"
+              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">
               <template #positionNo="text,record">
                 <a @click="showChangeLog(record)">{{ text }}</a>
               </template>
@@ -266,7 +328,7 @@ import {
   fetchSbInfo,
   fetchSbInfos,
   exportSbInfo,
-  batchLocationList,
+  batchLocationList
 } from '@/api/sb/info'
 import { queryDept } from '@/api/upms/dept'
 import { generateSbCodeAll } from '@/api/upms/code'
@@ -298,41 +360,42 @@ export default {
     BaseFormLocation,
     BaseFormStatusLog,
     SbChangeLogSelectModal,
-    SbBomSyncSelectModal,
+    SbBomSyncSelectModal
   },
   props: {
     filter: {
       type: Number,
-      default: -1,
+      default: -1
     },
     useType: {
       type: Number,
-      default: null,
+      default: null
     },
     correctType: {
       type: Number,
-      default: 1,
+      default: 1
     },
     measureStatus: {
       type: Number,
-      default: null,
+      default: null
     },
     isMeasure: {
       type: Number,
-      default: null,
+      default: null
     },
     isSelf: {
       type: Number,
-      default: null,
+      default: null
     },
     status: {
       type: Number,
-      default: null,
-    },
+      default: null
+    }
   },
-  data() {
+  data () {
     return {
       // 查询参数
+      showFilter: false,
       queryParam: {
         filter: this.filter,
         useType: this.useType,
@@ -341,8 +404,9 @@ export default {
         isSelf: this.isSelf,
         id: this.$route.query.id,
         typeId: this.$route.query.typeId,
-        status: this.$route.query.status || this.status,
+        status: this.$route.query.status || this.status
       },
+      current: 0,
       depreciationTypeMap: {},
       visible: true,
       dateRange: [],
@@ -382,26 +446,26 @@ export default {
           title: '设备位置',
           checked: true,
           width: 200,
-          dataIndex: 'positionName',
+          dataIndex: 'positionName'
         },
         {
           title: '设备名称',
           checked: true,
           width: 200,
-          dataIndex: 'name',
+          dataIndex: 'name'
         },
         {
           title: '设备位号',
           dataIndex: 'positionNo',
           width: 150,
           scopedSlots: { customRender: 'positionNo' },
-          checked: true,
+          checked: true
         },
         {
           title: '父位号',
           dataIndex: 'ppNo',
           width: 120,
-          checked: true,
+          checked: true
         },
 
         {
@@ -411,7 +475,7 @@ export default {
           width: 150,
           customRender: (text, record, index) => {
             return record.typeName
-          },
+          }
         },
         /* {
           title: '设备等级',
@@ -426,19 +490,19 @@ export default {
           title: '规格型号',
           dataIndex: 'model',
           width: 150,
-          checked: true,
+          checked: true
         },
         {
           title: '设备编号',
           dataIndex: 'no',
           width: 150,
-          checked: true,
+          checked: true
         },
         {
           title: '巡检序号',
           dataIndex: 'sortNum',
           width: 120,
-          checked: true,
+          checked: true
         },
         /* {
           title: '自定义类型',
@@ -473,43 +537,43 @@ export default {
           title: '出厂编号',
           dataIndex: 'zzh',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '设备识别码',
           dataIndex: 'identifyNo',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '使用证号',
           dataIndex: 'useNo',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '设备代号',
           dataIndex: 'sbCode',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '安装单位',
           dataIndex: 'installUnit',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '检验结论',
           dataIndex: 'examResult',
           width: 120,
-          checked: true,
+          checked: true
         },
         {
           title: '单位内部使用地点',
           dataIndex: 'usePosition',
           width: 120,
-          checked: true,
+          checked: true
         },
         /* {
           title: '是否显示',
@@ -581,7 +645,7 @@ export default {
           dataIndex: 'nextCheckDate',
           fixed: 'right',
           width: 150,
-          checked: true,
+          checked: true
         },
         /*  {
           title: '检定截止',
@@ -602,7 +666,7 @@ export default {
           dataIndex: 'status',
           fixed: 'right',
           width: 100,
-          scopedSlots: { customRender: 'status' },
+          scopedSlots: { customRender: 'status' }
         },
         {
           title: '检定状态',
@@ -610,7 +674,7 @@ export default {
           dataIndex: 'measureStatus',
           fixed: 'right',
           width: 100,
-          scopedSlots: { customRender: 'measureStatus' },
+          scopedSlots: { customRender: 'measureStatus' }
         },
         {
           title: '操作',
@@ -619,8 +683,8 @@ export default {
           fixed: 'right',
           align: 'center',
           width: '120',
-          scopedSlots: { customRender: 'action' },
-        },
+          scopedSlots: { customRender: 'action' }
+        }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: (parameter) => {
@@ -630,8 +694,8 @@ export default {
           typeList: this.typeList,
           dataScope: {
             sortBy: 'asc',
-            sortName: 'no',
-          },
+            sortName: 'no'
+          }
         }
         this.selectedRowKeys = []
         return getSbInfoPage(Object.assign(parameter, this.queryParam)).then((res) => {
@@ -646,17 +710,17 @@ export default {
           show: true,
           clear: () => {
             this.selectedRowKeys = []
-          },
+          }
         },
         rowSelection: {
           selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange,
-        },
+          onChange: this.onSelectChange
+        }
       },
-      optionAlertShow: false,
+      optionAlertShow: false
     }
   },
-  created() {
+  created () {
     console.log('this.$route.query.parentId: ' + this.$route.query.parentId)
     this.queryParam.parentId = this.$route.query.parentId
     this.queryParam.parentName = this.$route.query.parentName
@@ -676,7 +740,7 @@ export default {
     })
   },
   methods: {
-    tableOption() {
+    tableOption () {
       this.setTree()
       if (!this.optionAlertShow) {
         this.options = {
@@ -684,7 +748,7 @@ export default {
             show: true,
             clear: () => {
               this.selectedRowKeys = []
-            },
+            }
           },
           rowSelection: {
             selectedRowKeys: this.selectedRowKeys,
@@ -692,21 +756,21 @@ export default {
             getCheckboxProps: (record) => ({
               props: {
                 disabled: false,
-                name: record.id,
-              },
-            }),
-          },
+                name: record.id
+              }
+            })
+          }
         }
         this.optionAlertShow = true
       } else {
         this.options = {
           alert: false,
-          rowSelection: null,
+          rowSelection: null
         }
         this.optionAlertShow = false
       }
     },
-    batchDelete(id) {
+    batchDelete (id) {
       let ids = []
       if (this.BaseTool.String.isBlank(id)) {
         const length = this.selectedRows.length
@@ -724,7 +788,7 @@ export default {
         this.$refs.table.clearSelected()
       })
     },
-    batchGenerate() {
+    batchGenerate () {
       this.confirmLoading = true
       this.$message.info('正在生成请稍后')
       generateSbCodeAll().then((res) => {
@@ -734,21 +798,21 @@ export default {
         this.$refs.table.clearSelected()
       })
     },
-    handleEdit(record) {
+    handleEdit (record) {
       fetchSbInfo({ id: record.id }).then((res) => {
         this.visible = false
         const modal = this.$refs.baseModal
         modal.base(res.data)
       })
     },
-    handlePrint(record) {
+    handlePrint (record) {
       this.visible = false
       fetchSbInfo({ id: record.id }).then((res) => {
         const modal = this.$refs.printInSbInfoBatch
         modal.base([res.data])
       })
     },
-    batchLocation() {
+    batchLocation () {
       let ids = []
       const length = this.selectedRows.length
       if (length === 0) {
@@ -763,7 +827,7 @@ export default {
         modal.base(res.data)
       })
     },
-    batchIncorrect(id) {
+    batchIncorrect (id) {
       let ids = []
       if (this.BaseTool.String.isBlank(id)) {
         const length = this.selectedRows.length
@@ -779,7 +843,7 @@ export default {
       const modal = this.$refs.baseModalMeasure
       modal.base(ids, this.correctType)
     },
-    batchIncorrectInStore(id) {
+    batchIncorrectInStore (id) {
       let ids = []
       if (this.BaseTool.String.isBlank(id)) {
         const length = this.selectedRows.length
@@ -795,11 +859,11 @@ export default {
       const modal = this.$refs.baseModalMeasureInStore
       modal.base(ids, this.correctType)
     },
-    handleMeasureBatch() {
+    handleMeasureBatch () {
       const modal = this.$refs.detailSbMeasureModal
       modal.base()
     },
-    handlePrintBatch() {
+    handlePrintBatch () {
       this.visible = false
       let ids = []
       const length = this.selectedRows.length
@@ -813,7 +877,7 @@ export default {
         modal.base(res.data)
       })
     },
-    handleStart(record) {
+    handleStart (record) {
       const modal = this.$refs.baseModalStatusLog
       modal.base(null, {
         sbId: record.id,
@@ -821,10 +885,10 @@ export default {
         changeUserId: this.$store.getters.userInfo.userId,
         actualUser: this.$store.getters.userInfo.realName,
         preStatus: record.status,
-        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
       })
     },
-    handleStop(record) {
+    handleStop (record) {
       const modal = this.$refs.baseModalStatusLog
       modal.base(null, {
         sbId: record.id,
@@ -832,33 +896,33 @@ export default {
         changeUserId: this.$store.getters.userInfo.userId,
         actualUser: this.$store.getters.userInfo.realName,
         preStatus: record.status,
-        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP,
+        afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
       })
     },
-    handleAdd() {
+    handleAdd () {
       this.visible = false
       this.$refs.baseModal.base()
     },
-    handleView(record) {
+    handleView (record) {
       fetchSbInfo({ id: record.id }).then((res) => {
         this.visible = false
         const modal = this.$refs.detailModal
         modal.base(res.data)
       })
     },
-    showChangeLog(record) {
+    showChangeLog (record) {
       console.log(record)
       console.log(this.$refs)
       this.$refs.sbChangeRecordSelectModal.base({}, { sbId: record.id })
     },
-    handleCopy(record) {
+    handleCopy (record) {
       this.visible = false
       fetchSbInfo({ id: record.id }).then((res) => {
         const modal = this.$refs.baseModal
         modal.base(res.data, 1)
       })
     },
-    handleOk() {
+    handleOk () {
       this.visible = true
       this.setTree()
       if (this.dateRange != null) {
@@ -883,11 +947,11 @@ export default {
       }
       this.$refs.table.refresh()
     },
-    onSelectChange(selectedRowKeys, selectedRows) {
+    onSelectChange (selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
     },
-    resetSearchForm() {
+    resetSearchForm () {
       this.queryParam = {
         filter: this.filter,
         useType: this.useType,
@@ -896,27 +960,28 @@ export default {
         isSelf: this.isSelf,
         id: this.$route.query.id,
         typeId: this.$route.query.typeId,
-        status: this.$route.query.status || this.status,
+        status: this.$route.query.status || this.status
       }
       this.typeList = []
       this.dd = undefined
       this.visible = true
+      this.handleFilter(this.current)
       this.$refs.table.refresh(true)
     },
-    doExport() {
+    doExport () {
       const parameter = {
         ...this.queryParam,
         sbIds: this.selectedRowKeys,
         dataScope: {
           sortBy: 'asc',
-          sortName: 'no',
-        },
+          sortName: 'no'
+        }
       }
       exportSbInfo(parameter).then((file) => {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
       })
     },
-    setTree(record = {}) {
+    setTree (record = {}) {
       queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then((res) => {
         this.areaList = res.data
       })
@@ -929,7 +994,7 @@ export default {
       this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
       this.$refs.table.refresh(true)
     },
-    onExpand(expanded, record) {
+    onExpand (expanded, record) {
       // expanded判断展开or收缩操作,record当前行数据
       console.log(expanded)
       if (expanded) {
@@ -938,17 +1003,17 @@ export default {
         })
       }
     },
-    doImport() {
+    doImport () {
       this.$refs.importModal.base(null, null)
     },
-    doImportStandard() {
+    doImportStandard () {
       // this.$refs.importModalStandard.base()
       this.$refs.importModalUpdate.base(null, 1)
     },
-    doImportForUpdate() {
+    doImportForUpdate () {
       this.$refs.importModalUpdate.base(null, 2)
     },
-    handleChange(value, label, extra) {
+    handleChange (value, label, extra) {
       const data = this.treeData.find((item) => item.id === value)
       if (data && data.children && data.children.length > 0) {
         this.typeList = data.children.map((item) => item.id)
@@ -956,9 +1021,42 @@ export default {
         this.typeList = [value]
       }
     },
-    handleSync(record) {
+    handleSync (record) {
       this.$refs.sbBomSyncSelectModal.base({ sbId: record.id })
     },
-  },
+    handleFilter (key) {
+      this.current = key
+      switch (key) {
+        case 0:
+          this.queryParam.status = null
+          break
+        case 1:
+          this.queryParam.status = 1
+          break
+        case 2:
+          this.queryParam.status = 4
+          break
+      }
+      this.$refs.table.refresh()
+    }
+  }
 }
 </script>
+<style lang="less" scoped>
+.filter-icon{
+  font-size: 18px;
+  text-align: center;
+  color: #666;
+  cursor: pointer;
+  margin-bottom: 10px;
+  &>:first-child{
+  font-size: 30px;
+}
+&:hover{
+  color: #1890ff;
+}
+}
+.active{
+  color:#1890ff;
+}
+</style>

+ 192 - 79
src/views/sb/info/SbInfoC.vue

@@ -1,36 +1,75 @@
 <template>
   <div>
+    <a-space v-show="visible" :size="50">
+      <div class="filter-icon" :class="current===0?'active':''" @click="handleFilter(0)">
+        <my-icon type="icon-shebeiguanli"></my-icon>
+        <div>全部</div>
+      </div>
+      <div class="filter-icon" :class="current===1?'active':''" @click="handleFilter(1)">
+        <my-icon type="icon-cangkuxinxi"></my-icon>
+        <div>在库</div>
+      </div>
+      <div class="filter-icon" :class="current===2?'active':''" @click="handleFilter(2)">
+        <my-icon type="icon-jijubaofeishenqing"></my-icon>
+        <div>
+          报废
+        </div>
+      </div>
+      <div class="filter-icon" :class="current===3?'active':''" @click="handleFilter(3)">
+        <a-icon type="carry-out" theme="filled" />
+        <div>
+          检定
+        </div>
+      </div>
+      <div class="filter-icon" :class="current===4?'active':''" @click="handleFilter(4)">
+        <a-icon type="security-scan" theme="filled" />
+        <div>
+          检测
+        </div>
+      </div>
+      <div class="filter-icon" :class="current===5?'active':''" @click="handleFilter(5)">
+        <a-icon type="exclamation-circle" theme="filled" />
+        <div>
+          预警
+        </div>
+      </div>
+    </a-space>
     <a-card :bordered="false" v-show="visible">
-      <a-row :gutter="8">
-        <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.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="positionTreeData"
-                        :treeNodeFilterProp="'title'"
-                        :showSearch="true"
-                        v-model="queryParam.positionId"
-                        placeholder="请选择">
-                      </a-tree-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="设备名称">
-                      <a-input v-model.trim="queryParam.name" placeholder="名称"/>
-                    </a-form-item>
-                  </a-col>
-                  <!-- <a-col :md="6" :sm="24">
+      <a-drawer
+        title="设备筛选"
+        placement="top"
+        :closable="false"
+        :visible="showFilter"
+        :height="330"
+        @close="showFilter=false"
+      >
+        <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.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="positionTreeData"
+                    :treeNodeFilterProp="'title'"
+                    :showSearch="true"
+                    v-model="queryParam.positionId"
+                    placeholder="请选择">
+                  </a-tree-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备名称">
+                  <a-input v-model.trim="queryParam.name" placeholder="名称"/>
+                </a-form-item>
+              </a-col>
+              <!-- <a-col :md="6" :sm="24">
                     <a-form-item label="父位号">
                       <a-input v-model.trim="queryParam.no" placeholder="父位号"/>
                     </a-form-item>
@@ -40,29 +79,29 @@
                       <a-input v-model.trim="queryParam.positionNo" placeholder="设备位号"/>
                     </a-form-item>
                   </a-col> -->
-                  <a-col :md="6" :sm="24" >
-                    <a-form-item label="生产商">
-                      <a-input v-model.trim="queryParam.producerId" placeholder="生产商"/>
-                    </a-form-item>
-                  </a-col>
-                  <!--                  <a-col :md="6" :sm="24">
+              <a-col :md="6" :sm="24" >
+                <a-form-item label="生产商">
+                  <a-input v-model.trim="queryParam.producerId" 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-select v-model="queryParam.level" placeholder="请选择">
-                        <a-select-option
-                          v-for="(label,value) in levelMap"
-                          :key="value"
-                          :label="label"
-                          :value="parseInt(value)">{{ label }}
-                        </a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <!--                  <a-col :md="6" :sm="24">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备等级">
+                  <a-select v-model="queryParam.level" placeholder="请选择">
+                    <a-select-option
+                      v-for="(label,value) in levelMap"
+                      :key="value"
+                      :label="label"
+                      :value="parseInt(value)">{{ label }}
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <!--                  <a-col :md="6" :sm="24">
                     <a-form-item label="自定义类型">
                       <a-select v-model="queryParam.useType" placeholder="请选择">
                         <a-select-option
@@ -74,30 +113,30 @@
                       </a-select>
                     </a-form-item>
                   </a-col>-->
-                  <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
+              <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
                     <a-form-item label="检定日期范围">
                       <a-range-picker v-model="dateRangeCheck" />
                     </a-form-item>
                   </a-col> -->
-                  <a-col :md="6" :sm="24">
-                    <a-form-item label="有效日期范围">
-                      <a-range-picker v-model="dateRange" />
-                    </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"
-                          :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE"
-                          :label="label"
-                          :value="parseInt(value)">{{ label }}
-                        </a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="有效日期范围">
+                  <a-range-picker v-model="dateRange" />
+                </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"
+                      :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE"
+                      :label="label"
+                      :value="parseInt(value)">{{ label }}
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
                     <a-form-item label="规格型号">
                       <a-input v-model="queryParam.model" placeholder="规格型号"/>
                     </a-form-item>
@@ -150,14 +189,36 @@
                       </a-select>
                     </a-form-item>
                   </a-col> -->
-                  <a-col :span="6" >
-                    <span class="table-page-search-submitButtons">
-                      <a-button type="primary" @click="handleOk">查询</a-button>
-                      <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-                      <!-- <a :style="{ marginLeft: '8px', fontSize: '12px' }" @click="expand=!expand">
+              <a-col :span="6" >
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" @click="handleOk">查询</a-button>
+                  <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+                  <!-- <a :style="{ marginLeft: '8px', fontSize: '12px' }" @click="expand=!expand">
                       {{ !expand ? '展开' : '折叠' }} <a-icon :type="expand ? 'up' : 'down'" />
                     </a> -->
-                    </span>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+      </a-drawer>
+      <a-row :gutter="8">
+        <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.trim="queryParam.keyword" placeholder="关键字" />
+                    </a-form-item>
+                  </a-col>
+                  <a-col :span="6" >
+                    <a-space>
+                      <a-button type="primary" @click="handleOk">查询</a-button>
+                      <a-button type="primary" @click="showFilter=true">筛选</a-button>
+                      <a-button @click="resetSearchForm">重置</a-button>
+                    </a-space>
                   </a-col>
                 </a-row>
               </a-form>
@@ -188,7 +249,7 @@
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
               <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(13)">批量退库</a-button>
               <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(4)">批量报废</a-button>
-              <a-button style="margin-left: 8px" v-if="isMeasure===1" type="primary" icon="reload" @click="batchIncorrect()">批量检定</a-button>
+              <a-button style="margin-left: 8px" v-if="queryParam.isMeasure===1" type="primary" icon="reload" @click="batchIncorrect()">批量检定</a-button>
               <a-button style="margin-left: 8px" v-if="$auth('sb-infos-generate-code-all')" :loading="confirmLoading" type="primary" @click="batchGenerate()">重新生成二维码</a-button>
               <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
                 <a-menu slot="overlay">
@@ -198,7 +259,7 @@
                   <!-- <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrect()">
                     <a-menu-item key="2"><my-icon type="icon-pandian" /><a>检定</a></a-menu-item>
                   </a-popconfirm> -->
-                  <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrectInStore()">
+                  <a-popconfirm v-if="queryParam.isMeasure===1" @visibleChange="batchIncorrectInStore()">
                     <a-menu-item key="3"><my-icon type="icon-pandian" /><a>入库</a></a-menu-item>
                   </a-popconfirm>
                   <a-popconfirm :visible="false" @visibleChange="batchLocation()">
@@ -251,10 +312,10 @@
                         <a-menu-item key="1">
                           <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
                         </a-menu-item>
-                        <a-menu-item key="2" v-if="isMeasure===1">
+                        <a-menu-item key="2" v-if="record.isMeasure===1">
                           <a @click="batchIncorrect(record)">检定</a>
                         </a-menu-item>
-                        <a-menu-item key="3" v-if="isMeasure===1">
+                        <a-menu-item key="3" v-if="record.isMeasure===1">
                           <a @click="batchIncorrectInStore(record)">入库</a>
                         </a-menu-item>
                         <a-menu-item v-if="record.status != 2" key="2">
@@ -432,6 +493,8 @@ export default {
   data () {
     return {
       // 查询参数
+      current: 0,
+      showFilter: false,
       queryParam: {
         filter: this.filter,
         useType: this.useType,
@@ -1084,6 +1147,7 @@ export default {
         status: this.$route.query.status || this.status
       }
       this.visible = true
+      this.handleFilter(this.current)
       this.$refs.table.refresh(true)
     },
     doExport () {
@@ -1166,6 +1230,39 @@ export default {
         case 7:
           return 'gray'
       }
+    },
+    handleFilter (key) {
+      this.current = key
+      this.queryParam.status = null
+      this.queryParam.isMeasure = null
+      this.queryParam.isSelf = null
+      this.queryParam.measureStatus = null
+      switch (key) {
+        case 0:
+          break
+        case 1:
+          this.queryParam.status = 1
+          break
+        case 2:
+          this.queryParam.status = 4
+          break
+        case 3:
+          this.queryParam.status = null
+          this.queryParam.isMeasure = 1
+          this.queryParam.isSelf = 0
+          break
+        case 4:
+          this.queryParam.status = null
+          this.queryParam.isMeasure = 1
+          this.queryParam.isSelf = 1
+          break
+        case 5:
+          this.queryParam.status = null
+          this.queryParam.isMeasure = 1
+          this.queryParam.measureStatus = 1
+          break
+      }
+      this.$refs.table.refresh()
     }
   }
 }
@@ -1183,4 +1280,20 @@ export default {
 /deep/ .orange {
   background: rgb(245, 132, 91);
 }
+.filter-icon{
+  font-size: 18px;
+  text-align: center;
+  color: #666;
+  cursor: pointer;
+  margin-bottom: 10px;
+  &>:first-child{
+  font-size: 30px;
+}
+&:hover{
+  color: #1890ff;
+}
+}
+.active{
+  color:#1890ff;
+}
 </style>