Sfoglia il codice sorgente

feat: 仓库仓位对应关系

Howie 1 anno fa
parent
commit
6969295063

+ 63 - 51
src/views/basic_data/warehouse/warehouse_site.vue

@@ -17,7 +17,9 @@
       :show-close="false"
       :close-on-click-modal="false"
     >
-      <el-form ref="diaLogForm" :model="diaLogForm" label-width="120px" size="small" label-position="left">
+      <el-form ref="diaLogForm" :model="diaLogForm" :rules="diaLogRules"
+               label-width="120px" size="small" label-position="left"
+      >
         <el-form-item label="仓库名称" prop="name">
           <el-input v-model="diaLogForm.name" />
         </el-form-item>
@@ -51,6 +53,16 @@
           </div>
           <div class="weight">注:设置后商家下单的仓库可以选择对应仓库的品类</div>
         </el-form-item>
+        <el-form-item label="强制仓品类" prop="qiangzhiCategoryIds">
+          <div>
+            <el-checkbox-group v-model="diaLogForm.qiangzhiCategoryIds">
+              <el-checkbox v-for="(item, index) in dataList" :key="index" :label="item.id">
+                {{ item.name }}
+              </el-checkbox>
+            </el-checkbox-group>
+          </div>
+        </el-form-item>
+
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="onClose">取 消</el-button>
@@ -76,6 +88,9 @@ import {
   exportListStockV2,
   getStockDetailStock
 } from '@/api/basic_data/warehouse'
+import { findElem } from '@/utils/util'
+import { addApply, editApply } from '@/api/supply/apply'
+
 export default {
   components: { TemplatePage, Popu },
   mixins: [import_mixin, add_callback_mixin],
@@ -164,7 +179,12 @@ export default {
         stockIds: [],
         updateBy: '',
         updateTime: '',
-        categoryIds: []
+        categoryIds: [],
+        qiangzhiCategoryIds: []
+      },
+      diaLogRules: {
+        name: [{ required: true, trigger: 'blur', message: '请输入' }],
+        stockIds: [{ required: true, trigger: 'change', message: '请选择' }]
       },
       showDialogForm: false,
       screenForm: {
@@ -199,11 +219,11 @@ export default {
     operation() {
       return (h, { row, index, column }) => {
         return (
-          <div class='operation-btns'>
+          <div class="operation-btns">
             {this.$checkBtnRole('edit', this.$route.meta.roles) ? (
               <el-button
-                size='mini'
-                type='text'
+                size="mini"
+                type="text"
                 onClick={() => {
                   this.getDataList()
                   this.editFn(row.id)
@@ -214,16 +234,16 @@ export default {
             ) : null}
             {this.$checkBtnRole('del', this.$route.meta.roles) ? (
               <el-popconfirm
-                confirm-button-text='好的'
-                cancel-button-text='不用了'
-                icon='el-icon-info'
-                icon-color='red'
-                title='内容确定删除吗?'
+                confirm-button-text="好的"
+                cancel-button-text="不用了"
+                icon="el-icon-info"
+                icon-color="red"
+                title="内容确定删除吗?"
                 onConfirm={() => {
                   this.hanleDelete(row.id)
                 }}
               >
-                <el-button size='mini' slot='reference' type='text' class='textColor el-popover-left'>
+                <el-button size="mini" slot="reference" type="text" class="textColor el-popover-left">
                   删除
                 </el-button>
               </el-popconfirm>
@@ -234,19 +254,8 @@ export default {
     },
 
     onClose() {
-      this.diaLogForm = {
-        id: null,
-        type: '1',
-        name: '',
-        remark: '',
-        status: 1,
-        stockCordon: 0,
-        stockIds: [],
-        updateBy: '',
-        updateTime: '',
-        categoryIds: []
 
-      }
+      this.$refs.diaLogForm.resetFields()
       this.addOff(() => {
         this.showDialogForm = false
       })()
@@ -285,7 +294,8 @@ export default {
           stockCordon: row.stockCordon,
           type: row.type + '',
           stockIds: row.stockIds === undefined ? arr : row.stockIds,
-          categoryIds: row.kingDeeCategories !== null ? row.kingDeeCategories.map(k => k.id) : []
+          categoryIds: row.kingDeeCategories !== null ? row.kingDeeCategories.map(k => k.id) : [],
+          qiangzhiCategoryIds: row.stockForceCategories?.map(k => k.categoryId) || []
         }
         this.showDialogForm = true
       })
@@ -300,33 +310,28 @@ export default {
       this.dataList = res.data
     },
     hanleInfo() {
-      if (this.type == 1) {
-        addStock(this.diaLogForm).then(res => {
-          this.$successMsg('保存成功')
-          this.showDialogForm = false
-          this.$refs.pageRef.refreshList()
-        })
-      } else {
-        const params = {
-          ...this.diaLogForm
+      this.$refs.diaLogForm.validate(valid => {
+        if (valid) {
+          if (this.type == 1) {
+            addStock(this.diaLogForm).then(res => {
+              this.$successMsg('保存成功')
+              this.showDialogForm = false
+              this.$refs.pageRef.refreshList()
+              this.onClose()
+            })
+          } else {
+            const params = {
+              ...this.diaLogForm
+            }
+            updateStock(params).then(res => {
+              this.$successMsg('编辑成功')
+              this.showDialogForm = false
+              this.$refs.pageRef.refreshList()
+              this.onClose()
+            })
+          }
         }
-        updateStock(params).then(res => {
-          this.$successMsg('编辑成功')
-          this.showDialogForm = false
-          this.$refs.pageRef.refreshList()
-        })
-      }
-      this.diaLogForm = {
-        name: '',
-        remark: '',
-        type: '1',
-        status: 0,
-        stockCordon: 0,
-        stockIds: [],
-        updateBy: '',
-        updateTime: '',
-        categoryIds: []
-      }
+      })
     },
     // 删除数据
     hanleDelete(id) {
@@ -343,25 +348,32 @@ export default {
 ::v-deep .el-date-editor {
   width: 100%;
 }
+
 ::v-deep .el-select {
   width: 100%;
 }
+
 ::v-deep .el-col-9 .el-button {
   padding: 5px;
 }
+
 ::v-deep .el-dialog__header {
   background-color: #dddddd;
 }
+
 .base {
   padding: 20px 20px 0;
 }
+
 .table {
   margin-top: 12px;
 }
+
 .right {
   float: right;
 }
-.weight{
+
+.weight {
   font-weight: 700;
 }
 </style>

+ 1 - 1
src/views/setting/other.vue

@@ -12,7 +12,7 @@
       <el-radio-button v-if="$checkBtnRole('receipt', $route.meta.roles)" label="receipt">发票</el-radio-button>
       <el-radio-button label="warehouse">仓租费配置</el-radio-button>
       <el-radio-button label="radius">商用登录地图半径</el-radio-button>
-      <el-radio-button label="forcedHold">强制仓</el-radio-button>
+<!--      <el-radio-button label="forcedHold">强制仓</el-radio-button>-->
 
     </el-radio-group>