whj 11 months ago
parent
commit
d64771bed9

+ 77 - 86
src/views/sb/storecheckjob/StoreCheckJob.vue

@@ -5,19 +5,13 @@
         <a-row :gutter="48">
           <a-col :md="8" :sm="24">
             <a-form-item label="计划名称">
-              <a-input v-model="queryParam.keyword" placeholder="请输入计划名称"/>
+              <a-input v-model="queryParam.keyword" placeholder="请输入计划名称" />
             </a-form-item>
           </a-col>
           <a-col :md="8" :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 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>
@@ -47,16 +41,7 @@
       </a-dropdown>
     </div>-->
 
-    <s-table
-      ref="table"
-      size="default"
-      rowKey="id"
-      :columns="columns"
-      :data="loadData"
-      :alert="options.alert"
-      :rowSelection="options.rowSelection"
-      showPagination="auto"
-    >
+    <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>
@@ -65,20 +50,18 @@
             <a @click="handleFinish(record)">完成</a>
 
           </template>
-          <template v-if="record.status != DictCache.VALUE.CHECK_JOB_STATUS.NOT_EXECUTE">
+          <template v-if="record.status != 3">
             <a-divider type="vertical" />
             <a @click="handleEdit(record)">盘点</a>
           </template>
         </template>
       </span>
       <span slot="status" slot-scope="text">
-        <badge
-          :status="DictCache.COLOR.JOB_STATUS[text]"
-          :text="statusMap[text]" />
+        <badge :status="DictCache.COLOR.JOB_STATUS[text]" :text="statusMap[text]" />
       </span>
     </s-table>
-    <base-form :check-type="checkType" ref="baseModal" @ok="handleOk"/>
-    <detail :check-type="checkType" ref="detailModal"/>
+    <base-form :check-type="checkType" ref="baseModal" @ok="handleOk" />
+    <detail :check-type="checkType" ref="detailModal" />
   </a-card>
 </template>
 
@@ -94,7 +77,7 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
-    Detail
+    Detail,
   },
   props: {
     /**
@@ -102,21 +85,20 @@ export default {
      */
     checkType: {
       type: Number,
-      default: 1
+      default: 1,
     },
     filter: {
       type: Number,
-      default: -1
-    }
+      default: -1,
+    },
   },
-  data () {
+  data() {
     this.names = ['负责', '巡检']
     return {
-
       // 查询参数
       queryParam: {
         type: this.checkType,
-        filter: this.filter
+        filter: this.filter,
       },
       // 表头
       columns: [
@@ -124,32 +106,34 @@ export default {
           title: '序号',
           dataIndex: 'index',
           customRender: (text, record, index) => {
-            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-          }
+            return `${
+              (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
+            }`
+          },
         },
         {
           title: '计划名称',
-          dataIndex: 'planName'
+          dataIndex: 'planName',
         },
         {
           title: '盘点区域',
-          dataIndex: 'storeName'
+          dataIndex: 'storeName',
         },
         {
           title: '设备编号',
-          dataIndex: 'sbNo'
+          dataIndex: 'sbNo',
         },
         {
           title: '设备名称',
-          dataIndex: 'spareName'
+          dataIndex: 'spareName',
         },
         {
           title: '待盘数量',
-          dataIndex: 'checkNum'
+          dataIndex: 'checkNum',
         },
         {
           title: '实际数量',
-          dataIndex: 'realNum'
+          dataIndex: 'realNum',
         },
         {
           title: '盘盈盘亏',
@@ -164,98 +148,106 @@ export default {
             if (text === 2) {
               return '盘盈'
             }
-          }
+          },
         },
         {
           title: '说明',
-          dataIndex: 'remark'
+          dataIndex: 'remark',
         },
         {
           title: '处理结果',
-          dataIndex: 'feedback'
+          dataIndex: 'feedback',
         },
         {
           title: '开始时间',
-          dataIndex: 'startTime'
+          dataIndex: 'startTime',
         },
         {
           title: '结束时间',
-          dataIndex: 'endTime'
+          dataIndex: 'endTime',
         },
         {
           title: '任务状态',
           dataIndex: 'status',
-          scopedSlots: { customRender: 'status' }
+          scopedSlots: { customRender: 'status' },
         },
         {
           title: '操作',
           key: 'action',
           width: '200px',
           align: 'center',
-          scopedSlots: { customRender: 'action' }
-        }
+          scopedSlots: { customRender: 'action' },
+        },
       ],
       // 下拉框map
       statusMap: {},
       sbStatusMap: {},
       // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
+      loadData: (parameter) => {
         parameter = {
           ...parameter,
           ...this.queryParam,
-          dataScope: {
-          }
+          dataScope: {},
         }
-        return getCheckJobPage(Object.assign(parameter, this.queryParam))
-          .then(res => {
-            return res.data
-          })
+        return getCheckJobPage(Object.assign(parameter, this.queryParam)).then((res) => {
+          return res.data
+        })
       },
       selectedRowKeys: [],
       selectedRows: [],
 
       options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        alert: {
+          show: true,
+          clear: () => {
+            this.selectedRowKeys = []
+          },
+        },
         rowSelection: {
           selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
+          onChange: this.onSelectChange,
+        },
       },
-      optionAlertShow: false
+      optionAlertShow: false,
     }
   },
-  created () {
+  created() {
     // 下拉框map
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.STORE_CHECK_JOB_STATUS)
     this.sbStatusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.tableOption()
   },
   methods: {
-    tableOption () {
+    tableOption() {
       if (!this.optionAlertShow) {
         this.options = {
-          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          alert: {
+            show: true,
+            clear: () => {
+              this.selectedRowKeys = []
+            },
+          },
           rowSelection: {
             selectedRowKeys: this.selectedRowKeys,
             onChange: this.onSelectChange,
-            getCheckboxProps: record => ({
+            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
@@ -263,53 +255,52 @@ export default {
           this.$message.info('请选择要删除的记录')
           return
         }
-        ids = this.selectedRows.map(item => item.id)
+        ids = this.selectedRows.map((item) => item.id)
       } else {
         ids = [id]
       }
-      deleteCheckJobs(ids).then(res => {
+      deleteCheckJobs(ids).then((res) => {
         this.$message.info('删除成功')
         this.handleOk()
         this.$refs.table.clearSelected()
       })
     },
-    handleEdit (record) {
+    handleEdit(record) {
       const modal = this.$refs.baseModal
       modal.base(record)
     },
-    handleFinish (record) {
+    handleFinish(record) {
       const modal = this.$refs.baseModal
       modal.base(record)
     },
-    handleExecute (record) {
-      executeJob({ id: record.id }).then(res => {
+    handleExecute(record) {
+      executeJob({ id: record.id }).then((res) => {
         this.handleOk()
       })
     },
-    handleView (record) {
+    handleView(record) {
       const modal = this.$refs.detailModal
       modal.base(record)
     },
-    handleOk () {
+    handleOk() {
       this.$refs.table.refresh()
     },
-    onSelectChange (selectedRowKeys, selectedRows) {
+    onSelectChange(selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
     },
-    resetSearchForm () {
-      this.queryParam = {
-      }
+    resetSearchForm() {
+      this.queryParam = {}
       this.$refs.table.refresh(true)
     },
-    doExport () {
+    doExport() {
       const parameter = {
-        ...this.queryParam
+        ...this.queryParam,
       }
-      exportCheckJob(parameter).then(file => {
+      exportCheckJob(parameter).then((file) => {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
       })
-    }
-  }
+    },
+  },
 }
 </script>

+ 79 - 88
src/views/store/storecheckjob/StoreCheckJob.vue

@@ -5,24 +5,18 @@
         <a-row :gutter="48">
           <a-col :md="8" :sm="24">
             <a-form-item label="计划名称">
-              <a-input v-model="queryParam.planName" placeholder="请输入计划名称"/>
+              <a-input v-model="queryParam.planName" placeholder="请输入计划名称" />
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
             <a-form-item label="负责人">
-              <a-input v-model.trim="queryParam.keyword" placeholder="请输入负责人"/>
+              <a-input v-model.trim="queryParam.keyword" placeholder="请输入负责人" />
             </a-form-item>
           </a-col>
           <a-col :md="8" :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 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>
@@ -52,16 +46,7 @@
       </a-dropdown>
     </div>-->
 
-    <s-table
-      ref="table"
-      size="default"
-      rowKey="id"
-      :columns="columns"
-      :data="loadData"
-      :alert="options.alert"
-      :rowSelection="options.rowSelection"
-      showPagination="auto"
-    >
+    <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>
@@ -70,20 +55,18 @@
             <a @click="handleFinish(record)">完成</a>
 
           </template>
-          <template v-if="record.status != DictCache.VALUE.CHECK_JOB_STATUS.NOT_EXECUTE">
+          <template v-if="record.status != 3">
             <a-divider type="vertical" />
             <a @click="handleEdit(record)">盘点</a>
           </template>
         </template>
       </span>
       <span slot="status" slot-scope="text">
-        <badge
-          :status="DictCache.COLOR.JOB_STATUS[text]"
-          :text="statusMap[text]" />
+        <badge :status="DictCache.COLOR.JOB_STATUS[text]" :text="statusMap[text]" />
       </span>
     </s-table>
-    <base-form :check-type="checkType" ref="baseModal" @ok="handleOk"/>
-    <detail :check-type="checkType" ref="detailModal"/>
+    <base-form :check-type="checkType" ref="baseModal" @ok="handleOk" />
+    <detail :check-type="checkType" ref="detailModal" />
   </a-card>
 </template>
 
@@ -99,7 +82,7 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
-    Detail
+    Detail,
   },
   props: {
     /**
@@ -107,21 +90,20 @@ export default {
      */
     checkType: {
       type: Number,
-      default: 1
+      default: 1,
     },
     filter: {
       type: Number,
-      default: -1
-    }
+      default: -1,
+    },
   },
-  data () {
+  data() {
     this.names = ['负责', '巡检']
     return {
-
       // 查询参数
       queryParam: {
         type: this.checkType,
-        filter: this.filter
+        filter: this.filter,
       },
       // 表头
       columns: [
@@ -129,28 +111,30 @@ export default {
           title: '序号',
           dataIndex: 'index',
           customRender: (text, record, index) => {
-            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-          }
+            return `${
+              (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
+            }`
+          },
         },
         {
           title: '计划名称',
-          dataIndex: 'planName'
+          dataIndex: 'planName',
         },
         {
           title: '仓库名称',
-          dataIndex: 'storeName'
+          dataIndex: 'storeName',
         },
         {
           title: '备件名称',
-          dataIndex: 'spareName'
+          dataIndex: 'spareName',
         },
         {
           title: '待盘数量',
-          dataIndex: 'checkNum'
+          dataIndex: 'checkNum',
         },
         {
           title: '实际数量',
-          dataIndex: 'realNum'
+          dataIndex: 'realNum',
         },
         {
           title: '盘盈盘亏',
@@ -165,98 +149,106 @@ export default {
             if (text === 2) {
               return '盘盈'
             }
-          }
+          },
         },
         {
           title: '说明',
-          dataIndex: 'remark'
+          dataIndex: 'remark',
         },
         {
           title: '处理结果',
-          dataIndex: 'feedback'
+          dataIndex: 'feedback',
         },
         {
           title: '开始时间',
-          dataIndex: 'startTime'
+          dataIndex: 'startTime',
         },
         {
           title: '结束时间',
-          dataIndex: 'endTime'
+          dataIndex: 'endTime',
         },
         {
           title: '任务状态',
           dataIndex: 'status',
-          scopedSlots: { customRender: 'status' }
+          scopedSlots: { customRender: 'status' },
         },
         {
           title: '操作',
           key: 'action',
           width: '200px',
           align: 'center',
-          scopedSlots: { customRender: 'action' }
-        }
+          scopedSlots: { customRender: 'action' },
+        },
       ],
       // 下拉框map
       statusMap: {},
       sbStatusMap: {},
       // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
+      loadData: (parameter) => {
         parameter = {
           ...parameter,
           ...this.queryParam,
-          dataScope: {
-          }
+          dataScope: {},
         }
-        return getCheckJobPage(Object.assign(parameter, this.queryParam))
-          .then(res => {
-            return res.data
-          })
+        return getCheckJobPage(Object.assign(parameter, this.queryParam)).then((res) => {
+          return res.data
+        })
       },
       selectedRowKeys: [],
       selectedRows: [],
 
       options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        alert: {
+          show: true,
+          clear: () => {
+            this.selectedRowKeys = []
+          },
+        },
         rowSelection: {
           selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
+          onChange: this.onSelectChange,
+        },
       },
-      optionAlertShow: false
+      optionAlertShow: false,
     }
   },
-  created () {
+  created() {
     // 下拉框map
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.STORE_CHECK_JOB_STATUS)
     this.sbStatusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
     this.tableOption()
   },
   methods: {
-    tableOption () {
+    tableOption() {
       if (!this.optionAlertShow) {
         this.options = {
-          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          alert: {
+            show: true,
+            clear: () => {
+              this.selectedRowKeys = []
+            },
+          },
           rowSelection: {
             selectedRowKeys: this.selectedRowKeys,
             onChange: this.onSelectChange,
-            getCheckboxProps: record => ({
+            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
@@ -264,57 +256,56 @@ export default {
           this.$message.info('请选择要删除的记录')
           return
         }
-        ids = this.selectedRows.map(item => item.id)
+        ids = this.selectedRows.map((item) => item.id)
       } else {
         ids = [id]
       }
-      deleteCheckJobs(ids).then(res => {
+      deleteCheckJobs(ids).then((res) => {
         this.$message.info('删除成功')
         this.handleOk()
         this.$refs.table.clearSelected()
       })
     },
-    handleEdit (record) {
+    handleEdit(record) {
       const modal = this.$refs.baseModal
       modal.base(record)
     },
-    handleFinish (record) {
-      fetchCheckJob({ id: record.id }).then(res => {
+    handleFinish(record) {
+      fetchCheckJob({ id: record.id }).then((res) => {
         const modal = this.$refs.baseModal
         modal.base(res.data)
       })
     },
-    handleExecute (record) {
-      executeJob({ id: record.id }).then(res => {
+    handleExecute(record) {
+      executeJob({ id: record.id }).then((res) => {
         this.handleOk()
       })
     },
-    handleView (record) {
-      fetchCheckJob({ id: record.id }).then(res => {
+    handleView(record) {
+      fetchCheckJob({ id: record.id }).then((res) => {
         const modal = this.$refs.detailModal
         modal.base(res.data)
       })
     },
-    handleOk () {
+    handleOk() {
       this.$refs.table.refresh()
     },
-    onSelectChange (selectedRowKeys, selectedRows) {
+    onSelectChange(selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
     },
-    resetSearchForm () {
-      this.queryParam = {
-      }
+    resetSearchForm() {
+      this.queryParam = {}
       this.$refs.table.refresh(true)
     },
-    doExport () {
+    doExport() {
       const parameter = {
-        ...this.queryParam
+        ...this.queryParam,
       }
-      exportCheckJob(parameter).then(file => {
+      exportCheckJob(parameter).then((file) => {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
       })
-    }
-  }
+    },
+  },
 }
 </script>