From abb4f543b954ce6c448b7198626847c1ef2f284f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期四, 20 六月 2024 10:15:41 +0800
Subject: [PATCH] !125 ♥️发布 vue 版本 5.2.0 与 cloud 版本 2.2.0 Merge pull request !125 from 疯狂的狮子Li/dev

---
 src/views/index.vue                            |    4 
 src/api/system/user/types.ts                   |    1 
 src/layout/components/SocialCallback/index.vue |   15 ++++
 src/api/workflow/processInstance/index.ts      |    2 
 src/types/env.d.ts                             |    5 -
 src/store/modules/user.ts                      |    3 +
 src/views/system/user/profile/thirdParty.vue   |    3 
 src/bpmn/panel/TaskPanel.vue                   |    3 
 src/api/system/social/auth.ts                  |    8 ++
 .env.development                               |    2 
 src/views/login.vue                            |   10 ---
 src/views/monitor/admin/index.vue              |    2 
 src/views/workflow/leave/leaveEdit.vue         |   49 ++++++---------
 tsconfig.json                                  |    3 -
 package.json                                   |    4 
 .env.production                                |    2 
 src/components/Process/multiInstanceUser.vue   |   60 +++++++++++--------
 src/components/Process/approvalRecord.vue      |    2 
 18 files changed, 93 insertions(+), 85 deletions(-)

diff --git a/.env.development b/.env.development
index e1f7af6..52553ff 100644
--- a/.env.development
+++ b/.env.development
@@ -11,7 +11,7 @@
 VITE_APP_CONTEXT_PATH = '/'
 
 # 鐩戞帶鍦板潃
-VITE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/applications'
+VITE_APP_MONITOR_ADMIN = 'http://localhost:9090/admin/applications'
 
 # SnailJob 鎺у埗鍙板湴鍧�
 VITE_APP_SNAILJOB_ADMIN = 'http://localhost:8800/snail-job'
diff --git a/.env.production b/.env.production
index 9188c63..bf9e644 100644
--- a/.env.production
+++ b/.env.production
@@ -8,7 +8,7 @@
 VITE_APP_CONTEXT_PATH = '/'
 
 # 鐩戞帶鍦板潃
-VITE_APP_MONITRO_ADMIN = '/admin/applications'
+VITE_APP_MONITOR_ADMIN = '/admin/applications'
 
 # SnailJob 鎺у埗鍙板湴鍧�
 VITE_APP_SNAILJOB_ADMIN = '/snail-job'
diff --git a/package.json b/package.json
index 3557360..7995d93 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "ruoyi-vue-plus",
-  "version": "5.2.0-BETA",
+  "version": "5.2.0",
   "description": "RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�",
   "author": "LionLi",
   "license": "MIT",
@@ -30,7 +30,7 @@
     "diagram-js": "12.3.0",
     "didi": "9.0.2",
     "echarts": "5.5.0",
-    "element-plus": "2.7.2",
+    "element-plus": "2.7.5",
     "file-saver": "2.0.5",
     "fuse.js": "7.0.0",
     "highlight.js": "11.9.0",
diff --git a/src/api/system/social/auth.ts b/src/api/system/social/auth.ts
index 17a46d3..69f0d7e 100644
--- a/src/api/system/social/auth.ts
+++ b/src/api/system/social/auth.ts
@@ -1,10 +1,14 @@
 import request from '@/utils/request';
 
 // 缁戝畾璐﹀彿
-export function authBinding(source: string) {
+export function authBinding(source: string, tenantId: string) {
   return request({
     url: '/auth/binding/' + source,
-    method: 'get'
+    method: 'get',
+    params: {
+      tenantId: tenantId,
+      domain: window.location.host
+    }
   });
 }
 
diff --git a/src/api/system/user/types.ts b/src/api/system/user/types.ts
index 3488e9f..0787372 100644
--- a/src/api/system/user/types.ts
+++ b/src/api/system/user/types.ts
@@ -26,6 +26,7 @@
  */
 export interface UserVO extends BaseEntity {
   userId: string | number;
+  tenantId: string;
   deptId: number;
   userName: string;
   nickName: string;
diff --git a/src/api/workflow/processInstance/index.ts b/src/api/workflow/processInstance/index.ts
index b949b51..6d5e53b 100644
--- a/src/api/workflow/processInstance/index.ts
+++ b/src/api/workflow/processInstance/index.ts
@@ -53,7 +53,7 @@
  * @param businessKey 涓氬姟id
  * @returns
  */
-export const getHistoryRecord = (businessKey: string) => {
+export const getHistoryRecord = (businessKey: string | number) => {
   return request({
     url: `/workflow/processInstance/getHistoryRecord/${businessKey}`,
     method: 'get'
diff --git a/src/bpmn/panel/TaskPanel.vue b/src/bpmn/panel/TaskPanel.vue
index 358fba9..a42de8a 100644
--- a/src/bpmn/panel/TaskPanel.vue
+++ b/src/bpmn/panel/TaskPanel.vue
@@ -281,12 +281,11 @@
 const roleSelectRef = ref<InstanceType<typeof RoleSelect>>();
 const dueDateRef = ref<InstanceType<typeof DueDate>>();
 
-const isMultiple = ref(true);
 const openUserSelect = () => {
   userSelectRef.value.open();
 };
 const openSingleUserSelect = () => {
-  if (formData.value.assignee.includes('$')) {
+  if (formData.value.assignee?.includes('$')) {
     formData.value.assignee = '';
   }
   singleUserSelectRef.value.open();
diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue
index 37667ca..bb4ed91 100644
--- a/src/components/Process/approvalRecord.vue
+++ b/src/components/Process/approvalRecord.vue
@@ -67,7 +67,7 @@
 const bpmnViewRef = ref<BpmnView>();
 
 //鍒濆鍖栨煡璇㈠鎵硅褰�
-const init = async (businessKey: string) => {
+const init = async (businessKey: string | number) => {
   visible.value = true;
   loading.value = true;
   tabActiveName.value = 'bpmn';
diff --git a/src/components/Process/multiInstanceUser.vue b/src/components/Process/multiInstanceUser.vue
index b2039b9..292b1b7 100644
--- a/src/components/Process/multiInstanceUser.vue
+++ b/src/components/Process/multiInstanceUser.vue
@@ -1,22 +1,28 @@
 <template>
-  <el-dialog v-model="visible" draggable :title="title" :width="width" :height="height" append-to-body
-    :close-on-click-modal="false">
-    <div class="p-2" v-if="multiInstance === 'add'">
+  <el-dialog v-model="visible" draggable :title="title" :width="width" :height="height" append-to-body :close-on-click-modal="false">
+    <div v-if="multiInstance === 'add'" class="p-2">
       <el-row :gutter="20">
         <!-- 閮ㄩ棬鏍� -->
         <el-col :lg="4" :xs="24" style="">
           <el-card shadow="hover">
             <el-input v-model="deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" prefix-icon="Search" clearable />
-            <el-tree class="mt-2" ref="deptTreeRef" node-key="id" :data="deptOptions"
-              :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false"
-              :filter-node-method="filterNode" highlight-current default-expand-all
-              @node-click="handleNodeClick"></el-tree>
+            <el-tree
+              ref="deptTreeRef"
+              class="mt-2"
+              node-key="id"
+              :data="deptOptions"
+              :props="{ label: 'label', children: 'children' }"
+              :expand-on-click-node="false"
+              :filter-node-method="filterNode"
+              highlight-current
+              default-expand-all
+              @node-click="handleNodeClick"
+            ></el-tree>
           </el-card>
         </el-col>
         <el-col :lg="20" :xs="24">
-          <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
-            :leave-active-class="proxy?.animate.searchAnimate.leave">
-            <div class="search" v-show="showSearch">
+          <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+            <div v-show="showSearch" class="search">
               <el-form ref="queryFormRef" :model="queryParams" :inline="true">
                 <el-form-item label="鐢ㄦ埛鍚嶇О" prop="userName">
                   <el-input v-model="queryParams.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" clearable @keyup.enter="handleQuery" />
@@ -25,8 +31,8 @@
                   <el-input v-model="queryParams.phonenumber" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" clearable @keyup.enter="handleQuery" />
                 </el-form-item>
                 <el-form-item>
-                  <el-button type="primary" @click="handleQuery" icon="Search">鎼滅储</el-button>
-                  <el-button @click="resetQuery" icon="Refresh">閲嶇疆</el-button>
+                  <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+                  <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
                 </el-form-item>
               </el-form>
             </div>
@@ -35,17 +41,16 @@
           <el-card shadow="hover">
             <template #header>
               <el-row :gutter="10">
-                <right-toolbar v-model:showSearch="showSearch" @queryTable="handleQuery" :search="true"></right-toolbar>
+                <right-toolbar v-model:showSearch="showSearch" :search="true" @query-table="handleQuery"></right-toolbar>
               </el-row>
             </template>
 
-            <el-table v-loading="loading" :data="userList" ref="multipleTableRef" row-key="userId"
-              @selection-change="handleSelectionChange">
+            <el-table ref="multipleTableRef" v-loading="loading" :data="userList" row-key="userId" @selection-change="handleSelectionChange">
               <el-table-column type="selection" width="50" align="center" />
-              <el-table-column label="鐢ㄦ埛缂栧彿" align="center" key="userId" prop="userId" />
-              <el-table-column label="鐢ㄦ埛鍚嶇О" align="center" key="userName" prop="userName" :show-overflow-tooltip="true" />
-              <el-table-column label="鐢ㄦ埛鏄电О" align="center" key="nickName" prop="nickName" :show-overflow-tooltip="true" />
-              <el-table-column label="鎵嬫満鍙风爜" align="center" key="phonenumber" prop="phonenumber" width="120" />
+              <el-table-column key="userId" label="鐢ㄦ埛缂栧彿" align="center" prop="userId" />
+              <el-table-column key="userName" label="鐢ㄦ埛鍚嶇О" align="center" prop="userName" :show-overflow-tooltip="true" />
+              <el-table-column key="nickName" label="鐢ㄦ埛鏄电О" align="center" prop="nickName" :show-overflow-tooltip="true" />
+              <el-table-column key="phonenumber" label="鎵嬫満鍙风爜" align="center" prop="phonenumber" width="120" />
               <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="160">
                 <template #default="scope">
                   <span>{{ scope.row.createTime }}</span>
@@ -53,18 +58,23 @@
               </el-table-column>
             </el-table>
 
-            <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
-              v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
+            <pagination
+              v-show="total > 0"
+              v-model:page="queryParams.pageNum"
+              v-model:limit="queryParams.pageSize"
+              :total="total"
+              @pagination="handleQuery"
+            />
           </el-card>
           <el-card shadow="hover">
-            <el-tag v-for="(user, index) in chooseUserList" :key="user.userId" style="margin:2px" closable
-              @close="handleCloseTag(user, index)">{{ user.userName }}
+            <el-tag v-for="(user, index) in chooseUserList" :key="user.userId" style="margin: 2px" closable @close="handleCloseTag(user, index)"
+              >{{ user.userName }}
             </el-tag>
           </el-card>
         </el-col>
       </el-row>
     </div>
-    <div class="p-2" v-if="multiInstance === 'delete'">
+    <div v-if="multiInstance === 'delete'" class="p-2">
       <el-table v-loading="loading" :data="taskList" @selection-change="handleTaskSelection">
         <el-table-column type="selection" width="55" />
         <el-table-column prop="name" label="浠诲姟鍚嶇О" />
@@ -285,7 +295,7 @@
 //鍒犻櫎tag
 const handleCloseTag = (user: UserVO, index: any) => {
   if (multipleTableRef.value.selection && multipleTableRef.value.selection.length > 0) {
-    multipleTableRef.value.selection.forEach((u: UserVO, i: Number) => {
+    multipleTableRef.value.selection.forEach((u: UserVO, i: number) => {
       if (user.userId === u.userId) {
         multipleTableRef.value.selection.splice(i, 1);
       }
diff --git a/src/layout/components/SocialCallback/index.vue b/src/layout/components/SocialCallback/index.vue
index eac66bc..de65aed 100644
--- a/src/layout/components/SocialCallback/index.vue
+++ b/src/layout/components/SocialCallback/index.vue
@@ -17,7 +17,9 @@
 const code = route.query.code as string;
 const state = route.query.state as string;
 const source = route.query.source as string;
-const tenantId = localStorage.getItem('tenantId') ? (localStorage.getItem('tenantId') as string) : '000000';
+const stateJson = JSON.parse(atob(state));
+const tenantId = stateJson.tenantId as string ? stateJson.tenantId as string : '000000';
+const domain = stateJson.domain as string;
 
 const processResponse = async (res: any) => {
   if (res.code !== 200) {
@@ -60,12 +62,21 @@
 };
 
 const init = async () => {
+  // 濡傛灉鍩熷悕涓嶇浉绛� 鍒欓噸瀹氬悜澶勭悊
+  let host = window.location.host;
+  if (domain !== host) {
+    let urlFull = new URL(window.location.href);
+    urlFull.host = domain;
+    window.location.href = urlFull.toString();
+    return;
+  }
+
   const data: LoginData = {
     socialCode: code,
     socialState: state,
     tenantId: tenantId,
     source: source,
-    clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
+    clientId: import.meta.env.VITE_APP_CLIENT_ID,
     grantType: 'social'
   };
 
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 4122294..56f369b 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -10,6 +10,7 @@
   const name = ref('');
   const nickname = ref('');
   const userId = ref<string | number>('');
+  const tenantId = ref<string>('');
   const avatar = ref('');
   const roles = ref<Array<string>>([]); // 鐢ㄦ埛瑙掕壊缂栫爜闆嗗悎 鈫� 鍒ゆ柇璺敱鏉冮檺
   const permissions = ref<Array<string>>([]); // 鐢ㄦ埛鏉冮檺缂栫爜闆嗗悎 鈫� 鍒ゆ柇鎸夐挳鏉冮檺
@@ -49,6 +50,7 @@
       nickname.value = user.nickName;
       avatar.value = profile;
       userId.value = user.userId;
+      tenantId.value = user.tenantId;
       return Promise.resolve();
     }
     return Promise.reject(err);
@@ -69,6 +71,7 @@
 
   return {
     userId,
+    tenantId,
     token,
     nickname,
     avatar,
diff --git a/src/types/env.d.ts b/src/types/env.d.ts
index bfc37cc..777c858 100644
--- a/src/types/env.d.ts
+++ b/src/types/env.d.ts
@@ -11,9 +11,8 @@
   VITE_APP_BASE_API: string;
   VITE_APP_BASE_URL: string;
   VITE_APP_CONTEXT_PATH: string;
-  VITE_APP_MONITRO_ADMIN: string;
-  VITE_APP_POWERJOB_ADMIN: string;
-  VITE_APP_EASYRETRY_ADMIN: string;
+  VITE_APP_MONITOR_ADMIN: string;
+  VITE_APP_SNAILJOB_ADMIN: string;
   VITE_APP_ENV: string;
   VITE_APP_ENCRYPT: string;
   VITE_APP_RSA_PUBLIC_KEY: string;
diff --git a/src/views/index.vue b/src/views/index.vue
index e02c9fe..d384909 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -33,7 +33,7 @@
           * 閮ㄧ讲鏂瑰紡 Docker 瀹瑰櫒缂栨帓 涓�閿儴缃蹭笟鍔¢泦缇�<br />
           * 鍥介檯鍖� SpringMessage Spring鏍囧噯鍥介檯鍖栨柟妗�<br />
         </p>
-        <p><b>褰撳墠鐗堟湰:</b> <span>v5.2.0-BETA</span></p>
+        <p><b>褰撳墠鐗堟湰:</b> <span>v5.2.0</span></p>
         <p>
           <el-tag type="danger">&yen;鍏嶈垂寮�婧�</el-tag>
         </p>
@@ -77,7 +77,7 @@
           * 鍒嗗竷寮忕洃鎺� Prometheus銆丟rafana 鍏ㄦ柟浣嶆�ц兘鐩戞帶<br />
           * 鍏朵綑涓� Vue 鐗堟湰涓�鑷�<br />
         </p>
-        <p><b>褰撳墠鐗堟湰:</b> <span>v2.2.0-BETA</span></p>
+        <p><b>褰撳墠鐗堟湰:</b> <span>v2.2.0</span></p>
         <p>
           <el-tag type="danger">&yen;鍏嶈垂寮�婧�</el-tag>
         </p>
diff --git a/src/views/login.vue b/src/views/login.vue
index 7e1394e..ca2903f 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -186,20 +186,12 @@
   }
 };
 
-//妫�娴嬬鎴烽�夋嫨妗嗙殑鍙樺寲
-watch(
-  () => loginForm.value.tenantId,
-  () => {
-    localStorage.setItem('tenantId', String(loginForm.value.tenantId));
-  }
-);
-
 /**
  * 绗笁鏂圭櫥褰�
  * @param type
  */
 const doSocialLogin = (type: string) => {
-  authBinding(type).then((res: any) => {
+  authBinding(type, loginForm.value.tenantId).then((res: any) => {
     if (res.code === HttpStatus.SUCCESS) {
       // 鑾峰彇鎺堟潈鍦板潃璺宠浆
       window.location.href = res.data;
diff --git a/src/views/monitor/admin/index.vue b/src/views/monitor/admin/index.vue
index 04c63b5..b71a5cc 100644
--- a/src/views/monitor/admin/index.vue
+++ b/src/views/monitor/admin/index.vue
@@ -5,5 +5,5 @@
 </template>
 
 <script setup lang="ts">
-const url = ref(import.meta.env.VITE_APP_MONITRO_ADMIN);
+const url = ref(import.meta.env.VITE_APP_MONITOR_ADMIN);
 </script>
diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue
index 40daa86..957122a 100644
--- a/src/views/system/user/profile/thirdParty.vue
+++ b/src/views/system/user/profile/thirdParty.vue
@@ -58,6 +58,7 @@
 <script lang="ts" setup>
 import { authUnlock, authBinding } from '@/api/system/social/auth';
 import { propTypes } from '@/utils/propTypes';
+import useUserStore from "@/store/modules/user";
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -83,7 +84,7 @@
 };
 
 const authUrl = (source: string) => {
-  authBinding(source).then((res: any) => {
+  authBinding(source, useUserStore().tenantId).then((res: any) => {
     if (res.code === 200) {
       window.location.href = res.data;
     } else {
diff --git a/src/views/workflow/leave/leaveEdit.vue b/src/views/workflow/leave/leaveEdit.vue
index d6210f0..a4ed946 100644
--- a/src/views/workflow/leave/leaveEdit.vue
+++ b/src/views/workflow/leave/leaveEdit.vue
@@ -3,34 +3,10 @@
     <el-card shadow="never">
       <div style="display: flex; justify-content: space-between">
         <div>
-          <el-button
-            v-if="
-              routeParams.type === 'add' ||
-              (routeParams.type === 'update' && form.status && (form.status === 'draft' || form.status === 'cancel' || form.status === 'back'))
-            "
-            :loading="buttonLoading"
-            type="info"
-            @click="submitForm('draft')"
-            >鏆傚瓨</el-button
-          >
-          <el-button
-            v-if="
-              routeParams.type === 'add' ||
-              (routeParams.type === 'update' && form.status && (form.status === 'draft' || form.status === 'cancel' || form.status === 'back'))
-            "
-            :loading="buttonLoading"
-            type="primary"
-            @click="submitForm('submit')"
-            >鎻� 浜�</el-button
-          >
-          <el-button
-            v-if="routeParams.type === 'approval' && form.status && form.status === 'waiting'"
-            :loading="buttonLoading"
-            type="primary"
-            @click="approvalVerifyOpen"
-            >瀹℃壒</el-button
-          >
-          <el-button v-if="form.status !== 'draft'" type="primary" @click="handleApprovalRecord">娴佺▼杩涘害</el-button>
+          <el-button v-if="submitButtonShow" :loading="buttonLoading" type="info" @click="submitForm('draft')">鏆傚瓨</el-button>
+          <el-button v-if="submitButtonShow" :loading="buttonLoading" type="primary" @click="submitForm('submit')">鎻� 浜�</el-button>
+          <el-button v-if="approvalButtonShow" :loading="buttonLoading" type="primary" @click="approvalVerifyOpen">瀹℃壒</el-button>
+          <el-button v-if="form && form.id && form.status !== 'draft'" type="primary" @click="handleApprovalRecord">娴佺▼杩涘害</el-button>
         </div>
         <div>
           <el-button style="float: right" @click="goBack()">杩斿洖</el-button>
@@ -154,7 +130,7 @@
   const startDate = new Date(leaveTime.value[0]).getTime();
   const endDate = new Date(leaveTime.value[1]).getTime();
   const diffInMilliseconds = endDate - startDate;
-  form.value.leaveDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24));
+  form.value.leaveDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)) + 1;
 };
 /** 鑾峰彇璇︽儏 */
 const getInfo = () => {
@@ -246,6 +222,21 @@
 const approvalVerifyOpen = async () => {
   submitVerifyRef.value.openDialog(routeParams.value.taskId);
 };
+//鏍¢獙鎻愪氦鎸夐挳鏄惁鏄剧ず
+const submitButtonShow = computed(() => {
+  return (
+    routeParams.value.type === 'add' ||
+    (routeParams.value.type === 'update' &&
+      form.value.status &&
+      (form.value.status === 'draft' || form.value.status === 'cancel' || form.value.status === 'back'))
+  );
+});
+
+//鏍¢獙瀹℃壒鎸夐挳鏄惁鏄剧ず
+const approvalButtonShow = computed(() => {
+  return routeParams.value.type === 'approval' && form.value.status && form.value.status === 'waiting';
+});
+
 onMounted(() => {
   nextTick(async () => {
     routeParams.value = proxy.$route.query;
diff --git a/tsconfig.json b/tsconfig.json
index e4bf3ac..bb287e9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -19,9 +19,6 @@
     "paths": {
       "@/*": ["src/*"]
     },
-    "compilerOptions": {
-      "types": ["element-plus/global"]
-    },
     "types": ["vite/client"],
     "skipLibCheck": true,
     "removeComments": true,

--
Gitblit v1.9.3