"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                          */
;/* empty css                                                                     */
;/* empty css                                                                  */
;/* empty css                                                               */
;/* empty css                                                            */
;/* empty css                                                               */
;/* empty css                                                               */
;/* empty css                                                              */
;/* empty css                                                                  */
;/* empty css                                                               */
;/* empty css                                                               */
;/* empty css                                                             */
;/* empty css                                                             */
require("../../../../node_modules/element-plus/theme-chalk/el-tab-pane.css.js");
;/* empty css                                                              */
;/* empty css                                                             */
;/* empty css                                                               */
const Vue = require("vue");
const index$3 = require("../../../../node_modules/@element-plus/icons-vue/dist/index.js");
const useAdvancedFilterDialog = require("../advancedFilter/useAdvancedFilterDialog.js");
const common = require("../utils/common.js");
const FilterConfigDisplay = require("../../components/FilterConfigDisplay.vue.js");
require("../../../../node_modules/element-plus/theme-chalk/el-tooltip.css.js");
;/* empty css                                                                  */
;/* empty css                                                              */
;/* empty css                                                                          */
require("../../../../node_modules/element-plus/theme-chalk/el-date-picker.css.js");
;/* empty css                                                                */
;/* empty css                                                              */
;/* empty css                                         */
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
;/* empty css                                   */
const index$8 = require("../../api/index.js");
;/* empty css                                                              */
;/* empty css                                                                */
;/* empty css                                */
const FormulaEditorInput = require("../../components/FormulaEditorInput.vue.js");
;/* empty css            */
const index = require("../../../../node_modules/element-plus/es/components/container/index.js");
const index$1 = require("../../../../node_modules/element-plus/es/components/tabs/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/button/index.js");
const index$4 = require("../../../../node_modules/element-plus/es/components/scrollbar/index.js");
const index$5 = require("../../../../node_modules/element-plus/es/components/card/index.js");
const index$6 = require("../../../../node_modules/element-plus/es/components/empty/index.js");
const index$7 = require("../../../../node_modules/element-plus/es/components/select/index.js");
const _hoisted_1 = { class: "tab-content" };
const _hoisted_2 = {
  key: 0,
  class: "tab-link-content"
};
const _hoisted_3 = { class: "add-rule-btn" };
const _hoisted_4 = { class: "tab-desc" };
const _hoisted_5 = { class: "rule-content" };
const _hoisted_6 = { class: "rule-actions" };
const _hoisted_7 = {
  key: 0,
  class: "rule-section"
};
const _hoisted_8 = { class: "rule-conditions" };
const _hoisted_9 = { class: "condition-item" };
const _hoisted_10 = { class: "rule-section" };
const _hoisted_11 = { class: "rule-section-title" };
const _hoisted_12 = { class: "rule-field-values" };
const _hoisted_13 = {
  key: 0,
  class: "field-assignments-display"
};
const _hoisted_14 = { class: "field-name" };
const _hoisted_15 = { class: "field-value-display" };
const _hoisted_16 = {
  key: 1,
  class: "field-assignments-display"
};
const _hoisted_17 = { class: "field-name" };
const _hoisted_18 = { class: "field-value-display" };
const _hoisted_19 = {
  key: 2,
  class: "field-value-item"
};
const _hoisted_20 = {
  key: 1,
  class: "tab-empty-state"
};
const _hoisted_21 = { class: "advanced-title" };
const _hoisted_22 = { key: 0 };
const _hoisted_23 = {
  key: 1,
  class: "field-assignment-area"
};
const _hoisted_24 = { class: "field-assignment-list" };
const _hoisted_25 = {
  key: 0,
  class: "field-value-input"
};
const _hoisted_26 = {
  key: 2,
  class: "field-assignment-area"
};
const _hoisted_27 = { class: "field-assignment-list" };
const _hoisted_28 = {
  key: 0,
  class: "field-value-input"
};
const _sfc_main = {
  __name: "index",
  props: {
    linkedConfig: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ["update:linkedConfig"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const currentInstance = Vue.getCurrentInstance();
    const ctx = currentInstance.proxy;
    const emit = __emit;
    const fieldsData = Vue.computed(() => {
      return common.getEditConfigDataFields();
    });
    const optionsFieldsData = Vue.computed(() => {
      const list = ["select", "multipleSelection", "radio", "checkbox"];
      const fieldList = common.getEditConfigDataFields().filter(
        (item) => list.includes(item.fieldType)
      );
      return fieldList.filter(
        (item) => {
          var _a;
          return ((_a = item.optionConfig) == null ? void 0 : _a.optionSource) != "dataSource";
        }
      );
    });
    const hiddenFields = Vue.computed(() => {
      const editConfigData = common.getEditConfigData();
      const fields = (editConfigData == null ? void 0 : editConfigData.hiddenFields) || [];
      return fields.map((item) => ({
        id: item == null ? void 0 : item.id,
        fieldId: item == null ? void 0 : item.id,
        label: item == null ? void 0 : item.label
      }));
    });
    const tabList = Vue.ref([
      {
        label: "数据",
        name: "dataLink",
        desc: "根据触发方式和触发条件让字段的值根据其他字段的值自动变化,"
      },
      {
        label: "显隐",
        name: "visibility",
        desc: "让字段在特定条件成立时显示，反之隐藏"
      },
      { label: "必填", name: "required", desc: "让字段在特定条件成立时变为必填" },
      {
        label: "只读",
        name: "disabled",
        desc: "让字段在特定条件成立时变为不可编辑"
      },
      // { label: "禁用", name: "disabled", desc: "让字段在特定条件成立时变为禁用" },
      { label: "可选项", name: "options", desc: "让字段的选择项根据条件动态变化" }
    ]);
    const activeTab = Vue.ref("dataLink");
    const currentTab = Vue.computed(() => {
      return tabList.value.find((tab) => tab.name == activeTab.value);
    });
    const dataLinkFieldList = Vue.ref([]);
    const filterConfig = Vue.ref();
    const editingRuleIndex = Vue.ref(-1);
    const fieldAssignments = Vue.ref([]);
    const optionsFieldsOptionsCache = Vue.ref({});
    async function loadOptionsFieldsOptions(fieldId) {
      if (!fieldId) return [];
      if (optionsFieldsOptionsCache.value[fieldId]) {
        return optionsFieldsOptionsCache.value[fieldId];
      }
      const options = await getOptionsFieldsOptions(
        optionsFieldsData.value,
        fieldId
      );
      optionsFieldsOptionsCache.value[fieldId] = options;
      return options;
    }
    Vue.watch(
      () => fieldAssignments.value.map((a) => a.fieldId).filter(Boolean).join(","),
      async () => {
        if (currentTab.value.name == "options") {
          for (const assignment of fieldAssignments.value) {
            if (assignment.fieldId && !optionsFieldsOptionsCache.value[assignment.fieldId]) {
              await loadOptionsFieldsOptions(assignment.fieldId);
            }
          }
        }
      },
      { immediate: true }
    );
    function getOptionsFieldsOptionsByCache(fieldId) {
      return optionsFieldsOptionsCache.value[fieldId] || [];
    }
    function onFieldIdChange(index2) {
      fieldAssignments.value[index2].optionsOpt = null;
    }
    const filterTitle = Vue.ref("");
    const filterSuccessDesc = Vue.ref("条件满足时或不设置条件，数据联动赋值以下字段");
    function handleAddRule(tab) {
      const name = tab.name;
      filterTitle.value = `${tab.label}联动规则`;
      editingRuleIndex.value = -1;
      switch (name) {
        case "dataLink":
          filterSuccessDesc.value = `条件满足时或不设置条件，数据联动赋值以下字段`;
          break;
        case "visibility":
          filterSuccessDesc.value = `条件满足时，显示以下字段`;
          break;
        case "required":
        case "readonly":
        case "disabled":
          filterSuccessDesc.value = `条件满足时，${tab.label}以下字段`;
          break;
        case "property":
          filterSuccessDesc.value = `条件满足时，${tab.label}以下字段的属性`;
          break;
        case "options":
          filterSuccessDesc.value = `条件满足时，可显示以下字段的可选项`;
          break;
      }
      filterConfig.value = {
        operator: "and",
        conditions: [],
        groups: []
      };
      dataLinkFieldList.value = [];
      fieldAssignments.value = [];
      openAdvancedFilterDialog();
    }
    const {
      advancedFilterDialogVisible,
      openAdvancedFilterDialog,
      AdvancedFilterDialog
    } = useAdvancedFilterDialog.useAdvancedFilterDialog();
    Vue.watch(advancedFilterDialogVisible, (visible) => {
      if (!visible) {
        editingRuleIndex.value = -1;
      }
    });
    function advancedConfirm(data) {
      var _a;
      const linedConfigArr = [
        ...((_a = props.linkedConfig) == null ? void 0 : _a[currentTab.value.name]) || []
      ];
      const newRule = {
        dataLinkFieldList: dataLinkFieldList.value,
        filterConfig: data
      };
      if (currentTab.value.name == "dataLink" || currentTab.value.name == "options") {
        newRule.fieldAssignments = common.cloneDeep(fieldAssignments.value);
      }
      if (editingRuleIndex.value == -1) {
        linedConfigArr.push(newRule);
      } else {
        linedConfigArr[editingRuleIndex.value] = newRule;
      }
      const newLinkedConfig = {
        ...props.linkedConfig,
        [currentTab.value.name]: linedConfigArr
      };
      emit("update:linkedConfig", newLinkedConfig);
      editingRuleIndex.value = -1;
    }
    const getFieldLabel = (fieldId) => {
      const field = fieldsData.value.find((f) => f.id == fieldId);
      return (field == null ? void 0 : field.label) || fieldId;
    };
    const getFieldTitle = (tabName) => {
      const titleMap = {
        dataLink: "数据字段",
        visibility: "显示字段",
        required: "必填字段",
        readonly: "只读字段",
        disabled: "禁用字段",
        options: "字段显示可选项"
      };
      return titleMap[tabName] || "联动字段";
    };
    const formatFormulaText = (assignment) => {
      const { formula } = assignment;
      if (formula == null || (formula == null ? void 0 : formula.value) == void 0 || (formula == null ? void 0 : formula.text) == null || (formula == null ? void 0 : formula.text) == void 0 || (formula == null ? void 0 : formula.value.text) == "") {
        return "空";
      }
      return String(formula.text);
    };
    const addFieldAssignment = () => {
      fieldAssignments.value.push({
        fieldId: null,
        value: null,
        optionsOpt: null,
        optionsLabel: "",
        isField: false,
        operator: "eq",
        formula: {
          value: {
            text: "",
            marks: []
          },
          text: ""
        }
      });
    };
    function onOptionsOptChange(index2) {
      const assignment = fieldAssignments.value[index2];
      if (!assignment.optionsOpt || !assignment.optionsOpt.length) {
        assignment.optionsLabel = "";
        return;
      }
      const options = optionsFieldsOptionsCache.value[assignment.fieldId] || [];
      const labels = assignment.optionsOpt.map((val) => {
        const opt = options.find((o) => o.value === val);
        return opt ? opt.label : val;
      });
      assignment.optionsLabel = labels.join(", ");
    }
    const removeFieldAssignment = (index2) => {
      fieldAssignments.value.splice(index2, 1);
    };
    const handleEditRule = (tab, item, index2) => {
      filterTitle.value = `${tab.label}联动规则`;
      filterConfig.value = common.cloneDeep(item.filterConfig);
      dataLinkFieldList.value = [...item.dataLinkFieldList.map(String)];
      if ((tab.name == "dataLink" || tab.name == "options") && item.fieldAssignments) {
        fieldAssignments.value = common.cloneDeep(item.fieldAssignments);
      } else if (tab.name == "dataLink" || tab.name == "options") {
        fieldAssignments.value = [];
      }
      editingRuleIndex.value = index2;
      openAdvancedFilterDialog();
    };
    const handleDeleteRule = (tab, index2) => {
      var _a;
      const configArr = [...((_a = props.linkedConfig) == null ? void 0 : _a[tab.name]) || []];
      configArr.splice(index2, 1);
      const newLinkedConfig = {
        ...props.linkedConfig,
        [tab.name]: configArr
      };
      emit("update:linkedConfig", newLinkedConfig);
    };
    async function getOptionsFieldsOptions(optionsFieldsData2, fieldId) {
      var _a;
      const optionConfig = (_a = optionsFieldsData2.find(
        (item) => item.id == fieldId
      )) == null ? void 0 : _a.optionConfig;
      if (!(optionConfig == null ? void 0 : optionConfig.optionSource)) return [];
      if (optionConfig.optionSource == "custom") {
        return optionConfig.options.map((item) => ({
          label: item.label,
          value: item.value
        }));
      } else if (optionConfig.optionSource == "dictionary") {
        const data = await index$8.default.getDicDataByKey(
          ctx.$http,
          optionConfig.dictionaryValue
        );
        return Object.entries(data).map(([value, label]) => ({ label, value }));
      }
      return [];
    }
    return (_ctx, _cache) => {
      const _component_el_button = index$2.ElButton;
      const _component_el_card = index$5.ElCard;
      const _component_el_scrollbar = index$4.ElScrollbar;
      const _component_el_empty = index$6.ElEmpty;
      const _component_el_tab_pane = index$1.ElTabPane;
      const _component_el_tabs = index$1.ElTabs;
      const _component_el_main = index.ElMain;
      const _component_el_container = index.ElContainer;
      const _component_el_option = index$7.ElOption;
      const _component_el_select = index$7.ElSelect;
      const _component_el_option_group = index$7.ElOptionGroup;
      return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
        Vue.createVNode(_component_el_container, { style: { "border": "1px solid #ebeef5", "border-radius": "4px" } }, {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_el_main, { style: { "padding": "0" } }, {
              default: Vue.withCtx(() => [
                Vue.createVNode(_component_el_tabs, {
                  modelValue: Vue.unref(activeTab),
                  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(activeTab) ? activeTab.value = $event : null),
                  class: "data-link-tabs"
                }, {
                  default: Vue.withCtx(() => [
                    (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(tabList), (tab) => {
                      return Vue.openBlock(), Vue.createBlock(_component_el_tab_pane, {
                        key: tab.name,
                        label: tab.label,
                        name: tab.name
                      }, {
                        default: Vue.withCtx(() => {
                          var _a, _b, _c, _d;
                          return [
                            Vue.createElementVNode("div", _hoisted_1, [
                              ((_b = (_a = props.linkedConfig) == null ? void 0 : _a[tab.name]) == null ? void 0 : _b.length) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_2, [
                                Vue.createElementVNode("div", _hoisted_3, [
                                  Vue.createVNode(_component_el_button, {
                                    type: "primary",
                                    icon: Vue.unref(index$3.Plus),
                                    onClick: ($event) => handleAddRule(tab)
                                  }, {
                                    default: Vue.withCtx(() => [
                                      Vue.createTextVNode(" 添加" + Vue.toDisplayString(tab.label) + "联动规则 ", 1)
                                    ]),
                                    _: 2
                                  }, 1032, ["icon", "onClick"]),
                                  Vue.createElementVNode("span", _hoisted_4, Vue.toDisplayString(tab.desc), 1)
                                ]),
                                Vue.createVNode(_component_el_scrollbar, { class: "rule-content-scrollbar" }, {
                                  default: Vue.withCtx(() => {
                                    var _a2;
                                    return [
                                      (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList((_a2 = props.linkedConfig) == null ? void 0 : _a2[tab.name], (item, idx) => {
                                        return Vue.openBlock(), Vue.createBlock(_component_el_card, {
                                          key: idx,
                                          class: "rule-card",
                                          shadow: "hover"
                                        }, {
                                          default: Vue.withCtx(() => {
                                            var _a3;
                                            return [
                                              Vue.createElementVNode("div", _hoisted_5, [
                                                Vue.createElementVNode("div", _hoisted_6, [
                                                  Vue.createVNode(_component_el_button, {
                                                    type: "primary",
                                                    link: "",
                                                    size: "small",
                                                    onClick: ($event) => handleEditRule(tab, item, idx)
                                                  }, {
                                                    default: Vue.withCtx(() => _cache[3] || (_cache[3] = [
                                                      Vue.createTextVNode(" 编辑 ")
                                                    ])),
                                                    _: 2
                                                  }, 1032, ["onClick"]),
                                                  Vue.createVNode(_component_el_button, {
                                                    type: "danger",
                                                    link: "",
                                                    size: "small",
                                                    onClick: ($event) => handleDeleteRule(tab, idx)
                                                  }, {
                                                    default: Vue.withCtx(() => _cache[4] || (_cache[4] = [
                                                      Vue.createTextVNode(" 删除 ")
                                                    ])),
                                                    _: 2
                                                  }, 1032, ["onClick"])
                                                ]),
                                                item.filterConfig && ((_a3 = item.filterConfig.conditions) == null ? void 0 : _a3.length) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_7, [
                                                  _cache[5] || (_cache[5] = Vue.createElementVNode("div", { class: "rule-section-title" }, "触发条件", -1)),
                                                  Vue.createElementVNode("div", _hoisted_8, [
                                                    Vue.createElementVNode("div", _hoisted_9, [
                                                      Vue.createVNode(FilterConfigDisplay.default, {
                                                        config: item.filterConfig,
                                                        "field-label-getter": getFieldLabel
                                                      }, null, 8, ["config"])
                                                    ])
                                                  ])
                                                ])) : Vue.createCommentVNode("", true),
                                                Vue.createElementVNode("div", _hoisted_10, [
                                                  Vue.createElementVNode("div", _hoisted_11, Vue.toDisplayString(getFieldTitle(tab.name)), 1),
                                                  Vue.createElementVNode("div", _hoisted_12, [
                                                    tab.name == "dataLink" && item.fieldAssignments && item.fieldAssignments.length > 0 ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_13, [
                                                      (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(item.fieldAssignments, (assignment, index2) => {
                                                        return Vue.openBlock(), Vue.createElementBlock("div", {
                                                          key: index2,
                                                          class: "field-assignment-display-item"
                                                        }, [
                                                          Vue.createElementVNode("span", _hoisted_14, "「" + Vue.toDisplayString(getFieldLabel(assignment.fieldId)) + "」", 1),
                                                          _cache[6] || (_cache[6] = Vue.createElementVNode("span", { class: "field-operator" }, "=", -1)),
                                                          Vue.createElementVNode("span", _hoisted_15, [
                                                            assignment.isField ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 0 }, [
                                                              Vue.createTextVNode(" 「" + Vue.toDisplayString(getFieldLabel(assignment.value)) + "」 ", 1)
                                                            ], 64)) : (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 1 }, [
                                                              Vue.createTextVNode(Vue.toDisplayString(formatFormulaText(assignment)), 1)
                                                            ], 64))
                                                          ])
                                                        ]);
                                                      }), 128))
                                                    ])) : tab.name == "options" && item.fieldAssignments && item.fieldAssignments.length > 0 ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_16, [
                                                      (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(item.fieldAssignments, (assignment, index2) => {
                                                        return Vue.openBlock(), Vue.createElementBlock("div", {
                                                          key: index2,
                                                          class: "field-assignment-display-item"
                                                        }, [
                                                          Vue.createElementVNode("span", _hoisted_17, "「" + Vue.toDisplayString(getFieldLabel(assignment.fieldId)) + "」", 1),
                                                          _cache[7] || (_cache[7] = Vue.createElementVNode("span", { class: "field-operator" }, "→", -1)),
                                                          Vue.createElementVNode("span", _hoisted_18, Vue.toDisplayString(assignment.optionsLabel), 1)
                                                        ]);
                                                      }), 128))
                                                    ])) : (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_19, Vue.toDisplayString(item.dataLinkFieldList.map((fieldId) => `${getFieldLabel(fieldId)}`).join(", ")), 1))
                                                  ])
                                                ])
                                              ])
                                            ];
                                          }),
                                          _: 2
                                        }, 1024);
                                      }), 128))
                                    ];
                                  }),
                                  _: 2
                                }, 1024)
                              ])) : Vue.createCommentVNode("", true),
                              !((_d = (_c = props.linkedConfig) == null ? void 0 : _c[tab.name]) == null ? void 0 : _d.length) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_20, [
                                Vue.createVNode(_component_el_empty, {
                                  description: tab.desc
                                }, {
                                  default: Vue.withCtx(() => [
                                    Vue.createVNode(_component_el_button, {
                                      type: "primary",
                                      icon: Vue.unref(index$3.Plus),
                                      onClick: ($event) => handleAddRule(tab)
                                    }, {
                                      default: Vue.withCtx(() => [
                                        Vue.createTextVNode(" 添加" + Vue.toDisplayString(tab.label) + "联动规则 ", 1)
                                      ]),
                                      _: 2
                                    }, 1032, ["icon", "onClick"])
                                  ]),
                                  _: 2
                                }, 1032, ["description"])
                              ])) : Vue.createCommentVNode("", true)
                            ])
                          ];
                        }),
                        _: 2
                      }, 1032, ["label", "name"]);
                    }), 128))
                  ]),
                  _: 1
                }, 8, ["modelValue"])
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        Vue.createVNode(Vue.unref(AdvancedFilterDialog), {
          modelValue: Vue.unref(advancedFilterDialogVisible),
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => Vue.isRef(advancedFilterDialogVisible) ? advancedFilterDialogVisible.value = $event : null),
          filterConfig: Vue.unref(filterConfig),
          onConfirm: advancedConfirm,
          title: Vue.unref(filterTitle)
        }, {
          default: Vue.withCtx(({ filterConfigData }) => {
            var _a, _b;
            return [
              Vue.createElementVNode("span", _hoisted_21, Vue.toDisplayString(Vue.unref(filterSuccessDesc)), 1),
              Vue.unref(currentTab).name !== "dataLink" && Vue.unref(currentTab).name !== "options" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_22, [
                Vue.createVNode(_component_el_select, {
                  modelValue: Vue.unref(dataLinkFieldList),
                  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.isRef(dataLinkFieldList) ? dataLinkFieldList.value = $event : null),
                  multiple: "",
                  filterable: "",
                  placeholder: !filterConfigData || ((_a = filterConfigData.conditions) == null ? void 0 : _a.length) == 0 ? "请选择字段" : "",
                  disabled: !filterConfigData || ((_b = filterConfigData.conditions) == null ? void 0 : _b.length) == 0
                }, {
                  default: Vue.withCtx(() => [
                    (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldsData), (item) => {
                      return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                        key: item.id + "",
                        label: item.label,
                        value: item.id + ""
                      }, null, 8, ["label", "value"]);
                    }), 128))
                  ]),
                  _: 2
                }, 1032, ["modelValue", "placeholder", "disabled"])
              ])) : Vue.unref(currentTab).name == "options" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_23, [
                Vue.createElementVNode("div", _hoisted_24, [
                  (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldAssignments), (assignment, index2) => {
                    return Vue.openBlock(), Vue.createElementBlock("div", {
                      key: index2,
                      class: "field-assignment-item"
                    }, [
                      Vue.createVNode(_component_el_select, {
                        modelValue: assignment.fieldId,
                        "onUpdate:modelValue": ($event) => assignment.fieldId = $event,
                        filterable: "",
                        placeholder: "请选择字段",
                        style: { "width": "200px", "margin-right": "12px" },
                        onChange: ($event) => onFieldIdChange(index2)
                      }, {
                        default: Vue.withCtx(() => [
                          (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(optionsFieldsData), (item) => {
                            return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                              key: item.id,
                              label: item.label,
                              value: item.id
                            }, null, 8, ["label", "value"]);
                          }), 128))
                        ]),
                        _: 2
                      }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
                      assignment.fieldId ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_25, [
                        Vue.createVNode(_component_el_select, {
                          modelValue: assignment.optionsOpt,
                          "onUpdate:modelValue": ($event) => assignment.optionsOpt = $event,
                          multiple: "",
                          placeholder: "请选择可选项",
                          style: { "width": "100%", "margin-right": "12px" },
                          loading: !Vue.unref(optionsFieldsOptionsCache)[assignment.fieldId],
                          onChange: ($event) => onOptionsOptChange(index2)
                        }, {
                          default: Vue.withCtx(() => [
                            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(getOptionsFieldsOptionsByCache(
                              assignment.fieldId
                            ), (item) => {
                              return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                                key: item.value,
                                label: item.label,
                                value: item.value
                              }, null, 8, ["label", "value"]);
                            }), 128))
                          ]),
                          _: 2
                        }, 1032, ["modelValue", "onUpdate:modelValue", "loading", "onChange"])
                      ])) : Vue.createCommentVNode("", true),
                      Vue.createVNode(_component_el_button, {
                        type: "danger",
                        link: "",
                        icon: "Delete",
                        onClick: ($event) => removeFieldAssignment(index2),
                        style: { "margin-left": "8px" }
                      }, null, 8, ["onClick"])
                    ]);
                  }), 128))
                ]),
                Vue.createVNode(_component_el_button, {
                  type: "primary",
                  link: "",
                  icon: "CirclePlus",
                  onClick: addFieldAssignment,
                  class: "add-assignment-btn"
                }, {
                  default: Vue.withCtx(() => _cache[8] || (_cache[8] = [
                    Vue.createTextVNode(" 添加可选项字段 ")
                  ])),
                  _: 1
                })
              ])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_26, [
                Vue.createElementVNode("div", _hoisted_27, [
                  (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldAssignments), (assignment, index2) => {
                    return Vue.openBlock(), Vue.createElementBlock("div", {
                      key: index2,
                      class: "field-assignment-item"
                    }, [
                      Vue.createVNode(_component_el_select, {
                        modelValue: assignment.fieldId,
                        "onUpdate:modelValue": ($event) => assignment.fieldId = $event,
                        filterable: "",
                        placeholder: "请选择字段",
                        style: { "width": "200px", "margin-right": "12px" }
                      }, {
                        default: Vue.withCtx(() => [
                          Vue.unref(fieldsData).length > 0 ? (Vue.openBlock(), Vue.createBlock(_component_el_option_group, {
                            key: 0,
                            label: "表单字段"
                          }, {
                            default: Vue.withCtx(() => [
                              (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldsData), (item) => {
                                return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                                  key: item.id,
                                  label: item.label,
                                  value: item.id
                                }, null, 8, ["label", "value"]);
                              }), 128))
                            ]),
                            _: 1
                          })) : Vue.createCommentVNode("", true),
                          Vue.unref(hiddenFields).length > 0 ? (Vue.openBlock(), Vue.createBlock(_component_el_option_group, {
                            key: 1,
                            label: "隐藏域"
                          }, {
                            default: Vue.withCtx(() => [
                              (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(hiddenFields), (field) => {
                                return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                                  key: field.id,
                                  label: field.label,
                                  value: field.id
                                }, null, 8, ["label", "value"]);
                              }), 128))
                            ]),
                            _: 1
                          })) : Vue.createCommentVNode("", true)
                        ]),
                        _: 2
                      }, 1032, ["modelValue", "onUpdate:modelValue"]),
                      assignment.fieldId ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_28, [
                        Vue.createVNode(Vue.unref(FormulaEditorInput.default), {
                          title: "公式配置",
                          formulaConf: assignment.formula.value,
                          "onUpdate:formulaConf": ($event) => assignment.formula.value = $event,
                          modelValue: assignment.formula.text,
                          "onUpdate:modelValue": ($event) => assignment.formula.text = $event
                        }, null, 8, ["formulaConf", "onUpdate:formulaConf", "modelValue", "onUpdate:modelValue"])
                      ])) : Vue.createCommentVNode("", true),
                      Vue.createVNode(_component_el_button, {
                        type: "danger",
                        link: "",
                        icon: "Delete",
                        onClick: ($event) => removeFieldAssignment(index2),
                        style: { "margin-left": "8px" }
                      }, null, 8, ["onClick"])
                    ]);
                  }), 128))
                ]),
                Vue.createVNode(_component_el_button, {
                  type: "primary",
                  link: "",
                  icon: "CirclePlus",
                  onClick: addFieldAssignment,
                  class: "add-assignment-btn"
                }, {
                  default: Vue.withCtx(() => _cache[9] || (_cache[9] = [
                    Vue.createTextVNode(" 添加字段赋值 ")
                  ])),
                  _: 1
                })
              ]))
            ];
          }),
          _: 1
        }, 8, ["modelValue", "filterConfig", "title"])
      ], 64);
    };
  }
};
const DataLinkage = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-35097e4f"]]);
exports.default = DataLinkage;
