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,633 @@
1
+ <template>
2
+ <div>
3
+ <Modal v-model="opened" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" width="800">
4
+ <template #header>
5
+ <div>
6
+ <span class="title">筛选项设置</span>
7
+ <span class="description">Filter Setting</span>
8
+ </div>
9
+ </template>
10
+ <div class="ivu-ml-8 ivu-mr-8">
11
+ <Form ref="form" :model="data" label-position="top" label-colon=":" class="ivu-mt" :rules="rules" @submit.prevent>
12
+ <Row :gutter="24" type="flex">
13
+ <Col v-bind="grid8">
14
+ <FormItem label="字段" key="code" prop="code">
15
+ <Input type="text" v-if="data.operator != 'Custom'" readonly v-model="data.code" @on-focus="openSelect()">
16
+ <template #prepend>
17
+ <Button custom-icon="fa fa-search" @click="openSelect()"></Button>
18
+ </template>
19
+ </Input>
20
+ <Input type="text" v-if="data.operator == 'Custom'" v-model="data.code" maxlength="200" />
21
+ </FormItem>
22
+ </Col>
23
+ <Col v-bind="grid8">
24
+ <FormItem label="名称" key="name" prop="name">
25
+ <Input type="text" v-model="data.name" maxlength="200" />
26
+ </FormItem>
27
+ </Col>
28
+ <Col v-bind="grid8" v-if="!dataView.isDataSource">
29
+ <FormItem label="操作符" key="operator" prop="operator">
30
+ <Select v-model="data.operator" :transfer="true">
31
+ <Option v-for="item in getEnumList('Operator')" :key="item.id" :value="item.id">{{ item.name }}</Option>
32
+ </Select>
33
+ </FormItem>
34
+ </Col>
35
+ <Col v-bind="grid8">
36
+ <FormItem label="控件类型" key="controlType" prop="controlType">
37
+ <Select v-model="data.controlType" :transfer="true" @on-change="controlTypeChange">
38
+ <Option v-for="item in getEnumList('ControlType')" :key="item.id" :value="item.id">{{ item.name }}</Option>
39
+ </Select>
40
+ </FormItem>
41
+ </Col>
42
+ <Col
43
+ v-bind="grid8"
44
+ v-if="
45
+ data.controlType == 'Select' ||
46
+ data.controlType == 'MultiSelect' ||
47
+ data.controlType == 'SelectWithOther' ||
48
+ data.controlType == 'ComboSelect' ||
49
+ data.controlType == 'Radio' ||
50
+ data.controlType == 'CheckGroup'
51
+ "
52
+ >
53
+ <FormItem label="固定选项" key="isStaticItem" prop="isStaticItem">
54
+ <Switch
55
+ :model-value="!!data.isStaticItem"
56
+ @update:model-value="
57
+ $event => {
58
+ data.isStaticItem = $event;
59
+ //$forceUpdate();
60
+ }
61
+ "
62
+ />
63
+ </FormItem>
64
+ </Col>
65
+ <Col
66
+ v-bind="grid24"
67
+ v-if="
68
+ data.isStaticItem &&
69
+ (data.controlType == 'Select' ||
70
+ data.controlType == 'MultiSelect' ||
71
+ data.controlType == 'SelectWithOther' ||
72
+ data.controlType == 'ComboSelect' ||
73
+ data.controlType == 'Radio' ||
74
+ data.controlType == 'CheckGroup')
75
+ "
76
+ >
77
+ <FormItem label="选项内容(每一行为一项,key/value用冒号分隔,没有冒号表示key/value一致)" key="itemData" prop="itemData">
78
+ <Input type="textarea" :rows="5" v-model="data.itemData" />
79
+ </FormItem>
80
+ </Col>
81
+ <Col v-bind="grid8" v-if="needDataSource && data.controlType != 'DialogSelect'">
82
+ <FormItem label="数据源" key="source" prop="source">
83
+ <dialog-select
84
+ ref="select"
85
+ v-model="data.source"
86
+ source="EntitySelect"
87
+ source-data-code="name"
88
+ source-display-code="name"
89
+ @on-change="sourceChange"
90
+ ></dialog-select>
91
+ </FormItem>
92
+ </Col>
93
+ <Col v-bind="grid8" v-if="data.controlType == 'DialogSelect' || data.controlType == 'MultiDialogSelect'">
94
+ <FormItem label="视图" key="dataViewSource" prop="source">
95
+ <dialog-select
96
+ ref="dataViewSource"
97
+ v-model="data.source"
98
+ source="DataViewSelect"
99
+ source-data-code="code"
100
+ source-display-code="code"
101
+ :param="{ viewType: 'TableView' }"
102
+ @on-change="sourceChange"
103
+ ></dialog-select>
104
+ </FormItem>
105
+ </Col>
106
+ <Col v-bind="grid8" v-if="data.source && needDataSource">
107
+ <FormItem label="数据字段" key="sourceDataCode" prop="sourceDataCode">
108
+ <Input type="text" :readonly="true" v-model="data.sourceDataCode" @on-focus="openColumnSelect(data, 'sourceDataCode')">
109
+ <template #prepend>
110
+ <Button custom-icon="fa fa-search" @click="openColumnSelect(data, 'sourceDataCode')"></Button>
111
+ </template>
112
+ </Input>
113
+ </FormItem>
114
+ </Col>
115
+ <Col v-bind="grid8" v-if="data.source && needDataSource">
116
+ <FormItem label="显示字段" key="sourceDisplayCode" prop="sourceDisplayCode">
117
+ <Input type="text" :readonly="true" v-model="data.sourceDisplayCode" @on-focus="openColumnSelect(data, 'sourceDisplayCode')">
118
+ <template #prepend>
119
+ <Button custom-icon="fa fa-search" @click="openColumnSelect(data, 'sourceDisplayCode')"></Button>
120
+ </template>
121
+ </Input>
122
+ </FormItem>
123
+ </Col>
124
+ <Col v-bind="grid16" v-if="data.source && needDataSource">
125
+ <FormItem label="参数" key="param" prop="param">
126
+ <Input type="text" @click="paramOpen" :readonly="true" v-model="data.param" maxlength="200" />
127
+ </FormItem>
128
+ </Col>
129
+ <Col v-bind="grid8">
130
+ <FormItem label="是否显示" key="isShow" prop="isShow">
131
+ <Switch
132
+ :model-value="!!data.isShow"
133
+ @update:model-value="
134
+ $event => {
135
+ data.isShow = $event;
136
+ }
137
+ "
138
+ />
139
+ </FormItem>
140
+ </Col>
141
+ <Col v-bind="grid8">
142
+ <FormItem label="栏目宽度" key="columnWidth" prop="columnWidth">
143
+ <Select v-model="data.columnWidth" :transfer="true">
144
+ <Option v-for="item in getEnumList('ColumnWidth')" :key="item.id" :value="item.id">{{ item.name }}</Option>
145
+ </Select>
146
+ </FormItem>
147
+ </Col>
148
+ <Col v-bind="grid8">
149
+ <FormItem label="控件宽度" key="controlWidth" prop="controlWidth">
150
+ <Input type="number" style="width: 100px" number v-model="data.controlWidth" />
151
+ </FormItem>
152
+ </Col>
153
+ <Col v-bind="grid8">
154
+ <FormItem label="默认值" key="defaultValue" prop="defaultValue">
155
+ <Input type="text" v-model="data.defaultValue" maxlength="200" />
156
+ </FormItem>
157
+ </Col>
158
+ <Col v-bind="grid8">
159
+ <FormItem label="描述" key="description" prop="description">
160
+ <Input type="text" v-model="data.description" maxlength="200" />
161
+ </FormItem>
162
+ </Col>
163
+ </Row>
164
+ </Form>
165
+ </div>
166
+ <template #footer>
167
+ <div>
168
+ <Button type="primary" custom-icon="fa fa-check" @click="finish">确定</Button>
169
+ <Button type="default" custom-icon="fa fa-times" @click="close">关闭</Button>
170
+ </div>
171
+ </template>
172
+ </Modal>
173
+ <Modal v-model="paramOpened" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" width="600">
174
+ <template #header>
175
+ <div>
176
+ <slot name="header">
177
+ <span class="title">参数</span>
178
+ <span class="description">Param</span>
179
+ </slot>
180
+ </div>
181
+ </template>
182
+ <div class="i-table-no-border">
183
+ <Table :columns="parpamColumns" :data="params" stripe size="small" no-data-text="暂无数据...">
184
+ <template #command="{ index }">
185
+ <Button size="small" title="编辑" type="primary" ghost custom-icon="fa fa-edit" @click="paramEdit(params[index], index)"></Button>
186
+ <Button size="small" title="上移" type="primary" ghost custom-icon="fa fa-chevron-up" @click="upParam(params[index], index)"></Button>
187
+ <Button size="small" title="下移" type="primary" ghost custom-icon="fa fa-chevron-down" @click="downParam(params[index], index)"></Button>
188
+ <Button size="small" title="移除" type="primary" ghost custom-icon="fa fa-times" @click="paramRemove(params[index], index)"></Button>
189
+ </template>
190
+ </Table>
191
+ </div>
192
+ <template #footer>
193
+ <div>
194
+ <Button type="primary" ghost custom-icon="fa fa-plus" @click="paramEdit()">新增</Button>
195
+ <Button type="primary" custom-icon="fa fa-check" @click="paramSave">确定</Button>
196
+ </div>
197
+ </template>
198
+ </Modal>
199
+ <Modal v-model="paramItemOpened" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" width="800">
200
+ <template #header>
201
+ <div>
202
+ <span class="title">参数设置</span>
203
+ <span class="description">Param Setting</span>
204
+ </div>
205
+ </template>
206
+ <div class="ivu-ml-8 ivu-mr-8">
207
+ <Form ref="paramItemForm" :rules="paramItemFormRules" :model="paramData" label-position="top" label-colon=":" class="ivu-mt" @submit.prevent>
208
+ <Row :gutter="24" type="flex">
209
+ <Col v-bind="grid8">
210
+ <FormItem label="字段" key="code" prop="code">
211
+ <Input type="text" v-model="paramData.code">
212
+ <template #prepend>
213
+ <Button custom-icon="fa fa-search" @click="openColumnSelect(paramData, 'code')"></Button>
214
+ </template>
215
+ </Input>
216
+ </FormItem>
217
+ </Col>
218
+ <Col v-bind="grid8">
219
+ <FormItem label="字段类型" key="keyType" prop="keyType">
220
+ <RadioGroup v-model="paramData.keyType" @on-change="keyTypeChange">
221
+ <Radio label="常量"></Radio>
222
+ <Radio label="变量"></Radio>
223
+ </RadioGroup>
224
+ </FormItem>
225
+ </Col>
226
+ <Col v-bind="grid8" v-if="paramData.keyType == '常量'">
227
+ <FormItem label="值" key="val" prop="val">
228
+ <Input type="text" v-model="paramData.val" />
229
+ </FormItem>
230
+ </Col>
231
+ <Col v-bind="grid8" v-if="paramData.keyType == '变量'">
232
+ <FormItem label="值" key="val2" prop="val">
233
+ <Input type="text" v-model="paramData.val" @on-focus="openValueSelect">
234
+ <template #prepend>
235
+ <Button custom-icon="fa fa-search" @click="openValueSelect"></Button>
236
+ </template>
237
+ </Input>
238
+ </FormItem>
239
+ </Col>
240
+ </Row>
241
+ </Form>
242
+ </div>
243
+ <template #footer>
244
+ <div>
245
+ <Button type="primary" custom-icon="fa fa-check" @click="paramItemSave">确定</Button>
246
+ <Button type="default" custom-icon="fa fa-times" @click="paramItemClose">关闭</Button>
247
+ </div>
248
+ </template>
249
+ </Modal>
250
+ <column-check ref="columnCheck" />
251
+ <column-check ref="columnParamCheck" />
252
+ </div>
253
+ </template>
254
+ <script>
255
+ import mixinPage from '../../mixins/page';
256
+ import columnCheck from './column-check';
257
+
258
+ export default {
259
+ mixins: [mixinPage],
260
+ components: { columnCheck },
261
+ data() {
262
+ return {
263
+ data: {},
264
+ opened: false,
265
+ callback: null,
266
+ default: {
267
+ code: null,
268
+ name: null,
269
+ operator: 'Equal',
270
+ controlType: null,
271
+ isShow: true,
272
+ columnWidth: 'Column3',
273
+ source: null,
274
+ sourceDataCode: null,
275
+ sourceDisplayCode: null
276
+ },
277
+ rules: {
278
+ code: {
279
+ type: 'string',
280
+ required: true,
281
+ message: '请输入字段',
282
+ trigger: 'blur,change'
283
+ },
284
+ name: {
285
+ type: 'string',
286
+ required: true,
287
+ message: '请输入名称',
288
+ trigger: 'blur,change'
289
+ },
290
+ operator: {
291
+ type: 'string',
292
+ required: true,
293
+ message: '请输入操作符',
294
+ trigger: 'blur,change'
295
+ },
296
+ controlType: {
297
+ type: 'string',
298
+ required: true,
299
+ message: '请输入控件类型',
300
+ trigger: 'blur,change'
301
+ },
302
+ columnWidth: {
303
+ type: 'string',
304
+ required: true,
305
+ message: '请输入栏目宽度',
306
+ trigger: 'blur,change'
307
+ },
308
+ source: {
309
+ type: 'string',
310
+ required: true,
311
+ message: '请输入数据源/视图',
312
+ trigger: 'blur,change'
313
+ },
314
+ sourceDataCode: {
315
+ type: 'string',
316
+ required: true,
317
+ message: '请输入数据字段',
318
+ trigger: 'blur,change'
319
+ },
320
+ sourceDisplayCode: {
321
+ type: 'string',
322
+ required: true,
323
+ message: '请输入显示字段',
324
+ trigger: 'blur,change'
325
+ }
326
+ },
327
+ parpamColumns: [
328
+ { title: '参数', resizable: true, align: 'center', key: 'code' },
329
+ { title: '值', align: 'center', resizable: true, key: 'val' },
330
+ { slot: 'command', title: ' ', align: 'center', resizable: true, fixed: 'right' }
331
+ ],
332
+ params: [],
333
+ paramData: {},
334
+ paramItemFormRules: {
335
+ code: {
336
+ type: 'string',
337
+ required: true,
338
+ message: '请输入字段名称',
339
+ trigger: 'blur,change'
340
+ },
341
+ keyType: {
342
+ type: 'string',
343
+ required: true,
344
+ message: '请选择字段类型',
345
+ trigger: 'blur,change'
346
+ },
347
+ val: {
348
+ type: 'string',
349
+ required: true,
350
+ message: '请输入值',
351
+ trigger: 'blur,change'
352
+ }
353
+ },
354
+ paramOpened: false,
355
+ paramItemOpened: false,
356
+ sourceBefore: null,
357
+ //controlTypeBefore: null,
358
+ currentColumn: null
359
+ };
360
+ },
361
+ async created() {},
362
+ props: {
363
+ // 数据视图
364
+ dataView: {
365
+ type: Object
366
+ }
367
+ },
368
+ computed: {
369
+ // 选择框,或复选框组,且非枚举类型,需要输入数据源
370
+ needDataSource() {
371
+ if (this.data) {
372
+ return (
373
+ ((this.data.controlType === 'Select' ||
374
+ this.data.controlType === 'MultiSelect' ||
375
+ this.data.controlType === 'TreeSelect' ||
376
+ this.data.controlType === 'MultiTreeSelect' ||
377
+ this.data.controlType === 'SelectWithOther' ||
378
+ this.data.controlType === 'ComboSelect' ||
379
+ this.data.controlType === 'Radio' ||
380
+ this.data.controlType === 'CheckGroup') &&
381
+ !this.data.isStaticItem &&
382
+ this.data.dataType &&
383
+ this.data.dataType.indexOf('Enum:') !== 0) ||
384
+ this.data.controlType === 'DialogSelect' ||
385
+ this.data.controlType === 'MultiDialogSelect'
386
+ );
387
+ } else {
388
+ return false;
389
+ }
390
+ }
391
+ },
392
+ methods: {
393
+ // 打开
394
+ open(row, callback) {
395
+ if (row) {
396
+ this.data = this.copy(row);
397
+ } else {
398
+ this.data = this.copy(this.default);
399
+ this.data['dataView'] = this.dataView;
400
+ }
401
+ if (this.dataView.isDataSource) {
402
+ this.data.operator = 'Equal';
403
+ }
404
+
405
+ // 清空验证
406
+ setTimeout(() => {
407
+ this.$refs.form.fields.forEach(field => {
408
+ field.validateState = '';
409
+ field.validateMessage = '';
410
+ });
411
+ });
412
+
413
+ this.callback = callback;
414
+ this.opened = true;
415
+ },
416
+ // 关闭
417
+ close() {
418
+ this.opened = false;
419
+ },
420
+ // 确认
421
+ async finish() {
422
+ let isOK = await this.$refs.form.validate();
423
+
424
+ if (!isOK) {
425
+ this.error('有内容不符合要求,请正确填写!');
426
+ } else {
427
+ if (this.data.operator === 'Custom') {
428
+ this.data.dataType = 'String';
429
+ }
430
+
431
+ this.callback(this.copy(this.data));
432
+ this.opened = false;
433
+ }
434
+ },
435
+ // 打开字段选择界面
436
+ openSelect() {
437
+ if (this.dataView.isDataSource) {
438
+ // 存储过程
439
+ this.$refs.columnCheck.openDataSourceFilter(this.dataView.dataSource, checked => {
440
+ this.currentColumn = checked;
441
+
442
+ this.data.code = this.currentColumn.code;
443
+ this.data.name = this.currentColumn.name;
444
+ this.data.dataType = this.currentColumn.dataType;
445
+
446
+ setTimeout(() => {
447
+ //this.$forceUpdate();
448
+ });
449
+ });
450
+ } else {
451
+ // 非存储过程
452
+ this.$refs.columnCheck.open(this.dataView.model, checked => {
453
+ this.currentColumn = checked;
454
+
455
+ this.data.code = this.currentColumn.code;
456
+ this.data.name = this.currentColumn.name;
457
+ this.data.dataType = this.currentColumn.dataType;
458
+
459
+ if (this.currentColumn.objColumn) {
460
+ this.data.source =
461
+ this.data.controlType == 'DialogSelect' || this.data.controlType == 'MultiDialogSelect'
462
+ ? this.currentColumn.objColumn.dataType + 'Select'
463
+ : this.currentColumn.objColumn.dataType;
464
+ this.data.sourceDataCode = 'id';
465
+ this.data.sourceDisplayCode = this.currentColumn.objColumn.columns.some(column => {
466
+ return column.code === this.currentColumn.objColumn.code + '.name';
467
+ })
468
+ ? 'name'
469
+ : null;
470
+ }
471
+
472
+ setTimeout(() => {
473
+ //this.$forceUpdate();
474
+ });
475
+ });
476
+ }
477
+ },
478
+ // 数据源变更
479
+ sourceChange() {
480
+ if (this.sourceBefore != this.data.source) {
481
+ this.data.sourceDisplayCode = null;
482
+ this.data.sourceDataCode = null;
483
+ this.data.param = null;
484
+ }
485
+ this.sourceBefore = this.data.source;
486
+
487
+ setTimeout(() => {
488
+ //this.$forceUpdate();
489
+ });
490
+ },
491
+ // 打开变量字段选择界面
492
+ openValueSelect() {
493
+ this.$refs.columnCheck.open(this.data.dataView.model, checked => {
494
+ this.paramData.val = checked.code;
495
+ //this.$forceUpdate();
496
+ });
497
+ },
498
+ // 打开参数弹框
499
+ paramOpen() {
500
+ this.params = [];
501
+ this.paramOpened = true;
502
+ if (this.data.param != null && this.data.param != '') {
503
+ let obj = JSON.parse(this.data.param);
504
+ for (let key in obj) {
505
+ let type = '变量';
506
+ if (obj[key].indexOf('[') == 0 && obj[key].indexOf(']') + 1 == obj[key].length) {
507
+ type = '常量';
508
+ }
509
+ this.params.push({
510
+ code: key,
511
+ val: obj[key],
512
+ type: type
513
+ });
514
+ }
515
+ }
516
+ },
517
+ // 参数框确认
518
+ async paramItemSave() {
519
+ let isOK = await this.$refs.paramItemForm.validate();
520
+
521
+ if (!isOK) {
522
+ this.error('有内容不符合要求,请正确填写!');
523
+ return;
524
+ }
525
+ let val = this.paramData.val;
526
+
527
+ if (this.paramData.keyType == '常量') {
528
+ let len = this.paramData.val.length;
529
+ val = this.paramData.val.padStart(len + 1, '[').padEnd(len + 2, ']');
530
+ }
531
+
532
+ if (this.paramData.source) {
533
+ this.paramData.source.code = this.paramData.code;
534
+ this.paramData.source.val = val;
535
+ this.paramData.source.type = this.paramData.keyType;
536
+ } else {
537
+ this.params.push({
538
+ code: this.paramData.code,
539
+ val: val,
540
+ type: this.paramData.keyType
541
+ });
542
+ }
543
+ this.paramItemOpened = false;
544
+ this.$refs.paramItemForm.resetFields();
545
+ },
546
+ paramItemClose() {
547
+ this.paramItemOpened = false;
548
+ this.$refs.paramItemForm.resetFields();
549
+ },
550
+ keyTypeChange() {
551
+ setTimeout(() => {
552
+ this.paramData.val = null;
553
+ //this.$forceUpdate();
554
+ });
555
+ },
556
+ // 打开字段选择界面
557
+ openColumnSelect(data, code) {
558
+ if (this.data.source == null) {
559
+ return;
560
+ }
561
+
562
+ let model;
563
+ if (this.data.controlType == 'DialogSelect' || this.data.controlType == 'MultiDialogSelect') {
564
+ model = this.$refs.dataViewSource.selectedData.model;
565
+ } else {
566
+ model = this.data.source;
567
+ }
568
+
569
+ this.$refs.columnParamCheck.open(model, checked => {
570
+ data[code] = checked.code;
571
+ //this.$forceUpdate();
572
+ });
573
+ }, // 保存参数
574
+ paramSave() {
575
+ let obj = {};
576
+ this.params.forEach(item => {
577
+ obj[item.code] = item.val;
578
+ });
579
+ this.data.param = this.params.length > 0 ? JSON.stringify(obj) : '';
580
+ this.paramOpened = false;
581
+ },
582
+ // 编辑参数项
583
+ paramEdit(row) {
584
+ if (row) {
585
+ this.paramData = {
586
+ code: row.code,
587
+ val: row.val.replace('[', '').replace(']', ''),
588
+ keyType: row.type,
589
+ source: row
590
+ };
591
+ } else {
592
+ this.paramData = {
593
+ code: '',
594
+ val: '',
595
+ keyType: '常量'
596
+ };
597
+ }
598
+ this.paramItemOpened = true;
599
+ }, // 上移参数项
600
+ upParam(row, index) {
601
+ if (index > 0) {
602
+ this.params.splice(index, 1);
603
+ this.params.splice(index - 1, 0, row);
604
+ }
605
+ },
606
+ // 下移参数项
607
+ downParam(row, index) {
608
+ if (index < this.params.length - 1) {
609
+ this.params.splice(index, 1);
610
+ this.params.splice(index + 1, 0, row);
611
+ }
612
+ },
613
+ // 删除参数项
614
+ paramRemove(row, index) {
615
+ this.params.splice(index, 1);
616
+ },
617
+ // 控件类型变化
618
+ controlTypeChange() {
619
+ if (this.currentColumn && this.currentColumn.objColumn) {
620
+ if (this.data.controlType == 'DialogSelect' || this.data.controlType == 'MultiDialogSelect') {
621
+ this.data.source = this.currentColumn.objColumn.dataType + 'Select';
622
+ } else {
623
+ this.data.source = this.currentColumn.objColumn.dataType;
624
+ }
625
+ }
626
+
627
+ setTimeout(() => {
628
+ //this.$forceUpdate();
629
+ });
630
+ }
631
+ }
632
+ };
633
+ </script>