Переглянути джерело

修改库存管理keepAlive ---cjh

17767204043 3 роки тому
батько
коміт
e2fd3158b8

+ 3 - 3
src/routerMap/index.js

@@ -1249,7 +1249,7 @@ const routerMap = [
     name: "redFontInstockOrderList", //采购模块-->红字入库单列表
     meta: {
       index: 3,
-      keepAlive:true
+      // keepAlive:true
     },
     component: (resolve) =>
       require(["@/views/PurchasingManage/redFontInstockOrder/list"], resolve),
@@ -1277,7 +1277,7 @@ const routerMap = [
     name: "redFontOutstockOrderList", //采购模块-->红字出库单列表
     meta: {
       index: 3,
-      keepAlive:true
+      // keepAlive:true
     },
     component: (resolve) =>
       require(["@/views/PurchasingManage/redFontOutstockOrder/list"], resolve),
@@ -1323,7 +1323,7 @@ const routerMap = [
     name: "OutstockOrderList", //采购模块-->出库单列表
     meta: {
       index: 3,
-      keepAlive:true
+      // keepAlive:true
     },
     component: (resolve) =>
       require(["@/views/PurchasingManage/OutstockOrder/list"], resolve),

+ 463 - 314
src/views/PurchasingManage/InstockOrder/list.vue

@@ -9,168 +9,209 @@
         <!-- <Button type="primary"
                 @click="handleGoPage(1,'')"
                 style="margin-right:10px;">新增</Button> -->
-     
       </slot>
     </Toptitle>
-<div class="instock_order_content">
-    <div class="instock_order_search">
-      <Form :label-width="110"
-            :model="searchData">
-        <FormItem label="采购入库单号:">
-          <Input type="text"
-                 size="small"
-                 v-model="searchData.order_in_no"
-                 clearable
-                 style="width: 150px"
-                 placeholder="采购入库单号" />
-        </FormItem>
-        <FormItem label="供应商名称:">
-          <Tooltip :content="supplierTitle" placement="top" transfer >
-          <Select 
-                 size="small"
-                 v-model="searchData.supply_id"
-                 style="width: 150px"
-                 placeholder="请选择"
-                 filterable
-                 clearable
-                @on-change='supplyChange'
-                  >
-                 <Option v-for="(item,index) in suppliersList" :key="index" :value="item.id" :label="item.title"/>
-          </Select>
-          </Tooltip>
-        </FormItem>
-        <FormItem label="入库类型:">
-          <Select v-model="searchData.type" filterable clearable  size="small">
-            <Option v-for="(sitem) in purchaseTypeList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="仓库:">
-          <Select v-model="searchData.warehouse_id"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in warehouseList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="制单人:">
-          <Select v-model="searchData.crt_id"
-                  size="small"
-                  clearable
-                  filterable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="审批状态:">
-          <Select v-model="searchData.state"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option label='未审批'
-                    :value=0 />
-            <Option label='已审批'
-                    :value=1 />
-          </Select>
-        </FormItem>
-         <FormItem label="审批人:">
-          <Select v-model="searchData.check_id"
-                  size="small"
-                  clearable
-                  filterable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="单据日期:" style="width:430px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.end_time"></DatePicker>
-        </FormItem>
-        <FormItem label="订单创建时间:" style="width:430px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_end_time"></DatePicker>
-        </FormItem>
-        <FormItem>
-          <Button type="primary"
-                  size="small"
-                  @click="initData(searchData)"
-                  style="margin-right:10px;">搜索</Button>
-        </FormItem>
-      </Form>
-    </div>
-    <div class="addBtn">
-    <Button type="primary"
-                @click="handleGoPage(1,'')"
-                style="margin-right:10px;"
-                size='small'
-                >新增</Button></div>
-    
+    <div class="instock_order_content">
+      <div class="instock_order_search">
+        <Form :label-width="110" :model="searchData">
+          <FormItem label="采购入库单号:">
+            <Input
+              type="text"
+              size="small"
+              v-model="searchData.order_in_no"
+              clearable
+              style="width: 150px"
+              placeholder="采购入库单号"
+            />
+          </FormItem>
+          <FormItem label="供应商名称:">
+            <Tooltip :content="supplierTitle" placement="top" transfer>
+              <Select
+                size="small"
+                v-model="searchData.supply_id"
+                style="width: 150px"
+                placeholder="请选择"
+                filterable
+                clearable
+                @on-change="supplyChange"
+              >
+                <Option
+                  v-for="(item, index) in suppliersList"
+                  :key="index"
+                  :value="item.id"
+                  :label="item.title"
+                />
+              </Select>
+            </Tooltip>
+          </FormItem>
+          <FormItem label="入库类型:">
+            <Select v-model="searchData.type" filterable clearable size="small">
+              <Option
+                v-for="sitem in purchaseTypeList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="仓库:">
+            <Select
+              v-model="searchData.warehouse_id"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in warehouseList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="制单人:">
+            <Select
+              v-model="searchData.crt_id"
+              size="small"
+              clearable
+              filterable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="审批状态:">
+            <Select
+              v-model="searchData.state"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option label="未审批" :value="0" />
+              <Option label="已审批" :value="1" />
+            </Select>
+          </FormItem>
+          <FormItem label="审批人:">
+            <Select
+              v-model="searchData.check_id"
+              size="small"
+              clearable
+              filterable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="单据日期:" style="width: 430px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem label="订单创建时间:" style="width: 430px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem>
+            <Button
+              type="primary"
+              size="small"
+              @click="searchClick(searchData)"
+              style="margin-right: 10px"
+              >搜索</Button
+            >
+          </FormItem>
+        </Form>
+      </div>
+      <div class="addBtn">
+        <Button
+          type="primary"
+          @click="handleGoPage(1, '')"
+          style="margin-right: 10px"
+          size="small"
+          >新增</Button
+        >
+      </div>
+
       <div class="instock_order_content_table">
-        <Table :columns="tableColumns"
-               border
-               :max-height="500"
-               :data="tableData">
-          <template slot="setSlot"
-                    slot-scope="{row,index}">
-                     <a style="margin:0 5px"
-               @click="handleSet(6,row,index)">复制</a>
-            <a style="margin:0 5px"
-               @click="handleSet(2,row,index)">详情</a>
-            <a style="margin:0 5px"
-              v-show="row.state==0"
-               @click="handleSet(3,row,index)">编辑</a>
-            <a style="margin:0 5px"
+        <Table
+          :columns="tableColumns"
+          border
+          :max-height="500"
+          :data="tableData"
+        >
+          <template slot="setSlot" slot-scope="{ row, index }">
+            <a style="margin: 0 5px" @click="handleSet(6, row, index)">复制</a>
+            <a style="margin: 0 5px" @click="handleSet(2, row, index)">详情</a>
+            <a
+              style="margin: 0 5px"
+              v-show="row.state == 0"
+              @click="handleSet(3, row, index)"
+              >编辑</a
+            >
+            <a
+              style="margin: 0 5px"
               v-show="row.state == 0"
-               @click="handleSet(4,row,index)">删除</a>
-            <a style="margin:0 5px"
-               @click="handleSet(5,row,index)">{{row.state==1?'弃审':'审批'}}</a>
+              @click="handleSet(4, row, index)"
+              >删除</a
+            >
+            <a style="margin: 0 5px" @click="handleSet(5, row, index)">{{
+              row.state == 1 ? "弃审" : "审批"
+            }}</a>
           </template>
         </Table>
-         </div>
-         </div>
-        <div class="instock_order_content_page">
-          <Page :page-size-opts="[10, 20, 30, 40,100]"
-                @on-page-size-change='changeSize'
-                @on-change='changePage'
-                :current='pageIndex'
-                show-total
-                :total="total"
-                show-sizer
-                :page-size='pageSize' />
-        </div>
+      </div>
+    </div>
+    <div class="instock_order_content_page">
+      <Page
+        :page-size-opts="[10, 20, 30, 40, 100]"
+        @on-page-size-change="changeSize"
+        @on-change="changePage"
+        :current="pageIndex"
+        show-total
+        :total="total"
+        show-sizer
+        :page-size="pageSize"
+      />
+    </div>
   </div>
 </template>
 
@@ -180,234 +221,345 @@
 // 例如:import 《组件名称》 from '《组件路径》';
 
 export default {
-  name: '',
-  components: {
-
-  },
+  name: "",
+  components: {},
   props: {},
   // import引入的组件需要注入到对象中才能使用
-  data () {
+  data() {
     // 这里存放数据
     return {
-      supplierTitle:'',
-      suppliersList:[],
-      warehouseList:[],
-      purchaseTypeList: [{title:'采购',id:1},{title:'库存',id:2}],
+      supplierTitle: "",
+      suppliersList: [],
+      warehouseList: [],
+      purchaseTypeList: [
+        { title: "采购", id: 1 },
+        { title: "库存", id: 2 },
+      ],
       searchData: {
-        order_in_no: '',
-        supply_id: '',
-        type: '',
-        warehouse_id: '',
-        crt_id: '',
-        state: '',
-        check_id:'',
-        start_time: '',
-        end_time: '',
-        order_start_time:'',
-        order_end_time:''
+        order_in_no: "",
+        supply_id: "",
+        type: "",
+        warehouse_id: "",
+        crt_id: "",
+        state: "",
+        check_id: "",
+        start_time: "",
+        end_time: "",
+        order_start_time: "",
+        order_end_time: "",
       },
       tableColumns: [
-        { title: '采购入库单号', key: 'order_in_no', align: 'center', minWidth: 140 },
-        { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
         {
-          title: '入库类型', key: 'type', align: 'center', minWidth: 120,
+          title: "采购入库单号",
+          key: "order_in_no",
+          align: "center",
+          minWidth: 140,
+        },
+        {
+          title: "供应商名称",
+          key: "supply_title",
+          align: "center",
+          minWidth: 140,
+        },
+        {
+          title: "入库类型",
+          key: "type",
+          align: "center",
+          minWidth: 120,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, row.type_title)
-          }
+            const { row } = params;
+            return h("span", {}, row.type_title);
+          },
         },
         {
-          title: '仓库', key: 'warehouse_title', align: 'center', minWidth: 120
+          title: "仓库",
+          key: "warehouse_title",
+          align: "center",
+          minWidth: 120,
         },
-        { title: '制单人', key: 'user_name', align: 'center', minWidth: 100 },
+        { title: "制单人", key: "user_name", align: "center", minWidth: 100 },
         {
-          title: '审批状态', key: 'state', align: 'center', minWidth: 140,
+          title: "审批状态",
+          key: "state",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            const text = row.state == 0 ? '未审批' : '已审批'
-            return h('span', {}, text)
-          }
+            const { row } = params;
+            const text = row.state == 0 ? "未审批" : "已审批";
+            return h("span", {}, text);
+          },
         },
-          { title: '审批人', key: 'check_name', align: 'center', minWidth: 100 },
+        { title: "审批人", key: "check_name", align: "center", minWidth: 100 },
         {
-          title: '单据日期', key: 'order_time', align: 'center', minWidth: 140,
+          title: "单据日期",
+          key: "order_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDateNoHMS(row.order_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.order_time));
+          },
         },
-         {
-          title: '订单创建时间', key: 'crt_time', align: 'center', minWidth: 140,
+        {
+          title: "订单创建时间",
+          key: "crt_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDate(row.crt_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDate(row.crt_time));
+          },
+        },
+        {
+          title: "操作",
+          key: "code",
+          align: "center",
+          minWidth: 200,
+          slot: "setSlot",
         },
-        { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
       ],
       tableData: [{}],
-      pageIndex: 1,
+      pageIndex: localStorage.getItem("pageIndex") * 1 || 1,
       pageSize: 10,
       total: 0,
       userList: [],
-    }
+      newSearchData: {},
+    };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
-     // 获取采购类型
-    this.axios({ method: 'get', url: '/api/basic_purchase_list',params:{type_id:4}}).then((res) => { 
-      this.purchaseTypeList=res.data.data;
-      }).catch((err) => { });
+  created() {
+    // 获取采购类型
+    this.axios({
+      method: "get",
+      url: "/api/basic_purchase_list",
+      params: { type_id: 4 },
+    })
+      .then((res) => {
+        this.purchaseTypeList = res.data.data;
+      })
+      .catch((err) => {});
     // 获取操作员
-    this.axios('/api/user').then(res => this.userList = res.data.data)
-     // 获取仓库列表
-    this.axios({ method: 'get', url: '/api/warehouse', }).then((res) => { this.warehouseList = res.data.filter(v=>{return v.type_id==1}) }).catch((err) => { });
-     // 获取供应商列表
-    this.axios({ method: 'get', url: '/api/supply_list', }).then((res) => { this.suppliersList = res.data.data }).catch((err) => { });
+    this.axios("/api/user").then((res) => (this.userList = res.data.data));
+    // 获取仓库列表
+    this.axios({ method: "get", url: "/api/warehouse" })
+      .then((res) => {
+        this.warehouseList = res.data.filter((v) => {
+          return v.type_id == 1;
+        });
+      })
+      .catch((err) => {});
+    // 获取供应商列表
+    this.axios({ method: "get", url: "/api/supply_list" })
+      .then((res) => {
+        this.suppliersList = res.data.data;
+      })
+      .catch((err) => {});
   },
-    beforeRouteLeave(to, from, next) {
-      if (
-        to.path == "/cms/PurchasingManage/InstockOrder/detail" || to.path == "/cms/PurchasingManage/InstockOrder/edit"
-      ) {
-        next();
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/PurchasingManage/InstockOrder/detail") {
+      from.meta.keepAlive = false;
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      localStorage.setItem("pageIndex", this.pageIndex);
+      next();
+    } else if (to.path == "/cms/PurchasingManage/InstockOrder/edit") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      if (to.query.type == 3) {
+        localStorage.setItem("pageIndex", this.pageIndex);
       } else {
-        from.meta.keepAlive = false;
-        next();
+        let form = this.newSearchData;
+        Object.keys(form).forEach((key) => (form[key] = ""));
+         localStorage.setItem("searchData", form);
+        localStorage.setItem("newSearchData", form);
+        localStorage.setItem("pageIndex", 1);
+        localStorage.removeItem("searchData");
+        localStorage.removeItem("pageIndex");
+        localStorage.removeItem("newSearchData");
       }
-    },
+      from.meta.keepAlive = false;
+      // localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      next();
+    } else {
+      localStorage.removeItem("searchData");
+      localStorage.removeItem("pageIndex");
+      localStorage.removeItem("newSearchData");
+      from.meta.keepAlive = false;
+      next();
+    }
+  },
+
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
-    this.initData()
+  mounted() {
+    if (localStorage.getItem("searchData")) {
+      this.searchData = JSON.parse(localStorage.getItem("searchData"));
+    }
+    if (localStorage.getItem("newSearchData")) {
+      this.newSearchData = JSON.parse(localStorage.getItem("newSearchData"));
+    }
+    console.log(this.newSearchData);
+    this.initData(this.newSearchData);
   },
   methods: {
-    supplyChange(e){
-     this.suppliersList.forEach(v=>{
-       if(v.id==e){
-         this.supplierTitle = v.title;
-       }
-     })
+    supplyChange(e) {
+      this.suppliersList.forEach((v) => {
+        if (v.id == e) {
+          this.supplierTitle = v.title;
+        }
+      });
+    },
+    searchClick(row) {
+      localStorage.setItem("newSearchData", JSON.stringify(row));
+      this.newSearchData = row;
+      this.initData(row);
     },
-    initData () {
-      let obj = JSON.parse(JSON.stringify(this.searchData));
-      typeof this.searchData.start_time == 'object' ? obj.start_time = Date.parse(obj.start_time).toString().slice(0,10) : ''
-      typeof this.searchData.end_time == 'object' ? obj.end_time =  Date.parse(obj.end_time).toString().slice(0,10) : ''
-       typeof this.searchData.order_start_time == 'object' ? obj.order_start_time =  Date.parse(obj.order_start_time).toString().slice(0,10) : ''
-      typeof this.searchData.order_end_time == 'object' ? obj.order_end_time =  Date.parse(obj.order_end_time).toString().slice(0,10) : ''
+    initData(row) {
+      if (row) {
+        var obj = JSON.parse(JSON.stringify(this.searchData));
+        typeof this.searchData.start_time == "object"
+          ? (obj.start_time = Date.parse(obj.start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.end_time == "object"
+          ? (obj.end_time = Date.parse(obj.end_time).toString().slice(0, 10))
+          : "";
+        typeof this.searchData.order_start_time == "object"
+          ? (obj.order_start_time = Date.parse(obj.order_start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.order_end_time == "object"
+          ? (obj.order_end_time = Date.parse(obj.order_end_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+      } else {
+        var obj = {};
+      }
+
       this.axios({
-        method: 'get',
-        url: '/api/warehouse_order_in_list',
+        method: "get",
+        url: "/api/warehouse_order_in_list",
         params: {
           ...obj,
           page_index: this.pageIndex,
-          page_size: this.pageSize
-        }
-      }).then((res) => {
-        this.tableData = res.data.data
-        this.total = res.data.total
-        // console.log(res)
-      }).catch((err) => { });
+          page_size: this.pageSize,
+        },
+      })
+        .then((res) => {
+          this.tableData = res.data.data;
+          this.total = res.data.total;
+          // console.log(res)
+        })
+        .catch((err) => {});
     },
-    handleSet (type, row, index) {
+    handleSet(type, row, index) {
       // 1新增 2详情 3编辑 4删除 5审批 6复制
       switch (type) {
         case 6:
         case 1:
         case 3:
-          this.handleGoPage(type, row.order_in_no,row.is_refer)
-          break
+          this.handleGoPage(type, row.order_in_no, row.is_refer);
+          break;
         case 2:
-          this.handleGoPage(type, row.order_in_no,row.is_refer)
+          this.handleGoPage(type, row.order_in_no, row.is_refer);
           break;
         case 4:
           this.$Modal.confirm({
-            title: '确认删除?',
-            content: '此操作无法恢复,请确认!',
+            title: "确认删除?",
+            content: "此操作无法恢复,请确认!",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_in_del',
+                method: "get",
+                url: "/api/warehouse_order_in_del",
                 params: {
-                  order_in_no: row.order_in_no
-                }
-              }).then((res) => {
-                if(res.code==200){
-                this.$Message.success(res.msg)
-                this.initData()}
-              }).catch((err) => { });
+                  order_in_no: row.order_in_no,
+                },
+              })
+                .then((res) => {
+                  if (res.code == 200) {
+                    this.$Message.success(res.msg);
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
         case 5:
           this.$Modal.confirm({
-            title:row.state==1?'确认弃审?':'确认审批?',
+            title: row.state == 1 ? "确认弃审?" : "确认审批?",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_in_check',
+                method: "get",
+                url: "/api/warehouse_order_in_check",
                 params: {
                   order_in_no: row.order_in_no,
-                  state: row.state==1?0:1
-                }
-              }).then((res) => {
-                // this.$Message.success(res.msg)
-                if(res.code==200){
-                this.initData()}
-              }).catch((err) => { });
+                  state: row.state == 1 ? 0 : 1,
+                },
+              })
+                .then((res) => {
+                  // this.$Message.success(res.msg)
+                  if (res.code == 200) {
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
       }
     },
-    handleGoPage (type, order_in_no,is_refer) {
-      if(type==1||type==3||type==6){
+    handleGoPage(type, order_in_no, is_refer) {
+      if (type == 1 || type == 3 || type == 6) {
         this.$router.push({
-        path: '/cms/PurchasingManage/InstockOrder/edit',
-        query: {
-          type,
-          order_in_no,
-          is_refer
-        }
-      })
-      }else{
+          path: "/cms/PurchasingManage/InstockOrder/edit",
+          query: {
+            type,
+            order_in_no,
+            is_refer,
+          },
+        });
+      } else {
         this.$router.push({
-          path:'/cms/PurchasingManage/InstockOrder/detail',
-          query:{
+          path: "/cms/PurchasingManage/InstockOrder/detail",
+          query: {
             order_in_no,
-          }
-        })
+          },
+        });
       }
     },
-    changeSize (e) {
+    changeSize(e) {
       this.pageSize = e;
-      this.initData()
+      this.initData();
     },
-    changePage (e) {
+    changePage(e) {
       this.pageIndex = e;
-      this.initData()
-    }
+      this.initData(this.newSearchData);
+    },
   },
   // 监听属性 类似于data概念
   computed: {},
   // 监控data中的数据变化
   watch: {},
-  beforeCreate () { }, // 生命周期 - 创建之前
-  beforeMount () { }, // 生命周期 - 挂载之前
-  beforeUpdate () { }, // 生命周期 - 更新之前
-  updated () { }, // 生命周期 - 更新之后
-  beforeDestroy () { }, // 生命周期 - 销毁之前
-  destroyed () { }, // 生命周期 - 销毁完成
-  activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
-}
+  beforeCreate() {}, // 生命周期 - 创建之前
+  beforeMount() {}, // 生命周期 - 挂载之前
+  beforeUpdate() {}, // 生命周期 - 更新之前
+  updated() {}, // 生命周期 - 更新之后
+  beforeDestroy() {}, // 生命周期 - 销毁之前
+  destroyed() {}, // 生命周期 - 销毁完成
+  activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
+};
 </script>
 
 <style lang='scss' scoped>
-.addBtn{
-   display: flex;
-   flex-direction:row-reverse;
+.addBtn {
+  display: flex;
+  flex-direction: row-reverse;
 }
-.instock_order{
+.instock_order {
   height: 100%;
 }
 .instock_order_search {
@@ -428,17 +580,14 @@ export default {
   .instock_order_content_btn {
     display: flex;
     justify-content: flex-end;
-   
   }
- 
 }
- .instock_order_content_page {
-    display: flex;
-    justify-content: center;
-    padding-top: 20px;
-  }
-  .instock_order_content_table{
-    margin-top:10px ;
-  }
- 
+.instock_order_content_page {
+  display: flex;
+  justify-content: center;
+  padding-top: 20px;
+}
+.instock_order_content_table {
+  margin-top: 10px;
+}
 </style>

+ 72 - 27
src/views/PurchasingManage/OutstockOrder/list.vue

@@ -154,7 +154,7 @@
             <Button
               type="primary"
               size="small"
-              @click="initData(searchData)"
+              @click="searchClick(searchData)"
               style="margin-right: 10px"
               >搜索</Button
             >
@@ -315,10 +315,11 @@ export default {
         },
       ],
       tableData: [{}],
-      pageIndex: 1,
+      pageIndex: localStorage.getItem("pageIndex") * 1 || 1,
       pageSize: 10,
       total: 0,
       userList: [],
+      newSearchData:{}
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -352,30 +353,47 @@ export default {
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    this.initData();
+    if (localStorage.getItem("searchData")) {
+      this.searchData = JSON.parse(localStorage.getItem("searchData"));
+    }
+    if (localStorage.getItem("newSearchData")) {
+      this.newSearchData = JSON.parse(localStorage.getItem("newSearchData"));
+    }
+    this.initData(this.newSearchData);
   },
   methods: {
+    searchClick(row) {
+      localStorage.setItem("newSearchData", JSON.stringify(row));
+      this.newSearchData = row;
+      this.initData(row);
+    },
     supplyChange(e) {
       this.supplierTitle = e;
     },
-    initData() {
-      let obj = JSON.parse(JSON.stringify(this.searchData));
-      typeof this.searchData.start_time == "object"
-        ? (obj.start_time = Date.parse(obj.start_time).toString().slice(0, 10))
-        : "";
-      typeof this.searchData.end_time == "object"
-        ? (obj.end_time = Date.parse(obj.end_time).toString().slice(0, 10))
-        : "";
-      typeof this.searchData.order_start_time == "object"
-        ? (obj.order_start_time = Date.parse(obj.order_start_time)
-            .toString()
-            .slice(0, 10))
-        : "";
-      typeof this.searchData.order_end_time == "object"
-        ? (obj.order_end_time = Date.parse(obj.order_end_time)
-            .toString()
-            .slice(0, 10))
-        : "";
+    initData(row) {
+      if (row) {
+        var obj = JSON.parse(JSON.stringify(this.searchData));
+        typeof this.searchData.start_time == "object"
+          ? (obj.start_time = Date.parse(obj.start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.end_time == "object"
+          ? (obj.end_time = Date.parse(obj.end_time).toString().slice(0, 10))
+          : "";
+        typeof this.searchData.order_start_time == "object"
+          ? (obj.order_start_time = Date.parse(obj.order_start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.order_end_time == "object"
+          ? (obj.order_end_time = Date.parse(obj.order_end_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+      } else {
+        var obj = {};
+      }
       this.axios({
         method: "get",
         url: "/api/warehouse_order_out_list",
@@ -475,21 +493,48 @@ export default {
     },
     changePage(e) {
       this.pageIndex = e;
-      this.initData();
+      this.initData(this.newSearchData);
     },
   },
   // 监听属性 类似于data概念
   computed: {},
   // 监控data中的数据变化
   watch: {},
+  // beforeRouteLeave(to, from, next) {
+  //   if (
+  //     to.path == "/cms/PurchasingManage/OutstockOrder/detail" ||
+  //     to.path == "/cms/PurchasingManage/OutstockOrder/edit"
+  //   ) {
+  //     next();
+  //   } else {
+  //     from.meta.keepAlive = false;
+  //     next();
+  //   }
+  // },
   beforeRouteLeave(to, from, next) {
-    if (
-      to.path == "/cms/PurchasingManage/OutstockOrder/detail" ||
-      to.path == "/cms/PurchasingManage/OutstockOrder/edit"
-    ) {
+    if (to.path == "/cms/PurchasingManage/OutstockOrder/detail") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      localStorage.setItem("pageIndex", this.pageIndex);
+      next();
+    } else if (to.path == "/cms/PurchasingManage/OutstockOrder/edit") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      if (to.query.type == 3) {
+        localStorage.setItem("pageIndex", this.pageIndex);
+        localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      } else {
+        let form = this.newSearchData;
+        Object.keys(form).forEach((key) => (form[key] = ""));
+        localStorage.setItem("searchData", form);
+        localStorage.setItem("newSearchData", form);
+        localStorage.setItem("pageIndex", 1);
+        localStorage.removeItem("searchData");
+        localStorage.removeItem("pageIndex");
+        localStorage.removeItem("newSearchData");
+      }
       next();
     } else {
-      from.meta.keepAlive = false;
+      localStorage.removeItem("searchData");
+      localStorage.removeItem("pageIndex");
       next();
     }
   },

+ 463 - 312
src/views/PurchasingManage/redFontInstockOrder/list.vue

@@ -11,401 +11,554 @@
                 style="margin-right:10px;">新增</Button> -->
       </slot>
     </Toptitle>
-<div class="instock_order_content">
-    <div class="instock_order_search">
-      <Form :label-width="110"
-            :model="searchData">
-        <FormItem label="采购入库单号:">
-          <Input type="text"
-                 size="small"
-                 v-model="searchData.order_red_no"
-                 clearable
-                 style="width: 150px"
-                 placeholder="采购入库单号" />
-        </FormItem>
-        <FormItem label="供应商名称:">
-          <Tooltip :content="supplierTitle" placement="top" transfer >
-          <Select 
-                 size="small"
-                 v-model="searchData.supply_id"
-                 style="width: 150px"
-                 placeholder="请选择"
-                 filterable
-                 clearable
-                @on-change='supplyChange'
-                  >
-                 <Option v-for="(item,index) in suppliersList" :key="index" :value="item.id" :label="item.title"/>
-          </Select>
-          </Tooltip>
-        </FormItem>
-        <FormItem label="入库类型:">
-          <Select v-model="searchData.type" filterable clearable  size="small">
-            <Option v-for="(sitem) in purchaseTypeList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="仓库:">
-          <Select v-model="searchData.warehouse_id"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in warehouseList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="制单人:">
-          <Select v-model="searchData.crt_id"
-                  size="small"
-                  clearable
-                  filterable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="审批状态:">
-          <Select v-model="searchData.state"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option label='未审批'
-                    :value=0 />
-            <Option label='已审批'
-                    :value=1 />
-          </Select>
-        </FormItem>
-         <FormItem label="审批人:">
-          <Select v-model="searchData.check_id"
-                  size="small"
-                  clearable
-                  filterable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="单据日期:" style="width:430px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.end_time"></DatePicker>
-        </FormItem>
-        <FormItem label="订单创建时间:" style="width:430px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_end_time"></DatePicker>
-        </FormItem>
-        <FormItem>
-          <Button type="primary"
-                  size="small"
-                  @click="initData(searchData)"
-                  style="margin-right:10px;">搜索</Button>
-        </FormItem>
-      </Form>
-    </div>
-    <div class="addBtn">
-    <Button type="primary"
-                @click="handleGoPage(1,'')"
-                style="margin-right:10px;"
-                size='small'
-                >新增</Button></div>
-    
+    <div class="instock_order_content">
+      <div class="instock_order_search">
+        <Form :label-width="110" :model="searchData">
+          <FormItem label="采购入库单号:">
+            <Input
+              type="text"
+              size="small"
+              v-model="searchData.order_red_no"
+              clearable
+              style="width: 150px"
+              placeholder="采购入库单号"
+            />
+          </FormItem>
+          <FormItem label="供应商名称:">
+            <Tooltip :content="supplierTitle" placement="top" transfer>
+              <Select
+                size="small"
+                v-model="searchData.supply_id"
+                style="width: 150px"
+                placeholder="请选择"
+                filterable
+                clearable
+                @on-change="supplyChange"
+              >
+                <Option
+                  v-for="(item, index) in suppliersList"
+                  :key="index"
+                  :value="item.id"
+                  :label="item.title"
+                />
+              </Select>
+            </Tooltip>
+          </FormItem>
+          <FormItem label="入库类型:">
+            <Select v-model="searchData.type" filterable clearable size="small">
+              <Option
+                v-for="sitem in purchaseTypeList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="仓库:">
+            <Select
+              v-model="searchData.warehouse_id"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in warehouseList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="制单人:">
+            <Select
+              v-model="searchData.crt_id"
+              size="small"
+              clearable
+              filterable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="审批状态:">
+            <Select
+              v-model="searchData.state"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option label="未审批" :value="0" />
+              <Option label="已审批" :value="1" />
+            </Select>
+          </FormItem>
+          <FormItem label="审批人:">
+            <Select
+              v-model="searchData.check_id"
+              size="small"
+              clearable
+              filterable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="单据日期:" style="width: 430px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem label="订单创建时间:" style="width: 430px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem>
+            <Button
+              type="primary"
+              size="small"
+              @click="searchClick(searchData)"
+              style="margin-right: 10px"
+              >搜索</Button
+            >
+          </FormItem>
+        </Form>
+      </div>
+      <div class="addBtn">
+        <Button
+          type="primary"
+          @click="handleGoPage(1, '')"
+          style="margin-right: 10px"
+          size="small"
+          >新增</Button
+        >
+      </div>
+
       <div class="instock_order_content_table">
-        <Table :columns="tableColumns"
-               border
-               :max-height="500"
-               :data="tableData">
-          <template slot="setSlot"
-                    slot-scope="{row,index}">
-            <a style="margin:0 5px"
-               @click="handleSet(2,row,index)">详情</a>
-            <a style="margin:0 5px"
-              v-show="row.state==0"
-               @click="handleSet(3,row,index)">编辑</a>
-            <a style="margin:0 5px"
+        <Table
+          :columns="tableColumns"
+          border
+          :max-height="500"
+          :data="tableData"
+        >
+          <template slot="setSlot" slot-scope="{ row, index }">
+            <a style="margin: 0 5px" @click="handleSet(2, row, index)">详情</a>
+            <a
+              style="margin: 0 5px"
+              v-show="row.state == 0"
+              @click="handleSet(3, row, index)"
+              >编辑</a
+            >
+            <a
+              style="margin: 0 5px"
               v-show="row.state == 0"
-               @click="handleSet(4,row,index)">删除</a>
-            <a style="margin:0 5px"
-               @click="handleSet(5,row,index)">{{row.state==1?'弃审':'审批'}}</a>
+              @click="handleSet(4, row, index)"
+              >删除</a
+            >
+            <a style="margin: 0 5px" @click="handleSet(5, row, index)">{{
+              row.state == 1 ? "弃审" : "审批"
+            }}</a>
           </template>
         </Table>
-         </div>
-         </div>
-        <div class="instock_order_content_page">
-          <Page :page-size-opts="[10, 20, 30, 40,100]"
-                @on-page-size-change='changeSize'
-                @on-change='changePage'
-                :current='pageIndex'
-                show-total
-                :total="total"
-                show-sizer
-                :page-size='pageSize' />
-        </div>
-     
-    
+      </div>
+    </div>
+    <div class="instock_order_content_page">
+      <Page
+        :page-size-opts="[10, 20, 30, 40, 100]"
+        @on-page-size-change="changeSize"
+        @on-change="changePage"
+        :current="pageIndex"
+        show-total
+        :total="total"
+        show-sizer
+        :page-size="pageSize"
+      />
+    </div>
   </div>
 </template>
 
 <script>
-import colorSettingVue from '../../BasicSettings/colorSetting.vue'
+import colorSettingVue from "../../BasicSettings/colorSetting.vue";
 // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 // 例如:import 《组件名称》 from '《组件路径》';
 
 export default {
-  name: '',
-  components: {
-
-  },
+  name: "",
+  components: {},
   props: {},
   // import引入的组件需要注入到对象中才能使用
-  data () {
+  data() {
     // 这里存放数据
     return {
-      supplierTitle:'',
-      suppliersList:[],
-      warehouseList:[],
+      supplierTitle: "",
+      suppliersList: [],
+      warehouseList: [],
       purchaseTypeList: [],
       searchData: {
-        order_red_no: '',
-        supply_id: '',
-        type: '',
-        warehouse_id: '',
-        crt_id: '',
-        state: '',
-        check_id:'',
-        start_time: '',
-        end_time: '',
-        order_start_time:'',
-        order_end_time:''
+        order_red_no: "",
+        supply_id: "",
+        type: "",
+        warehouse_id: "",
+        crt_id: "",
+        state: "",
+        check_id: "",
+        start_time: "",
+        end_time: "",
+        order_start_time: "",
+        order_end_time: "",
       },
       tableColumns: [
-        { title: '采购入库单号', key: 'order_red_no', align: 'center', minWidth: 140 },
-        { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
         {
-          title: '入库类型', key: 'type', align: 'center', minWidth: 120,
+          title: "采购入库单号",
+          key: "order_red_no",
+          align: "center",
+          minWidth: 140,
+        },
+        {
+          title: "供应商名称",
+          key: "supply_title",
+          align: "center",
+          minWidth: 140,
+        },
+        {
+          title: "入库类型",
+          key: "type",
+          align: "center",
+          minWidth: 120,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, row.type_title)
-          }
+            const { row } = params;
+            return h("span", {}, row.type_title);
+          },
         },
         {
-          title: '仓库', key: 'warehouse_title', align: 'center', minWidth: 120
+          title: "仓库",
+          key: "warehouse_title",
+          align: "center",
+          minWidth: 120,
         },
-        { title: '制单人', key: 'user_name', align: 'center', minWidth: 100 },
+        { title: "制单人", key: "user_name", align: "center", minWidth: 100 },
         {
-          title: '审批状态', key: 'state', align: 'center', minWidth: 140,
+          title: "审批状态",
+          key: "state",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            const text = row.state == 0 ? '未审批' : '已审批'
-            return h('span', {}, text)
-          }
+            const { row } = params;
+            const text = row.state == 0 ? "未审批" : "已审批";
+            return h("span", {}, text);
+          },
         },
-          { title: '审批人', key: 'check_name', align: 'center', minWidth: 100 },
+        { title: "审批人", key: "check_name", align: "center", minWidth: 100 },
         {
-          title: '单据日期', key: 'order_time', align: 'center', minWidth: 140,
+          title: "单据日期",
+          key: "order_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDateNoHMS(row.order_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.order_time));
+          },
         },
-         {
-          title: '订单创建时间', key: 'crt_time', align: 'center', minWidth: 140,
+        {
+          title: "订单创建时间",
+          key: "crt_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDate(row.crt_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDate(row.crt_time));
+          },
+        },
+        {
+          title: "操作",
+          key: "code",
+          align: "center",
+          minWidth: 200,
+          slot: "setSlot",
         },
-        { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
       ],
       tableData: [{}],
-      pageIndex: 1,
+      pageIndex: localStorage.getItem("pageIndex") * 1 || 1,
       pageSize: 10,
       total: 0,
       userList: [],
-    }
+      newSearchData: {},
+    };
   },
-    beforeRouteLeave(to, from, next) {
-      if (
-        to.path == "/cms/PurchasingManage/redFontInstockOrder/edit" || to.path == "/cms/PurchasingManage/redFontInstockOrder/detail"
-      ) {
-        next();
+  // beforeRouteLeave(to, from, next) {
+  //   if (
+  //     to.path == "/cms/PurchasingManage/redFontInstockOrder/edit" ||
+  //     to.path == "/cms/PurchasingManage/redFontInstockOrder/detail"
+  //   ) {
+  //     next();
+  //   } else {
+  //     from.meta.keepAlive = false;
+  //     next();
+  //   }
+  // },
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/PurchasingManage/redFontInstockOrder/detail") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      localStorage.setItem("pageIndex", this.pageIndex);
+      next();
+    } else if (to.path == "/cms/PurchasingManage/redFontInstockOrder/edit") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      if (to.query.type == 3) {
+        localStorage.setItem("pageIndex", this.pageIndex);
+        localStorage.setItem("searchData", JSON.stringify(this.searchData));
       } else {
-        from.meta.keepAlive = false;
-        next();
+        let form = this.newSearchData;
+        Object.keys(form).forEach((key) => (form[key] = ""));
+        localStorage.setItem("searchData", form);
+        localStorage.setItem("newSearchData", form);
+        localStorage.setItem("pageIndex", 1);
+        localStorage.removeItem("searchData");
+        localStorage.removeItem("pageIndex");
+        localStorage.removeItem("newSearchData");
       }
-    },
+
+      next();
+    } else {
+      localStorage.removeItem("searchData");
+      localStorage.removeItem("pageIndex");
+      next();
+    }
+  },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
+  created() {
     //获取入库类型
-    this.axios({ method: 'get', url: '/api/basic_purchase_list',params:{type_id:4} }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
+    this.axios({
+      method: "get",
+      url: "/api/basic_purchase_list",
+      params: { type_id: 4 },
+    })
+      .then((res) => {
+        this.purchaseTypeList = res.data.data;
+      })
+      .catch((err) => {});
     // 获取操作员
-    this.axios('/api/user').then(res => this.userList = res.data.data)
-     // 获取仓库列表
-    this.axios({ method: 'get', url: '/api/warehouse', }).then((res) => { this.warehouseList = res.data.filter(v=>{
-      return v.type_id==1
-    }) }).catch((err) => { });
-     // 获取供应商列表
-    this.axios({ method: 'get', url: '/api/supply_list', }).then((res) => { this.suppliersList = res.data.data }).catch((err) => { });
+    this.axios("/api/user").then((res) => (this.userList = res.data.data));
+    // 获取仓库列表
+    this.axios({ method: "get", url: "/api/warehouse" })
+      .then((res) => {
+        this.warehouseList = res.data.filter((v) => {
+          return v.type_id == 1;
+        });
+      })
+      .catch((err) => {});
+    // 获取供应商列表
+    this.axios({ method: "get", url: "/api/supply_list" })
+      .then((res) => {
+        this.suppliersList = res.data.data;
+      })
+      .catch((err) => {});
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
-    this.initData()
+  mounted() {
+    if (localStorage.getItem("searchData")) {
+      this.searchData = JSON.parse(localStorage.getItem("searchData"));
+    }
+    if (localStorage.getItem("newSearchData")) {
+      this.newSearchData = JSON.parse(localStorage.getItem("newSearchData"));
+    }
+    this.initData(this.newSearchData);
   },
   methods: {
-    supplyChange(e){
-     this.suppliersList.forEach(v=>{
-       if(v.id==e){
-         this.supplierTitle = v.title;
-       }
-     })
+    supplyChange(e) {
+      this.suppliersList.forEach((v) => {
+        if (v.id == e) {
+          this.supplierTitle = v.title;
+        }
+      });
+    },
+    searchClick(row) {
+      localStorage.setItem("newSearchData", JSON.stringify(row));
+      this.newSearchData = row;
+      this.initData(row);
     },
-    initData () {
-      let obj = JSON.parse(JSON.stringify(this.searchData));
-      typeof this.searchData.start_time == 'object' ? obj.start_time = Date.parse(obj.start_time).toString().slice(0,10) : ''
-      typeof this.searchData.end_time == 'object' ? obj.end_time =  Date.parse(obj.end_time).toString().slice(0,10) : ''
-       typeof this.searchData.order_start_time == 'object' ? obj.order_start_time =  Date.parse(obj.order_start_time).toString().slice(0,10) : ''
-      typeof this.searchData.order_end_time == 'object' ? obj.order_end_time =  Date.parse(obj.order_end_time).toString().slice(0,10) : ''
+    initData(row) {
+      if (row) {
+        var obj = JSON.parse(JSON.stringify(this.searchData));
+        typeof this.searchData.start_time == "object"
+          ? (obj.start_time = Date.parse(obj.start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.end_time == "object"
+          ? (obj.end_time = Date.parse(obj.end_time).toString().slice(0, 10))
+          : "";
+        typeof this.searchData.order_start_time == "object"
+          ? (obj.order_start_time = Date.parse(obj.order_start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.order_end_time == "object"
+          ? (obj.order_end_time = Date.parse(obj.order_end_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+      } else {
+        var obj = {};
+      }
       this.axios({
-        method: 'get',
-        url: '/api/warehouse_order_red_list',
+        method: "get",
+        url: "/api/warehouse_order_red_list",
         params: {
           ...obj,
           page_index: this.pageIndex,
-          page_size: this.pageSize
-        }
-      }).then((res) => {
-        this.tableData = res.data.data
-        this.total = res.data.total
-        // console.log(res)
-      }).catch((err) => { });
+          page_size: this.pageSize,
+        },
+      })
+        .then((res) => {
+          this.tableData = res.data.data;
+          this.total = res.data.total;
+          // console.log(res)
+        })
+        .catch((err) => {});
     },
-    handleSet (type, row, index) {
-      // 1新增 2详情 3编辑 4删除 5审批 
+    handleSet(type, row, index) {
+      // 1新增 2详情 3编辑 4删除 5审批
       switch (type) {
         case 1:
         case 3:
-          this.handleGoPage(type, row.order_red_no,row.is_refer)
-          break
+          this.handleGoPage(type, row.order_red_no, row.is_refer);
+          break;
         case 2:
-          this.handleGoPage(type, row.order_red_no,row.is_refer)
+          this.handleGoPage(type, row.order_red_no, row.is_refer);
           break;
         case 4:
           this.$Modal.confirm({
-            title: '确认删除?',
-            content: '此操作无法恢复,请确认!',
+            title: "确认删除?",
+            content: "此操作无法恢复,请确认!",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_red_del',
+                method: "get",
+                url: "/api/warehouse_order_red_del",
                 params: {
-                  order_red_no: row.order_red_no
-                }
-              }).then((res) => {
-                if(res.code==200){
-                this.$Message.success(res.msg)
-                this.initData()}
-              }).catch((err) => { });
+                  order_red_no: row.order_red_no,
+                },
+              })
+                .then((res) => {
+                  if (res.code == 200) {
+                    this.$Message.success(res.msg);
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
         case 5:
           this.$Modal.confirm({
-            title:row.state==1?'确认弃审?':'确认审批?',
+            title: row.state == 1 ? "确认弃审?" : "确认审批?",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_red_check',
+                method: "get",
+                url: "/api/warehouse_order_red_check",
                 params: {
                   order_red_no: row.order_red_no,
-                  state: row.state==1?0:1
-                }
-              }).then((res) => {
-                // this.$Message.success(res.msg)
-                if(res.code==200){
-                this.initData()}
-              }).catch((err) => { });
+                  state: row.state == 1 ? 0 : 1,
+                },
+              })
+                .then((res) => {
+                  // this.$Message.success(res.msg)
+                  if (res.code == 200) {
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
       }
     },
-    handleGoPage (type, order_red_no,is_refer) {
-      if(type==1||type==3){
+    handleGoPage(type, order_red_no, is_refer) {
+      if (type == 1 || type == 3) {
         this.$router.push({
-        path: '/cms/PurchasingManage/redFontInstockOrder/edit',
-        query: {
-          type,
-          order_red_no,
-          is_refer
-        }
-      })
-      }else{
+          path: "/cms/PurchasingManage/redFontInstockOrder/edit",
+          query: {
+            type,
+            order_red_no,
+            is_refer,
+          },
+        });
+      } else {
         this.$router.push({
-          path:'/cms/PurchasingManage/redFontInstockOrder/detail',
-          query:{
+          path: "/cms/PurchasingManage/redFontInstockOrder/detail",
+          query: {
             order_red_no,
-          }
-        })
+          },
+        });
       }
     },
-    changeSize (e) {
+    changeSize(e) {
       this.pageSize = e;
-      this.initData()
+      this.initData();
     },
-    changePage (e) {
+    changePage(e) {
       this.pageIndex = e;
-      this.initData()
-    }
+      this.initData(this.newSearchData);
+    },
   },
   // 监听属性 类似于data概念
   computed: {},
   // 监控data中的数据变化
   watch: {},
-  beforeCreate () { }, // 生命周期 - 创建之前
-  beforeMount () { }, // 生命周期 - 挂载之前
-  beforeUpdate () { }, // 生命周期 - 更新之前
-  updated () { }, // 生命周期 - 更新之后
-  beforeDestroy () { }, // 生命周期 - 销毁之前
-  destroyed () { }, // 生命周期 - 销毁完成
-  activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
-}
+  beforeCreate() {}, // 生命周期 - 创建之前
+  beforeMount() {}, // 生命周期 - 挂载之前
+  beforeUpdate() {}, // 生命周期 - 更新之前
+  updated() {}, // 生命周期 - 更新之后
+  beforeDestroy() {}, // 生命周期 - 销毁之前
+  destroyed() {}, // 生命周期 - 销毁完成
+  activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
+};
 </script>
 
 <style lang='scss' scoped>
-.addBtn{
-   display: flex;
-   flex-direction:row-reverse;
+.addBtn {
+  display: flex;
+  flex-direction: row-reverse;
 }
-.instock_order{
+.instock_order {
   height: 100%;
 }
 .instock_order_search {
@@ -426,16 +579,14 @@ export default {
   .instock_order_content_btn {
     display: flex;
     justify-content: flex-end;
-   
   }
- 
 }
- .instock_order_content_page {
-    display: flex;
-    justify-content: center;
-    padding-top: 20px;
-  }
-  .instock_order_content_table{
-    margin-top:10px ;
-  }
+.instock_order_content_page {
+  display: flex;
+  justify-content: center;
+  padding-top: 20px;
+}
+.instock_order_content_table {
+  margin-top: 10px;
+}
 </style>

+ 466 - 311
src/views/PurchasingManage/redFontOutstockOrder/list.vue

@@ -11,380 +11,537 @@
                 style="margin-right:10px;">新增</Button> -->
       </slot>
     </Toptitle>
-<div class="instock_order_content">
-    <div class="instock_order_search">
-      <Form :label-width="130"
-            :model="searchData">
-        <FormItem label="红字领料出库单号:">
-          <Input type="text"
-                 size="small"
-                 v-model="searchData.order_red_no"
-                 clearable
-                 style="width: 150px"
-                 placeholder="红字领料出库单号" />
-        </FormItem>
-        <FormItem label="项目名称:">
-          <Tooltip :content="supplierTitle" placement="top" transfer >
-          <Select 
-                 size="small"
-                 v-model="searchData.project_title"
-                 style="width: 150px"
-                 placeholder="请选择"
-                 filterable
-                 clearable
-                @on-change='supplyChange'
-                  >
-                 <Option v-for="(item,index) in project_title_list" :key="index" :value="item" :label="item"/>
-          </Select>
-          </Tooltip>
-        </FormItem>
-        <FormItem label="出库类型:">
-          <Select v-model="searchData.type" filterable clearable  size="small" style="width: 150px">
-            <Option v-for="(sitem) in purchaseTypeList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="仓库:">
-          <Select v-model="searchData.warehouse_id"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in warehouseList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="制单人:">
-          <Select v-model="searchData.crt_id"
-                  size="small"
-                  filterable
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="审批状态:">
-          <Select v-model="searchData.state"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option label='未审批'
-                    :value=0 />
-            <Option label='已审批'
-                    :value=1 />
-          </Select>
-        </FormItem>
-         <FormItem label="审批人:">
-          <Select v-model="searchData.check_id"
-                  size="small"
-                  filterable
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="单据日期:" style="width:450px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.end_time"></DatePicker>
-        </FormItem>
-        <FormItem label="订单创建时间:" style="width:450px">
-          <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_start_time"></DatePicker>
-                      ~
-                       <DatePicker type="date"
-                      size="small"
-                      style="width: 150px"
-                      placeholder="年/月/日"
-                      v-model="searchData.order_end_time"></DatePicker>
-        </FormItem>
-        <FormItem>
-          <Button type="primary"
-                  size="small"
-                  @click="initData(searchData)"
-                  style="margin-right:10px;">搜索</Button>
-        </FormItem>
-      </Form>
-    </div>
-    <div class="addBtn">
-    <Button type="primary"
-                @click="handleGoPage(1,'')"
-                style="margin-right:10px;"
-                size='small'
-                >新增</Button></div>
-    
+    <div class="instock_order_content">
+      <div class="instock_order_search">
+        <Form :label-width="130" :model="searchData">
+          <FormItem label="红字领料出库单号:">
+            <Input
+              type="text"
+              size="small"
+              v-model="searchData.order_red_no"
+              clearable
+              style="width: 150px"
+              placeholder="红字领料出库单号"
+            />
+          </FormItem>
+          <FormItem label="项目名称:">
+            <Tooltip :content="supplierTitle" placement="top" transfer>
+              <Select
+                size="small"
+                v-model="searchData.project_title"
+                style="width: 150px"
+                placeholder="请选择"
+                filterable
+                clearable
+                @on-change="supplyChange"
+              >
+                <Option
+                  v-for="(item, index) in project_title_list"
+                  :key="index"
+                  :value="item"
+                  :label="item"
+                />
+              </Select>
+            </Tooltip>
+          </FormItem>
+          <FormItem label="出库类型:">
+            <Select
+              v-model="searchData.type"
+              filterable
+              clearable
+              size="small"
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in purchaseTypeList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="仓库:">
+            <Select
+              v-model="searchData.warehouse_id"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in warehouseList"
+                :key="sitem.id"
+                :label="sitem.title"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="制单人:">
+            <Select
+              v-model="searchData.crt_id"
+              size="small"
+              filterable
+              clearable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="审批状态:">
+            <Select
+              v-model="searchData.state"
+              size="small"
+              clearable
+              style="width: 150px"
+            >
+              <Option label="未审批" :value="0" />
+              <Option label="已审批" :value="1" />
+            </Select>
+          </FormItem>
+          <FormItem label="审批人:">
+            <Select
+              v-model="searchData.check_id"
+              size="small"
+              filterable
+              clearable
+              style="width: 150px"
+            >
+              <Option
+                v-for="sitem in userList"
+                :key="sitem.id"
+                :label="sitem.nickname"
+                :value="sitem.id"
+              >
+              </Option>
+            </Select>
+          </FormItem>
+          <FormItem label="单据日期:" style="width: 450px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem label="订单创建时间:" style="width: 450px">
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_start_time"
+            ></DatePicker>
+            ~
+            <DatePicker
+              type="date"
+              size="small"
+              style="width: 150px"
+              placeholder="年/月/日"
+              v-model="searchData.order_end_time"
+            ></DatePicker>
+          </FormItem>
+          <FormItem>
+            <Button
+              type="primary"
+              size="small"
+              @click="searchClick(searchData)"
+              style="margin-right: 10px"
+              >搜索</Button
+            >
+          </FormItem>
+        </Form>
+      </div>
+      <div class="addBtn">
+        <Button
+          type="primary"
+          @click="handleGoPage(1, '')"
+          style="margin-right: 10px"
+          size="small"
+          >新增</Button
+        >
+      </div>
+
       <div class="instock_order_content_table">
-        <Table :columns="tableColumns"
-               border
-               :max-height="500"
-               :data="tableData">
-          <template slot="setSlot"
-                    slot-scope="{row,index}">
-            <a style="margin:0 5px"
-               @click="handleSet(2,row,index)">详情</a>
-            <a style="margin:0 5px"
-              v-show="row.state==0"
-               @click="handleSet(3,row,index)">编辑</a>
-            <a style="margin:0 5px"
+        <Table
+          :columns="tableColumns"
+          border
+          :max-height="500"
+          :data="tableData"
+        >
+          <template slot="setSlot" slot-scope="{ row, index }">
+            <a style="margin: 0 5px" @click="handleSet(2, row, index)">详情</a>
+            <a
+              style="margin: 0 5px"
               v-show="row.state == 0"
-               @click="handleSet(4,row,index)">删除</a>
-            <a style="margin:0 5px"
-               @click="handleSet(5,row,index)">{{row.state==1?'弃审':'审批'}}</a>
+              @click="handleSet(3, row, index)"
+              >编辑</a
+            >
+            <a
+              style="margin: 0 5px"
+              v-show="row.state == 0"
+              @click="handleSet(4, row, index)"
+              >删除</a
+            >
+            <a style="margin: 0 5px" @click="handleSet(5, row, index)">{{
+              row.state == 1 ? "弃审" : "审批"
+            }}</a>
           </template>
         </Table>
-         </div>
-         </div>
-        <div class="instock_order_content_page">
-          <Page :page-size-opts="[10, 20, 30, 40,100]"
-                @on-page-size-change='changeSize'
-                @on-change='changePage'
-                :current='pageIndex'
-                show-total
-                :total="total"
-                show-sizer
-                :page-size='pageSize' />
-        </div>
-     
-    
+      </div>
+    </div>
+    <div class="instock_order_content_page">
+      <Page
+        :page-size-opts="[10, 20, 30, 40, 100]"
+        @on-page-size-change="changeSize"
+        @on-change="changePage"
+        :current="pageIndex"
+        show-total
+        :total="total"
+        show-sizer
+        :page-size="pageSize"
+      />
+    </div>
   </div>
 </template>
 
 <script>
-import colorSettingVue from '../../BasicSettings/colorSetting.vue'
+import colorSettingVue from "../../BasicSettings/colorSetting.vue";
 // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 // 例如:import 《组件名称》 from '《组件路径》';
 
 export default {
-  name: '',
-  components: {
-
-  },
+  name: "",
+  components: {},
   props: {},
   // import引入的组件需要注入到对象中才能使用
-  data () {
+  data() {
     // 这里存放数据
     return {
-      supplierTitle:'',
-      suppliersList:[],
-      warehouseList:[],
+      supplierTitle: "",
+      suppliersList: [],
+      warehouseList: [],
       purchaseTypeList: [],
       searchData: {
-        order_red_no: '',
-        supply_id: '',
-        type: '',
-        warehouse_id: '',
-        crt_id: '',
-        state: '',
-        check_id:'',
-        start_time: '',
-        end_time: '',
-        order_start_time:'',
-        order_end_time:''
+        order_red_no: "",
+        supply_id: "",
+        type: "",
+        warehouse_id: "",
+        crt_id: "",
+        state: "",
+        check_id: "",
+        start_time: "",
+        end_time: "",
+        order_start_time: "",
+        order_end_time: "",
       },
       tableColumns: [
-        { title: '红字领料出库单号', key: 'order_red_no', align: 'center', minWidth: 160 },
-        { title: '项目名称', key: 'project_title', align: 'center', minWidth: 140 },
         {
-          title: '出库类型', key: 'type', align: 'center', minWidth: 120,
+          title: "红字领料出库单号",
+          key: "order_red_no",
+          align: "center",
+          minWidth: 160,
+        },
+        {
+          title: "项目名称",
+          key: "project_title",
+          align: "center",
+          minWidth: 140,
+        },
+        {
+          title: "出库类型",
+          key: "type",
+          align: "center",
+          minWidth: 120,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, row.type_title)
-          }
+            const { row } = params;
+            return h("span", {}, row.type_title);
+          },
         },
         {
-          title: '仓库', key: 'warehouse_title', align: 'center', minWidth: 120
+          title: "仓库",
+          key: "warehouse_title",
+          align: "center",
+          minWidth: 120,
         },
-        { title: '制单人', key: 'user_name', align: 'center', minWidth: 100 },
+        { title: "制单人", key: "user_name", align: "center", minWidth: 100 },
         {
-          title: '审批状态', key: 'state', align: 'center', minWidth: 140,
+          title: "审批状态",
+          key: "state",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            const text = row.state == 0 ? '未审批' : '已审批'
-            return h('span', {}, text)
-          }
+            const { row } = params;
+            const text = row.state == 0 ? "未审批" : "已审批";
+            return h("span", {}, text);
+          },
         },
-          { title: '审批人', key: 'check_name', align: 'center', minWidth: 100 },
+        { title: "审批人", key: "check_name", align: "center", minWidth: 100 },
         {
-          title: '单据日期', key: 'order_time', align: 'center', minWidth: 140,
+          title: "单据日期",
+          key: "order_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDateNoHMS(row.order_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.order_time));
+          },
         },
-         {
-          title: '订单创建时间', key: 'crt_time', align: 'center', minWidth: 140,
+        {
+          title: "订单创建时间",
+          key: "crt_time",
+          align: "center",
+          minWidth: 140,
           render: (h, params) => {
-            const { row } = params
-            return h('span', {}, this.func.replaceDate(row.crt_time))
-          }
+            const { row } = params;
+            return h("span", {}, this.func.replaceDate(row.crt_time));
+          },
+        },
+        {
+          title: "操作",
+          key: "code",
+          align: "center",
+          minWidth: 200,
+          slot: "setSlot",
         },
-        { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
       ],
       tableData: [{}],
-      pageIndex: 1,
+      pageIndex: localStorage.getItem("pageIndex") * 1 || 1,
       pageSize: 10,
       total: 0,
       userList: [],
-      project_title_list:[]
-    }
+      project_title_list: [],
+      newSearchData: {},
+    };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
+  created() {
     //获取出库类型
-    this.axios({ method: 'get', url: '/api/basic_purchase_list',params:{type_id:3} }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
-    // 获取操作员
-    this.axios('/api/user').then(res => this.userList = res.data.data)
-     // 获取仓库列表
-    this.axios({ method: 'get', url: '/api/warehouse', }).then((res) => { this.warehouseList = res.data.filter(v=>{
-      return v.type_id==1
-    }) }).catch((err) => { });
-     // 获取供应商列表
-    this.axios({ method: 'get', url: '/api/supply_list', }).then((res) => { this.suppliersList = res.data.data }).catch((err) => { });
-     //获取项目编码和项目名称
-    this.axios.get('/api/purchase_orders_list').then(res=>{
-       this.project_title_list = res.data.project_name;
+    this.axios({
+      method: "get",
+      url: "/api/basic_purchase_list",
+      params: { type_id: 3 },
     })
+      .then((res) => {
+        this.purchaseTypeList = res.data.data;
+      })
+      .catch((err) => {});
+    // 获取操作员
+    this.axios("/api/user").then((res) => (this.userList = res.data.data));
+    // 获取仓库列表
+    this.axios({ method: "get", url: "/api/warehouse" })
+      .then((res) => {
+        this.warehouseList = res.data.filter((v) => {
+          return v.type_id == 1;
+        });
+      })
+      .catch((err) => {});
+    // 获取供应商列表
+    this.axios({ method: "get", url: "/api/supply_list" })
+      .then((res) => {
+        this.suppliersList = res.data.data;
+      })
+      .catch((err) => {});
+    //获取项目编码和项目名称
+    this.axios.get("/api/purchase_orders_list").then((res) => {
+      this.project_title_list = res.data.project_name;
+    });
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
-    this.initData()
+  mounted() {
+    if (localStorage.getItem("searchData")) {
+      this.searchData = JSON.parse(localStorage.getItem("searchData"));
+    }
+    if (localStorage.getItem("newSearchData")) {
+      this.newSearchData = JSON.parse(localStorage.getItem("newSearchData"));
+    }
+    this.initData(this.newSearchData);
   },
   methods: {
-    supplyChange(e){
-          this.supplierTitle = e;
+    supplyChange(e) {
+      this.supplierTitle = e;
+    },
+    searchClick(row) {
+      localStorage.setItem("newSearchData", JSON.stringify(row));
+      this.newSearchData = row;
+      this.initData(row);
     },
-    initData () {
-      let obj = JSON.parse(JSON.stringify(this.searchData));
-      typeof this.searchData.start_time == 'object' ? obj.start_time = Date.parse(obj.start_time).toString().slice(0,10) : ''
-      typeof this.searchData.end_time == 'object' ? obj.end_time =  Date.parse(obj.end_time).toString().slice(0,10) : ''
-       typeof this.searchData.order_start_time == 'object' ? obj.order_start_time =  Date.parse(obj.order_start_time).toString().slice(0,10) : ''
-      typeof this.searchData.order_end_time == 'object' ? obj.order_end_time =  Date.parse(obj.order_end_time).toString().slice(0,10) : ''
+    initData(row) {
+      if (row) {
+        var obj = JSON.parse(JSON.stringify(this.searchData));
+        typeof this.searchData.start_time == "object"
+          ? (obj.start_time = Date.parse(obj.start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.end_time == "object"
+          ? (obj.end_time = Date.parse(obj.end_time).toString().slice(0, 10))
+          : "";
+        typeof this.searchData.order_start_time == "object"
+          ? (obj.order_start_time = Date.parse(obj.order_start_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+        typeof this.searchData.order_end_time == "object"
+          ? (obj.order_end_time = Date.parse(obj.order_end_time)
+              .toString()
+              .slice(0, 10))
+          : "";
+      } else {
+        var obj = {};
+      }
       this.axios({
-        method: 'get',
-        url: '/api/warehouse_order_red_out_list',
+        method: "get",
+        url: "/api/warehouse_order_red_out_list",
         params: {
           ...obj,
           page_index: this.pageIndex,
-          page_size: this.pageSize
-        }
-      }).then((res) => {
-        this.tableData = res.data.data
-        this.total = res.data.total
-        // console.log(res)
-      }).catch((err) => { });
+          page_size: this.pageSize,
+        },
+      })
+        .then((res) => {
+          this.tableData = res.data.data;
+          this.total = res.data.total;
+          // console.log(res)
+        })
+        .catch((err) => {});
     },
-    handleSet (type, row, index) {
-      // 1新增 2详情 3编辑 4删除 5审批 
+    handleSet(type, row, index) {
+      // 1新增 2详情 3编辑 4删除 5审批
       switch (type) {
         case 1:
         case 3:
-          this.handleGoPage(type, row.order_red_no,row.is_refer)
-          break
+          this.handleGoPage(type, row.order_red_no, row.is_refer);
+          break;
         case 2:
-          this.handleGoPage(type, row.order_red_no,row.is_refer)
+          this.handleGoPage(type, row.order_red_no, row.is_refer);
           break;
         case 4:
           this.$Modal.confirm({
-            title: '确认删除?',
-            content: '此操作无法恢复,请确认!',
+            title: "确认删除?",
+            content: "此操作无法恢复,请确认!",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_red_out_del',
+                method: "get",
+                url: "/api/warehouse_order_red_out_del",
                 params: {
-                  order_red_no: row.order_red_no
-                }
-              }).then((res) => {
-                if(res.code==200){
-                this.$Message.success(res.msg)
-                this.initData()}
-              }).catch((err) => { });
+                  order_red_no: row.order_red_no,
+                },
+              })
+                .then((res) => {
+                  if (res.code == 200) {
+                    this.$Message.success(res.msg);
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
         case 5:
           this.$Modal.confirm({
-            title:row.state==1?'确认弃审?':'确认审批?',
+            title: row.state == 1 ? "确认弃审?" : "确认审批?",
             onOk: () => {
               this.axios({
-                method: 'get',
-                url: '/api/warehouse_order_red_out_check',
+                method: "get",
+                url: "/api/warehouse_order_red_out_check",
                 params: {
                   order_red_no: row.order_red_no,
-                  state: row.state==1?0:1
-                }
-              }).then((res) => {
-                // this.$Message.success(res.msg)
-                if(res.code==200){
-                this.initData()}
-              }).catch((err) => { });
+                  state: row.state == 1 ? 0 : 1,
+                },
+              })
+                .then((res) => {
+                  // this.$Message.success(res.msg)
+                  if (res.code == 200) {
+                    this.initData();
+                  }
+                })
+                .catch((err) => {});
             },
-            onCancel: () => { }
-          })
+            onCancel: () => {},
+          });
           break;
       }
     },
-    handleGoPage (type, order_red_no,is_refer) {
-      if(type==1||type==3){
+    handleGoPage(type, order_red_no, is_refer) {
+      if (type == 1 || type == 3) {
         this.$router.push({
-        path: '/cms/PurchasingManage/redFontOutstockOrder/edit',
-        query: {
-          type,
-          order_red_no,
-          is_refer
-        }
-      })
-      }else{
+          path: "/cms/PurchasingManage/redFontOutstockOrder/edit",
+          query: {
+            type,
+            order_red_no,
+            is_refer,
+          },
+        });
+      } else {
         this.$router.push({
-          path:'/cms/PurchasingManage/redFontOutstockOrder/detail',
-          query:{
+          path: "/cms/PurchasingManage/redFontOutstockOrder/detail",
+          query: {
             order_red_no,
-          }
-        })
+          },
+        });
       }
     },
-    changeSize (e) {
+    changeSize(e) {
       this.pageSize = e;
-      this.initData()
+      this.initData();
     },
-    changePage (e) {
+    changePage(e) {
       this.pageIndex = e;
-      this.initData()
-    }
+      this.initData(this.newSearchData);
+    },
   },
-    beforeRouteLeave(to, from, next) {
-    if (
-      to.path == "/cms/PurchasingManage/redFontOutstockOrder/detail" ||
-      to.path == "/cms/PurchasingManage/redFontOutstockOrder/edit"
-    ) {
+  // beforeRouteLeave(to, from, next) {
+  //   if (
+  //     to.path == "/cms/PurchasingManage/redFontOutstockOrder/detail" ||
+  //     to.path == "/cms/PurchasingManage/redFontOutstockOrder/edit"
+  //   ) {
+  //     next();
+  //   } else {
+  //     from.meta.keepAlive = false;
+  //     next();
+  //   }
+  // },
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/PurchasingManage/redFontOutstockOrder/detail") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      localStorage.setItem("pageIndex", this.pageIndex);
+      next();
+    } else if (to.path == "/cms/PurchasingManage/redFontOutstockOrder/edit") {
+      localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      if (to.query.type == 3) {
+        localStorage.setItem("pageIndex", this.pageIndex);
+        localStorage.setItem("searchData", JSON.stringify(this.searchData));
+      } else {
+        let form = this.newSearchData;
+        Object.keys(form).forEach((key) => (form[key] = ""));
+        localStorage.setItem("searchData", form);
+        localStorage.setItem("newSearchData", form);
+        localStorage.setItem("pageIndex", 1);
+        localStorage.removeItem("searchData");
+        localStorage.removeItem("pageIndex");
+        localStorage.removeItem("newSearchData");
+      }
       next();
     } else {
-      from.meta.keepAlive = false;
+      localStorage.removeItem("searchData");
+      localStorage.removeItem("pageIndex");
       next();
     }
   },
@@ -392,22 +549,22 @@ export default {
   computed: {},
   // 监控data中的数据变化
   watch: {},
-  beforeCreate () { }, // 生命周期 - 创建之前
-  beforeMount () { }, // 生命周期 - 挂载之前
-  beforeUpdate () { }, // 生命周期 - 更新之前
-  updated () { }, // 生命周期 - 更新之后
-  beforeDestroy () { }, // 生命周期 - 销毁之前
-  destroyed () { }, // 生命周期 - 销毁完成
-  activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
-}
+  beforeCreate() {}, // 生命周期 - 创建之前
+  beforeMount() {}, // 生命周期 - 挂载之前
+  beforeUpdate() {}, // 生命周期 - 更新之前
+  updated() {}, // 生命周期 - 更新之后
+  beforeDestroy() {}, // 生命周期 - 销毁之前
+  destroyed() {}, // 生命周期 - 销毁完成
+  activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
+};
 </script>
 
 <style lang='scss' scoped>
-.addBtn{
-   display: flex;
-   flex-direction:row-reverse;
+.addBtn {
+  display: flex;
+  flex-direction: row-reverse;
 }
-.instock_order{
+.instock_order {
   height: 100%;
 }
 .instock_order_search {
@@ -428,16 +585,14 @@ export default {
   .instock_order_content_btn {
     display: flex;
     justify-content: flex-end;
-   
   }
- 
 }
- .instock_order_content_page {
-    display: flex;
-    justify-content: center;
-    padding-top: 20px;
-  }
-  .instock_order_content_table{
-    margin-top:10px ;
-  }
+.instock_order_content_page {
+  display: flex;
+  justify-content: center;
+  padding-top: 20px;
+}
+.instock_order_content_table {
+  margin-top: 10px;
+}
 </style>

+ 580 - 381
src/views/SealApprove/list.vue

@@ -1,420 +1,619 @@
 <template>
-    <div>
-       <Toptitle title="印章审批">
-           <Button type="primary" style="margin-right:10px">导出</Button>
-         <Dropdown  trigger="click" @on-click='handleTotalAll'>
-     <Button type="primary">批量<Icon type="ios-arrow-down" style="padding-left:10px"/></Button>
+  <div>
+    <Toptitle title="印章审批">
+      <Button type="primary" style="margin-right: 10px">导出</Button>
+      <Dropdown trigger="click" @on-click="handleTotalAll">
+        <Button type="primary"
+          >批量<Icon type="ios-arrow-down" style="padding-left: 10px"
+        /></Button>
         <DropdownMenu slot="list">
-            <DropdownItem name='1'>提交审批</DropdownItem>
-            <DropdownItem name='2'>审批</DropdownItem>
-            <DropdownItem name='3'>删除</DropdownItem>
-             <DropdownItem name='4'>打印</DropdownItem>
+          <DropdownItem name="1">提交审批</DropdownItem>
+          <DropdownItem name="2">审批</DropdownItem>
+          <DropdownItem name="3">删除</DropdownItem>
+          <DropdownItem name="4">打印</DropdownItem>
         </DropdownMenu>
-    </Dropdown>
-       </Toptitle>
-       <div class="content">
-       <Form class="form_content" :label-width='120'>
-           <FormItem label='单据编号:'>
-               <Input class="form_item" placeholder="请搜索" v-model="searchData.seal_no" clearable/>
-           </FormItem>
-           <FormItem label='用印单位:'>
-               <Input class="form_item" placeholder="请搜索" v-model="searchData.project_title" clearable/>
-           </FormItem>
-           <FormItem label='用印人:'>
-               <Select class="form_item" v-model="searchData.user_id" filterable clearable>
-                   <Option v-for="item in users" :key='item.id' :value="item.id" :label="item.nickname"/>
-               </Select>
-           </FormItem>
-           <FormItem label='部门负责人:'>
-               <Select class="form_item" v-model="searchData.section_id" filterable clearable>
-                   <Option v-for="item in users" :key='item.id' :value="item.id" :label="item.nickname"/>
-               </Select>
-           </FormItem>
-           <FormItem label='待审人:'>
-               <Select class="form_item" v-model="searchData.pend_id" filterable clearable>
-                   <Option v-for="item in users" :key='item.id' :value="item.id" :label="item.nickname"/>
-               </Select>
-           </FormItem>
-           <FormItem label='审批人:'>
-                <Select class="form_item" v-model="searchData.check_id" filterable clearable>
-                   <Option v-for="item in users" :key='item.id' :value="item.id" :label="item.nickname"/>
-               </Select>
-           </FormItem>
-           <FormItem label='审批状态:'>
-                  <Select class="form_item" v-model="searchData.state" filterable clearable>
-                      <Option :value="0" label="未提交审批"/>
-                      <Option :value="1" label="已提交未审批"/>
-                        <Option :value="2" label='已审批'/>
-                  </Select>
-           </FormItem>
-           <FormItem label='申请用印时间:' style="width:100%">
-                  <DatePicker type="date" placeholder="年/月/日" class="form_item" v-model="searchData.start_time"></DatePicker>~
-                  <DatePicker type="date" placeholder="年/月/日" class="form_item" v-model="searchData.end_time"></DatePicker>
-           </FormItem>
-           <FormItem label='审批用印时间:'>
-                  <DatePicker type="date" placeholder="年/月/日" class="form_item" v-model="searchData.start_check_time"></DatePicker>~
-                  <DatePicker type="date" placeholder="年/月/日" class="form_item" v-model="searchData.end_check_time"></DatePicker>
-           </FormItem>
-           <FormItem :label-width='50'>
-               <Button type="primary" @click="initData(searchData)">搜索</Button>
-           </FormItem>
-       </Form>
-       <div class="before_table"><Button type="primary" @click="goPage(1)">新增</Button></div>
-       <Table :data='tableData' :columns='tableColumns' border max-height='550' @on-selection-change='DataSelect' :loading='loading'>
-              <template slot="set" slot-scope="{row}">
-                  <a style="margin-right:10px" v-show="row.state==0||row.state==2" @click='handelSet(row,1)'>提交审批</a>
-                    <a style="margin-right:10px" v-show="row.state==2" @click='handelSet(row,2)'>弃审</a>
-                   <a style="margin-right:10px" v-show="row.state==1" @click='handelSet(row,1)'>审批</a>
-                     <a style="margin-right:10px" v-show="row.state==1" @click='handelSet(row,2)'>撤销提交</a>
-                  <a style="margin-right:10px" @click="goPage(3,row)">详情</a>
-                  <a @click="goPage(2,row)" style="margin-right:10px" v-show="row.state==0">编辑</a>
-                  <a style="margin-right:10px" v-show="row.state==0" @click="handleDel(row)">删除</a>
-                  <a>打印</a>
-              </template>
-       </Table>
-       </div>
-         <div class="pageSlotStyle">
-        <Page :page-size-opts="[10, 20, 30, 40,100,1000]"
-              @on-page-size-change='changeSize'
-              @on-change='changePage'
-              :current='page_index'
-              show-total
-              :total="total"
-              show-sizer
-              :page-size='page_size' />
+      </Dropdown>
+    </Toptitle>
+    <div class="content">
+      <Form class="form_content" :label-width="120">
+        <FormItem label="单据编号:">
+          <Input
+            class="form_item"
+            placeholder="请搜索"
+            v-model="searchData.seal_no"
+            clearable
+          />
+        </FormItem>
+        <FormItem label="用印单位:">
+          <Input
+            class="form_item"
+            placeholder="请搜索"
+            v-model="searchData.project_title"
+            clearable
+          />
+        </FormItem>
+        <FormItem label="用印人:">
+          <Select
+            class="form_item"
+            v-model="searchData.user_id"
+            filterable
+            clearable
+          >
+            <Option
+              v-for="item in users"
+              :key="item.id"
+              :value="item.id"
+              :label="item.nickname"
+            />
+          </Select>
+        </FormItem>
+        <FormItem label="部门负责人:">
+          <Select
+            class="form_item"
+            v-model="searchData.section_id"
+            filterable
+            clearable
+          >
+            <Option
+              v-for="item in users"
+              :key="item.id"
+              :value="item.id"
+              :label="item.nickname"
+            />
+          </Select>
+        </FormItem>
+        <FormItem label="待审人:">
+          <Select
+            class="form_item"
+            v-model="searchData.pend_id"
+            filterable
+            clearable
+          >
+            <Option
+              v-for="item in users"
+              :key="item.id"
+              :value="item.id"
+              :label="item.nickname"
+            />
+          </Select>
+        </FormItem>
+        <FormItem label="审批人:">
+          <Select
+            class="form_item"
+            v-model="searchData.check_id"
+            filterable
+            clearable
+          >
+            <Option
+              v-for="item in users"
+              :key="item.id"
+              :value="item.id"
+              :label="item.nickname"
+            />
+          </Select>
+        </FormItem>
+        <FormItem label="审批状态:">
+          <Select
+            class="form_item"
+            v-model="searchData.state"
+            filterable
+            clearable
+          >
+            <Option :value="0" label="未提交审批" />
+            <Option :value="1" label="已提交未审批" />
+            <Option :value="2" label="已审批" />
+          </Select>
+        </FormItem>
+        <FormItem label="申请用印时间:" style="width: 100%">
+          <DatePicker
+            type="date"
+            placeholder="年/月/日"
+            class="form_item"
+            v-model="searchData.start_time"
+          ></DatePicker
+          >~
+          <DatePicker
+            type="date"
+            placeholder="年/月/日"
+            class="form_item"
+            v-model="searchData.end_time"
+          ></DatePicker>
+        </FormItem>
+        <FormItem label="审批用印时间:">
+          <DatePicker
+            type="date"
+            placeholder="年/月/日"
+            class="form_item"
+            v-model="searchData.start_check_time"
+          ></DatePicker
+          >~
+          <DatePicker
+            type="date"
+            placeholder="年/月/日"
+            class="form_item"
+            v-model="searchData.end_check_time"
+          ></DatePicker>
+        </FormItem>
+        <FormItem :label-width="50">
+          <Button type="primary" @click="initData(searchData)">搜索</Button>
+        </FormItem>
+      </Form>
+      <div class="before_table">
+        <Button type="primary" @click="goPage(1)">新增</Button>
       </div>
-      <Modal title="提交审批" v-model="show_submit">
-          <Form :label-width='100'>
-              <FormItem label="审批人:">
-                  <Select v-model="check_id">
-                      <Option v-for="item in users" :key='item.id' :value="item.id" :label="item.nickname"></Option>
-                  </Select>
-              </FormItem>
-          </Form>
-          <div slot="footer">
-              <Button type="primary" ghost @click="show_submit=false">取消</Button>
-              <Button type="primary" @click="submit">确认</Button>
-              
-          </div>
-      </Modal>
+      <Table
+        :data="tableData"
+        :columns="tableColumns"
+        border
+        max-height="550"
+        @on-selection-change="DataSelect"
+        :loading="loading"
+      >
+        <template slot="set" slot-scope="{ row }">
+          <a
+            style="margin-right: 10px"
+            v-show="row.state == 0 || row.state == 2"
+            @click="handelSet(row, 1)"
+            >提交审批</a
+          >
+          <a
+            style="margin-right: 10px"
+            v-show="row.state == 2"
+            @click="handelSet(row, 2)"
+            >弃审</a
+          >
+          <a
+            style="margin-right: 10px"
+            v-show="row.state == 1"
+            @click="handelSet(row, 1)"
+            >审批</a
+          >
+          <a
+            style="margin-right: 10px"
+            v-show="row.state == 1"
+            @click="handelSet(row, 2)"
+            >撤销提交</a
+          >
+          <a style="margin-right: 10px" @click="goPage(3, row)">详情</a>
+          <a
+            @click="goPage(2, row)"
+            style="margin-right: 10px"
+            v-show="row.state == 0"
+            >编辑</a
+          >
+          <a
+            style="margin-right: 10px"
+            v-show="row.state == 0"
+            @click="handleDel(row)"
+            >删除</a
+          >
+          <a>打印</a>
+        </template>
+      </Table>
     </div>
+    <div class="pageSlotStyle">
+      <Page
+        :page-size-opts="[10, 20, 30, 40, 100, 1000]"
+        @on-page-size-change="changeSize"
+        @on-change="changePage"
+        :current="page_index"
+        show-total
+        :total="total"
+        show-sizer
+        :page-size="page_size"
+      />
+    </div>
+    <Modal title="提交审批" v-model="show_submit">
+      <Form :label-width="100">
+        <FormItem label="审批人:">
+          <Select v-model="check_id">
+            <Option
+              v-for="item in users"
+              :key="item.id"
+              :value="item.id"
+              :label="item.nickname"
+            ></Option>
+          </Select>
+        </FormItem>
+      </Form>
+      <div slot="footer">
+        <Button type="primary" ghost @click="show_submit = false">取消</Button>
+        <Button type="primary" @click="submit">确认</Button>
+      </div>
+    </Modal>
+  </div>
 </template>
 <script>
 export default {
-    data(){
-        return{
-            loading:false,
-            submit_state:false,
-            searchData:{
-                  seal_no:'',
-                  project_title:'',
-                  user_id:'',
-                  section_id:'',
-                  pend_id:'',
-                  check_id:'',
-                  state:'',
-                  start_time:'',
-                  end_time:'',
-                  start_check_time:'',
-                  end_check_time:'',
-            },
-            chooseData:{},
-            check_id:'',
-            users:[],
-            show_submit:false,
-            page_index:1,
-            page_size:10,
-            total:0,
-            selectData:[],
-            tableData:[],
-            tableColumns:[
-                {type:'selection',minWidth:80,align:'center'},
-                {type:'index',minWidth:80,align:'center',title:'序号'},
-                {title:'单据编号',align:'center',minWidth:140,key:'seal_no'},
-                {title:'用印单位(项目)',align:'center',minWidth:150,key:'project_title'},
-                {title:'申请用印时间',align:'center',minWidth:130,key:'user_time',render:(h,params)=>{
-                    const {row} = params;
-                    return h('span',{},this.func.replaceDateNoHMS(row.user_time))
-                }},
-                {title:'申请用印内容',align:'center',minWidth:130,key:'content',ellipsis:true,tooltip:true},
-                {title:'用印人',align:'center',minWidth:120,key:'user_name'},
-                {title:'部门负责人',align:'center',minWidth:120,key:'section_name'},
-                {title:'审批状态',align:'center',minWidth:140,key:'state',render:(h,params)=>{
-                    const {row} = params;
-                    const text = row.state==0?'未提交审批':row.state==1?'已提交未审批':'已审批';
-                    return h('span',{},text)
-                }},
-                {title:'待审人',align:'center',minWidth:120,key:'pend_name'},
-                {title:'审批人',align:'center',minWidth:120,key:'check_name'},
-                {title:'审批用印时间',align:'center',minWidth:130,key:'check_time',render:(h,params)=>{
-                    const {row} = params;
-                    return h('span',{},this.func.replaceDateNoHMS(row.check_time))
-                }},
-                {title:'操作',align:'center',minWidth:300,key:'',slot:'set'}
-            ]
-        }
-    },
-    created(){
-         //获取人员列表
-        this.axios.get('/api/user').then(res=>{
-            this.users = res.data.data
-        })
-    },
-    mounted(){
-     this.initData();
-    },
-    methods:{
-        handleTotalAll(name){
-             switch(name){
-                 case "1":
-                       if(this.selectData.length==0){
-                        return this.$Message.warning('请先选择数据!');
-                    }
-                    let arr = [];
-                    arr = this.selectData.filter(v=>{
-                        return v.state==0||v.state==2
-                    })
-                    if(arr.length != this.selectData.length){
-                        return this.$Message.warning('数据中有不能提交审批的数据!')
-                    }
-                    console.log(arr);
-                    let state = false;
-                    arr.forEach(v=>{
-                        if(v.state!=arr[0].state){
-                            state = true;
-                        }
-                    })
-                    if(state){
-                       return this.$Message.warning('请选择状态相同的数据!')
-                    }
-                   this.show_submit = true;
-                       this.submit_state = true;
-                   this.check_id='';
-                    break;
-                case '2':
-                    if(this.selectData.length==0){
-                        return this.$Message.warning('请先选择数据!');
-                    };
-                    let ar = [];
-                    ar = this.selectData.filter(v=>{
-                        return v.state == 1;
-                    })
-                    if(ar.length!=this.selectData.length){
-                        return this.$Message.warning('数据中有不能审批的数据!')
-                    }
-                     this.confirmDelete({
-        title:'确认?',
-        content: "确认审批?",
-        then: () => {
-                    let seal_no = [];
-                    this.selectData.forEach(v=>{
-                        seal_no.push(v.seal_no);
-                    })
-                       this.axios.post('/api/seal_check',{seal_no,id:JSON.parse(localStorage.getItem('user_info')).id,state:1}).then(res=>{
-                              if(res.code==200){
-                        this.$Message.success(res.msg);
-                        this.initData(this.searchData);
-                    }
-                        })
-        }
-                     })
-                    break;
-                case '3':
-                     if(this.selectData.length==0){
-                        return this.$Message.warning('请先选择数据!');
-                    };
-                    let stateData = this.selectData.filter(v=>{
-                        return v.state == 1||v.state == 2;
-                    });
-                   if(stateData.length!=0){
-                       return this.$Message.warning('数据中有不能删除的数据,请重新选择!')
-                   }
-                   let seal = [];
-                   this.selectData.forEach(v=>{
-                       seal.push(v.seal_no);
-                   })
-                      this.confirmDelete({
-        content: "确认删除么?",
-        then: () => {
-          this.axios
-            .post("/api/seal_del", { seal_no:seal})
-            .then((res) => {
-              if (res.code == 200) {
-                    if(this.page_index!=1||this.tableData.length==1){
-                        this.page_index--;
-                }
-                this.$Message.success(res.msg);
-                this.initData(this.searchData);
-              }
-            });
+  data() {
+    return {
+      loading: false,
+      submit_state: false,
+      searchData: {
+        seal_no: "",
+        project_title: "",
+        user_id: "",
+        section_id: "",
+        pend_id: "",
+        check_id: "",
+        state: "",
+        start_time: "",
+        end_time: "",
+        start_check_time: "",
+        end_check_time: "",
+      },
+      chooseData: {},
+      check_id: "",
+      users: [],
+      show_submit: false,
+      page_index: 1,
+      page_size: 10,
+      total: 0,
+      selectData: [],
+      tableData: [],
+      tableColumns: [
+        { type: "selection", minWidth: 80, align: "center" },
+        { type: "index", minWidth: 80, align: "center", title: "序号" },
+        { title: "单据编号", align: "center", minWidth: 140, key: "seal_no" },
+        {
+          title: "用印单位(项目)",
+          align: "center",
+          minWidth: 150,
+          key: "project_title",
         },
-      });
-                    break;
-                case '4':
-                     if(this.selectData.length==0){
-                        return this.$Message.warning('请先选择数据!');
-                    };
-                    break;
-             }
+        {
+          title: "申请用印时间",
+          align: "center",
+          minWidth: 130,
+          key: "user_time",
+          render: (h, params) => {
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.user_time));
+          },
         },
-        handleDel(row){
-              this.confirmDelete({
-        content: "确认删除么?",
-        then: () => {
-          this.axios
-            .post("/api/seal_del", { seal_no:[row.seal_no]})
-            .then((res) => {
-              if (res.code == 200) {
-                this.$Message.success(res.msg);
-                if(this.page_index!=1||this.tableData.length==1){
-                        this.page_index--;
-                }
-                this.initData(this.searchData);
-              }
-            });
+        {
+          title: "申请用印内容",
+          align: "center",
+          minWidth: 130,
+          key: "content",
+          ellipsis: true,
+          tooltip: true,
         },
-      });
+        { title: "用印人", align: "center", minWidth: 120, key: "user_name" },
+        {
+          title: "部门负责人",
+          align: "center",
+          minWidth: 120,
+          key: "section_name",
         },
-        changePage(e){
-            this.page_index = e;
-            this.initData(this.searchData);
+        {
+          title: "审批状态",
+          align: "center",
+          minWidth: 140,
+          key: "state",
+          render: (h, params) => {
+            const { row } = params;
+            const text =
+              row.state == 0
+                ? "未提交审批"
+                : row.state == 1
+                ? "已提交未审批"
+                : "已审批";
+            return h("span", {}, text);
+          },
         },
-        changeSize(e){
-          this.page_size = e;
-          this.page_index =1;
-          this.initData(this.searchData);
+        { title: "待审人", align: "center", minWidth: 120, key: "pend_name" },
+        { title: "审批人", align: "center", minWidth: 120, key: "check_name" },
+        {
+          title: "审批用印时间",
+          align: "center",
+          minWidth: 130,
+          key: "check_time",
+          render: (h, params) => {
+            const { row } = params;
+            return h("span", {}, this.func.replaceDateNoHMS(row.check_time));
+          },
         },
-        submit(){
-            if(!this.check_id){
-                return this.$Message.warning('请选择审批人!')
+        { title: "操作", align: "center", minWidth: 300, key: "", slot: "set" },
+      ],
+    };
+  },
+  created() {
+    //获取人员列表
+    this.axios.get("/api/user").then((res) => {
+      this.users = res.data.data;
+    });
+  },
+  mounted() {
+    this.initData();
+  },
+  methods: {
+    handleTotalAll(name) {
+      switch (name) {
+        case "1":
+          if (this.selectData.length == 0) {
+            return this.$Message.warning("请先选择数据!");
+          }
+          let arr = [];
+          arr = this.selectData.filter((v) => {
+            return v.state == 0 || v.state == 2;
+          });
+          if (arr.length != this.selectData.length) {
+            return this.$Message.warning("数据中有不能提交审批的数据!");
+          }
+          console.log(arr);
+          let state = false;
+          arr.forEach((v) => {
+            if (v.state != arr[0].state) {
+              state = true;
             }
-               if(this.submit_state){
-                   let seal_no = [];
-                   this.selectData.forEach(v=>{
-                        seal_no.push(v.seal_no);
-                   })
-                      this.axios.post('/api/seal_check',{id:this.check_id,seal_no,state:this.selectData[0].state}).then(res=>{
-                    if(res.code==200){
-                        this.$Message.success(res.msg);
-                        this.initData(this.searchData);
-                        this.check_id = '';
-                        this.show_submit = false;
-                        this.submit_state = false;
-                    }
-                })
-               }else{
-                    this.axios.post('/api/seal_check',{id:this.check_id,seal_no:[this.chooseData.seal_no],state:this.chooseData.state}).then(res=>{
-                    if(res.code==200){
-                        this.$Message.success(res.msg);
-                        this.initData(this.searchData);
-                        this.check_id = '';
-                        this.show_submit = false;
-                    }
+          });
+          if (state) {
+            return this.$Message.warning("请选择状态相同的数据!");
+          }
+          this.show_submit = true;
+          this.submit_state = true;
+          this.check_id = "";
+          break;
+        case "2":
+          if (this.selectData.length == 0) {
+            return this.$Message.warning("请先选择数据!");
+          }
+          let ar = [];
+          ar = this.selectData.filter((v) => {
+            return v.state == 1;
+          });
+          if (ar.length != this.selectData.length) {
+            return this.$Message.warning("数据中有不能审批的数据!");
+          }
+          this.confirmDelete({
+            title: "确认?",
+            content: "确认审批?",
+            then: () => {
+              let seal_no = [];
+              this.selectData.forEach((v) => {
+                seal_no.push(v.seal_no);
+              });
+              this.axios
+                .post("/api/seal_check", {
+                  seal_no,
+                  id: JSON.parse(localStorage.getItem("user_info")).id,
+                  state: 1,
                 })
-               }
-               
-        },
-        handelSet(row,type){
-          switch(type){
-              case 1:
-                  if(row.state == 0||row.state == 2){
-                       this.show_submit = true;
-                  this.chooseData = row;
-                  }else{
-                      this.confirmDelete({
-        title:'确认?',
-        content: "确认审批?",
-        then: () => {
-                        this.axios.post('/api/seal_check',{seal_no:[row.seal_no],id:JSON.parse(localStorage.getItem('user_info')).id,state:row.state}).then(res=>{
-                              if(res.code==200){
-                        this.$Message.success(res.msg);
-                        this.initData(this.searchData);
+                .then((res) => {
+                  if (res.code == 200) {
+                    this.$Message.success(res.msg);
+                    this.initData(this.searchData);
+                  }
+                });
+            },
+          });
+          break;
+        case "3":
+          if (this.selectData.length == 0) {
+            return this.$Message.warning("请先选择数据!");
+          }
+          let stateData = this.selectData.filter((v) => {
+            return v.state == 1 || v.state == 2;
+          });
+          if (stateData.length != 0) {
+            return this.$Message.warning(
+              "数据中有不能删除的数据,请重新选择!"
+            );
+          }
+          let seal = [];
+          this.selectData.forEach((v) => {
+            seal.push(v.seal_no);
+          });
+          this.confirmDelete({
+            content: "确认删除么?",
+            then: () => {
+              this.axios
+                .post("/api/seal_del", { seal_no: seal })
+                .then((res) => {
+                  if (res.code == 200) {
+                    if (this.page_index != 1 || this.tableData.length == 1) {
+                      this.page_index--;
                     }
-                        
-            })
-        }
-                  })
+                    this.$Message.success(res.msg);
+                    this.initData(this.searchData);
                   }
-                  break;
-             case 2:
-                      this.confirmDelete({
-        title:'确认',
-        content: `${row.state==1?'确定撤销提交吗?':'确定弃审吗?'}`,
+                });
+            },
+          });
+          break;
+        case "4":
+          if (this.selectData.length == 0) {
+            return this.$Message.warning("请先选择数据!");
+          }
+          break;
+      }
+    },
+    handleDel(row) {
+      this.confirmDelete({
+        content: "确认删除么?",
         then: () => {
           this.axios
-            .post("/api/seal_un_check", { seal_no:row.seal_no,state: row.state })
+            .post("/api/seal_del", { seal_no: [row.seal_no] })
             .then((res) => {
               if (res.code == 200) {
                 this.$Message.success(res.msg);
+                if (this.page_index != 1 || this.tableData.length == 1) {
+                  this.page_index--;
+                }
                 this.initData(this.searchData);
-                // this.undata_navData();
               }
             });
         },
       });
-                 break
-          }
-        },
-        initData(row){
-            let obj = {};
-            if(row){
-                obj = JSON.parse(JSON.stringify(row));
-                obj.start_check_time = obj.start_check_time?Date.parse(obj.start_check_time).toString().slice(0,10):'';
-                obj.end_check_time = obj.end_check_time?Date.parse(obj.end_check_time).toString().slice(0,10):'';
-                obj.start_time = obj.start_time?Date.parse(obj.start_time).toString().slice(0,10):'';
-                obj.end_time = obj.end_time?Date.parse(obj.end_time).toString().slice(0,10):'';
+    },
+    changePage(e) {
+      this.page_index = e;
+      this.initData(this.searchData);
+    },
+    changeSize(e) {
+      this.page_size = e;
+      this.page_index = 1;
+      this.initData(this.searchData);
+    },
+    submit() {
+      if (!this.check_id) {
+        return this.$Message.warning("请选择审批人!");
+      }
+      if (this.submit_state) {
+        let seal_no = [];
+        this.selectData.forEach((v) => {
+          seal_no.push(v.seal_no);
+        });
+        this.axios
+          .post("/api/seal_check", {
+            id: this.check_id,
+            seal_no,
+            state: this.selectData[0].state,
+          })
+          .then((res) => {
+            if (res.code == 200) {
+              this.$Message.success(res.msg);
+              this.initData(this.searchData);
+              this.check_id = "";
+              this.show_submit = false;
+              this.submit_state = false;
             }
-            this.loading = true;
-          this.axios.post('/api/seal_list',{...obj}).then(res=>{
-              this.tableData = res.data.data;
-              this.total = res.data.total;
-              this.loading = false;
+          });
+      } else {
+        this.axios
+          .post("/api/seal_check", {
+            id: this.check_id,
+            seal_no: [this.chooseData.seal_no],
+            state: this.chooseData.state,
           })
-        },
-        DataSelect(e){
-  this.selectData = e;
-        },
-        goPage(type,row){
-            if(type==1){
-                 this.$router.push({path:'/cms/SealApprove/edit',query:{type}})
-            }else{
-                 this.$router.push({path:'/cms/SealApprove/edit',query:{type,seal_no:row.seal_no,state:row.state}})
+          .then((res) => {
+            if (res.code == 200) {
+              this.$Message.success(res.msg);
+              this.initData(this.searchData);
+              this.check_id = "";
+              this.show_submit = false;
             }
-          
-        },
-        beforeRouteLeave(to, from, next) {
-          if (
-            to.path == "/cms/SealApprove/edit"
-          ) {
-            next();
+          });
+      }
+    },
+    handelSet(row, type) {
+      switch (type) {
+        case 1:
+          if (row.state == 0 || row.state == 2) {
+            this.show_submit = true;
+            this.chooseData = row;
           } else {
-            from.meta.keepAlive = false;
-            next();
+            this.confirmDelete({
+              title: "确认?",
+              content: "确认审批?",
+              then: () => {
+                this.axios
+                  .post("/api/seal_check", {
+                    seal_no: [row.seal_no],
+                    id: JSON.parse(localStorage.getItem("user_info")).id,
+                    state: row.state,
+                  })
+                  .then((res) => {
+                    if (res.code == 200) {
+                      this.$Message.success(res.msg);
+                      this.initData(this.searchData);
+                    }
+                  });
+              },
+            });
           }
-        }
+          break;
+        case 2:
+          this.confirmDelete({
+            title: "确认",
+            content: `${row.state == 1 ? "确定撤销提交吗?" : "确定弃审吗?"}`,
+            then: () => {
+              this.axios
+                .post("/api/seal_un_check", {
+                  seal_no: row.seal_no,
+                  state: row.state,
+                })
+                .then((res) => {
+                  if (res.code == 200) {
+                    this.$Message.success(res.msg);
+                    this.initData(this.searchData);
+                    // this.undata_navData();
+                  }
+                });
+            },
+          });
+          break;
+      }
+    },
+    initData(row) {
+      let obj = {};
+      if (row) {
+        obj = JSON.parse(JSON.stringify(row));
+        obj.start_check_time = obj.start_check_time
+          ? Date.parse(obj.start_check_time).toString().slice(0, 10)
+          : "";
+        obj.end_check_time = obj.end_check_time
+          ? Date.parse(obj.end_check_time).toString().slice(0, 10)
+          : "";
+        obj.start_time = obj.start_time
+          ? Date.parse(obj.start_time).toString().slice(0, 10)
+          : "";
+        obj.end_time = obj.end_time
+          ? Date.parse(obj.end_time).toString().slice(0, 10)
+          : "";
+      }
+      this.loading = true;
+      this.axios.post("/api/seal_list", { ...obj }).then((res) => {
+        this.tableData = res.data.data;
+        this.total = res.data.total;
+        this.loading = false;
+      });
+    },
+    DataSelect(e) {
+      this.selectData = e;
+    },
+    goPage(type, row) {
+      if (type == 1) {
+        this.$router.push({ path: "/cms/SealApprove/edit", query: { type } });
+      } else {
+        this.$router.push({
+          path: "/cms/SealApprove/edit",
+          query: { type, seal_no: row.seal_no, state: row.state },
+        });
+      }
+    },
+  },
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/SealApprove/edit") {
+      next();
+    } else {
+      from.meta.keepAlive = false;
+      next();
     }
-}
+  },
+};
 </script>
 <style lang="scss" scoped>
-.content{
-     height: 85%;
-     overflow: auto;
-     .form_content{
-         margin-top:10px;
-           display: flex;
-           flex-wrap: wrap;
-           .form_item{
-               width:200px
-           }
-     }
-     .before_table{
-         display: flex;
-         flex-direction: row-reverse;
-         margin-bottom: 10px;
-     }
+.content {
+  height: 85%;
+  overflow: auto;
+  .form_content {
+    margin-top: 10px;
+    display: flex;
+    flex-wrap: wrap;
+    .form_item {
+      width: 200px;
+    }
+  }
+  .before_table {
+    display: flex;
+    flex-direction: row-reverse;
+    margin-bottom: 10px;
+  }
 }
-.pageSlotStyle{
-    text-align: center;
-    margin-top:10px;
+.pageSlotStyle {
+  text-align: center;
+  margin-top: 10px;
 }
 </style>