"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                                                               */
const Vue = require("vue");
const common = require("../utils/common.js");
;/* empty css                   */
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../node_modules/element-plus/es/components/switch/index.js");
const index$1 = require("../../../../node_modules/element-plus/es/components/divider/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/select/index.js");
const index$3 = require("../../../../node_modules/element-plus/es/components/radio/index.js");
const _hoisted_1 = { class: "table-summary-config" };
const _hoisted_2 = { class: "config-row" };
const _sfc_main = {
  __name: "tableSummary",
  setup(__props) {
    var _a;
    const editConfigData = Vue.computed(() => common.getEditConfigData());
    const availableFields = Vue.computed(() => {
      var _a2;
      const fields = ((_a2 = editConfigData.value) == null ? void 0 : _a2.fieldsData) || [];
      return fields.filter((field) => field.isShow && field.fieldType === "number");
    });
    const summaryConfig = Vue.reactive({
      enabled: false,
      mode: "current",
      summaryFields: [],
      ...((_a = editConfigData.value) == null ? void 0 : _a.summaryConfig) || {}
    });
    Vue.watch(
      summaryConfig,
      (val) => {
        editConfigData.value.summaryConfig = val;
      },
      { deep: true }
    );
    return (_ctx, _cache) => {
      const _component_el_switch = index.ElSwitch;
      const _component_el_divider = index$1.ElDivider;
      const _component_el_option = index$2.ElOption;
      const _component_el_select = index$2.ElSelect;
      const _component_el_radio_button = index$3.ElRadioButton;
      const _component_el_radio_group = index$3.ElRadioGroup;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          _cache[3] || (_cache[3] = Vue.createElementVNode("span", { class: "config-label" }, "开启合计:", -1)),
          Vue.createVNode(_component_el_switch, {
            modelValue: summaryConfig.enabled,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => summaryConfig.enabled = $event),
            size: "small"
          }, null, 8, ["modelValue"]),
          Vue.createVNode(_component_el_divider, { direction: "vertical" }),
          _cache[4] || (_cache[4] = Vue.createElementVNode("span", { class: "config-label" }, "合计列:", -1)),
          Vue.createVNode(_component_el_select, {
            modelValue: summaryConfig.summaryFields,
            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => summaryConfig.summaryFields = $event),
            multiple: "",
            size: "small",
            style: { "width": "200px" },
            "collapse-tags": "",
            "collapse-tags-tooltip": "",
            placeholder: "请选择要合计的列"
          }, {
            default: Vue.withCtx(() => [
              (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(availableFields.value, (field) => {
                return Vue.openBlock(), Vue.createBlock(_component_el_option, {
                  key: field.fieldName,
                  label: field.label || field.fieldName,
                  value: field.fieldName
                }, null, 8, ["label", "value"]);
              }), 128))
            ]),
            _: 1
          }, 8, ["modelValue"]),
          Vue.createVNode(_component_el_divider, { direction: "vertical" }),
          _cache[5] || (_cache[5] = Vue.createElementVNode("span", { class: "config-label" }, "合计模式:", -1)),
          Vue.createVNode(_component_el_radio_group, {
            modelValue: summaryConfig.mode,
            "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => summaryConfig.mode = $event),
            size: "small"
          }, {
            default: Vue.withCtx(() => [
              Vue.createVNode(_component_el_radio_button, {
                label: "当前页数据",
                value: "current"
              }),
              Vue.createVNode(_component_el_radio_button, {
                label: "全部数据",
                value: "all"
              })
            ]),
            _: 1
          }, 8, ["modelValue"])
        ])
      ]);
    };
  }
};
const TableSummary = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-29acfeb4"]]);
exports.default = TableSummary;
