cloud-web-corejs 1.0.54-dev.586 → 1.0.54-dev.587

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.586",
4
+ "version": "1.0.54-dev.587",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -308,6 +308,7 @@
308
308
  >{{ $t1("新增") }}
309
309
  </el-button
310
310
  >
311
+ <el-button v-if="userFlag === 6" type="primary" class="button-sty" icon="el-icon-upload2" @click="excelExport">导出</el-button>
311
312
  </template>
312
313
  <template #default>
313
314
  <div>
@@ -84,6 +84,11 @@
84
84
  :option="deleteProjectTagOption"
85
85
  v-if="isDev && (currentFormType.editAuth === 1 || otherFlag)"
86
86
  ></projectTagDeleteButton>
87
+ <base-table-export
88
+ v-if="userFlag === 6"
89
+ :option="{ title: $t1('数据表导出'), targetRef: 'table-m1' }"
90
+ :parent-target="_self"
91
+ />
87
92
  </template>
88
93
  <template #buttonRight>
89
94
  <vxe-button
@@ -7,7 +7,7 @@ import zdDialog from "@base/views/bd/setting/table_model/zdDialog.vue";
7
7
  import {getBdFlag} from "@base/api/user";
8
8
  import {getJsxBtn} from "@base/views/bd/setting/utils/index";
9
9
  import otherAuthDialog from "../otherAuthDialog.vue";
10
-
10
+ import { mapGetters } from "vuex";
11
11
 
12
12
  let modules = {};
13
13
  modules = {
@@ -93,6 +93,11 @@ modules = {
93
93
  showOtherAuthDialog:false
94
94
  };
95
95
  },
96
+ computed: {
97
+ ...mapGetters([
98
+ "userFlag",
99
+ ]),
100
+ },
96
101
  created() {
97
102
  if (this._dataId && !isNaN(this._dataId)) {
98
103
  this.dataId = this._dataId;
@@ -374,6 +379,11 @@ modules = {
374
379
  title: this.$t1("是否必填项"),
375
380
  field: "required",
376
381
  width: 140,
382
+ params: {
383
+ exportVal:({row,column})=>{
384
+ return this.$t1(row[column.field]? "是": "否")
385
+ }
386
+ },
377
387
  slots: {
378
388
  default: "required",
379
389
  /*default: ({row, $table, rowIndex}) => {
@@ -388,6 +398,11 @@ modules = {
388
398
  title: this.$t1("是否启用"),
389
399
  field: "enabled",
390
400
  width: 120,
401
+ params: {
402
+ exportVal:({row,column})=>{
403
+ return this.$t1(row[column.field]? "是": "否")
404
+ }
405
+ },
391
406
  slots: {
392
407
  default: "enabled",
393
408
  /*default: ({row, $table, rowIndex}) => {
@@ -403,6 +418,11 @@ modules = {
403
418
  title: this.$t1("是否自动生成编码"),
404
419
  field: "generateCode",
405
420
  width: 180,
421
+ params: {
422
+ exportVal:({row,column})=>{
423
+ return this.$t1(row[column.field]? "是": "否")
424
+ }
425
+ },
406
426
  slots: {
407
427
  default: "generateCode",
408
428
  /*default: ({row, $table, rowIndex}) => {
@@ -417,6 +437,11 @@ modules = {
417
437
  title: this.$t1('数据库字段加密'),
418
438
  field: 'atened',
419
439
  width: 180,
440
+ params: {
441
+ exportVal:({row,column})=>{
442
+ return this.$t1(row[column.field]? "是": "否")
443
+ }
444
+ },
420
445
  slots: {
421
446
  default: "atened"
422
447
  }
@@ -425,6 +450,11 @@ modules = {
425
450
  title: this.$t1('是否更新忽略字段'),
426
451
  field: 'updateIgnore',
427
452
  width: 180,
453
+ params: {
454
+ exportVal:({row,column})=>{
455
+ return this.$t1(row[column.field]? "是": "否")
456
+ }
457
+ },
428
458
  slots: {
429
459
  default: "updateIgnore"
430
460
  }
@@ -1197,6 +1227,9 @@ modules = {
1197
1227
  confirmOtherAuthDialog(){
1198
1228
  this.$baseReload()
1199
1229
  },
1230
+ excelExport(){
1231
+ this.$excelExport({title: '数据表字段明细导出', targetRef: 'table-szTaZdMb', prefix: USER_PREFIX, type: 'selected'})
1232
+ }
1200
1233
  },
1201
1234
  };
1202
1235
  export default modules;
@@ -8,6 +8,7 @@ import projectTagDialog from "@base/views/user/project_tag/dialog.vue";
8
8
  import {treeScollx} from "@base/utils/global";
9
9
  import {getBdFlag} from "@base/api/user";
10
10
  import {getJsxBtn, getJsxStatus} from "@base/views/bd/setting/utils";
11
+ import { mapGetters } from "vuex";
11
12
 
12
13
  let modules = {};
13
14
  modules = {
@@ -96,7 +97,10 @@ modules = {
96
97
  },
97
98
  otherFlag() {
98
99
  return this.currentFormType?.menuKindCode == "other"
99
- }
100
+ },
101
+ ...mapGetters([
102
+ "userFlag",
103
+ ]),
100
104
  },
101
105
  methods: {
102
106
  searchEvent() {
@@ -205,6 +209,7 @@ modules = {
205
209
  {title: this.$t1('表编码'), field: 'taCode', width: 150},
206
210
  {field: 'serviceName', title: this.$t1('服务名'), width: 150},
207
211
  {title: this.$t1('唯一标识'), field: 'sid', width: 280},
212
+ {field: 'sszstEn', title: this.$t1('所属主实体'), width: 150},
208
213
  {
209
214
  field: 'createBy',
210
215
  title: this.$t1('创建人'),
@@ -1,903 +0,0 @@
1
- import formOplogTable from "@base/components/formOplog/index.vue";
2
- import preformDialog from "@base/views/bd/setting/form_template/preformDialog.vue";
3
- import projectTagView from "@base/components/projectTag/view.vue";
4
- import szTaMbDialog from "@base/views/bd/setting/table_model/dialog.vue";
5
- import MenuKindDialog from "@base/views/bd/setting/menu_kind/dialog.vue";
6
- import zdDialog from "@base/views/bd/setting/table_model/zdDialog.vue";
7
- import {getBdFlag} from "@base/api/user";
8
- import {getJsxBtn} from "@base/views/bd/setting/utils/index";
9
-
10
- let modules = {};
11
- modules = {
12
- name: 'szTaMbEdit',
13
- props: {
14
- _dataId: [String, Number],
15
- currentFormType: Object,
16
- readonly: Boolean
17
- },
18
- components: {
19
- formOplogTable,
20
- preformDialog,
21
- projectTagView,
22
- szTaMbDialog,
23
- MenuKindDialog,
24
- zdDialog
25
- },
26
- data() {
27
- return {
28
- tabIndex: 0,
29
- isEdit: false,
30
- dataId: '',
31
- szTaMb: {
32
- enabled: true,
33
- taType: 0,
34
- szTaZdMbDTOs: [],
35
- menuKindName: null,
36
- menuKindCode: null,
37
- serviceName: null,
38
- taRule: 0,
39
- dataRange: 0,
40
- szTaMbTagDTOs: [],
41
- fromTable: false,
42
- taCh: null,
43
- sszstEn: null,
44
- taEn: null,
45
- taBm: null
46
- },
47
- treeDefaultZds: [],
48
- productOption: {},
49
- showSzTaMbDialog: false,
50
- showItemSzTaMbDialog: false,
51
- showMenuKindDialog: false,
52
- productCategoryCodes: [],
53
- zdEnIndex: '',
54
-
55
- referenceEntity: null,
56
- referenceKey: null,
57
- referenceShowFields: null,
58
- refServiceName: null,
59
- currentIndex: 0,
60
- showReferenceZdDialog: false,
61
-
62
- showEntityDialog: false,
63
- showEntityFieldDialog1: false,
64
- showEntityFieldDialog2: false,
65
- referenceShowRows: [],
66
- createdTableColumnStr: null,
67
- createdTableColumnArray: [],
68
- isDev: true,
69
- showPreformDialog: false,
70
- menuKindAuth: {
71
- editAuth: 0
72
- },
73
-
74
- dbTable: null,
75
- showDtDialog: false,
76
- showTmDialog: false
77
- };
78
- },
79
- created() {
80
- if (this._dataId && !isNaN(this._dataId)) {
81
- this.dataId = this._dataId;
82
- } else {
83
- this.szTaMb.menuKindName = this.currentFormType?.name || null;
84
- this.szTaMb.menuKindCode = this.currentFormType?.menuKindCode || null;
85
- this.szTaMb.serviceName = this.currentFormType?.serviceName || null;
86
- }
87
- },
88
- mounted() {
89
- this.getBdEnv();
90
- this.getTreeDefaultZds();
91
- this.initTableProduct();
92
- this.getData();
93
- },
94
- methods: {
95
- getData(callback) {
96
- if (this.dataId && !isNaN(this.dataId)) {
97
- this.isEdit = true;
98
- this.$http({
99
- aes: true,
100
- url: USER_PREFIX + `/szTaMb/get`,
101
- method: `post`,
102
- data: {
103
- id: this.dataId
104
- },
105
- isLoading: true,
106
- modalStrictly: true,
107
- success: res => {
108
- if (!callback) {
109
- let szTaMb = res.objx || {};
110
- szTaMb.szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs;
111
- szTaMb.attachmentDTOs = this.szTaMb.attachmentDTOs;
112
- szTaMb.oplogDTOs = this.szTaMb.oplogDTOs;
113
- this.szTaMb = szTaMb;
114
-
115
- this.getCreatedTableColumns();
116
- this.getMenuKindAuth(this.szTaMb.menuKindCode);
117
- } else {
118
- callback(res)
119
- }
120
- //获取操作日志数据
121
- this.$refs['oplogTable'].initData({
122
- param: () => {
123
- return {
124
- logType: "SzTaMb",
125
- logObjCode: this.szTaMb.taCode
126
- };
127
- }
128
- });
129
-
130
- }
131
- });
132
- } else {
133
- this.getMenuKindAuth(this.szTaMb.menuKindCode);
134
- }
135
- },
136
- updateStatus(status) {
137
- let text;
138
- if (status === 3) {
139
- text = this.$t1('您确定要作废吗?');
140
- }
141
- this.$baseConfirm(text).then(() => {
142
- this.$http({
143
- aes: true,
144
- url: USER_PREFIX + `/szTaMb/updateStatus`,
145
- method: `post`,
146
- data: {
147
- id: this.dataId,
148
- status: status
149
- },
150
- isLoading: true,
151
- success: res => {
152
- this.$message({
153
- message: res.content,
154
- type: 'success',
155
- duration: 500,
156
- onClose: t => {
157
- this.$baseReload();
158
- }
159
- });
160
- }
161
- });
162
- });
163
- },
164
- saveData() {
165
- this.$refs.editForm.$baseValidate(valid => {
166
- if (valid) {
167
- const szTaZdMbDTOs = this.$refs['table-szTaZdMb'].getTableData().fullData;
168
- if (szTaZdMbDTOs.length === 0) {
169
- this.$baseAlert(this.$t1('明细不能为空!'));
170
- return false;
171
- }
172
- this.szTaMb.szTaZdMbDTOs = szTaZdMbDTOs;
173
- this.openPreformDialog();
174
-
175
- }
176
- });
177
- },
178
- saveDataHandle(preformData) {
179
- let formData = {
180
- ...this.szTaMb,
181
- logContent: preformData.logContent
182
- };
183
- // const formData = this.szTaMb;
184
- // formData.szTaZdMbDTOs = szTaZdMbDTOs;
185
-
186
- var url = USER_PREFIX + (this.isEdit ? `/szTaMb/update` : `/szTaMb/save`);
187
- this.$http({
188
- aes: true,
189
- url: url,
190
- method: `post`,
191
- data: formData,
192
- isLoading: true,
193
- success: res => {
194
- this.$message({
195
- message: res.content,
196
- type: 'success',
197
- duration: 500,
198
- onClose: t => {
199
- if (this.isEdit) {
200
- this.$baseReload();
201
- } else {
202
- this.$baseReload({
203
- updateParam: {
204
- _dataId: res.objx
205
- }
206
- });
207
- }
208
- }
209
- });
210
- }
211
- });
212
- },
213
- openPreformDialog() {
214
- this.showPreformDialog = true;
215
- },
216
- confirmPreformDialog(preformData) {
217
- this.saveDataHandle(preformData);
218
- },
219
- initTableProduct() {
220
- const tableOption = {
221
- vue: this,
222
- tableRef: 'table-szTaZdMb',
223
- tableName: 'edit-szTaMb-szTaZdMb',
224
- config: {
225
- maxHeight: "600px"
226
- },
227
- columns: [
228
- {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
229
- {
230
- title: this.$t1('实体字段名称'),
231
- field: 'zdEn',
232
- width: 150,
233
- fixed: 'left',
234
- slots: {
235
- default: "zdEn"
236
- /*default: ({row, rowIndex, $table}) => {
237
- let disabled = !!row.systems || !!row.relationZd;
238
- if (!disabled) {
239
- return [
240
- <el-form-item prop={'szTaZdMbDTOs.' + rowIndex + '.zdEn'}
241
- rules={[{required: true, trigger: ['blur', 'change']}]}>
242
- <el-input v-model={row.zdEn} clearable/>
243
- </el-form-item>
244
- ];
245
- } else {
246
- let style = !!row.relationZd ? "margin-left:20px" : "";
247
- return [
248
- <div style={style}>{row.zdEn}</div>
249
- ]
250
- }
251
- }*/
252
- }
253
- },
254
- {title: this.$t1('数据库表字段名'), field: 'taZdMc', width: 150, fixed: 'left',},
255
- {
256
- title: this.$t1('数据库表字段是否已创建'),
257
- field: 'isFieldCreated',
258
- width: 200,
259
- slots: {
260
- default: ({row, rowIndex, $table}) => {
261
- let taZdMc = row.taZdMc;
262
- let createdTableColumnArray = this.createdTableColumnArray;
263
- return taZdMc && createdTableColumnArray.includes(taZdMc) ? "是" : "_";
264
- }
265
- }
266
- },
267
- {
268
- title: this.$t1('字段描述'),
269
- field: 'zdCh',
270
- width: 150,
271
- slots: {
272
- default: 'zdCh'
273
- /*default: ({row, rowIndex, $table}) => {
274
- return [
275
- <el-form-item prop={'szTaZdMbDTOs.' + rowIndex + '.zdCh'}
276
- rules={[{required: true, trigger: ['blur', 'change']}]}>
277
- <el-input v-model={row.zdCh} clearable disabled={!!row.systems}/>
278
- </el-form-item>
279
- ];
280
- }*/
281
- }
282
- },
283
- {
284
- title: this.$t1('字段类型'), field: 'zdType', width: 150,
285
- slots: {
286
- default: 'zdType'
287
- }
288
- },
289
- {
290
- title: this.$t1('关联字段'), field: 'referenceZd', width: 250,
291
- slots: {
292
- default: 'referenceZd'
293
- }
294
- },
295
- {
296
- title: this.$t1('关联表对应服务名'), field: 'refServiceName', width: 200
297
- },
298
- {
299
- title: this.$t1('字段类型对应的默认值'),
300
- field: 'zdTypeValues',
301
- width: 150,
302
- slots: {
303
- default: 'zdTypeValues'
304
- /*default: ({row, rowIndex, $table}) => {
305
- let disabled = !!row.systems || !!row.relationZd;
306
- return [
307
- <el-form-item prop={'szTaZdMbDTOs.' + rowIndex + '.zdTypeValues'}
308
- rules={[{required: false, trigger: ['blur', 'change']}]}>
309
- <el-input v-model={row.zdTypeValues} clearable disabled={disabled}/>
310
- </el-form-item>
311
- ];
312
- }*/
313
- }
314
- },
315
- {
316
- title: this.$t1('是否必填项'),
317
- field: 'required',
318
- width: 140,
319
- slots: {
320
- default: "required"
321
- /*default: ({row, $table, rowIndex}) => {
322
- let disabled = !!row.systems || !!row.relationZd;
323
- return [
324
- <el-checkbox v-model={row.required} disabled={disabled}/>
325
- ];
326
- }*/
327
- }
328
- },
329
- {
330
- title: this.$t1('是否启用'),
331
- field: 'enabled',
332
- width: 120,
333
- slots: {
334
- default: "enabled"
335
- /*default: ({row, $table, rowIndex}) => {
336
- let disabled = !!row.systems || !!row.relationZd;
337
- return [
338
- <el-checkbox v-model={row.enabled} disabled={disabled}/>
339
- ];
340
- }*/
341
- }
342
- },
343
-
344
- {
345
- title: this.$t1('是否自动生成编码'),
346
- field: 'generateCode',
347
- width: 180,
348
- slots: {
349
- default: "generateCode"
350
- /*default: ({row, $table, rowIndex}) => {
351
- let disabled = !!row.systems || !!row.relationZd;
352
- return [
353
- <el-checkbox v-model={row.generateCode} disabled={disabled}/>
354
- ];
355
- }*/
356
- }
357
- },
358
- /* {
359
- title: this.$t1('数据库字段加密'),
360
- field: 't1',
361
- width: 180,
362
- slots: {
363
- default: "t1"
364
- }
365
- }, */
366
- {
367
- title: this.$t1('编码类型'),
368
- field: 'codeType',
369
- width: 150,
370
- slots: {
371
- default: "codeType"
372
- /*default: ({row, rowIndex, $table}) => {
373
- let disabled = !!row.systems || !!row.relationZd;
374
- return [
375
- <el-form-item prop={'szTaZdMbDTOs.' + rowIndex + '.codeType'}
376
- rules={[{required: false, trigger: ['blur', 'change']}]}>
377
- <el-input v-model={row.codeType} clearable disabled={disabled}/>
378
- </el-form-item>
379
- ];
380
- }*/
381
- }
382
- },
383
- {
384
- title: this.$t1('序号'),
385
- field: 'orders',
386
- width: 150,
387
- slots: {
388
- default: "orders"
389
- /*default: ({row, rowIndex, $table}) => {
390
- return [
391
- <el-form-item prop={'szTaZdMbDTOs.' + rowIndex + '.orders'}
392
- rules={[{required: false, trigger: ['blur', 'change']}]}>
393
- <base-input-number v-model={row.orders} disabled={!!row.systems} onchange={() => {
394
- this.changeOrders(row);
395
- }}/>
396
- </el-form-item>
397
- ];
398
- }*/
399
- }
400
- },
401
- {
402
- width: 47,
403
- fixed: 'right',
404
- title: '',
405
- sortable: false,
406
- slots: {
407
- default: ({row, rowIndex, $table}) => {
408
- let taZdMc = row.taZdMc;
409
- let createdTableColumnArray = this.createdTableColumnArray || [];
410
- let hasCreated = !!taZdMc && createdTableColumnArray.includes(taZdMc)
411
- // let style = !row.relationZd ? "margin-left:20px" : "";
412
- if (!row.systems && !hasCreated && !row.relationZd) {
413
- //非内置,未创建字段,非关联表带出来的字段
414
- return getJsxBtn({
415
- iconName: "el-icon-delete",
416
- content: this.$t1('删除'),
417
- onclick: () => {
418
- this.deleteItem(row, rowIndex);
419
- }
420
- });
421
- }
422
- }
423
- }
424
- }
425
- ]
426
- };
427
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
428
- this.productOption = opts;
429
- });
430
- if (this.dataId) {
431
- this.$http({
432
- aes: true,
433
- url: USER_PREFIX + `/szTaMb/getSzTaZdMbs`,
434
- method: `post`,
435
- data: {
436
- id: this.dataId
437
- },
438
- isLoading: true,
439
- modalStrictly: true,
440
- success: res => {
441
- this.szTaMb.szTaZdMbDTOs = res.objx || [];
442
- }
443
- });
444
- }
445
- },
446
- addTaMbItems() {
447
- // let tacitly = true;
448
- // if (this.customer.szTaZdMbDTOs.length > 0) {
449
- // tacitly = false;
450
- // }
451
- // this.customer.szTaZdMbDTOs.push({tacitly: tacitly});
452
- let newIndex = this.getNewIndex();
453
- this.szTaMb.szTaZdMbDTOs.push({
454
- zdType: 'Text',
455
- enabled: true,
456
- orders: newIndex,
457
- generateCode: false,
458
- fromTable: false
459
- });
460
- },
461
- deleteItem(row, rowIndex) {
462
- let referenceZd = row.referenceZd;
463
- this.szTaMb.szTaZdMbDTOs.splice(rowIndex, 1);
464
- if (referenceZd) {
465
- this.szTaMb.szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs.filter(item => {
466
- return referenceZd !== item.relationZd
467
- })
468
- }
469
- },
470
- confirmInsertSzTaMb(rows) {
471
- if (rows.length > 0) {
472
- let row = rows[0];
473
- this.$set(this.szTaMb, 'sszst', row.taCode);
474
- this.$set(this.szTaMb, 'sszstEn', row.taEn);
475
- }
476
- },
477
- confirmInsertItemSzTaMb(rows) {
478
- if (rows.length > 0) {
479
- let row = rows[0];
480
- let szTaZdMbDTO = this.szTaMb.szTaZdMbDTOs[this.zdEnIndex];
481
- this.$set(szTaZdMbDTO, 'zdEn', row.taBm + '.' + szTaZdMbDTO.zdEn);
482
- this.$set(szTaZdMbDTO, 'dybm', row.taEn);
483
- }
484
- },
485
- confirmInsertMenuKind(rows) {
486
- if (rows.length > 0) {
487
- let row = rows[0];
488
- this.$set(this.szTaMb, 'menuKindCode', row.menuKindCode);
489
- this.$set(this.szTaMb, 'menuKindName', row.name);
490
- }
491
- },
492
- getNewData(callback) {
493
- this.getData((res0) => {
494
- let szTaMb = res0.objx;
495
- this.$http({
496
- aes: true,
497
- url: USER_PREFIX + `/szTaMb/getSzTaZdMbs`,
498
- method: `post`,
499
- data: {
500
- id: this.dataId
501
- },
502
- isLoading: true,
503
- modalStrictly: true,
504
- success: res1 => {
505
- szTaMb.szTaZdMbDTOs = res1.objx || [];
506
- callback(szTaMb)
507
- }
508
- });
509
- });
510
- },
511
- createModifyTable() {
512
- let text = this.$t1('您确定要创建/更新数据表吗?');
513
- this.$baseConfirm(text).then(() => {
514
- this.getNewData((data) => {
515
- this.$http({
516
- aes: true,
517
- url: "/" + this.szTaMb.serviceName + `/dbTable/createUpdateTable`,
518
- method: `post`,
519
- data: data,
520
- isLoading: true,
521
- success: res => {
522
- this.$message({
523
- message: res.content,
524
- type: 'success',
525
- duration: 500,
526
- onClose: t => {
527
- this.$baseReload();
528
- }
529
- });
530
- }
531
- });
532
-
533
- });
534
- });
535
- },
536
- openReferenceZdDialog(row, rowIndex, $table) {
537
- let referenceZd = row.referenceZd;
538
- let referenceEntity = null;
539
- let referenceKey = null;
540
- let referenceShowFields = [];
541
-
542
- if (referenceZd) {
543
- let index = referenceZd.indexOf(".")
544
- referenceEntity = referenceZd.substring(0, index);
545
- referenceKey = referenceZd.substr(index + 1);
546
- referenceShowFields = this.szTaMb.szTaZdMbDTOs.filter(item => {
547
- return referenceZd == item.relationZd
548
- }).map(item => {
549
- return item.referenceZd.substr(index + 1)
550
- });
551
- }
552
-
553
- this.referenceEntity = referenceEntity;
554
- this.referenceKey = referenceKey;
555
- this.referenceShowFields = referenceShowFields;
556
- this.refServiceName = row.refServiceName ?? null;
557
-
558
- this.referenceShowRows = referenceShowFields.map(item => {
559
- return {
560
- taZdMc: item
561
- }
562
- });
563
-
564
- this.currentIndex = rowIndex;
565
- this.showReferenceZdDialog = true;
566
- },
567
- confirmReferenceZdDialog() {
568
- let row = this.szTaMb.szTaZdMbDTOs[this.currentIndex];
569
- let oldReferenceZd = row.referenceZd;
570
-
571
- let referenceEntity = this.referenceEntity;
572
- let refServiceName = this.refServiceName;
573
-
574
- let referenceZd = referenceEntity + "." + this.referenceKey;
575
- let referenceShowFields = this.referenceShowFields;
576
- let keys = referenceShowFields.map(item => {
577
- return referenceEntity + "." + item;
578
- })
579
- if (oldReferenceZd) {
580
- let index0 = oldReferenceZd.indexOf(".")
581
- let oldReferenceEntity = oldReferenceZd.substring(0, index0);
582
- let delIndex = [];
583
- if (referenceEntity != oldReferenceEntity) {
584
- this.szTaMb.szTaZdMbDTOs.forEach((item, index) => {
585
- if (item.relationZd && oldReferenceZd == item.relationZd) {
586
- delIndex.push(index);
587
- }
588
- })
589
- }/*else if (oldReferenceZd != referenceZd) {
590
- this.szTaMb.szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs.forEach((item, index) => {
591
- if (oldReferenceZd == item.relationZd) {
592
- delIndex.push(index)
593
- }
594
- })
595
- }*/ else {
596
- this.szTaMb.szTaZdMbDTOs.forEach((item, index) => {
597
- if (oldReferenceZd == item.relationZd) {
598
- if (!keys.includes(item.referenceZd)) {
599
- delIndex.push(index)
600
- } else {
601
- item.refServiceName = refServiceName;
602
- }
603
-
604
- }
605
- })
606
- }
607
- if (delIndex.length) {
608
- /*this.szTaMb.szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs.filter((item, index) => {
609
- return !delIndex.includes(index);
610
- })*/
611
- delIndex.reverse().forEach(i => {
612
- this.szTaMb.szTaZdMbDTOs.splice(i, 1)
613
- })
614
- }
615
- }
616
-
617
- /*let addReferenceShowFields = referenceShowFields.filter((item, index) => {
618
- return !keys.includes(item)
619
- })*/
620
- let oldKeys = this.szTaMb.szTaZdMbDTOs.filter(item => referenceZd == item.relationZd).map(item => item.referenceZd)
621
- let addReferenceShowFields = referenceShowFields.filter((item, index) => {
622
- return !oldKeys.includes(referenceEntity + "." + item)
623
- })
624
-
625
- let addIndex = -1;
626
- let lastIndex = this.szTaMb.szTaZdMbDTOs.findLastIndex(item => {
627
- return referenceZd == item.relationZd
628
- });
629
- addIndex = lastIndex >= 0 ? (lastIndex + 1) : (this.currentIndex + 1);
630
-
631
- let referenceShowRows = this.referenceShowRows;
632
-
633
- let addReferenceShowRows = referenceShowRows.filter((item, index) => {
634
- return addReferenceShowFields.includes(item.taZdMc)
635
- })
636
- addReferenceShowRows.forEach((item, index) => {
637
- let rIndex = addIndex + index;
638
- let orders = (row.orders || 0) + index + 1;
639
- let newItem = {
640
- zdEn: "ref_" + item.zdEn,
641
- taZdMc: null,
642
- zdCh: item.zdCh,
643
- zdType: "Text",
644
- referenceZd: referenceEntity + "." + item.taZdMc,
645
- relationZd: referenceZd,
646
- refServiceName,
647
- zdTypeValues: null,
648
- required: false,
649
- enabled: true,
650
- requiredMsg: null,
651
- regexp: null,
652
- regexpMsg: null,
653
- orders
654
- };
655
- this.szTaMb.szTaZdMbDTOs.splice(rIndex, 0, newItem);
656
- });
657
- row.referenceZd = referenceZd
658
- row.refServiceName = refServiceName
659
- this.handleReferenceOrders(row);
660
- this.showReferenceZdDialog = false;
661
- },
662
- changeOrders(row) {
663
- this.handleReferenceOrders(row);
664
- },
665
- handleReferenceOrders(row) {
666
- let referenceZd = row.referenceZd;
667
- let orders = row.orders || 0;
668
- if (referenceZd) {
669
- this.szTaMb.szTaZdMbDTOs.filter(item => referenceZd === item.relationZd).forEach((item, index) => {
670
- if (referenceZd === item.relationZd) {
671
- item.orders = orders + index + 1;
672
- }
673
- })
674
- }
675
- },
676
- confirmEntityDialog(rows) {
677
- if (rows.length) {
678
- let row = rows[0];
679
- if (this.referenceEntity != row.taBm) {
680
- this.referenceKey = null;
681
- this.referenceShowFields = [];
682
- }
683
- this.referenceEntity = row.taBm;
684
- this.refServiceName = row.serviceName;
685
- }
686
- },
687
- confirmEntityFieldDialog1(rows) {
688
- if (rows.length) {
689
- let row = rows[0];
690
- this.referenceKey = row.taZdMc;
691
- }
692
- },
693
- confirmEntityFieldDialog2(rows) {
694
- if (rows.length) {
695
- this.referenceShowRows = rows;
696
- this.referenceShowFields = rows.map(row => {
697
- return row.taZdMc;
698
- });
699
- }
700
- },
701
- getCreatedTableColumns() {
702
- if (!this.szTaMb.taBm) return;
703
- this.$http({
704
- aes: true,
705
- url: "/" + this.szTaMb.serviceName + "/dbTable/getTableColumns",
706
- method: `post`,
707
- data: {
708
- stringOne: this.szTaMb.taBm
709
- },
710
- isLoading: true,
711
- modalStrictly: true,
712
- success: res => {
713
- if (res.objx) {
714
- this.createdTableColumnStr = res.objx;
715
- let createdTableColumnArray = res.objx.split(",").filter(item => !!item);
716
- this.createdTableColumnArray = createdTableColumnArray;
717
- }
718
- }
719
- });
720
- },
721
- getTreeDefaultZds() {
722
- this.$http({
723
- aes: true,
724
- url: USER_PREFIX + `/szTaMb/getTreeDefaultZds`,
725
- method: `post`,
726
- data: {},
727
- isLoading: true,
728
- modalStrictly: true,
729
- success: res => {
730
- let rows = res.objx || []
731
- this.treeDefaultZds = rows
732
- }
733
- });
734
- },
735
- hasFieldCreated(row) {
736
- let taZdMc = row.taZdMc;
737
- let createdTableColumnArray = this.createdTableColumnArray || [];
738
- let hasCreated = !!taZdMc && createdTableColumnArray.includes(taZdMc)
739
- return hasCreated;
740
- },
741
- changeTaRule(val) {
742
- let treeDefaultZds = this.$baseLodash.cloneDeep(this.treeDefaultZds);
743
- let szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs;
744
- if (val == 1) {
745
- let zdEns = szTaZdMbDTOs.filter(item => !!item.zdEn).map(item => item.zdEn);
746
- if (zdEns.length) {
747
- treeDefaultZds = treeDefaultZds.filter(item => {
748
- return !zdEns.includes(item.zdEn);
749
- })
750
- }
751
- let newIndex = this.getNewIndex();
752
- treeDefaultZds.forEach((item, index) => {
753
- item.orders = newIndex + index;
754
- })
755
- szTaZdMbDTOs.push(...treeDefaultZds);
756
- } else {
757
- let zdEns = szTaZdMbDTOs.filter(item => !!item.zdEn).map(item => item.zdEn);
758
- let createdFields = szTaZdMbDTOs.filter(item => {
759
- return !!item.zdEn && this.hasFieldCreated(item)
760
- }).map(item => item.zdEn);
761
- if (zdEns.length) {
762
- treeDefaultZds = treeDefaultZds.filter(item => {
763
- return !createdFields.includes(item.zdEn) && zdEns.includes(item.zdEn);
764
- })
765
- }
766
- let delFields = treeDefaultZds.map(item => item.zdEn);
767
- this.szTaMb.szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs.filter(item => !delFields.includes(item.zdEn))
768
- }
769
-
770
- },
771
- getNewIndex() {
772
- let min = 100
773
- let szTaZdMbDTOs = this.szTaMb.szTaZdMbDTOs;
774
- let value = 0;
775
- let allOrders = szTaZdMbDTOs.filter(item=>item.orders!=null && item.orders!=undefined).map(item=>item.orders);
776
- szTaZdMbDTOs.forEach(item => {
777
- let orders = item.orders;
778
- if (orders !== null && orders !== undefined && orders < 9000) {
779
- value = Math.max(value, orders);
780
- }
781
- })
782
- let newIndex = Math.max(min, (value + 10));
783
- return newIndex;
784
- },
785
- getBdEnv() {
786
- getBdFlag({
787
- success: res => {
788
- this.isDev = res.objx == 1
789
- }
790
- });
791
- },
792
- getMenuKindAuth(menuKindCode) {
793
- if (menuKindCode) {
794
- this.$http({
795
- aes: true,
796
- url: USER_PREFIX + '/menu_kind_auth/getAuth',
797
- method: `post`,
798
- data: {stringOne: menuKindCode},
799
- isLoading: true,
800
- success: res => {
801
- this.menuKindAuth = res.objx || {}
802
- }
803
- });
804
- }
805
- },
806
- openDtDialog() {
807
- //引用数据库中数据表结构
808
- this.dbTable = null;
809
- this.showDtDialog = true;
810
- },
811
- confirmDtDialog() {
812
- let dbTable = this.dbTable;
813
- if (!dbTable) {
814
- this.$baseAlert(this.$t1("数据表不能为空"));
815
- return
816
- }
817
- this.showDtDialog = false;
818
- this.$http({
819
- // aes: true,
820
- url: "/" + this.szTaMb.serviceName + `/dbTable/getSzTaZdMbs`,
821
- method: `post`,
822
- data: {
823
- stringOne: dbTable
824
- },
825
- isLoading: true,
826
- success: res => {
827
- let items = res.objx || [];
828
- if (!items.length) {
829
- this.$baseAlert(this.$t1("数据表[{dbTable}]不存在", {dbTable}));
830
- return
831
- }
832
- let szTaZdMbDTOs = items.filter(item => !item.systems).map(item => {
833
- return {
834
- ...item,
835
- createBy: null,
836
- createDate: null,
837
- fromTable: true,
838
- id: null,
839
- modifyBy: null,
840
- modifyDate: null
841
- }
842
- })
843
- this.szTaMb.taEn = dbTable;
844
- this.szTaMb.taBm = dbTable;
845
- this.szTaMb.szTaZdMbDTOs = szTaZdMbDTOs;
846
- }
847
- });
848
- },
849
- openTmDialog() {
850
- //引用数据表定义的结构
851
- this.showTmDialog = true;
852
- },
853
- confirmTmDialog(rows) {
854
- if (rows.length) {
855
- let row = rows[0];
856
- this.$http({
857
- aes: true,
858
- url: USER_PREFIX + `/szTaMb/getSzTaZdMbs`,
859
- method: `post`,
860
- data: {
861
- id: row.id
862
- },
863
- isLoading: true,
864
- modalStrictly: true,
865
- success: res => {
866
- let items = res.objx || [];
867
- let szTaZdMbDTOs = items.filter(item => !item.systems).map(item => {
868
- return {
869
- ...item,
870
- createBy: null,
871
- createDate: null,
872
- fromTable: true,
873
- id: null,
874
- modifyBy: null,
875
- modifyDate: null
876
- }
877
- })
878
- let newRow = {
879
- ...row,
880
- createBy: null,
881
- createDate: null,
882
- fromTable: true,
883
- id: null,
884
- modifyBy: null,
885
- modifyDate: null,
886
- sid: null,
887
- // taBm: null,
888
- taCode: null
889
- }
890
- Object.keys(newRow).forEach(key => {
891
- if (key.endsWith('DTOs')) {
892
- delete newRow[key]
893
- }
894
- })
895
- Object.assign(this.szTaMb, newRow);
896
- this.szTaMb.szTaZdMbDTOs = szTaZdMbDTOs;
897
- }
898
- });
899
- }
900
- }
901
- }
902
- };
903
- export default modules