yuanjia-form-pro-standard 1.1.6-beta5.9 → 1.1.6-beta6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/designer.es.js CHANGED
@@ -176280,7 +176280,7 @@ const _sfc_main$4l = {
176280
176280
  });
176281
176281
  return this.doGetFormData(formDataModelEx, needValidation);
176282
176282
  },
176283
- setFormData(formData, disableChangeEvent = false) {
176283
+ setFormData(formData, disableChangeEvent = false, fullData = {}) {
176284
176284
  let formDataObj = formData;
176285
176285
  if (typeof formData === "string") {
176286
176286
  formDataObj = JSON.parse(formData);
@@ -176290,22 +176290,46 @@ const _sfc_main$4l = {
176290
176290
  this.formDataModel[propName] = deepClone(formDataObj[propName]);
176291
176291
  }
176292
176292
  });
176293
- const fieldContentMap = {};
176294
- if (this.formObj && Object.keys(this.formObj).length > 0) {
176295
- Object.keys(this.formObj).forEach((fieldName) => {
176296
- const fieldObj = this.formObj[fieldName];
176297
- if (fieldObj && fieldObj.content !== void 0) {
176298
- if (fieldObj.value !== void 0 && !Array.isArray(fieldObj.value)) {
176299
- fieldContentMap[fieldName] = {
176300
- value: fieldObj.value,
176301
- content: fieldObj.content
176302
- };
176303
- } else if (Array.isArray(fieldObj.value) && Array.isArray(fieldObj.content)) {
176304
- fieldContentMap[fieldName] = {};
176305
- fieldObj.value.forEach((val, index2) => {
176306
- if (fieldContentMap[fieldName][val] === void 0) {
176307
- fieldContentMap[fieldName][val] = fieldObj.content[index2] || val;
176308
- }
176293
+ if (fullData && typeof fullData === "object" && Object.keys(fullData).length > 0) {
176294
+ const allFields = getAllFieldWidgets(this.formJsonObj.widgetList, false);
176295
+ Object.keys(fullData).forEach((fieldName) => {
176296
+ const fullDataItem = fullData[fieldName];
176297
+ if (!fullDataItem || typeof fullDataItem !== "object") {
176298
+ return;
176299
+ }
176300
+ const { value: value2, content: content2 } = fullDataItem;
176301
+ if (value2 === void 0 || value2 === null || content2 === void 0 || content2 === null) {
176302
+ return;
176303
+ }
176304
+ const matchedField = allFields.find((f) => f.name === fieldName);
176305
+ if (!matchedField || !matchedField.field) {
176306
+ return;
176307
+ }
176308
+ const field = matchedField.field;
176309
+ const fieldType = field.type;
176310
+ if (fieldType !== "select" && fieldType !== "DIYselect") {
176311
+ return;
176312
+ }
176313
+ if (!field.options.optionItems) {
176314
+ field.options.optionItems = [];
176315
+ }
176316
+ let exists = false;
176317
+ if (fieldType === "select") {
176318
+ exists = field.options.optionItems.some((item) => item.value === value2);
176319
+ if (!exists) {
176320
+ field.options.optionItems.push({
176321
+ label: content2,
176322
+ value: value2,
176323
+ disabled: false
176324
+ });
176325
+ }
176326
+ } else if (fieldType === "DIYselect") {
176327
+ exists = field.options.optionItems.some((item) => item.Id === value2 || item.id === value2);
176328
+ if (!exists) {
176329
+ field.options.optionItems.push({
176330
+ Id: value2,
176331
+ Name: content2,
176332
+ disabled: false
176309
176333
  });
176310
176334
  }
176311
176335
  }
@@ -176313,7 +176337,7 @@ const _sfc_main$4l = {
176313
176337
  }
176314
176338
  this.setCEOCDisabledFlag(disableChangeEvent);
176315
176339
  this.broadcast("ContainerItem", "setFormData", [this.formDataModel, disableChangeEvent, this.isCaseEdit]);
176316
- this.broadcast("FieldWidget", "setFormData", [this.formDataModel, disableChangeEvent, this.isCaseEdit, fieldContentMap]);
176340
+ this.broadcast("FieldWidget", "setFormData", [this.formDataModel, disableChangeEvent, this.isCaseEdit]);
176317
176341
  },
176318
176342
  setFormDataEx(formData, disableChangeEvent = false) {
176319
176343
  let formDataObj = formData;
@@ -176864,7 +176888,7 @@ function _sfc_render$4l(_ctx, _cache, $props, $setup, $data, $options) {
176864
176888
  [_directive_loading, $data.formLoading]
176865
176889
  ]);
176866
176890
  }
176867
- var VFormRender = /* @__PURE__ */ _export_sfc(_sfc_main$4l, [["render", _sfc_render$4l], ["__scopeId", "data-v-744f2dc0"]]);
176891
+ var VFormRender = /* @__PURE__ */ _export_sfc(_sfc_main$4l, [["render", _sfc_render$4l], ["__scopeId", "data-v-7a7e01ce"]]);
176868
176892
  var ace$2 = { exports: {} };
176869
176893
  (function(module, exports) {
176870
176894
  (function() {
@@ -236229,13 +236253,13 @@ var Draggable = /* @__PURE__ */ getDefaultExportFromCjs(vuedraggable_umd.exports
236229
236253
  if (typeof window !== "undefined") {
236230
236254
  let loadSvg = function() {
236231
236255
  var body = document.body;
236232
- var svgDom = document.getElementById("__svg__icons__dom__1767697756187__");
236256
+ var svgDom = document.getElementById("__svg__icons__dom__1767756935069__");
236233
236257
  if (!svgDom) {
236234
236258
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
236235
236259
  svgDom.style.position = "absolute";
236236
236260
  svgDom.style.width = "0";
236237
236261
  svgDom.style.height = "0";
236238
- svgDom.id = "__svg__icons__dom__1767697756187__";
236262
+ svgDom.id = "__svg__icons__dom__1767756935069__";
236239
236263
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
236240
236264
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
236241
236265
  }
@@ -237216,8 +237240,7 @@ const _sfc_main$3 = {
237216
237240
  rules: [],
237217
237241
  requestData: [],
237218
237242
  defaultAvatarSrc: "https://static.yuanjia101.com/CRMProjectH5/public/image/avatar.png",
237219
- isSettingValue: false,
237220
- queryingIds: new Set()
237243
+ isSettingValue: false
237221
237244
  };
237222
237245
  },
237223
237246
  computed: {
@@ -237258,35 +237281,6 @@ const _sfc_main$3 = {
237258
237281
  this.initEventHandler();
237259
237282
  this.buildFieldRules();
237260
237283
  this.handleOnCreated();
237261
- this.$nextTick(() => {
237262
- this.off$("setFormData");
237263
- this.on$("setFormData", (params) => {
237264
- const newFormData = params[0];
237265
- const disableChangeEvent = params[1];
237266
- const isCaseEdit = params[2];
237267
- const fieldContentMap = params[3];
237268
- if (!this.subFormItemFlag) {
237269
- if (!!this.getObjectFieldFlag() && !this.designState) {
237270
- const objectModel = this.getObjectModel();
237271
- this.setValue(objectModel === void 0 ? null : objectModel[this.fieldKeyName], disableChangeEvent);
237272
- } else {
237273
- if (this.field.options.disabled === 1) {
237274
- this.setDisabled(!!newFormData[this.fieldKeyName]);
237275
- } else if (this.field.options.disabled === 2 && isCaseEdit) {
237276
- this.setDisabled(!!newFormData[this.fieldKeyName]);
237277
- } else {
237278
- this.setDisabled(false);
237279
- }
237280
- const fieldValue = newFormData[this.fieldKeyName];
237281
- if (fieldValue !== null && fieldValue !== void 0 && fieldValue !== "") {
237282
- this.handleSetFormDataWithContent(fieldValue, fieldContentMap, disableChangeEvent);
237283
- } else {
237284
- this.setValue(fieldValue, disableChangeEvent);
237285
- }
237286
- }
237287
- }
237288
- });
237289
- });
237290
237284
  },
237291
237285
  mounted() {
237292
237286
  this.handleOnMounted();
@@ -237295,156 +237289,6 @@ const _sfc_main$3 = {
237295
237289
  this.unregisterFromRefList();
237296
237290
  },
237297
237291
  methods: {
237298
- isValueInOptions(value2) {
237299
- if (value2 === null || value2 === void 0 || value2 === "") {
237300
- return true;
237301
- }
237302
- const optionItems = this.field.options.optionItems || [];
237303
- if (this.field.options.multiple && Array.isArray(value2)) {
237304
- return value2.every((v) => optionItems.some((item) => item.Id === v || item.id === v));
237305
- }
237306
- return optionItems.some((item) => item.Id === value2 || item.id === value2);
237307
- },
237308
- queryById(idValue) {
237309
- if (!idValue || idValue === "") {
237310
- return;
237311
- }
237312
- if (this.queryingIds.has(idValue)) {
237313
- return;
237314
- }
237315
- if (this.isValueInOptions(idValue)) {
237316
- return;
237317
- }
237318
- this.queryingIds.add(idValue);
237319
- let that = this;
237320
- almLocalStorage.removeItem("formId");
237321
- let header = {};
237322
- const token = almLocalStorage.getItem("token");
237323
- const rToken = almLocalStorage.getItem("rToken");
237324
- const tokenTime = almLocalStorage.getItem("tokenTime");
237325
- if (token !== null)
237326
- header["Authorization"] = "Bearer " + token;
237327
- if (!tokenTime && rToken) {
237328
- header["X-Authorization"] = "Bearer " + rToken;
237329
- }
237330
- this.loading = true;
237331
- let url = null;
237332
- let foundDataSource = false;
237333
- for (let i5 = 0; i5 < this.formatDataSourceList.length && !foundDataSource; i5++) {
237334
- const item = this.formatDataSourceList[i5];
237335
- for (let j5 = 0; j5 < this.widgetList.length && !foundDataSource; j5++) {
237336
- const items = this.widgetList[j5];
237337
- if (this.field.options.name == items.options.name) {
237338
- let dsName = items.options.dsName || null;
237339
- let dsID = items.options.dsID || null;
237340
- if (dsID == item.dataSourceId || dsName == item.uniqueName) {
237341
- url = JSON.parse(JSON.stringify(item));
237342
- foundDataSource = true;
237343
- const request_url = commonGETUrlTranslation("formset/formset_construct_manage");
237344
- const handleSuccess = (result) => {
237345
- var _a2;
237346
- let requestData = ((_a2 = result.data.Data) == null ? void 0 : _a2.Items) || result.data.Data || [];
237347
- if (!Array.isArray(requestData)) {
237348
- requestData = [requestData];
237349
- }
237350
- if (requestData.length > 0) {
237351
- requestData.forEach((dtem) => {
237352
- dtem.label = dtem[url.labelKey] || dtem.Name;
237353
- dtem.value = dtem[url.valueKey] || dtem.Id;
237354
- });
237355
- const existingIds = (that.field.options.optionItems || []).map((item2) => item2.Id || item2.id);
237356
- requestData.forEach((newItem) => {
237357
- const itemId = newItem.Id || newItem.id;
237358
- if (!existingIds.includes(itemId)) {
237359
- if (!that.field.options.optionItems) {
237360
- that.field.options.optionItems = [];
237361
- }
237362
- that.field.options.optionItems.push(newItem);
237363
- }
237364
- });
237365
- }
237366
- that.queryingIds.delete(idValue);
237367
- that.loading = false;
237368
- };
237369
- const handleError = (error2) => {
237370
- console.error("\u67E5\u8BE2\u9009\u9879\u5931\u8D25:", error2);
237371
- that.queryingIds.delete(idValue);
237372
- that.loading = false;
237373
- };
237374
- if (url.requestMethod == "post") {
237375
- axios$1[url.requestMethod](request_url, {
237376
- keywords: idValue
237377
- }, {
237378
- headers: header
237379
- }).then(handleSuccess).catch(handleError);
237380
- } else {
237381
- const idParam = `keywords=${idValue}`;
237382
- const baseUrl = url.requestURL || "";
237383
- const queryUrl = baseUrl.includes("?") ? `${baseUrl}&${idParam}` : `${baseUrl}?${idParam}`;
237384
- axios$1[url.requestMethod](queryUrl, {
237385
- headers: header
237386
- }).then(handleSuccess).catch(handleError);
237387
- }
237388
- }
237389
- }
237390
- }
237391
- }
237392
- if (!foundDataSource) {
237393
- this.queryingIds.delete(idValue);
237394
- this.loading = false;
237395
- }
237396
- },
237397
- handleSetFormDataWithContent(fieldValue, fieldContentMap, disableChangeEvent = false) {
237398
- if (!fieldContentMap) {
237399
- this.setValue(fieldValue, disableChangeEvent);
237400
- return;
237401
- }
237402
- const fieldName = this.field.options.name;
237403
- const contentInfo = fieldContentMap[fieldName];
237404
- if (!contentInfo) {
237405
- this.setValue(fieldValue, disableChangeEvent);
237406
- return;
237407
- }
237408
- if (this.field.options.multiple && Array.isArray(fieldValue)) {
237409
- const missingValues = fieldValue.filter((v) => v !== null && v !== void 0 && v !== "" && !this.isValueInOptions(v));
237410
- if (missingValues.length > 0 && typeof contentInfo === "object" && !Array.isArray(contentInfo)) {
237411
- missingValues.forEach((value2) => {
237412
- const content2 = contentInfo[value2];
237413
- if (content2 && !this.isValueInOptions(value2)) {
237414
- this.addOptionFromContent(value2, content2);
237415
- }
237416
- });
237417
- }
237418
- } else if (!this.isValueInOptions(fieldValue)) {
237419
- const content2 = typeof contentInfo === "object" && !Array.isArray(contentInfo) ? contentInfo[fieldValue] : contentInfo.content || contentInfo;
237420
- if (content2) {
237421
- this.addOptionFromContent(fieldValue, content2);
237422
- }
237423
- }
237424
- this.setValue(fieldValue, disableChangeEvent);
237425
- },
237426
- addOptionFromContent(value2, content2) {
237427
- if (!value2 || value2 === "") {
237428
- return;
237429
- }
237430
- const existingIds = (this.field.options.optionItems || []).map((item) => item.Id || item.id);
237431
- if (existingIds.includes(value2)) {
237432
- return;
237433
- }
237434
- const newOption = {
237435
- Id: value2,
237436
- id: value2,
237437
- Name: content2 || String(value2),
237438
- name: content2 || String(value2),
237439
- label: content2 || String(value2),
237440
- value: value2,
237441
- Avatar: this.defaultAvatarSrc
237442
- };
237443
- if (!this.field.options.optionItems) {
237444
- this.field.options.optionItems = [];
237445
- }
237446
- this.field.options.optionItems.push(newOption);
237447
- },
237448
237292
  setValue(newValue, disableChangeEvent = false) {
237449
237293
  if (!!this.field.formItemFlag) {
237450
237294
  this.isSettingValue = true;
@@ -237457,13 +237301,6 @@ const _sfc_main$3 = {
237457
237301
  }
237458
237302
  this.oldFieldValue = newValue;
237459
237303
  this.clearValidate();
237460
- const valuesToCheck = this.field.options.multiple && Array.isArray(newValue) ? newValue : newValue !== null && newValue !== void 0 ? [newValue] : [];
237461
- const missingValues = valuesToCheck.filter((v) => v !== null && v !== void 0 && v !== "" && !this.isValueInOptions(v));
237462
- if (missingValues.length > 0) {
237463
- missingValues.forEach((id2) => {
237464
- this.queryById(id2);
237465
- });
237466
- }
237467
237304
  this.isSettingValue = false;
237468
237305
  }
237469
237306
  },
@@ -237618,7 +237455,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
237618
237455
  __: [2]
237619
237456
  }, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
237620
237457
  }
237621
- var SelectWidget = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-2408940e"]]);
237458
+ var SelectWidget = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-2ffe261c"]]);
237622
237459
  var DIYtableWidget_vue_vue_type_style_index_0_scoped_true_lang = "";
237623
237460
  const _sfc_main$2 = {
237624
237461
  name: "DIYtable-widget",