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,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<modal-table ref="table" view-code="TableFilterColumn" :static="true" :footer-enable="true" :draggable="true" :sticky="true" @on-drag-drop="dragDrop" v-if="active">
|
|
4
|
+
<template #command="{ row, index }">
|
|
5
|
+
<Button size="small" title="编辑" type="primary" ghost custom-icon="fa fa-edit" @click="edit(row, index)"></Button>
|
|
6
|
+
<Button size="small" title="上移" type="primary" ghost custom-icon="fa fa-chevron-up" @click="up(row, index)"></Button>
|
|
7
|
+
<Button size="small" title="下移" type="primary" ghost custom-icon="fa fa-chevron-down" @click="down(row, index)"></Button>
|
|
8
|
+
<Button size="small" title="移除" type="primary" ghost custom-icon="fa fa-times" @click="remove(row, index)"></Button>
|
|
9
|
+
</template>
|
|
10
|
+
<template #footer>
|
|
11
|
+
<Button type="primary" ghost custom-icon="fa fa-plus" @click="add">新增</Button>
|
|
12
|
+
<Button type="primary" custom-icon="fa fa-save" @click="save">保存</Button>
|
|
13
|
+
</template>
|
|
14
|
+
</modal-table>
|
|
15
|
+
<filter-edit ref="filterEdit" :data-view="dataView" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
import mixinPage from '../../mixins/page';
|
|
20
|
+
import filterEdit from './filter-edit';
|
|
21
|
+
import { mapActions } from 'vuex';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
mixins: [mixinPage],
|
|
25
|
+
components: { filterEdit },
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
active: false,
|
|
29
|
+
dataView: {}
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
created() {},
|
|
33
|
+
props: {},
|
|
34
|
+
computed: {},
|
|
35
|
+
methods: {
|
|
36
|
+
...mapActions('admin/dataView', {
|
|
37
|
+
resetDataView: 'reset',
|
|
38
|
+
saveDataView: 'save',
|
|
39
|
+
saveUserView: 'saveUserView',
|
|
40
|
+
saveDataViewSetting: 'saveSetting',
|
|
41
|
+
saveFilterColumn: 'saveFilterColumn'
|
|
42
|
+
}),
|
|
43
|
+
// 打开
|
|
44
|
+
open(dataView, columns) {
|
|
45
|
+
this.dataView = dataView;
|
|
46
|
+
this.active = true;
|
|
47
|
+
|
|
48
|
+
setTimeout(async () => {
|
|
49
|
+
this.$refs.table.loadData(columns);
|
|
50
|
+
this.$refs.table.open();
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
// 新增
|
|
54
|
+
add() {
|
|
55
|
+
this.$refs.filterEdit.open(null, data => {
|
|
56
|
+
let columns = this.$refs.table.data;
|
|
57
|
+
columns.push(data);
|
|
58
|
+
|
|
59
|
+
this.$refs.table.loadData(columns);
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
// 打开字段设置界面
|
|
63
|
+
edit(row, index) {
|
|
64
|
+
this.$refs.filterEdit.open(row, data => {
|
|
65
|
+
let columns = this.$refs.table.data;
|
|
66
|
+
columns.splice(index, 1, data);
|
|
67
|
+
|
|
68
|
+
this.$refs.table.loadData(columns);
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
// 上移
|
|
72
|
+
up(row, index) {
|
|
73
|
+
let columns = this.$refs.table.data;
|
|
74
|
+
if (index > 0) {
|
|
75
|
+
columns.splice(index, 1);
|
|
76
|
+
columns.splice(index - 1, 0, row);
|
|
77
|
+
|
|
78
|
+
this.$refs.table.loadData(columns);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
// 下移
|
|
82
|
+
down(row, index) {
|
|
83
|
+
let columns = this.$refs.table.data;
|
|
84
|
+
if (index < columns.length - 1) {
|
|
85
|
+
columns.splice(index, 1);
|
|
86
|
+
columns.splice(index + 1, 0, row);
|
|
87
|
+
|
|
88
|
+
this.$refs.table.loadData(columns);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
// 拖动完成
|
|
92
|
+
dragDrop({ index1, index2 }) {
|
|
93
|
+
if (index1 != index2) {
|
|
94
|
+
let columns = this.$refs.table.data;
|
|
95
|
+
let row = columns[index1];
|
|
96
|
+
|
|
97
|
+
columns.splice(index1, 1);
|
|
98
|
+
columns.splice(index2, 0, row);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
// 移除
|
|
102
|
+
remove(row, index) {
|
|
103
|
+
let columns = this.$refs.table.data;
|
|
104
|
+
columns.splice(index, 1);
|
|
105
|
+
|
|
106
|
+
this.$refs.table.loadData(columns);
|
|
107
|
+
},
|
|
108
|
+
// 保存
|
|
109
|
+
save() {
|
|
110
|
+
this.confirm('确定要保存设置吗?', async () => {
|
|
111
|
+
let columns = this.$refs.table.data;
|
|
112
|
+
await this.saveFilterColumn({
|
|
113
|
+
code: this.dataView.code,
|
|
114
|
+
columns
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.$emit('on-change', this.dataView.code);
|
|
118
|
+
|
|
119
|
+
this.success('保存成功!', () => {
|
|
120
|
+
this.$refs.table.close();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Modal
|
|
4
|
+
ref="modal"
|
|
5
|
+
v-model="opened"
|
|
6
|
+
scrollable
|
|
7
|
+
:mask-closable="layout.maskClosable"
|
|
8
|
+
:draggable="layout.draggable"
|
|
9
|
+
:sticky="true"
|
|
10
|
+
:reset-drag-position="true"
|
|
11
|
+
:width="(dataView && dataView.width ? dataView.width : 800) + 350"
|
|
12
|
+
>
|
|
13
|
+
<template #header>
|
|
14
|
+
<div>
|
|
15
|
+
<slot name="header">
|
|
16
|
+
<span class="title">{{ dataView.name }}</span>
|
|
17
|
+
<span class="description">{{ dataView.description }}</span>
|
|
18
|
+
</slot>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<div class="container">
|
|
22
|
+
<div class="left">
|
|
23
|
+
<Card :bordered="false" dis-hover class="toolbox">
|
|
24
|
+
<Divider :plain="true" dashed class="title" size="small">默认列宽</Divider>
|
|
25
|
+
<RadioGroup v-model="columnWidth" @on-change="columnWidthChange">
|
|
26
|
+
<Radio label="Column12">整行</Radio>
|
|
27
|
+
<Radio label="Column6">二分之一</Radio>
|
|
28
|
+
<Radio label="Column4">三分之一</Radio>
|
|
29
|
+
<Radio label="Column3">四分之一</Radio>
|
|
30
|
+
<Radio label="Column2">六分之一</Radio>
|
|
31
|
+
</RadioGroup>
|
|
32
|
+
<template v-for="(componentGroup, index) in componentGroups" :key="index">
|
|
33
|
+
<Divider :plain="true" dashed class="title" size="small">{{ componentGroup.name }}</Divider>
|
|
34
|
+
<div style="width: 100%; display: flex">
|
|
35
|
+
<draggable
|
|
36
|
+
:animation="500"
|
|
37
|
+
v-model="componentGroup.components"
|
|
38
|
+
item-key="index"
|
|
39
|
+
:scroll="true"
|
|
40
|
+
:group="{
|
|
41
|
+
name: 'sort',
|
|
42
|
+
pull: 'clone',
|
|
43
|
+
put: false
|
|
44
|
+
}"
|
|
45
|
+
:sort="false"
|
|
46
|
+
:clone="clone"
|
|
47
|
+
filter=""
|
|
48
|
+
>
|
|
49
|
+
<template #item="{ element: component }">
|
|
50
|
+
<div style="width: 50%; float: left">
|
|
51
|
+
<Button icon="md-list-box" @dblclick="dblclick(component)" class="component">{{ component.name }}</Button>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</draggable>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
</Card>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="right">
|
|
60
|
+
<div class="ivu-ml-8 ivu-mr-8">
|
|
61
|
+
<view-form-draggable ref="form" @edit="({ column, index }) => edit(column, index)" @remove="({ column, index }) => remove(column, index)" />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<template #footer>
|
|
66
|
+
<div>
|
|
67
|
+
<Button type="primary" ghost custom-icon="fa fa-bars" @click="listMode">列表模式</Button>
|
|
68
|
+
<Button type="primary" v-if="!dataView.isVirtual" ghost custom-icon="fa fa-indent" @click="openColumnSelect">选择字段</Button>
|
|
69
|
+
<Button type="primary" custom-icon="fa fa-save" v-if="!isSetting" @click="save">保存</Button>
|
|
70
|
+
<Button type="error" custom-icon="fa fa-save" v-if="isSetting" @click="globalSave">全局保存</Button>
|
|
71
|
+
<Button type="error" custom-icon="fa fa-cog" v-if="isSetting" @click="setting">表单设置</Button>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
</Modal>
|
|
75
|
+
<column-select ref="columnSelect" />
|
|
76
|
+
<column-edit ref="columnEdit" view-type="FormView" />
|
|
77
|
+
<modal-form ref="setting" view-code="FormViewSetting" v-if="isSetting">
|
|
78
|
+
<template #footer>
|
|
79
|
+
<Button type="primary" custom-icon="fa fa-save" @click="saveSetting">保存</Button>
|
|
80
|
+
</template>
|
|
81
|
+
</modal-form>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
<script>
|
|
85
|
+
import { mapActions } from 'vuex';
|
|
86
|
+
import mixinPage from '../../mixins/page';
|
|
87
|
+
import columnEdit from './column-edit';
|
|
88
|
+
import columnSelect from './column-select';
|
|
89
|
+
import viewFormDraggable from './view-form-draggable';
|
|
90
|
+
import draggable from 'vuedraggable';
|
|
91
|
+
import enumApi from '../../api/enum';
|
|
92
|
+
|
|
93
|
+
export default {
|
|
94
|
+
mixins: [mixinPage],
|
|
95
|
+
components: { columnEdit, columnSelect, viewFormDraggable, draggable },
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
columnWidth: 'Column6',
|
|
99
|
+
opened: false,
|
|
100
|
+
dataView: {},
|
|
101
|
+
columns: [],
|
|
102
|
+
componentGroups: []
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
async created() {},
|
|
106
|
+
props: {
|
|
107
|
+
// 是否公共配置界面
|
|
108
|
+
isSetting: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
computed: {},
|
|
114
|
+
methods: {
|
|
115
|
+
...mapActions('admin/dataView', {
|
|
116
|
+
saveDataView: 'save',
|
|
117
|
+
saveDataViewSetting: 'saveSetting'
|
|
118
|
+
}),
|
|
119
|
+
// 打开
|
|
120
|
+
async open(dataView, columns) {
|
|
121
|
+
this.dataView = dataView;
|
|
122
|
+
this.columns = this.copy(columns);
|
|
123
|
+
this.$refs.form.init(this.dataView, this.columns);
|
|
124
|
+
this.opened = true;
|
|
125
|
+
|
|
126
|
+
const res = await enumApi.query('ControlType');
|
|
127
|
+
|
|
128
|
+
this.componentGroups = [
|
|
129
|
+
{
|
|
130
|
+
key: 'Normal',
|
|
131
|
+
name: '一般控件',
|
|
132
|
+
components: []
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: 'Datasource',
|
|
136
|
+
name: '数据源控件',
|
|
137
|
+
components: []
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: 'DateTime',
|
|
141
|
+
name: '日期时间控件',
|
|
142
|
+
components: []
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
key: 'Other',
|
|
146
|
+
name: '其他控件',
|
|
147
|
+
components: []
|
|
148
|
+
}
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
res.forEach(item => {
|
|
152
|
+
let component = {
|
|
153
|
+
code: null,
|
|
154
|
+
name: item.name,
|
|
155
|
+
controlType: item.id,
|
|
156
|
+
isShow: true,
|
|
157
|
+
isVirtual: dataView.isVirtual,
|
|
158
|
+
columnWidth: this.columnWidth,
|
|
159
|
+
dataView
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (
|
|
163
|
+
item.id == 'Label' ||
|
|
164
|
+
item.id == 'TextInput' ||
|
|
165
|
+
item.id == 'NumberInput' ||
|
|
166
|
+
item.id == 'Check' ||
|
|
167
|
+
item.id == 'Switch' ||
|
|
168
|
+
item.id == 'Slider' ||
|
|
169
|
+
item.id == 'TextArea'
|
|
170
|
+
) {
|
|
171
|
+
this.componentGroups.find(componentGroup => componentGroup.key == 'Normal').components.push(component);
|
|
172
|
+
} else if (
|
|
173
|
+
item.id == 'Select' ||
|
|
174
|
+
item.id == 'SelectWithOther' ||
|
|
175
|
+
item.id == 'MultiSelect' ||
|
|
176
|
+
item.id == 'ComboSelect' ||
|
|
177
|
+
item.id == 'DialogSelect' ||
|
|
178
|
+
item.id == 'MultiDialogSelect' ||
|
|
179
|
+
item.id == 'AutoComplete' ||
|
|
180
|
+
item.id == 'Radio' ||
|
|
181
|
+
item.id == 'CheckGroup'
|
|
182
|
+
) {
|
|
183
|
+
this.componentGroups.find(componentGroup => componentGroup.key == 'Datasource').components.push(component);
|
|
184
|
+
} else if (item.id == 'Date' || item.id == 'Time' || item.id == 'DateTime' || item.id == 'Year' || item.id == 'YearMonth' || item.id == 'DateRange') {
|
|
185
|
+
this.componentGroups.find(componentGroup => componentGroup.key == 'DateTime').components.push(component);
|
|
186
|
+
} else if (
|
|
187
|
+
item.id == 'Table' ||
|
|
188
|
+
item.id == 'List' ||
|
|
189
|
+
item.id == 'Attachment' ||
|
|
190
|
+
item.id == 'Image' ||
|
|
191
|
+
item.id == 'RichEditor' ||
|
|
192
|
+
item.id == 'Placeholder' ||
|
|
193
|
+
item.id == 'Custom'
|
|
194
|
+
) {
|
|
195
|
+
this.componentGroups.find(componentGroup => componentGroup.key == 'Other').components.push(component);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
// 关闭
|
|
200
|
+
close() {
|
|
201
|
+
this.opened = false;
|
|
202
|
+
},
|
|
203
|
+
// 打开字段设置界面
|
|
204
|
+
edit(row, index) {
|
|
205
|
+
this.$refs.columnEdit.open(row, index, this.columns, data => {
|
|
206
|
+
let columns = this.$refs.form.columns;
|
|
207
|
+
columns.splice(index, 1, data);
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
// 移除
|
|
211
|
+
remove(row, index) {
|
|
212
|
+
this.confirm('确认要删除该组件吗?', async () => {
|
|
213
|
+
let columns = this.$refs.form.columns;
|
|
214
|
+
columns.splice(index, 1);
|
|
215
|
+
//this.$forceUpdate();
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
// 打开字段选择界面
|
|
219
|
+
openColumnSelect() {
|
|
220
|
+
this.$refs.columnSelect.open(this.dataView, this.columns, checked => {
|
|
221
|
+
// 移除未勾选的
|
|
222
|
+
let columns = this.columns.filter(column => {
|
|
223
|
+
return (
|
|
224
|
+
checked.some(item => {
|
|
225
|
+
return column.code === item.code;
|
|
226
|
+
}) || column.isVirtual
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
this.columns.splice(0, this.columns.length);
|
|
231
|
+
columns.forEach(item => {
|
|
232
|
+
this.columns.push(item);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// 添加新勾选的
|
|
236
|
+
checked.forEach(item => {
|
|
237
|
+
if (
|
|
238
|
+
!this.columns.some(column => {
|
|
239
|
+
return column.code === item.code;
|
|
240
|
+
})
|
|
241
|
+
) {
|
|
242
|
+
this.columns.push({
|
|
243
|
+
code: item.code,
|
|
244
|
+
name: item.name,
|
|
245
|
+
dataType: item.dataType,
|
|
246
|
+
dataView: this.dataView,
|
|
247
|
+
isShow: true,
|
|
248
|
+
controlType: this.getDefaultControlType(item.dataType),
|
|
249
|
+
columnWidth: this.columnWidth, // 默认宽度1/2
|
|
250
|
+
source: item.objColumn != null ? item.objColumn.dataType : null,
|
|
251
|
+
sourceDataCode: item.objColumn != null ? 'id' : null,
|
|
252
|
+
sourceModel: item.objColumn != null ? item.objColumn.dataType : null,
|
|
253
|
+
sourceDisplayCode:
|
|
254
|
+
item.objColumn != null &&
|
|
255
|
+
item.objColumn.columns.some(function (column) {
|
|
256
|
+
return column.code === item.objColumn.code + '.name';
|
|
257
|
+
})
|
|
258
|
+
? 'name'
|
|
259
|
+
: null
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
//this.$forceUpdate();
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
// 全局保存
|
|
268
|
+
globalSave() {
|
|
269
|
+
this.confirm('确定要保存全局设置吗?', () => {
|
|
270
|
+
this.confirm('本次操作将修改全局设置,确认要保存吗?', async () => {
|
|
271
|
+
await this.saveDataView({
|
|
272
|
+
code: this.dataView.code,
|
|
273
|
+
columns: this.columns
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
this.$emit('on-change', this.dataView.code);
|
|
277
|
+
this.success('保存成功!', () => {
|
|
278
|
+
this.close();
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
// 保存
|
|
284
|
+
save() {
|
|
285
|
+
this.confirm('确定要保存设置吗?', async () => {
|
|
286
|
+
await this.saveDataView({
|
|
287
|
+
code: this.dataView.code,
|
|
288
|
+
columns: this.columns
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
this.success('保存成功!', () => {
|
|
292
|
+
this.close();
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
// 默认列宽变更
|
|
297
|
+
columnWidthChange() {
|
|
298
|
+
this.componentGroups.forEach(componentGroup => {
|
|
299
|
+
componentGroup.components.forEach(component => {
|
|
300
|
+
component.columnWidth = this.columnWidth;
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
// 拖动克隆
|
|
305
|
+
clone(item) {
|
|
306
|
+
return this.copy(item);
|
|
307
|
+
},
|
|
308
|
+
// 双击
|
|
309
|
+
dblclick(item) {
|
|
310
|
+
this.columns.push(this.copy(item));
|
|
311
|
+
},
|
|
312
|
+
// 设置
|
|
313
|
+
setting() {
|
|
314
|
+
this.$refs.setting.open(this.copy(this.dataView));
|
|
315
|
+
},
|
|
316
|
+
// 保存设置
|
|
317
|
+
saveSetting() {
|
|
318
|
+
this.confirm('确定要保存设置吗?', async () => {
|
|
319
|
+
let res = await this.saveDataViewSetting(this.$refs.setting.data);
|
|
320
|
+
this.dataView = res.dataView;
|
|
321
|
+
|
|
322
|
+
this.$emit('on-change', this.dataView.code);
|
|
323
|
+
this.success('保存成功!', () => {
|
|
324
|
+
this.$refs.setting.close();
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
},
|
|
328
|
+
// 切换至列表模式
|
|
329
|
+
listMode() {
|
|
330
|
+
this.$emit('list-mode', {
|
|
331
|
+
dataView: this.dataView,
|
|
332
|
+
columns: this.columns
|
|
333
|
+
});
|
|
334
|
+
},
|
|
335
|
+
// 获取默认控件类型
|
|
336
|
+
getDefaultControlType(dataType) {
|
|
337
|
+
if (dataType == 'Integer' || dataType == 'BigInteger' || dataType == 'Decimal' || dataType == 'Float' || dataType == 'Double') {
|
|
338
|
+
return 'NumberInput';
|
|
339
|
+
} else if (dataType == 'Boolean') {
|
|
340
|
+
return 'Check';
|
|
341
|
+
} else if (dataType == 'DateTime') {
|
|
342
|
+
return 'Date';
|
|
343
|
+
} else {
|
|
344
|
+
return 'TextInput';
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
</script>
|
|
350
|
+
|
|
351
|
+
<style scoped>
|
|
352
|
+
.container {
|
|
353
|
+
width: 100%;
|
|
354
|
+
display: flex;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.container .left .toolbox {
|
|
358
|
+
width: 350px;
|
|
359
|
+
margin-right: 8px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.container .left .toolbox .title {
|
|
363
|
+
font-weight: bold;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.container .right {
|
|
367
|
+
width: 100%;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.component {
|
|
371
|
+
margin: 5px;
|
|
372
|
+
width: 150px;
|
|
373
|
+
text-align: left;
|
|
374
|
+
}
|
|
375
|
+
</style>
|