Browse Source

修改发货单点击返回时接口不重新调用问题---cjh

17767204043 3 years ago
parent
commit
7d756ae001
1 changed files with 228 additions and 14 deletions
  1. 228 14
      src/views/ProductionOrderList/Deliverylist/Deliverylist.vue

+ 228 - 14
src/views/ProductionOrderList/Deliverylist/Deliverylist.vue

@@ -1,6 +1,10 @@
 <template>
   <div>
+    <Toptitle title="发货单">
+      <Button type="primary" ghost @click="postData"> 导出 </Button>
+    </Toptitle>
     <FullPage
+      v-if="false"
       title="发货单"
       :list="set_list"
       @init="init"
@@ -69,6 +73,150 @@
         <a @click="goPage(row, 3)" class="map-margin">匹配五金</a>
       </template>
     </FullPage>
+
+    <div class="page-edit" v-else>
+      <Form :label-width="120" class="form_content">
+        <FormItem label="订单编号">
+          <Input
+            clearable
+            v-model="searchFrom.order_no"
+            placeholder="请输入订单编号"
+          ></Input>
+        </FormItem>
+        <FormItem label="订单状态">
+          <Select
+            clearable
+            v-model="searchFrom.sub_state"
+            placeholder="请选择"
+            style="width: 200px"
+          >
+            <Option
+              v-for="item in stateList"
+              :value="item.value"
+              :key="item.value"
+              >{{ item.label }}</Option
+            >
+          </Select>
+        </FormItem>
+        <FormItem label="紧急程度">
+          <Select
+            clearable
+            v-model="searchFrom.warning_state"
+            placeholder="请选择"
+            style="width: 200px"
+          >
+            <Option
+              v-for="item in warningList"
+              :value="item.id"
+              :key="item.title"
+              >{{ item.title }}</Option
+            >
+          </Select>
+        </FormItem>
+        <FormItem label="项目名称">
+          <Input
+            clearable
+            v-model="searchFrom.residential_name"
+            placeholder="请输入项目名称"
+          ></Input>
+        </FormItem>
+        <FormItem label="图号">
+          <Select
+            clearable
+            v-model="searchFrom.url_number"
+            multiple
+            filterable
+            style="width: 180px"
+          >
+            <Option
+              v-for="item in url_number_list"
+              :value="item.title"
+              :key="item.title"
+              >{{ item.title }}</Option
+            >
+          </Select>
+        </FormItem>
+        <FormItem label="出库日期范围">
+          <DatePicker
+            clearable
+            transfer
+            type="daterange"
+            @on-change="fromTime"
+            placement="bottom-end"
+            placeholder="请选择时间"
+            style="width: 200px"
+          ></DatePicker>
+        </FormItem>
+        <FormItem :label-width="40">
+          <Button type="primary" @click="initData(searchFrom)">搜索</Button>
+        </FormItem>
+      </Form>
+      <div>
+        <Checkbox @on-change="showTrueChange"
+          >展示确认出库百分比不一致的数据</Checkbox
+        >
+      </div>
+      <Table
+        ref="table"
+        :loading="loading"
+        @on-selection-change="selectTable"
+        border
+        :columns="tableColums"
+        :data="tableData"
+      >
+        <template slot="basicTypeSet" slot-scope="{ row }">
+          <div>
+            <span
+              v-for="item in warningList"
+              :key="item.id"
+              :style="{ color: item.color }"
+              v-show="item.id == row.warning_state"
+              >{{ item.title }}</span
+            >
+          </div>
+        </template>
+        <template slot="set" slot-scope="{ row }">
+          <a class="map-margin" @click="goPage(row, 1)">详情</a>
+          <a class="map-margin" @click="goPage(row, 2)">查看异常</a>
+          <a
+            @click="confirmOutStock(row, 1)"
+            v-if="row.state == 0"
+            class="map-margin"
+            >发货完成</a
+          >
+          <!-- &&(persimissionData['确认出库'] || persimissionData.all) -->
+          <a
+            @click="confirmOutStock(row, 2)"
+            v-if="row.state == 1"
+            class="map-margin"
+            >收货完成</a
+          >
+          <!-- &&(persimissionData['确认运输'] || persimissionData.all) -->
+          <a
+            class="map-margin"
+            @click="
+              goBigScreen(row);
+              showModal = true;
+            "
+            >大屏</a
+          >
+          <a @click="goPage(row, 3)" class="map-margin">匹配五金</a>
+        </template>
+      </Table>
+      <div class="content_body_page">
+        <Page
+          :page-size-opts="[10, 20, 30, 40, 100]"
+          @on-page-size-change="changeSize"
+          @on-change="changePage"
+          :current="pageIndex"
+          show-total
+          show-elevator
+          :total="total"
+          show-sizer
+          :page-size="pageSize"
+        />
+      </div>
+    </div>
     <Modal v-model="showModal" fullscreen footer-hide class="modal-bs">
       <template slot="header">
         <div class="modal-title">
@@ -155,6 +303,17 @@ import { mapState } from "vuex";
 export default {
   data() {
     return {
+      searchData: [],
+      typeList: [
+        { label: "工装", value: 1 },
+        { label: "家装", value: 0 },
+      ],
+      stateList: [
+        { label: "可以派工", value: 0 },
+        { label: "已派工", value: 1 },
+        { label: "已完成", value: 2 },
+      ],
+      searchFrom: {},
       type: 0, //不展示确认出库百分比与运输百分比不一定的数据
       chooseData: [],
       url_number_list: [],
@@ -258,8 +417,8 @@ export default {
         },
       ],
       tableData: [],
-      pageIndex: 1,
-      pageSize: 10,
+      pageIndex: JSON.parse(localStorage.getItem("pageIndex")) || 1,
+      pageSize: JSON.parse(localStorage.getItem("pageSize")) || 10,
       total: 0,
       proxyObj: {},
       loading: false,
@@ -296,6 +455,16 @@ export default {
       timer: "",
     };
   },
+  mounted() {
+    if (localStorage.getItem("searchFrom")) {
+      this.searchFrom = JSON.parse(localStorage.getItem("searchFrom"));
+    }
+    if (localStorage.getItem("newSearchFrom")) {
+      this.init(JSON.parse(localStorage.getItem("newSearchFrom")));
+    }else{
+      this.init()
+    }
+  },
   computed: {
     ...mapState(["persimissionData"]),
     computedTable() {
@@ -396,16 +565,36 @@ export default {
   beforeRouteLeave(to, from, next) {
     if (
       to.path == "/cms/productionorderlist/deliverylist/deliverylistDetail" ||
-      "/cms/productionorderlist/deliverylist/checkUnusual" ||
-      "/cms/productionorderlist/deliverylist/matchIronware"
+      to.path == "/cms/productionorderlist/deliverylist/checkUnusual" ||
+      to.path == "/cms/productionorderlist/deliverylist/matchIronware"
     ) {
+      from.meta.keepAlive = false;
+      localStorage.setItem("searchFrom", JSON.stringify(this.searchFrom));
+      localStorage.setItem("pageSize", this.pageSize);
+      localStorage.setItem("pageIndex", this.pageIndex);
       next();
     } else {
+      let form = this.searchFrom;
+      Object.keys(form).forEach((key) => (form[key] = ""));
+      localStorage.setItem("searchFrom", form);
+      localStorage.setItem("newSearchFrom", form);
+      localStorage.removeItem("searchFrom");
+      localStorage.removeItem("newSearchFrom");
+      localStorage.removeItem("pageSize");
+      localStorage.removeItem("pageIndex");
       from.meta.keepAlive = false;
       next();
     }
   },
   methods: {
+    initData(row) {
+      localStorage.setItem("newSearchFrom", JSON.stringify(row));
+      this.init(row);
+    },
+    fromTime(data1, data2) {
+      this.searchFrom.start_time = data1[0];
+      this.searchFrom.end_time = data1[1];
+    },
     showTrueChange(e) {
       if (e) {
         this.type = 1;
@@ -417,7 +606,6 @@ export default {
     },
     selectTable(e) {
       this.chooseData = e;
-      console.log(this.chooseData);
     },
     async postData() {
       if (this.chooseData.length == 0) {
@@ -437,16 +625,22 @@ export default {
     },
 
     init(row) {
-      this.pageIndex = 1;
-      row.page_index = this.pageIndex;
-      row.page_size = this.pageSize;
-      row.type = this.type;
-      this.proxyObj = JSON.parse(JSON.stringify(row));
-      this.getData(this.proxyObj);
+      if (row) {
+        row.page_index = this.pageIndex;
+        row.page_size = this.pageSize;
+        row.type = this.type;
+        this.proxyObj = JSON.parse(JSON.stringify(row));
+        this.getData(this.proxyObj);
+      } else {
+        this.proxyObj = {
+          page_index: this.pageIndex,
+          page_size: this.pageSize,
+        };
+        this.getData(this.proxyObj);
+      }
     },
     getData(row) {
       this.loading = true;
-      console.log(row, 1);
       this.axios("/api/orders_out_list", { params: row }).then((res) => {
         this.loading = false;
         if (res.code == 200) {
@@ -463,7 +657,6 @@ export default {
 
           this.set_list[4].option = data;
           this.url_number_list = data;
-          console.log(this.set_list[4].option);
         }
       });
     },
@@ -496,7 +689,6 @@ export default {
         content: type == 1 ? "确认发货么?" : "确认收货么?",
         type: "primary",
         then: (e) => {
-          console.log(123, e);
           this.axios.post(post_url, params).then((res) => {
             if (res.code == 200) {
               this.$Message.success(res.msg);
@@ -639,6 +831,28 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.content_body_page {
+  text-align: center;
+  margin-top: 10px;
+}
+.form_content {
+  margin-top: 15px;
+  display: flex;
+  flex-wrap: wrap;
+}
+.nav {
+  display: flex;
+  justify-content: space-between;
+  align-items: flex-end;
+  margin-top: 10px;
+}
+.page-edit {
+  // overflow: hidden;
+  overflow-y: auto;
+  position: relative;
+  top: 0px;
+  height: 80%;
+}
 .modal-bs {
   /deep/.ivu-modal-header,
   /deep/.ivu-modal-body,