luobang 2 年之前
父節點
當前提交
e360218ba3
共有 1 個文件被更改,包括 117 次插入51 次删除
  1. 117 51
      src/views/appoint/components/saleContract/saleOrderSteel.vue

+ 117 - 51
src/views/appoint/components/saleContract/saleOrderSteel.vue

@@ -2,56 +2,63 @@
   <!-- 销售订单页面 -->
   <div class="salePlan">
     <div class="top">
-      <span>订单时间:</span>
-      <el-date-picker
-        v-model="startTime"
-        type="datetime"
-        placeholder="选择日期"
-        style="width:220px"
-      >
-      </el-date-picker>
-      <span>至</span>
-      <el-date-picker
-        v-model="endTime"
-        type="datetime"
-        placeholder="选择日期"
-        style="width:220px"
-      >
-      </el-date-picker>
-      <el-input
-        placeholder="请输入内容"
-        v-model="input"
-        clearable
-        style="width:250px"
-      >
-      </el-input>
-      <el-button type="primary" class="btn" @click="onclick">
-        <i class="el-icon-search"></i>
-      </el-button>
-      <el-button type="primary" @click="btnclick(0)">
-        <i class="el-icon-plus"></i>钢材订单新增
-      </el-button>
-      <el-button type="primary" @click="refresh">
-        <i class="el-icon-refresh"></i>
-      </el-button>
-      <el-button type="primary" @click="batchReport">
-        <i class="upload2"></i>批量上传
-      </el-button>
-      <el-button
-        type="primary"
-        @click="exportData()"
-        v-if="activeName == 'first'"
-        ><i class="el-icon-download"></i>Excel</el-button
-      >
-      <el-button disabled>物资总件数</el-button>
-      <el-input
-        placeholder=""
-        v-model="matSum"
-        clearable
-        style="width:100px"
-        disabled
-      >
-      </el-input>
+      <el-form :inline="true">
+        <el-form-item>
+          <el-date-picker
+            v-model="startTime"
+            type="datetime"
+            placeholder="选择日期"
+            style="width:220px"
+          >
+          </el-date-picker>
+          <span>至</span>
+          <el-date-picker
+            v-model="endTime"
+            type="datetime"
+            placeholder="选择日期"
+            style="width:220px"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-input
+            placeholder="请输入内容"
+            v-model="input"
+            clearable
+            style="width:250px"
+          >
+          </el-input>
+          <el-button type="primary" class="btn" @click="onclick">
+            <i class="el-icon-search"></i>
+          </el-button>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="btnclick(0)">
+            <i class="el-icon-plus"></i>新增
+          </el-button>
+          <el-button type="primary" @click="refresh">
+            <i class="el-icon-refresh"></i>
+          </el-button>
+          <el-button type="primary" @click="batchReport">
+            <i class="upload2"></i>批量上传
+          </el-button>
+          <el-button
+            type="primary"
+            @click="exportData()"
+            v-if="activeName == 'first'"
+            ><i class="el-icon-download"></i>Excel</el-button
+          >
+          <el-button disabled>物资总件数</el-button>
+          <el-input
+            placeholder=""
+            v-model="matSum"
+            clearable
+            style="width:100px"
+            disabled
+          >
+          </el-input>
+        </el-form-item>
+      </el-form>
     </div>
     <div class="table">
       <el-tabs v-model="activeName" @tab-click="handleClick">
@@ -210,6 +217,7 @@
 <script>
 import { getCookie } from "@/utils/util.js";
 import { sjTime } from "@/utils/sharedJsFile";
+import returnResultVue from "../../../inward/components/offsetSteel/truckTransport/returnResult.vue";
 export default {
   name: "saleOrder",
   data() {
@@ -289,7 +297,9 @@ export default {
       },
       mapList: [],
       mapItemList: [],
-      matSum: null
+      matSum: null,
+      tableData: [],
+      saleDateOfReceipt: null
     };
   },
   created() {
@@ -353,8 +363,64 @@ export default {
         "&i=" +
         new Date();
     }
+    let loadTime1 = new Date(
+      new Date(new Date().toLocaleDateString()).getTime() +
+        (3600 * 1000 * 8 - 1)
+    ); // 当天8点前
+    let loadTime2 = new Date(
+      new Date(new Date().toLocaleDateString()).getTime() +
+        (3600 * 1000 * 32 - 1)
+    ); // 次天8点前
+    if (new Date().getTime() - loadTime1 > 0) {
+      this.saleDateOfReceipt = loadTime2;
+    } else {
+      this.saleDateOfReceipt = loadTime1;
+    }
   },
   methods: {
+    //导入Excel格式
+    // 导入excel
+    importExcel(file) {
+      let that = this;
+      if (!file) {
+        that.$message({
+          message: "文件错误!",
+          type: "warning"
+        });
+        return;
+      }
+      this.tableData = [];
+      var reader = new FileReader();
+      var data = null;
+      var workbook = null;
+      //设置读取操作
+      reader.onload = function(e) {
+        console.log(e);
+        data = e.target.result;
+        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 => {
+          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);
+        });
+        return;
+      };
+      reader.readAsBinaryString(file.raw); //以二进制方式读取
+    },
     adverseCloseSaleOrder(row) {
       console.log(row);
       this.$confirm("确定反关闭整条订单吗?", "继续?", {