Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

liyuan 11 часов назад
Родитель
Сommit
900dfea12a

+ 2 - 2
src/api/tirePartsMall/salesManagement/saleOrder.js

@@ -364,7 +364,7 @@ export const getExpenditurePrice = (data) => {
         params: data
     })
 }
-// 撤销调拨
+// 清空库区
 export const itemRemove = (data) => {
   return request({
     url: '/api/blade-sales-part/history/remove',
@@ -388,4 +388,4 @@ export const voidedDocument = (data) => {
     method: 'get',
     params: data
   })
-}
+}

+ 48 - 42
src/util/date.js

@@ -56,6 +56,7 @@ export function dateFormat(date, format) {
  * type 1为 [yyyy-MM-dd,yyyy-MM-dd]
  * type 2为 [yyyy-MM-dd 00:00:00,yyyy-MM-dd 23:59:59]
  * type 4为 [yyyy-MM-dd,yyyy-MM-dd] 当月的第一天和最后一天
+ * type 5为 [yyyy-MM-dd,yyyy-MM-dd] 前三个月的第一天和后三个月最后一天
  * type为空默认2
  */
 export function defaultDate(type) {
@@ -78,6 +79,11 @@ export function defaultDate(type) {
       dateFormat(new Date(date.getFullYear(), date.getMonth(), 1), "yyyy-MM-dd"),
       dateFormat(new Date(date.getFullYear(), date.getMonth() + 1, 0), "yyyy-MM-dd")
     ];
+  } else if (type == 5) {
+    return [
+      dateFormat(new Date(date.getFullYear(), date.getMonth() - 3, 1), "yyyy-MM-dd") + " 00:00:00",
+      dateFormat(new Date(date.getFullYear(), date.getMonth() + 4, 0), "yyyy-MM-dd") + " 23:59:59"
+    ];
   } else {
     return [
       dateFormat(startDate, "yyyy-MM-dd") + " 00:00:00",
@@ -282,53 +288,53 @@ export function checkFullWidthSymbols_bak(text) {
 }
 // wfg
 export function checkFullWidthSymbols(text) {
-    if (text) {
-        const fullWidthRegex = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u3400-\u4dbf]/g;
-        const matchesItem = [];
-        // TAB 键转为空格
-        let lines = text.trimEnd().replaceAll("\t", " ").split('\n')
-        let match;
-        lines.forEach((ln, index, array) => {
-            ln=ln.trimEnd();
-            lines[index]=ln
-            while ((match = fullWidthRegex.exec(ln)) !== null) {
-                matchesItem.push({
-                    row: index + 1,         // 行号
-                    index: match.index,     // 符号的位置
-                    symbol: match[0],       // 符号本身
-                    input: match.input      // 行
-                });
-            }
-        })
-        let resetText = lines.join("\n")
-        let isResetText = resetText != text
-        let message=[]
-        matchesItem.forEach(m=>{
-            message.push(`第 ${m.row} 行第 ${m.index} 个字符 ${m.symbol} 不符合要求,存在全角字符或汉字等!`)
-        })
-        return {
-            hasFullWidth: matchesItem.length > 0, // 是否包含全角符号
-            positions: matchesItem,               // 符号的详细位置和内容
-            message: message.join("<br>"),
-            isResetText: isResetText,  // 是否重设文本
-            resetText: resetText,      // 重设的文本
-        };
-    } else {
-        return {
-            hasFullWidth: false, // 是否包含全角符号
-            positions: [],                // 符号的详细位置和内容
-            message: "",
-            isResetText:false,  // 是否重设文本
-            resetText: "",      // 重设的文本
-        };
-    }
+  if (text) {
+    const fullWidthRegex = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u3400-\u4dbf]/g;
+    const matchesItem = [];
+    // TAB 键转为空格
+    let lines = text.trimEnd().replaceAll("\t", " ").split('\n')
+    let match;
+    lines.forEach((ln, index, array) => {
+      ln = ln.trimEnd();
+      lines[index] = ln
+      while ((match = fullWidthRegex.exec(ln)) !== null) {
+        matchesItem.push({
+          row: index + 1,         // 行号
+          index: match.index,     // 符号的位置
+          symbol: match[0],       // 符号本身
+          input: match.input      // 行
+        });
+      }
+    })
+    let resetText = lines.join("\n")
+    let isResetText = resetText != text
+    let message = []
+    matchesItem.forEach(m => {
+      message.push(`第 ${m.row} 行第 ${m.index} 个字符 ${m.symbol} 不符合要求,存在全角字符或汉字等!`)
+    })
+    return {
+      hasFullWidth: matchesItem.length > 0, // 是否包含全角符号
+      positions: matchesItem,               // 符号的详细位置和内容
+      message: message.join("<br>"),
+      isResetText: isResetText,  // 是否重设文本
+      resetText: resetText,      // 重设的文本
+    };
+  } else {
+    return {
+      hasFullWidth: false, // 是否包含全角符号
+      positions: [],                // 符号的详细位置和内容
+      message: "",
+      isResetText: false,  // 是否重设文本
+      resetText: "",      // 重设的文本
+    };
+  }
 }
 //判断是否超过设置天数
 export function overdueJudgment(date) {
   const overDay = localStorage.getItem('lockTermDays')
   if (overDay) {
-    const nowDate = new Date(dateFormat(new Date(),'yyyy-MM-dd'))
-    const startDate = new Date(dateFormat(new Date(date),'yyyy-MM-dd'))
+    const nowDate = new Date(dateFormat(new Date(), 'yyyy-MM-dd'))
+    const startDate = new Date(dateFormat(new Date(date), 'yyyy-MM-dd'))
     startDate.setDate(startDate.getDate() + Number(overDay))
     if (startDate < nowDate) {
       return true

+ 5 - 1
src/views/exportTrade/EcommerceStocking/index.vue

@@ -157,7 +157,8 @@ export default {
         headerAlign: "center",
         menuWidth: "150",
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         searchLabelWidth: 90,
         showSummary: true,
         selection: true,
@@ -897,4 +898,7 @@ export default {
   margin-left: 50px;
   width: 100%;
 }
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 7 - 3
src/views/exportTrade/customerInquiry/index.vue

@@ -139,7 +139,7 @@ export default {
       activeName: "second",
       tabType: 2,
       search: {
-        businesDate: defaultDate()
+        businesDate: defaultDate(5)
       },
       form: {},
       option: {},
@@ -156,7 +156,8 @@ export default {
         menuWidth: "70",
         showSummary: true,
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         selection: true,
         tip: false,
         expand: true,
@@ -756,7 +757,7 @@ export default {
   },
   watch: {
     option: function() {
-      this.search.businesDate = defaultDate();
+      this.search.businesDate = defaultDate(5);
     }
   }
 };
@@ -775,4 +776,7 @@ export default {
   margin-left: 50px;
   width: 100%;
 }
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 3 - 2
src/views/exportTrade/invoice/config/mainList.json

@@ -1,6 +1,6 @@
 {
   "searchShow": true,
-  "searchMenuSpan": 16,
+  "searchMenuSpan": 24,
   "border": true,
   "index": true,
   "viewBtn": false,
@@ -14,7 +14,8 @@
   "searchIcon": true,
   "expand": true,
   "expandWidth": 38,
-  "searchIndex": 2,
+  "searchIndex": 3,
+  "searchSpan": 6,
   "selection": true,
   "tip":false,
   "column": [{

+ 10 - 6
src/views/exportTrade/invoice/index.vue

@@ -110,7 +110,7 @@ export default {
       },
       key: 0,
       search: {
-        businesDate: defaultDate()
+        businesDate: defaultDate(5)
       },
       itemOption: {
         align: "center",
@@ -439,11 +439,11 @@ export default {
       }
     }
   },
-  // watch: {
-  //   option: function () {
-  //     this.search.businessDate = defaultDate();
-  //   }
-  // }
+  watch: {
+    option: function () {
+      this.search.businesDate = defaultDate(5);
+    }
+  }
 };
 </script>
 
@@ -460,4 +460,8 @@ export default {
   margin-left: 50px;
   width: 100%;
 }
+
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 7 - 3
src/views/exportTrade/purchaseContract/index.vue

@@ -543,7 +543,7 @@ export default {
         ]
       },
       search: {
-        // businesDate: defaultDate()
+        businesDate: defaultDate(5)
         // businesDate: ''
       },
       treeData: [],
@@ -803,7 +803,8 @@ export default {
         menuWidth: "120",
         searchLabelWidth: "90",
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         expand: true,
         expandWidth: 38,
         selection: true,
@@ -1525,7 +1526,7 @@ export default {
   },
   watch: {
     option: function() {
-      this.search.businesDate = defaultDate();
+      this.search.businesDate = defaultDate(5);
     },
     dialogVisible: function() {
       this.goodsListShow = [];
@@ -1555,4 +1556,7 @@ export default {
   margin-left: 50px;
   width: 100%;
 }
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 8 - 3
src/views/exportTrade/purchaseInquiry/index.vue

@@ -96,7 +96,7 @@ export default {
   data() {
     return {
       search: {
-        businesDate: defaultDate()
+        businesDate: defaultDate(5)
       },
       option: {},
       optionBack: {
@@ -111,7 +111,8 @@ export default {
         headerAlign: "center",
         menuWidth: "120",
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         showSummary: true,
         selection: true,
         tip: false,
@@ -453,7 +454,7 @@ export default {
   },
   watch: {
     option: function() {
-      this.search.businesDate = defaultDate();
+      this.search.businesDate = defaultDate(5);
     }
   }
 };
@@ -466,4 +467,8 @@ export default {
 .page-crad ::v-deep .basic-container__card {
   height: 94.2vh;
 }
+
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 11 - 7
src/views/exportTrade/salesContract/index.vue

@@ -151,7 +151,7 @@ export default {
       activeName: "second",
       tabType: 2,
       search: {
-        businesDate: defaultDate()
+        businesDate: defaultDate(5)
       },
       form: {},
       option: {},
@@ -167,7 +167,8 @@ export default {
         headerAlign: "center",
         menuWidth: "150",
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         searchLabelWidth: 90,
         showSummary: true,
         selection: true,
@@ -959,12 +960,12 @@ export default {
         this.$refs[ref].$refs.dialogColumn.columnBox = false;
       }
     }
+  },
+  watch: {
+      option: function () {
+          this.search.businesDate = defaultDate(5);
+      }
   }
-  // watch: {
-  //     option: function () {
-  //         this.search.businesDate = defaultDate();
-  //     }
-  // }
 };
 </script>
 
@@ -981,4 +982,7 @@ export default {
   margin-left: 50px;
   width: 100%;
 }
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 5 - 1
src/views/exportTrade/shippingInquiry/index.vue

@@ -109,7 +109,8 @@ export default {
         headerAlign: "center",
         menuWidth: "70",
         searchIcon: true,
-        searchIndex: 2,
+        searchIndex: 3,
+        searchSpan: 6,
         selection: true,
         tip: false,
         column: [
@@ -369,4 +370,7 @@ export default {
 .page-crad ::v-deep .basic-container__card {
   height: 94.2vh;
 }
+/deep/ .el-col-md-8 {
+  width: 24.33333%;
+}
 </style>

+ 253 - 0
src/views/tirePartsMall/salesManagement/saleOrder/components/viewArea.vue

@@ -0,0 +1,253 @@
+<template>
+  <div>
+    <el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose" v-dialog-drag>
+      <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 || query.whether != 1"
+          :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
+          :filterable="true"
+          @selectChange="dicChange('dot', $event)"
+        ></dic-select>
+        <el-tag type="danger" style="margin-left: 10px;">出库数量:{{ qtyMax }}</el-tag>
+      </div>
+
+      <avue-crud
+        v-if="dialogVisible"
+        :option="option"
+        :table-loading="loading"
+        :data="data"
+        ref="crud"
+        id="out-table"
+        :header-cell-class-name="headerClassName"
+      >
+        <template slot="quantity" slot-scope="{ row }">
+          <el-input-number
+            v-model="row.quantity"
+            size="small"
+            :controls="false"
+            style="width: 100%"
+            :max="row.balanceQuantity"
+            :min="0"
+            :precision="0"
+            :disabled="disabled"
+            @change="qtyChange(row)"
+          />
+        </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" :disabled="disabled">确 认</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { selectReservoirAreaList } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
+import { head } from "lodash";
+import { isProcurement } from "@/api/basicData/configuration";
+import dicSelect from "@/components/dicSelect/main";
+export default {
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  components: {
+    dicSelect
+  },
+  data() {
+    return {
+      data: [],
+      dialogVisible: false,
+      loading: false,
+      option: {
+        height: 500,
+        calcHeight: 30,
+        border: true,
+        index: true,
+        addBtn: false,
+        viewBtn: false,
+        delBtn: false,
+        editBtn: false,
+        menu: false,
+        header: false,
+        column: [
+          {
+            label: "库区",
+            prop: "reservoirAreaName",
+            filters: true,
+            sortable: true,
+            overHidden: true
+          },
+          {
+            label: "批次",
+            prop: "dot",
+            filters: true,
+            sortable: true,
+            overHidden: true
+          },
+          {
+            label: "库存",
+            prop: "balanceQuantity",
+            overHidden: true
+          },
+          {
+            label: "本次数量",
+            prop: "quantity",
+            overHidden: true
+          }
+        ]
+      },
+      form: {},
+      query: {},
+      index: 0,
+      qtyMax: 0
+    };
+  },
+  async created() {},
+  methods: {
+    dicChange(name, row) {
+      if (name == "dot") {
+        if (row) {
+          this.query.inventory = row.balanceQuantity;
+          this.onLoad();
+        } else {
+          this.query.dot = null;
+          this.onLoad();
+        }
+      }
+    },
+    qtyChange(row) {
+      let sum = 0;
+      for (let item of this.data.filter(item => item.quantity > 0)) {
+        sum += Number(item.quantity ? item.quantity : 0);
+      }
+      if (sum > this.qtyMax) {
+        return this.$message.error("总数量不能超过" + this.qtyMax);
+      }
+    },
+    onLoad() {
+      let obj = {
+        shipId: this.form.id,
+        shipItemId: this.query.id,
+        goodsId: this.query.goodsId,
+        storageId: this.form.storageId,
+        dot: this.query.dot
+      };
+      this.loading = true;
+      selectReservoirAreaList(obj)
+        .then(res => {
+          this.data = res.data.data;
+        })
+        .catch(() => {
+          this.data = [];
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    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 = this.deepClone(row.historyList);
+      this.qtyMax = row.goodsNum;
+      this.dialogVisible = true;
+      if (row.historyList.length == 0) {
+        this.onLoad();
+      }
+    },
+    submit() {
+      if (this.data.filter(item => item.quantity > 0).length == 0) {
+        return this.$message.error("至少有一条本次数量不能为0");
+      }
+      for (let item of this.data.filter(item => item.quantity > 0)) {
+        if (this.data.filter(item => item.quantity > 0)[0].dot != item.dot) {
+          return this.$message.error("请选择一种批次号");
+        }
+      }
+      if (!this.query.dot) {
+        this.query.dot = this.data.filter(item => item.quantity > 0)[0].dot;
+      }
+      let sum = 0;
+      for (let item of this.data.filter(item => item.quantity > 0)) {
+        sum += Number(item.quantity ? item.quantity : 0);
+      }
+      if (Number(sum) != Number(this.qtyMax)) {
+        return this.$message.error("总数量必须等于" + this.qtyMax);
+      }
+      let obj = {
+        ...this.query,
+        historyList: this.data.filter(item => item.quantity > 0)
+      };
+      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>

+ 73 - 5
src/views/tirePartsMall/salesManagement/saleOrder/detailsPage.vue

@@ -286,6 +286,33 @@
 
               <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
                 <el-button
+                  v-if="reservoirArea == 1 && row.historyList.length"
+                  :size="size"
+                  :disabled="!row.id || disabled || isAdd"
+                  type="text"
+                  @click="rowDelArea(row, index)"
+                >
+                  清空库区
+                </el-button>
+                <el-button
+                  v-if="reservoirArea == 1 && row.historyList.length"
+                  :size="size"
+                  :disabled="!row.id"
+                  type="text"
+                  @click="rowArea(row, index)"
+                >
+                  查看库区
+                </el-button>
+                <el-button
+                  v-if="reservoirArea == 1 && row.historyList.length == 0"
+                  :size="size"
+                  :disabled="!row.id || disabled || isAdd"
+                  type="text"
+                  @click="rowArea(row, index)"
+                >
+                  选择库区
+                </el-button>
+                <el-button
                   v-if="mingxibaocun"
                   :size="size"
                   :disabled="disabled || isAdd || form.billType == 1"
@@ -518,6 +545,7 @@
         <!--           :disabled="tableData.length !== 1">导入</el-button>-->
       </span>
     </el-dialog>
+    <view-area ref="viewArea" @areaData="update" :disabled="disabled"></view-area>
   </div>
 </template>
 
@@ -542,7 +570,8 @@ import {
   checkOrderRW,
   revokeCheckOrderRW,
   getParamservice,
-  selectShipItemRecord
+  selectShipItemRecord,
+  itemRemove
 } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
 import reportDialog from "@/components/report-dialog/main";
@@ -559,6 +588,7 @@ import { getToken } from "@/util/auth";
 import { isProcurement } from "@/api/basicData/configuration";
 import { getList as inventoryList } from "@/api/tirePartsMall/inventory";
 import dicSelect from "@/components/dicSelect/main";
+import viewArea from "./components/viewArea.vue";
 export default {
   name: "detailsPage",
   data() {
@@ -892,7 +922,7 @@ export default {
           {
             label: "电话",
             disabled: false,
-            prop: "phone",
+            prop: "phone"
           },
           {
             label: "收货地址",
@@ -1073,7 +1103,7 @@ export default {
         addRowBtn: false,
         editBtn: false,
         delBtn: false,
-        menuWidth: 140,
+        menuWidth: 250,
         dialogTop: 25,
         dialogWidth: "80%",
         summaryText: this.$t("land118n.total"),
@@ -1477,7 +1507,7 @@ export default {
       reservoirArea: 0
     };
   },
-  components: { SearchQuery, reportDialog, check, checkSchedule, dicSelect },
+  components: { SearchQuery, reportDialog, check, checkSchedule, dicSelect, viewArea },
   props: {
     onLoad: Object,
     detailData: Object
@@ -1764,6 +1794,37 @@ export default {
     }
   },
   methods: {
+    rowArea(row, index) {
+      // let obj = {
+      //   shipId: this.form.id,
+      //   shipItemId: row.id,
+      //   goodsId: row.goodsId,
+      //   storageId: this.form.storageId,
+      //   dot: row.dot
+      // };
+      this.$refs.viewArea.openDialog(this.form, row, index);
+    },
+    rowDelArea(row, index) {
+      if (row.historyList.filter(item => item.id).length) {
+        this.$confirm("是否撤销库区?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          let ids = [];
+          for (let item of row.historyList) {
+            ids.push(item.id);
+          }
+          itemRemove({ ids: ids.join(",") }).then(res => {
+            row.historyList = [];
+            row.dot = null;
+          });
+        });
+      } else {
+        row.historyList = [];
+        row.dot = null;
+      }
+    },
     viewArea(row) {
       this.areaData = [];
       selectShipItemRecord({
@@ -1772,6 +1833,12 @@ export default {
         this.areaData = res.data.data;
       });
     },
+    update(row, index) {
+      console.log(row, index);
+      this.form.orderItemsList[index].dot = row.dot;
+      // this.form.orderItemsList[index].sendNum = row.sendNum;
+      this.form.orderItemsList[index].historyList = row.historyList;
+    },
     viewInventory() {
       this.inventoryData = [];
       inventoryList({
@@ -2067,7 +2134,8 @@ export default {
           // 价格数量
           goodsNumtype: false,
           // 价格
-          pricetype: false
+          pricetype: false,
+          historyList:[],
           // sendNum: 0,
         };
         if (item.goodsFilesList && item.goodsFilesList.length) {