From 3afdcfd1b13483085991f46e7bcb3d78ac238bf3 Mon Sep 17 00:00:00 2001 From: weizong song Date: Thu, 4 Jun 2026 15:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=AE=97=E5=A4=9A=E9=80=89=E4=B8=8D?= =?UTF-8?q?=E9=99=90=E5=90=8C=E4=B8=80=E7=88=B6=E7=BA=A7|oa=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8A=A0=E8=BD=BD=E9=80=9F=E5=BA=A6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BudgetSourcePickerField.vue | 17 ++------ src/main.js | 46 ++++++---------------- src/plugins/vxe.js | 18 +++++++++ src/router/index.js | 12 +++--- src/store/modules/permission.js | 4 +- src/views/dashboard/index.vue | 2 +- src/views/flow/components/ListPopover.vue | 2 +- 7 files changed, 46 insertions(+), 55 deletions(-) create mode 100644 src/plugins/vxe.js diff --git a/src/components/BudgetSourcePickerField.vue b/src/components/BudgetSourcePickerField.vue index 0c8440d..ef34910 100644 --- a/src/components/BudgetSourcePickerField.vue +++ b/src/components/BudgetSourcePickerField.vue @@ -949,7 +949,9 @@ export default { if (!auths || auths.length === 0) { this.selectionError = "该预算来源未配置部门授权"; this.$message.warning(this.selectionError); + this.selectedBudgetIds = [...this.lastValidBudgetIds]; this.setCheckedIds(this.lastValidBudgetIds); + this.selectionError = ""; return; } @@ -983,23 +985,15 @@ export default { return; } - // 多条预算来源:同一直接父级 + 每条唯一授权部门 - const parentId = selectedNodes[0].parent_id ?? null; - const parentMismatch = selectedNodes.some((n) => (n.parent_id ?? null) !== parentId); - if (parentMismatch) { - this.selectionError = "多条预算来源必须同属一个直接父级"; - this.$message.warning(this.selectionError); - this.setCheckedIds(this.lastValidBudgetIds); - return; - } - const rows = []; for (const node of selectedNodes) { const auths = await this.getDepartmentAuthorizations(node.id); if (!auths || auths.length !== 1) { this.selectionError = "多条预算来源时,每条预算必须且仅能授权给一个部门"; this.$message.warning(this.selectionError); + this.selectedBudgetIds = [...this.lastValidBudgetIds]; this.setCheckedIds(this.lastValidBudgetIds); + this.selectionError = ""; return; } const a = auths[0]; @@ -1009,7 +1003,6 @@ export default { budget_name: node.name || "", department_id: a.department_id, department_name: a.department?.name || "", - // 情形(3) 默认全为 0(由用户手动填充) allocated_amount: existingMap[key] ?? 0, }); } @@ -1367,5 +1360,3 @@ export default { font-weight: 500; } - - diff --git a/src/main.js b/src/main.js index 2943c8a..a2b3583 100644 --- a/src/main.js +++ b/src/main.js @@ -15,47 +15,25 @@ import router from './router' import '@/icons' // icon import '@/permission' // permission control -/** - * If you don't want to use mock-server - * you want to use MockJs for mock api - * you can execute: mockXHR() - * - * Currently MockJs will be used in the production environment, - * please remove it before going online ! ! ! - */ -if (process.env.NODE_ENV === 'production') { - const { mockXHR } = require('../mock') - mockXHR() -} - // set ElementUI lang to EN //Vue.use(ElementUI, { locale }) // 如果想要中文版 element-ui,按如下方式声明 Vue.use(ElementUI) -// vxe-table / vxe-pc-ui -// 注意:vxe-pc-ui 的部分组件(如 vxe-modal)需要显式 Vue.use 注册,否则会退化成“未知标签”,其内容会直接渲染在页面里 -import { VxeUI, VxeUpload, VxeDatePicker, VxeNumberInput, VxeModal } from 'vxe-pc-ui' -import 'vxe-pc-ui/lib/style.css' -Vue.use(VxeUpload) -Vue.use(VxeDatePicker) -Vue.use(VxeNumberInput) -Vue.use(VxeModal) -import VxeTable from 'vxe-table' -import "vxe-table/styles/index.scss" -import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx' -import ExcelJS from 'exceljs' -VxeTable.use(VXETablePluginExportXLSX, { - ExcelJS -}) -Vue.use(VxeTable) - Vue.config.productionTip = false -//vant -import Vant from 'vant' -import 'vant/lib/index.css'; -Vue.use(Vant) +// vant: only register components used as global tags +import { Popup, Picker, Uploader } from 'vant' +import 'vant/lib/popup/style' +import 'vant/lib/picker/style' +import 'vant/lib/uploader/style' +import 'vant/lib/checkbox/style' +import 'vant/lib/checkbox-group/style' +import 'vant/lib/dropdown-menu/style' +import 'vant/lib/dropdown-item/style' +Vue.use(Popup) +Vue.use(Picker) +Vue.use(Uploader) import domZIndex from 'dom-zindex' domZIndex.setCurrent(2000) diff --git a/src/plugins/vxe.js b/src/plugins/vxe.js new file mode 100644 index 0000000..fed8cd7 --- /dev/null +++ b/src/plugins/vxe.js @@ -0,0 +1,18 @@ +import Vue from 'vue' +import { VxeUpload, VxeDatePicker, VxeNumberInput, VxeModal } from 'vxe-pc-ui' +import 'vxe-pc-ui/lib/style.css' +import VxeTable from 'vxe-table' +import 'vxe-table/styles/index.scss' +import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx' +import ExcelJS from 'exceljs' + +VxeTable.use(VXETablePluginExportXLSX, { + ExcelJS +}) + +Vue.use(VxeUpload) +Vue.use(VxeDatePicker) +Vue.use(VxeNumberInput) +Vue.use(VxeModal) +Vue.use(VxeTable) + diff --git a/src/router/index.js b/src/router/index.js index 7a32247..daaa321 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,6 +6,8 @@ Vue.use(Router); /* Layout */ import Layout from "@/layout"; +const loadVxeView = (view) => () => import("@/plugins/vxe").then(() => view()); + /** * Note: sub-menu only appear when route children.length >= 1 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html @@ -68,24 +70,24 @@ export const constantRoutes = [ path: "list/:type", name: "flowList", hidden: true, - component: () => import("@/views/flow/list.vue"), + component: loadVxeView(() => import("@/views/flow/list.vue")), }, { path: "create", name: "create", - component: () => import("@/views/flow/create"), + component: loadVxeView(() => import("@/views/flow/create")), hidden: true, }, { path: "detail", name: "detail", - component: () => import("@/views/flow/create"), + component: loadVxeView(() => import("@/views/flow/create")), hidden: true, }, { path: "detailCommon", name: "detailCommon", - component: () => import("@/views/flow/detailCommon"), + component: loadVxeView(() => import("@/views/flow/detailCommon")), hidden: true, } ], @@ -100,7 +102,7 @@ export const constantRoutes = [ { path: "index", name: "MeetingMinutes", - component: () => import("@/views/MeetingMinutes/index"), + component: loadVxeView(() => import("@/views/MeetingMinutes/index")), meta: { title: "会议纪要管理", icon: "el-icon-document" }, }, ], diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 1264500..5225ad9 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -5,7 +5,9 @@ import Layout from "@/layout" import Nested from "@/layout/nested.vue" const loadView = (view) => { - return (resolve) => require([`@/views${view}`], resolve); + return () => import('@/plugins/vxe').then(() => new Promise((resolve, reject) => { + require([`@/views${view}`], resolve, reject) + })) } const componentHandle = (url, route)=> { if (/^#+/.test(route.path) && route.pid === 0) { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 375d463..2b46baf 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -589,7 +589,7 @@ export default { const res = await axios.get( `https://restapi.amap.com/v3/weather/weatherInfo?city=320400&key=15ecd1e7de61e684959f43d8965a89f0` ); - if (res.status === 200) { + if (res.status === 200 && Array.isArray(res.data && res.data.lives) && res.data.lives.length > 0) { this.weather = res.data.lives[0]; } } catch (err) { diff --git a/src/views/flow/components/ListPopover.vue b/src/views/flow/components/ListPopover.vue index 3d42b5d..4e6acdc 100644 --- a/src/views/flow/components/ListPopover.vue +++ b/src/views/flow/components/ListPopover.vue @@ -7,7 +7,7 @@ @input="e => $emit('update:isShow', e)" size="mini" :loading="loading" - :id="id.toString()" + id="flow-list-popover" :lock-view="false" :lock-scroll="false" :mask="false"