olp-table 5.3.7 → 5.5.1

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 (171) hide show
  1. package/{olp-table/olp-table.common.js → olp-table.common.js} +67 -67
  2. package/{olp-table/olp-table.umd.js → olp-table.umd.js} +67 -67
  3. package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +67 -67
  4. package/package.json +7 -87
  5. package/.env.build +0 -1
  6. package/.env.prod +0 -1
  7. package/README.md +0 -26
  8. package/babel.config.js +0 -5
  9. package/jsconfig.json +0 -22
  10. package/public/favicon.ico +0 -0
  11. package/public/index.html +0 -17
  12. package/rmMode.bat +0 -1
  13. package/src/App.vue +0 -199
  14. package/src/api/crud.js +0 -22
  15. package/src/api/dist.js +0 -6
  16. package/src/assets/iconfont/iconfont.css +0 -20
  17. package/src/assets/iconfont/iconfont.json +0 -16
  18. package/src/assets/iconfont/iconfont.ttf +0 -0
  19. package/src/assets/iconfont/iconfont.woff +0 -0
  20. package/src/assets/iconfont/iconfont.woff2 +0 -0
  21. package/src/assets/logo.png +0 -0
  22. package/src/components/auto-height/index.vue +0 -75
  23. package/src/components/codemirror-tag.vue +0 -100
  24. package/src/components/lazy-load-select.vue +0 -107
  25. package/src/components/ol-dialog-excel.vue +0 -112
  26. package/src/components/ol-dialog-import.vue +0 -304
  27. package/src/components/ol-dialog-json.vue +0 -83
  28. package/src/components/ol-dialog-table.vue +0 -81
  29. package/src/components/ol-dialog-upload-file.vue +0 -208
  30. package/src/components/ol-dict-tag.vue +0 -271
  31. package/src/components/ol-select-dom.vue +0 -71
  32. package/src/components/ol-table-filter.vue +0 -28
  33. package/src/components/ol-table-render.vue +0 -44
  34. package/src/components/ol-table-select.vue +0 -154
  35. package/src/components/pinia-init.vue +0 -18
  36. package/src/components/table/model/ModelMixins.js +0 -43
  37. package/src/components/table/model/model-index.vue +0 -124
  38. package/src/components/table/model/ot-left-right.vue +0 -18
  39. package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
  40. package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
  41. package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
  42. package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
  43. package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
  44. package/src/components/table/model/ot-top-bottom.vue +0 -18
  45. package/src/components/table/model/splitpanesModel.css +0 -22
  46. package/src/components/table/model/splitpanesModel.vue +0 -54
  47. package/src/components/table/ol-form/index.vue +0 -544
  48. package/src/components/table/ol-form-v3/index.vue +0 -455
  49. package/src/components/table/ol-main-form-sub-table/index.vue +0 -611
  50. package/src/components/table/ol-pager/index.vue +0 -46
  51. package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
  52. package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
  53. package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
  54. package/src/components/table/ol-table/index.vue +0 -232
  55. package/src/components/table/ol-table-operate/index.vue +0 -61
  56. package/src/components/table/ol-table-search/index.vue +0 -17
  57. package/src/components/table/ol-table-tool-btn/index.vue +0 -60
  58. package/src/components/tree/components/o-tree.vue +0 -289
  59. package/src/components/tree/index.vue +0 -46
  60. package/src/components/v-component/index.vue +0 -43
  61. package/src/config/dev-config.js +0 -5
  62. package/src/config/prod-config.js +0 -5
  63. package/src/config/shared-config.js +0 -20
  64. package/src/data.js +0 -9378
  65. package/src/directives/permission/hasPermi.js +0 -63
  66. package/src/directives/permission/hasRole.js +0 -30
  67. package/src/main.js +0 -55
  68. package/src/mixins/VTMixin/DefaultMethods.js +0 -821
  69. package/src/mixins/VTMixin/OTMixinBody.js +0 -105
  70. package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
  71. package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -421
  72. package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -454
  73. package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
  74. package/src/mixins/VTMixin/OTMixinPager.js +0 -38
  75. package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
  76. package/src/mixins/VTMixin/index.js +0 -18
  77. package/src/package/index.js +0 -20
  78. package/src/plugins/axios.js +0 -61
  79. package/src/store/dict.js +0 -76
  80. package/src/store/dictType.js +0 -52
  81. package/src/store/permi.js +0 -45
  82. package/src/styles/common.scss +0 -37
  83. package/src/styles/index.scss +0 -48
  84. package/src/styles/theme.scss +0 -32
  85. package/src/utils/AESCRUDUtils.js +0 -87
  86. package/src/utils/DateUtils.js +0 -35
  87. package/src/utils/ExcelUtil.js +0 -159
  88. package/src/utils/TableSortUtil.js +0 -91
  89. package/src/utils/columnProp.js +0 -3
  90. package/src/utils/groupCompute.js +0 -68
  91. package/src/utils/http/httpFactory.js +0 -92
  92. package/src/utils/http/httpFactory2.js +0 -79
  93. package/src/utils/http/httpUtil.js +0 -123
  94. package/src/utils/http/httpUtils.js +0 -38
  95. package/src/utils/loadStyle.js +0 -14
  96. package/src/utils/message.js +0 -56
  97. package/src/utils/object.js +0 -80
  98. package/src/utils/security/TokenUtil.js +0 -19
  99. package/src/utils/tree.js +0 -54
  100. package/src/utils/util.js +0 -127
  101. package/src/views/Test/index.vue +0 -77
  102. package/src/views/Test/index2.vue +0 -33
  103. package/src/views/components/btn-config/index.vue +0 -202
  104. package/src/views/components/option-config/index.vue +0 -192
  105. package/src/views/db/chineseToEnglish.vue +0 -127
  106. package/src/views/db/filed.vue +0 -395
  107. package/src/views/db/index.vue +0 -192
  108. package/src/views/db/preview/index.vue +0 -139
  109. package/src/views/db/preview/left.vue +0 -204
  110. package/src/views/db/preview/right.vue +0 -466
  111. package/src/views/groupTable/index.vue +0 -137
  112. package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
  113. package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
  114. package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
  115. package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
  116. package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
  117. package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
  118. package/src/views/table/add-or-edit/config/data/column.js +0 -218
  119. package/src/views/table/add-or-edit/config/data/crud.js +0 -122
  120. package/src/views/table/add-or-edit/config/data/events.js +0 -109
  121. package/src/views/table/add-or-edit/config/data/method.js +0 -127
  122. package/src/views/table/add-or-edit/config/data/option.js +0 -725
  123. package/src/views/table/add-or-edit/config/data/page.js +0 -79
  124. package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
  125. package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
  126. package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1180
  127. package/src/views/table/add-or-edit/config/index.vue +0 -377
  128. package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
  129. package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
  130. package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
  131. package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
  132. package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
  133. package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
  134. package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
  135. package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
  136. package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
  137. package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
  138. package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
  139. package/src/views/table/add-or-edit/configOld/index.vue +0 -127
  140. package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
  141. package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
  142. package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
  143. package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
  144. package/src/views/table/add-or-edit/index.vue +0 -201
  145. package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
  146. package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
  147. package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
  148. package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
  149. package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
  150. package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
  151. package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
  152. package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
  153. package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
  154. package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
  155. package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
  156. package/src/views/table/index.vue +0 -43
  157. package/src/views/table/index2.vue +0 -199
  158. package/src/views/table/preview/index.vue +0 -29
  159. package/src/views/tree/components/config-core-data.vue +0 -85
  160. package/src/views/tree/components/config-core-table.vue +0 -362
  161. package/src/views/tree/components/config-core-tree/data/events.js +0 -95
  162. package/src/views/tree/components/config-core-tree/data/option.js +0 -88
  163. package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
  164. package/src/views/tree/components/config-core-tree/index.vue +0 -181
  165. package/src/views/tree/components/config-core.vue +0 -42
  166. package/src/views/tree/components/form-config/index.vue +0 -967
  167. package/src/views/tree/index.vue +0 -424
  168. package/vue.config.js +0 -44
  169. /package/{olp-table/demo.html → demo.html} +0 -0
  170. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
  171. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
@@ -1,544 +0,0 @@
1
- <template>
2
- <el-dialog
3
- v-model="state.dialogVisible"
4
- :title="state.title"
5
- align-center
6
- destroy-on-close
7
- :width="state.width"
8
- v-loading="state.loading"
9
- :close-on-click-modal="false"
10
- >
11
- <el-scrollbar :max-height="state.maxHeight" style="padding-right: 10px">
12
- <avue-form v-if="state.type == '0'" :key="state.key" ref="formRef" :option="form"
13
- v-model="formData">
14
- <!-- 动态生成插槽 -->
15
- <template v-for="slotRow in dynamicSlotsTable" :key="slotRow.slotName" #[slotRow.slotName]="{ disabled, size }">
16
- <!-- 根据配置动态渲染插槽内容 -->
17
- <ol-table-select @olTableSelectChange="olTableSelectChange" :slotName="slotRow.slotName" :http="http"
18
- :defaultValue="formData[slotRow.slotName]"
19
- :uuid="slotRow.config.uuid" :disabled="disabled" :size="size"
20
- :config="slotRow.config"></ol-table-select>
21
- </template>
22
- </avue-form>
23
- <VFormRender v-else :form-json="form" :form-data="formData"
24
- :option-data="optionData"
25
- ref="formRef">
26
- </VFormRender>
27
- </el-scrollbar>
28
- <template #footer>
29
- <el-button @click="state.dialogVisible = false;">返 回</el-button>
30
- <el-button type="primary" v-if="show" :loading="state.loading" @click="doSave">保 存</el-button>
31
- </template>
32
- </el-dialog>
33
- </template>
34
- <script>
35
- import {setArrayObjectKeyValue} from "@/utils/object";
36
- import {useMessage} from "@/utils/message";
37
- import {get, post, postAes, put} from "@/utils/http/httpUtils";
38
- import {handleTree} from "@/utils/tree";
39
- import {doGetColumnAndValueMap} from "@/utils/util";
40
- import {initDictTable} from "@/api/dist";
41
- import {pinyin as olPinyin} from "pinyin-pro";
42
- import {storeDict} from "@/store/dict";
43
- import {storeDictType} from "@/store/dictType";
44
- import OlTableSelect from "@/components/ol-table-select.vue";
45
-
46
- const dict = storeDict();
47
- const dictType = storeDictType();
48
-
49
- function replaceDollarBraces(str) {
50
- return str.toString().replace(/\$\{?([^{}]+)\}?/g, function (match, innerContent) {
51
- return innerContent ? `'${innerContent}'` : match;
52
- });
53
- }
54
-
55
- function parseJson(column) {
56
- let attrs = column.attrs;
57
- if (attrs) {
58
- try {
59
- attrs = JSON.parse(attrs)
60
- for (let key of Object.keys(attrs)) {
61
- column[key] = attrs[key];
62
- }
63
- } catch (e) {
64
- console.error("解析attrs异常", attrs)
65
- }
66
- }
67
- }
68
-
69
- export default {
70
- name: "olForm",
71
- components: {OlTableSelect},
72
- inject: ['http'],
73
- data() {
74
- return {
75
- formData: {},
76
- optionData: {},
77
- form: {
78
- column: []
79
- },
80
- dynamicSlotsTable: [],
81
- dynamicSlotsField: {},
82
- dynamicSlotsOtherResult: {},
83
- show: true,
84
- state: {
85
- loading: false,
86
- fullscreen: false,
87
- dialogVisible: false,
88
- title: "",
89
- width: '60%',
90
- comCommit: true,
91
- maxHeight: '400px',
92
- type: '0',
93
- edit: false,
94
- saveUrl: '',
95
- requestType: 'post',
96
- updateKey: '',
97
- theme: 't1',
98
- tableConfigId: '',
99
- dbName: '',
100
- tableName: '',
101
- },
102
- }
103
- },
104
- methods: {
105
- hideColumn(prop) {
106
- setArrayObjectKeyValue(this.form.column, 'display', false, prop)
107
- },
108
- showColumn(prop) {
109
- setArrayObjectKeyValue(this.form.column, 'display', true, prop)
110
- },
111
- getParams() {
112
- let params = {
113
- tableConfigId: this.state.tableConfigId,
114
- dbName: this.state.dbName,
115
- tableName: this.state.tableName,
116
- columnAndValueMap: {},
117
- };
118
- if (this.state.type != '0') {
119
- let formData = this.$refs.value.getFormData(false);
120
- for (let prop of Object.keys(formData)) {
121
- let value = formData[prop];
122
- if (value instanceof String) {
123
- value = value.trim();
124
- }
125
- params.columnAndValueMap[prop] = value;
126
- }
127
- } else {
128
- // for (let {prop} of this.form.column) {
129
- // let value = this.formData[prop];
130
- // if (value) {
131
- // if (value instanceof String) {
132
- // value = value.trim();
133
- // }
134
- // params.columnAndValueMap[prop] = value;
135
- // }
136
- // }
137
- params.columnAndValueMap = this.getTableUpdateValue(this.form.column, this.formData);
138
- }
139
- if (this.state.saveUrl) {
140
- return params.columnAndValueMap;
141
- }
142
- if (this.state.edit) {
143
- params.whereMap = {}
144
- if (this.state.updateKey) {
145
- let split = this.state.updateKey.split(',');
146
- for (let kv of split) {
147
- let kvs = kv.split("=");
148
- if (kvs.length == 2) {
149
- params.whereMap[kvs[0]] = params.columnAndValueMap[kvs[1]]
150
- delete params.columnAndValueMap[kvs[0]];
151
- } else {
152
- let val = params.columnAndValueMap[kvs];
153
- params.whereMap[kvs] = val != undefined ? val : this.formData[kvs];
154
- delete params.columnAndValueMap[kvs];
155
- }
156
- }
157
- } else {
158
- // 编辑时默认更新条件为id
159
- params.whereMap['id'] = this.formData['id'];
160
- if (!params.whereMap['id']) {
161
- params.whereMap['id'] = this.formData['t1_id'];
162
- }
163
- delete params.columnAndValueMap['id'];
164
- }
165
- } else if (this.state.updateKey) {
166
- let split = this.state.updateKey.split(',');
167
- params['genIdMap'] = {};
168
- for (let kv of split) {
169
- let kvs = kv.split("=");
170
- if (kvs.length == 2) {
171
- params['genIdMap'][kvs[0]] = kvs[1]
172
- } else {
173
- params['genIdMap'][kvs[0]] = 'uuid'
174
- }
175
- }
176
- }
177
- return params
178
- },
179
- /**
180
- * 根据列配置获取数据库表更新数据
181
- * @param column
182
- * @param formData
183
- * @returns {{}}
184
- */
185
- getTableUpdateValue(column, formData) {
186
- let columnAndValueMap = {}
187
- for (let {prop, tableField} of column) {
188
- if (tableField && tableField == '1') {
189
- continue
190
- }
191
- let value = formData[prop];
192
- if (value) {
193
- if (value instanceof String) {
194
- value = value.trim();
195
- }
196
- columnAndValueMap[prop] = value;
197
- }
198
- }
199
- return columnAndValueMap;
200
- },
201
- async doSave() {
202
- let dom;
203
- let keys;
204
- if (this.state.type != '0') {
205
- await this.$refs.formRef.getNativeForm().validate((valid, msg) => {
206
- if (!valid) {
207
- keys = Object.keys(msg);
208
- dom = this.$refs.formRef.getWidgetRef(keys[0]);
209
- dom.$el.scrollIntoView({
210
- block: "center",
211
- behavior: "smooth",
212
- });
213
- useMessage().error("您还有" + keys.length + "项信息未填写,请填写后再操作!");
214
- } else {
215
- this.save()
216
- }
217
- })
218
- } else {
219
- await this.$refs.formRef.validate((valid, done, msg) => {
220
- if (!valid) {
221
- keys = Object.keys(msg);
222
- dom = this.$refs.formRef.getPropRef(keys[0]);
223
- dom.$el.scrollIntoView({
224
- block: "center",
225
- behavior: "smooth",
226
- });
227
- useMessage().error("您还有" + keys.length + "项信息未填写,请填写后再操作!");
228
- } else {
229
- this.save()
230
- }
231
- done()
232
- })
233
- }
234
- },
235
- async save() {
236
- this.state.loading = true;
237
- try {
238
- let params = this.getParams()
239
- let url = this.state.saveUrl ? this.state.saveUrl : this.state.edit ? '/online/crudAes/modify' : '/online/crudAes/save'
240
- if (this.state.requestType.toLowerCase() == "put") {
241
- await put(this.http, url, params).then(status => {
242
- this.state.loading = false;
243
- if (status) {
244
- this.state.dialogVisible = false;
245
- this.$emit('query')
246
- }
247
- })
248
- } else if (this.state.saveUrl) {
249
- await post(this.http, url, params).then(status => {
250
- this.state.loading = false;
251
- if (status) {
252
- this.state.dialogVisible = false;
253
- this.$emit('query')
254
- }
255
- })
256
- } else {
257
- await postAes(this.http, url, params).then(status => {
258
- this.state.loading = false;
259
- if (status) {
260
- this.state.dialogVisible = false;
261
- this.$emit('query')
262
- }
263
- })
264
- }
265
- } catch (e) {
266
- console.error(e)
267
- } finally {
268
- this.state.loading = false;
269
- }
270
- },
271
- init(data) {
272
- if (data.disabled) {
273
- this.show = false;
274
- }
275
- // 初始化动态插槽表格
276
- data.form.column.forEach(column => {
277
- if (data.disabled) {
278
- column.disabled = true;
279
- }
280
- if (column.selectDom === '22') {//表格选取
281
- let slotObj = {
282
- slotName: column.prop,
283
- config: JSON.parse(column.attrs).olTableSelect,
284
- }
285
- this.dynamicSlotsField[column.prop] = column //收集继续动态改变值的字段信息,以便动态改变值时更新表单数据
286
- this.dynamicSlotsTable.push(slotObj)//收集需要的动态插槽字段信息
287
- const otherResult = slotObj.config.otherResult //返回额外参数字段配置
288
- if (otherResult !== null && otherResult !== undefined && otherResult !== '') {
289
- let otherResultArray = []
290
- otherResult.split(",").forEach(m => {
291
- let k = m.split(":")
292
- otherResultArray.push({targetField: k[1], sourceField: k[0]})
293
- });
294
- this.dynamicSlotsOtherResult[column.prop] = otherResultArray
295
- }
296
- }
297
- })
298
- if (data.saveUrl) {
299
- this.state.saveUrl = data.saveUrl.trim();
300
- if (data.requestType) {
301
- this.state.requestType = data.requestType;
302
- }
303
- }
304
- this.state.edit = data['code'] == 'edit' == true;
305
- this.state.title = data.title ? data.title : this.state.edit ? '编辑' : '新增';
306
- //赋值弹窗宽度和高度
307
- if (data.form.diaLogWidth) {
308
- this.state.width = data.form.diaLogWidth
309
- }
310
- if (data.form.diaLogHeight) {
311
- this.state.maxHeight = data.form.diaLogHeight + 'px'
312
- }
313
- if (data.form.title) {
314
- this.state.title = data.form.title
315
- }
316
- this.state.dialogVisible = true;
317
- this.form = data.form;
318
- this.formData = data.formData;
319
- for (let key of Object.keys(this.state)) {
320
- if (data[key]) {
321
- this.state[key] = data[key]
322
- }
323
- }
324
- if (this.state.type == 0) {
325
- for (let column of this.form.column) {
326
- if (column.disabled == 1) {
327
- column.disabled = true;
328
- }
329
- this.initDict(column);
330
- parseJson(column);
331
- for (let event of ['change']) {
332
- if (column[event] && !(column[event] instanceof Function)) {
333
- try {
334
- column[event] = eval("(params)=>{this.$nextTick(()=>{" +
335
- "let formData = this.formData;console.log(formData);" +
336
- "let {value} = params;" + replaceDollarBraces(column[event]) +
337
- "})" +
338
- "}")
339
- } catch (e) {
340
- console.error(e)
341
- }
342
- }
343
- }
344
- }
345
- }
346
- },
347
- initDict(column) {
348
- if (column.dictCode) {
349
- column.dicData = dict.val(column.dictCode)
350
- if (column.selectDom == 1) {
351
- column.type = "select";
352
- }
353
- //”number”、”string”、”boolean”、”object”、”function” 和 “undefined”
354
- let dataType = typeof (this.formData[column.prop]);
355
- if (["number", "boolean"].indexOf(dataType) != -1) {
356
- this.formData[column.prop] = String(this.formData[column.prop])
357
- column.value = this.formData[column.prop];
358
- }
359
-
360
- if (this.state.edit) {
361
- return;
362
- }
363
- if (this.formData[column.prop] != undefined) {
364
- this.formData[column.prop] = String(this.formData[column.prop])
365
- column.value = this.formData[column.prop]
366
- } else if (column.value != undefined) {
367
- this.formData[column.prop] = String(column.value)
368
- } else {
369
- // 数据字典与值类型不一致
370
- if (this.formData[column.prop] == undefined) {
371
- setTimeout(() => {
372
- if (column.dicData) {
373
- for (let dicDatum of column.dicData) {
374
- if (dicDatum.isDefault == 1) {
375
- this.formData[column.prop] = dicDatum.value;
376
- column.value = this.formData[column.prop];
377
- }
378
- }
379
- }
380
- }, 100)
381
- }
382
- }
383
- } else if (column.dictTable || column.dictUrl) {
384
- if (column.selectDom == 1) {
385
- column.type = "select";
386
- }
387
- column.filterable = true;
388
- column.dicData = [];
389
- setTimeout(() => {
390
- this.setDictTable(column, undefined);
391
- }, 10)
392
- if (column.type == 'tree') {
393
- column.filterable = column.filterable == undefined ? true : column.clearable;
394
- column.clearable = column.clearable == undefined ? true : column.clearable;
395
- } else {
396
- column.filterMethod = (e) => {
397
- this.$nextTick(() => {
398
- this.setDictTable(column, e);
399
- })
400
- };
401
- }
402
- }
403
- },
404
- setDictUrl(column, like) {
405
- let dictUrl = column.dictUrl.split(",");
406
- let url;
407
- let label = 'label';
408
- let value = 'value';
409
- let parentId = 'parentId';
410
- // get,url,label,value,parent_id
411
- let doGet = true;
412
- if (dictUrl.length > 1
413
- ) {
414
- if (dictUrl[0].toString().toLowerCase() == 'post') {
415
- doGet = false;
416
- }
417
- url = dictUrl[1];
418
- label = dictUrl[2];
419
- value = dictUrl[3];
420
- parentId = dictUrl[4];
421
- } else {
422
- url = dictUrl[0];
423
- }
424
-
425
- if (doGet) {
426
- get(this.http, url + "?label=" + like).then((data) => {
427
- column.dicData.length = 0;
428
- if (column.type == 'tree') {
429
- for (let da of data) {
430
- da['label'] = da[label]
431
- da['value'] = da[value]
432
- }
433
- column.dicData = handleTree(data, value, parentId);
434
- } else {
435
- data.forEach((d) => {
436
- column.dicData.push(d);
437
- })
438
- }
439
- })
440
- } else {
441
- let params = {}
442
- if (like) {
443
- params['label'] = like;
444
- }
445
- post(this.http, column.dictUrl, params, false).then(({data}) => {
446
- column.dicData.length = 0;
447
- if (column.type == 'tree') {
448
- for (let da of data) {
449
- da['label'] = da[label]
450
- da['value'] = da[value]
451
- }
452
- column.dicData = handleTree(data, value, parentId);
453
- } else {
454
- data.forEach((da => {
455
- da['label'] = da[label];
456
- da['value'] = da[value];
457
- column.dicData.push(da);
458
- }))
459
- }
460
- })
461
- }
462
- },
463
- setDictTable(column, like) {
464
- if (column.dictTable && column.dictTable.toString().trim() != '') {
465
- this.doSetDictTable(column, like);
466
- } else if (column.dictUrl) {
467
- this.setDictUrl(column, like);
468
- }
469
- },
470
- doSetDictTable(column, like) {
471
- let value = this.formData[column.prop];
472
- /*String tableName;
473
- String dataBase;
474
- String label;
475
- String value;
476
- Map<String, Object> where;*/
477
- // olp-vue-pro,system_users,nickname,id,parentId
478
- let params = {}
479
- let dictTable = JSON.parse(JSON.stringify(column.dictTable));
480
- if (dictTable instanceof Object) {
481
- params = dictTable;
482
- } else {
483
- dictTable = column.dictTable.split(",");
484
- params["dbName"] = dictTable[0];
485
- params["tableName"] = dictTable[1];
486
- params["label"] = dictTable[2];
487
- params["value"] = dictTable[3];
488
- if (dictTable[4]) {
489
- params["parentValue"] = dictTable[4];
490
- }
491
- }
492
-
493
- if (like || value) {
494
- if (!params.where) {
495
- params.where = {};
496
- }
497
-
498
- }
499
- if (!params["parentValue"]) {
500
- if (like) {
501
- params.where['_like_' + params["label"]] = like;
502
- }
503
- if (value) {
504
- params.defaultValue = value;
505
- }
506
- }
507
-
508
- initDictTable(this.http, params).then((data) => {
509
- column.dicData.length = 0;
510
- if (params["parentValue"]) {
511
- column.dicData = handleTree(data, 'dictValue', 'parentValue');
512
- } else {
513
- data.forEach((d) => {
514
- column.dicData.push(d);
515
- })
516
- }
517
- })
518
- },
519
- /**
520
- * 表格选择器回调函数
521
- * @param data
522
- */
523
- olTableSelectChange(slotName, data) {
524
- // console.info('插槽名称', slotName, '表格回传的数据', data)
525
- // console.info('表格', this.form.column)
526
- this.formData[slotName] = data.value;//修改表单数据,以便后续提交
527
- if (typeof this.dynamicSlotsField[slotName].change === 'function') {
528
- this.dynamicSlotsField[slotName].change(data.value)//字段数据更新回调
529
- }
530
- //给其他字段赋值
531
- this.dynamicSlotsOtherResult[slotName]?.forEach(item => {
532
- this.formData[item.targetField] = data.data[item.sourceField]
533
- })
534
- }
535
- },
536
- mounted() {
537
- this.$nextTick(() => {
538
- storeDict().init(this.http)
539
- })
540
- },
541
- created() {
542
- }
543
- };
544
- </script>