mooho-base-admin-plus 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +5 -0
- package/.env.development +0 -0
- package/.env.production +0 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +47 -0
- package/.prettierrc +15 -0
- package/README.md +18 -0
- package/dist/favicon.ico +0 -0
- package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
- package/dist/mooho-base-admin-plus.min.js +279 -0
- package/dist/setting.js +31 -0
- package/dist/static/images/app-barcode.png +0 -0
- package/dist/static/images/login/bg.png +0 -0
- package/dist/static/images/login/logo.png +0 -0
- package/dist/static/images/login/password-active.png +0 -0
- package/dist/static/images/login/password-default.png +0 -0
- package/dist/static/images/login/signIn-img.png +0 -0
- package/dist/static/images/login/user-active.png +0 -0
- package/dist/static/images/login/user-default.png +0 -0
- package/dist/static/images/logo-dark.png +0 -0
- package/dist/static/images/logo-small.png +0 -0
- package/dist/static/images/logo.png +0 -0
- package/dist/static/images/logo.svg +510 -0
- package/dist/static/images/no-image.png +0 -0
- package/dist/style.css +4 -0
- package/index.html +18 -0
- package/other/pda.vue +28 -0
- package/package.json +59 -0
- package/public/favicon.ico +0 -0
- package/public/setting.js +31 -0
- package/public/static/images/app-barcode.png +0 -0
- package/public/static/images/login/bg.png +0 -0
- package/public/static/images/login/logo.png +0 -0
- package/public/static/images/login/password-active.png +0 -0
- package/public/static/images/login/password-default.png +0 -0
- package/public/static/images/login/signIn-img.png +0 -0
- package/public/static/images/login/user-active.png +0 -0
- package/public/static/images/login/user-default.png +0 -0
- package/public/static/images/logo-dark.png +0 -0
- package/public/static/images/logo-small.png +0 -0
- package/public/static/images/logo.png +0 -0
- package/public/static/images/logo.svg +510 -0
- package/public/static/images/no-image.png +0 -0
- package/src/App.vue +60 -0
- package/src/api/application.js +35 -0
- package/src/api/customModel.js +187 -0
- package/src/api/customPage.js +15 -0
- package/src/api/customTable.js +24 -0
- package/src/api/dataSource.js +93 -0
- package/src/api/dataView.js +199 -0
- package/src/api/dictType.js +23 -0
- package/src/api/entityView.js +13 -0
- package/src/api/enum.js +15 -0
- package/src/api/filterColumn.js +16 -0
- package/src/api/model.js +244 -0
- package/src/api/movePlan.js +29 -0
- package/src/api/notification.js +28 -0
- package/src/api/openApiPermission.js +25 -0
- package/src/api/permission.js +51 -0
- package/src/api/planJob.js +15 -0
- package/src/api/process.js +23 -0
- package/src/api/processDef.js +36 -0
- package/src/api/processInst.js +16 -0
- package/src/api/rolePermission.js +17 -0
- package/src/api/roleProperty.js +36 -0
- package/src/api/shortcut.js +20 -0
- package/src/api/system.js +23 -0
- package/src/api/task.js +56 -0
- package/src/api/taskQueue.js +24 -0
- package/src/api/user.js +45 -0
- package/src/api/viewColumn.js +16 -0
- package/src/assets/svg/body.svg +17 -0
- package/src/assets/svg/header-theme-dark.svg +40 -0
- package/src/assets/svg/header-theme-primary.svg +40 -0
- package/src/assets/svg/header-top.svg +40 -0
- package/src/assets/svg/icon-happy.svg +1 -0
- package/src/assets/svg/icon-sad.svg +1 -0
- package/src/assets/svg/icon-social-bilibili.svg +1 -0
- package/src/assets/svg/icon-social-dingding.svg +1 -0
- package/src/assets/svg/icon-social-facebook.svg +1 -0
- package/src/assets/svg/icon-social-juejin.svg +1 -0
- package/src/assets/svg/icon-social-qq.svg +1 -0
- package/src/assets/svg/icon-social-twitter.svg +1 -0
- package/src/assets/svg/icon-social-wechat.svg +1 -0
- package/src/assets/svg/icon-social-weibo.svg +1 -0
- package/src/assets/svg/icon-social-zhihu.svg +1 -0
- package/src/assets/svg/nav-theme-dark.svg +40 -0
- package/src/assets/svg/nav-theme-light.svg +40 -0
- package/src/components/copyright/index.vue +28 -0
- package/src/components/home/notice-list.vue +62 -0
- package/src/components/home/shortcut.vue +125 -0
- package/src/components/input/dialog-select.vue +301 -0
- package/src/components/input/item-select.vue +195 -0
- package/src/components/link/index.vue +54 -0
- package/src/components/richEditor/index.vue +86 -0
- package/src/components/upload/file-upload.vue +84 -0
- package/src/components/upload/upload-attachment.vue +119 -0
- package/src/components/upload/upload-image.vue +212 -0
- package/src/components/view/column-check.vue +223 -0
- package/src/components/view/column-edit.vue +850 -0
- package/src/components/view/column-select.vue +206 -0
- package/src/components/view/condition-edit.vue +164 -0
- package/src/components/view/filter-edit.vue +633 -0
- package/src/components/view/filter-setting.vue +126 -0
- package/src/components/view/form-setting-layout.vue +375 -0
- package/src/components/view/form-setting.vue +247 -0
- package/src/components/view/group-column.vue +104 -0
- package/src/components/view/group-method.vue +104 -0
- package/src/components/view/mixin.js +72 -0
- package/src/components/view/modal-form-filter.vue +319 -0
- package/src/components/view/modal-form-sort.vue +248 -0
- package/src/components/view/modal-form.vue +453 -0
- package/src/components/view/modal-table.vue +471 -0
- package/src/components/view/table-filter.vue +702 -0
- package/src/components/view/table-setting.vue +533 -0
- package/src/components/view/view-chart.vue +423 -0
- package/src/components/view/view-form-draggable.vue +837 -0
- package/src/components/view/view-form.vue +1444 -0
- package/src/components/view/view-table.vue +2261 -0
- package/src/components/workflow/flow-chart.vue +846 -0
- package/src/directive/focus.js +10 -0
- package/src/directive/tabHide.js +9 -0
- package/src/i18n/index.js +15 -0
- package/src/i18n/locale/en-US.js +1 -0
- package/src/i18n/locale/lang.js +1 -0
- package/src/i18n/locale/zh-CN.js +1 -0
- package/src/i18n/locale.js +102 -0
- package/src/index.js +222 -0
- package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
- package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
- package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
- package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
- package/src/layouts/basic-layout/header-log/index.vue +41 -0
- package/src/layouts/basic-layout/header-logo/index.vue +23 -0
- package/src/layouts/basic-layout/header-notice/index.vue +218 -0
- package/src/layouts/basic-layout/header-reload/index.vue +21 -0
- package/src/layouts/basic-layout/header-search/index.vue +37 -0
- package/src/layouts/basic-layout/header-setting/index.vue +219 -0
- package/src/layouts/basic-layout/header-user/index.vue +175 -0
- package/src/layouts/basic-layout/i18n.js +50 -0
- package/src/layouts/basic-layout/index.vue +280 -0
- package/src/layouts/basic-layout/menu-head/index.vue +120 -0
- package/src/layouts/basic-layout/menu-head/title.vue +48 -0
- package/src/layouts/basic-layout/menu-side/index.vue +113 -0
- package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
- package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
- package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
- package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
- package/src/layouts/basic-layout/mixins/click-item.js +21 -0
- package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
- package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
- package/src/layouts/basic-layout/tabs/index.vue +192 -0
- package/src/layouts/basic-layout/water-mark/index.vue +29 -0
- package/src/libs/lodop/index.js +145 -0
- package/src/libs/random_str.js +10 -0
- package/src/libs/request/index.js +158 -0
- package/src/libs/system/index.js +234 -0
- package/src/libs/util.cookies.js +44 -0
- package/src/libs/util.db.js +13 -0
- package/src/libs/util.js +55 -0
- package/src/libs/util.log.js +88 -0
- package/src/libs/water-mark.js +44 -0
- package/src/menu/header.js +20 -0
- package/src/menu/modules/dashboard.js +23 -0
- package/src/menu/sider.js +12 -0
- package/src/mixins/app.js +9 -0
- package/src/mixins/page.js +643 -0
- package/src/pages/account/login.vue +101 -0
- package/src/pages/common/home.vue +169 -0
- package/src/pages/common/task-form.vue +350 -0
- package/src/pages/common/todo.vue +31 -0
- package/src/pages/system/apiLog.vue +79 -0
- package/src/pages/system/applicationType.vue +182 -0
- package/src/pages/system/customPage.vue +62 -0
- package/src/pages/system/customTable.vue +98 -0
- package/src/pages/system/dict.vue +36 -0
- package/src/pages/system/dictType.vue +58 -0
- package/src/pages/system/entityView.vue +38 -0
- package/src/pages/system/error/404.vue +6 -0
- package/src/pages/system/extendColumn.vue +99 -0
- package/src/pages/system/formView.vue +136 -0
- package/src/pages/system/log.vue +55 -0
- package/src/pages/system/notice.vue +26 -0
- package/src/pages/system/openApi.vue +26 -0
- package/src/pages/system/openUser.vue +66 -0
- package/src/pages/system/organization.vue +98 -0
- package/src/pages/system/organizationType.vue +26 -0
- package/src/pages/system/permission.vue +175 -0
- package/src/pages/system/planJob.vue +40 -0
- package/src/pages/system/printTemplate.vue +48 -0
- package/src/pages/system/process.vue +79 -0
- package/src/pages/system/processType.vue +26 -0
- package/src/pages/system/role.vue +395 -0
- package/src/pages/system/rolePropertyEdit.vue +480 -0
- package/src/pages/system/sequenceSetting.vue +26 -0
- package/src/pages/system/systemData.vue +52 -0
- package/src/pages/system/tableView.vue +386 -0
- package/src/pages/system/taskQueue.vue +48 -0
- package/src/pages/system/user.vue +250 -0
- package/src/pages/template/processPage.vue +243 -0
- package/src/pages/template/reportPage.vue +66 -0
- package/src/pages/template/viewPage.vue +139 -0
- package/src/plugins/auth/index.js +21 -0
- package/src/plugins/error/index.js +31 -0
- package/src/plugins/index.js +24 -0
- package/src/plugins/sweetalert2/index.js +20 -0
- package/src/router/dynamic.js +183 -0
- package/src/router/index.js +84 -0
- package/src/setting.js +202 -0
- package/src/store/index.js +9 -0
- package/src/store/modules/admin/index.js +16 -0
- package/src/store/modules/admin/modules/account.js +103 -0
- package/src/store/modules/admin/modules/cache.js +119 -0
- package/src/store/modules/admin/modules/dataView.js +112 -0
- package/src/store/modules/admin/modules/db.js +231 -0
- package/src/store/modules/admin/modules/i18n.js +87 -0
- package/src/store/modules/admin/modules/layout.js +115 -0
- package/src/store/modules/admin/modules/loader.js +44 -0
- package/src/store/modules/admin/modules/log.js +77 -0
- package/src/store/modules/admin/modules/menu.js +338 -0
- package/src/store/modules/admin/modules/page.js +466 -0
- package/src/store/modules/admin/modules/user.js +96 -0
- package/src/store/modules/admin/modules/viewPage.js +34 -0
- package/src/styles/common.less +47 -0
- package/src/styles/css/default.css +510 -0
- package/src/styles/css/login.css +1217 -0
- package/src/styles/default/index.less +6 -0
- package/src/styles/font/demo.css +539 -0
- package/src/styles/font/demo_index.html +372 -0
- package/src/styles/font/icon-demo/demo.css +539 -0
- package/src/styles/font/icon-demo/demo_index.html +423 -0
- package/src/styles/font/icon-demo/iconfont.css +61 -0
- package/src/styles/font/icon-demo/iconfont.eot +0 -0
- package/src/styles/font/icon-demo/iconfont.js +1 -0
- package/src/styles/font/icon-demo/iconfont.svg +59 -0
- package/src/styles/font/icon-demo/iconfont.ttf +0 -0
- package/src/styles/font/icon-demo/iconfont.woff +0 -0
- package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
- package/src/styles/font/iconfont.css +47 -0
- package/src/styles/font/iconfont.js +1 -0
- package/src/styles/font/iconfont.json +65 -0
- package/src/styles/font/iconfont.ttf +0 -0
- package/src/styles/font/iconfont.woff +0 -0
- package/src/styles/font/iconfont.woff2 +0 -0
- package/src/styles/font/ionicons.svg +870 -0
- package/src/styles/font/ionicons.ttf +0 -0
- package/src/styles/font/ionicons.woff +0 -0
- package/src/styles/font/ionicons.woff2 +0 -0
- package/src/styles/index.less +7 -0
- package/src/styles/layout/basic-layout/layout.less +527 -0
- package/src/styles/layout/basic-layout/menu.less +274 -0
- package/src/styles/layout/index.less +2 -0
- package/src/styles/setting.less +6 -0
- package/styleguide.config.js +22 -0
- package/test/api/barcode.js +50 -0
- package/test/api/inbound.js +47 -0
- package/test/api/interfaceLog.js +15 -0
- package/test/api/interfaceQueue.js +15 -0
- package/test/api/interfaceServer.js +29 -0
- package/test/api/movePlan.js +50 -0
- package/test/api/movePlanItem.js +13 -0
- package/test/api/moveType.js +22 -0
- package/test/api/openApiPermission.js +25 -0
- package/test/api/outbound.js +40 -0
- package/test/api/permission.js +34 -0
- package/test/api/rolePermission.js +17 -0
- package/test/api/user.js +40 -0
- package/test/api/viewColumn.js +16 -0
- package/test/api/warehouse.js +13 -0
- package/test/api/warehouseMoveType.js +18 -0
- package/test/main.js +55 -0
- package/test/package.js +33 -0
- package/test/pages/home/index.vue +22 -0
- package/test/pages/task/test.vue +28 -0
- package/test/pages/test/dataViewTest.vue +28 -0
- package/test/pages/test/logReport.vue +25 -0
- package/test/pages/test/testPage.vue +38 -0
- package/test/router/routes.js +88 -0
- package/test/setting.env.js +22 -0
- package/test/styles/css/custom.css +0 -0
- package/test/styles/css/login.css +1217 -0
- package/vite.config.js +72 -0
- package/vue.config.js +20 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="i-layout-page-header">
|
|
4
|
+
<PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
|
|
5
|
+
</div>
|
|
6
|
+
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
7
|
+
<view-table ref="table" view-code="PrintTemplate" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)"></view-table>
|
|
8
|
+
</Card>
|
|
9
|
+
<modal-form ref="form" view-code="PrintTemplateEdit" @on-change="formChange" @on-after-save="$refs.table.loadData()" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
import mixinPage from '../../mixins/page';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'system-printTemplate',
|
|
17
|
+
mixins: [mixinPage],
|
|
18
|
+
components: {},
|
|
19
|
+
data() {
|
|
20
|
+
return {};
|
|
21
|
+
},
|
|
22
|
+
computed: {},
|
|
23
|
+
created() {},
|
|
24
|
+
methods: {
|
|
25
|
+
formChange() {
|
|
26
|
+
const data = this.$refs.form.data;
|
|
27
|
+
const columns = this.$refs.form.columns;
|
|
28
|
+
const pageWidth = columns.find(item => {
|
|
29
|
+
return item.code === 'pageWidth';
|
|
30
|
+
});
|
|
31
|
+
const pageHeight = columns.find(item => {
|
|
32
|
+
return item.code === 'pageHeight';
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (data.pageName != undefined && data.pageName != 'custom') {
|
|
36
|
+
pageWidth.isShow = false;
|
|
37
|
+
pageHeight.isShow = false;
|
|
38
|
+
data.pageWidth = '';
|
|
39
|
+
data.pageHeight = '';
|
|
40
|
+
} else {
|
|
41
|
+
pageWidth.isShow = true;
|
|
42
|
+
pageHeight.isShow = true;
|
|
43
|
+
}
|
|
44
|
+
//this.$refs.form.forceUpdate();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="i-layout-page-header">
|
|
4
|
+
<PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
|
|
5
|
+
</div>
|
|
6
|
+
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
7
|
+
<view-table ref="table" view-code="Process" :selectEnable="true" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)">
|
|
8
|
+
<template #filterCommand>
|
|
9
|
+
<Button size="small" type="info" custom-icon="fa fa-cloud-download-alt" @click="exportFile()">导出</Button>
|
|
10
|
+
<file-upload url="api/Process/importFile" accept=".proc" @on-success="importFileSuccess" style="display: inline-block; margin-left: 4px; margin-right: 4px">
|
|
11
|
+
<template #>
|
|
12
|
+
<Button type="primary" custom-icon="fa fa-cloud-upload-alt" size="small">导入</Button>
|
|
13
|
+
</template>
|
|
14
|
+
</file-upload>
|
|
15
|
+
</template>
|
|
16
|
+
<template #command="{ row }">
|
|
17
|
+
<Button size="small" title="流程定义" type="primary" custom-icon="fa fa-route" @click="$refs.flowChart.open({ processID: row.id })"></Button>
|
|
18
|
+
<Button size="small" title="版本" type="info" custom-icon="fa fa-bars" @click="$refs.processDefTable.open({ processID: row.id })"></Button>
|
|
19
|
+
</template>
|
|
20
|
+
</view-table>
|
|
21
|
+
</Card>
|
|
22
|
+
<modal-form ref="form" view-code="ProcessEdit" @on-after-save="$refs.table.loadData()" />
|
|
23
|
+
<modal-table ref="processDefTable" view-code="ProcessDefModal">
|
|
24
|
+
<template #command="{ row }">
|
|
25
|
+
<Button size="small" title="流程定义" type="primary" custom-icon="fa fa-route" @click="$refs.flowChart.open({ id: row.id })"></Button>
|
|
26
|
+
<Button size="small" v-if="!row.isActive" title="激活此版本" type="primary" custom-icon="fa fa-star" @click="active(row)"></Button>
|
|
27
|
+
</template>
|
|
28
|
+
</modal-table>
|
|
29
|
+
<flow-chart ref="flowChart" />
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<script>
|
|
33
|
+
import mixinPage from '../../mixins/page';
|
|
34
|
+
import flowChart from '../../components/workflow/flow-chart';
|
|
35
|
+
import processApi from '../../api/process';
|
|
36
|
+
import processDefApi from '../../api/processDef';
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
name: 'system-process',
|
|
40
|
+
mixins: [mixinPage],
|
|
41
|
+
components: { flowChart },
|
|
42
|
+
data() {
|
|
43
|
+
return {};
|
|
44
|
+
},
|
|
45
|
+
computed: {},
|
|
46
|
+
created() {},
|
|
47
|
+
methods: {
|
|
48
|
+
// 激活版本
|
|
49
|
+
active(row) {
|
|
50
|
+
this.confirm('确定要激活该版本吗?', async () => {
|
|
51
|
+
await processDefApi.active(row.id);
|
|
52
|
+
this.success('激活成功!');
|
|
53
|
+
this.$refs.processDefTable.loadData();
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
// 导出文件
|
|
57
|
+
exportFile() {
|
|
58
|
+
let ids = this.$refs.table.getSelected().map(x => {
|
|
59
|
+
return x.id;
|
|
60
|
+
});
|
|
61
|
+
if (ids.length > 0) {
|
|
62
|
+
processApi.exportFile(ids);
|
|
63
|
+
} else {
|
|
64
|
+
this.error('请选择需要导出的内容!');
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
// 导入成功
|
|
68
|
+
importFileSuccess(res) {
|
|
69
|
+
if (res.code == 0) {
|
|
70
|
+
this.success('导入成功!', () => {
|
|
71
|
+
this.$refs.table.loadData();
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
this.error(res.message);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="i-layout-page-header">
|
|
4
|
+
<PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
|
|
5
|
+
</div>
|
|
6
|
+
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
7
|
+
<view-table ref="table" view-code="ProcessType" @create="$refs.form.open()" @edit="({ row, index }) => $refs.form.open(row)"></view-table>
|
|
8
|
+
</Card>
|
|
9
|
+
<modal-form ref="form" view-code="ProcessTypeEdit" @on-after-save="$refs.table.loadData()" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
import mixinPage from '../../mixins/page';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'system-processType',
|
|
17
|
+
mixins: [mixinPage],
|
|
18
|
+
components: {},
|
|
19
|
+
data() {
|
|
20
|
+
return {};
|
|
21
|
+
},
|
|
22
|
+
computed: {},
|
|
23
|
+
created() {},
|
|
24
|
+
methods: {}
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="i-layout-page-header">
|
|
4
|
+
<PageHeader :title="$route.meta.title" :content="$route.meta.description" hidden-breadcrumb />
|
|
5
|
+
</div>
|
|
6
|
+
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
7
|
+
<view-table ref="table" view-code="Role" @create="$refs.form.open()">
|
|
8
|
+
<template #command="{ row }">
|
|
9
|
+
<Button size="small" title="用户" type="info" custom-icon="fa fa-user" @click="$refs.userRoleTable.open({ roleID: row.id })"></Button>
|
|
10
|
+
<Button size="small" title="编辑" type="primary" custom-icon="fa fa-edit" @click="$refs.form.open(row)"></Button>
|
|
11
|
+
<Button size="small" title="权限" type="primary" custom-icon="fa fa-desktop" @click="openPermission(row)"></Button>
|
|
12
|
+
<Button size="small" title="参数" type="info" custom-icon="fa fa-ethernet" @click="$refs.rolePropertyTable.open({ roleID: row.id })"></Button>
|
|
13
|
+
<Button size="small" title="删除" type="warning" custom-icon="fa fa-trash-alt" @click="$refs.table.remove(row)"></Button>
|
|
14
|
+
</template>
|
|
15
|
+
</view-table>
|
|
16
|
+
</Card>
|
|
17
|
+
<modal-form ref="form" view-code="RoleEdit" @on-after-save="$refs.table.loadData()" />
|
|
18
|
+
<modal-table ref="userRoleTable" view-code="RoleUser" @edit="({ row }) => editUserRole(row)">
|
|
19
|
+
<template #filterCommand>
|
|
20
|
+
<Button size="small" type="primary" custom-icon="fa fa-plus" @click="addUserRole()">添加</Button>
|
|
21
|
+
</template>
|
|
22
|
+
</modal-table>
|
|
23
|
+
<modal-form ref="userRoleForm" view-code="RoleUserEdit" @on-after-save="$refs.userRoleTable.loadData()">
|
|
24
|
+
<template #bottom>
|
|
25
|
+
<view-table ref="userRoleDataTable" view-code="UserRoleDataEdit" :static="true">
|
|
26
|
+
<template #column="{ row, code }">
|
|
27
|
+
<template v-if="row.controlType === 'TextInput'">
|
|
28
|
+
<Input type="text" size="small" v-model="row.propertyValue" />
|
|
29
|
+
</template>
|
|
30
|
+
<template v-else-if="row.controlType === 'NumberInput'">
|
|
31
|
+
<Input type="number" size="small" number v-model="row.propertyValue" />
|
|
32
|
+
</template>
|
|
33
|
+
<template v-else-if="row.controlType === 'Select'">
|
|
34
|
+
<Select size="small" v-model="row.propertyValue" clearable :transfer="true">
|
|
35
|
+
<Option v-for="item in row._dataSource" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
36
|
+
</Select>
|
|
37
|
+
</template>
|
|
38
|
+
<template v-else-if="row.controlType === 'MultiSelect'">
|
|
39
|
+
<Select
|
|
40
|
+
size="small"
|
|
41
|
+
:model-value="row.propertyValue == null ? null : JSON.parse(row.propertyValue)"
|
|
42
|
+
@update:model-value="
|
|
43
|
+
$event => {
|
|
44
|
+
row.propertyValue = $event.length == 0 ? null : JSON.stringify($event);
|
|
45
|
+
}
|
|
46
|
+
"
|
|
47
|
+
:multiple="true"
|
|
48
|
+
clearable
|
|
49
|
+
:transfer="true"
|
|
50
|
+
>
|
|
51
|
+
<Option v-for="item in row._dataSource" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
52
|
+
</Select>
|
|
53
|
+
</template>
|
|
54
|
+
<template v-else-if="row.controlType === 'DialogSelect'">
|
|
55
|
+
<dialog-select
|
|
56
|
+
v-model="row.propertyValue"
|
|
57
|
+
size="small"
|
|
58
|
+
:source="row.source"
|
|
59
|
+
:source-data-code="row.sourceDataCode"
|
|
60
|
+
:source-display-code="row.sourceDisplayCode"
|
|
61
|
+
:param="getParam(row)"
|
|
62
|
+
></dialog-select>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else-if="row.controlType === 'MultiDialogSelect'">
|
|
65
|
+
<dialog-select
|
|
66
|
+
v-model="row.propertyValue"
|
|
67
|
+
size="small"
|
|
68
|
+
:multi="true"
|
|
69
|
+
:source="row.source"
|
|
70
|
+
:source-data-code="row.sourceDataCode"
|
|
71
|
+
:source-display-code="row.sourceDisplayCode"
|
|
72
|
+
:param="getParam(row)"
|
|
73
|
+
></dialog-select>
|
|
74
|
+
</template>
|
|
75
|
+
<template v-else-if="row.controlType === 'Check'">
|
|
76
|
+
<Checkbox :model-value="!!parseData(row, code)" @update:model-value="$event => setData(row, code, $event)" />
|
|
77
|
+
</template>
|
|
78
|
+
</template>
|
|
79
|
+
</view-table>
|
|
80
|
+
</template>
|
|
81
|
+
<template #footer>
|
|
82
|
+
<Button type="primary" custom-icon="fa fa-save" @click="userRoleSave">保存</Button>
|
|
83
|
+
</template>
|
|
84
|
+
</modal-form>
|
|
85
|
+
<modal-table
|
|
86
|
+
ref="rolePropertyTable"
|
|
87
|
+
view-code="RolePropertyModal"
|
|
88
|
+
@create="
|
|
89
|
+
$refs.rolePropertyEdit.open({ roleID: $refs.rolePropertyTable.param.roleID }, () => {
|
|
90
|
+
$refs.rolePropertyTable.loadData();
|
|
91
|
+
})
|
|
92
|
+
"
|
|
93
|
+
@edit="
|
|
94
|
+
({ row, index }) =>
|
|
95
|
+
$refs.rolePropertyEdit.open(row, () => {
|
|
96
|
+
$refs.rolePropertyTable.loadData();
|
|
97
|
+
})
|
|
98
|
+
"
|
|
99
|
+
></modal-table>
|
|
100
|
+
<role-property-edit ref="rolePropertyEdit" />
|
|
101
|
+
<Modal
|
|
102
|
+
v-model="permissionOpened"
|
|
103
|
+
scrollable
|
|
104
|
+
:mask-closable="layout.maskClosable"
|
|
105
|
+
:draggable="layout.draggable"
|
|
106
|
+
:sticky="true"
|
|
107
|
+
:reset-drag-position="true"
|
|
108
|
+
:width="800"
|
|
109
|
+
:styles="{ top: '4vh' }"
|
|
110
|
+
>
|
|
111
|
+
<template #header>
|
|
112
|
+
<div>
|
|
113
|
+
<span class="title">权限</span>
|
|
114
|
+
<span class="description">Permission</span>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
<div class="ivu-ml-8 ivu-mr-8">
|
|
118
|
+
<Form label-position="top" label-colon=":" class="ivu-mt">
|
|
119
|
+
<Row :gutter="24" type="flex">
|
|
120
|
+
<Col span="24">
|
|
121
|
+
<FormItem label="终端类型" key="clientType" prop="clientType">
|
|
122
|
+
<RadioGroup v-model="clientType" @on-change="loadPermission()">
|
|
123
|
+
<Radio v-for="item in clientTypes" :key="item.code" :label="item.code">
|
|
124
|
+
<span>{{ item.name }}</span>
|
|
125
|
+
</Radio>
|
|
126
|
+
</RadioGroup>
|
|
127
|
+
</FormItem>
|
|
128
|
+
</Col>
|
|
129
|
+
</Row>
|
|
130
|
+
</Form>
|
|
131
|
+
<Tree :data="permissions" show-checkbox></Tree>
|
|
132
|
+
</div>
|
|
133
|
+
<template #footer>
|
|
134
|
+
<div>
|
|
135
|
+
<Button type="primary" custom-icon="fa fa-save" @click="savePermission()">确定</Button>
|
|
136
|
+
<Button type="default" custom-icon="fa fa-times" @click="permissionOpened = false">关闭</Button>
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
</Modal>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
<script>
|
|
143
|
+
import customModelApi from '../../api/customModel';
|
|
144
|
+
import mixinPage from '../../mixins/page';
|
|
145
|
+
import modelApi from '../../api/model';
|
|
146
|
+
import permissionApi from '../../api/permission';
|
|
147
|
+
import rolePermissionApi from '../../api/rolePermission';
|
|
148
|
+
import rolePropertyEdit from './rolePropertyEdit.vue';
|
|
149
|
+
|
|
150
|
+
// 转换为tree列表对象
|
|
151
|
+
var convertList = nodes => {
|
|
152
|
+
if (!nodes) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return nodes.map(item => {
|
|
157
|
+
if (!item.subPermissions) {
|
|
158
|
+
item.subPermissions = [];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
let children = convertList(item.subPermissions);
|
|
162
|
+
|
|
163
|
+
if (item.permissionPoints) {
|
|
164
|
+
// 权限点
|
|
165
|
+
item.permissionPoints.forEach(permissionPoint => {
|
|
166
|
+
children.push({
|
|
167
|
+
id: item.id + '-' + permissionPoint.code,
|
|
168
|
+
title: permissionPoint.name + ' (' + permissionPoint.code + ')',
|
|
169
|
+
checked: permissionPoint.checked
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
id: item.id,
|
|
176
|
+
title: item.name + ' (' + item.subName + ')',
|
|
177
|
+
checked: item.checked && (children == null || children.length === 0),
|
|
178
|
+
expand: children != null,
|
|
179
|
+
children: children
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// 获取选中项目
|
|
185
|
+
var getChecked = data => {
|
|
186
|
+
let checked = [];
|
|
187
|
+
|
|
188
|
+
data.forEach(item => {
|
|
189
|
+
if (item.checked) {
|
|
190
|
+
checked.push(item.id);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (item.children) {
|
|
194
|
+
let children = getChecked(item.children);
|
|
195
|
+
if (children.length > 0 && !item.checked) {
|
|
196
|
+
checked.push(item.id);
|
|
197
|
+
}
|
|
198
|
+
checked = checked.concat(children);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return checked;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default {
|
|
206
|
+
name: 'system-role',
|
|
207
|
+
mixins: [mixinPage],
|
|
208
|
+
components: { rolePropertyEdit },
|
|
209
|
+
data() {
|
|
210
|
+
return {
|
|
211
|
+
roleID: null,
|
|
212
|
+
permissions: [],
|
|
213
|
+
permissionOpened: false,
|
|
214
|
+
clientType: null,
|
|
215
|
+
clientTypes: [],
|
|
216
|
+
roleProperties: []
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
computed: {},
|
|
220
|
+
async created() {
|
|
221
|
+
const res = await modelApi.query('Dict', { 'type.code': 'ClientType' });
|
|
222
|
+
this.clientTypes = res.data;
|
|
223
|
+
this.clientType = this.clientTypes[0].code;
|
|
224
|
+
},
|
|
225
|
+
methods: {
|
|
226
|
+
// 权限
|
|
227
|
+
async openPermission(row) {
|
|
228
|
+
this.roleID = row.id;
|
|
229
|
+
this.loadPermission();
|
|
230
|
+
this.permissionOpened = true;
|
|
231
|
+
},
|
|
232
|
+
// 加载权限
|
|
233
|
+
async loadPermission() {
|
|
234
|
+
const res = await permissionApi.queryByRoleID(this.roleID, this.clientType);
|
|
235
|
+
this.permissions = convertList(res);
|
|
236
|
+
},
|
|
237
|
+
// 保存权限
|
|
238
|
+
savePermission() {
|
|
239
|
+
let permissionIDs = getChecked(this.permissions);
|
|
240
|
+
|
|
241
|
+
this.confirm('确定要保存权限设置吗?', async () => {
|
|
242
|
+
await rolePermissionApi.update(this.roleID, this.clientType, permissionIDs);
|
|
243
|
+
this.success('操作成功!', () => {
|
|
244
|
+
this.permissionOpened = false;
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
// 给角色添加用户
|
|
249
|
+
async addUserRole() {
|
|
250
|
+
this.$refs.userRoleForm.columns.find(item => item.code == 'userID').isReadonly = false;
|
|
251
|
+
|
|
252
|
+
let roleID = this.$refs.userRoleTable.param.roleID;
|
|
253
|
+
const res = await modelApi.query('RoleProperty', { roleID });
|
|
254
|
+
|
|
255
|
+
this.roleProperties = res.data.map(item => {
|
|
256
|
+
return {
|
|
257
|
+
...item,
|
|
258
|
+
propertyValue: null
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
await this.initDataSource();
|
|
262
|
+
|
|
263
|
+
this.$refs.userRoleDataTable.loadData(this.roleProperties);
|
|
264
|
+
this.$refs.userRoleForm.openDefault(this.$refs.userRoleTable.param);
|
|
265
|
+
},
|
|
266
|
+
// 用户角色编辑
|
|
267
|
+
async editUserRole(row) {
|
|
268
|
+
this.$refs.userRoleForm.columns.find(item => item.code == 'userID').isReadonly = true;
|
|
269
|
+
|
|
270
|
+
let roleID = row.roleID;
|
|
271
|
+
let res = await modelApi.query('RoleProperty', { roleID });
|
|
272
|
+
let roleProperties = res.data;
|
|
273
|
+
|
|
274
|
+
let userRoleDatas = [];
|
|
275
|
+
|
|
276
|
+
res = await modelApi.query('UserRoleData', { userID: row.userID, roleID: row.roleID });
|
|
277
|
+
userRoleDatas = res.data;
|
|
278
|
+
|
|
279
|
+
this.roleProperties = roleProperties.map(roleProperty => {
|
|
280
|
+
let userRoleData = userRoleDatas.find(item => item.propertyCode == roleProperty.propertyCode);
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
...roleProperty,
|
|
284
|
+
propertyValue: userRoleData == null ? null : userRoleData.propertyValue
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
await this.initDataSource();
|
|
288
|
+
|
|
289
|
+
this.$refs.userRoleDataTable.loadData(this.roleProperties);
|
|
290
|
+
this.$refs.userRoleForm.open(row);
|
|
291
|
+
},
|
|
292
|
+
// 加载数据源
|
|
293
|
+
async initDataSource() {
|
|
294
|
+
for (let i = 0; i < this.roleProperties.length; i++) {
|
|
295
|
+
let item = this.roleProperties[i];
|
|
296
|
+
if (!!(item.source || '').trim()) {
|
|
297
|
+
if (item.controlType === 'Select' || item.controlType === 'MultiSelect') {
|
|
298
|
+
item._dataSource = [];
|
|
299
|
+
let param = this.getParam(item);
|
|
300
|
+
|
|
301
|
+
// 选择框、单选框组
|
|
302
|
+
if (param != null) {
|
|
303
|
+
await this.fillDataSource(item, param);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
// 填充数据源
|
|
310
|
+
async fillDataSource(data, param) {
|
|
311
|
+
// 参数完整,查询数据
|
|
312
|
+
let res;
|
|
313
|
+
if (data.isSourceCustom) {
|
|
314
|
+
res = await customModelApi.query(data.source, param);
|
|
315
|
+
} else {
|
|
316
|
+
res = await modelApi.query(data.source, param);
|
|
317
|
+
}
|
|
318
|
+
res.data.forEach(item => {
|
|
319
|
+
data._dataSource.push({
|
|
320
|
+
id: !(data.sourceDataCode || '').trim() ? item.id : this.parseData(item, data.sourceDataCode),
|
|
321
|
+
name: this.parseData(item, data.sourceDisplayCode)
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
// 获取参数
|
|
326
|
+
getParam(data) {
|
|
327
|
+
let param = {};
|
|
328
|
+
|
|
329
|
+
if (!!(data.param || '').trim()) {
|
|
330
|
+
// 有参数
|
|
331
|
+
param = JSON.parse(data.param);
|
|
332
|
+
|
|
333
|
+
// 填充参数
|
|
334
|
+
for (let key in param) {
|
|
335
|
+
// 常量
|
|
336
|
+
let index = param[key].search(/^\[.*?\]$/);
|
|
337
|
+
if (index === 0) {
|
|
338
|
+
param[key] = param[key].substring(1, param[key].length - 1);
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// 变量
|
|
343
|
+
let paramData = this.parseData(data, param[key]);
|
|
344
|
+
|
|
345
|
+
if (paramData != null) {
|
|
346
|
+
param[key] = paramData;
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// 参数不完整
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return param;
|
|
356
|
+
},
|
|
357
|
+
// 用户角色保存
|
|
358
|
+
async userRoleSave() {
|
|
359
|
+
let isOK = await this.$refs.userRoleForm.validate();
|
|
360
|
+
|
|
361
|
+
if (!isOK) {
|
|
362
|
+
this.error('有内容不符合要求,请正确填写!');
|
|
363
|
+
} else {
|
|
364
|
+
this.confirm('确定要保存吗?', async () => {
|
|
365
|
+
let userRole = this.$refs.userRoleForm.getFullData();
|
|
366
|
+
|
|
367
|
+
if (!userRole) {
|
|
368
|
+
// 表格验证失败
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
let userRoleDatas = this.$refs.userRoleDataTable.data;
|
|
373
|
+
|
|
374
|
+
let data = {
|
|
375
|
+
userRole,
|
|
376
|
+
userRoleDatas
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
if (!userRole.id) {
|
|
380
|
+
await modelApi.add('UserRole', data);
|
|
381
|
+
} else {
|
|
382
|
+
await modelApi.update('UserRole', data);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.success('操作成功!', () => {
|
|
386
|
+
this.$refs.userRoleDataTable.loadData([]);
|
|
387
|
+
this.$refs.userRoleTable.loadData();
|
|
388
|
+
this.$refs.userRoleForm.close();
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
</script>
|