ap-dev 1.2.13 → 1.2.15

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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ap-container>
3
- <ap-aside margin="1111" width="220px">
3
+ <ap-aside margin="1111" width="230px">
4
4
  <ap-aside-tree ref="cptTree" :options.sync="treeOptions">
5
5
  <el-form slot="form" ref="tDevCpt" :inline="true" label-width="80px"
6
6
  :model="tDevCptForm" :rules="tDevCptRules" class="ap-form">
@@ -95,7 +95,8 @@
95
95
  <ap-main margin="0110">
96
96
  <ap-table ref="tDevCptParamTemplateTableRef" :options.sync="tDevCptParamTemplateTable">
97
97
  <template #slotTemplate="searchProps">
98
- <el-input v-model="searchProps.rowData.fdTemplate" type="textarea" :rows=10></el-input>
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>
99
100
  </template>
100
101
  <template #slotDefault="searchProps">
101
102
  <el-input v-model="searchProps.rowData.fdDefault" type="textarea" :rows=10></el-input>
@@ -114,6 +115,37 @@
114
115
  <el-button type="primary" @click="doCopyParam('1')">复制参数和参数模板</el-button>
115
116
  </span>
116
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>
117
149
  <el-dialog
118
150
  title="参数编码/参数名称 批量更新"
119
151
  :visible.sync="showHandleCptCodeDialog"
@@ -145,9 +177,14 @@
145
177
  </template>
146
178
 
147
179
  <script>
180
+ import clipboard from 'ap-util/util/ClipboardUtil'
181
+ import CptTemplate from './CptTemplate'
148
182
 
149
183
  export default {
150
184
  name: 'DevCpt',
185
+ components: {
186
+ CptTemplate
187
+ },
151
188
  data() {
152
189
 
153
190
  return {
@@ -168,12 +205,17 @@ export default {
168
205
  optionType: "",
169
206
  showCopyDialog: false,
170
207
  showHandleCptCodeDialog: false,
208
+ showJsCodeDialog: false,
171
209
  replaceForm: {
172
210
  oldName: "",
173
211
  newName: "",
174
212
  oldCode: "",
175
213
  newCode: "",
176
214
  },
215
+ cptParamTreeOptions: this.getCptParamTreeOptions(),
216
+ isErrorScript: "0",
217
+ tDevCptScriptOpt: this.getDevCptScriptOpt(),
218
+ insertScriptId: ""
177
219
  }
178
220
  },
179
221
  mounted() {
@@ -184,13 +226,17 @@ export default {
184
226
  // 左侧树:配置
185
227
  getTreeOption() {
186
228
  let treeOptions = {
187
- title: "组件列表",
229
+ title: "组件",
188
230
  dialogWidth: "700px",
189
231
  toolbarBtn: [{
190
232
  icon: "el-icon-copy", onClick: () => {
191
233
  this.copyCpt();
192
234
  }
193
- }, "add", "edit", "del"],
235
+ }, {
236
+ icon: "el-icon-bug", onClick: () => {
237
+ this.clearCpt();
238
+ }
239
+ }, "add", "edit", "del", "sort"],
194
240
  dialogTitle: "组件信息",
195
241
  sortByDrag: true,
196
242
  onClick: (data, node, comp) => {
@@ -241,6 +287,7 @@ export default {
241
287
  },
242
288
  updateSortUrl: '/apd/TDevCpt/updateTDevCptSort',
243
289
  updateSortListUrl: '/apd/TDevCpt/updateTDevCptSortList',
290
+ sortByDrag: true,
244
291
  resetForm: () => {
245
292
  this.tDevCptForm = {
246
293
  fdName: '',
@@ -295,7 +342,7 @@ export default {
295
342
  prop: 'fdParamName',
296
343
  label: '参数名',
297
344
  type: 'input',
298
- width: '80',
345
+ width: '90',
299
346
  }, {
300
347
  prop: 'fdTemplate',
301
348
  label: '组件模板',
@@ -313,13 +360,20 @@ export default {
313
360
  html: (value, row) => {
314
361
  return this.handleTemplateHtml(value);
315
362
  },
316
- help: `1、参数格式:\${xxxx}<br> xxx只能是字母,默认空格连接<br>
317
- 2、数组参数格式:\${xxxx#abc}<br>使用#连接,abc为自定义连接符。使用\\n表示换行<br>`
363
+ help: "1、参数格式:\${xxxx}<br> xxx只能是字母,默认空格连接<br>" +
364
+ "2、数组参数格式:\${xxxx#abc}<br>使用#连接,abc为自定义连接符。使用\\n表示换行<br>" +
365
+ "3、if判断:<br><#if>xxxx&lt/#if>"
318
366
  }, {
319
- prop: 'fdAddCondition',
320
- label: '模板添加条件',
321
- type: 'input',
322
- minWidth: '150',
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
+ },
323
377
  }, {
324
378
  prop: 'fdDefault',
325
379
  label: '默认模板',
@@ -335,10 +389,16 @@ export default {
335
389
  return true;
336
390
  },
337
391
  }, {
338
- prop: 'fdDefaultCondition',
339
- label: '默认模板使用条件',
340
- type: 'input',
341
- minWidth: '70',
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
+ }
342
402
  }, {
343
403
  prop: 'fdLeftSpace',
344
404
  label: '左侧空格',
@@ -360,6 +420,28 @@ export default {
360
420
  deletePk: "fdId", // 默认fdId
361
421
  deleteUrl: "/apd/TDevCptTemplate/deleteTDevCptTemplateGridData",
362
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", {
363
445
  btnType: "primary", text: "编码替换", icon: "el-icon-transfer", onClick: () => {
364
446
  this.showHandleCptCodeDialog = true;
365
447
  }
@@ -400,13 +482,13 @@ export default {
400
482
  prop: 'fdName',
401
483
  label: '参数名称',
402
484
  type: 'input',
403
- width: '100',
485
+ width: '110',
404
486
  }, {
405
487
  prop: 'fdCode',
406
488
  label: '参数编码',
407
489
  type: 'input',
408
490
  minWidth: '120',
409
- help: `参数编码。<br>.value: 表示参数值<br>示例:"\${InputType.value}"`
491
+ help: `参数编码。<br>.value: 表示参数值<br>示例:"\${InputType.value}"<br>click点击可复制参数取值(如:"\${InputType.value}")`
410
492
  }, {
411
493
  prop: 'fdValue',
412
494
  label: '默认值',
@@ -415,21 +497,25 @@ export default {
415
497
  showOverflowTooltip: true,
416
498
  help: `默认值格式:<br>1、非数组参数:字符串<br>2、数组参数: 可执行js,格式:[{参数编码A:"参数值1"},{参数编码B:"参数值2"}]<br>示例:[{InputA:"add"},{InputB:"自定义",InputC:"按钮"}]`
417
499
  }, {
418
- prop: 'fdShowCondition',
419
- label: '显示条件',
420
- type: 'input',
421
- minWidth: '120',
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
+ },
422
510
  help: `判断页面是否显示组件。为空,默认显示。<br>示例:"\${InputType.value}" == "textarea"`
423
511
  }, {
424
512
  prop: 'fdShowType',
425
513
  label: '显示类型',
426
514
  type: 'select',
427
515
  width: '80',
428
- selectOptions: [{label: "input", value: 1}, {label: "下拉单选", value: 3}, {label: "数组参数", value: 4},
429
- {label: "text", value: 6}, {label: "计数文本", value: 7}, {label: "开关", value: 2}, {
430
- label: "单选框",
431
- value: 5
432
- }],
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}],
433
519
  }, {
434
520
  prop: 'fdOption',
435
521
  label: '值选项',
@@ -446,16 +532,22 @@ export default {
446
532
  return true;
447
533
  },
448
534
  }, {
449
- prop: 'fdChangeMethod',
450
- label: '参数值变化执行方法',
451
- type: 'input',
452
- minWidth: '120',
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
+ },
453
545
  help: `参数值修改时,调用方法,用于直接设定其他参数值。<br>示例:"\${InputType.value}" = "123"`
454
546
  }, {
455
547
  prop: 'fdPlaceholder',
456
548
  label: '占位文本',
457
549
  type: 'input',
458
- width: '60',
550
+ width: '120',
459
551
  showOverflowTooltip: true
460
552
  }, {
461
553
  prop: 'fdTab',
@@ -466,21 +558,14 @@ export default {
466
558
  prop: 'fdTip',
467
559
  label: '提示',
468
560
  type: 'input',
469
- width: '60',
561
+ minWidth: '120',
470
562
  showOverflowTooltip: true
471
563
  }, {
472
564
  prop: 'fdRemark',
473
565
  label: '备注',
474
566
  type: 'input',
475
- width: '60',
476
- }, {
477
- prop: 'fdShowLine',
478
- label: '分割线',
479
- type: 'select',
480
- width: '60',
481
- help: '参数tab页分块,参数底部显示分割线',
482
- selectOptions: [{label: "隐藏", value: 0}, {label: "显示", value: 1}]
483
-
567
+ width: '80',
568
+ showOverflowTooltip: true,
484
569
  }, {
485
570
  prop: 'fdSort',
486
571
  label: '排序',
@@ -510,7 +595,7 @@ export default {
510
595
  cptId: this.selectedCptId
511
596
  }
512
597
  },
513
- rowClickEvent: (row) => {
598
+ rowClickEvent: (row, column, event) => {
514
599
  this.selectedParam = row.fdId;
515
600
  this.$refs.tDevCptParamTemplateTableRef.refresh();
516
601
  },
@@ -529,7 +614,7 @@ export default {
529
614
  type: "select",
530
615
  selectOptionsRemote: "paramList",
531
616
  selectOptionsKey: {label: "fdName", value: "fdId"},
532
- width: '100',
617
+ width: '110',
533
618
  addDefaultValue: () => {
534
619
  return this.selectedParam;
535
620
  }
@@ -546,6 +631,7 @@ export default {
546
631
  type: "search",
547
632
  searchTitle: "模板编辑",
548
633
  searchSlot: 'slotTemplate',
634
+ searchWidth:"1100px",
549
635
  searchConfirm: (row) => {
550
636
  return true
551
637
  },
@@ -558,12 +644,17 @@ export default {
558
644
  },
559
645
  help: `格式:参数格式必须为\${xxxx.xxx} 不能有空格`
560
646
  }, {
561
- prop: 'fdAddCondition',
562
- label: '模板添加条件',
563
- type: 'input',
564
- minWidth: '150',
565
- showOverflowTooltip: true,
566
- help: `判断是否添加模板。为空,表示默认添加。<br>示例:"\${InputSize.value}" != ""`
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
+ }
567
658
  }, {
568
659
  prop: 'fdDefault',
569
660
  label: '默认模板',
@@ -580,22 +671,22 @@ export default {
580
671
  return true;
581
672
  },
582
673
  }, {
583
- prop: 'fdDefaultCondition',
584
- label: '默认模板使用条件',
585
- type: 'input',
586
- minWidth: '70',
587
- showOverflowTooltip: true,
588
- help: `判断是否使用默认模板。为空,不使用默认模板。<br>示例:"\${InputSize.value}" != ""`
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
+ }
589
685
  }, {
590
686
  prop: 'fdLeftSpace',
591
687
  label: '左侧空格',
592
688
  type: 'input',
593
689
  width: '60',
594
- }, {
595
- prop: 'fdSort',
596
- label: '排序',
597
- type: 'input',
598
- width: '60',
599
690
  }
600
691
  ];
601
692
  let tDevCptParamTemplateTable = {
@@ -611,9 +702,7 @@ export default {
611
702
  btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
612
703
  this.doCopyParamTemplate()
613
704
  }
614
- }, "separator",
615
- "sortAuto", "sortDown", "sortUp", "separator",
616
- "add", "edit", "del", "refresh", "save"],
705
+ }, "separator", "add", "edit", "del", "refresh", "save"],
617
706
  showPagination: false,
618
707
  params: () => {
619
708
  return {
@@ -647,9 +736,25 @@ export default {
647
736
  return "";
648
737
  }
649
738
  str = str.replaceAll("<", "&lt;")
650
- let html = `<div class="api-code" style="line-height: 14px;">${str}</div>`;
739
+ let html = `<div class="api-code" style="line-height: 14px;width: 100%; max-height: 80px;overflow: auto;">${str}</div>`;
651
740
  return html;
652
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
+ },
653
758
  copyCpt() {
654
759
  if (this.selectedCptId == "" || this.selectedCptId == null) {
655
760
  this.$message.error("请选择需要复制的行");
@@ -727,7 +832,196 @@ export default {
727
832
  this.$refs.tDevCptParamTemplateTableRef.refresh();
728
833
  })
729
834
 
730
- }
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执行脚本。<br><b>自带参数:</b>paramObj, paramTemplateObj' +
883
+ '<br><b>示例1-参数:</b>"\${InputSize.value}" != ""<br><b>示例2-自带参数:</b>paramTemplateObj.attrs.length>0'
884
+ }, {
885
+ prop: 'fdComment',
886
+ label: '备注',
887
+ type: 'input',
888
+ width: 100,
889
+ }
890
+ ];
891
+ let tableOpt = {
892
+ title: "组件脚本",
893
+ columns: columns,
894
+ editPk: "fdId", //默认fdId
895
+ deletePk: "fdId", // 默认fdId
896
+ dataUrl: "/apd/TDevCptScript/getTDevCptScriptGridList",
897
+ saveUrl: "/apd/TDevCptScript/saveTDevCptScriptGridData",
898
+ deleteUrl: "/apd/TDevCptScript/deleteTDevCptScriptGridData",
899
+ toolbarBtn: [{
900
+ btnType: "primary", text: "异常筛选", icon: "el-icon-copy", onClick: () => {
901
+ this.isErrorScript = "1";
902
+ this.$refs.tDevCptScriptRef.refresh();
903
+ }
904
+ }, {
905
+ btnType: "primary", text: "复制", icon: "el-icon-copy", onClick: () => {
906
+ this.copyScript()
907
+ }
908
+ }, "separator", "add", "edit", "del", "cancel", "refresh", "save"],
909
+ initData: false, // 默认false
910
+ showPagination: false,
911
+ afterLoadData: () => {
912
+ this.isErrorScript = "0";
913
+ },
914
+ addDefaultObj: () => {
915
+ return {
916
+ fdCptId: this.selectedCptId
917
+ }
918
+ },
919
+ params: () => {
920
+ return {
921
+ cptId: this.selectedCptId,
922
+ isErrorScript: this.isErrorScript
923
+ }
924
+ },
925
+ rowDblClickEvent: (row, column, event) => {
926
+ this.$refs.tDevCptScriptRef.toggleEditRow(row);
927
+ },
928
+ afterSave: this.refreshScriptTable,
929
+ afterAll: () => {
930
+ if (this.insertScriptId == null || this.insertScriptId == "") {
931
+ return;
932
+ }
933
+ this.$refs.tDevCptScriptRef.toggleRowSelectionByRowKey(this.insertScriptId, true);
934
+ this.insertScriptId = "";
935
+ }
936
+ };
937
+ return tableOpt;
938
+ },
939
+ // 刷新脚本相关表格
940
+ refreshScriptTable() {
941
+ console.log("刷新外部表格");
942
+ this.$refs.tDevCptParamTableRef.refresh();
943
+ this.$refs.tDevCptTemplateTableRef.refresh();
944
+ this.$refs.tDevCptParamTemplateTableRef.refresh();
945
+ },
946
+ copyText(text, event) {
947
+ clipboard(text, event);
948
+ },
949
+ copyParamValue(code, event) {
950
+ let str = '"${' + code + '.value}"';
951
+ clipboard(str, event);
952
+ },
953
+ insertScript(data) {
954
+ let name = "";
955
+ if (data.fdName.indexOf("事件") > -1) {
956
+ name = "显示事件-" + data.fdName.replace("事件", "");
957
+ } else if (data.fdCode.indexOf("Method") > -1) {
958
+ name = "显示方法-" + data.fdName;
959
+ } else {
960
+ name = "显示-" + data.fdName;
961
+ }
962
+
963
+ let script = "";
964
+ if (data.fdShowType == 2) {
965
+ // 开
966
+ script = '"${' + data.fdCode + '.value}" == "1"';
967
+ } else {
968
+ // 不为空
969
+ script = '"${' + data.fdCode + '.value}" != ""';
970
+ }
971
+ let msg = `确定添加脚本?
972
+ <br><span style="font-weight: bold">名称:</span><span class="ap-color-blue">${name}</span>
973
+ <br><span style="font-weight: bold">脚本:</span><span class="ap-color-blue">${script}</span>`
974
+ this.$confirm(msg, '提示', {
975
+ confirmButtonText: '确定添加',
976
+ cancelButtonText: '取消',
977
+ dangerouslyUseHTMLString: true,
978
+ type: 'warning'
979
+ }).then(() => {
980
+ this.$request({
981
+ url: '/apd/TDevCptScript/insertTDevCptScript',
982
+ method: 'post',
983
+ data: {
984
+ fdCptId: this.selectedCptId,
985
+ fdName: name,
986
+ fdScript: script,
987
+ }
988
+ }).then(response => {
989
+ this.insertScriptId = response.data;
990
+ this.$message.success("添加成功:" + name);
991
+ this.$refs.tDevCptScriptRef.refresh();
992
+ this.refreshScriptTable();
993
+ })
994
+ }).catch(() => {
995
+ this.$message({
996
+ type: 'info',
997
+ message: '已取消添加'
998
+ });
999
+ });
1000
+ },
1001
+ // 复制参数模板
1002
+ copyScript() {
1003
+ let selectedRows = this.$refs.tDevCptScriptRef.getSelection();
1004
+ if (selectedRows.length < 1) {
1005
+ this.$message.error("请选择需要复制的行!");
1006
+ return;
1007
+ }
1008
+ if (selectedRows.length > 1) {
1009
+ this.$message.error("只能选择单行数据进行复制!");
1010
+ return;
1011
+ }
1012
+
1013
+ this.$request({
1014
+ url: '/apd/TDevCptScript/copyScript',
1015
+ method: 'post',
1016
+ data: {
1017
+ scriptId: selectedRows[0].fdId,
1018
+ }
1019
+ }).then(response => {
1020
+ this.$message.success("复制成功");
1021
+ this.$refs.tDevCptScriptRef.refresh();
1022
+ })
1023
+
1024
+ },
731
1025
  }
732
1026
  }
733
1027
  </script>