瀏覽代碼

feat: 强制仓操作

Howie 1 年之前
父節點
當前提交
7cebf493cf

+ 16 - 1
src/api/common.js

@@ -104,7 +104,22 @@ export function getCategoryList(params) {
     params
   })
 }
-
+// 强制仓库展示
+export function getStockForceDetail(params) {
+  return request({
+    url: '/stock/force/detail',
+    method: 'post',
+    params
+  })
+}
+// 添加强制仓库
+export function updateStockForceDetail(data) {
+  return request({
+    url: '/stock/force/update',
+    method: 'post',
+    data
+  })
+}
 // 联查单据
 export function checkOrder(params) {
   return request({

+ 112 - 5
src/views/setting/other.vue

@@ -12,6 +12,8 @@
       <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-group>
 
     <div v-show="formType === 'first'">
@@ -341,6 +343,41 @@
       </div>
       <el-button type="primary" size="small" @click="submitForm('radius')">确 定</el-button>
     </div>
+    <div v-show="formType === 'forcedHold'">
+      <div style="margin: 40px 0 30px;">
+        <el-form ref="form" :model="forcedHoldForm" label-width="50px" label-position="left">
+          <el-row>
+            <el-col>
+              <el-form-item label="仓库">
+                <el-select
+                  v-model="forcedHoldForm.warehouse"
+                  style="width: 50%"
+                  placeholder="请选择仓库"
+                  size="mini"
+                  @change="()=> this.forcedHoldForm.category = []"
+                >
+                  <el-option
+                    v-for="item in warehouseList"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col>
+              <el-form-item label="品类">
+                <el-checkbox-group v-model="forcedHoldForm.category">
+                  <el-checkbox v-for="item in categoryList" :key="item.id" :label="item.id">{{ item.name }}
+                  </el-checkbox>
+                </el-checkbox-group>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <el-button type="primary" size="small" @click="submitForcedHold">确 定</el-button>
+    </div>
     <!-- //弹窗 -->
     <el-dialog :title="title" :visible.sync="dialogForm" width="30%" :show-close="false" :close-on-click-modal="false">
       <el-form ref="addForm" size="mini" :rules="rules" :model="addForm" label-width="120px">
@@ -360,7 +397,17 @@
 </template>
 
 <script>
-import { getDictList, editDictList, addDictList, deleDictList, updateReceipt, getStockCostDict, updateStockCostDict } from '@/api/common'
+import {
+  getDictList,
+  editDictList,
+  addDictList,
+  deleDictList,
+  updateReceipt,
+  getStockCostDict,
+  updateStockCostDict, getStockForceDetail, updateStockForceDetail
+} from '@/api/common'
+import { getKingDeeCategory } from '@/api/basic_data/material'
+import { getListStockV2 } from '@/api/basic_data/warehouse'
 
 export default {
   data() {
@@ -400,6 +447,10 @@ export default {
       radiusForm: {
         input1: {}
       },
+      forcedHoldForm: {
+        warehouse: '',
+        category: []
+      },
       stockCostDict: {},
       sixthForm: [],
       seventhForm: [],
@@ -419,7 +470,9 @@ export default {
           this.choiceDate = minDate.getTime()
           if (maxDate) this.choiceDate = ''
         }
-      }
+      },
+      categoryList: [],
+      warehouseList: []
     }
   },
   created() {
@@ -506,13 +559,40 @@ export default {
       // return index >= 0 ? true : false;
       return true
     },
-
+    // 获取品类数据
+    async getCategoryList() {
+      const res = await getKingDeeCategory()
+      this.categoryList = res.data
+    },
+    // 获取仓库列表
+    getListStockV2() {
+      getListStockV2({
+        pageNum: 1,
+        pageSize: -1
+      }).then(res => {
+        this.warehouseList = res.data.records
+      })
+    },
+    getStockForceDetail() {
+      getStockForceDetail().then(res => {
+        this.forcedHoldForm = {
+          warehouse: res.data.stockCorrespondId,
+          category: res.data.stockForceCategories.map(k => k.categoryId)
+        }
+      })
+    },
     changeType(val) {
       if (this.formType === 'receipt') return
       if (val === 'warehouse') {
         this.getStockCostDict()
         return
       }
+      if (val === 'forcedHold') {
+        this.getListStockV2()
+        this.getCategoryList()
+        this.getStockForceDetail()
+        return
+      }
       this.getDetail(val)
     },
     getStockCostDict() {
@@ -540,7 +620,7 @@ export default {
             return
           }
           this[type + 'Form'].input1 = data[0]
-          console.log(  this[type + 'Form'].input1, 999)
+          console.log(this[type + 'Form'].input1, 999)
           // this[type + "Form"].input2 = data[1];
         } else {
           this[type + 'Form'].input1 = data[0]
@@ -565,7 +645,6 @@ export default {
         if (type == 'eigth') {
           this.eigthForm = res.data
         }
-
       })
     },
     getDetail(type) {
@@ -617,6 +696,32 @@ export default {
         this.value1 = ''
       })
     },
+    submitForcedHold() {
+      if (!this.forcedHoldForm.warehouse) {
+        this.$errorMsg('请选择仓库')
+        return
+      }
+      if (!this.forcedHoldForm.category.length) {
+        this.$errorMsg('请选择品类')
+        return
+      }
+      const temp = this.warehouseList.find(k => k.id === this.forcedHoldForm.warehouse)
+      const stockForceCategories = this.forcedHoldForm.category.map(k => {
+        return {
+          categoryId: k,
+          correspondId: temp.id,
+          correspondName: temp.name
+        }
+      })
+      updateStockForceDetail({
+        stockCorrespondId: temp.id,
+        stockCorrespondName: temp.name,
+        stockForceCategories
+      }).then(_res => {
+        this.getStockForceDetail()
+        this.$successMsg('操作成功')
+      })
+    },
     submitStockForm() {
       if (!this.stockCostDict.dictValue) {
         this.$errorMsg('请输入总库存')
@@ -641,10 +746,12 @@ export default {
 .demo-table-expand {
   font-size: 0;
 }
+
 .demo-table-expand label {
   width: 80px;
   color: #99a9bf;
 }
+
 .demo-table-expand .el-form-item {
   margin-right: 0;
   margin-bottom: 0;

+ 8 - 4
src/views/supply/apply/apply_list.vue

@@ -259,7 +259,7 @@ export default {
                   this.handleSubmit(row.id, 'WAIT')
                 }}
               >
-                <el-button slot="reference" type="text">
+                <el-button slot="reference" type="text" size="mini">
                   申请
                 </el-button>
               </el-popconfirm>
@@ -276,7 +276,7 @@ export default {
                   this.handleSubmit(row.id, 'SAVE')
                 }}
               >
-                <el-button slot="reference" type="text">
+                <el-button slot="reference" type="text" size="mini">
                   撤回
                 </el-button>
               </el-popconfirm>
@@ -292,7 +292,7 @@ export default {
                   this.handleAbandon(row.id)
                 }}
               >
-                <el-button slot="reference" type="text">
+                <el-button slot="reference" type="text" size="mini">
                   弃审
                 </el-button>
               </el-popconfirm>
@@ -304,6 +304,7 @@ export default {
             row.type === 1 ? (
               <el-button
                 type="text"
+                size="mini"
                 onClick={() => {
                   this.toForm(row)
                 }}
@@ -327,6 +328,7 @@ export default {
                 row.type === 2)) ? (
               <el-button
                 type="text"
+                size="mini"
                 onClick={() => {
                   this.toReturnForm(row)
                 }}
@@ -341,6 +343,7 @@ export default {
               (!this.isCustomer && row.automaticStatus && row.examineStatus === 'WAIT' && row.type == 2)) ? (
               <el-button
                 type="text"
+                size="mini"
                 onClick={() => {
                   this.toExamine(row)
                 }}
@@ -360,13 +363,14 @@ export default {
                   this.handleDelete(row.id)
                 }}
               >
-                <el-button slot="reference" type="text" style="color: #f56c6c">
+                <el-button slot="reference" size="mini" type="text" style="color: #f56c6c">
                   删除
                 </el-button>
               </el-popconfirm>
             ) : null}
             <el-button
               type="text"
+              size="mini"
               onClick={() => {
                 this.toDetail(row)
               }}

+ 1 - 2
src/views/supply/apply/components/apply_form.vue

@@ -191,7 +191,7 @@
                 size="small"
                 filterable
                 clearable
-                :disabled="goodsList.length > 0"
+                :disabled=" isDealer ? goodsList.length > 0 : false"
                 style="width: 100%"
               >
                 <el-option
@@ -620,7 +620,6 @@ export default {
     // 确定 添加产品
     submitAddGoods() {
       let tableSelection = []
-
       this.tableGoodsList.forEach(item => {
         if ((item.invoiceNum || item.invoiceNum === 0) && !item.selected) {
           tableSelection.push(item)

+ 2 - 1
src/views/supply/apply/components/engin_form.vue

@@ -315,7 +315,8 @@
                 size="small"
                 filterable
                 clearable
-                :disabled="goodsList.length > 0 || tableSelection.length > 0"
+                :disabled=" isDealer ? goodsList.length > 0 || tableSelection.length > 0 : false"
+
                 style="width: 100%"
               >
                 <el-option