cloud-web-corejs 1.0.325 → 1.0.327

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.
@@ -93,7 +93,7 @@
93
93
  </div>
94
94
  </div>
95
95
  <div
96
- v-if="!field.options.disabled"
96
+ v-if="!field.options.disabled && showUploadBtn"
97
97
  class="el-upload el-upload--picture"
98
98
  style="vertical-align: middle; display: inline-block; float: left"
99
99
  >
@@ -102,7 +102,9 @@
102
102
  class="upload-demo"
103
103
  action="https://jsonplaceholder.typicode.com/posts/"
104
104
  :http-request="uploadSectionFile"
105
- :limit="1"
105
+ :multiple="isMulti"
106
+ :limit="pickLimit"
107
+ :on-exceed="handleUploadExceed"
106
108
  >
107
109
  <button type="button" class="avatar-uploader">
108
110
  <i class="el-icon-plus avatar-uploader-icon"></i>
@@ -126,6 +128,99 @@ import FormItemWrapper from "./form-item-wrapper";
126
128
  import emitter from "../../../../../components/xform/utils/emitter";
127
129
  import i18n from "../../../../../components/xform/utils/i18n";
128
130
  import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
131
+ import settingConfig from "@/settings.js";
132
+
133
+ const BATCH_UPLOAD_API = "/api/v1.0/FileOperation/BatchUploadFilesFromPortal";
134
+ /** 全部处理完显示 100 后,再停一会儿关闭加载。 */
135
+ const HX_UPLOAD_DONE_DELAY = 200;
136
+
137
+ function parseJsonValue(value) {
138
+ if (value == null || value === "") return null;
139
+ if (typeof value === "object") return value;
140
+ if (typeof value !== "string") return null;
141
+ try {
142
+ return JSON.parse(value);
143
+ } catch (e) {
144
+ return null;
145
+ }
146
+ }
147
+
148
+ /** 配置仍返回旧地址时,换成批量上传;已是批量地址则原样使用。 */
149
+ function resolveBatchUploadUrl(domain, uploadApi) {
150
+ let api = uploadApi || "";
151
+ if (!/BatchUploadFilesFromPortal/i.test(api)) {
152
+ if (/UploadFilesFromPortal/i.test(api)) {
153
+ api = api.replace(/UploadFilesFromPortal/i, "BatchUploadFilesFromPortal");
154
+ } else {
155
+ api = BATCH_UPLOAD_API;
156
+ }
157
+ }
158
+ return (domain || "") + api;
159
+ }
160
+
161
+ /** settings.hxFileLocalProxyEnabled 打开且处于 npm run dev 时,把海信绝对地址改写到本地 /hx-file。 */
162
+ function toDevProxyUrl(absoluteUrl) {
163
+ if (settingConfig.hxFileLocalProxyEnabled !== true) return absoluteUrl;
164
+ if (process.env.NODE_ENV !== "development") return absoluteUrl;
165
+ if (typeof window === "undefined" || !absoluteUrl) return absoluteUrl;
166
+ if (!/^https?:\/\//i.test(absoluteUrl)) return absoluteUrl;
167
+ try {
168
+ const parsed = new URL(absoluteUrl);
169
+ return (
170
+ window.location.origin +
171
+ "/hx-file/" +
172
+ parsed.host +
173
+ parsed.pathname +
174
+ parsed.search
175
+ );
176
+ } catch (e) {
177
+ return absoluteUrl;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * 批量接口一次只带一个文件(requests[0])。
183
+ * 外层 code=1000 只表示批次受理,需看明细 code;外层 2020 视为整批失败。
184
+ */
185
+ function adaptHisenseBatchUploadResponse(responseData) {
186
+ const body = responseData || {};
187
+ const outerCode = Number(body.code);
188
+ const fail = (message) => ({
189
+ success: false,
190
+ message: message || this.$t1('上传失败'),
191
+ fullResponse: body,
192
+ data: null,
193
+ });
194
+ if (outerCode !== 1000) {
195
+ return fail(body.message);
196
+ }
197
+ const parsed = parseJsonValue(body.data);
198
+ if (parsed && !Array.isArray(parsed) && parsed.filename) {
199
+ return {
200
+ success: true,
201
+ message: body.message || "ok",
202
+ fullResponse: body,
203
+ data: parsed,
204
+ };
205
+ }
206
+ if (!Array.isArray(parsed) || !parsed.length) {
207
+ return fail(body.message);
208
+ }
209
+ const item = parsed[0] || {};
210
+ if (Number(item.code) !== 1000) {
211
+ return fail(item.message || body.message);
212
+ }
213
+ const fileInfo = parseJsonValue(item.data);
214
+ if (!fileInfo) {
215
+ return fail(item.message || body.message);
216
+ }
217
+ return {
218
+ success: true,
219
+ message: item.message || "ok",
220
+ fullResponse: body,
221
+ data: fileInfo,
222
+ };
223
+ }
129
224
 
130
225
  export default {
131
226
  name: "vabUpload2-widget",
@@ -157,25 +252,7 @@ export default {
157
252
  },
158
253
  responseAdapter: {
159
254
  type: Function,
160
- default(responseData, file) {
161
- // 默认适配器:假设返回格式为
162
- /* {
163
- "code": 1000,
164
- "message": "ok",
165
- "data": "{\"name\":\"8aafaaad-f033-4f46-a8f3-fe2639204f6a-source.jpg\",\"size\":186847,\"date\":1754711199966,\"id\":\"f3056c29-f65a-4d1b-8778-c2df5fa53775\",\"filename\":\"f3056c29-f65a-4d1b-8778-c2df5fa53775.jpg\",\"user\":\"1\",\"type\":\"工单\",\"url\":\"\"}"
166
- } */
167
- let data = null;
168
- if (responseData.code === 1000 && responseData.data) {
169
- data = JSON.parse(responseData.data);
170
- }
171
- return {
172
- success: responseData.code === 1000,
173
- // url: responseData.objx?.url,
174
- message: responseData.message || "success",
175
- fullResponse: responseData,
176
- data: data,
177
- };
178
- },
255
+ default: adaptHisenseBatchUploadResponse,
179
256
  },
180
257
  },
181
258
  components: {
@@ -201,6 +278,7 @@ export default {
201
278
  showViewer: false,
202
279
  ownedBlobUrls: [],
203
280
  componentDestroyed: false,
281
+ uploadingCount: 0,
204
282
  };
205
283
  },
206
284
  watch: {
@@ -213,6 +291,33 @@ export default {
213
291
  let formRef = this.getFormRef();
214
292
  return formRef.dataId;
215
293
  },
294
+ /* 与 baseUpload 一致:空 / 0 不限制,1 为单文件,大于 1 为上限 */
295
+ uploadLimit() {
296
+ let limit = this.field.options.limit;
297
+ if (limit === null || limit === undefined || limit === "") return null;
298
+ let num = Number(limit);
299
+ return num > 0 ? num : null;
300
+ },
301
+ isMulti() {
302
+ return this.uploadLimit !== 1;
303
+ },
304
+ attachmentCount() {
305
+ return Array.isArray(this.fieldModel) ? this.fieldModel.length : 0;
306
+ },
307
+ showUploadBtn() {
308
+ let size = this.attachmentCount + this.uploadingCount;
309
+ if (!this.isMulti) {
310
+ return size === 0;
311
+ }
312
+ return this.uploadLimit ? this.uploadLimit > size : true;
313
+ },
314
+ /* 单文件限 1;有上限时限剩余名额;不限制时不传 limit,文件框可多选 */
315
+ pickLimit() {
316
+ if (!this.isMulti) return 1;
317
+ if (!this.uploadLimit) return undefined;
318
+ let remain = this.uploadLimit - this.attachmentCount - this.uploadingCount;
319
+ return remain > 0 ? remain : 1;
320
+ },
216
321
  },
217
322
  beforeCreate() {
218
323
  /* 这里不能访问方法和属性!! */
@@ -239,6 +344,7 @@ export default {
239
344
 
240
345
  beforeDestroy() {
241
346
  this.componentDestroyed = true;
347
+ this.closeHxUploadLoading();
242
348
  this.revokeOwnedBlobUrls();
243
349
  this.unregisterFromRefList();
244
350
  },
@@ -425,10 +531,12 @@ export default {
425
531
  let token = objx.apiToken;
426
532
  if (token) {
427
533
  this.token = token;
428
- this.uploadUrl = objx.domain + objx.uploadApi;
429
- this.deleteUrl = objx.domain + objx.deleteApi;
534
+ this.uploadUrl = toDevProxyUrl(
535
+ resolveBatchUploadUrl(objx.domain, objx.uploadApi)
536
+ );
537
+ this.deleteUrl = toDevProxyUrl(objx.domain + objx.deleteApi);
430
538
  // https://crm-dev.hisense.com/api/v1.0/fileoperation/GetFile?fileName=e24a1ad9-6821-41c3-957c-0916077bb97f.jpg
431
- this.viewApiUrl = objx.domain + objx.viewApi;
539
+ this.viewApiUrl = toDevProxyUrl(objx.domain + objx.viewApi);
432
540
  // this.initShowUrl();
433
541
  // this.initCustomConfig();
434
542
  }
@@ -498,8 +606,9 @@ export default {
498
606
  let source;
499
607
 
500
608
  var form = new FormData();
501
- // 文件对象
502
- form.append("file", fileObj);
609
+ // 一个文件一次请求,索引固定为 0
610
+ const fieldPrefix = "requests[0].";
611
+ form.append(fieldPrefix + "File", fileObj);
503
612
 
504
613
  let customParam = {};
505
614
  let entityId = this.formDataId;
@@ -517,8 +626,10 @@ export default {
517
626
  Object.assign(customParam, uploadParam);
518
627
  if (customParam) {
519
628
  Object.keys(customParam).forEach((key) => {
629
+ if (key === "file" || key === "File") return;
630
+ let fieldKey = key.indexOf("requests[") === 0 ? key : fieldPrefix + key;
520
631
  let value = customParam[key];
521
- form.append(key, value);
632
+ form.append(fieldKey, value);
522
633
  });
523
634
  }
524
635
 
@@ -530,13 +641,28 @@ export default {
530
641
 
531
642
  let isLoading = uploadConfig?.isLoading === true;
532
643
  var uploadUrl = this.uploadUrl;
644
+ if (!isCustom && !this.showUploadBtn) {
645
+ target && target.clearFiles();
646
+ return;
647
+ }
533
648
  target.clearFiles();
534
649
  if (uploadUrl) {
650
+ let fileOrder = 0;
651
+ if (!isCustom) {
652
+ if (this.uploadingCount === 0) {
653
+ this.hxUploadTotal = 0;
654
+ this.openHxUploadLoading();
655
+ }
656
+ this.uploadingCount++;
657
+ this.hxUploadTotal++;
658
+ fileOrder = this.hxUploadTotal;
659
+ }
535
660
  var abort;
536
661
 
537
662
  let config = {
538
663
  useToken: false,
539
- isLoading: true,
664
+ // 串行时每个请求单独 isLoading,上一个的延迟关闭会把后一个的遮罩关掉,中间空一截
665
+ isLoading: false,
540
666
  headers: {
541
667
  "Content-Type": "multipart/form-data",
542
668
  Authorization: `Bearer ${this.token}`,
@@ -548,12 +674,14 @@ export default {
548
674
  }
549
675
  }), */
550
676
  onUploadProgress: (progressEvent) => {
677
+ const percent = progressEvent.total
678
+ ? Math.floor((progressEvent.loaded * 100) / progressEvent.total)
679
+ : 0;
551
680
  if (isCustom || file) {
552
- // progressEvent.loaded:已上传文件大小
553
- // progressEvent.total:被上传文件的总大小
554
- progressEvent.percent = Math.floor(
555
- (progressEvent.loaded * 100) / progressEvent.total
556
- );
681
+ progressEvent.percent = percent;
682
+ }
683
+ if (!isCustom) {
684
+ this.setHxUploadProgress(fileOrder, percent);
557
685
  }
558
686
  },
559
687
  failMsg: false,
@@ -563,31 +691,139 @@ export default {
563
691
  config = extendDeeply(config, config.httpConfig);
564
692
  }
565
693
 
566
- let req = this.getFormRef()
567
- .$http.post(uploadUrl, form, config)
568
- .then((res1) => {
569
- uploadConfig && uploadConfig.callback && uploadConfig.callback(res1, fileObj);
694
+ this.enqueueHxUpload(() => {
695
+ if (this.componentDestroyed || !this.getFormRef()) {
696
+ this.finishHxUpload(!isCustom);
697
+ return;
698
+ }
699
+ if (!isCustom) {
700
+ this.setHxUploadProgress(fileOrder, 0);
701
+ }
702
+ let batchDone = false;
703
+ return this.getFormRef()
704
+ .$http.post(uploadUrl, form, config)
705
+ .then((res1) => {
706
+ if (this.componentDestroyed) return;
707
+ const isLast = !isCustom && this.uploadingCount <= 1;
708
+ if (isLast) {
709
+ this.setHxUploadPercentText(99);
710
+ }
711
+ uploadConfig && uploadConfig.callback && uploadConfig.callback(res1, fileObj);
570
712
 
571
- const adaptedResponse = this.responseAdapter(res1);
713
+ const adaptedResponse = this.responseAdapter(res1);
572
714
 
573
- if (!isCustom) {
574
- if (adaptedResponse.success) {
575
- // this.initShowImageUrl(adaptedResponse.data)
576
- if (adaptedResponse.data) {
577
- let fileInfo = {
578
- ...adaptedResponse.data,
579
- showUrl: null,
580
- };
581
- this.fieldModel.push(fileInfo);
582
- // this.initShowUrl();
715
+ if (!isCustom) {
716
+ if (adaptedResponse.success) {
717
+ // this.initShowImageUrl(adaptedResponse.data)
718
+ if (adaptedResponse.data) {
719
+ let fileInfo = {
720
+ ...adaptedResponse.data,
721
+ showUrl: null,
722
+ };
723
+ this.appendUploadedFile(fileInfo);
724
+ // this.initShowUrl();
725
+ }
726
+ batchDone = isLast;
727
+ } else {
728
+ if (isLast) {
729
+ this.closeHxUploadLoading();
730
+ }
731
+ // param.onError(new Error(res1.content || '上传异常'));
732
+ this.$baseAlert(adaptedResponse.message);
583
733
  }
584
- } else {
585
- // param.onError(new Error(res1.content || '上传异常'));
586
- this.$baseAlert(adaptedResponse.message);
587
734
  }
588
- }
589
- });
735
+ })
736
+ .finally(() => {
737
+ return this.finishHxUpload(!isCustom, batchDone);
738
+ });
739
+ });
740
+ }
741
+ },
742
+ /**
743
+ * 同一控件内串行上传。上一次请求结束后立刻发下一次,
744
+ * 避免海信回写工单字段时后一次覆盖前一次。
745
+ */
746
+ enqueueHxUpload(task) {
747
+ if (!this.hxUploadChain) {
748
+ this.hxUploadChain = Promise.resolve();
749
+ }
750
+ const scheduled = this.hxUploadChain.then(() => task());
751
+ this.hxUploadChain = scheduled.catch(() => {});
752
+ return scheduled;
753
+ },
754
+ openHxUploadLoading() {
755
+ if (this.hxUploadLoading) return;
756
+ this.hxUploadLoading = this.$baseLoading({
757
+ target: document.body,
758
+ background: "unset",
759
+ customClass: "hx-upload-loading",
760
+ text: "",
761
+ });
762
+ },
763
+ setHxUploadProgress(index, percent) {
764
+ if (!this.hxUploadLoading || typeof this.hxUploadLoading.setText !== "function") {
765
+ return;
766
+ }
767
+ const total = this.hxUploadTotal || 1;
768
+ const safePercent = Number.isFinite(percent) ? Math.min(percent, 98) : 0;
769
+ const text = total > 1 ? `${index}/${total}` : `${safePercent}%`;
770
+ this.hxUploadLoading.setText(text);
771
+ },
772
+ setHxUploadPercentText(percent) {
773
+ if (!this.hxUploadLoading || typeof this.hxUploadLoading.setText !== "function") {
774
+ return;
590
775
  }
776
+ this.hxUploadLoading.setText(`${percent}%`);
777
+ },
778
+ closeHxUploadLoading() {
779
+ const loading = this.hxUploadLoading;
780
+ if (!loading) return;
781
+ this.hxUploadLoading = null;
782
+ loading.close();
783
+ },
784
+ finishHxUpload(counted, showDone) {
785
+ if (!counted) return;
786
+ this.uploadingCount = Math.max(0, this.uploadingCount - 1);
787
+ if (this.uploadingCount !== 0) return;
788
+ if (!showDone) {
789
+ this.closeHxUploadLoading();
790
+ return;
791
+ }
792
+ this.setHxUploadPercentText(100);
793
+ return new Promise((resolve) => {
794
+ setTimeout(() => {
795
+ this.closeHxUploadLoading();
796
+ resolve();
797
+ }, HX_UPLOAD_DONE_DELAY);
798
+ });
799
+ },
800
+ handleUploadExceed(files) {
801
+ let limit = this.pickLimit || this.uploadLimit;
802
+ let errorMsg = this.$t1('当前限制选择 {p0} 个文件,本次选择了 {p1} 个文件', { p0: limit, p1: files.length });
803
+ this.$message({
804
+ message: this.$t2(errorMsg, "components.VabUpload.warnMsg2", {
805
+ limit,
806
+ size: files.length,
807
+ }),
808
+ type: "error",
809
+ duration: 5 * 1000,
810
+ });
811
+ },
812
+ appendUploadedFile(fileInfo) {
813
+ if (!Array.isArray(this.fieldModel)) {
814
+ this.fieldModel = [];
815
+ }
816
+ if (!this.isMulti) {
817
+ this.fieldModel.forEach((item) => {
818
+ this.revokeBlobUrl(item && (item.showUrl || item.url));
819
+ });
820
+ this.fieldModel = [fileInfo];
821
+ return;
822
+ }
823
+ if (this.uploadLimit && this.fieldModel.length >= this.uploadLimit) {
824
+ return;
825
+ }
826
+ this.fieldModel.push(fileInfo);
591
827
  },
592
828
  initShowImageUrl(attachment, callback) {
593
829
  let filename = attachment.filename;
@@ -674,41 +910,41 @@ export default {
674
910
  throw new TypeError("输入必须是字符串格式");
675
911
  }
676
912
  if (!fileUrl.trim()) {
677
- throw new Error("URL不能为空");
913
+ throw new Error(this.$t1('URL不能为空'));
678
914
  }
679
915
 
680
916
  // 基本URL格式验证
681
917
  const urlRegex = /^(https?:\/\/)?([\w.-]+)(:\d+)?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i;
682
918
  if (!urlRegex.test(fileUrl)) {
683
- throw new Error("无效的URL格式");
919
+ throw new Error(this.$t1('无效的URL格式'));
684
920
  }
685
921
 
686
922
  // 提取域名部分
687
923
  const domainRegex = /^(https?:\/\/[^\/]+)/i;
688
924
  const domainMatch = fileUrl.match(domainRegex);
689
925
  if (!domainMatch) {
690
- throw new Error("URL缺少协议或域名部分");
926
+ throw new Error(this.$t1('URL缺少协议或域名部分'));
691
927
  }
692
928
  const domain = domainMatch[0];
693
929
 
694
930
  // 提取完整路径
695
931
  const url = fileUrl.substring(domain.length);
696
932
  if (!url || url === "/") {
697
- throw new Error("URL缺少文件路径部分");
933
+ throw new Error(this.$t1('URL缺少文件路径部分'));
698
934
  }
699
935
 
700
936
  // 提取带扩展名的文件名
701
937
  const filenameRegex = /[^\/]+$/;
702
938
  const filenameMatch = url.match(filenameRegex);
703
939
  if (!filenameMatch) {
704
- throw new Error("无法从路径中提取文件名");
940
+ throw new Error(this.$t1('无法从路径中提取文件名'));
705
941
  }
706
942
  const fullFilename = filenameMatch[0];
707
943
 
708
944
  // 验证文件名格式(至少1字符+扩展名)
709
945
  const nameFormat = /^.+\..+$/;
710
946
  if (!nameFormat.test(fullFilename)) {
711
- throw new Error(`无效的文件名格式: ${fullFilename}`);
947
+ throw new Error(this.$t1('无效的文件名格式: {p0}', { p0: fullFilename }));
712
948
  }
713
949
 
714
950
  // 修复点:更可靠的文件名和扩展名分离
@@ -775,3 +1011,33 @@ export default {
775
1011
  }
776
1012
  }
777
1013
  </style>
1014
+
1015
+ <style lang="scss">
1016
+ /* 进度写在转圈中间。全局 spinner 被 zoom:2 放大,这里单独收回来,避免文字掉到圈外。 */
1017
+ body .el-loading-mask.hx-upload-loading .el-loading-spinner {
1018
+ zoom: 1;
1019
+ margin-top: -42px;
1020
+
1021
+ .circular {
1022
+ width: 84px;
1023
+ height: 84px;
1024
+ }
1025
+
1026
+ .el-loading-text {
1027
+ zoom: 1;
1028
+ position: absolute;
1029
+ left: 50%;
1030
+ top: 42px;
1031
+ width: 52px;
1032
+ margin: 0;
1033
+ padding: 0;
1034
+ transform: translate(-50%, -50%);
1035
+ font-size: 14px;
1036
+ line-height: 1;
1037
+ text-align: center;
1038
+ white-space: nowrap;
1039
+ overflow: hidden;
1040
+ color: #409eff;
1041
+ }
1042
+ }
1043
+ </style>
@@ -241,6 +241,58 @@ modules = {
241
241
  this.eventHandlerCode =
242
242
  " /* sample code */\n /*\n if ((value > 100) || (value < 0)) {\n callback(new Error('error message')) //fail\n } else {\n callback(); //pass\n }\n */";
243
243
  }
244
+ if (eventName === "lazyParamScript" && !this.optionModel["lazyParamScript"]) {
245
+ this.eventHandlerCode =
246
+ " /* 展开节点请求下一级时执行。根节点 row 为 null,level 为 null。\n" +
247
+ " level:0 省、1 市、2 区、3 镇(当前展开节点)。\n" +
248
+ " pathRows / levels 为从根到当前展开节点的各级完整行。返回对象并入 data。 */\n" +
249
+ " if (!row) return {};\n" +
250
+ " return {\n" +
251
+ " f_code: row.f_code\n" +
252
+ " };";
253
+ }
254
+ if (
255
+ eventName === "onSelect" &&
256
+ selectedWidget &&
257
+ selectedWidget.type === "cascader" &&
258
+ !this.optionModel["onSelect"]
259
+ ) {
260
+ this.eventHandlerCode =
261
+ " /* item 为选中节点。清空走 onClear,不会进这里。\n" +
262
+ " item.level:0 省、1 市、2 区、3 镇。\n" +
263
+ " item.data 为当前选中行;item.pathRows / item.levels 为各级完整行。 */";
264
+ }
265
+ if (eventName === "onLazyLoad" && !this.optionModel["onLazyLoad"]) {
266
+ this.eventHandlerCode =
267
+ " /* 启用「请求访问」时不会走这里。\n" +
268
+ " node.level === 0 为根节点,否则 node.value 为父级。\n" +
269
+ " 末级节点设置 leaf: true。必须调用 resolve。\n" +
270
+ " 回显值须为各级 value 组成的数组。isLoading 请保持 false。 */\n" +
271
+ " var parentValue = node.level === 0 ? null : node.value;\n" +
272
+ " var labelKey = this.field.options.labelKey || \"label\";\n" +
273
+ " var valueKey = this.field.options.valueKey || \"value\";\n" +
274
+ " this.formHttp({\n" +
275
+ " scriptCode: this.field.options.formScriptCode || \"getList\",\n" +
276
+ " isLoading: false,\n" +
277
+ " data: this.buildFormScriptData(this.getFormRef().reportTemplate, {\n" +
278
+ " parentValue: parentValue,\n" +
279
+ " level: node.level\n" +
280
+ " }),\n" +
281
+ " callback: (res) => {\n" +
282
+ " var rows = (res.objx && res.objx.records) || res.objx || [];\n" +
283
+ " resolve(rows.map(function (item) {\n" +
284
+ " var row = {};\n" +
285
+ " row[labelKey] = item[labelKey];\n" +
286
+ " row[valueKey] = item[valueKey];\n" +
287
+ " if (item.leaf != null) row.leaf = !!item.leaf;\n" +
288
+ " else if (item.hasChildren != null) row.leaf = !item.hasChildren;\n" +
289
+ " return row;\n" +
290
+ " }));\n" +
291
+ " },\n" +
292
+ " fail: function () { resolve([]); },\n" +
293
+ " error: function () { resolve([]); }\n" +
294
+ " });";
295
+ }
244
296
  /*} else {
245
297
  this.eventHeader = `formSetting.${eventName}(${eventParams.join(', ')}) {`;
246
298
  }*/
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <el-form-item label="onClear" label-width="150px">
3
+ <a href="javascript:void(0);" class="a-link link-oneLind" @click="editEventHandler('onClear', eventParams)">
4
+ <span>{{ optionModel.onClear }}</span>
5
+ <i class="el-icon-edit"></i>
6
+ </a>
7
+ </el-form-item>
8
+ </template>
9
+
10
+ <script>
11
+ import i18n from "../../../../../../components/xform/utils/i18n";
12
+ import eventMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin";
13
+
14
+ export default {
15
+ name: "onClear-editor",
16
+ mixins: [i18n, eventMixin],
17
+ props: {
18
+ designer: Object,
19
+ selectedWidget: Object,
20
+ optionModel: Object,
21
+ },
22
+ data() {
23
+ return {
24
+ eventParams: ["dataId", "formCode", "rowData", "rowIndex"],
25
+ };
26
+ },
27
+ };
28
+ </script>
29
+
30
+ <style scoped></style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <el-form-item v-if="optionModel.lazy" label="onLazyLoad" label-width="150px">
3
+ <a
4
+ href="javascript:void(0);"
5
+ class="a-link link-oneLind"
6
+ @click="editEventHandler('onLazyLoad', eventParams)"
7
+ >
8
+ <span>{{ optionModel.onLazyLoad }}</span>
9
+ <i class="el-icon-edit"></i>
10
+ </a>
11
+ </el-form-item>
12
+ </template>
13
+
14
+ <script>
15
+ import i18n from "../../../../../../components/xform/utils/i18n";
16
+ import eventMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin";
17
+
18
+ export default {
19
+ name: "onLazyLoad-editor",
20
+ mixins: [i18n, eventMixin],
21
+ props: {
22
+ designer: Object,
23
+ selectedWidget: Object,
24
+ optionModel: Object,
25
+ },
26
+ data() {
27
+ return {
28
+ eventParams: ["node", "resolve"],
29
+ };
30
+ },
31
+ };
32
+ </script>
33
+
34
+ <style scoped></style>