From 78929be215190bede08c7390a2d9a8cdfcee9aa5 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Mon, 17 Apr 2023 17:31:55 +0800 Subject: [PATCH] 2023-4-17 --- src/api/dashboard/notice.js | 10 +- src/layout/components/worker/index.vue | 46 +-- src/store/modules/app.js | 97 ++++-- src/views/achievements/evaluate.vue | 212 +++++++------ src/views/budget/budgetList.vue | 21 +- src/views/budget/components/addEvaluate.vue | 28 +- src/views/system/worker.vue | 56 ++-- src/views/system/workerComponents/card1.vue | 38 --- src/views/system/workerComponents/card2.vue | 37 --- src/views/system/workerComponents/card3.vue | 33 --- .../system/workerComponents/department.vue | 154 ++++++++++ .../{card4.vue => lineChart.vue} | 5 +- src/views/system/workerComponents/toDo.vue | 177 +++++++++++ src/views/system/workerComponents/total.vue | 103 +++++++ src/views/system/workerComponents/type.vue | 279 ++++++++++++++++++ 15 files changed, 988 insertions(+), 308 deletions(-) delete mode 100644 src/views/system/workerComponents/card1.vue delete mode 100644 src/views/system/workerComponents/card2.vue delete mode 100644 src/views/system/workerComponents/card3.vue create mode 100644 src/views/system/workerComponents/department.vue rename src/views/system/workerComponents/{card4.vue => lineChart.vue} (98%) create mode 100644 src/views/system/workerComponents/toDo.vue create mode 100644 src/views/system/workerComponents/total.vue create mode 100644 src/views/system/workerComponents/type.vue diff --git a/src/api/dashboard/notice.js b/src/api/dashboard/notice.js index 6be0d2c..9983bd0 100644 --- a/src/api/dashboard/notice.js +++ b/src/api/dashboard/notice.js @@ -1,10 +1,11 @@ import request from "@/utils/request"; -export function getNotice(params){ +export function getNotice(params,noLoading = false){ return request({ method:'get', url:'/api/admin/notice/index', - params + params, + noLoading }) } @@ -16,10 +17,11 @@ export function readNotice(params){ }) } -export function statistic(params){ +export function statistic(params,noLoading = false){ return request({ method:'get', url:'/api/admin/notice/statistic', - params + params, + noLoading }) } diff --git a/src/layout/components/worker/index.vue b/src/layout/components/worker/index.vue index 3cec04d..7440000 100644 --- a/src/layout/components/worker/index.vue +++ b/src/layout/components/worker/index.vue @@ -27,6 +27,7 @@ @@ -44,20 +45,6 @@ const files = require.context( let cpns = files.keys().map((key) => { return files(key).default || files(key); }); -const componentsRegister = () => { - let obj = {}; - cpns.forEach((cpn) => { - Object.defineProperty(obj, cpn.name, { - value: cpn, - enumerable: true, - writable: true, - configurable: true, - }); - }); - obj["GridLayout"] = VueGridLayout.GridLayout; - obj["GridItem"] = VueGridLayout.GridItem; - return obj; -}; let layout = cpns.map((item) => { return { ...item.layout, @@ -65,20 +52,37 @@ let layout = cpns.map((item) => { }; }); export default { - components: componentsRegister(), + components: { + "GridLayout": VueGridLayout.GridLayout, + "GridItem": VueGridLayout.GridItem + }, + provide() { + return { + getStatistic: () => this.data + } + }, data() { return { - layoutList:[] + layoutList:[], + data: { + statistic: {} + } + } + }, + methods: { + sendData(data) { + this.data.statistic = data } }, - methods: {}, computed: {}, created() { - this.layoutList = this.$store.state.app.workerLayout.map(item => { - layout.forEach(lay => { - lay.i === item.i ? item.component = lay.component : '' + this.$store.dispatch('app/getLayout').then(res => { + this.layoutList = res.map(item => { + layout.forEach(lay => { + lay.i === item.i ? item.component = lay.component : '' + }) + return item }) - return item }) }, } diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 575e593..fdc70de 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,52 +1,93 @@ -import Cookies from 'js-cookie' - +import Cookies from "js-cookie"; +import { Message } from "element-ui"; +import { show, save } from "@/api/system/expand"; +import store from "@/store"; const state = { sidebar: { - opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, - withoutAnimation: false + opened: Cookies.get("sidebarStatus") + ? !!+Cookies.get("sidebarStatus") + : true, + withoutAnimation: false, }, - device: 'desktop', - workerLayout:[], -} - + device: "desktop", + workerLayout: {}, +}; +const getter = { + layout: (state) => { + return state["app/workerLayout"]?.config || []; + }, +}; const mutations = { - TOGGLE_SIDEBAR: state => { - state.sidebar.opened = !state.sidebar.opened - state.sidebar.withoutAnimation = false + TOGGLE_SIDEBAR: (state) => { + state.sidebar.opened = !state.sidebar.opened; + state.sidebar.withoutAnimation = false; if (state.sidebar.opened) { - Cookies.set('sidebarStatus', 1) + Cookies.set("sidebarStatus", 1); } else { - Cookies.set('sidebarStatus', 0) + Cookies.set("sidebarStatus", 0); } }, CLOSE_SIDEBAR: (state, withoutAnimation) => { - Cookies.set('sidebarStatus', 0) - state.sidebar.opened = false - state.sidebar.withoutAnimation = withoutAnimation + Cookies.set("sidebarStatus", 0); + state.sidebar.opened = false; + state.sidebar.withoutAnimation = withoutAnimation; }, TOGGLE_DEVICE: (state, device) => { - state.device = device + state.device = device; + }, + SET_LAYOUT: (state, layout) => { + state.workerLayout = layout; }, - SET_LAYOUT:(state,layout) => { - state.workerLayout = layout - } -} +}; const actions = { toggleSideBar({ commit }) { - commit('TOGGLE_SIDEBAR') + commit("TOGGLE_SIDEBAR"); }, closeSideBar({ commit }, { withoutAnimation }) { - commit('CLOSE_SIDEBAR', withoutAnimation) + commit("CLOSE_SIDEBAR", withoutAnimation); }, toggleDevice({ commit }, device) { - commit('TOGGLE_DEVICE', device) - } -} + commit("TOGGLE_DEVICE", device); + }, + getLayout({ commit, state }) { + return state.workerLayout.config + ? JSON.parse(state.workerLayout.config) + : new Promise((resolve, reject) => { + show({ + admin_id: store.state.user.userId, + }).then((res) => { + commit("SET_LAYOUT", res); + resolve(JSON.parse(res?.config) || []) + }); + }); + }, + setLayout({ commit }) { + show({ + admin_id: store.state.user.userId, + }).then((res) => { + commit("SET_LAYOUT", res); + }); + }, + saveLayout({ commit, dispatch, state }, layout) { + save({ + id: state.workerLayout.id, + name: "1", + config: JSON.stringify(layout), + }).then((res) => { + dispatch("setLayout"); + Message({ + type: "success", + message: "保存成功", + }); + }); + }, +}; export default { namespaced: true, state, + getter, mutations, - actions -} + actions, +}; diff --git a/src/views/achievements/evaluate.vue b/src/views/achievements/evaluate.vue index cf55ab7..99ad22d 100644 --- a/src/views/achievements/evaluate.vue +++ b/src/views/achievements/evaluate.vue @@ -1,47 +1,72 @@ diff --git a/src/views/budget/budgetList.vue b/src/views/budget/budgetList.vue index 6692c0e..1b00328 100644 --- a/src/views/budget/budgetList.vue +++ b/src/views/budget/budgetList.vue @@ -164,24 +164,19 @@ " >绩效指标 - - - - - 年中目标 - 年末目标 - - + 绩效目标 + diff --git a/src/views/budget/components/addEvaluate.vue b/src/views/budget/components/addEvaluate.vue index 968abb1..b7718bc 100644 --- a/src/views/budget/components/addEvaluate.vue +++ b/src/views/budget/components/addEvaluate.vue @@ -1,12 +1,18 @@ - - diff --git a/src/views/system/workerComponents/card2.vue b/src/views/system/workerComponents/card2.vue deleted file mode 100644 index 2c9f51f..0000000 --- a/src/views/system/workerComponents/card2.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/src/views/system/workerComponents/card3.vue b/src/views/system/workerComponents/card3.vue deleted file mode 100644 index 0f7c3d6..0000000 --- a/src/views/system/workerComponents/card3.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/src/views/system/workerComponents/department.vue b/src/views/system/workerComponents/department.vue new file mode 100644 index 0000000..d8f5ceb --- /dev/null +++ b/src/views/system/workerComponents/department.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/src/views/system/workerComponents/card4.vue b/src/views/system/workerComponents/lineChart.vue similarity index 98% rename from src/views/system/workerComponents/card4.vue rename to src/views/system/workerComponents/lineChart.vue index fe71321..16a1b4a 100644 --- a/src/views/system/workerComponents/card4.vue +++ b/src/views/system/workerComponents/lineChart.vue @@ -1,7 +1,7 @@