瀏覽代碼

Merge remote-tracking branch 'origin/xq'

13660505945 1 月之前
父節點
當前提交
fd1ab012cb

+ 27 - 1
jshERP-web/src/mixins/newTableMixin.js

@@ -29,6 +29,7 @@ export const newTableMixin = {
     }
   },
   methods: {
+    //table功能
     onSelectChange(selectedRowKeys, selectionRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectionRows = selectionRows
@@ -49,6 +50,23 @@ export const newTableMixin = {
       }
       this.getList()
     },
+    //禁止点击表格某一行
+    getCheckboxProps(record) {
+      return {
+        props: {
+          disabled: record.taskStatus !== 1,
+        },
+      }
+    },
+    getTaskkboxProps(record) {
+      return {
+        props: {
+          disabled: record.taskStatus !== 1 || record.taskStatus !== 4,
+        },
+      }
+    },
+
+    // --------------------------------------------------------------------
     formateTaskStatus(type) {
       switch (type) {
         case 1:
@@ -63,10 +81,18 @@ export const newTableMixin = {
           return ''
       }
     },
+    onSearch() {
+      this.ipagination.current = 1
+      this.getList()
+    },
+    onReset() {
+      this.queryParam = {}
+      this.onSearch()
+      this.$forceUpdate()
+    },
     edit(id, col) {
       this.editableData[id] = cloneDeep(this.dataSource.filter((item) => id === item.id)[0])
       this.$forceUpdate()
-      console.log('111111111111111111111', col)
     },
     save(id) {
       Object.assign(this.dataSource.filter((item) => id === item.id)[0], this.editableData[id])

+ 43 - 13
jshERP-web/src/views/stock/CheckList.vue

@@ -4,13 +4,16 @@
       <a-card :bordered="false">
         <!-- 查询区域 -->
         <filter-form
-          @search="getList"
+          @search="onSearch"
+          @reset="onReset"
           :queryParam="queryParam"
           :spinnerList="spinnerList"
           :deoptData="deoptData"
         ></filter-form>
         <div style="margin-bottom: 6px">
-          <a-button type="primary" icon="plus" @click="addTask('add')">开始盘点</a-button>
+          <a-button :disabled="!selectedRowKeys.length" type="primary" icon="plus" @click="onStartTask"
+            >开始盘点</a-button
+          >
 
           <!-- <a-popconfirm style="margin: 0 6px" title="确定取消选中的盘点任务吗?" @confirm="() => cancelTask()">
             <a-button :disabled="!selectedRowKeys.length">取消盘点</a-button>
@@ -30,7 +33,11 @@
           :pagination="ipagination"
           :scroll="scroll"
           :loading="loading"
-          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+          :rowSelection="{
+            selectedRowKeys: selectedRowKeys,
+            onChange: onSelectChange,
+            getCheckboxProps: getCheckboxProps,
+          }"
           @change="handleTableChange"
         >
           <template slot="taskType" slot-scope="value">
@@ -42,10 +49,10 @@
           <span slot="action" slot-scope="text, record">
             <a @click="addTask('detail', record)">查看</a>
             <a-divider type="vertical" />
-            <a @click="addTask('edit', record)">编辑</a>
+            <a :disabled="record.taskStatus !== 1" @click="addTask('edit', record)">编辑</a>
             <a-divider type="vertical" />
             <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
-              <a>删除</a>
+              <a :disabled="record.taskStatus !== 1 || record.taskStatus !== 4">删除</a>
             </a-popconfirm>
           </span>
         </a-table>
@@ -117,6 +124,7 @@ export default {
         detailByItemList: '/stocktaking/detailByItemList',
         delete: '/stocktaking/taskDelete/',
         cancel: '/stocktaking/taskCancel/',
+        startTask: '/stocktaking/startTask/',
       },
       stockVisible: false,
       title: '',
@@ -187,18 +195,40 @@ export default {
     handleDelete(id) {
       const ids = id || this.selectedRowKeys
       const url = this.url.delete + ids
-      getAction(url).then((res) => {
-        this.$message.success('删除成功')
-        this.getList()
-      })
+      getAction(url)
+        .then((res) => {
+          this.$message.success('删除成功')
+          this.getList()
+        })
+        .catch((err) => {
+          this.$message.error('删除失败')
+        })
     },
     cancelTask() {
       const ids = this.selectedRowKeys
       const url = this.url.cancel + ids
-      getAction(url).then((res) => {
-        this.$message.success('取消成功')
-        this.getList()
-      })
+      getAction(url)
+        .then((res) => {
+          this.$message.success('取消成功')
+          this.getList()
+        })
+        .catch((err) => {
+          this.$message.error('取消失败')
+        })
+    },
+    //开始盘点
+    onStartTask() {
+      const ids = this.selectedRowKeys
+      const url = this.url.startTask + ids
+      getAction(url)
+        .then((res) => {
+          this.$message.success('盘点成功')
+          this.getList()
+          this.$refs.table.clearSelection()
+        })
+        .catch((err) => {
+          this.$message.error('盘点失败')
+        })
     },
   },
 }

+ 35 - 13
jshERP-web/src/views/stock/TaskList.vue

@@ -12,10 +12,19 @@
         <div style="margin-bottom: 6px">
           <a-button type="primary" icon="plus" @click="addTask('add')">新增盘点任务</a-button>
 
-          <a-popconfirm style="margin: 0 6px" title="确定取消选中的盘点任务吗?" @confirm="() => cancelTask()">
+          <a-popconfirm
+            :disabled="!selectedRowKeys.length"
+            style="margin: 0 6px"
+            title="确定取消选中的盘点任务吗?"
+            @confirm="() => cancelTask()"
+          >
             <a-button :disabled="!selectedRowKeys.length">取消盘点</a-button>
           </a-popconfirm>
-          <a-popconfirm title="确定删除选中的盘点任务吗?" @confirm="() => handleDelete()">
+          <a-popconfirm
+            :disabled="!selectedRowKeys.length"
+            title="确定删除选中的盘点任务吗?"
+            @confirm="() => handleDelete()"
+          >
             <a-button :disabled="!selectedRowKeys.length">批量删除</a-button>
           </a-popconfirm>
           <!-- <a-button style="margin-left: 6px">导出任务</a-button> -->
@@ -30,7 +39,11 @@
           :pagination="ipagination"
           :scroll="scroll"
           :loading="loading"
-          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+          :rowSelection="{
+            selectedRowKeys: selectedRowKeys,
+            onChange: onSelectChange,
+            getCheckboxProps: getTaskkboxProps,
+          }"
           @change="handleTableChange"
         >
           <template slot="taskType" slot-scope="value">
@@ -42,10 +55,10 @@
           <span slot="action" slot-scope="text, record">
             <a @click="addTask('detail', record)">查看</a>
             <a-divider type="vertical" />
-            <a @click="addTask('edit', record)">编辑</a>
+            <a :disabled="record.taskStatus !== 1" @click="addTask('edit', record)">编辑</a>
             <a-divider type="vertical" />
             <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
-              <a>删除</a>
+              <a :disabled="record.taskStatus !== 1 || record.taskStatus !== 4">删除</a>
             </a-popconfirm>
           </span>
         </a-table>
@@ -132,6 +145,7 @@ export default {
       }
     },
   },
+
   created() {
     this.getList()
     this.getSpinnerList(), this.getDepotList()
@@ -186,18 +200,26 @@ export default {
     handleDelete(id) {
       const ids = id || this.selectedRowKeys
       const url = this.url.delete + ids
-      getAction(url).then((res) => {
-        this.$message.success('删除成功')
-        this.getList()
-      })
+      getAction(url)
+        .then((res) => {
+          this.$message.success('删除成功')
+          this.getList()
+        })
+        .catch((err) => {
+          this.$message.error('删除失败')
+        })
     },
     cancelTask() {
       const ids = this.selectedRowKeys
       const url = this.url.cancel + ids
-      getAction(url).then((res) => {
-        this.$message.success('取消成功')
-        this.getList()
-      })
+      getAction(url)
+        .then((res) => {
+          this.$message.success('取消成功')
+          this.getList()
+        })
+        .catch((err) => {
+          this.$message.error('取消失败')
+        })
     },
   },
 }

+ 9 - 9
jshERP-web/src/views/stock/components/FilterForm.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="table-page-search-wrapper">
     <!-- 搜索区域 -->
-    <a-form layout="inline" @keyup.enter.native="searchQuery">
+    <a-form layout="inline" :form="queryParam" ref="form" @keyup.enter.native="searchQuery">
       <a-row :gutter="24">
         <a-col :md="6" :sm="24">
           <a-form-item label="盘点状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
@@ -16,13 +16,13 @@
         </a-col>
         <a-col :md="6" :sm="24">
           <a-form-item label="盘点仓库" :labelCol="labelCol" :wrapperCol="wrapperCol">
-            <a-select placeholder="请选择盘点仓库" showSearch :options="spinnerList" v-model="queryParam.depotId">
+            <a-select placeholder="请选择盘点仓库" showSearch :options="deoptData" v-model="queryParam.depotId">
             </a-select>
           </a-form-item>
         </a-col>
         <a-col :md="6" :sm="24">
           <a-form-item label="创建人" :labelCol="labelCol" :wrapperCol="wrapperCol">
-            <a-select placeholder="请选择创建人" showSearch :options="deoptData" v-model="queryParam.createBy">
+            <a-select placeholder="请选择创建人" showSearch :options="spinnerList" v-model="queryParam.createBy">
             </a-select>
           </a-form-item>
         </a-col>
@@ -42,8 +42,8 @@
         </a-col> -->
         <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
           <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="searchQuery">查询</a-button>
-            <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
+            <a-button type="primary" @click="onSearch">查询</a-button>
+            <a-button style="margin-left: 8px" @click="onReset">重置</a-button>
           </a-col>
         </span>
       </a-row>
@@ -86,11 +86,11 @@ export default {
     }
   },
   methods: {
-    searchQuery() {
-      this.$emit('search', 'search')
+    onSearch() {
+      this.$emit('search')
     },
-    searchReset() {
-      this.$emit('search', 'reset')
+    onReset() {
+      this.$emit('reset')
     },
   },
 }

+ 41 - 19
jshERP-web/src/views/stock/components/checkModal.vue

@@ -56,8 +56,8 @@
                 </a-col>
                 <span>
                   <a-col :md="6" :sm="24">
-                    <a-button type="primary" @click="getList">查询</a-button>
-                    <a-button style="margin-left: 8px" @click="getList">重置</a-button>
+                    <a-button type="primary" @click="onSearch">查询</a-button>
+                    <a-button style="margin-left: 8px" @click="onReset">重置</a-button>
                   </a-col>
                 </span>
               </a-row>
@@ -95,8 +95,8 @@
       </a-spin>
       <template slot="footer">
         <a-button @click="handleCancel">取消</a-button>
-        <a-button v-if="isShowBtn" @click="handleCancel">完成盘点</a-button>
-        <a-button v-if="isShowBtn" @click="handleOk" type="primary">确认更新盘点数据</a-button>
+        <a-button v-if="isShowBtn" @click="handleOk">完成盘点</a-button>
+        <a-button v-if="isShowBtn" @click="handleUpdate" type="primary">确定更新盘点数据</a-button>
       </template>
     </a-modal>
     <j-select-material-modal
@@ -139,6 +139,8 @@ import JSelectMaterialModal from '../../../components/jeecgbiz/modal/JSelectMate
 import { getAction, postAction } from '@/api/manage'
 import { getMaterialByBatchNumber } from '@/api/api'
 import { newTableMixin } from '@/mixins/newTableMixin'
+import { Modal } from 'ant-design-vue'
+
 // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 // import { Form } from 'ant-design-vue'
 // const useForm = Form.useForm
@@ -191,6 +193,9 @@ export default {
         add: '/stocktaking/add',
         update: '/stocktaking/detailUpdate',
         edit: '/stocktaking/itemUpdate',
+        updateStock: '/stocktaking/taskUpdateStock/',
+        taskCom: '	/stocktaking/taskComplete/',
+        detail: '/stocktaking/detail/',
       },
       form: {},
       isShow: false,
@@ -245,7 +250,7 @@ export default {
   },
   computed: {
     isShowBtn() {
-      return this.openType !== 'detail' || this.form.taskStatus !== 1
+      return this.openType !== 'detail' && this.form.taskStatus !== 1
     },
   },
   methods: {
@@ -275,27 +280,44 @@ export default {
     handleCancel() {
       this.$emit('update:stockVisible', false)
     },
-    handleOk() {
-      this.$refs.editForm.form.validateFields((err, values) => {
-        if (!err) {
-          const params = { ...values }
-          if (params.taskType === 2) {
-            params.materialExtendIdList = this.dataSource.map((item) => item.batchNumber)
-          }
-          const url = this.openType === 'add' ? this.url.add : this.url.update
-          postAction(url, params).then((res) => {
-            this.$message.success('操作成功')
-            this.handleCancel()
-          })
-        }
+    //更新盘点数据
+    handleUpdate() {
+      let that = this
+      const url = this.url.updateStock + this.taskId
+
+      Modal.confirm({
+        title: '是否确定更新盘点数据,确定后商品库存将按照当前的盘点数据进行更新',
+        onOk() {
+          getAction(url)
+            .then((res) => {
+              that.$message.success('操作成功')
+              that.handleCancel()
+            })
+            .catch((err) => {
+              this.$message.error('操作失败')
+            })
+        },
+        onCancel() {
+          console.log('Cancel')
+        },
       })
     },
+    handleOk() {
+      getAction(this.url.taskCom + this.taskId)
+        .then((res) => {
+          this.$message.success('操作成功')
+        })
+        .catch((err) => {
+          this.$message.error('操作失败')
+        })
+      this.handleCancel()
+    },
     onChangeGoods() {
       this.$refs.selectModal.queryParam.depotId = this.form.depotId
       this.$refs.selectModal.showModal()
     },
     getDetailList(id) {
-      const url = '/stocktaking/detail/' + id
+      const url = this.url.detail + id
       const form = this.$refs['editForm'].form
 
       getAction(url).then((res) => {

+ 0 - 7
jshERP-web/src/views/stock/components/editForm.vue

@@ -158,13 +158,6 @@ export default {
     }
   },
   watch: {
-    model: {
-      handler(val) {
-        console.log('=====================222', this.form.getFieldsValue())
-      },
-      deep: true,
-      immediate: true,
-    },
     total(val) {
       this.form.setFieldsValue({ materialCount: val })
     },

+ 1 - 1
jshERP-web/src/views/stock/components/stockModal.vue

@@ -143,7 +143,7 @@ export default {
   },
   computed: {
     isShowBtn() {
-      return this.openType !== 'detail' || this.form.taskStatus !== 1
+      return this.openType !== 'detail' && this.form.taskStatus !== 1
     },
   },
   methods: {

+ 1 - 1
jshERP-web/src/views/stock/utils/table.js

@@ -82,7 +82,7 @@ const table = {
     { dataIndex: 'position', title: '仓库货架' },
   ],
   checkGoodsColumns: [
-    { dataIndex: 'categoryName', title: '商品类别', scopedSlots: { customRender: 'categoryName' } },
+    { dataIndex: 'categoryName', title: '商品类别' },
     { dataIndex: 'name', title: '商品名称' },
     { dataIndex: 'systemSku', title: '系统SKU' },
     { dataIndex: 'batchNumber', title: '批次号' },