Lijy 11 ماه پیش
والد
کامیت
4e9c087797

+ 8 - 0
fhKeeper/formulahousekeeper/plugIn/form-design-master/src/generate/GenerateForm.vue

@@ -17,6 +17,8 @@
         :config="data.config"
         :disabled="disabled"
         :request="request"
+        :widgetFormData="widgetForm.list"
+        @updateWidgetForm="updateWidgetForm"
       />
     </template>
   </el-form>
@@ -122,6 +124,11 @@ export default defineComponent({
       })
     }
 
+    const updateWidgetForm = (list: any[]) => {
+      state.widgetForm.list = list
+      state.model = {...state.model, contactsId: ''}
+    }
+
     watch(
       () => props.data,
       (val) => {
@@ -159,6 +166,7 @@ export default defineComponent({
       ...toRefs(state),
       getData,
       reset,
+      updateWidgetForm
     }
   },
 })

+ 38 - 0
fhKeeper/formulahousekeeper/plugIn/form-design-master/src/generate/GenerateFormItem.vue

@@ -236,6 +236,7 @@
         :filterable="element.options.filterable"
         :disabled="disabled || element.options.disabled"
         :style="{ width: element.options.width }"
+        @change="(value: any) => specializedHandleSelect(value, element)"
       >
         <el-option
           v-for="item of element.options.remote
@@ -346,6 +347,7 @@ const props = defineProps<{
   updatedModel: any
   disabled: boolean
   request?: Function
+  widgetFormData?: any
 }>()
 const originData = props.model[props.element.model]
 const data = computed({
@@ -382,6 +384,42 @@ async function download(defaultValue: string, label: string) {
   a.download = `${label}.${defaultValue.split('.')[1]}`
   a.click()
 }
+
+const emits = defineEmits(['updateWidgetForm'])
+const specializedHandleSelect = (val: any, element: any) => {
+  const field = element.model
+  if(field == 'customerId') {
+    let list = JSON.parse(JSON.stringify(props.widgetFormData))
+    for(var i in list) {
+      if(list[i].model == 'contactsId') {
+        let item = list[i]
+        const token: any = sessionStorage.getItem('token')
+        // fetch(item.options.remoteFunc, {
+        fetch(`${item.options.remoteFunc}?customerId=${val}`, {
+          headers: {
+            "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
+            "Token": token
+          }
+        })
+          .then(resp => resp.json())
+          .then((json) => {
+            const res = json.data
+            if (res instanceof Array) {
+              item.options.remoteOptions = res.map(data => ({
+                label: data[item.options.props.label],
+                value: data[item.options.props.value],
+                children: data[item.options.props.children],
+              }))
+            }
+            list[i].options = {...list[i].options, disabled: false, defaultValue: ''}
+          })
+      }
+    }
+    setTimeout(() => {
+      emits('updateWidgetForm', list)
+    }, 100)
+  }
+}
 </script>
 <style scoped>
 :deep(.el-upload--picture-card) {

+ 1 - 0
fhKeeper/formulahousekeeper/plugIn/form-design-master/update/dist/generate/GenerateForm.vue.d.ts

@@ -16,6 +16,7 @@ declare const _default: import("vue").DefineComponent<{
 }, {
     getData: () => Promise<unknown>;
     reset: () => void;
+    updateWidgetForm: (list: any[]) => void;
     generateForm: import("vue").Ref<any>;
     model: import("vue").Ref<any>;
     updatedModel: import("vue").Ref<any>;

+ 6 - 2
fhKeeper/formulahousekeeper/plugIn/form-design-master/update/dist/generate/GenerateFormItem.vue.d.ts

@@ -6,14 +6,18 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
     updatedModel: any;
     disabled: boolean;
     request?: Function | undefined;
-}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
+    widgetFormData?: any;
+}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "updateWidgetForm"[], "updateWidgetForm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
     config: WidgetForm['config'];
     element: any;
     model: any;
     updatedModel: any;
     disabled: boolean;
     request?: Function | undefined;
-}>>>, {}>;
+    widgetFormData?: any;
+}>>> & {
+    onUpdateWidgetForm?: ((...args: any[]) => any) | undefined;
+}, {}>;
 export default _default;
 declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
 declare type __VLS_TypePropsToRuntimeProps<T> = {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
fhKeeper/formulahousekeeper/plugIn/form-design-master/update/dist/index.css


+ 53 - 12
fhKeeper/formulahousekeeper/plugIn/form-design-master/update/dist/index.es.js

@@ -27558,7 +27558,7 @@ var _export_sfc = (sfc, props) => {
   }
   return target;
 };
-const _withScopeId = (n) => (pushScopeId("data-v-4dd8224f"), n = n(), popScopeId(), n);
+const _withScopeId = (n) => (pushScopeId("data-v-6f7c6df8"), n = n(), popScopeId(), n);
 const _hoisted_1$6 = { key: 12 };
 const _hoisted_2$5 = {
   key: 1,
@@ -27575,9 +27575,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
     model: null,
     updatedModel: null,
     disabled: { type: Boolean },
-    request: null
+    request: null,
+    widgetFormData: null
   },
-  setup(__props) {
+  emits: ["updateWidgetForm"],
+  setup(__props, { emit: emits }) {
     const props = __props;
     const originData = props.model[props.element.model];
     const data2 = computed({
@@ -27609,6 +27611,37 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
       a2.download = `${label}.${defaultValue.split(".")[1]}`;
       a2.click();
     }
+    const specializedHandleSelect = (val, element) => {
+      const field = element.model;
+      if (field == "customerId") {
+        let list = JSON.parse(JSON.stringify(props.widgetFormData));
+        for (var i in list) {
+          if (list[i].model == "contactsId") {
+            let item = list[i];
+            const token = sessionStorage.getItem("token");
+            fetch(`${item.options.remoteFunc}?customerId=${val}`, {
+              headers: {
+                "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
+                "Token": token
+              }
+            }).then((resp) => resp.json()).then((json) => {
+              const res = json.data;
+              if (res instanceof Array) {
+                item.options.remoteOptions = res.map((data22) => ({
+                  label: data22[item.options.props.label],
+                  value: data22[item.options.props.value],
+                  children: data22[item.options.props.children]
+                }));
+              }
+              list[i].options = __spreadProps(__spreadValues({}, list[i].options), { disabled: false, defaultValue: "" });
+            });
+          }
+        }
+        setTimeout(() => {
+          emits("updateWidgetForm", list);
+        }, 100);
+      }
+    };
     return (_ctx, _cache) => {
       const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
       const _component_el_table_column = ElTableColumn;
@@ -27895,7 +27928,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
             clearable: __props.element.options.clearable,
             filterable: __props.element.options.filterable,
             disabled: __props.disabled || __props.element.options.disabled,
-            style: normalizeStyle({ width: __props.element.options.width })
+            style: normalizeStyle({ width: __props.element.options.width }),
+            onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
           }, {
             default: withCtx(() => [
               (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
@@ -27911,7 +27945,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
           __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
             key: 10,
             modelValue: unref(data2),
-            "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(data2) ? data2.value = $event : null),
+            "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
             "active-text": __props.element.options.activeText,
             "inactive-text": __props.element.options.inactiveText,
             disabled: __props.disabled || __props.element.options.disabled
@@ -27919,7 +27953,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
           __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
             key: 11,
             modelValue: unref(data2),
-            "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
+            "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => isRef(data2) ? data2.value = $event : null),
             min: __props.element.options.min,
             max: __props.element.options.max,
             step: __props.element.options.step,
@@ -27966,7 +28000,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
             key: 14,
             style: { "margin-top": "-4px" },
             type: "text",
-            onClick: _cache[12] || (_cache[12] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
+            onClick: _cache[13] || (_cache[13] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
           }, {
             default: withCtx(() => [
               _hoisted_6$4
@@ -27976,7 +28010,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
           __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
             key: 15,
             modelValue: unref(data2),
-            "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
+            "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
             options: __props.element.options.remoteOptions,
             placeholder: __props.element.options.placeholder,
             filterable: __props.element.options.filterable,
@@ -28001,7 +28035,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
     };
   }
 });
-var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-4dd8224f"]]);
+var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-6f7c6df8"]]);
 const _sfc_main$7 = defineComponent({
   name: "FormGenerate",
   components: {
@@ -28085,6 +28119,10 @@ const _sfc_main$7 = defineComponent({
         }
       });
     };
+    const updateWidgetForm = (list) => {
+      state.widgetForm.list = list;
+      state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
+    };
     watch(() => props.data, (val) => {
       var _a3;
       state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
@@ -28110,7 +28148,8 @@ const _sfc_main$7 = defineComponent({
     };
     return __spreadProps(__spreadValues({}, toRefs(state)), {
       getData,
-      reset
+      reset,
+      updateWidgetForm
     });
   }
 });
@@ -28136,8 +28175,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
           element: _ctx.widgetForm.list[index],
           config: _ctx.data.config,
           disabled: _ctx.disabled,
-          request: _ctx.request
-        }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request"]);
+          request: _ctx.request,
+          widgetFormData: _ctx.widgetForm.list,
+          onUpdateWidgetForm: _ctx.updateWidgetForm
+        }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
       }), 128))
     ]),
     _: 1

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
fhKeeper/formulahousekeeper/plugIn/form-design-master/update/dist/index.es.js.map