songxy 1 год назад
Родитель
Сommit
e6bb8ae6a2

+ 6 - 2
client_h5/.env.dev

@@ -1,5 +1,9 @@
-# VITE_BASE_URL='http://10.10.10.7:18080/'
-VITE_BASE_URL='http://localhost:6090/'
+VITE_BASE_URL='http://10.10.10.7:18080/'
+# VITE_BASE_URL='http://localhost:6090/'
+
+# 接口地址
+VITE_API_URL=/admin-api
+
 
 # File上传路径
 VITE_FILE_BASE_URI='/admin-api/infra/file'

+ 1 - 0
client_h5/package.json

@@ -26,6 +26,7 @@
   },
   "devDependencies": {
     "@types/node": "^20.11.20",
+    "@types/qs": "^6.9.15",
     "@vitejs/plugin-vue": "^5.0.4",
     "sass": "^1.71.1",
     "typescript": "^5.2.2",

+ 2 - 0
client_h5/src/App.vue

@@ -2,8 +2,10 @@
 import { useUserStoreWithOut, UserInterface } from "@/stores/modules/user"
 import { getAuthCode } from 'dingtalk-jsapi'; 
 import reqest from "@/utils/request";
+import { useDictStoreWithOut } from '@/utils/dict';
 
 const userStore = useUserStoreWithOut();
+const dictStore = useDictStoreWithOut()
 const initUserInfoHandler = async () => {
     const code: string = await getDDAuthCode() as string
     const userIdResult = await getUserIdByDD({code})

+ 4 - 11
client_h5/src/pages/leave/index.vue

@@ -138,6 +138,7 @@ import FlowForm from '@/components/flowForm.vue';
 import Card from '@/components/card.vue';
 import CardCell from '@/components/cardCell.vue';
 import { showSuccessToast, showFailToast } from 'vant';
+import { getDictOptions, getDictLabel, DICT_TYPE } from '@/utils/dict';
 
 const popupShow = ref<boolean>(false)
 const route = useRoute();
@@ -185,17 +186,9 @@ const formRead = ref(false)
 const detailIndex = ref<any>(null)
 const leaveTypePiker = ref(['11']);
 const showPicker = ref(false);
-const columns = [
-      { text: '事假', value: '11' },
-      { text: '病假', value: '12' },
-      { text: '婚假', value: '13' },
-      { text: '产假', value: '14' },
-      { text: '陪产假', value: '15' },
-      { text: '工伤', value: '16' },
-      { text: '年假', value: '17' },
-      { text: '调休', value: '18' },
-      { text: '其他', value: '20' },
-    ];
+const columns = getDictOptions(DICT_TYPE.WF_LEAVE_TYPE, {
+  label: 'text'
+})
 const { activityInstanceId, participant,flowInstanceId,read } = route.query as {
   activityInstanceId: string;
   participant: string;

+ 1 - 1
client_h5/src/service/flow.ts

@@ -9,7 +9,7 @@ export interface FlowCreateDTO {
   templateId: string
 }
 /** 获取办件中心列表 */
- export const getHandlerCaseCenterList = async (data: any) => {
+export const getHandlerCaseCenterList = async (data: any) => {
   return await request.post(`/HandlerCaseCenter/list`, data, {
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded'

+ 28 - 10
client_h5/src/utils/dict.ts

@@ -7,18 +7,18 @@ import { getStoreObject, setStoreObject } from './common'
 const DICT_NAME = '_dict';
 export const useDictStoreWithOut = () => {
   const listSimpleDictData = async () => {
-    const result = await request.get('/system/dict-data/list-all-simple')
+    const result = await request.get('/admin-api/system/dict-data/list-all-simple')
     return result.data;
   }
   const dictObj = getStoreObject(DICT_NAME);
-  if (!dictObj) { 
-    const resultData = listSimpleDictData()
-    if (resultData && resultData?.length > 0) {
-      setStoreObject(DICT_NAME, resultData);
-    }
+  if (!dictObj) {
+    listSimpleDictData().then((resultData) => { 
+      if (resultData && resultData?.length > 0) {
+        setStoreObject(DICT_NAME, resultData);
+      }
+    });
   }
 }
-const dictStore = useDictStoreWithOut()
 
 /**
  * 获取 dictType 对应的数据字典数组
@@ -33,8 +33,25 @@ export interface DictDataType {
   cssClass: string
 }
 
-export const getDictOptions = (dictType: string) => {
-  return dictStore.getDictByType(dictType) || []
+export const getDictOptions = (dictType: string, option: {
+  dictType?: string
+  label?: string
+  value?: string
+  cssClass?: string
+}) => {
+  const dictStore = getStoreObject(DICT_NAME);
+  const nDicts: any[] = []
+  dictStore.forEach((dict: DictDataType) => {
+    if (dict.dictType === dictType) {
+      nDicts.push({
+        [option.dictType ?? 'dictType']: dict.dictType,
+        [option.label ?? 'label']: dict.label,
+        [option.value ?? 'value']: dict.value,
+        [option.cssClass ?? 'cssClass']: dict.cssClass,
+      })
+    }
+  })
+  return nDicts;
 }
 
 export const getIntDictOptions = (dictType: string) => {
@@ -162,5 +179,6 @@ export enum DICT_TYPE {
   POST_TYPE = 'post_type',
   ABILITY_LEVEL = 'ABILITY_LEVEL',
   INVOICE_OUT_STATUS = 'INVOICE_OUT_STATUS',
-  INVOICE_TYPE = 'invoice_type'
+  INVOICE_TYPE = 'invoice_type',
+  WF_LEAVE_TYPE = 'WF_LEAVE_TYPE'
 }

+ 1 - 1
client_h5/src/utils/request.ts

@@ -38,4 +38,4 @@ instance.interceptors.response.use(
         return Promise.reject(error);
     }
 );
-export default instance;
+export default instance;