Pārlūkot izejas kodu

添加token轮询刷新

lph 1 gadu atpakaļ
vecāks
revīzija
9a12b6cf81

+ 44 - 9
zkqy-ui/src/App.vue

@@ -1,29 +1,64 @@
 <template>
   <div id="app">
-    <router-view /> 
+    <router-view />
     <theme-picker />
   </div>
 </template>
 
 <script>
 import ThemePicker from "@/components/ThemePicker";
+import { refreshToken } from "@/api/login";
+import { getToken } from "@/utils/auth";
 
 export default {
   name: "App",
   components: { ThemePicker },
-    metaInfo() {
-        return {
-            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
-            titleTemplate: title => {
-                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
-            }
+  data() {
+    return {
+      timer: null,
+    };
+  },
+  methods: {
+    async startTokenRefresh() {
+      if (this.timer) {
+        clearInterval(this.timer);
+      }
+      let outTime = 5 * 60 * 60 * 1000;
+      this.timer = setInterval(async () => {
+        try {
+          if (!getToken()) return;
+          const response = await refreshToken();
+          console.log(object);
+        } catch (error) {
+          console.error("token刷新失败:", error);
         }
+      }, outTime);
+    },
+  },
+  mounted() {
+    this.startTokenRefresh();
+  },
+  beforeDestroy() {
+    if (this.timer) {
+      clearInterval(this.timer);
     }
+  },
+  metaInfo() {
+    return {
+      title:
+        this.$store.state.settings.dynamicTitle &&
+        this.$store.state.settings.title,
+      titleTemplate: (title) => {
+        return title
+          ? `${title} - ${process.env.VUE_APP_TITLE}`
+          : process.env.VUE_APP_TITLE;
+      },
+    };
+  },
 };
 </script>
-<style >
+<style>
 #app .theme-picker {
   display: none;
 }
-
 </style>

+ 10 - 0
zkqy-ui/src/api/login.js

@@ -71,3 +71,13 @@ export function getCodeImg() {
   })
 }
 
+// 刷新token
+export function refreshToken() {
+  return request({
+    url: '/dragform/common/refreshToken',
+    headers: {
+      isToken: true
+    },
+    method: 'get'
+  })
+}

+ 23 - 0
zkqy-ui/src/layout/index.vue

@@ -82,6 +82,8 @@ import variables from "@/assets/styles/variables.scss";
 import mecLogoLogin from "@/assets/images/mec-logo-login.svg";
 import mes412 from "@/assets/images/mes412.svg";
 
+import { refreshToken } from "@/api/login";
+
 export default {
   name: "Layout",
   components: {
@@ -97,6 +99,7 @@ export default {
       userName: "默认用户",
       title: "",
       logo: "",
+      timer: null,
     };
   },
   mixins: [ResizeMixin],
@@ -136,6 +139,20 @@ export default {
     },
   },
   methods: {
+    async startTokenRefresh() {
+      if (this.timer) {
+        clearInterval(this.timer);
+      }
+      let outTime = 5 * 60 * 60 * 1000;
+      this.timer = setInterval(async () => {
+        try {
+          const response = await refreshToken();
+          console.log(object);
+        } catch (error) {
+          console.error("token刷新失败:", error);
+        }
+      }, outTime);
+    },
     async logout() {
       // this.tenantInfo.tenantClientLoginUrl 退出登录后跳转到登录页面
       this.$confirm("确定注销并退出系统吗?", "提示", {
@@ -173,6 +190,12 @@ export default {
     var user = JSON.parse(user);
     this.userName = JSON.parse(user.data).username;
     this.getlogo();
+    // this.startTokenRefresh();
+  },
+  beforeDestroy() {
+    if (this.timer) {
+      clearInterval(this.timer);
+    }
   },
 };
 </script>

+ 19 - 11
zkqy-ui/src/router/index.js

@@ -54,6 +54,14 @@ export const constantRoutes = [
       }
     ]
   },
+  // {
+  //   path: '/planTable/index',
+  //   component: () => {
+  //     return import('@/views/orderMange/planTable/index')
+  //   },
+  //   hidden: true
+  // },
+
   {
     path: '/tableMange',
     component: Layout,
@@ -178,7 +186,7 @@ export const constantRoutes = [
         path: 'index',
         component: () => import('@/views/index'),
         name: 'Index',
-        meta: {title: '首页', icon: 'dashboard', affix: true}
+        meta: { title: '首页', icon: 'dashboard', affix: true }
       }
     ]
   },
@@ -192,7 +200,7 @@ export const constantRoutes = [
         path: 'profile',
         component: () => import('@/views/system/user/profile/index'),
         name: 'Profile',
-        meta: {title: '个人中心', icon: 'user'}
+        meta: { title: '个人中心', icon: 'user' }
       }
     ]
   },
@@ -211,7 +219,7 @@ export const dynamicRoutes = [
         path: 'role/:userId(\\d+)',
         component: () => import('@/views/system/data/index'),
         name: 'AuthRole',
-        meta: {title: '数据源配置', activeMenu: '/system/data'}
+        meta: { title: '数据源配置', activeMenu: '/system/data' }
       }
     ]
   },
@@ -225,7 +233,7 @@ export const dynamicRoutes = [
         path: 'role/:userId(\\d+)',
         component: () => import('@/views/system/user/authRole'),
         name: 'AuthRole',
-        meta: {title: '分配角色', activeMenu: '/system/user'}
+        meta: { title: '分配角色', activeMenu: '/system/user' }
       }
     ]
   },
@@ -239,7 +247,7 @@ export const dynamicRoutes = [
         path: 'fromModel/:index',
         component: () => import('@/views/system/fromModel/index'),
         name: 'fromModel',
-        meta: {title: '表单建模', activeMenu: '/system/fromModel/index'}
+        meta: { title: '表单建模', activeMenu: '/system/fromModel/index' }
       },
       // {
       //   path: '/fromModel/:index',
@@ -260,7 +268,7 @@ export const dynamicRoutes = [
         path: 'user/:roleId(\\d+)',
         component: () => import('@/views/system/role/authUser'),
         name: 'AuthUser',
-        meta: {title: '分配用户', activeMenu: '/system/role'}
+        meta: { title: '分配用户', activeMenu: '/system/role' }
       }
     ]
   },
@@ -274,7 +282,7 @@ export const dynamicRoutes = [
         path: 'index/:dictId(\\d+)',
         component: () => import('@/views/system/dict/data'),
         name: 'Data',
-        meta: {title: '字典数据', activeMenu: '/system/dict'}
+        meta: { title: '字典数据', activeMenu: '/system/dict' }
       }
     ]
   },
@@ -289,7 +297,7 @@ export const dynamicRoutes = [
         path: 'index/:dictId(\\d+)',
         component: () => import('@/views/system/tenant/dict/data'),
         name: 'TenantData',
-        meta: {title: '字典数据', activeMenu: '/system/tenant/dict'}
+        meta: { title: '字典数据', activeMenu: '/system/tenant/dict' }
       }
     ]
   },
@@ -304,7 +312,7 @@ export const dynamicRoutes = [
         path: 'index/:jobId(\\d+)',
         component: () => import('@/views/monitor/job/log'),
         name: 'JobLog',
-        meta: {title: '调度日志', activeMenu: '/monitor/job'}
+        meta: { title: '调度日志', activeMenu: '/monitor/job' }
       }
     ]
   },
@@ -318,7 +326,7 @@ export const dynamicRoutes = [
         path: 'index/:tableId(\\d+)',
         component: () => import('@/views/tool/gen/editTable'),
         name: 'GenEdit',
-        meta: {title: '修改生成配置', activeMenu: '/tool/gen'}
+        meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
       }
     ]
   }
@@ -339,6 +347,6 @@ Router.prototype.replace = function push(location) {
 
 export default new Router({
   mode: 'history', // 去掉url中的#
-  scrollBehavior: () => ({y: 0}),
+  scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })

+ 6 - 6
zkqy-ui/src/views/orderMange/approve.vue

@@ -362,7 +362,7 @@
                   </el-select>
                 </template>
               </el-table-column>
-              <el-table-column prop="productType" label="规格">
+              <el-table-column prop="productSpecifications" label="规格">
               </el-table-column>
               <el-table-column prop="productNumber" label="数量/kg">
                 <template slot-scope="scope">
@@ -1188,7 +1188,7 @@ export default {
         saleProductNo: uuidv4(),
         productNo: "", //货品编号
         productName: "", //货品名称
-        productType: "", //规格
+        productSpecifications: "", //规格
         productNumber: "", //销售数量
         productWeight: "", //销售重量kg
         productUnitPrice: "", //单价
@@ -1461,7 +1461,7 @@ export default {
           };
           this.productionTableData.forEach((item) => {
             item.saleOrderNo = saleNo;
-            delete item.productType;
+            delete item.productSpecifications;
           });
           let productData = {
             //货品表新增数据
@@ -1604,13 +1604,13 @@ export default {
           this.productIds = sale_products.map((item) => item.saleProductNo);
           await this.getDropDownData();
           this.productionTableData = sale_products.map((item) => {
-            item.productType = this.productionOptions.find(
+            item.productSpecifications = this.productionOptions.find(
               (i) => item.productNo == i.productNo
-            )?.productType;
+            )?.productSpecifications;
             return item;
           });
           this.title = "审批审计单";
-          this.approveForm.status=this.approveFormStatusLabel
+          this.approveForm.status = this.approveFormStatusLabel;
           this.open = true;
         }
       } catch (error) {

+ 0 - 1
zkqy-ui/src/views/orderMange/codeListManage/index.vue

@@ -845,7 +845,6 @@ export default {
         //   label: "订单号",
         // },
       ],
-
       // 自定义数据 end
 
       // 遮罩层

+ 20 - 18
zkqy-ui/src/views/orderMange/index.vue

@@ -432,13 +432,13 @@
                       }}</span>
                       <span
                         style="float: right; color: #8492a6; font-size: 13px"
-                        >{{ item.productType }}</span
+                        >{{ item.productSpecifications }}</span
                       >
                     </el-option>
                   </el-select>
                 </template>
               </el-table-column>
-              <el-table-column prop="productType" label="规格">
+              <el-table-column prop="productSpecifications" label="规格">
               </el-table-column>
               <el-table-column prop="productNumber" label="数量/kg">
                 <template slot-scope="scope">
@@ -877,13 +877,13 @@ export default {
             trigger: "change",
           },
         ],
-        lotNumber: [
-          {
-            required: true,
-            message: "请输入批号",
-            trigger: "blur",
-          },
-        ],
+        // lotNumber: [
+        //   {
+        //     required: true,
+        //     message: "请输入批号",
+        //     trigger: "blur",
+        //   },
+        // ],
         saleCustomNo: [
           {
             required: true,
@@ -1064,9 +1064,9 @@ export default {
       row.productName = this.productionOptions.find(
         (item) => item.productNo == productNo
       )?.productName;
-      row.productType = this.productionOptions.find(
+      row.productSpecifications = this.productionOptions.find(
         (item) => item.productNo == productNo
-      )?.productType;
+      )?.productSpecifications;
     },
     // 订单类型改变回调
     orderTypeChange(type) {
@@ -1164,7 +1164,7 @@ export default {
       this.productionTableData.push({
         saleProductNo: uuidv4(),
         productNo: "", //货品编号
-        productType: "", //货品类型
+        productSpecifications: "", //规格
         productName: "", //货品名称
         productNumber: "", //销售数量
         productWeight: "", //销售重量kg
@@ -1569,7 +1569,7 @@ export default {
             delete item.delFlag;
             delete item.sliceTypeLabel;
             delete item.colourNumberLabel;
-            delete item.productType; //删除产品类型
+            delete item.productSpecifications; //删除规格
             const matchedOption = this.colourNumberOptions.find(
               (option) => option.materielCode === item.colourNumber
             );
@@ -1582,7 +1582,7 @@ export default {
             item.taskName = taskName;
           });
           this.productionTableData.forEach((item) => {
-            delete item.productType; //删除产品类型
+            delete item.productSpecifications; //删除产品类型
           });
           let productData = {
             //货品表新增数据
@@ -1719,9 +1719,9 @@ export default {
 
           await this.getDropDownData();
           this.productionTableData = sale_products.map((item) => {
-            item.productType = this.productionOptions.find(
+            item.productSpecifications = this.productionOptions.find(
               (i) => item.productNo == i.productNo
-            )?.productType;
+            )?.productSpecifications;
             return item;
           });
           if (this.formData.saleCustomNo) {
@@ -2819,10 +2819,12 @@ export default {
             (k) => k.materielCode == item.colourNumber
           )?.materieColorNumber;
           let productName = productData ? productData.productName : "";
-          let productType = productData ? productData.productType : "";
+          let productSpecifications = productData
+            ? productData.productSpecifications
+            : "";
           printStr += `<tr align="center">
                     <td>${productName}</td>    
-                    <td>${productType}</td>    
+                    <td>${productSpecifications}</td>    
                     <td>${item.productNumber}</td>
                     <td>${item.productUnitPrice}</td>
                     <td>${item.productAmounts}</td>

+ 146 - 132
zkqy-ui/src/views/orderMange/outStock/index.vue

@@ -1,144 +1,156 @@
 <template>
-  <div class="app-container">
-    <div class="table-area">
-      <el-table
-        :data="leftTableData"
-        border
-        stripe
-        @selection-change="handleSelectionChange"
-        @cell-click="cellClick"
-      >
-        <el-table-column type="selection" width="55" />
-        <el-table-column type="index" label="序号" width="50" />
-        <el-table-column align="center" prop="customerName" label="客户名称">
-        </el-table-column>
-        <el-table-column align="center" prop="noticeNumber" label="通知单号">
-        </el-table-column>
-        <el-table-column align="center" prop="noticeDate" label="开单日期">
-        </el-table-column>
-      </el-table>
-    </div>
-    <div class="form-area">
-      <el-row :gutter="20">
-        <el-form
-          :model="form"
-          ref="form"
-          label-width="80px"
-          :inline="true"
-          size="mini"
-          :rules="rules"
+  <el-card shadow="always" :body-style="{ padding: '10px' }">
+    <div class="app-container">
+      <div class="table-area">
+        <el-table
+          :data="leftTableData"
+          border
+          stripe
+          @selection-change="handleSelectionChange"
+          @cell-click="cellClick"
         >
-          <el-col :span="16">
-            <el-form-item label="通知单号" prop="noticeNumber">
-              <div class="text-area">
-                <span class="mr10">{{ form.noticeNumber }}</span>
-                <span>{{ form.documentTypeName }}</span>
-              </div>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="销售员" prop="salesman">
-              {{ form.salesman }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="16">
-            <el-form-item label="客户名称" prop="customerName">
-              {{ form.customerName }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="售货单位" prop="sellingUnit">
-              {{ form.sellingUnit }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="16">
-            <el-form-item label="货车信息" prop="truckRegistration">
-              {{ form.truckRegistration }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="发货员" prop="deliveryClerk">
-              {{ form.deliveryClerk }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="备注" prop="dispatchNoteRemark">
-              {{ form.dispatchNoteRemark }}
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="发货日期" prop="deliveryDate">
-              <el-date-picker
-                v-model="form.deliveryDate"
-                type="date"
-                size="mini"
-                placeholder="选择日期"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="发货仓库" prop="deliveryWarehouse">
-              <el-select v-model="form.deliveryWarehouse" clearable filterable>
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :label="item.warehouseName"
-                  :value="item.id"
+          <el-table-column type="selection" width="55" />
+          <el-table-column type="index" label="序号" width="50" />
+          <el-table-column align="center" prop="customerName" label="客户名称">
+          </el-table-column>
+          <el-table-column align="center" prop="noticeNumber" label="通知单号">
+          </el-table-column>
+          <el-table-column align="center" prop="noticeDate" label="开单日期">
+          </el-table-column>
+        </el-table>
+      </div>
+      <div class="form-area">
+        <el-row :gutter="20">
+          <el-form
+            :model="form"
+            ref="form"
+            label-width="80px"
+            :inline="true"
+            size="mini"
+            :rules="rules"
+          >
+            <el-col :span="16">
+              <el-form-item label="通知单号" prop="noticeNumber">
+                <div class="text-area">
+                  <span class="mr10">{{ form.noticeNumber }}</span>
+                  <span>{{ form.documentTypeName }}</span>
+                </div>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="销售员" prop="salesman">
+                {{ form.salesman }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label="客户名称" prop="customerName">
+                {{ form.customerName }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="售货单位" prop="sellingUnit">
+                {{ form.sellingUnit }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label="货车信息" prop="truckRegistration">
+                {{ form.truckRegistration }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="发货员" prop="deliveryClerk">
+                {{ form.deliveryClerk }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="备注" prop="dispatchNoteRemark">
+                {{ form.dispatchNoteRemark }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="发货日期" prop="deliveryDate">
+                <el-date-picker
+                  v-model="form.deliveryDate"
+                  type="date"
+                  size="mini"
+                  placeholder="选择日期"
                 >
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="调拨仓库" prop="transferWarehouse">
-              <el-select v-model="form.transferWarehouse" clearable filterable>
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :label="item.warehouseName"
-                  :value="item.id"
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="发货仓库" prop="deliveryWarehouse">
+                <el-select
+                  v-model="form.deliveryWarehouse"
+                  clearable
+                  filterable
                 >
-                </el-option>
-              </el-select>
+                  <el-option
+                    v-for="item in warehouseList"
+                    :key="item.id"
+                    :label="item.warehouseName"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="调拨仓库" prop="transferWarehouse">
+                <el-select
+                  v-model="form.transferWarehouse"
+                  clearable
+                  filterable
+                >
+                  <el-option
+                    v-for="item in warehouseList"
+                    :key="item.id"
+                    :label="item.warehouseName"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-form-item>
+              <el-button type="primary" @click="outStockHandler"
+                >出库</el-button
+              >
+              <el-button @click="refreshHandler">刷新</el-button>
             </el-form-item>
-          </el-col>
-          <el-form-item>
-            <el-button type="primary" @click="outStockHandler">出库</el-button>
-            <el-button @click="refreshHandler">刷新</el-button>
-          </el-form-item>
-        </el-form>
-      </el-row>
-      <el-table width="100%" :data="saleProductInfoList" border stripe>
-        <el-table-column align="center" label="编码" prop="productCode">
-        </el-table-column>
-        <el-table-column align="center" label="品名" prop="productName">
-        </el-table-column>
-        <el-table-column
-          align="center"
-          label="规格"
-          prop="productSpecifications"
-        >
-        </el-table-column>
-        <el-table-column align="center" label="色泽" prop="productColor">
-        </el-table-column>
-        <el-table-column align="center" label="批号" prop="lotNum">
-        </el-table-column>
-        <el-table-column align="center" label="等级" prop="levels">
-        </el-table-column>
-        <el-table-column align="center" label="通知">
-          <el-table-column align="center" label="重量" prop="actualWeight">
+          </el-form>
+        </el-row>
+        <el-table width="100%" :data="saleProductInfoList" border stripe>
+          <el-table-column align="center" label="编码" prop="productCode">
+          </el-table-column>
+          <el-table-column align="center" label="品名" prop="productName">
+          </el-table-column>
+          <el-table-column
+            align="center"
+            label="规格"
+            prop="productSpecifications"
+          >
+          </el-table-column>
+          <el-table-column align="center" label="色泽" prop="productColor">
+          </el-table-column>
+          <el-table-column align="center" label="批号" prop="lotNum">
+          </el-table-column>
+          <el-table-column align="center" label="等级" prop="levels">
           </el-table-column>
-        </el-table-column>
-        <el-table-column align="center" label="实发">
-          <el-table-column align="center" label="箱数" prop="boxNum">
+          <el-table-column align="center" label="通知">
+            <el-table-column align="center" label="重量" prop="actualWeight">
+            </el-table-column>
           </el-table-column>
-          <el-table-column align="center" label="重量" prop="weight">
+          <el-table-column align="center" label="实发">
+            <el-table-column align="center" label="箱数" prop="boxNum">
+            </el-table-column>
+            <el-table-column align="center" label="重量" prop="weight">
+            </el-table-column>
           </el-table-column>
-        </el-table-column>
-      </el-table>
+        </el-table>
+      </div>
     </div>
-  </div>
+  </el-card>
 </template>
 
 <script>
@@ -211,6 +223,8 @@ export default {
           let res = await noticeOutStorage(payLoad);
           if (res.code == 200) {
             this.$message.success("出库成功");
+            this.initData();
+            this.refreshHandler();
           } else {
             this.$message.error(res.msg);
           }