ap-dev 1.2.25 → 1.2.26

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 (91) hide show
  1. package/abap/ApiPanel/components/ApiContent.vue +1 -1
  2. package/abap/ApiPanel/components/ApiTable.vue +1 -1
  3. package/abap/ApiPanel/components/ApiTittle1.vue +1 -1
  4. package/abap/ApiPanel/components/ApiTittle2.vue +1 -1
  5. package/abap/ApiPanel/components/index.js +1 -1
  6. package/abap/CodePanel/abapKeywords.js +6 -6
  7. package/abap/CodePanel/componentMenus.js +28 -28
  8. package/abap/ConfigPanel/AbapCustomTable.vue +122 -122
  9. package/abap/ConfigPanel/AbapDocHistory.vue +145 -145
  10. package/abap/ConfigPanel/AbapSql.vue +81 -81
  11. package/abap/ConfigPanel/AbapTable.vue +379 -379
  12. package/abap/ConfigPanel/AbapTableCondition.vue +213 -213
  13. package/abap/ConfigPanel/AbapTableLink.vue +391 -391
  14. package/abap/SqlPanel/index.vue +1088 -1088
  15. package/abap/abap/abapStore.js +27 -27
  16. package/abap/abap/index.vue +87 -87
  17. package/abap/components/SapTable.vue +129 -129
  18. package/abap/components/SapTableField.vue +161 -161
  19. package/dev/ApiPanel/components/ApiCode.vue +1 -1
  20. package/dev/ApiPanel/components/ApiContent.vue +1 -1
  21. package/dev/ApiPanel/components/ApiTable.vue +1 -1
  22. package/dev/ApiPanel/components/ApiTittle1.vue +1 -1
  23. package/dev/ApiPanel/components/ApiTittle2.vue +1 -1
  24. package/dev/ApiPanel/components/index.js +1 -1
  25. package/dev/ApiPanel/modules/ApiBaseLayout.vue +1 -1
  26. package/dev/ComponentsPanel/items/ApDevItemBase.vue +1 -1
  27. package/dev/ComponentsPanel/items/ApDevItemButton.vue +1 -1
  28. package/dev/ComponentsPanel/items/ApDevItemChartBar.vue +1 -1
  29. package/dev/ComponentsPanel/items/ApDevItemChartGauge.vue +1 -1
  30. package/dev/ComponentsPanel/items/ApDevItemChartLine.vue +1 -1
  31. package/dev/ComponentsPanel/items/ApDevItemChartPie.vue +1 -1
  32. package/dev/ComponentsPanel/items/ApDevItemChartRadar.vue +1 -1
  33. package/dev/ComponentsPanel/items/ApDevItemCheckbox.vue +1 -1
  34. package/dev/ComponentsPanel/items/ApDevItemDateTime.vue +1 -1
  35. package/dev/ComponentsPanel/items/ApDevItemForm.vue +1 -1
  36. package/dev/ComponentsPanel/items/ApDevItemInput.vue +1 -1
  37. package/dev/ComponentsPanel/items/ApDevItemInputNumber.vue +1 -1
  38. package/dev/ComponentsPanel/items/ApDevItemLoading.vue +1 -1
  39. package/dev/ComponentsPanel/items/ApDevItemRadio.vue +1 -1
  40. package/dev/ComponentsPanel/items/ApDevItemSelect.vue +1 -1
  41. package/dev/ComponentsPanel/items/ApDevItemSwitch.vue +1 -1
  42. package/dev/ComponentsPanel/items/ApDevItemTooltip.vue +1 -1
  43. package/dev/ComponentsPanel/items/ApDevItemTree.vue +1 -1
  44. package/dev/ComponentsPanel/items/ApDevItemUpload.vue +1 -1
  45. package/dev/ComponentsPanel/items/test.vue +1 -1
  46. package/dev/ConfigPanel/DevCpt.vue +1036 -1036
  47. package/dev/ConfigPanel/DevCptBase.vue +210 -210
  48. package/dev/ConfigPanel/DevDbSource.vue +108 -108
  49. package/dev/ConfigPanel/DevDbUserSource.vue +117 -117
  50. package/dev/ConfigPanel/DevDocHistory.vue +145 -145
  51. package/dev/ConfigPanel/DevMyConfig.vue +205 -205
  52. package/dev/CustomPanel/CustomComponents.vue +10 -10
  53. package/dev/CustomPanel/CustomDataTree.vue +1 -1
  54. package/dev/CustomPanel/CustomTools.vue +1 -1
  55. package/dev/CustomPanel/index.vue +1 -1
  56. package/dev/CustomPanel/items/ApDevCheckbox.vue +7 -7
  57. package/dev/CustomPanel/items/ApDevCheckboxProp.vue +1 -1
  58. package/dev/CustomPanel/items/ApDevContainerRow.vue +155 -155
  59. package/dev/CustomPanel/items/ApDevContainerRowProp.vue +39 -39
  60. package/dev/CustomPanel/items/ApDevDateTime.vue +5 -5
  61. package/dev/CustomPanel/items/ApDevDateTimeProp.vue +1 -1
  62. package/dev/CustomPanel/items/ApDevDefaultProp.vue +20 -20
  63. package/dev/CustomPanel/items/ApDevInput.vue +49 -49
  64. package/dev/CustomPanel/items/ApDevInputNumber.vue +57 -57
  65. package/dev/CustomPanel/items/ApDevInputNumberProp.vue +96 -96
  66. package/dev/CustomPanel/items/ApDevInputProp.vue +85 -85
  67. package/dev/CustomPanel/items/ApDevRadio.vue +7 -7
  68. package/dev/CustomPanel/items/ApDevRadioProp.vue +1 -1
  69. package/dev/CustomPanel/items/ApDevSelect.vue +314 -314
  70. package/dev/CustomPanel/items/ApDevSelectProp.vue +83 -83
  71. package/dev/CustomPanel/items/ApDevTree.vue +5 -5
  72. package/dev/CustomPanel/items/ApDevTreeProp.vue +1 -1
  73. package/dev/CustomPanel/items/ApDevUpload.vue +6 -6
  74. package/dev/CustomPanel/items/ApDevUploadProp.vue +1 -1
  75. package/dev/CustomPanel/items/base/ApDevBase.vue +1 -1
  76. package/dev/CustomPanel/items/base/ApDevItemBase.vue +2 -2
  77. package/dev/CustomPanel/items/base/ApDevPropBase.vue +1 -1
  78. package/dev/CustomPanel/items/base/ApDevPropStyle.vue +93 -93
  79. package/dev/dev/DevUtil.js +31 -31
  80. package/dev/dev/devConfig.js +99 -99
  81. package/dev/dev/devStore.js +368 -368
  82. package/dev/dev/index.vue +85 -85
  83. package/ops/ApiPanel/components/ApiContent.vue +1 -1
  84. package/ops/ApiPanel/components/ApiTable.vue +1 -1
  85. package/ops/ApiPanel/components/ApiTittle1.vue +1 -1
  86. package/ops/ApiPanel/components/ApiTittle2.vue +1 -1
  87. package/ops/ApiPanel/components/index.js +1 -1
  88. package/ops/ConfigPanel/OpsDocHistory.vue +145 -145
  89. package/ops/ops/index.vue +60 -60
  90. package/ops/ops/opsStore.js +27 -27
  91. package/package.json +1 -1
@@ -1,1036 +1,1036 @@
1
- <template>
2
- <ap-container>
3
- <ap-aside margin="1111" width="230px">
4
- <ap-aside-tree ref="cptTree" :options.sync="treeOptions">
5
- <el-form slot="form" ref="tDevCpt" :inline="true" label-width="80px"
6
- :model="tDevCptForm" :rules="tDevCptRules" class="ap-form">
7
- <div class="ap-form-row">
8
- <el-form-item label="父节点" prop='fdParentId'>
9
- <el-select v-model="tDevCptForm.fdParentId" filterable placeholder="请选择父节点">
10
- <el-option label="无" value=""/>
11
- <el-option
12
- v-for="item in parentList"
13
- :key="item.fdId"
14
- :label="item.fdName"
15
- :value="item.fdId"
16
- />
17
- </el-select>
18
- </el-form-item>
19
- </div>
20
- <div class="ap-form-row">
21
- <el-form-item label='节点类型' prop='fdType'>
22
- <el-select v-model="tDevCptForm.fdType" filterable placeholder="请选择类型">
23
- <el-option key="1" label="Tab" :value=1></el-option>
24
- <el-option key="2" label="组件分组" :value=2></el-option>
25
- <el-option key="3" label="组件" :value=3></el-option>
26
- </el-select>
27
- </el-form-item>
28
- <el-form-item label='语言' prop='fdLanguage'>
29
- <el-select v-model="tDevCptForm.fdLanguage" filterable placeholder="请选择语言">
30
- <el-option key="vue" label="vue" value="vue"></el-option>
31
- <el-option key="java" label="java" value="java"></el-option>
32
- <el-option key="abap" label="abap" value="abap"></el-option>
33
- </el-select>
34
- </el-form-item>
35
- </div>
36
- <div class="ap-form-row">
37
- <el-form-item label='名称' prop='fdName'>
38
- <el-input v-model='tDevCptForm.fdName'></el-input>
39
- </el-form-item>
40
- <el-form-item label='备注' prop='fdRemark'>
41
- <el-input v-model='tDevCptForm.fdRemark'></el-input>
42
- </el-form-item>
43
- </div>
44
- <el-form-item label='编码' prop='fdCode' v-if="tDevCptForm.fdType == 3">
45
- <el-input v-model='tDevCptForm.fdCode'></el-input>
46
- </el-form-item>
47
- <el-form-item label='基础模板' prop='fdBaseId' v-if="tDevCptForm.fdType == 3">
48
- <el-select v-model="tDevCptForm.fdBaseId" filterable placeholder="请选择基础模板">
49
- <el-option label="无" value=""/>
50
- <el-option
51
- v-for="item in cptBaseList"
52
- :key="item.fdId"
53
- :label="item.fdName"
54
- :value="item.fdId"
55
- />
56
- </el-select>
57
- </el-form-item>
58
- <el-form-item label='图标' prop='fdIcon' v-if="tDevCptForm.fdType == 3">
59
- <el-input v-model='tDevCptForm.fdIcon'></el-input>
60
- </el-form-item>
61
- <el-form-item label='排序' prop='fdSort'>
62
- <el-input v-model='tDevCptForm.fdSort'></el-input>
63
- </el-form-item>
64
- </el-form>
65
- <span slot="tree" slot-scope="scope"
66
- :style="scope.data.fdType == 3 ? 'color: #1682e6;font-size: 14px;':''">
67
- <i :class="scope.data.fdIcon"/>
68
- {{ scope.data.fdName }}
69
- </span>
70
- </ap-aside-tree>
71
- </ap-aside>
72
- <ap-split-panel></ap-split-panel>
73
- <ap-container>
74
- <ap-header margin="1110" height="30%">
75
- <ap-table ref="tDevCptTemplateTableRef" :options.sync="tDevCptTemplateTable">
76
- <template #slotTemplate="searchProps">
77
- <el-input v-model="searchProps.rowData.fdTemplate" type="textarea" :rows=10></el-input>
78
- </template>
79
- <template #slotDefault="searchProps">
80
- <el-input v-model="searchProps.rowData.fdDefault" type="textarea" :rows=10></el-input>
81
- </template>
82
- </ap-table>
83
- </ap-header>
84
- <ap-container>
85
- <ap-header margin="0110" height="50%">
86
- <ap-table ref="tDevCptParamTableRef" :options.sync="tDevCptParamTable">
87
- <template #slotOption="searchProps">
88
- <el-input v-model="searchProps.rowData.fdOption" type="textarea" :rows=5></el-input>
89
- <span
90
- style="color: #909399;">注1: 数组格式 [{label:"名字1", value:"值1"},{label:"名字2", value:"值2"}]</span><br>
91
- <span style="color: #909399;">注2: 对象格式 {attr1:"属性1", attr2:"属性2"}</span><br>
92
- </template>
93
- </ap-table>
94
- </ap-header>
95
- <ap-main margin="0110">
96
- <ap-table ref="tDevCptParamTemplateTableRef" :options.sync="tDevCptParamTemplateTable">
97
- <template #slotTemplate="searchProps">
98
- <!-- <el-input v-model="searchProps.rowData.fdTemplate" type="textarea" :rows=10></el-input>-->
99
- <cpt-template v-model="searchProps.rowData.fdTemplate" :cptId="selectedCptId"></cpt-template>
100
- </template>
101
- <template #slotDefault="searchProps">
102
- <el-input v-model="searchProps.rowData.fdDefault" type="textarea" :rows=10></el-input>
103
- </template>
104
- </ap-table>
105
- </ap-main>
106
- </ap-container>
107
- </ap-container>
108
- <el-dialog
109
- title="提示"
110
- :visible.sync="showCopyDialog"
111
- width="30%">
112
- <span>复制参数、复制参数模板</span>
113
- <span slot="footer" class="dialog-footer">
114
- <el-button type="primary" @click="doCopyParam()">仅复制参数</el-button>
115
- <el-button type="primary" @click="doCopyParam('1')">复制参数和参数模板</el-button>
116
- </span>
117
- </el-dialog>
118
- <el-dialog
119
- title="参数脚本"
120
- :visible.sync="showJsCodeDialog"
121
- width="1500px">
122
- <div style="width: 100%;height: 450px" class="flex-justify-start">
123
- <div style="width: 400px;height: 100%">
124
- <ap-aside-tree ref="cptParamTreeRef" :options.sync="cptParamTreeOptions">
125
- <div slot="tree" slot-scope="scope" class="flex-justify-between" style="width: 100%">
126
- <div>
127
- <span @click="copyText(scope.data.fdName, $event)">{{ scope.data.fdName }} </span>
128
- <span class="ap-color-blue"
129
- @click="copyParamValue(scope.data.fdCode, $event)">{{ scope.data.fdCode }}</span>
130
- </div>
131
- <div style="margin-right: 10px">
132
- <div class="ap-tag" style="font-size: 12px;padding: 2px 5px;"
133
- @click="insertScript(scope.data)">
134
- <span v-if="scope.data.fdShowType == 2">开</span>
135
- <span v-else>不为空</span>
136
- </div>
137
- </div>
138
- </div>
139
- </ap-aside-tree>
140
- </div>
141
- <div class="flex-1" style="height: 100%;margin-left: 15px">
142
- <ap-table ref="tDevCptScriptRef" :options.sync="tDevCptScriptOpt"></ap-table>
143
- </div>
144
- </div>
145
- <span slot="footer" class="dialog-footer">
146
- <el-button @click="showJsCodeDialog = false">取 消</el-button>
147
- </span>
148
- </el-dialog>
149
- <el-dialog
150
- title="参数编码/参数名称 批量更新"
151
- :visible.sync="showHandleCptCodeDialog"
152
- width="700px">
153
- <el-form :model="replaceForm" label-width="100px" :inline="true" class="ap-form">
154
- <div class="ap-form-row">
155
- <el-form-item label='旧参数名称' prop='oldName'>
156
- <el-input v-model='replaceForm.oldName'></el-input>
157
- </el-form-item>
158
- <el-form-item label='新参数名称' prop='newName'>
159
- <el-input v-model='replaceForm.newName'></el-input>
160
- </el-form-item>
161
- </div>
162
- <div class="ap-form-row">
163
- <el-form-item label='旧参数编码' prop='oldCode'>
164
- <el-input v-model='replaceForm.oldCode'></el-input>
165
- </el-form-item>
166
- <el-form-item label='新参数编码' prop='newCode'>
167
- <el-input v-model='replaceForm.newCode'></el-input>
168
- </el-form-item>
169
- </div>
170
- </el-form>
171
- <span slot="footer" class="dialog-footer">
172
- <el-button @click="showHandleCptCodeDialog = false">取 消</el-button>
173
- <el-button type="primary" @click="replaceCptNameAndCode">确认替换</el-button>
174
- </span>
175
- </el-dialog>
176
- </ap-container>
177
- </template>
178
-
179
- <script>
180
- import clipboard from 'ap-util/util/ClipboardUtil'
181
- import CptTemplate from './CptTemplate'
182
-
183
- export default {
184
- name: 'DevCpt',
185
- components: {
186
- CptTemplate
187
- },
188
- data() {
189
-
190
- return {
191
- // ----- 左侧树 -----
192
- treeOptions: this.getTreeOption(),
193
- parentList: [],
194
- cptBaseList: [],
195
- tDevCptForm: {},
196
- tDevCptRules: {},
197
- selectedCptId: "",
198
- selectedCpt: {},
199
- // ----- 右侧 -----
200
- tDevCptTemplateTable: this.getCptTemplateTableOption(),
201
- tDevCptParamTable: this.getCptParamTableOption(),
202
- tDevCptParamTemplateTable: this.getCptParamTemplateTableOption(),
203
- selectedParam: "",
204
- template: "",
205
- optionType: "",
206
- showCopyDialog: false,
207
- showHandleCptCodeDialog: false,
208
- showJsCodeDialog: false,
209
- replaceForm: {
210
- oldName: "",
211
- newName: "",
212
- oldCode: "",
213
- newCode: "",
214
- },
215
- cptParamTreeOptions: this.getCptParamTreeOptions(),
216
- isErrorScript: "0",
217
- tDevCptScriptOpt: this.getDevCptScriptOpt(),
218
- insertScriptId: ""
219
- }
220
- },
221
- mounted() {
222
- this.getCptList();
223
- this.getCptBaseList();
224
- },
225
- methods: {
226
- // 左侧树:配置
227
- getTreeOption() {
228
- let treeOptions = {
229
- title: "组件",
230
- dialogWidth: "700px",
231
- toolbarBtn: [{
232
- icon: "el-icon-copy", onClick: () => {
233
- this.copyCpt();
234
- }
235
- }, {
236
- icon: "el-icon-bug", onClick: () => {
237
- this.clearCpt();
238
- }
239
- }, "add", "edit", "del", "sort"],
240
- dialogTitle: "组件信息",
241
- sortByDrag: true,
242
- onClick: (data, node, comp) => {
243
- this.selectedCptId = data.fdId;
244
- this.selectedCpt = data;
245
- this.selectedParam = "";
246
- this.$refs.tDevCptParamTableRef.refresh();
247
- this.$refs.tDevCptTemplateTableRef.refresh();
248
- this.$refs.tDevCptParamTemplateTableRef.refresh();
249
- },
250
- loadOptions: {
251
- url: "/apd/TDevCpt/getCptList",
252
- treeKey: {
253
- idKey: "fdId",
254
- parentKey: "fdParentId",
255
- childrenKey: "children",
256
- label: "fdName"
257
- },
258
- success: (response) => {
259
- },
260
- },
261
- editOptions: {
262
- url: "/apd/TDevCpt/getTDevCptByFdId",
263
- data: (node) => {
264
- return {
265
- fdId: node.fdId
266
- }
267
- },
268
- success: (response) => {
269
- this.tDevCptForm = response.data;
270
- },
271
- error() {
272
- },
273
- },
274
- insertUrl: "/apd/TDevCpt/insertTDevCpt",
275
- insertData: () => {
276
- return this.tDevCptForm
277
- },
278
- updateUrl: "/apd/TDevCpt/updateTDevCpt",
279
- updateData: () => {
280
- return this.tDevCptForm
281
- },
282
- deleteUrl: "/apd/TDevCpt/deleteTDevCptByFdId",
283
- deleteData: (node) => {
284
- return {
285
- fdId: node.fdId
286
- }
287
- },
288
- updateSortUrl: '/apd/TDevCpt/updateTDevCptSort',
289
- updateSortListUrl: '/apd/TDevCpt/updateTDevCptSortList',
290
- sortByDrag: true,
291
- resetForm: () => {
292
- this.tDevCptForm = {
293
- fdName: '',
294
- fdType: '',
295
- fdCode: '',
296
- fdParentId: '',
297
- fdBaseId: '',
298
- fdLanguage: '',
299
- fdIcon: '',
300
- fdRemark: '',
301
- fdSort: '',
302
- };
303
- },
304
- afterOpenAddDialog: (node) => {
305
- },
306
- };
307
-
308
- return treeOptions;
309
- },
310
- getCptList() {
311
- this.$request({
312
- url: '/apd/TDevCpt/getCptList',
313
- method: 'post',
314
- data: {}
315
- }).then(response => {
316
- this.parentList = response.data
317
- })
318
- },
319
- getCptBaseList() {
320
- this.$request({
321
- url: '/apd/TDevCptBase/getTDevCptBaseList',
322
- method: 'post',
323
- data: {}
324
- }).then(response => {
325
- this.cptBaseList = response.data
326
- })
327
- },
328
- // 右侧:组件模板表格
329
- getCptTemplateTableOption() {
330
- let tDevCptTemplateCols = [
331
- {
332
- prop: 'fdCptId',
333
- label: '所属组件',
334
- type: "select",
335
- selectOptionsRemote: "cptList",
336
- selectOptionsKey: {label: "fdName", value: "fdId"},
337
- width: '80',
338
- addDefaultValue: () => {
339
- return this.selectedCptId;
340
- }
341
- }, {
342
- prop: 'fdParamName',
343
- label: '参数名',
344
- type: 'input',
345
- width: '90',
346
- }, {
347
- prop: 'fdTemplate',
348
- label: '组件模板',
349
- minWidth: '130',
350
- type: "search",
351
- searchTitle: "模板编辑",
352
- searchSlot: 'slotTemplate',
353
- searchConfirm: (row) => {
354
- return true
355
- },
356
- searchClear: (row) => {
357
- row.fdTemplate = '';
358
- return true;
359
- },
360
- html: (value, row) => {
361
- return this.handleTemplateHtml(value);
362
- },
363
- help: "1、参数格式:\${xxxx}<br> xxx只能是字母,默认空格连接<br>" +
364
- "2、数组参数格式:\${xxxx#abc}<br>使用#连接,abc为自定义连接符。使用\\n表示换行<br>" +
365
- "3、if判断:<br><#if>xxxx&lt/#if>"
366
- }, {
367
- prop: 'fdAddScriptId',
368
- label: '模板添加脚本',
369
- width: '150',
370
- type: "select",
371
- selectClearable: true,
372
- selectOptionsRemote: "scriptList",
373
- selectOptionsKey: {label: "fdName", value: "fdId"},
374
- selectHtml: (value, text, row) => {
375
- return `<span class="ap-color-blue" title='${row.addScript}'>${text}</span>`
376
- },
377
- }, {
378
- prop: 'fdDefault',
379
- label: '默认模板',
380
- minWidth: '70',
381
- type: "search",
382
- searchTitle: "模板编辑",
383
- searchSlot: 'slotDefault',
384
- searchConfirm: (row) => {
385
- return true
386
- },
387
- searchClear: (row) => {
388
- row.fdDefault = '';
389
- return true;
390
- },
391
- }, {
392
- prop: 'fdDefaultScriptId',
393
- label: '默认模板使用脚本',
394
- width: '150',
395
- type: "select",
396
- selectClearable: true,
397
- selectOptionsRemote: "scriptList",
398
- selectOptionsKey: {label: "fdName", value: "fdId"},
399
- selectHtml: (value, text, row) => {
400
- return `<span class="ap-color-blue" title='${row.defaultScript}'>${text}</span>`
401
- }
402
- }, {
403
- prop: 'fdLeftSpace',
404
- label: '左侧空格',
405
- type: 'input',
406
- width: '60',
407
- }, {
408
- prop: 'fdSort',
409
- label: '排序',
410
- type: 'input',
411
- width: '60',
412
- },
413
- ];
414
- let tDevCptTemplateTable = {
415
- title: "组件模板",
416
- columns: tDevCptTemplateCols,
417
- dataUrl: "/apd/TDevCptTemplate/getTDevCptTemplateGridList",
418
- saveUrl: "/apd/TDevCptTemplate/saveTDevCptTemplateGridData",
419
- editPk: "fdId", //默认fdId
420
- deletePk: "fdId", // 默认fdId
421
- deleteUrl: "/apd/TDevCptTemplate/deleteTDevCptTemplateGridData",
422
- toolbarBtn: [{
423
- btnType: "primary", text: "脚本", icon: "el-icon-collection-tag", onClick: () => {
424
- if (this.selectedCptId == null || this.selectedCptId == "") {
425
- this.$message.error("请选择组件");
426
- return;
427
- }
428
- if (this.$refs.tDevCptParamTableRef.getAddRowList().length > 0 ||
429
- this.$refs.tDevCptParamTableRef.getEditRowList().length > 0 ||
430
- this.$refs.tDevCptTemplateTableRef.getAddRowList().length > 0 ||
431
- this.$refs.tDevCptTemplateTableRef.getEditRowList().length > 0 ||
432
- this.$refs.tDevCptParamTemplateTableRef.getAddRowList().length > 0 ||
433
- this.$refs.tDevCptParamTemplateTableRef.getEditRowList().length > 0) {
434
- this.$message.error("请先保存数据");
435
- return;
436
- }
437
-
438
- this.showJsCodeDialog = true;
439
- this.$nextTick(() => {
440
- this.$refs.tDevCptScriptRef.refresh();
441
- this.$refs.cptParamTreeRef.reLoadTreeData();
442
- })
443
- }
444
- }, "separator", {
445
- btnType: "primary", text: "编码替换", icon: "el-icon-transfer", onClick: () => {
446
- this.showHandleCptCodeDialog = true;
447
- }
448
- }, "separator", "add", "edit", "del", "refresh", "save"],
449
- showPagination: false,
450
- params: () => {
451
- return {
452
- cptId: this.selectedCptId
453
- }
454
- },
455
- rowDblClickEvent: (row, column, event) => {
456
- this.$refs.tDevCptTemplateTableRef.toggleEditRow(row);
457
- },
458
- };
459
- return tDevCptTemplateTable;
460
- },
461
- // 右侧:组件参数表格
462
- getCptParamTableOption() {
463
- let tDevCptParamCols = [
464
- {
465
- prop: 'fdCptId',
466
- label: '所属组件',
467
- type: "select",
468
- selectOptionsRemote: "cptList",
469
- selectOptionsKey: {label: "fdName", value: "fdId"},
470
- width: '80',
471
- addDefaultValue: () => {
472
- return this.selectedCptId;
473
- }
474
- }, {
475
- prop: 'fdParentId',
476
- label: '父参数',
477
- type: "select",
478
- selectOptionsRemote: "cptParamList",
479
- selectOptionsKey: {label: "fdName", value: "fdId"},
480
- width: '80',
481
- }, {
482
- prop: 'fdName',
483
- label: '参数名称',
484
- type: 'input',
485
- width: '110',
486
- }, {
487
- prop: 'fdCode',
488
- label: '参数编码',
489
- type: 'input',
490
- minWidth: '120',
491
- help: `参数编码。<br>.value: 表示参数值<br>示例:"\${InputType.value}"<br>click点击可复制参数取值(如:"\${InputType.value}")`
492
- }, {
493
- prop: 'fdValue',
494
- label: '默认值',
495
- type: 'input',
496
- width: '80',
497
- showOverflowTooltip: true,
498
- help: `默认值格式:<br>1、非数组参数:字符串<br>2、数组参数: 可执行js,格式:[{参数编码A:"参数值1"},{参数编码B:"参数值2"}]<br>示例:[{InputA:"add"},{InputB:"自定义",InputC:"按钮"}]`
499
- }, {
500
- prop: 'fdShowScriptId',
501
- label: '显示条件脚本',
502
- width: '130',
503
- type: "select",
504
- selectClearable: true,
505
- selectOptionsRemote: "scriptList",
506
- selectOptionsKey: {label: "fdName", value: "fdId"},
507
- selectHtml: (value, text, row) => {
508
- return `<span class="ap-color-blue" title='${row.showScript}'>${text}</span>`
509
- },
510
- help: `判断页面是否显示组件。为空,默认显示。<br>示例:"\${InputType.value}" == "textarea"`
511
- }, {
512
- prop: 'fdShowType',
513
- label: '显示类型',
514
- type: 'select',
515
- width: '80',
516
- selectOptions: [{label: "input", value: 1}, {label: "开关", value: 2}, {label: "下拉单选", value: 3},
517
- {label: "数组参数", value: 4}, {label: "单选框", value: 5}, {label: "text", value: 6},
518
- {label: "计数文本", value: 7}, {label: "分割线", value: 8}, {label: "文本信息", value: 9}],
519
- }, {
520
- prop: 'fdOption',
521
- label: '值选项',
522
- width: '100',
523
- showOverflowTooltip: true,
524
- type: "search",
525
- searchTitle: "选项值",
526
- searchSlot: 'slotOption',
527
- searchConfirm: (row) => {
528
- return true
529
- },
530
- searchClear: (row) => {
531
- row.fdOption = '';
532
- return true;
533
- },
534
- }, {
535
- prop: 'fdMethodScriptId',
536
- label: '参数值变化脚本',
537
- width: '120',
538
- type: "select",
539
- selectClearable: true,
540
- selectOptionsRemote: "scriptList",
541
- selectOptionsKey: {label: "fdName", value: "fdId"},
542
- selectHtml: (value, text, row) => {
543
- return `<span class="ap-color-blue" title='${row.methodScript}'>${text}</span>`
544
- },
545
- help: `参数值修改时,调用方法,用于直接设定其他参数值。<br>示例:"\${InputType.value}" = "123"`
546
- }, {
547
- prop: 'fdPlaceholder',
548
- label: '占位文本',
549
- type: 'input',
550
- width: '120',
551
- showOverflowTooltip: true
552
- }, {
553
- prop: 'fdTab',
554
- label: 'tab页',
555
- type: 'input',
556
- width: '60',
557
- }, {
558
- prop: 'fdTip',
559
- label: '提示',
560
- type: 'input',
561
- minWidth: '120',
562
- showOverflowTooltip: true
563
- }, {
564
- prop: 'fdRemark',
565
- label: '备注',
566
- type: 'input',
567
- width: '80',
568
- showOverflowTooltip: true,
569
- }, {
570
- prop: 'fdSort',
571
- label: '排序',
572
- type: 'input',
573
- width: '50',
574
- },
575
- ];
576
- let tDevCptParamTable = {
577
- title: "参数",
578
- columns: tDevCptParamCols,
579
- dataUrl: "/apd/TDevCptParam/getTDevCptParamGridList",
580
- saveUrl: "/apd/TDevCptParam/saveTDevCptParamGridData",
581
- editPk: "fdId", //默认fdId
582
- deletePk: "fdId", // 默认fdId
583
- deleteUrl: "/apd/TDevCptParam/deleteTDevCptParamGridData",
584
- sortUrl: "/apd/TDevCptParam/updateTDevCptParamSortList",
585
- toolbarBtn: [{
586
- btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
587
- this.copyParam()
588
- }
589
- }, "separator",
590
- "sortAuto", "sortDown", "sortUp", "separator",
591
- "add", "edit", "del", "refresh", "save"],
592
- showPagination: false,
593
- params: () => {
594
- return {
595
- cptId: this.selectedCptId
596
- }
597
- },
598
- rowClickEvent: (row, column, event) => {
599
- this.selectedParam = row.fdId;
600
- this.$refs.tDevCptParamTemplateTableRef.refresh();
601
- },
602
- rowDblClickEvent: (row, column, event) => {
603
- this.$refs.tDevCptParamTableRef.toggleEditRow(row);
604
- },
605
- };
606
- return tDevCptParamTable;
607
- },
608
- // 右侧:参数模板表格
609
- getCptParamTemplateTableOption() {
610
- let tDevCptParamTemplateCols = [
611
- {
612
- prop: 'fdParamId',
613
- label: '所属参数',
614
- type: "select",
615
- selectOptionsRemote: "paramList",
616
- selectOptionsKey: {label: "fdName", value: "fdId"},
617
- width: '110',
618
- addDefaultValue: () => {
619
- return this.selectedParam;
620
- }
621
- }, {
622
- prop: 'fdParamName',
623
- label: '参数名',
624
- type: 'input',
625
- width: '80',
626
- }, {
627
- prop: 'fdTemplate',
628
- label: '参数模板',
629
- minWidth: '130',
630
- showOverflowTooltip: true,
631
- type: "search",
632
- searchTitle: "模板编辑",
633
- searchSlot: 'slotTemplate',
634
- searchWidth:"1100px",
635
- searchConfirm: (row) => {
636
- return true
637
- },
638
- searchClear: (row) => {
639
- row.fdTemplate = '';
640
- return true;
641
- },
642
- html: (value, row) => {
643
- return this.handleTemplateHtml(value);
644
- },
645
- help: `格式:参数格式必须为\${xxxx.xxx} 不能有空格`
646
- }, {
647
- prop: 'fdAddScriptId',
648
- label: '模板添加脚本',
649
- width: '150',
650
- help: `判断是否添加模板。为空,表示默认添加。`,
651
- type: "select",
652
- selectClearable: true,
653
- selectOptionsRemote: "scriptList",
654
- selectOptionsKey: {label: "fdName", value: "fdId"},
655
- selectHtml: (value, text, row) => {
656
- return `<span class="ap-color-blue" title='${row.addScript}'>${text}</span>`
657
- }
658
- }, {
659
- prop: 'fdDefault',
660
- label: '默认模板',
661
- minWidth: '70',
662
- showOverflowTooltip: true,
663
- type: "search",
664
- searchTitle: "模板编辑",
665
- searchSlot: 'slotDefault',
666
- searchConfirm: (row) => {
667
- return true
668
- },
669
- searchClear: (row) => {
670
- row.fdDefault = '';
671
- return true;
672
- },
673
- }, {
674
- prop: 'fdDefaultScriptId',
675
- label: '默认模板使用脚本',
676
- width: '140',
677
- help: `判断是否使用默认模板。为空,不使用默认模板。<br>示例:"\${InputSize.value}" != ""`,
678
- type: "select",
679
- selectClearable: true,
680
- selectOptionsRemote: "scriptList",
681
- selectOptionsKey: {label: "fdName", value: "fdId"},
682
- selectHtml: (value, text, row) => {
683
- return `<span class="ap-color-blue" title='${row.defaultScript}'>${text}</span>`
684
- }
685
- }, {
686
- prop: 'fdLeftSpace',
687
- label: '左侧空格',
688
- type: 'input',
689
- width: '60',
690
- }
691
- ];
692
- let tDevCptParamTemplateTable = {
693
- title: "参数模板",
694
- columns: tDevCptParamTemplateCols,
695
- dataUrl: "/apd/TDevCptParamTemplate/getTDevCptParamTemplateGridList",
696
- saveUrl: "/apd/TDevCptParamTemplate/saveTDevCptParamTemplateGridData",
697
- editPk: "fdId", //默认fdId
698
- deletePk: "fdId", // 默认fdId
699
- deleteUrl: "/apd/TDevCptParamTemplate/deleteTDevCptParamTemplateGridData",
700
- sortUrl: "/apd/TDevCptParamTemplate/updateTDevCptParamTemplateSortList",
701
- toolbarBtn: [{
702
- btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
703
- this.doCopyParamTemplate()
704
- }
705
- }, "separator", "add", "edit", "del", "refresh", "save"],
706
- showPagination: false,
707
- params: () => {
708
- return {
709
- cptId: this.selectedCptId,
710
- paramId: this.selectedParam
711
- }
712
- },
713
- rowDblClickEvent: (row, column, event) => {
714
- this.$refs.tDevCptParamTemplateTableRef.toggleEditRow(row);
715
- },
716
- };
717
- return tDevCptParamTemplateTable;
718
- },
719
- replaceCptNameAndCode() {
720
- let form = this.replaceForm;
721
- form.cptId = this.selectedCptId
722
- this.$request({
723
- url: '/apd/TDevCpt/replaceCptNameAndCode',
724
- method: 'post',
725
- data: form
726
- }).then(response => {
727
- this.$message.success("替换成功");
728
- this.$refs.tDevCptParamTableRef.refresh();
729
- this.$refs.tDevCptTemplateTableRef.refresh();
730
- this.$refs.tDevCptParamTemplateTableRef.refresh();
731
- this.showHandleCptCodeDialog = false;
732
- })
733
- },
734
- handleTemplateHtml(str) {
735
- if (str == null) {
736
- return "";
737
- }
738
- str = str.replaceAll("<", "&lt;")
739
- let html = `<div class="api-code" style="line-height: 14px;width: 100%; max-height: 80px;overflow: auto;">${str}</div>`;
740
- return html;
741
- },
742
- clearCpt() {
743
- this.$confirm(`清空无效组件配置(已删除组件的模板、脚本、参数、demo)?`, '提示', {
744
- confirmButtonText: '清空',
745
- cancelButtonText: '取消',
746
- type: 'warning'
747
- }).then(() => {
748
- this.$request({
749
- url: '/apd/TDevCpt/clearCpt',
750
- method: 'post',
751
- data: {}
752
- }).then(response => {
753
- this.$message.success("清空成功");
754
- this.$refs.cptTree.reLoadTreeData();
755
- })
756
- })
757
- },
758
- copyCpt() {
759
- if (this.selectedCptId == "" || this.selectedCptId == null) {
760
- this.$message.error("请选择需要复制的行");
761
- return;
762
- }
763
- this.$confirm(`确认复制【${this.selectedCpt.fdName}】组件?`, '提示', {
764
- confirmButtonText: '复制',
765
- cancelButtonText: '取消',
766
- type: 'warning'
767
- }).then(() => {
768
- this.$request({
769
- url: '/apd/TDevCpt/copyCpt',
770
- method: 'post',
771
- data: {
772
- cptId: this.selectedCptId,
773
- }
774
- }).then(response => {
775
- this.$message.success("复制成功");
776
- this.$refs.cptTree.reLoadTreeData();
777
- })
778
- })
779
- },
780
- copyParam(type) {
781
- this.showCopyDialog = true;
782
- },
783
- // 复制参数
784
- doCopyParam(type) {
785
- let selectedRows = this.$refs.tDevCptParamTableRef.getSelection();
786
- if (selectedRows.length < 1) {
787
- this.$message.error("请选择需要复制的行!");
788
- return;
789
- }
790
- if (selectedRows.length > 1) {
791
- this.$message.error("只能选择单行数据进行复制!");
792
- return;
793
- }
794
-
795
- this.$request({
796
- url: '/apd/TDevCptParam/copyParam',
797
- method: 'post',
798
- data: {
799
- paramId: selectedRows[0].fdId,
800
- copyTemplate: type
801
- }
802
- }).then(response => {
803
- this.$message.success("复制成功");
804
- this.$refs.tDevCptParamTableRef.refresh();
805
- if (type == "1") {
806
- this.$refs.tDevCptParamTemplateTableRef.refresh();
807
- }
808
- this.showCopyDialog = false;
809
- })
810
-
811
- },
812
- // 复制参数模板
813
- doCopyParamTemplate() {
814
- let selectedRows = this.$refs.tDevCptParamTemplateTableRef.getSelection();
815
- if (selectedRows.length < 1) {
816
- this.$message.error("请选择需要复制的行!");
817
- return;
818
- }
819
- if (selectedRows.length > 1) {
820
- this.$message.error("只能选择单行数据进行复制!");
821
- return;
822
- }
823
-
824
- this.$request({
825
- url: '/apd/TDevCptParam/copyParamTemplate',
826
- method: 'post',
827
- data: {
828
- templateId: selectedRows[0].fdId,
829
- }
830
- }).then(response => {
831
- this.$message.success("复制成功");
832
- this.$refs.tDevCptParamTemplateTableRef.refresh();
833
- })
834
-
835
- },
836
- // 组件参数
837
- getCptParamTreeOptions() {
838
- let treeOptions = {
839
- title: "组件参数",
840
- initData: false,
841
- onClick: (data, node, comp) => {
842
- },
843
- loadOptions: {
844
- url: "/apd/TDevCptParam/getTDevCptParamList",
845
- data: () => {
846
- return {
847
- cptId: this.selectedCptId
848
- }
849
- },
850
- treeKey: {
851
- idKey: "fdId",
852
- parentKey: "fdParentId",
853
- childrenKey: "children",
854
- label: "fdName"
855
- },
856
- success: (response) => {
857
- },
858
- },
859
- };
860
-
861
- return treeOptions;
862
- },
863
- // 组件脚本
864
- getDevCptScriptOpt() {
865
- let columns = [
866
- {
867
- prop: 'fdName',
868
- label: '名称',
869
- type: 'input',
870
- width: 180,
871
- help: '参数- <br>显示- <br>显示事件- <br>显示方法-'
872
- }, {
873
- prop: 'fdCode',
874
- label: '变量名',
875
- type: 'input',
876
- width: 100,
877
- help: '模板中执行判断的变量名。<br>如<#if testName>'
878
- }, {
879
- prop: 'fdScript',
880
- label: '脚本',
881
- type: 'input',
882
- help: 'js执行脚本。' +
883
- '<br><b>一、用于判断是否显示</b>' +
884
- '<br><b>可用参数:</b>paramObj, paramTemplateObj' +
885
- '<br><b>示例1:</b>"\${InputSize.value}" != ""<br><b>示例2:</b>paramTemplateObj.attrs.length>0'+
886
- '<br><b>二、用于修改值(固定格式):</b>'+
887
- '<br><b>可用参数:</b>paramObj,paramList' +
888
- '<br><b>格式:</b>changeValue(paramList, \'参数编码\' , \'新值\')' +
889
- '<br><b>示例1:</b>changeValue(paramList, \'typeValue\' , \'a\')'
890
- }, {
891
- prop: 'fdComment',
892
- label: '备注',
893
- type: 'input',
894
- width: 100,
895
- }
896
- ];
897
- let tableOpt = {
898
- title: "组件脚本",
899
- columns: columns,
900
- editPk: "fdId", //默认fdId
901
- deletePk: "fdId", // 默认fdId
902
- dataUrl: "/apd/TDevCptScript/getTDevCptScriptGridList",
903
- saveUrl: "/apd/TDevCptScript/saveTDevCptScriptGridData",
904
- deleteUrl: "/apd/TDevCptScript/deleteTDevCptScriptGridData",
905
- toolbarBtn: [{
906
- btnType: "primary", text: "异常筛选", icon: "el-icon-copy", onClick: () => {
907
- this.isErrorScript = "1";
908
- this.$refs.tDevCptScriptRef.refresh();
909
- }
910
- }, {
911
- btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
912
- this.copyScript()
913
- }
914
- }, "separator", "add", "edit", "del", "cancel", "refresh", "save"],
915
- initData: false, // 默认false
916
- showPagination: false,
917
- afterLoadData: () => {
918
- this.isErrorScript = "0";
919
- },
920
- addDefaultObj: () => {
921
- return {
922
- fdCptId: this.selectedCptId
923
- }
924
- },
925
- params: () => {
926
- return {
927
- cptId: this.selectedCptId,
928
- isErrorScript: this.isErrorScript
929
- }
930
- },
931
- rowDblClickEvent: (row, column, event) => {
932
- this.$refs.tDevCptScriptRef.toggleEditRow(row);
933
- },
934
- afterSave: this.refreshScriptTable,
935
- afterAll: () => {
936
- if (this.insertScriptId == null || this.insertScriptId == "") {
937
- return;
938
- }
939
- this.$refs.tDevCptScriptRef.toggleRowSelectionByRowKey(this.insertScriptId, true);
940
- this.insertScriptId = "";
941
- }
942
- };
943
- return tableOpt;
944
- },
945
- // 刷新脚本相关表格
946
- refreshScriptTable() {
947
- console.log("刷新外部表格");
948
- this.$refs.tDevCptParamTableRef.refresh();
949
- this.$refs.tDevCptTemplateTableRef.refresh();
950
- this.$refs.tDevCptParamTemplateTableRef.refresh();
951
- },
952
- copyText(text, event) {
953
- clipboard(text, event);
954
- },
955
- copyParamValue(code, event) {
956
- let str = '"${' + code + '.value}"';
957
- clipboard(str, event);
958
- },
959
- insertScript(data) {
960
- let name = "";
961
- if (data.fdName.indexOf("事件") > -1) {
962
- name = "显示事件-" + data.fdName.replace("事件", "");
963
- } else if (data.fdCode.indexOf("Method") > -1) {
964
- name = "显示方法-" + data.fdName;
965
- } else {
966
- name = "显示-" + data.fdName;
967
- }
968
-
969
- let script = "";
970
- if (data.fdShowType == 2) {
971
- // 开
972
- script = '"${' + data.fdCode + '.value}" == "1"';
973
- } else {
974
- // 不为空
975
- script = '"${' + data.fdCode + '.value}" != ""';
976
- }
977
- let msg = `确定添加脚本?
978
- <br><span style="font-weight: bold">名称:</span><span class="ap-color-blue">${name}</span>
979
- <br><span style="font-weight: bold">脚本:</span><span class="ap-color-blue">${script}</span>`
980
- this.$confirm(msg, '提示', {
981
- confirmButtonText: '确定添加',
982
- cancelButtonText: '取消',
983
- dangerouslyUseHTMLString: true,
984
- type: 'warning'
985
- }).then(() => {
986
- this.$request({
987
- url: '/apd/TDevCptScript/insertTDevCptScript',
988
- method: 'post',
989
- data: {
990
- fdCptId: this.selectedCptId,
991
- fdName: name,
992
- fdScript: script,
993
- }
994
- }).then(response => {
995
- this.insertScriptId = response.data;
996
- this.$message.success("添加成功:" + name);
997
- this.$refs.tDevCptScriptRef.refresh();
998
- this.refreshScriptTable();
999
- })
1000
- }).catch(() => {
1001
- this.$message({
1002
- type: 'info',
1003
- message: '已取消添加'
1004
- });
1005
- });
1006
- },
1007
- // 复制参数模板
1008
- copyScript() {
1009
- let selectedRows = this.$refs.tDevCptScriptRef.getSelection();
1010
- if (selectedRows.length < 1) {
1011
- this.$message.error("请选择需要复制的行!");
1012
- return;
1013
- }
1014
- if (selectedRows.length > 1) {
1015
- this.$message.error("只能选择单行数据进行复制!");
1016
- return;
1017
- }
1018
-
1019
- this.$request({
1020
- url: '/apd/TDevCptScript/copyScript',
1021
- method: 'post',
1022
- data: {
1023
- scriptId: selectedRows[0].fdId,
1024
- }
1025
- }).then(response => {
1026
- this.$message.success("复制成功");
1027
- this.$refs.tDevCptScriptRef.refresh();
1028
- })
1029
-
1030
- },
1031
- }
1032
- }
1033
- </script>
1034
-
1035
- <style scoped>
1036
- </style>
1
+ <template>
2
+ <ap-container>
3
+ <ap-aside margin="1111" width="230px">
4
+ <ap-aside-tree ref="cptTree" :options.sync="treeOptions">
5
+ <el-form slot="form" ref="tDevCpt" :inline="true" label-width="80px"
6
+ :model="tDevCptForm" :rules="tDevCptRules" class="ap-form">
7
+ <div class="ap-form-row">
8
+ <el-form-item label="父节点" prop='fdParentId'>
9
+ <el-select v-model="tDevCptForm.fdParentId" filterable placeholder="请选择父节点">
10
+ <el-option label="无" value=""/>
11
+ <el-option
12
+ v-for="item in parentList"
13
+ :key="item.fdId"
14
+ :label="item.fdName"
15
+ :value="item.fdId"
16
+ />
17
+ </el-select>
18
+ </el-form-item>
19
+ </div>
20
+ <div class="ap-form-row">
21
+ <el-form-item label='节点类型' prop='fdType'>
22
+ <el-select v-model="tDevCptForm.fdType" filterable placeholder="请选择类型">
23
+ <el-option key="1" label="Tab" :value=1></el-option>
24
+ <el-option key="2" label="组件分组" :value=2></el-option>
25
+ <el-option key="3" label="组件" :value=3></el-option>
26
+ </el-select>
27
+ </el-form-item>
28
+ <el-form-item label='语言' prop='fdLanguage'>
29
+ <el-select v-model="tDevCptForm.fdLanguage" filterable placeholder="请选择语言">
30
+ <el-option key="vue" label="vue" value="vue"></el-option>
31
+ <el-option key="java" label="java" value="java"></el-option>
32
+ <el-option key="abap" label="abap" value="abap"></el-option>
33
+ </el-select>
34
+ </el-form-item>
35
+ </div>
36
+ <div class="ap-form-row">
37
+ <el-form-item label='名称' prop='fdName'>
38
+ <el-input v-model='tDevCptForm.fdName'></el-input>
39
+ </el-form-item>
40
+ <el-form-item label='备注' prop='fdRemark'>
41
+ <el-input v-model='tDevCptForm.fdRemark'></el-input>
42
+ </el-form-item>
43
+ </div>
44
+ <el-form-item label='编码' prop='fdCode' v-if="tDevCptForm.fdType == 3">
45
+ <el-input v-model='tDevCptForm.fdCode'></el-input>
46
+ </el-form-item>
47
+ <el-form-item label='基础模板' prop='fdBaseId' v-if="tDevCptForm.fdType == 3">
48
+ <el-select v-model="tDevCptForm.fdBaseId" filterable placeholder="请选择基础模板">
49
+ <el-option label="无" value=""/>
50
+ <el-option
51
+ v-for="item in cptBaseList"
52
+ :key="item.fdId"
53
+ :label="item.fdName"
54
+ :value="item.fdId"
55
+ />
56
+ </el-select>
57
+ </el-form-item>
58
+ <el-form-item label='图标' prop='fdIcon' v-if="tDevCptForm.fdType == 3">
59
+ <el-input v-model='tDevCptForm.fdIcon'></el-input>
60
+ </el-form-item>
61
+ <el-form-item label='排序' prop='fdSort'>
62
+ <el-input v-model='tDevCptForm.fdSort'></el-input>
63
+ </el-form-item>
64
+ </el-form>
65
+ <span slot="tree" slot-scope="scope"
66
+ :style="scope.data.fdType == 3 ? 'color: #1682e6;font-size: 14px;':''">
67
+ <i :class="scope.data.fdIcon"/>
68
+ {{ scope.data.fdName }}
69
+ </span>
70
+ </ap-aside-tree>
71
+ </ap-aside>
72
+ <ap-split-panel></ap-split-panel>
73
+ <ap-container>
74
+ <ap-header margin="1110" height="30%">
75
+ <ap-table ref="tDevCptTemplateTableRef" :options.sync="tDevCptTemplateTable">
76
+ <template #slotTemplate="searchProps">
77
+ <el-input v-model="searchProps.rowData.fdTemplate" type="textarea" :rows=10></el-input>
78
+ </template>
79
+ <template #slotDefault="searchProps">
80
+ <el-input v-model="searchProps.rowData.fdDefault" type="textarea" :rows=10></el-input>
81
+ </template>
82
+ </ap-table>
83
+ </ap-header>
84
+ <ap-container>
85
+ <ap-header margin="0110" height="50%">
86
+ <ap-table ref="tDevCptParamTableRef" :options.sync="tDevCptParamTable">
87
+ <template #slotOption="searchProps">
88
+ <el-input v-model="searchProps.rowData.fdOption" type="textarea" :rows=5></el-input>
89
+ <span
90
+ style="color: #909399;">注1: 数组格式 [{label:"名字1", value:"值1"},{label:"名字2", value:"值2"}]</span><br>
91
+ <span style="color: #909399;">注2: 对象格式 {attr1:"属性1", attr2:"属性2"}</span><br>
92
+ </template>
93
+ </ap-table>
94
+ </ap-header>
95
+ <ap-main margin="0110">
96
+ <ap-table ref="tDevCptParamTemplateTableRef" :options.sync="tDevCptParamTemplateTable">
97
+ <template #slotTemplate="searchProps">
98
+ <!-- <el-input v-model="searchProps.rowData.fdTemplate" type="textarea" :rows=10></el-input>-->
99
+ <cpt-template v-model="searchProps.rowData.fdTemplate" :cptId="selectedCptId"></cpt-template>
100
+ </template>
101
+ <template #slotDefault="searchProps">
102
+ <el-input v-model="searchProps.rowData.fdDefault" type="textarea" :rows=10></el-input>
103
+ </template>
104
+ </ap-table>
105
+ </ap-main>
106
+ </ap-container>
107
+ </ap-container>
108
+ <el-dialog
109
+ title="提示"
110
+ :visible.sync="showCopyDialog"
111
+ width="30%">
112
+ <span>复制参数、复制参数模板</span>
113
+ <span slot="footer" class="dialog-footer">
114
+ <el-button type="primary" @click="doCopyParam()">仅复制参数</el-button>
115
+ <el-button type="primary" @click="doCopyParam('1')">复制参数和参数模板</el-button>
116
+ </span>
117
+ </el-dialog>
118
+ <el-dialog
119
+ title="参数脚本"
120
+ :visible.sync="showJsCodeDialog"
121
+ width="1500px">
122
+ <div style="width: 100%;height: 450px" class="flex-justify-start">
123
+ <div style="width: 400px;height: 100%">
124
+ <ap-aside-tree ref="cptParamTreeRef" :options.sync="cptParamTreeOptions">
125
+ <div slot="tree" slot-scope="scope" class="flex-justify-between" style="width: 100%">
126
+ <div>
127
+ <span @click="copyText(scope.data.fdName, $event)">{{ scope.data.fdName }} </span>
128
+ <span class="ap-color-blue"
129
+ @click="copyParamValue(scope.data.fdCode, $event)">{{ scope.data.fdCode }}</span>
130
+ </div>
131
+ <div style="margin-right: 10px">
132
+ <div class="ap-tag" style="font-size: 12px;padding: 2px 5px;"
133
+ @click="insertScript(scope.data)">
134
+ <span v-if="scope.data.fdShowType == 2">开</span>
135
+ <span v-else>不为空</span>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </ap-aside-tree>
140
+ </div>
141
+ <div class="flex-1" style="height: 100%;margin-left: 15px">
142
+ <ap-table ref="tDevCptScriptRef" :options.sync="tDevCptScriptOpt"></ap-table>
143
+ </div>
144
+ </div>
145
+ <span slot="footer" class="dialog-footer">
146
+ <el-button @click="showJsCodeDialog = false">取 消</el-button>
147
+ </span>
148
+ </el-dialog>
149
+ <el-dialog
150
+ title="参数编码/参数名称 批量更新"
151
+ :visible.sync="showHandleCptCodeDialog"
152
+ width="700px">
153
+ <el-form :model="replaceForm" label-width="100px" :inline="true" class="ap-form">
154
+ <div class="ap-form-row">
155
+ <el-form-item label='旧参数名称' prop='oldName'>
156
+ <el-input v-model='replaceForm.oldName'></el-input>
157
+ </el-form-item>
158
+ <el-form-item label='新参数名称' prop='newName'>
159
+ <el-input v-model='replaceForm.newName'></el-input>
160
+ </el-form-item>
161
+ </div>
162
+ <div class="ap-form-row">
163
+ <el-form-item label='旧参数编码' prop='oldCode'>
164
+ <el-input v-model='replaceForm.oldCode'></el-input>
165
+ </el-form-item>
166
+ <el-form-item label='新参数编码' prop='newCode'>
167
+ <el-input v-model='replaceForm.newCode'></el-input>
168
+ </el-form-item>
169
+ </div>
170
+ </el-form>
171
+ <span slot="footer" class="dialog-footer">
172
+ <el-button @click="showHandleCptCodeDialog = false">取 消</el-button>
173
+ <el-button type="primary" @click="replaceCptNameAndCode">确认替换</el-button>
174
+ </span>
175
+ </el-dialog>
176
+ </ap-container>
177
+ </template>
178
+
179
+ <script>
180
+ import clipboard from 'ap-util/util/ClipboardUtil'
181
+ import CptTemplate from './CptTemplate'
182
+
183
+ export default {
184
+ name: 'DevCpt',
185
+ components: {
186
+ CptTemplate
187
+ },
188
+ data() {
189
+
190
+ return {
191
+ // ----- 左侧树 -----
192
+ treeOptions: this.getTreeOption(),
193
+ parentList: [],
194
+ cptBaseList: [],
195
+ tDevCptForm: {},
196
+ tDevCptRules: {},
197
+ selectedCptId: "",
198
+ selectedCpt: {},
199
+ // ----- 右侧 -----
200
+ tDevCptTemplateTable: this.getCptTemplateTableOption(),
201
+ tDevCptParamTable: this.getCptParamTableOption(),
202
+ tDevCptParamTemplateTable: this.getCptParamTemplateTableOption(),
203
+ selectedParam: "",
204
+ template: "",
205
+ optionType: "",
206
+ showCopyDialog: false,
207
+ showHandleCptCodeDialog: false,
208
+ showJsCodeDialog: false,
209
+ replaceForm: {
210
+ oldName: "",
211
+ newName: "",
212
+ oldCode: "",
213
+ newCode: "",
214
+ },
215
+ cptParamTreeOptions: this.getCptParamTreeOptions(),
216
+ isErrorScript: "0",
217
+ tDevCptScriptOpt: this.getDevCptScriptOpt(),
218
+ insertScriptId: ""
219
+ }
220
+ },
221
+ mounted() {
222
+ this.getCptList();
223
+ this.getCptBaseList();
224
+ },
225
+ methods: {
226
+ // 左侧树:配置
227
+ getTreeOption() {
228
+ let treeOptions = {
229
+ title: "组件",
230
+ dialogWidth: "700px",
231
+ toolbarBtn: [{
232
+ icon: "el-icon-copy", onClick: () => {
233
+ this.copyCpt();
234
+ }
235
+ }, {
236
+ icon: "el-icon-bug", onClick: () => {
237
+ this.clearCpt();
238
+ }
239
+ }, "add", "edit", "del", "sort"],
240
+ dialogTitle: "组件信息",
241
+ sortByDrag: true,
242
+ onClick: (data, node, comp) => {
243
+ this.selectedCptId = data.fdId;
244
+ this.selectedCpt = data;
245
+ this.selectedParam = "";
246
+ this.$refs.tDevCptParamTableRef.refresh();
247
+ this.$refs.tDevCptTemplateTableRef.refresh();
248
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
249
+ },
250
+ loadOptions: {
251
+ url: "/apd/TDevCpt/getCptList",
252
+ treeKey: {
253
+ idKey: "fdId",
254
+ parentKey: "fdParentId",
255
+ childrenKey: "children",
256
+ label: "fdName"
257
+ },
258
+ success: (response) => {
259
+ },
260
+ },
261
+ editOptions: {
262
+ url: "/apd/TDevCpt/getTDevCptByFdId",
263
+ data: (node) => {
264
+ return {
265
+ fdId: node.fdId
266
+ }
267
+ },
268
+ success: (response) => {
269
+ this.tDevCptForm = response.data;
270
+ },
271
+ error() {
272
+ },
273
+ },
274
+ insertUrl: "/apd/TDevCpt/insertTDevCpt",
275
+ insertData: () => {
276
+ return this.tDevCptForm
277
+ },
278
+ updateUrl: "/apd/TDevCpt/updateTDevCpt",
279
+ updateData: () => {
280
+ return this.tDevCptForm
281
+ },
282
+ deleteUrl: "/apd/TDevCpt/deleteTDevCptByFdId",
283
+ deleteData: (node) => {
284
+ return {
285
+ fdId: node.fdId
286
+ }
287
+ },
288
+ updateSortUrl: '/apd/TDevCpt/updateTDevCptSort',
289
+ updateSortListUrl: '/apd/TDevCpt/updateTDevCptSortList',
290
+ sortByDrag: true,
291
+ resetForm: () => {
292
+ this.tDevCptForm = {
293
+ fdName: '',
294
+ fdType: '',
295
+ fdCode: '',
296
+ fdParentId: '',
297
+ fdBaseId: '',
298
+ fdLanguage: '',
299
+ fdIcon: '',
300
+ fdRemark: '',
301
+ fdSort: '',
302
+ };
303
+ },
304
+ afterOpenAddDialog: (node) => {
305
+ },
306
+ };
307
+
308
+ return treeOptions;
309
+ },
310
+ getCptList() {
311
+ this.$request({
312
+ url: '/apd/TDevCpt/getCptList',
313
+ method: 'post',
314
+ data: {}
315
+ }).then(response => {
316
+ this.parentList = response.data
317
+ })
318
+ },
319
+ getCptBaseList() {
320
+ this.$request({
321
+ url: '/apd/TDevCptBase/getTDevCptBaseList',
322
+ method: 'post',
323
+ data: {}
324
+ }).then(response => {
325
+ this.cptBaseList = response.data
326
+ })
327
+ },
328
+ // 右侧:组件模板表格
329
+ getCptTemplateTableOption() {
330
+ let tDevCptTemplateCols = [
331
+ {
332
+ prop: 'fdCptId',
333
+ label: '所属组件',
334
+ type: "select",
335
+ selectOptionsRemote: "cptList",
336
+ selectOptionsKey: {label: "fdName", value: "fdId"},
337
+ width: '80',
338
+ addDefaultValue: () => {
339
+ return this.selectedCptId;
340
+ }
341
+ }, {
342
+ prop: 'fdParamName',
343
+ label: '参数名',
344
+ type: 'input',
345
+ width: '90',
346
+ }, {
347
+ prop: 'fdTemplate',
348
+ label: '组件模板',
349
+ minWidth: '130',
350
+ type: "search",
351
+ searchTitle: "模板编辑",
352
+ searchSlot: 'slotTemplate',
353
+ searchConfirm: (row) => {
354
+ return true
355
+ },
356
+ searchClear: (row) => {
357
+ row.fdTemplate = '';
358
+ return true;
359
+ },
360
+ html: (value, row) => {
361
+ return this.handleTemplateHtml(value);
362
+ },
363
+ help: "1、参数格式:\${xxxx}<br> xxx只能是字母,默认空格连接<br>" +
364
+ "2、数组参数格式:\${xxxx#abc}<br>使用#连接,abc为自定义连接符。使用\\n表示换行<br>" +
365
+ "3、if判断:<br><#if>xxxx&lt/#if>"
366
+ }, {
367
+ prop: 'fdAddScriptId',
368
+ label: '模板添加脚本',
369
+ width: '150',
370
+ type: "select",
371
+ selectClearable: true,
372
+ selectOptionsRemote: "scriptList",
373
+ selectOptionsKey: {label: "fdName", value: "fdId"},
374
+ selectHtml: (value, text, row) => {
375
+ return `<span class="ap-color-blue" title='${row.addScript}'>${text}</span>`
376
+ },
377
+ }, {
378
+ prop: 'fdDefault',
379
+ label: '默认模板',
380
+ minWidth: '70',
381
+ type: "search",
382
+ searchTitle: "模板编辑",
383
+ searchSlot: 'slotDefault',
384
+ searchConfirm: (row) => {
385
+ return true
386
+ },
387
+ searchClear: (row) => {
388
+ row.fdDefault = '';
389
+ return true;
390
+ },
391
+ }, {
392
+ prop: 'fdDefaultScriptId',
393
+ label: '默认模板使用脚本',
394
+ width: '150',
395
+ type: "select",
396
+ selectClearable: true,
397
+ selectOptionsRemote: "scriptList",
398
+ selectOptionsKey: {label: "fdName", value: "fdId"},
399
+ selectHtml: (value, text, row) => {
400
+ return `<span class="ap-color-blue" title='${row.defaultScript}'>${text}</span>`
401
+ }
402
+ }, {
403
+ prop: 'fdLeftSpace',
404
+ label: '左侧空格',
405
+ type: 'input',
406
+ width: '60',
407
+ }, {
408
+ prop: 'fdSort',
409
+ label: '排序',
410
+ type: 'input',
411
+ width: '60',
412
+ },
413
+ ];
414
+ let tDevCptTemplateTable = {
415
+ title: "组件模板",
416
+ columns: tDevCptTemplateCols,
417
+ dataUrl: "/apd/TDevCptTemplate/getTDevCptTemplateGridList",
418
+ saveUrl: "/apd/TDevCptTemplate/saveTDevCptTemplateGridData",
419
+ editPk: "fdId", //默认fdId
420
+ deletePk: "fdId", // 默认fdId
421
+ deleteUrl: "/apd/TDevCptTemplate/deleteTDevCptTemplateGridData",
422
+ toolbarBtn: [{
423
+ btnType: "primary", text: "脚本", icon: "el-icon-collection-tag", onClick: () => {
424
+ if (this.selectedCptId == null || this.selectedCptId == "") {
425
+ this.$message.error("请选择组件");
426
+ return;
427
+ }
428
+ if (this.$refs.tDevCptParamTableRef.getAddRowList().length > 0 ||
429
+ this.$refs.tDevCptParamTableRef.getEditRowList().length > 0 ||
430
+ this.$refs.tDevCptTemplateTableRef.getAddRowList().length > 0 ||
431
+ this.$refs.tDevCptTemplateTableRef.getEditRowList().length > 0 ||
432
+ this.$refs.tDevCptParamTemplateTableRef.getAddRowList().length > 0 ||
433
+ this.$refs.tDevCptParamTemplateTableRef.getEditRowList().length > 0) {
434
+ this.$message.error("请先保存数据");
435
+ return;
436
+ }
437
+
438
+ this.showJsCodeDialog = true;
439
+ this.$nextTick(() => {
440
+ this.$refs.tDevCptScriptRef.refresh();
441
+ this.$refs.cptParamTreeRef.reLoadTreeData();
442
+ })
443
+ }
444
+ }, "separator", {
445
+ btnType: "primary", text: "编码替换", icon: "el-icon-transfer", onClick: () => {
446
+ this.showHandleCptCodeDialog = true;
447
+ }
448
+ }, "separator", "add", "edit", "del", "refresh", "save"],
449
+ showPagination: false,
450
+ params: () => {
451
+ return {
452
+ cptId: this.selectedCptId
453
+ }
454
+ },
455
+ rowDblClickEvent: (row, column, event) => {
456
+ this.$refs.tDevCptTemplateTableRef.toggleEditRow(row);
457
+ },
458
+ };
459
+ return tDevCptTemplateTable;
460
+ },
461
+ // 右侧:组件参数表格
462
+ getCptParamTableOption() {
463
+ let tDevCptParamCols = [
464
+ {
465
+ prop: 'fdCptId',
466
+ label: '所属组件',
467
+ type: "select",
468
+ selectOptionsRemote: "cptList",
469
+ selectOptionsKey: {label: "fdName", value: "fdId"},
470
+ width: '80',
471
+ addDefaultValue: () => {
472
+ return this.selectedCptId;
473
+ }
474
+ }, {
475
+ prop: 'fdParentId',
476
+ label: '父参数',
477
+ type: "select",
478
+ selectOptionsRemote: "cptParamList",
479
+ selectOptionsKey: {label: "fdName", value: "fdId"},
480
+ width: '80',
481
+ }, {
482
+ prop: 'fdName',
483
+ label: '参数名称',
484
+ type: 'input',
485
+ width: '110',
486
+ }, {
487
+ prop: 'fdCode',
488
+ label: '参数编码',
489
+ type: 'input',
490
+ minWidth: '120',
491
+ help: `参数编码。<br>.value: 表示参数值<br>示例:"\${InputType.value}"<br>click点击可复制参数取值(如:"\${InputType.value}")`
492
+ }, {
493
+ prop: 'fdValue',
494
+ label: '默认值',
495
+ type: 'input',
496
+ width: '80',
497
+ showOverflowTooltip: true,
498
+ help: `默认值格式:<br>1、非数组参数:字符串<br>2、数组参数: 可执行js,格式:[{参数编码A:"参数值1"},{参数编码B:"参数值2"}]<br>示例:[{InputA:"add"},{InputB:"自定义",InputC:"按钮"}]`
499
+ }, {
500
+ prop: 'fdShowScriptId',
501
+ label: '显示条件脚本',
502
+ width: '130',
503
+ type: "select",
504
+ selectClearable: true,
505
+ selectOptionsRemote: "scriptList",
506
+ selectOptionsKey: {label: "fdName", value: "fdId"},
507
+ selectHtml: (value, text, row) => {
508
+ return `<span class="ap-color-blue" title='${row.showScript}'>${text}</span>`
509
+ },
510
+ help: `判断页面是否显示组件。为空,默认显示。<br>示例:"\${InputType.value}" == "textarea"`
511
+ }, {
512
+ prop: 'fdShowType',
513
+ label: '显示类型',
514
+ type: 'select',
515
+ width: '80',
516
+ selectOptions: [{label: "input", value: 1}, {label: "开关", value: 2}, {label: "下拉单选", value: 3},
517
+ {label: "数组参数", value: 4}, {label: "单选框", value: 5}, {label: "text", value: 6},
518
+ {label: "计数文本", value: 7}, {label: "分割线", value: 8}, {label: "文本信息", value: 9}],
519
+ }, {
520
+ prop: 'fdOption',
521
+ label: '值选项',
522
+ width: '100',
523
+ showOverflowTooltip: true,
524
+ type: "search",
525
+ searchTitle: "选项值",
526
+ searchSlot: 'slotOption',
527
+ searchConfirm: (row) => {
528
+ return true
529
+ },
530
+ searchClear: (row) => {
531
+ row.fdOption = '';
532
+ return true;
533
+ },
534
+ }, {
535
+ prop: 'fdMethodScriptId',
536
+ label: '参数值变化脚本',
537
+ width: '120',
538
+ type: "select",
539
+ selectClearable: true,
540
+ selectOptionsRemote: "scriptList",
541
+ selectOptionsKey: {label: "fdName", value: "fdId"},
542
+ selectHtml: (value, text, row) => {
543
+ return `<span class="ap-color-blue" title='${row.methodScript}'>${text}</span>`
544
+ },
545
+ help: `参数值修改时,调用方法,用于直接设定其他参数值。<br>示例:"\${InputType.value}" = "123"`
546
+ }, {
547
+ prop: 'fdPlaceholder',
548
+ label: '占位文本',
549
+ type: 'input',
550
+ width: '120',
551
+ showOverflowTooltip: true
552
+ }, {
553
+ prop: 'fdTab',
554
+ label: 'tab页',
555
+ type: 'input',
556
+ width: '60',
557
+ }, {
558
+ prop: 'fdTip',
559
+ label: '提示',
560
+ type: 'input',
561
+ minWidth: '120',
562
+ showOverflowTooltip: true
563
+ }, {
564
+ prop: 'fdRemark',
565
+ label: '备注',
566
+ type: 'input',
567
+ width: '80',
568
+ showOverflowTooltip: true,
569
+ }, {
570
+ prop: 'fdSort',
571
+ label: '排序',
572
+ type: 'input',
573
+ width: '50',
574
+ },
575
+ ];
576
+ let tDevCptParamTable = {
577
+ title: "参数",
578
+ columns: tDevCptParamCols,
579
+ dataUrl: "/apd/TDevCptParam/getTDevCptParamGridList",
580
+ saveUrl: "/apd/TDevCptParam/saveTDevCptParamGridData",
581
+ editPk: "fdId", //默认fdId
582
+ deletePk: "fdId", // 默认fdId
583
+ deleteUrl: "/apd/TDevCptParam/deleteTDevCptParamGridData",
584
+ sortUrl: "/apd/TDevCptParam/updateTDevCptParamSortList",
585
+ toolbarBtn: [{
586
+ btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
587
+ this.copyParam()
588
+ }
589
+ }, "separator",
590
+ "sortAuto", "sortDown", "sortUp", "separator",
591
+ "add", "edit", "del", "refresh", "save"],
592
+ showPagination: false,
593
+ params: () => {
594
+ return {
595
+ cptId: this.selectedCptId
596
+ }
597
+ },
598
+ rowClickEvent: (row, column, event) => {
599
+ this.selectedParam = row.fdId;
600
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
601
+ },
602
+ rowDblClickEvent: (row, column, event) => {
603
+ this.$refs.tDevCptParamTableRef.toggleEditRow(row);
604
+ },
605
+ };
606
+ return tDevCptParamTable;
607
+ },
608
+ // 右侧:参数模板表格
609
+ getCptParamTemplateTableOption() {
610
+ let tDevCptParamTemplateCols = [
611
+ {
612
+ prop: 'fdParamId',
613
+ label: '所属参数',
614
+ type: "select",
615
+ selectOptionsRemote: "paramList",
616
+ selectOptionsKey: {label: "fdName", value: "fdId"},
617
+ width: '110',
618
+ addDefaultValue: () => {
619
+ return this.selectedParam;
620
+ }
621
+ }, {
622
+ prop: 'fdParamName',
623
+ label: '参数名',
624
+ type: 'input',
625
+ width: '80',
626
+ }, {
627
+ prop: 'fdTemplate',
628
+ label: '参数模板',
629
+ minWidth: '130',
630
+ showOverflowTooltip: true,
631
+ type: "search",
632
+ searchTitle: "模板编辑",
633
+ searchSlot: 'slotTemplate',
634
+ searchWidth:"1100px",
635
+ searchConfirm: (row) => {
636
+ return true
637
+ },
638
+ searchClear: (row) => {
639
+ row.fdTemplate = '';
640
+ return true;
641
+ },
642
+ html: (value, row) => {
643
+ return this.handleTemplateHtml(value);
644
+ },
645
+ help: `格式:参数格式必须为\${xxxx.xxx} 不能有空格`
646
+ }, {
647
+ prop: 'fdAddScriptId',
648
+ label: '模板添加脚本',
649
+ width: '150',
650
+ help: `判断是否添加模板。为空,表示默认添加。`,
651
+ type: "select",
652
+ selectClearable: true,
653
+ selectOptionsRemote: "scriptList",
654
+ selectOptionsKey: {label: "fdName", value: "fdId"},
655
+ selectHtml: (value, text, row) => {
656
+ return `<span class="ap-color-blue" title='${row.addScript}'>${text}</span>`
657
+ }
658
+ }, {
659
+ prop: 'fdDefault',
660
+ label: '默认模板',
661
+ minWidth: '70',
662
+ showOverflowTooltip: true,
663
+ type: "search",
664
+ searchTitle: "模板编辑",
665
+ searchSlot: 'slotDefault',
666
+ searchConfirm: (row) => {
667
+ return true
668
+ },
669
+ searchClear: (row) => {
670
+ row.fdDefault = '';
671
+ return true;
672
+ },
673
+ }, {
674
+ prop: 'fdDefaultScriptId',
675
+ label: '默认模板使用脚本',
676
+ width: '140',
677
+ help: `判断是否使用默认模板。为空,不使用默认模板。<br>示例:"\${InputSize.value}" != ""`,
678
+ type: "select",
679
+ selectClearable: true,
680
+ selectOptionsRemote: "scriptList",
681
+ selectOptionsKey: {label: "fdName", value: "fdId"},
682
+ selectHtml: (value, text, row) => {
683
+ return `<span class="ap-color-blue" title='${row.defaultScript}'>${text}</span>`
684
+ }
685
+ }, {
686
+ prop: 'fdLeftSpace',
687
+ label: '左侧空格',
688
+ type: 'input',
689
+ width: '60',
690
+ }
691
+ ];
692
+ let tDevCptParamTemplateTable = {
693
+ title: "参数模板",
694
+ columns: tDevCptParamTemplateCols,
695
+ dataUrl: "/apd/TDevCptParamTemplate/getTDevCptParamTemplateGridList",
696
+ saveUrl: "/apd/TDevCptParamTemplate/saveTDevCptParamTemplateGridData",
697
+ editPk: "fdId", //默认fdId
698
+ deletePk: "fdId", // 默认fdId
699
+ deleteUrl: "/apd/TDevCptParamTemplate/deleteTDevCptParamTemplateGridData",
700
+ sortUrl: "/apd/TDevCptParamTemplate/updateTDevCptParamTemplateSortList",
701
+ toolbarBtn: [{
702
+ btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
703
+ this.doCopyParamTemplate()
704
+ }
705
+ }, "separator", "add", "edit", "del", "refresh", "save"],
706
+ showPagination: false,
707
+ params: () => {
708
+ return {
709
+ cptId: this.selectedCptId,
710
+ paramId: this.selectedParam
711
+ }
712
+ },
713
+ rowDblClickEvent: (row, column, event) => {
714
+ this.$refs.tDevCptParamTemplateTableRef.toggleEditRow(row);
715
+ },
716
+ };
717
+ return tDevCptParamTemplateTable;
718
+ },
719
+ replaceCptNameAndCode() {
720
+ let form = this.replaceForm;
721
+ form.cptId = this.selectedCptId
722
+ this.$request({
723
+ url: '/apd/TDevCpt/replaceCptNameAndCode',
724
+ method: 'post',
725
+ data: form
726
+ }).then(response => {
727
+ this.$message.success("替换成功");
728
+ this.$refs.tDevCptParamTableRef.refresh();
729
+ this.$refs.tDevCptTemplateTableRef.refresh();
730
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
731
+ this.showHandleCptCodeDialog = false;
732
+ })
733
+ },
734
+ handleTemplateHtml(str) {
735
+ if (str == null) {
736
+ return "";
737
+ }
738
+ str = str.replaceAll("<", "&lt;")
739
+ let html = `<div class="api-code" style="line-height: 14px;width: 100%; max-height: 80px;overflow: auto;">${str}</div>`;
740
+ return html;
741
+ },
742
+ clearCpt() {
743
+ this.$confirm(`清空无效组件配置(已删除组件的模板、脚本、参数、demo)?`, '提示', {
744
+ confirmButtonText: '清空',
745
+ cancelButtonText: '取消',
746
+ type: 'warning'
747
+ }).then(() => {
748
+ this.$request({
749
+ url: '/apd/TDevCpt/clearCpt',
750
+ method: 'post',
751
+ data: {}
752
+ }).then(response => {
753
+ this.$message.success("清空成功");
754
+ this.$refs.cptTree.reLoadTreeData();
755
+ })
756
+ })
757
+ },
758
+ copyCpt() {
759
+ if (this.selectedCptId == "" || this.selectedCptId == null) {
760
+ this.$message.error("请选择需要复制的行");
761
+ return;
762
+ }
763
+ this.$confirm(`确认复制【${this.selectedCpt.fdName}】组件?`, '提示', {
764
+ confirmButtonText: '复制',
765
+ cancelButtonText: '取消',
766
+ type: 'warning'
767
+ }).then(() => {
768
+ this.$request({
769
+ url: '/apd/TDevCpt/copyCpt',
770
+ method: 'post',
771
+ data: {
772
+ cptId: this.selectedCptId,
773
+ }
774
+ }).then(response => {
775
+ this.$message.success("复制成功");
776
+ this.$refs.cptTree.reLoadTreeData();
777
+ })
778
+ })
779
+ },
780
+ copyParam(type) {
781
+ this.showCopyDialog = true;
782
+ },
783
+ // 复制参数
784
+ doCopyParam(type) {
785
+ let selectedRows = this.$refs.tDevCptParamTableRef.getSelection();
786
+ if (selectedRows.length < 1) {
787
+ this.$message.error("请选择需要复制的行!");
788
+ return;
789
+ }
790
+ if (selectedRows.length > 1) {
791
+ this.$message.error("只能选择单行数据进行复制!");
792
+ return;
793
+ }
794
+
795
+ this.$request({
796
+ url: '/apd/TDevCptParam/copyParam',
797
+ method: 'post',
798
+ data: {
799
+ paramId: selectedRows[0].fdId,
800
+ copyTemplate: type
801
+ }
802
+ }).then(response => {
803
+ this.$message.success("复制成功");
804
+ this.$refs.tDevCptParamTableRef.refresh();
805
+ if (type == "1") {
806
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
807
+ }
808
+ this.showCopyDialog = false;
809
+ })
810
+
811
+ },
812
+ // 复制参数模板
813
+ doCopyParamTemplate() {
814
+ let selectedRows = this.$refs.tDevCptParamTemplateTableRef.getSelection();
815
+ if (selectedRows.length < 1) {
816
+ this.$message.error("请选择需要复制的行!");
817
+ return;
818
+ }
819
+ if (selectedRows.length > 1) {
820
+ this.$message.error("只能选择单行数据进行复制!");
821
+ return;
822
+ }
823
+
824
+ this.$request({
825
+ url: '/apd/TDevCptParam/copyParamTemplate',
826
+ method: 'post',
827
+ data: {
828
+ templateId: selectedRows[0].fdId,
829
+ }
830
+ }).then(response => {
831
+ this.$message.success("复制成功");
832
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
833
+ })
834
+
835
+ },
836
+ // 组件参数
837
+ getCptParamTreeOptions() {
838
+ let treeOptions = {
839
+ title: "组件参数",
840
+ initData: false,
841
+ onClick: (data, node, comp) => {
842
+ },
843
+ loadOptions: {
844
+ url: "/apd/TDevCptParam/getTDevCptParamList",
845
+ data: () => {
846
+ return {
847
+ cptId: this.selectedCptId
848
+ }
849
+ },
850
+ treeKey: {
851
+ idKey: "fdId",
852
+ parentKey: "fdParentId",
853
+ childrenKey: "children",
854
+ label: "fdName"
855
+ },
856
+ success: (response) => {
857
+ },
858
+ },
859
+ };
860
+
861
+ return treeOptions;
862
+ },
863
+ // 组件脚本
864
+ getDevCptScriptOpt() {
865
+ let columns = [
866
+ {
867
+ prop: 'fdName',
868
+ label: '名称',
869
+ type: 'input',
870
+ width: 180,
871
+ help: '参数- <br>显示- <br>显示事件- <br>显示方法-'
872
+ }, {
873
+ prop: 'fdCode',
874
+ label: '变量名',
875
+ type: 'input',
876
+ width: 100,
877
+ help: '模板中执行判断的变量名。<br>如<#if testName>'
878
+ }, {
879
+ prop: 'fdScript',
880
+ label: '脚本',
881
+ type: 'input',
882
+ help: 'js执行脚本。' +
883
+ '<br><b>一、用于判断是否显示</b>' +
884
+ '<br><b>可用参数:</b>paramObj, paramTemplateObj' +
885
+ '<br><b>示例1:</b>"\${InputSize.value}" != ""<br><b>示例2:</b>paramTemplateObj.attrs.length>0'+
886
+ '<br><b>二、用于修改值(固定格式):</b>'+
887
+ '<br><b>可用参数:</b>paramObj,paramList' +
888
+ '<br><b>格式:</b>changeValue(paramList, \'参数编码\' , \'新值\')' +
889
+ '<br><b>示例1:</b>changeValue(paramList, \'typeValue\' , \'a\')'
890
+ }, {
891
+ prop: 'fdComment',
892
+ label: '备注',
893
+ type: 'input',
894
+ width: 100,
895
+ }
896
+ ];
897
+ let tableOpt = {
898
+ title: "组件脚本",
899
+ columns: columns,
900
+ editPk: "fdId", //默认fdId
901
+ deletePk: "fdId", // 默认fdId
902
+ dataUrl: "/apd/TDevCptScript/getTDevCptScriptGridList",
903
+ saveUrl: "/apd/TDevCptScript/saveTDevCptScriptGridData",
904
+ deleteUrl: "/apd/TDevCptScript/deleteTDevCptScriptGridData",
905
+ toolbarBtn: [{
906
+ btnType: "primary", text: "异常筛选", icon: "el-icon-copy", onClick: () => {
907
+ this.isErrorScript = "1";
908
+ this.$refs.tDevCptScriptRef.refresh();
909
+ }
910
+ }, {
911
+ btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
912
+ this.copyScript()
913
+ }
914
+ }, "separator", "add", "edit", "del", "cancel", "refresh", "save"],
915
+ initData: false, // 默认false
916
+ showPagination: false,
917
+ afterLoadData: () => {
918
+ this.isErrorScript = "0";
919
+ },
920
+ addDefaultObj: () => {
921
+ return {
922
+ fdCptId: this.selectedCptId
923
+ }
924
+ },
925
+ params: () => {
926
+ return {
927
+ cptId: this.selectedCptId,
928
+ isErrorScript: this.isErrorScript
929
+ }
930
+ },
931
+ rowDblClickEvent: (row, column, event) => {
932
+ this.$refs.tDevCptScriptRef.toggleEditRow(row);
933
+ },
934
+ afterSave: this.refreshScriptTable,
935
+ afterAll: () => {
936
+ if (this.insertScriptId == null || this.insertScriptId == "") {
937
+ return;
938
+ }
939
+ this.$refs.tDevCptScriptRef.toggleRowSelectionByRowKey(this.insertScriptId, true);
940
+ this.insertScriptId = "";
941
+ }
942
+ };
943
+ return tableOpt;
944
+ },
945
+ // 刷新脚本相关表格
946
+ refreshScriptTable() {
947
+ console.log("刷新外部表格");
948
+ this.$refs.tDevCptParamTableRef.refresh();
949
+ this.$refs.tDevCptTemplateTableRef.refresh();
950
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
951
+ },
952
+ copyText(text, event) {
953
+ clipboard(text, event);
954
+ },
955
+ copyParamValue(code, event) {
956
+ let str = '"${' + code + '.value}"';
957
+ clipboard(str, event);
958
+ },
959
+ insertScript(data) {
960
+ let name = "";
961
+ if (data.fdName.indexOf("事件") > -1) {
962
+ name = "显示事件-" + data.fdName.replace("事件", "");
963
+ } else if (data.fdCode.indexOf("Method") > -1) {
964
+ name = "显示方法-" + data.fdName;
965
+ } else {
966
+ name = "显示-" + data.fdName;
967
+ }
968
+
969
+ let script = "";
970
+ if (data.fdShowType == 2) {
971
+ // 开
972
+ script = '"${' + data.fdCode + '.value}" == "1"';
973
+ } else {
974
+ // 不为空
975
+ script = '"${' + data.fdCode + '.value}" != ""';
976
+ }
977
+ let msg = `确定添加脚本?
978
+ <br><span style="font-weight: bold">名称:</span><span class="ap-color-blue">${name}</span>
979
+ <br><span style="font-weight: bold">脚本:</span><span class="ap-color-blue">${script}</span>`
980
+ this.$confirm(msg, '提示', {
981
+ confirmButtonText: '确定添加',
982
+ cancelButtonText: '取消',
983
+ dangerouslyUseHTMLString: true,
984
+ type: 'warning'
985
+ }).then(() => {
986
+ this.$request({
987
+ url: '/apd/TDevCptScript/insertTDevCptScript',
988
+ method: 'post',
989
+ data: {
990
+ fdCptId: this.selectedCptId,
991
+ fdName: name,
992
+ fdScript: script,
993
+ }
994
+ }).then(response => {
995
+ this.insertScriptId = response.data;
996
+ this.$message.success("添加成功:" + name);
997
+ this.$refs.tDevCptScriptRef.refresh();
998
+ this.refreshScriptTable();
999
+ })
1000
+ }).catch(() => {
1001
+ this.$message({
1002
+ type: 'info',
1003
+ message: '已取消添加'
1004
+ });
1005
+ });
1006
+ },
1007
+ // 复制参数模板
1008
+ copyScript() {
1009
+ let selectedRows = this.$refs.tDevCptScriptRef.getSelection();
1010
+ if (selectedRows.length < 1) {
1011
+ this.$message.error("请选择需要复制的行!");
1012
+ return;
1013
+ }
1014
+ if (selectedRows.length > 1) {
1015
+ this.$message.error("只能选择单行数据进行复制!");
1016
+ return;
1017
+ }
1018
+
1019
+ this.$request({
1020
+ url: '/apd/TDevCptScript/copyScript',
1021
+ method: 'post',
1022
+ data: {
1023
+ scriptId: selectedRows[0].fdId,
1024
+ }
1025
+ }).then(response => {
1026
+ this.$message.success("复制成功");
1027
+ this.$refs.tDevCptScriptRef.refresh();
1028
+ })
1029
+
1030
+ },
1031
+ }
1032
+ }
1033
+ </script>
1034
+
1035
+ <style scoped>
1036
+ </style>