"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.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_hs_popup2 = common_vendor.resolveComponent("hs-popup");
  (_easycom_uni_icons2 + _easycom_hs_popup2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_popup = () => "../hs-popup/hs-popup.js";
if (!Math) {
  (_easycom_uni_icons + _easycom_hs_popup)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "hs-popup-building",
  props: ["Apis", "baseStyle", "params"],
  emits: ["close", "change"],
  setup(__props, { emit }) {
    const props = __props;
    const selectEd = common_vendor.ref({ name: "全部楼栋", id: 0 });
    const formData = common_vendor.ref({ page: 1 });
    const pickerList = common_vendor.ref([]);
    common_vendor.ref({});
    const popupShow = common_vendor.ref(false);
    const onPopupShow = () => {
      var _a;
      console.log(props == null ? void 0 : props.params, "成都市 ");
      if (!popupShow.value && ((_a = props == null ? void 0 : props.params) == null ? void 0 : _a.asset_projects_id)) {
        popupShow.value = !popupShow.value;
        getPickerList();
      } else {
        common_libraries_naviHelper.showToast("请先选择项目！");
      }
    };
    const getPickerList = () => {
      var _a, _b, _c;
      common_libraries_apiLoading.getApiLoading((_c = (_b = (_a = gen_Apis.Apis) == null ? void 0 : _a.Asset) == null ? void 0 : _b.AssetHouses) == null ? void 0 : _c.SelectBuilding, { ...formData.value, ...props == null ? void 0 : props.params }).then((res) => {
        pickerList.value = res == null ? void 0 : res.data;
        console.log(res);
      });
    };
    const handleonClose = () => {
      popupShow.value = !popupShow.value;
    };
    const onSelectMerchant = (i) => {
      selectEd.value = i;
      emit("change", { asset_buildings_id: i == null ? void 0 : i.id });
      handleonClose();
    };
    const handleClose = () => {
      selectEd.value = { name: "全部楼栋", id: 0 };
      emit("change", { asset_buildings_id: void 0 });
    };
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e;
      return common_vendor.e({
        a: common_vendor.t((_a = selectEd.value) == null ? void 0 : _a.name),
        b: common_vendor.s((props == null ? void 0 : props.baseStyle) || {}),
        c: ((_b = selectEd.value) == null ? void 0 : _b.name) === "全部楼栋"
      }, ((_c = selectEd.value) == null ? void 0 : _c.name) === "全部楼栋" ? {
        d: common_vendor.p({
          type: "down",
          color: "#333",
          size: "12"
        })
      } : {}, {
        e: common_vendor.o(onPopupShow),
        f: ((_d = selectEd.value) == null ? void 0 : _d.name) !== "全部楼栋"
      }, ((_e = selectEd.value) == null ? void 0 : _e.name) !== "全部楼栋" ? {
        g: common_vendor.p({
          type: "close",
          color: "#666",
          size: "18"
        }),
        h: common_vendor.o(handleClose)
      } : {}, {
        i: common_vendor.f(pickerList.value, (i, index, i0) => {
          var _a2, _b2;
          return common_vendor.e({
            a: common_vendor.t(i == null ? void 0 : i.name),
            b: ((_a2 = selectEd.value) == null ? void 0 : _a2.id) === (i == null ? void 0 : i.id)
          }, ((_b2 = selectEd.value) == null ? void 0 : _b2.id) === (i == null ? void 0 : i.id) ? {
            c: "96fc7dbc-3-" + i0 + ",96fc7dbc-2",
            d: common_vendor.p({
              type: "checkmarkempty",
              size: "20",
              color: "#2A7EFB"
            })
          } : {}, {
            e: `key_${index}`,
            f: common_vendor.o(($event) => onSelectMerchant(i), `key_${index}`)
          });
        }),
        j: common_vendor.o(handleonClose),
        k: common_vendor.p({
          show: popupShow.value,
          mode: "bottom",
          closeable: true,
          round: 20
        })
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-96fc7dbc"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-popup-building/hs-popup-building.vue"]]);
wx.createComponent(Component);
