From 73f1786be3e892548484ca4a228c8e38fd3856f2 Mon Sep 17 00:00:00 2001 From: Leo_Ding <2405260743@qq.com> Date: Fri, 10 Oct 2025 09:30:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=AF=B9=E8=B1=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=92=8C=E5=AD=97=E5=85=B8=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/modules/common.js | 2 +- src/apis/modules/serverObj.js | 17 + src/assets/imgs/total.png | Bin 0 -> 2296 bytes src/layouts/BasicLayout.vue | 4 +- src/locales/lang/zh-CN/menu.js | 2 + src/router/routes/index.js | 4 + src/router/routes/severObj.js | 29 + src/router/routes/supervise.js | 18 +- src/store/index.js | 3 +- src/store/modules/dicts.js | 103 +++ src/utils/dics.js | 3 + src/views/login/index.vue | 9 +- src/views/login/platForm.vue | 5 +- .../serverList/components/EditDialog.vue | 543 ++++++++++++ src/views/serverObj/serverList/index.vue | 789 ++++++++++++++++++ .../system/dict/components/EditDialog.vue | 39 +- src/views/system/dict/index.vue | 37 +- .../dictionary/components/EditDialog.vue | 7 + 18 files changed, 1536 insertions(+), 78 deletions(-) create mode 100644 src/apis/modules/serverObj.js create mode 100644 src/assets/imgs/total.png create mode 100644 src/router/routes/severObj.js create mode 100644 src/store/modules/dicts.js create mode 100644 src/utils/dics.js create mode 100644 src/views/serverObj/serverList/components/EditDialog.vue create mode 100644 src/views/serverObj/serverList/index.vue diff --git a/src/apis/modules/common.js b/src/apis/modules/common.js index b14e84b..f80407a 100644 --- a/src/apis/modules/common.js +++ b/src/apis/modules/common.js @@ -5,7 +5,7 @@ export const getRegion = (params) => request.basic.get('/region', params) // 获取 验证码ID export const getCaptcha = (params) => request.basic.get('/api/v1/captcha/id', params) - +export const getDictByType = (type) => request.basic.get(`/api/v1/dictionaries?categoryCode=${type}`) //上传图片 export const uploadFile=(params)=>request.basic.post('/api/v1/upload',params,{ headers: { diff --git a/src/apis/modules/serverObj.js b/src/apis/modules/serverObj.js new file mode 100644 index 0000000..9772598 --- /dev/null +++ b/src/apis/modules/serverObj.js @@ -0,0 +1,17 @@ +/** + * 区域模块接口 + */ +import request from '@/utils/request' +// 获取项目列表 +export const getProjectList = (params) => request.basic.get('/api/v1/customers', params) +// 获取单挑数据 +export const getItem = (id) => request.basic.get(`/api/v1/customers/${id}`) +// 添加条目 +export const createItem = (params) => request.basic.post('/api/v1/customers', params) +// 更新role +export const updateItem = (id, params) => request.basic.put(`/api/v1/customers/${id}`, params) +// 删除数据 +export const delItem = (id) => request.basic.delete(`/api/v1/customers/${id}`) + + + diff --git a/src/assets/imgs/total.png b/src/assets/imgs/total.png new file mode 100644 index 0000000000000000000000000000000000000000..11bedbb37ef7cca0743fdbdc2cac9035401297b9 GIT binary patch literal 2296 zcmVPx-vPnciRCr$Pn{A90R~g5Dvv07=`@X=^-R`omyX*^;NJSfKp+ZRuh*c8XSleQ2 zsnMWmV$v`DqOo5zYK<@9gVtcx1ly+A+7hd&sA)sBwiPTyE42ziN(o?D-URj@^UTb- zd+ynD?wxz@+;y*UzUSsND%l0>5Bv2ee@k>?1_YQ0g_M0Y$eU)SAQPq&C z=WAs6G*Ig@*w=AsB*$={VY;&kejnGS&(NgTqk$PEV4FJ0=MQ`#xG0Z?4iMv2J-d`* zOMU&5&c9?m> zPQpQDSQadPQau!8xUVee>k%u&1%(jc8TmxSY9rTSxXCMFn*rYl27anuLor;A1F~^z zLp7nnUUH2?peQ6HML?Lk*e?z^9j3Yj1m%i-okhY<`k-Dy+m*-yA?s_WMvfW@26hS< z@{nJi&R2yFC=gbH0F{^hT@J9WRgn$|^@>J9__rJcxR6r~Iv^xK?TD-cJn14)TvwqE z(3vGw1XPs{7>9ronA%QX1-T$$TC^2l#dJVg98k47plk;idEcc2n(Cl$7IaOASq(6? z4*q=^PG5w>BXIB(%xHl13*fp==#cxSz{v}6_%!_HF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JJstq4`>IC2_3^phyP7W%d^ zRUNRr1+JOvS9;Q!l~=&Bwn~{k*6!E$z{7tmK#Dp9(pVRe)P83l$l70y;xcR%C3yFc zRV1m9FOHvuH9v$=J)3mQ2~yPoUDM!$UH)7zqd(LPYp$%2#g1k_^)x(x$QY1HW`Xz5 zgR9I^l_Tw~>w?}gR)C6i-6MP9%P-{rQZ2Q5z@`P!+&|~AJid9*SSKjfniB4R^)0yl zi3vi$UHu@dz&-~EM|@^!Wm2EdHz&@)%Iy{>nOu;j4!Cz9f9{v`_sLQgK^&o^4K}J} z&dHUO(^h=ffdI?!)O3K!{sq4cDnLlCFVQOTrD&=;z$ZHX|DB*C?p$jG&aYErscIHi zO!->U_soX;mFK0saD6bA#AVe4b3~A-v6IftErYY|8F6dB!+W0eomSiFIKY;fwqeDV ztvm~vg|z-SRT|d<_4U+rfN$hA!zPA&0=1?gn-~cNP-WLH%R_)+K$Y$n2&cm(ZwpFz{K(@>bKB*p3_%-a1=tIv^l- z>#TM{;?2{Zk)P~3z`J?coMX%O`O#YLsmZWb71%y+#`dJu0RbZ@4h5d=^Zx import { storeToRefs } from 'pinia' import { ref } from 'vue' -import { useAppStore } from '@/store' +import { useAppStore,useDicsStore } from '@/store' import useMultiTab from './hooks/useMultiTab' import useMenu from './hooks/useMenu' import BasicContent from './components/BasicContent.vue' @@ -162,6 +162,8 @@ defineOptions({ useMultiTab() const appStore = useAppStore() +const dicsStore = useDicsStore() + dicsStore.loadAllDictData() // 加载字典数据 const { sideMenuList, topMenuList } = useMenu() const { config } = storeToRefs(appStore) diff --git a/src/locales/lang/zh-CN/menu.js b/src/locales/lang/zh-CN/menu.js index 43cd0cd..2e2d618 100644 --- a/src/locales/lang/zh-CN/menu.js +++ b/src/locales/lang/zh-CN/menu.js @@ -34,4 +34,6 @@ export default { 'account.logout': '退出登录', 'dict': '字典管理', 'dict-detail': '字典数据', + 'serverObj': '服务对象管理', + 'serverList': '服务对象列表', } diff --git a/src/router/routes/index.js b/src/router/routes/index.js index c6489d2..bd924c1 100644 --- a/src/router/routes/index.js +++ b/src/router/routes/index.js @@ -7,6 +7,8 @@ import home from './home' // import admin from './admin' import system from './system' import platform from './platform' +import supervise from './supervise' +import severObj from './severObj' // import link from './link' // import iframe from './iframe' // import other from './other' @@ -21,6 +23,8 @@ export default [ // ...admin, ...system, ...platform, + ...supervise, + ...severObj, // ...link, // ...iframe, // ...other, diff --git a/src/router/routes/severObj.js b/src/router/routes/severObj.js new file mode 100644 index 0000000..fe043e2 --- /dev/null +++ b/src/router/routes/severObj.js @@ -0,0 +1,29 @@ +import { DollarOutlined } from '@ant-design/icons-vue' + +export default [ + { + path: 'serverObj', + name: 'serverObj', + component: 'RouteViewLayout', + meta: { + icon: DollarOutlined, + title: '服务对象管理', + isMenu: true, + keepAlive: true, + permission: '*', + }, + children: [ + { + path: 'serverList', + name: 'serverList', + component: 'serverObj/serverList/index.vue', + meta: { + title: '服务对象列表', + isMenu: true, + keepAlive: true, + permission: '*', + }, + }, + ], + }, +] diff --git a/src/router/routes/supervise.js b/src/router/routes/supervise.js index c394c3d..695c12e 100644 --- a/src/router/routes/supervise.js +++ b/src/router/routes/supervise.js @@ -14,9 +14,9 @@ export default [ }, children: [ { - path: 'custList/index.vue', + path: 'custList', name: 'custlist', - component: 'pages/custMenu/custList/index.vue', + component: '/custMenu/custList/index.vue', meta: { title: '服务对象列表', isMenu: true, @@ -25,7 +25,7 @@ export default [ }, }, { - path: 'custallotList/index.vue', + path: '/custListMenu/custallotList', name: 'custallotList', component: 'pages/custMenu/custallotList/index.vue', meta: { @@ -36,7 +36,7 @@ export default [ }, }, { - path: 'householdCustList/index.vue', + path: '/custListMenu/householdCustList', name: 'householdCustList', component: 'pages/custMenu/householdCustList/index.vue', meta: { @@ -47,7 +47,7 @@ export default [ }, }, { - path: 'institutionList/index.vue', + path: '/custListMenu/institutionList', name: 'institutionList', component: 'pages/custMenu/institutionList/index.vue', meta: { @@ -58,7 +58,7 @@ export default [ }, }, { - path: 'toimprovedList/index.vue', + path: '/custListMenu/toimprovedList', name: 'toimprovedList', component: 'pages/custMenu/toimprovedList/index.vue', meta: { @@ -69,7 +69,7 @@ export default [ }, }, { - path: 'phonecareList/index.vue', + path: '/custListMenu/phonecareList', name: 'phonecareList', component: 'pages/custMenu/phonecareList/index.vue', meta: { @@ -80,7 +80,7 @@ export default [ }, }, { - path: 'selectiveList/index.vue', + path: '/custListMenu/selectiveList', name: 'selectiveList', component: 'pages/custMenu/selectiveList/index.vue', meta: { @@ -91,7 +91,7 @@ export default [ }, }, { - path: 'livingstateList/index.vue', + path: '/custListMenu/livingstateList', name: 'livingstateList', component: 'pages/custMenu/livingstateList/index.vue', meta: { diff --git a/src/store/index.js b/src/store/index.js index 2f8b85e..4cfe071 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,6 +4,7 @@ import useAppStore from './modules/app' import useMultiTabStore from './modules/multiTab' import useRouterStore from './modules/router' import useUserStore from './modules/user' +import useDicsStore from './modules/dicts' const store = createPinia() const setupStore = (app) => { @@ -11,6 +12,6 @@ const setupStore = (app) => { return app } -export { setupStore, useAppStore, useMultiTabStore, useRouterStore, useUserStore } +export { setupStore, useAppStore, useMultiTabStore, useRouterStore, useUserStore, useDicsStore } export default store diff --git a/src/store/modules/dicts.js b/src/store/modules/dicts.js new file mode 100644 index 0000000..73f6bdb --- /dev/null +++ b/src/store/modules/dicts.js @@ -0,0 +1,103 @@ +import { message } from 'ant-design-vue' +import { cloneDeep, findIndex, isEmpty } from 'lodash-es' +import { defineStore } from 'pinia' +import { getDictByType } from '@/apis/modules/common' +import router from '@/router' +import apis from '@/apis' +import useAppStore from './app' + +const useDicsStore = defineStore('dics', { + state: () => ({ + dictOptions: {}, + }), + getters: { + /** + * 根据字典 key 获取选项列表 + * @param state + * @returns {function(string): Array} + */ + getDict: (state) => (key) => { + return state.dictOptions[key] || [] + }, + + /** + * 根据字典 key 和值,获取对应的中文描述(introduction) + * @param state + * @returns {function(string, string): string} + */ + getDictLabel: (state) => (key, value) => { + const options = state.dictOptions[key] || [] + const item = options.find((opt) => opt.dval === value) + return item ? item.introduction : '-' + }, + + /** + * 判断某个字典是否存在 + */ + hasDict: (state) => (key) => { + return !!state.dictOptions[key] + }, + }, + mutations: { + /** + * 保存所有字典数据 + * @param state + * @param payload {Object} 字典对象 + */ + SET_DICT_DATA(state, payload) { + state.dictOptions = { ...payload } + }, + + /** + * 清空字典数据 + * @param state + */ + CLEAR_DICT_DATA(state) { + state.dictOptions = {} + }, + }, + + actions: { + /** + * 从后端加载所有字典数据 + * @param commit + * @returns {Promise} + */ + async loadAllDictData() { + try { + const res = await apis.dict + .getProjectList({ + pageSize: 100, + current: 1, + }) + .catch(() => { + throw new Error() + }) + if (res?.data) { + this.dictOptions = res.data + if (res.data.length > 0) { + const dictTypes = res.data.map(item => item.code) + const requests = dictTypes.map((type) => getDictByType(type)) + const results = await Promise.all(requests) + // 将结果按 type 存入 dictOptions + dictTypes.forEach((type, index) => { + this.dictOptions[type] = results[index].data || [] + }) + console.log('字典数据加载完成', this.dictOptions) + } + } + } catch (error) { + console.error('加载字典数据失败:', error) + } + }, + + /** + * 可选:清空字典数据(登出时调用) + */ + clearDictData({ commit }) { + commit('CLEAR_DICT_DATA') + }, + }, +}) + +export default useDicsStore diff --git a/src/utils/dics.js b/src/utils/dics.js new file mode 100644 index 0000000..200e7f9 --- /dev/null +++ b/src/utils/dics.js @@ -0,0 +1,3 @@ +export const dicList=[ + +] \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 7d08b7b..a5ffbcd 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -51,7 +51,7 @@ import { useRoute, useRouter } from 'vue-router' import { LockOutlined, UserOutlined, SafetyOutlined } from '@ant-design/icons-vue' import { config } from '@/config' import { useForm } from '@/hooks' -import { useAppStore, useRouterStore, useUserStore } from '@/store' +import { useAppStore, useRouterStore, useUserStore,useDicsStore } from '@/store' import { timeFix } from '@/utils/util' import apis from '@/apis' @@ -65,6 +65,7 @@ const { formData, formRef, formRules } = useForm() const appStore = useAppStore() const userStore = useUserStore() const routerStore = useRouterStore() +const dicsStore = useDicsStore() const router = useRouter() const route = useRoute() const loading = ref(false) @@ -117,6 +118,7 @@ async function handleLogin() { }) loading.value = false if (config('http.code.success') === success) { + // dicsStore.loadAllDictData() // 加载字典数据 router.push('/platform') } }) @@ -154,10 +156,7 @@ function goIndex() { if (!indexRoute) return router.push(indexRoute) } - notification.success({ - message: t('welcome'), - description: `${timeFix()},${t('home')}`, - }) + } diff --git a/src/views/login/platForm.vue b/src/views/login/platForm.vue index 633207e..0951aa6 100644 --- a/src/views/login/platForm.vue +++ b/src/views/login/platForm.vue @@ -96,10 +96,7 @@ async function goIndex() { console.log(indexRoute) if (!indexRoute) return router.push(indexRoute) - notification.success({ - message: t('welcome'), - description: `${timeFix()},${t('home')}`, - }) + } /** * 获取首页路由 diff --git a/src/views/serverObj/serverList/components/EditDialog.vue b/src/views/serverObj/serverList/components/EditDialog.vue new file mode 100644 index 0000000..3b01b9c --- /dev/null +++ b/src/views/serverObj/serverList/components/EditDialog.vue @@ -0,0 +1,543 @@ + + + + + diff --git a/src/views/serverObj/serverList/index.vue b/src/views/serverObj/serverList/index.vue new file mode 100644 index 0000000..03d3e17 --- /dev/null +++ b/src/views/serverObj/serverList/index.vue @@ -0,0 +1,789 @@ + + + + + diff --git a/src/views/system/dict/components/EditDialog.vue b/src/views/system/dict/components/EditDialog.vue index da40be2..76e0abc 100644 --- a/src/views/system/dict/components/EditDialog.vue +++ b/src/views/system/dict/components/EditDialog.vue @@ -1,37 +1,18 @@