yuanjia-form-pro-standard 1.1.6-beta5.8 → 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,6 +176290,51 @@ const _sfc_main$4l = {
176290
176290
  this.formDataModel[propName] = deepClone(formDataObj[propName]);
176291
176291
  }
176292
176292
  });
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
176333
+ });
176334
+ }
176335
+ }
176336
+ });
176337
+ }
176293
176338
  this.setCEOCDisabledFlag(disableChangeEvent);
176294
176339
  this.broadcast("ContainerItem", "setFormData", [this.formDataModel, disableChangeEvent, this.isCaseEdit]);
176295
176340
  this.broadcast("FieldWidget", "setFormData", [this.formDataModel, disableChangeEvent, this.isCaseEdit]);
@@ -176843,7 +176888,7 @@ function _sfc_render$4l(_ctx, _cache, $props, $setup, $data, $options) {
176843
176888
  [_directive_loading, $data.formLoading]
176844
176889
  ]);
176845
176890
  }
176846
- var VFormRender = /* @__PURE__ */ _export_sfc(_sfc_main$4l, [["render", _sfc_render$4l], ["__scopeId", "data-v-262aff17"]]);
176891
+ var VFormRender = /* @__PURE__ */ _export_sfc(_sfc_main$4l, [["render", _sfc_render$4l], ["__scopeId", "data-v-7a7e01ce"]]);
176847
176892
  var ace$2 = { exports: {} };
176848
176893
  (function(module, exports) {
176849
176894
  (function() {
@@ -236208,13 +236253,13 @@ var Draggable = /* @__PURE__ */ getDefaultExportFromCjs(vuedraggable_umd.exports
236208
236253
  if (typeof window !== "undefined") {
236209
236254
  let loadSvg = function() {
236210
236255
  var body = document.body;
236211
- var svgDom = document.getElementById("__svg__icons__dom__1767696823562__");
236256
+ var svgDom = document.getElementById("__svg__icons__dom__1767756935069__");
236212
236257
  if (!svgDom) {
236213
236258
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
236214
236259
  svgDom.style.position = "absolute";
236215
236260
  svgDom.style.width = "0";
236216
236261
  svgDom.style.height = "0";
236217
- svgDom.id = "__svg__icons__dom__1767696823562__";
236262
+ svgDom.id = "__svg__icons__dom__1767756935069__";
236218
236263
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
236219
236264
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
236220
236265
  }
@@ -237195,8 +237240,7 @@ const _sfc_main$3 = {
237195
237240
  rules: [],
237196
237241
  requestData: [],
237197
237242
  defaultAvatarSrc: "https://static.yuanjia101.com/CRMProjectH5/public/image/avatar.png",
237198
- isSettingValue: false,
237199
- queryingIds: new Set()
237243
+ isSettingValue: false
237200
237244
  };
237201
237245
  },
237202
237246
  computed: {
@@ -237245,105 +237289,6 @@ const _sfc_main$3 = {
237245
237289
  this.unregisterFromRefList();
237246
237290
  },
237247
237291
  methods: {
237248
- isValueInOptions(value2) {
237249
- if (value2 === null || value2 === void 0 || value2 === "") {
237250
- return true;
237251
- }
237252
- const optionItems = this.field.options.optionItems || [];
237253
- if (this.field.options.multiple && Array.isArray(value2)) {
237254
- return value2.every((v) => optionItems.some((item) => item.Id === v || item.id === v));
237255
- }
237256
- return optionItems.some((item) => item.Id === value2 || item.id === value2);
237257
- },
237258
- queryById(idValue) {
237259
- if (!idValue || idValue === "") {
237260
- return;
237261
- }
237262
- if (this.queryingIds.has(idValue)) {
237263
- return;
237264
- }
237265
- if (this.isValueInOptions(idValue)) {
237266
- return;
237267
- }
237268
- this.queryingIds.add(idValue);
237269
- let that = this;
237270
- almLocalStorage.removeItem("formId");
237271
- let header = {};
237272
- const token = almLocalStorage.getItem("token");
237273
- const rToken = almLocalStorage.getItem("rToken");
237274
- const tokenTime = almLocalStorage.getItem("tokenTime");
237275
- if (token !== null)
237276
- header["Authorization"] = "Bearer " + token;
237277
- if (!tokenTime && rToken) {
237278
- header["X-Authorization"] = "Bearer " + rToken;
237279
- }
237280
- this.loading = true;
237281
- let url = null;
237282
- let foundDataSource = false;
237283
- for (let i5 = 0; i5 < this.formatDataSourceList.length && !foundDataSource; i5++) {
237284
- const item = this.formatDataSourceList[i5];
237285
- for (let j5 = 0; j5 < this.widgetList.length && !foundDataSource; j5++) {
237286
- const items = this.widgetList[j5];
237287
- if (this.field.options.name == items.options.name) {
237288
- let dsName = items.options.dsName || null;
237289
- let dsID = items.options.dsID || null;
237290
- if (dsID == item.dataSourceId || dsName == item.uniqueName) {
237291
- url = JSON.parse(JSON.stringify(item));
237292
- foundDataSource = true;
237293
- const request_url = commonGETUrlTranslation("formset/formset_construct_manage");
237294
- const handleSuccess = (result) => {
237295
- var _a2;
237296
- let requestData = ((_a2 = result.data.Data) == null ? void 0 : _a2.Items) || result.data.Data || [];
237297
- if (!Array.isArray(requestData)) {
237298
- requestData = [requestData];
237299
- }
237300
- if (requestData.length > 0) {
237301
- requestData.forEach((dtem) => {
237302
- dtem.label = dtem[url.labelKey] || dtem.Name;
237303
- dtem.value = dtem[url.valueKey] || dtem.Id;
237304
- });
237305
- const existingIds = (that.field.options.optionItems || []).map((item2) => item2.Id || item2.id);
237306
- requestData.forEach((newItem) => {
237307
- const itemId = newItem.Id || newItem.id;
237308
- if (!existingIds.includes(itemId)) {
237309
- if (!that.field.options.optionItems) {
237310
- that.field.options.optionItems = [];
237311
- }
237312
- that.field.options.optionItems.push(newItem);
237313
- }
237314
- });
237315
- }
237316
- that.queryingIds.delete(idValue);
237317
- that.loading = false;
237318
- };
237319
- const handleError = (error2) => {
237320
- console.error("\u67E5\u8BE2\u9009\u9879\u5931\u8D25:", error2);
237321
- that.queryingIds.delete(idValue);
237322
- that.loading = false;
237323
- };
237324
- if (url.requestMethod == "post") {
237325
- axios$1[url.requestMethod](request_url, {
237326
- keywords: idValue
237327
- }, {
237328
- headers: header
237329
- }).then(handleSuccess).catch(handleError);
237330
- } else {
237331
- const idParam = `keywords=${idValue}`;
237332
- const baseUrl = url.requestURL || "";
237333
- const queryUrl = baseUrl.includes("?") ? `${baseUrl}&${idParam}` : `${baseUrl}?${idParam}`;
237334
- axios$1[url.requestMethod](queryUrl, {
237335
- headers: header
237336
- }).then(handleSuccess).catch(handleError);
237337
- }
237338
- }
237339
- }
237340
- }
237341
- }
237342
- if (!foundDataSource) {
237343
- this.queryingIds.delete(idValue);
237344
- this.loading = false;
237345
- }
237346
- },
237347
237292
  setValue(newValue, disableChangeEvent = false) {
237348
237293
  if (!!this.field.formItemFlag) {
237349
237294
  this.isSettingValue = true;
@@ -237356,13 +237301,6 @@ const _sfc_main$3 = {
237356
237301
  }
237357
237302
  this.oldFieldValue = newValue;
237358
237303
  this.clearValidate();
237359
- const valuesToCheck = this.field.options.multiple && Array.isArray(newValue) ? newValue : newValue !== null && newValue !== void 0 ? [newValue] : [];
237360
- const missingValues = valuesToCheck.filter((v) => v !== null && v !== void 0 && v !== "" && !this.isValueInOptions(v));
237361
- if (missingValues.length > 0) {
237362
- missingValues.forEach((id2) => {
237363
- this.queryById(id2);
237364
- });
237365
- }
237366
237304
  this.isSettingValue = false;
237367
237305
  }
237368
237306
  },
@@ -237517,7 +237455,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
237517
237455
  __: [2]
237518
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"]);
237519
237457
  }
237520
- var SelectWidget = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-298a6f95"]]);
237458
+ var SelectWidget = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-2ffe261c"]]);
237521
237459
  var DIYtableWidget_vue_vue_type_style_index_0_scoped_true_lang = "";
237522
237460
  const _sfc_main$2 = {
237523
237461
  name: "DIYtable-widget",