Browse Source

新加数量提示

Qukatie 2 weeks ago
parent
commit
522fe41268

+ 15 - 12
src/views/tirePartsMall/purchaseService/outStorage/components/viewArea.vue

@@ -1,17 +1,20 @@
 <template>
   <div>
     <el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
-      <dic-select
-        v-if="dialogVisible"
-        style="width: 300px;"
-        v-model="query.dot"
-        placeholder="批次号"
-        label="dot"
-        :disabled="disabled || query.historyList.length"
-        :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
-        :filterable="true"
-        @selectChange="dicChange('dot', $event)"
-      ></dic-select>
+      <div style="display: flex;align-items: center;">
+        <dic-select
+          v-if="dialogVisible"
+          style="width: 300px;"
+          v-model="query.dot"
+          placeholder="批次号"
+          label="dot"
+          :disabled="disabled || query.historyList.length"
+          :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
+          :filterable="true"
+          @selectChange="dicChange('dot', $event)"
+        ></dic-select>
+        <div style="color: #F56C6C;margin-left: 100px;">采购数量:{{ qtyMax }}</div>
+      </div>
       <avue-crud
         v-if="dialogVisible"
         :option="option"
@@ -70,7 +73,7 @@ export default {
         viewBtn: false,
         delBtn: false,
         editBtn: false,
-        columnBtn:false,
+        columnBtn: false,
         menu: false,
         header: false,
         column: [

+ 5 - 5
src/views/tirePartsMall/purchaseService/outStorage/detailsPage.vue

@@ -58,7 +58,7 @@
                 <el-button
                   v-if="reservoirArea == 1"
                   :size="size"
-                  :disabled="!row.id || disabled || isDisabled"
+                  :disabled="!row.id"
                   type="text"
                   @click="rowArea(row, index)"
                 >
@@ -850,10 +850,10 @@ export default {
               });
             }
             this.isAddDisabled = true;
-            if (res.data.data.statusName == "待出库") {
-              this.isAddDisabled = true;
-              this.isDisabled = true;
-            }
+            // if (res.data.data.statusName == "待出库") {
+            //   this.isAddDisabled = true;
+            //   this.isDisabled = true;
+            // }
             this.form = res.data.data;
             this.filesList = res.data.data.filesList;
             this.$nextTick(() => {

+ 22 - 20
src/views/tirePartsMall/salesManagement/outboundWorkOrder/components/viewArea.vue

@@ -1,17 +1,23 @@
 <template>
   <div>
     <el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
-      <dic-select
-        v-if="dialogVisible"
-        style="width: 300px;"
-        v-model="query.dot"
-        placeholder="批次号"
-        label="dot"
-        :disabled="disabled || query.historyList.length"
-        :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
-        :filterable="true"
-        @selectChange="dicChange('dot', $event)"
-      ></dic-select>
+      <div style="display: flex;align-items: center;">
+        <dic-select
+          v-if="dialogVisible"
+          style="width: 300px;"
+          v-model="query.dot"
+          placeholder="批次号"
+          label="dot"
+          :disabled="disabled || query.historyList.length"
+          :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
+          :filterable="true"
+          @selectChange="dicChange('dot', $event)"
+        ></dic-select>
+        <div style="color: #F56C6C;margin-left: 100px;">
+          出库数量:{{ qtyMax }}
+        </div>
+      </div>
+
       <avue-crud
         v-if="dialogVisible"
         :option="option"
@@ -76,8 +82,8 @@ export default {
           {
             label: "库区",
             prop: "reservoirAreaName",
-              filters:true,
-              sortable:true,
+            filters: true,
+            sortable: true,
             overHidden: true
           },
           {
@@ -153,8 +159,8 @@ export default {
       this.data = row.historyList;
       this.qtyMax = row.goodsNum;
       this.dialogVisible = true;
-      if(row.historyList.length==0){
-        this.onLoad()
+      if (row.historyList.length == 0) {
+        this.onLoad();
       }
     },
     submit() {
@@ -173,11 +179,7 @@ export default {
         sendNum: sum,
         historyList: this.data.filter(item => item.quantity > 0)
       };
-      this.$emit(
-        "areaData",
-       obj,
-        this.index,
-      );
+      this.$emit("areaData", obj, this.index);
 
       this.dialogVisible = false;
     },

+ 1 - 1
src/views/tirePartsMall/salesManagement/outboundWorkOrder/detailsPage.vue

@@ -102,7 +102,7 @@
                 <el-button
                   v-if="reservoirArea == 1"
                   :size="size"
-                  :disabled="!row.id || disabled || isDisabled"
+                  :disabled="!row.id"
                   type="text"
                   @click="rowArea(row, index)"
                 >

+ 258 - 0
src/views/tirePartsMall/salesService/inStorage/components/viewArea.vue

@@ -0,0 +1,258 @@
+<template>
+  <div>
+    <el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
+      <avue-crud
+        v-if="dialogVisible"
+        :option="option"
+        :table-loading="loading"
+        :data="data"
+        ref="crud"
+        id="out-table"
+        :header-cell-class-name="headerClassName"
+      >
+        <template slot-scope="{ scope, row }" slot="menuLeft">
+          <div style="display: flex;">
+            <el-button type="primary" size="small" @click="addRow">新增</el-button>
+            <dic-select
+              v-if="dialogVisible"
+              style="width: 300px;"
+              v-model="query.dot"
+              placeholder="批次号"
+              label="dot"
+              :disabled="disabled || query.historyList.length"
+              :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
+              :filterable="true"
+              :allowCreate="true"
+            ></dic-select>
+          </div>
+        </template>
+        <template slot="reservoirAreaName" slot-scope="{ row }">
+          <dic-select
+            v-model="row.reservoirAreaName"
+            placeholder="库区"
+            label="cname"
+            res="records"
+            :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + form.storageId"
+            :filterable="true"
+            :remote="true"
+            dataName="cname"
+            @selectChange="rowDicChange('reservoirAreaName', $event, row)"
+            :slotRight="true"
+            rightLabel="balanceQuantity"
+          ></dic-select>
+        </template>
+        <template slot="quantity" slot-scope="{ row }">
+          <el-input-number
+            v-model="row.quantity"
+            size="small"
+            :controls="false"
+            style="width: 100%"
+            :max="qtyMax"
+            :disabled="disabled"
+            @change="qtyChange(row)"
+          />
+        </template>
+        <template slot-scope="{ row, index }" slot="menu">
+          <el-button icon="el-icon-delete" :disabled="disabled" type="text" @click="rowDel(row, index)">删除 </el-button>
+        </template>
+      </avue-crud>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false" size="mini">取 消</el-button>
+        <el-button type="primary" @click="submit" size="mini">确 认</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import dicSelect from "@/components/dicSelect/main";
+import { itemRemove } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
+export default {
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  components: {
+    dicSelect
+  },
+  data() {
+    return {
+      data: [],
+      dialogVisible: false,
+      loading: false,
+      option: {
+        height: 500,
+        calcHeight: 30,
+        menuWidth: 80,
+        border: true,
+        index: true,
+        addBtn: false,
+        viewBtn: false,
+        delBtn: false,
+        editBtn: false,
+        refreshBtn: false,
+        columnBtn: false,
+        // menu: false,
+        // header: false,
+        column: [
+          {
+            label: "库区",
+            prop: "reservoirAreaName",
+            overHidden: true
+          },
+          {
+            label: "库存",
+            prop: "balanceQuantity",
+            overHidden: true
+          },
+          {
+            label: "本次数量",
+            prop: "quantity",
+            overHidden: true
+          }
+        ]
+      },
+      form: {},
+      query: {},
+      index: 0,
+      qtyMax: 0
+    };
+  },
+  async created() {},
+  methods: {
+    rowDel(row, index) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id) {
+          itemRemove({ ids: row.id }).then(res => {
+            this.data.splice(index, 1);
+            this.$message.success("操作成功!");
+          });
+        } else {
+          this.data.splice(index, 1);
+          this.$message.success("操作成功!");
+        }
+      });
+    },
+    addRow() {
+      this.data.push({
+        quantity: 0
+      });
+    },
+    rowDicChange(name, row, el) {
+      if (name == "reservoirAreaName") {
+        if (row) {
+          el.reservoirAreaId = row.id;
+          el.balanceQuantity = row.balanceQuantity;
+        } else {
+          el.reservoirAreaId = null;
+          el.reservoirAreaName = null;
+          el.balanceQuantity = null;
+        }
+      }
+    },
+    qtyChange(row) {
+      let sum = 0;
+      for (let item of this.data) {
+        sum += Number(item.quantity);
+      }
+      if (sum > this.qtyMax) {
+        return this.$message.error("总数量不能超过" + this.qtyMax);
+      }
+    },
+    openDialog(form, row, index) {
+      this.form = {};
+      this.query = {};
+      this.index = null;
+      this.data = [];
+      this.qtyMax = 0;
+      this.form = form;
+      this.query = row;
+      this.index = index;
+      this.data = row.historyList;
+      this.qtyMax = row.goodsNum;
+      this.dialogVisible = true;
+    },
+    submit() {
+      let sum = 0;
+      for (let item of this.data) {
+        if (!item.reservoirAreaId) {
+          return this.$message.error("请选择库区");
+        }
+        if (!item.quantity) {
+          return this.$message.error("本次数量不能为0");
+        }
+        sum += Number(item.quantity);
+      }
+      if (sum > this.qtyMax) {
+        return this.$message.error("总数量不能超过" + this.qtyMax);
+      }
+      let obj = {
+        ...this.query,
+        sendNum: sum,
+        historyList: this.data
+      };
+      this.$emit("areaData", obj, this.index);
+
+      this.dialogVisible = false;
+    },
+    //自定义列保存
+    async saveColumn(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+        this.searchReset();
+      }
+    },
+    //自定义列重置
+    async resetColumn(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+
+    // 更改表格颜色
+    headerClassName(tab) {
+      //颜色间隔
+      let back = "";
+      if (tab.columnIndex >= 0 && tab.column.level === 1) {
+        if (tab.columnIndex % 2 === 0) {
+          back = "back-one";
+        } else if (tab.columnIndex % 2 === 1) {
+          back = "back-two";
+        }
+      }
+      return back;
+    }
+  }
+};
+</script>
+
+<style scoped>
+::v-deep#out-table .back-one {
+  background: #ecf5ff !important;
+  text-align: center;
+  padding: 4px 0;
+}
+
+::v-deep#out-table .back-two {
+  background: #ecf5ff !important;
+  text-align: center;
+  padding: 4px 0;
+}
+</style>

+ 2 - 2
src/views/tirePartsMall/salesService/inStorage/detailsPage.vue

@@ -1101,8 +1101,8 @@ export default {
         if (valid) {
           if (this.reservoirArea == 1) {
             for (let item of this.form.shipItemsList) {
-              if (!item.reservoirAreaId) {
-                return this.$message.error("请选择入库明细的库区");
+              if (item.historyList.length == 0) {
+                return this.$message.error("请选择库区");
               }
             }
           }