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,533 @@
1
+ <template>
2
+ <div>
3
+ <modal-table ref="table" :static="true" :setting-enable="false" :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" v-if="!dataView.isVirtual" ghost custom-icon="fa fa-indent" @click="openColumnSelect">选择字段</Button>
12
+ <!-- <Button type="primary"
13
+ ghost
14
+ custom-icon="fa fa-redo"
15
+ v-if="isSetting"
16
+ @click="reset">
17
+ 重置
18
+ </Button> -->
19
+ <Button type="primary" custom-icon="fa fa-bookmark" @click="createVirtual">虚拟字段</Button>
20
+ <!-- <Button type="primary"
21
+ ghost
22
+ custom-icon="fa fa-save"
23
+ v-if="isSetting"
24
+ @click="userSave">
25
+ 保存
26
+ </Button> -->
27
+ <Button type="primary" custom-icon="fa fa-save" v-if="!isSetting" @click="save">保存</Button>
28
+ <Button type="error" custom-icon="fa fa-save" v-if="isSetting" @click="globalSave">全局保存</Button>
29
+ <Button type="error" custom-icon="fa fa-cog" v-if="isSetting" @click="setting">表格设置</Button>
30
+ </template>
31
+ </modal-table>
32
+ <column-select ref="columnSelect" />
33
+ <column-edit ref="columnEdit" view-type="TableView" />
34
+ <modal-form ref="setting" view-code="TableViewSetting" v-if="isSetting">
35
+ <template #column="{ data, code }">
36
+ <div v-if="code == 'keywordColumn'">
37
+ <Input type="text" :readonly="true" v-model="data.keywordColumn" @click="keywordColumnOpen()"></Input>
38
+ </div>
39
+ <div v-if="code == 'sorting'">
40
+ <Input type="text" :readonly="true" v-model="sort" @click="$refs.modal_sort.open()">
41
+ <template #prepend></template>
42
+ <Button custom-icon="fa fa-edit" @click="$refs.modal_sort.open()"></Button>
43
+ </Input>
44
+ </div>
45
+ <div v-if="code == 'filtering'">
46
+ <Input type="text" :readonly="true" v-model="filter" @click="$refs.modal_filter.open()">
47
+ <template #prepend>
48
+ <Button custom-icon="fa fa-edit" @click="$refs.modal_filter.open()"></Button>
49
+ </template>
50
+ </Input>
51
+ </div>
52
+ <div v-if="code == 'batchSelectDataCode'">
53
+ <Input type="text" :readonly="true" v-model="$refs.setting.data.batchSelectDataCode" @click="openColumnCheck($refs.setting.data, 'batchSelectDataCode')">
54
+ <template #prepend>
55
+ <Button custom-icon="fa fa-search" @click="openColumnCheck($refs.setting.data, 'batchSelectDataCode')"></Button>
56
+ </template>
57
+ </Input>
58
+ </div>
59
+ <div v-if="code == 'groupColumn'">
60
+ <Input
61
+ type="text"
62
+ :readonly="true"
63
+ v-model="$refs.setting.data.groupColumn"
64
+ @click="
65
+ $refs.groupColumn.open(dataView.model, $refs.setting.data.groupColumn, json => {
66
+ $refs.setting.data.groupColumn = json;
67
+ })
68
+ "
69
+ >
70
+ <template #prepend>
71
+ <Button
72
+ custom-icon="fa fa-edit"
73
+ @click="
74
+ $refs.groupColumn.open(dataView.model, $refs.setting.data.groupColumn, json => {
75
+ $refs.setting.data.groupColumn = json;
76
+ })
77
+ "
78
+ ></Button>
79
+ </template>
80
+ </Input>
81
+ </div>
82
+ <div v-if="code == 'groupMethod'">
83
+ <Input
84
+ type="text"
85
+ :readonly="true"
86
+ v-model="$refs.setting.data.groupMethod"
87
+ @click="
88
+ $refs.groupMethod.open(dataView.model, $refs.setting.data.groupMethod, json => {
89
+ $refs.setting.data.groupMethod = json;
90
+ })
91
+ "
92
+ >
93
+ <template #prepend>
94
+ <Button
95
+ custom-icon="fa fa-edit"
96
+ @click="
97
+ $refs.groupMethod.open(dataView.model, $refs.setting.data.groupMethod, json => {
98
+ $refs.setting.data.groupMethod = json;
99
+ })
100
+ "
101
+ ></Button>
102
+ </template>
103
+ </Input>
104
+ </div>
105
+ <div v-if="code == 'editEnable'">
106
+ <Switch
107
+ :model-value="!!data.editEnable"
108
+ v-if="showCheck(data.editEnableJson)"
109
+ @update:model-value="
110
+ $event => {
111
+ data.editEnable = $event;
112
+ //$forceUpdate();
113
+ }
114
+ "
115
+ @on-change="checkChange('editEnableJson', 'editEnable')"
116
+ />
117
+ <Button style="margin-left: 8px" @click="$refs.conditionEdit.open(data, 'editEnableJson', 'editEnable', dataView.model)" type="primary" size="small" icon="ios-settings">
118
+ 条件
119
+ </Button>
120
+ </div>
121
+ <div v-if="code == 'removeEnable'">
122
+ <Switch
123
+ :model-value="!!data.removeEnable"
124
+ v-if="showCheck(data.removeEnableJson)"
125
+ @update:model-value="
126
+ $event => {
127
+ data.removeEnable = $event;
128
+ //$forceUpdate();
129
+ }
130
+ "
131
+ @on-change="checkChange('removeEnableJson', 'removeEnable')"
132
+ />
133
+ <Button
134
+ style="margin-left: 8px"
135
+ @click="$refs.conditionEdit.open(data, 'removeEnableJson', 'removeEnable', dataView.model)"
136
+ type="primary"
137
+ size="small"
138
+ icon="ios-settings"
139
+ >
140
+ 条件
141
+ </Button>
142
+ </div>
143
+ </template>
144
+ <template #bottom>
145
+ <Divider :plain="true" dashed orientation="left" size="small">
146
+ <span class="title">操作栏按钮</span>
147
+ </Divider>
148
+ <view-table ref="commandButton" view-code="CommandButton" :static="true" :embedded="true">
149
+ <template #column="{ row, code }">
150
+ <template v-if="code == 'params'">
151
+ <Button type="primary" v-if="row.viewCode && row.viewType == 'TableView'" size="small" custom-icon="fa fa-list" @click="openParams(row)">参数</Button>
152
+ </template>
153
+ </template>
154
+ </view-table>
155
+ </template>
156
+ <template #footer>
157
+ <Button type="primary" custom-icon="fa fa-save" @click="saveSetting">保存</Button>
158
+ </template>
159
+ </modal-form>
160
+ <modal-table ref="commandButtonParams" view-code="CommandButtonParams" :static="true" :embedded="true" :footerEnable="true">
161
+ <template #column="{ row, code }">
162
+ <template v-if="code == 'param'">
163
+ <Input type="text" size="small" v-model="row.param">
164
+ <template #prepend>
165
+ <Button size="small" custom-icon="fa fa-search" @click="$refs.columnCheck.openViewCode(commandButton.viewCode, column => (row.param = column.code))"></Button>
166
+ </template>
167
+ </Input>
168
+ </template>
169
+ <template v-if="code == 'value'">
170
+ <Input type="text" size="small" v-model="row.value">
171
+ <template #prepend>
172
+ <Button size="small" custom-icon="fa fa-search" @click="$refs.columnCheck.open(dataView.model, column => (row.value = column.code))"></Button>
173
+ </template>
174
+ </Input>
175
+ </template>
176
+ </template>
177
+ <template #footer>
178
+ <Button type="primary" custom-icon="fa fa-save" @click="saveParams">保存</Button>
179
+ </template>
180
+ </modal-table>
181
+ <modal-form-sort ref="modal_sort" :sort="sort" :dataView="dataView" @bindSort="bindSort" />
182
+ <modal-form-filter ref="modal_filter" :filter="filter" :dataView="dataView" @bindFilter="bindFilter" />
183
+ <column-check ref="columnCheck" />
184
+ <group-method ref="groupMethod" />
185
+ <group-column ref="groupColumn" />
186
+ <condition-edit ref="conditionEdit" />
187
+ </div>
188
+ </template>
189
+ <script>
190
+ import mixinPage from '../../mixins/page';
191
+ import columnCheck from './column-check';
192
+ import columnSelect from './column-select';
193
+ import columnEdit from './column-edit';
194
+ import { mapActions } from 'vuex';
195
+ import modalFormSort from './modal-form-sort';
196
+ import modalFormFilter from './modal-form-filter';
197
+ import groupMethod from './group-method';
198
+ import groupColumn from './group-column';
199
+ import conditionEdit from './condition-edit';
200
+
201
+ export default {
202
+ mixins: [mixinPage],
203
+ components: { columnCheck, columnSelect, columnEdit, modalFormSort, modalFormFilter, groupMethod, groupColumn, conditionEdit },
204
+ data() {
205
+ return {
206
+ active: false,
207
+ dataView: {},
208
+ data: {},
209
+ tablename: '',
210
+ sort: '',
211
+ filter: '',
212
+ tableid: '',
213
+ commandButton: {}
214
+ };
215
+ },
216
+ created() {},
217
+ props: {
218
+ // 是否公共配置界面
219
+ isSetting: {
220
+ type: Boolean,
221
+ default: false
222
+ }
223
+ },
224
+ computed: {},
225
+ methods: {
226
+ ...mapActions('admin/dataView', {
227
+ resetDataView: 'reset',
228
+ saveDataView: 'save',
229
+ saveUserView: 'saveUserView',
230
+ saveDataViewSetting: 'saveSetting'
231
+ }),
232
+ // 打开
233
+ open(dataView, columns) {
234
+ this.dataView = dataView;
235
+ this.active = true;
236
+ let code;
237
+
238
+ if (this.isSetting) {
239
+ code = 'TableViewColumnSimple';
240
+ } else {
241
+ code = 'TableViewColumn';
242
+ }
243
+
244
+ setTimeout(async () => {
245
+ await this.$refs.table.init(code, () => {
246
+ this.$refs.table.loadData(columns);
247
+ this.$refs.table.open();
248
+ });
249
+ });
250
+ },
251
+ // 打开字段设置界面
252
+ edit(row, index) {
253
+ this.$refs.columnEdit.open(row, index, this.$refs.table.data, data => {
254
+ let columns = this.$refs.table.data;
255
+ columns.splice(index, 1, data);
256
+
257
+ this.$refs.table.loadData(columns);
258
+ });
259
+ },
260
+ // 打开字段选择界面
261
+ openColumnCheck(data, code) {
262
+ if (data.model == null) {
263
+ return;
264
+ }
265
+
266
+ this.$refs.columnCheck.open(data.model, checked => {
267
+ data[code] = checked.code;
268
+ //this.$forceUpdate();
269
+ });
270
+ },
271
+ // 上移
272
+ up(row, index) {
273
+ let columns = this.$refs.table.data;
274
+ if (index > 0) {
275
+ columns.splice(index, 1);
276
+ columns.splice(index - 1, 0, row);
277
+
278
+ this.$refs.table.loadData(columns);
279
+ }
280
+ },
281
+ // 下移
282
+ down(row, index) {
283
+ let columns = this.$refs.table.data;
284
+ if (index < columns.length - 1) {
285
+ columns.splice(index, 1);
286
+ columns.splice(index + 1, 0, row);
287
+
288
+ this.$refs.table.loadData(columns);
289
+ }
290
+ },
291
+ // 拖动完成
292
+ dragDrop({ index1, index2 }) {
293
+ if (index1 != index2) {
294
+ let columns = this.$refs.table.data;
295
+ let row = columns[index1];
296
+
297
+ columns.splice(index1, 1);
298
+ columns.splice(index2, 0, row);
299
+ }
300
+ },
301
+ // 移除
302
+ remove(row, index) {
303
+ let columns = this.$refs.table.data;
304
+ columns.splice(index, 1);
305
+
306
+ this.$refs.table.loadData(columns);
307
+ },
308
+ // 打开字段选择界面
309
+ openColumnSelect() {
310
+ let columns = this.$refs.table.data;
311
+ this.$refs.columnSelect.open(this.dataView, columns, checked => {
312
+ // 移除未勾选的
313
+ columns = columns.filter(column => {
314
+ return (
315
+ checked.some(item => {
316
+ return column.code === item.code;
317
+ }) || column.isVirtual
318
+ );
319
+ });
320
+
321
+ // 添加新勾选的
322
+ checked.forEach(item => {
323
+ if (
324
+ !columns.some(column => {
325
+ return column.code === item.code;
326
+ })
327
+ ) {
328
+ columns.push({
329
+ code: item.code,
330
+ name: item.name,
331
+ dataType: item.dataType,
332
+ dataView: this.dataView,
333
+ isShow: true,
334
+ controlType: 'Label', // 默认只读文本
335
+ align: 'Center' // 默认居中
336
+ });
337
+ }
338
+ });
339
+
340
+ setTimeout(() => {
341
+ this.$refs.table.loadData(columns);
342
+ });
343
+ });
344
+ },
345
+ // 创建虚拟字段
346
+ createVirtual() {
347
+ let columns = this.$refs.table.data;
348
+
349
+ let row = {
350
+ isShow: true,
351
+ isVirtual: true,
352
+ dataType: 'String'
353
+ };
354
+
355
+ this.$refs.columnEdit.open(row, -1, this.$refs.table.data, data => {
356
+ columns.push(data);
357
+ this.$refs.table.loadData(columns);
358
+ });
359
+ },
360
+ // 全局保存
361
+ globalSave() {
362
+ this.confirm('确定要保存全局设置吗?', () => {
363
+ this.confirm('本次操作将修改全局设置,确认要保存吗?', async () => {
364
+ await this.saveDataView({
365
+ code: this.dataView.code,
366
+ columns: this.$refs.table.data
367
+ });
368
+
369
+ this.$emit('on-change', this.dataView.code);
370
+ this.success('保存成功!', () => {
371
+ this.$refs.table.close();
372
+ });
373
+ });
374
+ });
375
+ },
376
+ // 重置
377
+ reset() {
378
+ this.confirm('确定要恢复默认设置吗?', async () => {
379
+ await this.resetDataView(this.dataView.code);
380
+
381
+ this.$emit('on-change', this.dataView.code);
382
+ this.success('重置成功!', () => {
383
+ this.$refs.table.close();
384
+ });
385
+ });
386
+ },
387
+ // 用户保存
388
+ userSave() {
389
+ this.confirm('确定要保存设置吗?', async () => {
390
+ await this.saveUserView({
391
+ code: this.dataView.code,
392
+ columns: this.$refs.table.data
393
+ });
394
+
395
+ this.$emit('on-change', this.dataView.code);
396
+ this.success('保存成功!', () => {
397
+ this.$refs.table.close();
398
+ });
399
+ });
400
+ },
401
+ // 保存
402
+ save() {
403
+ this.confirm('确定要保存设置吗?', async () => {
404
+ await this.saveDataView({
405
+ code: this.dataView.code,
406
+ columns: this.$refs.table.data
407
+ });
408
+
409
+ this.success('保存成功!', () => {
410
+ this.$refs.table.close();
411
+ });
412
+ });
413
+ },
414
+ // 设置
415
+ setting() {
416
+ // 排序字段参数赋值
417
+ this.sort = this.dataView.sorting;
418
+ this.filter = this.dataView.filtering;
419
+
420
+ if (!!(this.dataView.commandButton || '').trim()) {
421
+ this.$refs.commandButton.loadData(JSON.parse(this.dataView.commandButton));
422
+ } else {
423
+ this.$refs.commandButton.loadData([]);
424
+ }
425
+
426
+ this.$refs.setting.open(this.copy(this.dataView));
427
+ },
428
+ // 保存设置
429
+ async saveSetting() {
430
+ let isOK = await this.$refs.setting.validate();
431
+
432
+ if (!isOK) {
433
+ this.error('有内容不符合要求,请正确填写!');
434
+ } else {
435
+ if (!this.$refs.commandButton.validate()) {
436
+ return;
437
+ }
438
+
439
+ // 操作栏按钮
440
+ this.$refs.setting.data.commandButton = JSON.stringify(this.$refs.commandButton.getData());
441
+
442
+ this.confirm('确定要保存设置吗?', async () => {
443
+ let res = await this.saveDataViewSetting(this.$refs.setting.data);
444
+ this.dataView = res.dataView;
445
+
446
+ this.$emit('on-change', this.dataView.code);
447
+ this.success('保存成功!', () => {
448
+ this.$refs.setting.close();
449
+ });
450
+ });
451
+ }
452
+ },
453
+ //绑定排序组件返回的排序json
454
+ bindSort(value) {
455
+ this.sort = value;
456
+ this.$refs.setting.data.sorting = value;
457
+ },
458
+ //绑定筛选组件返回的排序json
459
+ bindFilter(value) {
460
+ this.filter = value;
461
+ this.$refs.setting.data.filtering = value;
462
+ },
463
+ // 打开操作栏按钮参数设置界面
464
+ openParams(row) {
465
+ this.commandButton = row;
466
+
467
+ let params = [];
468
+ if (!!(row.params || '').trim()) {
469
+ params = JSON.parse(row.params);
470
+ }
471
+
472
+ this.$refs.commandButtonParams.loadData(params);
473
+ this.$refs.commandButtonParams.open();
474
+ },
475
+ // 保存操作栏按钮参数
476
+ saveParams() {
477
+ let params = this.$refs.commandButtonParams.getData();
478
+ this.commandButton.params = JSON.stringify(params);
479
+
480
+ this.$refs.commandButtonParams.close();
481
+ },
482
+ // 打开筛选字段选择
483
+ keywordColumnOpen() {
484
+ if (!(this.dataView.model || '').trim()) {
485
+ this.error('请先选择模型!');
486
+ return;
487
+ }
488
+
489
+ let data = this.$refs.setting.data;
490
+ let keywordColumn = data.keywordColumn;
491
+ let columns = [];
492
+
493
+ if (!!(keywordColumn || '').trim()) {
494
+ columns = keywordColumn.split(',').map(item => {
495
+ return { code: item };
496
+ });
497
+ }
498
+
499
+ this.$refs.columnSelect.open(this.dataView, columns, checked => {
500
+ this.$refs.setting.data.keywordColumn = checked
501
+ .map(item => {
502
+ return item.code;
503
+ })
504
+ .join();
505
+
506
+ //this.$forceUpdate();
507
+ });
508
+ },
509
+ // 是否显示选择框
510
+ showCheck(json) {
511
+ if (!(json || '').trim()) {
512
+ return true;
513
+ } else {
514
+ let setting = JSON.parse(json);
515
+
516
+ return setting.type == 'True' || setting.type == 'False';
517
+ }
518
+ },
519
+ // 选择框变化
520
+ checkChange(jsonKey, checkKey) {
521
+ if (!!(this.data[jsonKey] || '').trim()) {
522
+ let setting = JSON.parse(this.data[jsonKey]);
523
+ if (this.data[checkKey]) {
524
+ setting.type = 'True';
525
+ } else {
526
+ setting.type = 'False';
527
+ }
528
+ this.data[jsonKey] = JSON.stringify(setting);
529
+ }
530
+ }
531
+ }
532
+ };
533
+ </script>