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.
Files changed (283) hide show
  1. package/.env +5 -0
  2. package/.env.development +0 -0
  3. package/.env.production +0 -0
  4. package/.eslintignore +11 -0
  5. package/.eslintrc.js +47 -0
  6. package/.prettierrc +15 -0
  7. package/README.md +18 -0
  8. package/dist/favicon.ico +0 -0
  9. package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
  10. package/dist/mooho-base-admin-plus.min.js +279 -0
  11. package/dist/setting.js +31 -0
  12. package/dist/static/images/app-barcode.png +0 -0
  13. package/dist/static/images/login/bg.png +0 -0
  14. package/dist/static/images/login/logo.png +0 -0
  15. package/dist/static/images/login/password-active.png +0 -0
  16. package/dist/static/images/login/password-default.png +0 -0
  17. package/dist/static/images/login/signIn-img.png +0 -0
  18. package/dist/static/images/login/user-active.png +0 -0
  19. package/dist/static/images/login/user-default.png +0 -0
  20. package/dist/static/images/logo-dark.png +0 -0
  21. package/dist/static/images/logo-small.png +0 -0
  22. package/dist/static/images/logo.png +0 -0
  23. package/dist/static/images/logo.svg +510 -0
  24. package/dist/static/images/no-image.png +0 -0
  25. package/dist/style.css +4 -0
  26. package/index.html +18 -0
  27. package/other/pda.vue +28 -0
  28. package/package.json +59 -0
  29. package/public/favicon.ico +0 -0
  30. package/public/setting.js +31 -0
  31. package/public/static/images/app-barcode.png +0 -0
  32. package/public/static/images/login/bg.png +0 -0
  33. package/public/static/images/login/logo.png +0 -0
  34. package/public/static/images/login/password-active.png +0 -0
  35. package/public/static/images/login/password-default.png +0 -0
  36. package/public/static/images/login/signIn-img.png +0 -0
  37. package/public/static/images/login/user-active.png +0 -0
  38. package/public/static/images/login/user-default.png +0 -0
  39. package/public/static/images/logo-dark.png +0 -0
  40. package/public/static/images/logo-small.png +0 -0
  41. package/public/static/images/logo.png +0 -0
  42. package/public/static/images/logo.svg +510 -0
  43. package/public/static/images/no-image.png +0 -0
  44. package/src/App.vue +60 -0
  45. package/src/api/application.js +35 -0
  46. package/src/api/customModel.js +187 -0
  47. package/src/api/customPage.js +15 -0
  48. package/src/api/customTable.js +24 -0
  49. package/src/api/dataSource.js +93 -0
  50. package/src/api/dataView.js +199 -0
  51. package/src/api/dictType.js +23 -0
  52. package/src/api/entityView.js +13 -0
  53. package/src/api/enum.js +15 -0
  54. package/src/api/filterColumn.js +16 -0
  55. package/src/api/model.js +244 -0
  56. package/src/api/movePlan.js +29 -0
  57. package/src/api/notification.js +28 -0
  58. package/src/api/openApiPermission.js +25 -0
  59. package/src/api/permission.js +51 -0
  60. package/src/api/planJob.js +15 -0
  61. package/src/api/process.js +23 -0
  62. package/src/api/processDef.js +36 -0
  63. package/src/api/processInst.js +16 -0
  64. package/src/api/rolePermission.js +17 -0
  65. package/src/api/roleProperty.js +36 -0
  66. package/src/api/shortcut.js +20 -0
  67. package/src/api/system.js +23 -0
  68. package/src/api/task.js +56 -0
  69. package/src/api/taskQueue.js +24 -0
  70. package/src/api/user.js +45 -0
  71. package/src/api/viewColumn.js +16 -0
  72. package/src/assets/svg/body.svg +17 -0
  73. package/src/assets/svg/header-theme-dark.svg +40 -0
  74. package/src/assets/svg/header-theme-primary.svg +40 -0
  75. package/src/assets/svg/header-top.svg +40 -0
  76. package/src/assets/svg/icon-happy.svg +1 -0
  77. package/src/assets/svg/icon-sad.svg +1 -0
  78. package/src/assets/svg/icon-social-bilibili.svg +1 -0
  79. package/src/assets/svg/icon-social-dingding.svg +1 -0
  80. package/src/assets/svg/icon-social-facebook.svg +1 -0
  81. package/src/assets/svg/icon-social-juejin.svg +1 -0
  82. package/src/assets/svg/icon-social-qq.svg +1 -0
  83. package/src/assets/svg/icon-social-twitter.svg +1 -0
  84. package/src/assets/svg/icon-social-wechat.svg +1 -0
  85. package/src/assets/svg/icon-social-weibo.svg +1 -0
  86. package/src/assets/svg/icon-social-zhihu.svg +1 -0
  87. package/src/assets/svg/nav-theme-dark.svg +40 -0
  88. package/src/assets/svg/nav-theme-light.svg +40 -0
  89. package/src/components/copyright/index.vue +28 -0
  90. package/src/components/home/notice-list.vue +62 -0
  91. package/src/components/home/shortcut.vue +125 -0
  92. package/src/components/input/dialog-select.vue +301 -0
  93. package/src/components/input/item-select.vue +195 -0
  94. package/src/components/link/index.vue +54 -0
  95. package/src/components/richEditor/index.vue +86 -0
  96. package/src/components/upload/file-upload.vue +84 -0
  97. package/src/components/upload/upload-attachment.vue +119 -0
  98. package/src/components/upload/upload-image.vue +212 -0
  99. package/src/components/view/column-check.vue +223 -0
  100. package/src/components/view/column-edit.vue +850 -0
  101. package/src/components/view/column-select.vue +206 -0
  102. package/src/components/view/condition-edit.vue +164 -0
  103. package/src/components/view/filter-edit.vue +633 -0
  104. package/src/components/view/filter-setting.vue +126 -0
  105. package/src/components/view/form-setting-layout.vue +375 -0
  106. package/src/components/view/form-setting.vue +247 -0
  107. package/src/components/view/group-column.vue +104 -0
  108. package/src/components/view/group-method.vue +104 -0
  109. package/src/components/view/mixin.js +72 -0
  110. package/src/components/view/modal-form-filter.vue +319 -0
  111. package/src/components/view/modal-form-sort.vue +248 -0
  112. package/src/components/view/modal-form.vue +453 -0
  113. package/src/components/view/modal-table.vue +471 -0
  114. package/src/components/view/table-filter.vue +702 -0
  115. package/src/components/view/table-setting.vue +533 -0
  116. package/src/components/view/view-chart.vue +423 -0
  117. package/src/components/view/view-form-draggable.vue +837 -0
  118. package/src/components/view/view-form.vue +1444 -0
  119. package/src/components/view/view-table.vue +2261 -0
  120. package/src/components/workflow/flow-chart.vue +846 -0
  121. package/src/directive/focus.js +10 -0
  122. package/src/directive/tabHide.js +9 -0
  123. package/src/i18n/index.js +15 -0
  124. package/src/i18n/locale/en-US.js +1 -0
  125. package/src/i18n/locale/lang.js +1 -0
  126. package/src/i18n/locale/zh-CN.js +1 -0
  127. package/src/i18n/locale.js +102 -0
  128. package/src/index.js +222 -0
  129. package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
  130. package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
  131. package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
  132. package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
  133. package/src/layouts/basic-layout/header-log/index.vue +41 -0
  134. package/src/layouts/basic-layout/header-logo/index.vue +23 -0
  135. package/src/layouts/basic-layout/header-notice/index.vue +218 -0
  136. package/src/layouts/basic-layout/header-reload/index.vue +21 -0
  137. package/src/layouts/basic-layout/header-search/index.vue +37 -0
  138. package/src/layouts/basic-layout/header-setting/index.vue +219 -0
  139. package/src/layouts/basic-layout/header-user/index.vue +175 -0
  140. package/src/layouts/basic-layout/i18n.js +50 -0
  141. package/src/layouts/basic-layout/index.vue +280 -0
  142. package/src/layouts/basic-layout/menu-head/index.vue +120 -0
  143. package/src/layouts/basic-layout/menu-head/title.vue +48 -0
  144. package/src/layouts/basic-layout/menu-side/index.vue +113 -0
  145. package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
  146. package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
  147. package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
  148. package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
  149. package/src/layouts/basic-layout/mixins/click-item.js +21 -0
  150. package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
  151. package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
  152. package/src/layouts/basic-layout/tabs/index.vue +192 -0
  153. package/src/layouts/basic-layout/water-mark/index.vue +29 -0
  154. package/src/libs/lodop/index.js +145 -0
  155. package/src/libs/random_str.js +10 -0
  156. package/src/libs/request/index.js +158 -0
  157. package/src/libs/system/index.js +234 -0
  158. package/src/libs/util.cookies.js +44 -0
  159. package/src/libs/util.db.js +13 -0
  160. package/src/libs/util.js +55 -0
  161. package/src/libs/util.log.js +88 -0
  162. package/src/libs/water-mark.js +44 -0
  163. package/src/menu/header.js +20 -0
  164. package/src/menu/modules/dashboard.js +23 -0
  165. package/src/menu/sider.js +12 -0
  166. package/src/mixins/app.js +9 -0
  167. package/src/mixins/page.js +643 -0
  168. package/src/pages/account/login.vue +101 -0
  169. package/src/pages/common/home.vue +169 -0
  170. package/src/pages/common/task-form.vue +350 -0
  171. package/src/pages/common/todo.vue +31 -0
  172. package/src/pages/system/apiLog.vue +79 -0
  173. package/src/pages/system/applicationType.vue +182 -0
  174. package/src/pages/system/customPage.vue +62 -0
  175. package/src/pages/system/customTable.vue +98 -0
  176. package/src/pages/system/dict.vue +36 -0
  177. package/src/pages/system/dictType.vue +58 -0
  178. package/src/pages/system/entityView.vue +38 -0
  179. package/src/pages/system/error/404.vue +6 -0
  180. package/src/pages/system/extendColumn.vue +99 -0
  181. package/src/pages/system/formView.vue +136 -0
  182. package/src/pages/system/log.vue +55 -0
  183. package/src/pages/system/notice.vue +26 -0
  184. package/src/pages/system/openApi.vue +26 -0
  185. package/src/pages/system/openUser.vue +66 -0
  186. package/src/pages/system/organization.vue +98 -0
  187. package/src/pages/system/organizationType.vue +26 -0
  188. package/src/pages/system/permission.vue +175 -0
  189. package/src/pages/system/planJob.vue +40 -0
  190. package/src/pages/system/printTemplate.vue +48 -0
  191. package/src/pages/system/process.vue +79 -0
  192. package/src/pages/system/processType.vue +26 -0
  193. package/src/pages/system/role.vue +395 -0
  194. package/src/pages/system/rolePropertyEdit.vue +480 -0
  195. package/src/pages/system/sequenceSetting.vue +26 -0
  196. package/src/pages/system/systemData.vue +52 -0
  197. package/src/pages/system/tableView.vue +386 -0
  198. package/src/pages/system/taskQueue.vue +48 -0
  199. package/src/pages/system/user.vue +250 -0
  200. package/src/pages/template/processPage.vue +243 -0
  201. package/src/pages/template/reportPage.vue +66 -0
  202. package/src/pages/template/viewPage.vue +139 -0
  203. package/src/plugins/auth/index.js +21 -0
  204. package/src/plugins/error/index.js +31 -0
  205. package/src/plugins/index.js +24 -0
  206. package/src/plugins/sweetalert2/index.js +20 -0
  207. package/src/router/dynamic.js +183 -0
  208. package/src/router/index.js +84 -0
  209. package/src/setting.js +202 -0
  210. package/src/store/index.js +9 -0
  211. package/src/store/modules/admin/index.js +16 -0
  212. package/src/store/modules/admin/modules/account.js +103 -0
  213. package/src/store/modules/admin/modules/cache.js +119 -0
  214. package/src/store/modules/admin/modules/dataView.js +112 -0
  215. package/src/store/modules/admin/modules/db.js +231 -0
  216. package/src/store/modules/admin/modules/i18n.js +87 -0
  217. package/src/store/modules/admin/modules/layout.js +115 -0
  218. package/src/store/modules/admin/modules/loader.js +44 -0
  219. package/src/store/modules/admin/modules/log.js +77 -0
  220. package/src/store/modules/admin/modules/menu.js +338 -0
  221. package/src/store/modules/admin/modules/page.js +466 -0
  222. package/src/store/modules/admin/modules/user.js +96 -0
  223. package/src/store/modules/admin/modules/viewPage.js +34 -0
  224. package/src/styles/common.less +47 -0
  225. package/src/styles/css/default.css +510 -0
  226. package/src/styles/css/login.css +1217 -0
  227. package/src/styles/default/index.less +6 -0
  228. package/src/styles/font/demo.css +539 -0
  229. package/src/styles/font/demo_index.html +372 -0
  230. package/src/styles/font/icon-demo/demo.css +539 -0
  231. package/src/styles/font/icon-demo/demo_index.html +423 -0
  232. package/src/styles/font/icon-demo/iconfont.css +61 -0
  233. package/src/styles/font/icon-demo/iconfont.eot +0 -0
  234. package/src/styles/font/icon-demo/iconfont.js +1 -0
  235. package/src/styles/font/icon-demo/iconfont.svg +59 -0
  236. package/src/styles/font/icon-demo/iconfont.ttf +0 -0
  237. package/src/styles/font/icon-demo/iconfont.woff +0 -0
  238. package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
  239. package/src/styles/font/iconfont.css +47 -0
  240. package/src/styles/font/iconfont.js +1 -0
  241. package/src/styles/font/iconfont.json +65 -0
  242. package/src/styles/font/iconfont.ttf +0 -0
  243. package/src/styles/font/iconfont.woff +0 -0
  244. package/src/styles/font/iconfont.woff2 +0 -0
  245. package/src/styles/font/ionicons.svg +870 -0
  246. package/src/styles/font/ionicons.ttf +0 -0
  247. package/src/styles/font/ionicons.woff +0 -0
  248. package/src/styles/font/ionicons.woff2 +0 -0
  249. package/src/styles/index.less +7 -0
  250. package/src/styles/layout/basic-layout/layout.less +527 -0
  251. package/src/styles/layout/basic-layout/menu.less +274 -0
  252. package/src/styles/layout/index.less +2 -0
  253. package/src/styles/setting.less +6 -0
  254. package/styleguide.config.js +22 -0
  255. package/test/api/barcode.js +50 -0
  256. package/test/api/inbound.js +47 -0
  257. package/test/api/interfaceLog.js +15 -0
  258. package/test/api/interfaceQueue.js +15 -0
  259. package/test/api/interfaceServer.js +29 -0
  260. package/test/api/movePlan.js +50 -0
  261. package/test/api/movePlanItem.js +13 -0
  262. package/test/api/moveType.js +22 -0
  263. package/test/api/openApiPermission.js +25 -0
  264. package/test/api/outbound.js +40 -0
  265. package/test/api/permission.js +34 -0
  266. package/test/api/rolePermission.js +17 -0
  267. package/test/api/user.js +40 -0
  268. package/test/api/viewColumn.js +16 -0
  269. package/test/api/warehouse.js +13 -0
  270. package/test/api/warehouseMoveType.js +18 -0
  271. package/test/main.js +55 -0
  272. package/test/package.js +33 -0
  273. package/test/pages/home/index.vue +22 -0
  274. package/test/pages/task/test.vue +28 -0
  275. package/test/pages/test/dataViewTest.vue +28 -0
  276. package/test/pages/test/logReport.vue +25 -0
  277. package/test/pages/test/testPage.vue +38 -0
  278. package/test/router/routes.js +88 -0
  279. package/test/setting.env.js +22 -0
  280. package/test/styles/css/custom.css +0 -0
  281. package/test/styles/css/login.css +1217 -0
  282. package/vite.config.js +72 -0
  283. 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>