luobang 2 rokov pred
rodič
commit
d5413d966a

+ 2 - 1
build/utils.js

@@ -26,7 +26,8 @@ const devPathSrc = path.resolve(__dirname, "../../../src"); // node_modules应
 
 // let devModules = ["index", "appoint", "statisticalReport", "WMS"];
 // let devModules = ["index", "appoint", "inward", "statisticalReport", "RMS"];
-let devModules = ["all"];
+// let devModules = ["index", "appoint", "sale", "statisticalReport", "inward"];
+let devModules = ["index", "statisticalReport", "appoint"];
 
 // let devModules = ['index','appoint','sale','statisticalReport','RMS','TMS','WMS']
 // let devModules = ["index", "ADMINISTRATORS", "RMS"];

+ 2 - 2
config/index.js

@@ -65,9 +65,9 @@ let proxyTable = {
   },
   // 所有数据的请求域名地址
   "/api/v1": {
-    target: "http://172.16.33.166:80",
+    // target: "http://172.16.33.166:80",
     // target: "http://localhost:8080",
-    // target: "http://192.168.1.107:8080",
+    target: "http://192.168.1.107:8080",
     ws: true,
     pathRewrite: {
       "^/api/v1": "/api/v1"

+ 4 - 0
src/views/appoint/components/saleContract/addSaleOrder.vue

@@ -1002,6 +1002,10 @@ export default {
       this.remarks = item.value;
     },
     onclikSaleArea() {
+      if (this.saleAreaId == null) {
+        this.$message.warning("请先选择片区");
+        return;
+      }
       this.axios
         .post("/api/v1/uc/bandSaleArea", {
           areaId: this.saleAreaId,

+ 134 - 0
src/views/appoint/components/saleContract/importExcelSaleOrder.vue

@@ -0,0 +1,134 @@
+<template>
+  <div>
+    <el-table
+      :data="tableData1"
+      :span-method="objectSpanMethod"
+      border
+      highlight-current-row
+    >
+      <el-table-column
+        property="receiveName"
+        label="下单客户"
+        width="200"
+      ></el-table-column>
+      <el-table-column property="truckNo" label="车序号"></el-table-column>
+      <el-table-column
+        property="materialName"
+        label="物资名称"
+      ></el-table-column>
+      <el-table-column
+        property="materialSpecification"
+        label="物资规格"
+      ></el-table-column>
+      <el-table-column
+        property="materialModel"
+        label="物资型号"
+      ></el-table-column>
+      <el-table-column property="steelMeters" label="米数"></el-table-column>
+      <el-table-column
+        property="materialNumber"
+        label="物资件数"
+      ></el-table-column>
+      <el-table-column property="province" label="省"></el-table-column>
+      <el-table-column property="district" label="市"></el-table-column>
+      <el-table-column property="town" label="县"></el-table-column>
+      <el-table-column property="place" label="具体收货地址"></el-table-column>
+
+      <el-table-column
+        property="isSelfMention"
+        label="是否自提"
+        width="150"
+      ></el-table-column>
+      <el-table-column
+        property="saleRemark"
+        label="摘要"
+        width="150"
+      ></el-table-column>
+      <el-table-column
+        property="saleOrderReceiveCustomer"
+        label="收款客户"
+        width="150"
+      ></el-table-column>
+      <el-table-column
+        property="truckRemark"
+        label="车号备注"
+      ></el-table-column>
+
+      <el-table-column
+        property="saleOrderConsigneeTel"
+        label="收货方电话"
+      ></el-table-column>
+      <el-table-column
+        property="saleDateOfReceipt"
+        label="截止日期"
+      ></el-table-column>
+
+      <el-table-column
+        property="isPoundSale"
+        label="是否磅重交货"
+      ></el-table-column>
+      <el-table-column
+        property="shipperName"
+        label="发货单位"
+        width="150"
+      ></el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "ExcelSaleOrder",
+  props: {
+    tableData: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      columnIndexList: [0, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
+      spanArr: [],
+      tableData1: this.tableData
+    };
+  },
+  mounted() {
+    this.getSpanArr(this.tableData1);
+  },
+  methods: {
+    //记录每一行的合并数
+    getSpanArr(data) {
+      //每次调用方法初始化
+      this.spanArr = [];
+      for (var i = 0; i < data.length; i++) {
+        if (i === 0) {
+          this.spanArr.push(1);
+          this.pos = 0;
+          data[i].group = i;
+        } else {
+          // 判断当前元素与上一个元素是否相同
+          if (data[i].truckNo === data[i - 1].truckNo) {
+            this.spanArr[this.pos] += 1;
+            this.spanArr.push(0);
+            data[i].group = data[i - 1].group;
+          } else {
+            this.spanArr.push(1);
+            this.pos = i;
+            data[i].group = data[i - 1].group + 1;
+          }
+        }
+      }
+    },
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (this.columnIndexList.indexOf(columnIndex) != -1) {
+        const _row = this.spanArr[rowIndex];
+        const _col = _row > 0 ? 1 : 0;
+        return {
+          rowspan: _row,
+          colspan: _col
+        };
+      }
+    }
+  }
+};
+</script>

+ 242 - 16
src/views/appoint/components/saleContract/saleOrderSteel.vue

@@ -28,7 +28,7 @@
             style="width:250px"
           >
           </el-input>
-          <el-button type="primary" class="btn" @click="onclick">
+          <el-button type="primary" @click="onclick">
             <i class="el-icon-search"></i>
           </el-button>
         </el-form-item>
@@ -46,8 +46,22 @@
             type="primary"
             @click="exportData()"
             v-if="activeName == 'first'"
-            ><i class="el-icon-download"></i>Excel</el-button
+            ><i class="el-icon-download"></i>导出Excel</el-button
           >
+          <el-form-item v-if="activeName == 'first'">
+            <el-upload
+              class="upload-excel"
+              action=""
+              :on-change="importExcel"
+              :show-file-list="false"
+              accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
+              :auto-upload="false"
+            >
+              <el-button type="primary" icon="el-icon-upload"
+                >导入Excel</el-button
+              >
+            </el-upload>
+          </el-form-item>
           <el-button disabled>物资总件数</el-button>
           <el-input
             placeholder=""
@@ -212,16 +226,40 @@
         </el-tab-pane>
       </el-tabs>
     </div>
+    <div>
+      <el-dialog
+        title="销售订单预览"
+        :visible.sync="dialogTableVisible"
+        :center="true"
+        width="100%"
+      >
+        <ExcelSaleOrder :tableData="tableData"></ExcelSaleOrder>
+        <div class="btn">
+          <el-button
+            type="primary"
+            @click="addExcelInport"
+            @keyup.native.enter="addExcelInport"
+            >确认</el-button
+          >
+          <el-button type="primary" @click="cancelExcelInport">取消</el-button>
+        </div>
+      </el-dialog>
+    </div>
   </div>
 </template>
 <script>
 import { getCookie } from "@/utils/util.js";
 import { sjTime } from "@/utils/sharedJsFile";
-import returnResultVue from "../../../inward/components/offsetSteel/truckTransport/returnResult.vue";
+import { isNumber } from "../../../ADMINISTRATORS/app";
+import ExcelSaleOrder from "../saleContract/importExcelSaleOrder.vue";
 export default {
   name: "saleOrder",
+  components: {
+    ExcelSaleOrder
+  },
   data() {
     return {
+      dialogTableVisible: false,
       startTime: null,
       endTime: null,
       batchReportList: [],
@@ -232,6 +270,12 @@ export default {
       index: "",
       carrierId: null,
       carrierName: null,
+      shipperName: "四川省达州钢铁集团有限责任公司",
+      shipperId: 1,
+      receivingCompany: [
+        "四川省达州钢铁集团有限责任公司",
+        "四川达钢商贸有限公司"
+      ],
       option: {
         // 表格请求数据的地址
         requestUrl: "",
@@ -299,7 +343,31 @@ export default {
       mapItemList: [],
       matSum: null,
       tableData: [],
-      saleDateOfReceipt: null
+      saleDateOfReceipt: null,
+      //销售订单主表数据
+      saleOrderList: [
+        "receiveName",
+        "isSelfMention",
+        "saleRemark",
+        "saleOrderReceiveCustomer",
+        "salerName"
+      ],
+      saleOrderMapList: [
+        "truckNo",
+        "province",
+        "district",
+        "town",
+        "truckRemark",
+        "place",
+        "saleOrderConsigneeTel",
+        "saleDateOfReceipt",
+        "materialName",
+        "materialSpecification",
+        "materialModel",
+        "materialNumber",
+        "steelMeters",
+        "isPoundSale"
+      ]
     };
   },
   created() {
@@ -376,10 +444,21 @@ export default {
     } else {
       this.saleDateOfReceipt = loadTime1;
     }
+    // document.addEventListener("keydown", e => {
+    //   let key = window.event.keyCode;
+    //   if (key == 13) {
+    //     // 13是enter键的键盘码 如果等于13 就调用click的登录方法
+    //     this.addExcelInport();
+    //   }
+    // });
   },
+  // beforeDestroy() {
+  //   //这里的 this.login('loginForm') 指的是键盘事件的方法名
+  //   document.removeEventListener("keydown", this.addExcelInport());
+  // },
   methods: {
     //导入Excel格式
-    // 导入excel
+    //导入excel
     importExcel(file) {
       let that = this;
       if (!file) {
@@ -400,27 +479,169 @@ export default {
         workbook = XLSX.read(data, {
           type: "binary"
         });
-        console.log(workbook);
         let rows = XLSX.utils.sheet_to_json(
           workbook.Sheets[workbook.SheetNames[0]]
         ); //只取第一页
         console.log("rows", rows);
-        Array.from(rows).forEach(e => {
+        Array.from(rows).forEach((e, index) => {
           let map = {};
-          console.log(e, "e");
-          Object.keys(e).forEach(e1 => {
-            console.log("e1", e1);
-            if (e1.includes("物资名称")) {
-              map.materialName = e[e1];
-            }
-          });
-          that.tableData.push(map);
-          console.log(that.tableData);
+          try {
+            Object.keys(e).forEach(e1 => {
+              if (e1.includes("物资名称")) {
+                map.materialName = e[e1];
+              }
+              if (e1.includes("下单客户")) {
+                map.receiveName = e[e1];
+              }
+              if (e1.includes("米数")) {
+                map.steelMeters = e[e1];
+              }
+              if (e1.includes("物资规格")) {
+                if (e[e1].includes("Φ")) {
+                  map.materialSpecification = e[e1];
+                } else {
+                  map.materialSpecification = "Φ" + e[e1];
+                }
+              }
+              if (e1.includes("物资型号")) {
+                map.materialModel = e[e1];
+              }
+              if (e1.includes("物资件数")) {
+                if (isNumber(e[e1])) {
+                  map.materialNumber = e[e1];
+                } else {
+                  throw new Error(
+                    `该Excel第--${index +
+                      2}--行-“物资件数”错误,请核实后再输入(件数输入整数)`
+                  );
+                }
+              }
+              if (e1.includes("车序号")) {
+                if (isNumber(e[e1])) {
+                  map.truckNo = e[e1];
+                } else {
+                  throw new Error(
+                    `该Excel第--${index +
+                      2}--行-“车序号”错误,请核实后再输入(车序号输入正整数)`
+                  );
+                }
+              }
+              if (e1.includes("收款公司")) {
+                if (that.receivingCompany.indexOf(e[e1]) === -1) {
+                  throw new Error(
+                    `该Excel第--${index + 2}--行-“收款公司”错误,请核实后再输入`
+                  );
+                } else {
+                  map.saleOrderReceiveCustomer = e[e1];
+                }
+              }
+              if (e1.includes("业务员")) {
+                map.salerName = e[e1];
+              }
+              if (e1.includes("摘要")) {
+                map.saleRemark = e[e1];
+              }
+              if (e1.includes("省")) {
+                map.province = e[e1];
+              }
+              if (e1.includes("市")) {
+                map.district = e[e1];
+              }
+              if (e1.includes("县/区")) {
+                map.town = e[e1];
+              }
+              if (e1.includes("具体收货地址")) {
+                map.place = e[e1];
+              }
+              if (e1.includes("收货客户电话")) {
+                map.saleOrderConsigneeTel = e[e1];
+              }
+              if (e1.includes("备注")) {
+                map.truckRemark = e[e1];
+              }
+              if (e1.includes("是否磅重交货")) {
+                if (e[e1] == "是") {
+                  map.isPoundSale = 1;
+                } else if (e[e1] == "否") {
+                  map.isPoundSale = 0;
+                } else {
+                  throw new Error(
+                    `该Excel第--${index +
+                      2}--行-“是否磅重交货”-错误,请核实后再输入`
+                  );
+                }
+              }
+              if (e1.includes("是否自提")) {
+                if (e[e1] === "是" || e[e1] === "否") {
+                  map.isSelfMention = e[e1];
+                } else {
+                  throw new Error(
+                    `该Excel第--${index + 2}--行-“是否自提”-错误,请核实后再输入`
+                  );
+                }
+              }
+            });
+            map.shipperName = that.shipperName;
+            that.tableData.push(map);
+          } catch (e) {
+            that.$message.error(e.message);
+          }
         });
+        that.dialogTableVisible = true;
         return;
       };
       reader.readAsBinaryString(file.raw); //以二进制方式读取
     },
+    addExcelInport() {
+      this.$confirm("以上均核对正确,确定导入Excel", "提示", {
+        cancelButtonText: "取消",
+        confirmButtonText: "确认",
+        center: true
+      })
+        .then(() => {
+          let map = {};
+          let arr = [];
+          this.tableData.forEach(e => {
+            let mapMaterial = {};
+            Object.keys(e).forEach(e1 => {
+              if (this.saleOrderList.includes(e1)) {
+                map[e1] = e[e1];
+              }
+              if (this.saleOrderMapList.includes(e1)) {
+                mapMaterial[e1] = e[e1];
+              }
+            });
+            mapMaterial.saleDateOfReceipt = sjTime(this.saleDateOfReceipt);
+            arr.push(mapMaterial);
+          });
+          map.shipperId = 1;
+          map.mapList = arr;
+          console.log(map);
+          this.axios
+            .post("/api/v1/ams/addSteelSaleOrder", map)
+            .then(res => {
+              if (res.data.code == "200") {
+                this.$message.success("新增销售订单成功!");
+                this.getRequestUrl();
+                this.dialogTableVisible = false;
+              } else {
+                this.$message.error(res.data.data);
+                this.getRequestUrl();
+                this.dialogTableVisible = false;
+              }
+            })
+            .catch(e => {
+              this.$message.error("生成错误!");
+              this.dialogTableVisible = false;
+            });
+        })
+        .catch(() => {
+          this.$message.info("取消导入");
+        });
+    },
+    cancelExcelInport() {
+      this.dialogTableVisible = false;
+    },
     adverseCloseSaleOrder(row) {
       console.log(row);
       this.$confirm("确定反关闭整条订单吗?", "继续?", {
@@ -844,5 +1065,10 @@ export default {
     margin-left: 20px;
     margin-top: 20px;
   }
+  .btn {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
 }
 </style>

+ 8 - 3
src/views/inward/components/inwardSettlement/detailOrder.vue

@@ -8,7 +8,7 @@
             v-model="screen"
             placeholder="请选择需筛选的内容"
             clearable
-            style="width:120px"
+            class="elSelect"
           >
             <el-option
               v-for="item in options"
@@ -30,7 +30,7 @@
             v-model="screen1"
             placeholder="请选择需筛选的内容"
             clearable
-            style="width:120px"
+            class="elSelect"
           >
             <el-option
               v-for="item in optionsF"
@@ -392,11 +392,16 @@ export default {
 };
 </script>
 
-<style lang="scss" scode>
+<style lang="scss" scoped>
 .steel_inbound {
   .sache {
     margin-left: 20px;
     margin-top: 20px;
+    .elSelect /deep/ {
+      .el-input--suffix .el-input__inner {
+        width: 120px !important;
+      }
+    }
   }
   .table {
     margin-left: 20px;

+ 0 - 3
src/views/sale/components/transport_order/saleSteelOrder.vue

@@ -7,9 +7,6 @@
       <el-button type="primary" class="btn" @click="onClick">
         <i class="el-icon-search"></i>查询
       </el-button>
-      <el-button type="primary" class="btn" @click="batchCloseOrder">
-        <i></i>批量关闭订单
-      </el-button>
       <el-button type="primary" @click="refresh">
         <i class="el-icon-refresh"></i>刷新
       </el-button>

+ 1 - 0
src/views/statisticalReport/components/salesLogisticsStatistics/saleSteelAllReport.vue

@@ -1097,6 +1097,7 @@ export default {
       arr.push(map);
       let updateMap = {
         orderId: row.orderId,
+        saleOrderId: row.saleOrderId,
         saleOrderMaterialId: row.saleOrderMaterialId,
         mapList: arr
       };