ap-dev 1.2.12 → 1.2.13

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.
@@ -2,37 +2,36 @@
2
2
  <div class="flex flex-pack-center" style="height: 100%;height: 100%;margin-top: 5px;">
3
3
  <!--左侧面板-->
4
4
  <div class="dev-container dev-left-panel">
5
- <el-tabs value="default" :stretch="true">
6
- <el-tab-pane label="默认" name="default">
7
- <el-collapse v-model="componentGroup">
8
- <template v-for="devComponent in devComponents">
9
- <el-collapse-item :name="devComponent.title">
10
- <template slot="title">
11
- <span class="dev-collapse-title">{{ devComponent.title }}</span>
12
- </template>
13
- <div class="dev-panel-item">
14
- <div
15
- v-for="item in devComponent.list"
16
- :key="item.type"
17
- class="dev-comp-item"
18
- :data-type="item.type"
19
- @click="clickItemEvent(item.type)"
20
- >
21
- <i :class="item.icon"/>&nbsp;{{ item.title }}
22
- </div>
23
- </div>
24
- </el-collapse-item>
5
+ <el-tabs value="name0" :stretch="true" style="width: 100%">
6
+ <template v-for="(tab,cptIndex) in cptList">
7
+ <el-tab-pane v-if="tab.fdType == 1" :label="tab.fdName" :name="'name' + cptIndex">
8
+ <template v-for="menu in tab.children">
9
+ <el-collapse value="itemName">
10
+ <el-collapse-item v-if="menu.fdType == 2" :title="menu.fdName" name="itemName">
11
+ <template slot="title">
12
+ <span class="dev-collapse-title">{{ menu.fdName }}</span>
13
+ </template>
14
+ <template v-for="(item,index) in menu.children">
15
+ <div v-if="item.fdType == 3" class="dev-panel-item">
16
+ <div class="dev-comp-item" :data-type="item.fdId"
17
+ @click="clickItemEvent(item.fdId)">
18
+ <i :class="item.fdIcon"/>&nbsp;{{ item.fdName }}
19
+ </div>
20
+ </div>
21
+ </template>
22
+ </el-collapse-item>
23
+ </el-collapse>
25
24
  </template>
26
- </el-collapse>
27
- </el-tab-pane>
28
- <el-tab-pane label="自定义" name="custom"/>
25
+ </el-tab-pane>
26
+ </template>
29
27
  </el-tabs>
30
28
  </div>
29
+ <ap-split-panel></ap-split-panel>
31
30
 
32
31
  <!--中间面板-->
33
32
  <div class="flex-1 flex flex-direction-column" style="overflow: auto;">
34
33
  <ap-container>
35
- <ap-header margin="0111" height="45%" style="overflow: auto;">
34
+ <ap-header margin="0111" height="40%" style="overflow: auto;">
36
35
  <template v-if="showItem">
37
36
  <!-- <dynamic-item/>-->
38
37
  <vue-render :options.sync="vueCode"></vue-render>
@@ -45,6 +44,7 @@
45
44
  <div style="position: relative;float: right;">
46
45
  <el-button-group>
47
46
  <el-button icon="el-icon-copy" @click="copyCode($event)">复制</el-button>
47
+ <el-button icon="el-icon-mokuai3" @click="getDevCptInfo">刷新配置</el-button>
48
48
  </el-button-group>
49
49
  </div>
50
50
  <div class="dev-code">
@@ -57,77 +57,656 @@
57
57
  <!--右侧面板-->
58
58
  <div class="dev-container dev-right-panel flex flex-direction-column">
59
59
  <div class="flex-1" style="overflow: auto">
60
- <comment :is="currentItem" @dataChange="itemDataChange"/>
60
+ <el-tabs value="name0" :stretch="true">
61
+ <template v-for="(tab,paramIndex) in paramTabList">
62
+ <el-tab-pane :label="tab" :name="'name' + paramIndex" style="padding-left: 10px;">
63
+ <template v-for="param in paramList">
64
+ <template v-if="param.fdTab == tab">
65
+ <div class="flex-justify-start" v-if="checkShowCondition(param) && (param.fdParentId == null || param.fdParentId == '')">
66
+ <div class="param-label">
67
+ {{param.fdName}}
68
+ <el-tooltip v-if="param.fdTip != null && param.fdTip != ''" effect="dark" :content="param.fdTip" placement="top-end">
69
+ <i class="el-icon-wenhao2" />
70
+ </el-tooltip>
71
+ </div>
72
+ <el-input v-if="param.fdShowType == 1" v-model="param.value" :placeholder="param.fdPlaceholder"
73
+ style="width: 280px;" @input="changeEvent(param)"/>
74
+
75
+ <el-switch v-if="param.fdShowType == 2" v-model="param.value" active-value="1" inactive-value="0"
76
+ @change="changeEvent(param)"/>
77
+
78
+ <el-select v-if="param.fdShowType == 3" v-model="param.value" @input="changeEvent(param)" clearable >
79
+ <template v-for="option in handelOption(param)">
80
+ <el-option :label="option.label" :value="option.value"/>
81
+ </template>
82
+ </el-select>
83
+
84
+ <div v-if="param.fdShowType == 4">
85
+ <el-input :value="param.value" style="width: 215px;" :readonly="true"/>
86
+ <el-button size="mini" type="primary" plain @click="openDialog(param)"
87
+ style="padding: 6px 10px;margin-left: 5px"><i class="el-icon-s-tools"/> 配置
88
+ </el-button>
89
+ </div>
90
+
91
+ <el-radio-group v-if="param.fdShowType == 5" v-model="param.value" @change="changeEvent(param)">
92
+ <template v-for="option in handelOption(param)">
93
+ <el-radio :label="option.value">{{ option.label }}</el-radio>
94
+ </template>
95
+ </el-radio-group>
96
+
97
+ <el-input v-if="param.fdShowType == 6" type="textarea" v-model="param.value"
98
+ :placeholder="param.fdPlaceholder" :rows="2" style="width: 280px;"
99
+ @input="changeEvent(param)"/>
100
+
101
+ <el-input-number v-if="param.fdShowType == 7" v-model="param.value" @change="changeEvent(param)"
102
+ :min="handelOptionObj(param).min"
103
+ :max="handelOptionObj(param).max"
104
+ label="描述文字"></el-input-number>
105
+
106
+ </div>
107
+ <div v-if="param.fdShowLine == 1" class="ap-split-line"/>
108
+ </template>
109
+ </template>
110
+ </el-tab-pane>
111
+ </template>
112
+ </el-tabs>
61
113
  </div>
62
114
  </div>
115
+
116
+ <!-- 数组参数弹框 -->
117
+ <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="1000px">
118
+ <div style="height: 350px;">
119
+ <ap-table v-if="dialogVisible" ref="tableRef" :options.sync="tableOpts"></ap-table>
120
+ </div>
121
+ <span slot="footer">
122
+ <el-button @click="dialogVisible = false">取 消</el-button>
123
+ <el-button type="primary" @click="saveArrayParam">确 定</el-button>
124
+ </span>
125
+ </el-dialog>
63
126
  </div>
64
127
  </template>
65
128
 
66
129
  <script>
67
- import devComponents from './../dev/devConfig'
68
130
  import VueRender from './../base/VueRender'
69
- import DynamicItem from "./DynamicItem";
70
- // import DynamicItem from './../generator/DynamicItem'
71
- import {getLocalData} from './../dev/DevUtil'
72
131
  import clipboard from 'ap-util/util/ClipboardUtil'
132
+ import {convertToTreeData} from 'ap-util/util/DataUtil'
73
133
 
74
- // 批量导入组件
75
- const allComponents = require.context('./items', false, /\.vue$/)
76
- const apDevComponentItems = {}
77
- allComponents.keys().forEach(fileName => {
78
- const comp = allComponents(fileName)
79
- apDevComponentItems[fileName.replace(/^\.\/(.*)\.\w+$/, '$1')] = comp.default
80
- })
81
- apDevComponentItems['DynamicItem'] = DynamicItem
82
- apDevComponentItems['VueRender'] = VueRender
83
134
 
84
135
  export default {
85
136
  name: 'ComponentsPanel',
86
- components: apDevComponentItems,
137
+ components: {
138
+ VueRender: VueRender
139
+ },
87
140
  data() {
88
141
  return {
89
- devComponents: devComponents,
90
- componentGroup: [],
91
- currentItem: '',
92
- template: '',
93
142
  showItem: true,
94
- vueCode: ''
143
+ vueCode: '',
144
+ cptList: [], // 组件清单列表
145
+ cptInfo: {}, // 组件信息
146
+ baseInfo: {}, // 组件基础模板信息
147
+ cptTemplateList: [], // 组件模板列表
148
+ cptTemplateObj: {}, // 组件模板对象
149
+ paramTabList: [], // 参数页签列表
150
+ paramList: [], // 参数列表
151
+ paramObj: {}, // 参数对象
152
+ paramTemplateList: [], // 参数模板列表
153
+ paramTemplateObj: {}, // 参数模板对象
154
+ template: '', // 代码
155
+
156
+ dialogTitle: '',
157
+ dialogVisible: false,
158
+ tableOpts: {},
159
+ currentArrayParam: {}, // 当前数组参数
95
160
  }
96
161
  },
97
162
  computed: {},
98
163
  created() {
99
- for (let i = 0; i < devComponents.length; i++) {
100
- this.componentGroup.push(devComponents[i].title)
101
- }
164
+ this.getDevCpt();
102
165
  },
103
166
  methods: {
104
- clickItemEvent(type) {
105
- this.currentItem = 'ap-dev-item-' + type
167
+ getDevCpt() {
168
+ this.$request({
169
+ url: '/apd/TDevCpt/getCptList',
170
+ method: 'post',
171
+ data: {}
172
+ }).then(response => {
173
+ this.cptList = convertToTreeData(response.data, {
174
+ idKey: 'fdId',
175
+ parentKey: 'fdParentId',
176
+ childrenKey: 'children'
177
+ });
178
+ })
179
+ },
180
+ clickItemEvent(id) {
181
+ this.currentCptId = id;
182
+ this.getDevCptInfo();
106
183
  },
107
- createFile(projectName, list) {
184
+ getDevCptInfo() {
108
185
  this.$request({
109
- url: '/apd/dev/DevGenerateCode/createFile',
186
+ url: '/apd/TDevCpt/getDevCptInfo',
110
187
  method: 'post',
111
188
  data: {
112
- list: JSON.stringify(list),
113
- projectName: projectName
189
+ id: this.currentCptId
114
190
  }
115
191
  }).then(response => {
116
- this.showItem = true
192
+ let data = response.data;
193
+ this.getParamTabList(data.paramList);
194
+ this.cptInfo = data.cptInfo;
195
+ this.baseInfo = data.baseInfo;
196
+ this.paramList = data.paramList;
197
+ this.paramTemplateList = data.paramTemplateList;
198
+ this.cptTemplateList = data.cptTemplateList;
199
+ this.initParam();
200
+ this.renderTemplate();
117
201
  })
118
202
  },
119
- // 子组件数据修改
120
- itemDataChange(template) {
121
- this.template = template
122
- this.renderVue();
203
+ getParamTabList(list) {
204
+ let tabNameList = [];
205
+ for (let i = 0; i < list.length; i++) {
206
+ tabNameList.push(list[i].fdTab);
207
+ }
208
+ this.paramTabList = Array.from(new Set(tabNameList));
209
+ },
210
+ // 参数选项值转为数组
211
+ handelOption(param) {
212
+ let options = param.fdOption;
213
+ if (options == null || options == "") {
214
+ return [];
215
+ }
216
+ let res = eval(options);
217
+ return res;
218
+ },
219
+ // 参数选项值转为对象
220
+ handelOptionObj(param) {
221
+ let options = param.fdOption;
222
+ if (options == null || options == "") {
223
+ return {};
224
+ }
225
+ let res = {};
226
+ eval("res = " + options)
227
+ return res;
228
+ },
229
+ // 初始化参数信息:value
230
+ initParam() {
231
+ let paramList = this.paramList;
232
+ // 处理参数的value 默认赋值fdValue
233
+ for (let i = 0; i < paramList.length; i++) {
234
+ paramList[i].value = paramList[i].fdValue;
235
+ }
236
+ },
237
+ // 判定是否显示参数
238
+ checkShowCondition(param) {
239
+ let showCondition = param.fdShowCondition;
240
+ if (showCondition == null || showCondition == "") {
241
+ return true;
242
+ }
243
+ let condition = this.replaceTemplateParam(showCondition);
244
+ return eval(condition);
123
245
  },
124
- renderVue() {
246
+ // 判定是否添加参数到代码
247
+ checkAddCondition(addCondition) {
248
+ if (addCondition == null || addCondition == "") {
249
+ return true;
250
+ }
251
+ let condition = this.replaceTemplateParam(addCondition);
252
+ return eval(condition);
253
+ },
254
+ // 判定是否使用默认参数
255
+ checkDefaultCondition(defaultCondition) {
256
+ if (defaultCondition == null || defaultCondition == "") {
257
+ return false;
258
+ }
259
+ let condition = this.replaceTemplateParam(defaultCondition);
260
+ return eval(condition);
261
+ },
262
+ // 模板赋值 -> type:1参数模板 2组件模板
263
+ handleTemplate(template, type) {
264
+ let res = "";
265
+
266
+ // 判断是否添加模板
267
+ if (!this.checkAddCondition(template.fdAddCondition)) {
268
+ return "";
269
+ }
270
+
271
+ // 判断是否使用默认模板
272
+ if (this.checkDefaultCondition(template.fdDefaultCondition)) {
273
+ res = template.fdDefault;
274
+ } else {
275
+ res = template.fdTemplate;
276
+ }
277
+
278
+ // 处理左侧空格
279
+ let letfSpace = template.fdLeftSpace;
280
+ if (letfSpace != null && letfSpace > 0) {
281
+ let str = "";
282
+ for (let i = 0; i < letfSpace; i++) {
283
+ str += " ";
284
+ }
285
+ res = str + res;
286
+ res = res.replaceAll("\n", "\n" + str);
287
+ }
288
+
289
+ // 参数模板
290
+ if (type == 1) {
291
+ return this.replaceTemplateParam(res);
292
+ }
293
+
294
+ // 组件模板
295
+ if (type == 2) {
296
+ return this.replaceTemplateCpt(res);
297
+ }
298
+
299
+ },
300
+ changeEvent(param) {
301
+ this.renderTemplate();
302
+ },
303
+ // 渲染代码
304
+ renderTemplate() {
305
+ // 设定参数对象
306
+ this.initParamObj();
307
+
308
+ // 设定参数模板
309
+ this.initParamTemplate();
310
+
311
+ // 设定参数对象 - 数组形式
312
+ this.initParamObjForArr();
313
+
314
+ // 设定参数模板 -> 补充数组参数模板
315
+ this.initParamTemplate();
316
+
317
+ // 设定组件模板
318
+ this.initCptTemplate();
319
+
320
+ // 设定组件基础模板
321
+ this.initBaseTemplate();
322
+ },
323
+ // 设定参数对象
324
+ initParamObj() {
325
+ let paramList = this.paramList;
326
+ // 设定参数对象
327
+ let param = {};
328
+ for (let i = 0; i < paramList.length; i++) {
329
+ param[paramList[i].fdCode] = {
330
+ value: paramList[i].value,
331
+ defaultCondition: paramList[i].fdDefaultCondition,
332
+ }
333
+ }
334
+ this.paramObj = param;
335
+ console.log("paramObj: 参数对象");
336
+ console.log(param);
337
+ },
338
+ // 替换模板中的参数
339
+ replaceTemplateParam(template) {
340
+ if (template == null) {
341
+ return "";
342
+ }
343
+ // 正则参数:例:${InputChangeEvent.value}
344
+ let reg = new RegExp(/\${\w*\.\w*}/g);
345
+ let paramArr = template.match(reg);
346
+ if (paramArr == null) {
347
+ return template;
348
+ }
349
+ for (let j = 0; j < paramArr.length; j++) {
350
+ let pTemp = paramArr[j].substring(2, paramArr[j].length - 1).split(".");
351
+ // 参数实际值
352
+ let paramValue = this.paramObj[pTemp[0]];
353
+ let replaceStr = "";
354
+ if (paramValue == null) {
355
+ replaceStr = `###error: 获取参数对象为空 ${paramArr[j]}###`;
356
+ } else {
357
+ let value = paramValue[pTemp[1]];
358
+ if (value == null || value == "") {
359
+ replaceStr = "";
360
+ } else {
361
+ replaceStr = value;
362
+ }
363
+ }
364
+ template = template.replaceAll(paramArr[j], replaceStr);
365
+ }
366
+ return template;
367
+ },
368
+ // 设定参数对象 - 数组形式
369
+ initParamObjForArr() {
370
+ let paramList = this.paramList;
371
+ // 处理参数的value 默认赋值fdValue
372
+ for (let i = 0; i < paramList.length; i++) {
373
+ let param = paramList[i];
374
+ // 字符串形式不处理
375
+ if (param.fdShowType != 4) {
376
+ continue;
377
+ }
378
+
379
+ // 数组形式:第一次需要赋值,编辑修改。无需再次赋值
380
+ let fdValue = param.fdValue;
381
+ if (param.arrValue == null) {
382
+ if (fdValue == null || fdValue == "") {
383
+ param.arrValue = [];
384
+ param.value = "";
385
+ continue;
386
+ }
387
+ param.arrValue = eval(param.fdValue);
388
+ }
389
+ let pv = this.getArrayParamValue(param);
390
+ param.value = pv;
391
+ // 设定参数对象
392
+ this.paramObj[param.fdCode].value = pv;
393
+ }
394
+ },
395
+ // 替换组件模板的参数
396
+ replaceTemplateCpt(template) {
397
+ if (template == null) {
398
+ return "";
399
+ }
400
+
401
+ // 正则参数:例:${attrs}
402
+ let reg = new RegExp(/\${\w*}/g);
403
+ // 正则参数:例:${attrs#,}
404
+ let regCustom = new RegExp(/\${\w*#[^$]*}/g);
405
+
406
+ // 参数赋值:数组默认拼接
407
+ let paramArr = template.match(reg);
408
+ if (paramArr != null) {
409
+ for (let j = 0; j < paramArr.length; j++) {
410
+ // 参数实际值
411
+ let attrName = paramArr[j].substring(2, paramArr[j].length - 1);
412
+ let valueObj = this.paramTemplateObj[attrName];
413
+ if (valueObj == null) {
414
+ // 不存在参数数组,替换为空
415
+ template = template.replaceAll(paramArr[j], "");
416
+ } else {
417
+ template = template.replaceAll(paramArr[j], valueObj.join(" "));
418
+ }
419
+
420
+ }
421
+ }
422
+
423
+ // 参数赋值:数组自定义拼接
424
+ let paramArr2 = template.match(regCustom);
425
+ if (paramArr2 != null) {
426
+ for (let j = 0; j < paramArr2.length; j++) {
427
+ // 参数实际值
428
+ let attrName = paramArr2[j].substring(2, paramArr2[j].length - 1).split("#");
429
+ let valueObj = this.paramTemplateObj[attrName[0]];
430
+ if (valueObj == null) {
431
+ // 不存在参数数组,替换为空
432
+ template = template.replaceAll(paramArr2[j], "");
433
+ } else {
434
+ let splitStr = attrName[1].replaceAll("\\n", "\n")
435
+ template = template.replaceAll(paramArr2[j], valueObj.join(splitStr));
436
+ }
437
+ }
438
+ }
439
+
440
+ return template;
441
+ },
442
+ // 设定参数模板
443
+ initParamTemplate() {
444
+ let templates = this.paramTemplateList;
445
+
446
+ for (let i = 0; i < templates.length; i++) {
447
+ templates[i].template = this.handleTemplate(templates[i], 1);
448
+ }
449
+
450
+ // 参数模板对象
451
+ let templateObj = {};
452
+ for (let i = 0; i < templates.length; i++) {
453
+ let paramName = templates[i].fdParamName;
454
+ if (templateObj[paramName] == null) {
455
+ templateObj[paramName] = [];
456
+ }
457
+ let tmp = templates[i].template;
458
+ if (tmp != null && tmp != "") {
459
+ templateObj[paramName].push(templates[i].template);
460
+ }
461
+ }
462
+
463
+ this.paramTemplateObj = templateObj;
464
+ // console.log("paramTemplateObj: 参数模板对象");
465
+ // console.log(templateObj);
466
+ },
467
+ // 设定组件模板
468
+ initCptTemplate() {
469
+ let templates = this.cptTemplateList;
470
+ for (let i = 0; i < templates.length; i++) {
471
+ templates[i].template = this.handleTemplate(templates[i], 2);
472
+ }
473
+
474
+ // 组件模板对象
475
+ let templateObj = {};
476
+ for (let i = 0; i < templates.length; i++) {
477
+ let paramName = templates[i].fdParamName;
478
+ if (templateObj[paramName] == null) {
479
+ templateObj[paramName] = [];
480
+ }
481
+ let tmp = templates[i].template;
482
+ if (tmp != null && tmp != "") {
483
+ templateObj[paramName].push(templates[i].template);
484
+ }
485
+ }
486
+
487
+ this.cptTemplateObj = templateObj;
488
+ // console.log("cptTemplateObj: 组件模板");
489
+ // console.log(this.cptTemplateObj);
490
+ },
491
+ handleTemplateLeftSpace(template){
492
+ let res = [];
493
+ let lines = template.split("\n");
494
+ let reg = new RegExp(/\s+\${/g);
495
+ for (let i = 0; i < lines.length; i++) {
496
+ let line = lines[i];
497
+ let lineTemp = line.match(reg);
498
+ if (lineTemp != null && lineTemp.length > 0) {
499
+ line = line.trimLeft();
500
+ }
501
+ res.push(line);
502
+ }
503
+ return res.join("\n");
504
+ },
505
+ // 设定组件基础模板
506
+ initBaseTemplate() {
507
+ let baseInfo = this.baseInfo;
508
+ let cptTemplateObj = this.cptTemplateObj;
509
+ // 正则参数:例:${attrs}
510
+ let reg = new RegExp(/\${\w*}/g);
511
+ // 正则参数:例:${attrs#,}
512
+ let regCustom = new RegExp(/\${\w*#[^}]*}/g);
513
+ let template = this.baseInfo.fdTemplate;
514
+ if (template == null) {
515
+ template = "组件的基础模板不存在";
516
+ return;
517
+ }
518
+ template = this.handleTemplateLeftSpace(template);
519
+
520
+ // 参数赋值:数组默认拼接
521
+ let paramArr = template.match(reg);
522
+ if (paramArr != null) {
523
+ for (let j = 0; j < paramArr.length; j++) {
524
+ // 参数实际值
525
+ let attrName = paramArr[j].substring(2, paramArr[j].length - 1);
526
+ let valueObj = cptTemplateObj[attrName];
527
+ if (valueObj == null) {
528
+ // 不存在参数数组,替换为空
529
+ template = template.replaceAll(paramArr[j], "");
530
+ } else {
531
+ template = template.replaceAll(paramArr[j], valueObj.join(" "));
532
+ }
533
+ }
534
+ }
535
+
536
+ // 参数赋值:数组自定义拼接
537
+ let paramArr2 = template.match(regCustom);
538
+ if (paramArr2 != null) {
539
+ for (let j = 0; j < paramArr2.length; j++) {
540
+ // 参数实际值
541
+ let attrName = paramArr2[j].substring(2, paramArr2[j].length - 1).split("#");
542
+ let valueObj = cptTemplateObj[attrName[0]];
543
+ if (valueObj == null) {
544
+ // 不存在参数数组,替换为空
545
+ template = template.replaceAll(paramArr2[j], "");
546
+ } else {
547
+ template = template.replaceAll(paramArr2[j], valueObj.join(attrName[1]));
548
+ }
549
+ }
550
+ }
551
+ this.template = template;
552
+
553
+ // console.log("cptTemplateObj: 组件模板对象");
554
+ // console.log(this.cptTemplateObj);
125
555
  this.vueCode = this.template;
126
556
  },
127
- copyCode(event){
557
+ renderCode() {
558
+ this.vueCode = this.template;
559
+ },
560
+ copyCode(event) {
128
561
  clipboard(this.vueCode, event)
562
+ },
563
+ initDialogTableOpts() {
564
+ let paramList = this.paramList;
565
+ let columns = [];
566
+ for (let i = 0; i < paramList.length; i++) {
567
+ let param = paramList[i];
568
+ if (param.fdParentId == this.currentArrayParam.fdId) {
569
+ let col = {
570
+ prop: param.fdCode,
571
+ label: param.fdName,
572
+ };
573
+ // 显示:1input2开关3下拉单选4数组5单选6text7计数
574
+ switch (param.fdShowType) {
575
+ case 1:
576
+ case 6:
577
+ col.type = "input";
578
+ break;
579
+ case 7:
580
+ col.type = "inputNumber";
581
+ col.inputNumberMin = this.handelOptionObj(param).min;
582
+ col.inputNumberMax = this.handelOptionObj(param).max;
583
+ break;
584
+ case 2:
585
+ case 3:
586
+ case 5:
587
+ col.selectOptions = eval(param.fdOption)
588
+ col.type = "select";
589
+ break;
590
+ }
591
+
592
+ columns.push(col);
593
+ }
594
+ }
595
+ let tempData = eval(this.currentArrayParam.fdValue);
596
+ let localData = tempData;
597
+ let tableOpt = {
598
+ title: "数组列表",
599
+ columns: columns,
600
+ localData: localData,
601
+ toolbarBtn: ["add", "edit", "del"],
602
+ initData: true, // 默认false
603
+ pagination: {pageSizes: [100],pageSize: 100}
604
+ };
605
+
606
+ this.tableOpts = tableOpt;
607
+ },
608
+ openDialog(param) {
609
+ this.dialogTitle = param.fdName;
610
+ this.dialogVisible = true;
611
+ this.currentArrayParam = param;
612
+ this.initDialogTableOpts();
613
+ },
614
+ // 当前数组参数对象
615
+ initFullObj(arrParam) {
616
+ let fullObj = {};
617
+ for (let i = 0; i < arrParam.length; i++) {
618
+ fullObj[arrParam[i].fdCode] = null;
619
+ }
620
+ return fullObj;
621
+ },
622
+ // 返回当前数组参数的子参数值
623
+ getArrayParamValue(currentParam) {
624
+ // 获取当前数组参数的子参数
625
+ let id = currentParam.fdId;
626
+ let arrParam = [];
627
+ let paramList = this.paramList;
628
+ for (let i = 0; i < paramList.length; i++) {
629
+ if (paramList[i].fdParentId == id) {
630
+ arrParam.push(paramList[i]);
631
+ }
632
+ }
633
+ let arrValue = currentParam.arrValue;
634
+ if (arrParam == null || arrParam.length < 1) {
635
+ return "";
636
+ }
637
+ let allTemplate = [];
638
+ let templates = this.paramTemplateList;
639
+
640
+ for (let i = 0; i < arrValue.length; i++) {
641
+ // 设定数组参数信息
642
+ let fullObj = this.initFullObj(arrParam)
643
+ let item = arrValue[i];
644
+ for(let key in item ){
645
+ fullObj[key] = item[key];
646
+ }
647
+ // 修改数组参数对应的参数对象
648
+ for(let key in fullObj){
649
+ let temp = this.paramObj[key];
650
+ if (temp != null && temp != undefined) {
651
+ temp.value = fullObj[key]
652
+ }
653
+ }
654
+
655
+ let templateArr = [];
656
+ for (let j = 0; j < arrParam.length; j++) {
657
+ for (let k = 0; k < templates.length; k++) {
658
+ if (templates[k].fdParamId == arrParam[j].fdId) {
659
+ let tmp = this.handleTemplate(templates[k], 1);
660
+ if (tmp != null && tmp != "") {
661
+ templateArr.push(tmp);
662
+ }
663
+ }
664
+ }
665
+ }
666
+ allTemplate.push(templateArr);
667
+ }
668
+
669
+ if (allTemplate.length < 1) {
670
+ return "";
671
+ }
672
+
673
+ let templateStr = [];
674
+ for (let i = 0; i < allTemplate.length; i++) {
675
+ let item = allTemplate[i];
676
+ if (item.length == 1) {
677
+ if (item.indexOf(": ") > -1) {
678
+ // 对象参数
679
+ templateStr.push(`{ ${item[0]} } `);
680
+ } else {
681
+ // 非对象类型
682
+ templateStr.push(item[0]);
683
+ }
684
+ }
685
+
686
+ if (item.length > 1) {
687
+ // 对象参数
688
+ templateStr.push(`{ ${item.join(",")} } `);
689
+ }
690
+
691
+ }
692
+ return `[ ${templateStr.join(", ")} ]`;
693
+ },
694
+ // 保存数组参数
695
+ saveArrayParam() {
696
+ let datas = this.$refs.tableRef.getData();
697
+ for (let i = 0; i < datas.length; i++) {
698
+ delete datas[i].changeArr;
699
+ delete datas[i].dataIdx;
700
+ delete datas[i].isAdd;
701
+ delete datas[i].isEdit;
702
+ }
703
+ this.currentArrayParam.arrValue = datas
704
+ this.currentArrayParam.value = this.getArrayParamValue(this.currentArrayParam);
705
+ this.renderTemplate();
129
706
  }
130
707
  }
708
+
709
+
131
710
  }
132
711
  </script>
133
712
 
@@ -142,7 +721,7 @@ export default {
142
721
  }
143
722
 
144
723
  .dev-right-panel {
145
- width: 350px;
724
+ width: 450px;
146
725
  }
147
726
 
148
727
  .dev-right-panel /deep/ .el-form-item {
@@ -188,4 +767,10 @@ export default {
188
767
  white-space: pre;
189
768
  width: fit-content;
190
769
  }
770
+ .param-label {
771
+ width: 120px;
772
+ font-weight: bold;
773
+ line-height: 34px;
774
+ font-size: 14px;
775
+ }
191
776
  </style>