vue2-client 1.7.0 → 1.7.2

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 (128) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +661 -628
  3. package/Components.md +60 -0
  4. package/index.js +31 -30
  5. package/package.json +83 -81
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +369 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +107 -17
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/index.js +41 -0
  33. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  34. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  35. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  36. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  37. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  39. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  40. package/src/base-client/plugins/AppData.js +76 -76
  41. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  42. package/src/base-client/plugins/PagedList.js +177 -177
  43. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  44. package/src/base-client/plugins/i18n-extend.js +32 -32
  45. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  46. package/src/components/Ellipsis/index.md +38 -38
  47. package/src/components/NumberInfo/index.md +43 -43
  48. package/src/components/STable/README.md +341 -341
  49. package/src/components/STable/index.js +318 -318
  50. package/src/components/Trend/index.md +45 -45
  51. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  52. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  53. package/src/components/exception/ExceptionPage.vue +70 -70
  54. package/src/components/form/FormRow.vue +52 -52
  55. package/src/components/index.js +36 -36
  56. package/src/components/menu/SideMenu.vue +75 -62
  57. package/src/components/menu/menu.js +273 -273
  58. package/src/components/page/header/index.less +40 -40
  59. package/src/components/setting/Setting.vue +235 -235
  60. package/src/components/table/StandardTable.vue +141 -141
  61. package/src/components/table/advance/ActionColumns.vue +158 -158
  62. package/src/components/table/advance/SearchArea.vue +355 -355
  63. package/src/components/tool/AStepItem.vue +60 -60
  64. package/src/components/tool/AvatarList.vue +68 -68
  65. package/src/components/tool/Drawer.vue +142 -142
  66. package/src/components/tool/TagSelect.vue +83 -83
  67. package/src/components/transition/PageToggleTransition.vue +97 -97
  68. package/src/config/CreateQueryConfig.js +307 -307
  69. package/src/config/default/admin.config.js +18 -18
  70. package/src/config/default/setting.config.js +4 -2
  71. package/src/config/replacer/resolve.config.js +67 -67
  72. package/src/layouts/CommonLayout.vue +42 -42
  73. package/src/layouts/ComponentLayoutOne.vue +47 -47
  74. package/src/layouts/PageLayout.vue +151 -151
  75. package/src/layouts/SinglePageView.vue +116 -116
  76. package/src/layouts/footer/PageFooter.vue +49 -49
  77. package/src/layouts/header/AdminHeader.vue +134 -134
  78. package/src/layouts/header/HeaderAvatar.vue +64 -64
  79. package/src/layouts/header/HeaderNotice.vue +176 -176
  80. package/src/layouts/header/HeaderSearch.vue +67 -67
  81. package/src/layouts/header/InstitutionDetail.vue +181 -181
  82. package/src/layouts/header/index.less +92 -92
  83. package/src/layouts/tabs/TabsHead.vue +190 -190
  84. package/src/layouts/tabs/TabsView.vue +379 -379
  85. package/src/lib.js +1 -0
  86. package/src/mock/goods/index.js +108 -108
  87. package/src/pages/CreateQueryPage.vue +84 -84
  88. package/src/pages/login/Login.vue +369 -369
  89. package/src/pages/report/ReportTable.js +124 -124
  90. package/src/pages/report/ReportTableHome.vue +28 -28
  91. package/src/pages/resourceManage/orgListManage.vue +98 -98
  92. package/src/pages/system/dictionary/index.vue +43 -43
  93. package/src/pages/system/file/index.vue +317 -317
  94. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  95. package/src/pages/system/monitor/operLog/index.vue +36 -36
  96. package/src/pages/system/settings/index.vue +126 -126
  97. package/src/pages/system/settings/modifyPassword.vue +109 -109
  98. package/src/router/async/config.async.js +28 -28
  99. package/src/router/async/router.map.js +66 -66
  100. package/src/router/guards.js +52 -12
  101. package/src/router/index.js +27 -27
  102. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  103. package/src/services/api/LogDetailsViewApi.js +10 -10
  104. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  105. package/src/services/api/TicketDetailsViewApi.js +34 -34
  106. package/src/services/api/cas.js +79 -79
  107. package/src/services/api/common.js +137 -137
  108. package/src/services/api/commonTempTable.js +10 -10
  109. package/src/services/api/index.js +17 -17
  110. package/src/services/api/logininfor/index.js +6 -6
  111. package/src/services/api/manage.js +8 -8
  112. package/src/services/apiService.js +14 -14
  113. package/src/services/user.js +67 -67
  114. package/src/store/modules/index.js +4 -4
  115. package/src/theme/default/nprogress.less +76 -76
  116. package/src/theme/default/style.less +58 -58
  117. package/src/utils/EncryptUtil.js +53 -53
  118. package/src/utils/colors.js +107 -107
  119. package/src/utils/excel/Blob.js +180 -180
  120. package/src/utils/excel/Export2Excel.js +141 -141
  121. package/src/utils/formatter.js +68 -68
  122. package/src/utils/i18n.js +80 -80
  123. package/src/utils/login.js +138 -0
  124. package/src/utils/map-utils.js +37 -37
  125. package/src/utils/theme-color-replacer-extend.js +91 -91
  126. package/src/utils/themeUtil.js +100 -100
  127. package/src/utils/util.js +230 -230
  128. package/vue.config.js +106 -106
@@ -1,344 +1,356 @@
1
- <template>
2
- <div>
3
- <a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
4
- <div v-show="!loading">
5
- <x-add-form
6
- ref="xAddForm"
7
- :get-data-params="getDataParams"
8
- @onSubmit="onAddOrEditSubmit"
9
- />
10
- <x-form
11
- ref="xForm"
12
- :get-data-params="getDataParams"
13
- style="margin-bottom: 14px;"
14
- @onSubmit="onSearchSubmit">
15
- <slot name="formBtnExpand"></slot>
16
- </x-form>
17
- <x-table
18
- ref="xTable"
19
- :fixedQueryForm="fixedQueryForm"
20
- :queryParamsName="queryParamsName"
21
- :query-params-json="queryParamsJson"
22
- :show-pagination="showPagination"
23
- @add="add"
24
- @edit="edit"
25
- @afterDelete="afterDelete"
26
- @action="action"
27
- @selectRow="selectRow"
28
- @afterQuery="afterQuery"
29
- @tempTableEdit="tempTableEdit">
30
- <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
31
- <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
32
- </template>
33
- <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
34
- <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
35
- <a-button @click="toggleIsFormShow">
36
- <a-icon :style="iconStyle" type="vertical-align-top"/>
37
- </a-button>
38
- </template>
39
- <!-- 底部插槽 -->
40
- <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
41
- <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
42
- </template>
43
- </x-table>
44
- </div>
45
- </div>
46
- </template>
47
- <script>
48
- import XForm from '@vue2-client/base-client/components/common/XForm'
49
- import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
50
- import XTable from '@vue2-client/base-client/components/common/XTable'
51
- import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
52
- import { addOrModify, getConfigUrl } from '@vue2-client/services/api/common'
53
- import { indexedDB } from '@vue2-client/utils/indexedDB'
54
- import { mapState } from 'vuex'
55
- import { post } from '@vue2-client/services/api/restTools'
56
-
57
- export default {
58
- name: 'XFormTable',
59
- components: {
60
- XTable,
61
- XForm,
62
- XAddForm,
63
- XImportExcel
64
- },
65
- data () {
66
- return {
67
- // 加载状态
68
- loading: false,
69
- // 图标样式
70
- iconStyle: {
71
- position: 'relative',
72
- top: '1px'
73
- }
74
- }
75
- },
76
- computed: {
77
- ...mapState('setting', ['isMobile'])
78
- },
79
- props: {
80
- // 业务名称
81
- title: {
82
- type: String,
83
- default: ''
84
- },
85
- // 查询配置文件名
86
- queryParamsName: {
87
- type: String,
88
- default: null
89
- },
90
- // 配置所属命名空间
91
- serviceName: {
92
- type: String,
93
- default: undefined
94
- },
95
- // 查询配置文件Json,用于查询配置生成器的预览
96
- queryParamsJson: {
97
- type: Object,
98
- default: null
99
- },
100
- // 业务逻辑名称, 通过logic获取表单表格配置
101
- logicName: {
102
- type: String,
103
- default: null
104
- },
105
- // 执行logic传递的参数
106
- logicParam: {
107
- type: Object,
108
- default: () => {}
109
- },
110
- // 固定新增表单
111
- fixedAddForm: {
112
- type: Object,
113
- default: () => {
114
- return {}
115
- }
116
- },
117
- // 固定查询表单
118
- fixedQueryForm: {
119
- type: Object,
120
- default: () => {
121
- return {}
122
- }
123
- },
124
- // 预览模式
125
- viewMode: {
126
- type: Boolean,
127
- default: () => {
128
- return false
129
- }
130
- },
131
- // 数据只有一页时是否展示分页,true:展示,auto:隐藏
132
- showPagination: {
133
- type: Boolean,
134
- default: true
135
- },
136
- // 调用logic获取数据源的追加参数
137
- getDataParams: {
138
- type: Object,
139
- default: undefined
140
- }
141
- },
142
- watch: {
143
- logicParam: {
144
- handler () {
145
- this.getColumnJsonByLogic()
146
- },
147
- deep: true
148
- },
149
- fixedQueryForm: {
150
- handler () {
151
- this.$nextTick(() => {
152
- this.refreshTable(true)
153
- })
154
- },
155
- deep: true
156
- },
157
- queryParamsJson: {
158
- handler () {
159
- this.getColumnsJsonBySource()
160
- },
161
- deep: true
162
- },
163
- queryParamsName: {
164
- handler () {
165
- this.getColumnsJson()
166
- }
167
- }
168
- },
169
- created () {
170
- if (this.queryParamsName) {
171
- this.getColumnsJson()
172
- } else if (this.queryParamsJson) {
173
- this.getColumnsJsonBySource()
174
- }
175
- },
176
- methods: {
177
- getColumnsJson () {
178
- this.loading = true
179
- const url = getConfigUrl(this.serviceName)
180
- indexedDB.getByWeb(this.queryParamsName, url, { configName: this.queryParamsName }, (res) => {
181
- this.updateComponents(res)
182
- })
183
- },
184
- getColumnsJsonBySource () {
185
- this.loading = true
186
- const url = getConfigUrl(this.serviceName)
187
- post(url, { queryObject: this.queryParamsJson }).then(res => {
188
- this.updateComponents(res, true)
189
- })
190
- },
191
- getColumnJsonByLogic () {
192
- this.loading = true
193
- const url = getConfigUrl(this.serviceName)
194
- indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, url, { logic: this.logicName, logicParam: this.logicParam }, (res) => {
195
- this.updateComponents(res, true)
196
- })
197
- },
198
- /**
199
- * 更新子组件
200
- * @param res 参数
201
- * @param setQueryParams 是否设置queryParams参数
202
- */
203
- updateComponents (res, setQueryParams) {
204
- if (this.$refs.xTable && this.$refs.xForm && this.$refs.xAddForm) {
205
- this.$refs.xTable.init({
206
- queryParams: setQueryParams ? res : null,
207
- tableColumns: res.columnJson,
208
- buttonState: res.buttonState,
209
- title: this.title,
210
- viewMode: this.viewMode,
211
- isTableTemp: this.isTableTemp,
212
- serviceName: res.serviceName
213
- })
214
- this.$refs.xForm.init({
215
- formItems: res.formJson,
216
- serviceName: res.serviceName
217
- })
218
- this.$refs.xAddForm.init({
219
- isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
220
- formItems: res.formJson,
221
- viewMode: this.viewMode,
222
- isTableTemp: this.isTableTemp,
223
- serviceName: res.serviceName
224
- })
225
- }
226
- this.loading = false
227
- },
228
- /**
229
- * 提交查询表单事件
230
- * @param res 参数
231
- */
232
- onSearchSubmit (res) {
233
- if (res.valid) {
234
- // 表单赋值
235
- this.$refs.xTable.setQueryForm(res.form)
236
- // commit
237
- this.$emit('afterSearchSubmit', res)
238
- } else {
239
- return false
240
- }
241
- },
242
- /**
243
- * 提交新增表单事件
244
- */
245
- onAddOrEditSubmit (res, callback) {
246
- // 组织请求
247
- const requestParameters = {
248
- queryParamsName: this.queryParamsName,
249
- queryParams: this.queryParamsJson,
250
- form: res.realForm,
251
- businessType: res.businessType,
252
- operator: res.currUserName
253
- }
254
- addOrModify(requestParameters, res.serviceName).then(data => {
255
- this.$message.success(res.businessType + '成功!')
256
- this.refreshTable(res.businessType === '新增')
257
- // commit
258
- this.$emit('afterSubmit', { type: res.businessType, id: data.id, form: requestParameters.form })
259
- }).catch(e => {
260
- this.$message.error(res.businessType + '失败:' + e)
261
- }).finally(() => {
262
- callback()
263
- })
264
- },
265
- /**
266
- * 表格查询后事件
267
- * @param res 参数
268
- * @param conditionParams 查询条件
269
- */
270
- afterQuery (res, conditionParams) {
271
- this.$emit('afterQuery', res, conditionParams)
272
- },
273
- /**
274
- * 详情按钮事件
275
- * @param record 本条数据
276
- * @param id 数据标识
277
- * @param actionType 操作类型
278
- */
279
- action (record, id, actionType) {
280
- this.$emit('action', record, id, actionType)
281
- },
282
- /**
283
- * 新增按钮事件
284
- */
285
- add () {
286
- this.$refs.xAddForm.open({
287
- businessType: '新增',
288
- title: this.title,
289
- fixedAddForm: this.fixedAddForm
290
- })
291
- },
292
- /**
293
- * 修改按钮事件
294
- * @param res 参数
295
- */
296
- edit (res) {
297
- this.$refs.xAddForm.open({
298
- businessType: '修改',
299
- modifyModelData: res,
300
- title: this.title,
301
- fixedAddForm: this.fixedAddForm
302
- })
303
- },
304
- /**
305
- * 删除后事件
306
- * @param res
307
- */
308
- afterDelete (res) {
309
- this.$emit('afterDelete', res)
310
- },
311
- /**
312
- * 查询表单部分显示/隐藏切换
313
- */
314
- toggleIsFormShow () {
315
- this.$refs.xForm.toggleVisible()
316
- },
317
- /**
318
- * 选择列事件
319
- * @param selectedRowKeys 选中列Key集合
320
- * @param selectedRows 选中列
321
- */
322
- selectRow (selectedRowKeys, selectedRows) {
323
- this.$emit('selectRow', selectedRowKeys, selectedRows)
324
- },
325
- /**
326
- * 临时表修改
327
- * @param res 参数
328
- */
329
- tempTableEdit (res) {
330
- this.$emit('tempTableEdit', res)
331
- },
332
- /**
333
- * 刷新表格
334
- * @param toFirstPage 是否到第一页
335
- */
336
- refreshTable (toFirstPage = true) {
337
- this.$refs.xTable.refresh(toFirstPage)
338
- },
339
- }
340
- }
341
- </script>
342
- <style lang="less" scoped>
343
-
344
- </style>
1
+ <template>
2
+ <div>
3
+ <a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
4
+ <div v-show="!loading">
5
+ <x-add-form
6
+ ref="xAddForm"
7
+ @onSubmit="onAddOrEditSubmit"
8
+ />
9
+ <x-form
10
+ ref="xForm"
11
+ style="margin-bottom: 14px;"
12
+ @onSubmit="onSearchSubmit">
13
+ <slot name="formBtnExpand"></slot>
14
+ </x-form>
15
+ <x-table
16
+ ref="xTable"
17
+ :fixedQueryForm="fixedQueryForm"
18
+ :queryParamsName="queryParamsName"
19
+ :query-params-json="queryParamsJson"
20
+ :show-pagination="showPagination"
21
+ @add="add"
22
+ @edit="edit"
23
+ @afterDelete="afterDelete"
24
+ @action="action"
25
+ @selectRow="selectRow"
26
+ @afterQuery="afterQuery"
27
+ @tempTableEdit="tempTableEdit">
28
+ <template slot="leftButton" slot-scope="{selectedRowKeys, selectedRows}">
29
+ <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
30
+ </template>
31
+ <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
32
+ <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
33
+ </template>
34
+ <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
35
+ <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
36
+ <a-button @click="toggleIsFormShow">
37
+ <a-icon :style="iconStyle" type="vertical-align-top"/>
38
+ </a-button>
39
+ </template>
40
+ <!-- 底部插槽 -->
41
+ <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
42
+ <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
43
+ </template>
44
+ </x-table>
45
+ </div>
46
+ </div>
47
+ </template>
48
+ <script>
49
+ import XForm from '@vue2-client/base-client/components/common/XForm'
50
+ import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
51
+ import XTable from '@vue2-client/base-client/components/common/XTable'
52
+ import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
53
+ import { addOrModify, getConfigUrl } from '@vue2-client/services/api/common'
54
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
55
+ import { mapState } from 'vuex'
56
+ import { post } from '@vue2-client/services/api/restTools'
57
+
58
+ export default {
59
+ name: 'XFormTable',
60
+ components: {
61
+ XTable,
62
+ XForm,
63
+ XAddForm,
64
+ XImportExcel
65
+ },
66
+ data () {
67
+ return {
68
+ // 加载状态
69
+ loading: false,
70
+ // 图标样式
71
+ iconStyle: {
72
+ position: 'relative',
73
+ top: '1px'
74
+ },
75
+ // 实际查询配置内容
76
+ realQueryConfig: {}
77
+ }
78
+ },
79
+ computed: {
80
+ ...mapState('setting', ['isMobile'])
81
+ },
82
+ props: {
83
+ // 业务名称
84
+ title: {
85
+ type: String,
86
+ default: ''
87
+ },
88
+ // 查询配置文件名
89
+ queryParamsName: {
90
+ type: String,
91
+ default: null
92
+ },
93
+ // 配置所属命名空间
94
+ serviceName: {
95
+ type: String,
96
+ default: undefined
97
+ },
98
+ // 查询配置文件Json,用于查询配置生成器的预览
99
+ queryParamsJson: {
100
+ type: Object,
101
+ default: null
102
+ },
103
+ // 业务逻辑名称, 通过logic获取表单表格配置
104
+ logicName: {
105
+ type: String,
106
+ default: null
107
+ },
108
+ // 执行logic传递的参数
109
+ logicParam: {
110
+ type: Object,
111
+ default: () => {}
112
+ },
113
+ // 固定新增表单
114
+ fixedAddForm: {
115
+ type: Object,
116
+ default: () => {
117
+ return {}
118
+ }
119
+ },
120
+ // 固定查询表单
121
+ fixedQueryForm: {
122
+ type: Object,
123
+ default: () => {
124
+ return {}
125
+ }
126
+ },
127
+ // 预览模式
128
+ viewMode: {
129
+ type: Boolean,
130
+ default: () => {
131
+ return false
132
+ }
133
+ },
134
+ // 数据只有一页时是否展示分页,true:展示,auto:隐藏
135
+ showPagination: {
136
+ type: Boolean,
137
+ default: true
138
+ },
139
+ // 调用logic获取数据源的追加参数
140
+ getDataParams: {
141
+ type: Object,
142
+ default: undefined
143
+ }
144
+ },
145
+ watch: {
146
+ logicParam: {
147
+ handler () {
148
+ this.getColumnJsonByLogic()
149
+ },
150
+ deep: true
151
+ },
152
+ fixedQueryForm: {
153
+ handler () {
154
+ this.$nextTick(() => {
155
+ this.refreshTable(true)
156
+ })
157
+ },
158
+ deep: true
159
+ },
160
+ queryParamsJson: {
161
+ handler () {
162
+ this.getColumnsJsonBySource()
163
+ },
164
+ deep: true
165
+ },
166
+ queryParamsName: {
167
+ handler () {
168
+ this.getColumnsJson()
169
+ }
170
+ }
171
+ },
172
+ created () {
173
+ if (this.queryParamsName) {
174
+ this.getColumnsJson()
175
+ } else if (this.queryParamsJson) {
176
+ this.getColumnsJsonBySource()
177
+ }
178
+ },
179
+ methods: {
180
+ getColumnsJson () {
181
+ this.loading = true
182
+ const url = getConfigUrl(this.serviceName)
183
+ indexedDB.getByWeb(this.queryParamsName, url, { configName: this.queryParamsName }, (res) => {
184
+ this.updateComponents(res)
185
+ })
186
+ },
187
+ getColumnsJsonBySource () {
188
+ this.loading = true
189
+ const url = getConfigUrl(this.serviceName)
190
+ post(url, { queryObject: this.queryParamsJson }).then(res => {
191
+ this.updateComponents(res, true)
192
+ })
193
+ },
194
+ getColumnJsonByLogic () {
195
+ this.loading = true
196
+ const url = getConfigUrl(this.serviceName)
197
+ indexedDB.getByWeb(`${this.logicName}_${JSON.stringify(this.logicParam)}`, url, { logic: this.logicName, logicParam: this.logicParam }, (res) => {
198
+ this.updateComponents(res, true)
199
+ })
200
+ },
201
+ /**
202
+ * 更新子组件
203
+ * @param res 参数
204
+ * @param setQueryParams 是否设置queryParams参数
205
+ */
206
+ updateComponents (res, setQueryParams) {
207
+ this.realQueryConfig = res
208
+ if (this.$refs.xTable && this.$refs.xForm && this.$refs.xAddForm) {
209
+ this.$refs.xTable.init({
210
+ queryParams: setQueryParams ? res : null,
211
+ tableColumns: res.columnJson,
212
+ buttonState: res.buttonState,
213
+ title: this.title,
214
+ viewMode: this.viewMode,
215
+ isTableTemp: this.isTableTemp,
216
+ serviceName: res.serviceName
217
+ })
218
+ this.$refs.xForm.init({
219
+ formItems: res.formJson,
220
+ serviceName: res.serviceName,
221
+ getDataParams: this.getDataParams
222
+ })
223
+ }
224
+ this.loading = false
225
+ },
226
+ /**
227
+ * 提交查询表单事件
228
+ * @param res 参数
229
+ */
230
+ onSearchSubmit (res) {
231
+ if (res.valid) {
232
+ // 表单赋值
233
+ this.$refs.xTable.setQueryForm(res.form)
234
+ // commit
235
+ this.$emit('afterSearchSubmit', res)
236
+ } else {
237
+ return false
238
+ }
239
+ },
240
+ /**
241
+ * 提交新增表单事件
242
+ */
243
+ onAddOrEditSubmit (res, callback) {
244
+ // 组织请求
245
+ const requestParameters = {
246
+ queryParamsName: this.queryParamsName,
247
+ queryParams: this.queryParamsJson,
248
+ form: res.realForm,
249
+ businessType: res.businessType,
250
+ operator: res.currUserName
251
+ }
252
+ addOrModify(requestParameters, res.serviceName).then(data => {
253
+ this.$message.success(res.businessType + '成功!')
254
+ this.refreshTable(res.businessType === '新增')
255
+ // commit
256
+ this.$emit('afterSubmit', { type: res.businessType, id: data.id, form: requestParameters.form })
257
+ }).catch(e => {
258
+ this.$message.error(res.businessType + '失败:' + e)
259
+ }).finally(() => {
260
+ callback()
261
+ })
262
+ },
263
+ /**
264
+ * 表格查询后事件
265
+ * @param res 参数
266
+ * @param conditionParams 查询条件
267
+ */
268
+ afterQuery (res, conditionParams) {
269
+ this.$emit('afterQuery', res, conditionParams)
270
+ },
271
+ /**
272
+ * 详情按钮事件
273
+ * @param record 本条数据
274
+ * @param id 数据标识
275
+ * @param actionType 操作类型
276
+ */
277
+ action (record, id, actionType) {
278
+ this.$emit('action', record, id, actionType)
279
+ },
280
+ /**
281
+ * 新增按钮事件
282
+ */
283
+ add () {
284
+ const res = this.realQueryConfig
285
+ this.$refs.xAddForm.init({
286
+ businessType: '新增',
287
+ title: this.title,
288
+ isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
289
+ formItems: res.formJson,
290
+ viewMode: this.viewMode,
291
+ isTableTemp: this.isTableTemp,
292
+ serviceName: res.serviceName,
293
+ fixedAddForm: this.fixedAddForm,
294
+ getDataParams: this.getDataParams
295
+ })
296
+ },
297
+ /**
298
+ * 修改按钮事件
299
+ * @param modifyModelData 修改表单数据
300
+ */
301
+ edit (modifyModelData) {
302
+ const res = this.realQueryConfig
303
+ this.$refs.xAddForm.init({
304
+ businessType: '修改',
305
+ title: this.title,
306
+ isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
307
+ formItems: res.formJson,
308
+ viewMode: this.viewMode,
309
+ isTableTemp: this.isTableTemp,
310
+ serviceName: res.serviceName,
311
+ fixedAddForm: this.fixedAddForm,
312
+ getDataParams: this.getDataParams,
313
+ modifyModelData: modifyModelData
314
+ })
315
+ },
316
+ /**
317
+ * 删除后事件
318
+ * @param res
319
+ */
320
+ afterDelete (res) {
321
+ this.$emit('afterDelete', res)
322
+ },
323
+ /**
324
+ * 查询表单部分显示/隐藏切换
325
+ */
326
+ toggleIsFormShow () {
327
+ this.$refs.xForm.toggleVisible()
328
+ },
329
+ /**
330
+ * 选择列事件
331
+ * @param selectedRowKeys 选中列Key集合
332
+ * @param selectedRows 选中列
333
+ */
334
+ selectRow (selectedRowKeys, selectedRows) {
335
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
336
+ },
337
+ /**
338
+ * 临时表修改
339
+ * @param res 参数
340
+ */
341
+ tempTableEdit (res) {
342
+ this.$emit('tempTableEdit', res)
343
+ },
344
+ /**
345
+ * 刷新表格
346
+ * @param toFirstPage 是否到第一页
347
+ */
348
+ refreshTable (toFirstPage = true) {
349
+ this.$refs.xTable.refresh(toFirstPage)
350
+ },
351
+ }
352
+ }
353
+ </script>
354
+ <style lang="less" scoped>
355
+
356
+ </style>