"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const gen_Apis = require("../../gen/Apis.js");
require("../../common/libraries/request.js");
require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWatermarkStore.js");
require("../../common/store/useWorkStore.js");
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_up_cascader2 = common_vendor.resolveComponent("up-cascader");
  const _component_veiw = common_vendor.resolveComponent("veiw");
  (_easycom_uni_icons2 + _easycom_up_cascader2 + _component_veiw)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_up_cascader = () => "../../node-modules/uview-plus/components/u-cascader/u-cascader.js";
if (!Math) {
  (_easycom_uni_icons + _easycom_up_cascader)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "hs-radio-picker-categories-tree",
  props: [
    "Enums",
    "title",
    "pickerIndex",
    "value",
    "borderTop",
    "required",
    "disabled",
    "tip",
    "key",
    "des",
    "padding",
    "valueModel",
    "placeholder",
    "titleStyle",
    "rightStyle",
    "defaultValue"
  ],
  emits: ["change", "update:valueModel"],
  setup(__props, { emit }) {
    const props = __props;
    const borderStyle = "1rpx solid #eee";
    const paddingStyle = "15rpx 0";
    const show = common_vendor.ref(false);
    const pickerList = common_vendor.ref([]);
    const selectValue = common_vendor.ref("");
    const selectValueModel = common_vendor.ref([]);
    const onConfirm = (e) => {
      var _a;
      (_a = pickerList.value) == null ? void 0 : _a.map((res) => {
        var _a2;
        if ((res == null ? void 0 : res.id) === (e == null ? void 0 : e[0])) {
          selectValue.value = res == null ? void 0 : res.name;
          (_a2 = res == null ? void 0 : res.children) == null ? void 0 : _a2.map((child) => {
            if ((child == null ? void 0 : child.id) === (e == null ? void 0 : e[1])) {
              selectValue.value += `/${child == null ? void 0 : child.name}`;
            }
          });
        }
      });
      emit("update:valueModel", e);
      emit("change", e);
    };
    common_vendor.watch(
      () => props.defaultValue,
      (newVal) => {
        selectValue.value = newVal;
      }
    );
    const getPickerList = () => {
      common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Emergency.EmergencyEventCategories.SelectTree, {}).then((res) => {
        pickerList.value = res == null ? void 0 : res.data;
        console.log(res);
      });
    };
    common_vendor.onMounted(() => {
      getPickerList();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t((props == null ? void 0 : props.title) || "标题"),
        b: __props.required
      }, __props.required ? {} : {}, {
        c: common_vendor.s(props.titleStyle),
        d: selectValue.value
      }, selectValue.value ? {
        e: common_vendor.t(selectValue.value)
      } : {
        f: common_vendor.t((props == null ? void 0 : props.placeholder) || "请选择")
      }, {
        g: common_vendor.p({
          type: "right",
          color: "#333",
          size: "12"
        }),
        h: common_vendor.s(props.rightStyle),
        i: props.borderTop ? borderStyle : "",
        j: (props == null ? void 0 : props.padding) || paddingStyle,
        k: common_vendor.o(($event) => show.value = true),
        l: common_vendor.o(onConfirm),
        m: common_vendor.o(($event) => show.value = $event),
        n: common_vendor.o(($event) => selectValueModel.value = $event),
        o: common_vendor.p({
          mode: "mutil-column-auto",
          data: pickerList.value,
          ["label-key"]: "name",
          ["value-key"]: "id",
          ["children-key"]: "children",
          show: show.value,
          modelValue: selectValueModel.value
        })
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d4e228cc"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-radio-picker-categories-tree/hs-radio-picker-categories-tree.vue"]]);
wx.createComponent(Component);
