"use strict"; require("../../common/vendor.js"); const INDEX_binding_model = require("./model.js"); const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js"); const gen_Apis = require("../../gen/Apis.js"); const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js"); const handleSubmitStore = () => { var _a, _b, _c; common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.Store, { ...INDEX_binding_model.useModel.formData.value, is_live_in: ((_c = (_b = (_a = INDEX_binding_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value) == null ? void 0 : _c.is_live_in) ? 1 : 0, customer_info: [INDEX_binding_model.useModel.formData.value] }).then((res) => { INDEX_binding_model.useModel.show.value = false; common_libraries_naviHelper.showToastBack("提交成功,等待审核!", 1, true); console.log(res); }); }; const method = { handleSubmitStore, handleSelectProject: (e) => { var _a; if (e[3]) { INDEX_binding_model.useModel.formData.value.asset_houses_id = (_a = e[3]) == null ? void 0 : _a.id; } else { INDEX_binding_model.useModel.formData.value.asset_houses_id = ""; } console.log(e, "e"); }, init() { INDEX_binding_model.useModel.formData.value = { asset_project_id: "", asset_houses_id: "", type: "", customer_info: [], name: "", phone: "", card_front_image: [], card_back_image: [], house_relation: "", card_type: "MainlandID", relation_with_owner: "", ownership_info: [], id_card: "", move_in_date: "", is_live_in: true }; }, handleIsLiveIn(e) { var _a; INDEX_binding_model.useModel.formData.value.is_live_in = (_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value; console.log(e, "e"); }, handleSubmit: (e) => { var _a, _b, _c, _d, _e, _f, _g, _h; if (!INDEX_binding_model.useModel.formData.value.asset_houses_id) { return common_libraries_naviHelper.showToast("请先选择房屋!"); } if (!INDEX_binding_model.useModel.formData.value.type) { return common_libraries_naviHelper.showToast("请先选择身份!"); } if (!INDEX_binding_model.useModel.formData.value.name || !INDEX_binding_model.useModel.formData.value.phone) { return common_libraries_naviHelper.showToast("请设置姓名和手机号!"); } if (!((_a = INDEX_binding_model.useModel.formData.value.card_front_image) == null ? void 0 : _a.length) || !((_b = INDEX_binding_model.useModel.formData.value.card_back_image) == null ? void 0 : _b.length)) { return common_libraries_naviHelper.showToast("请先上传身份证正反面!"); } if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && !((_d = (_c = INDEX_binding_model.useModel.formData.value) == null ? void 0 : _c.ownership_info) == null ? void 0 : _d.length)) { return common_libraries_naviHelper.showToast("请先上传房产证!"); } if (INDEX_binding_model.useModel.formData.value.type === "AddOwner" && ((_g = (_f = (_e = INDEX_binding_model.useModel) == null ? void 0 : _e.ownerList) == null ? void 0 : _f.value) == null ? void 0 : _g.length)) { INDEX_binding_model.useModel.show.value = true; return; } console.log((_h = INDEX_binding_model.useModel) == null ? void 0 : _h.formData.value, "formData"); handleSubmitStore(); }, handleClose() { INDEX_binding_model.useModel.show.value = false; }, handleSelectType(e) { INDEX_binding_model.useModel.formData.value.house_relation = (e == null ? void 0 : e.value) === "AddOwner" ? "Owner" : "NonOwner"; console.log(e); }, handleSelectResidentialRelation() { var _a, _b, _c, _d, _e, _f; if ((_c = (_b = (_a = INDEX_binding_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value) == null ? void 0 : _c.asset_houses_id) { common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseOccupants.GetOwner, { asset_houses_id: (_f = (_e = (_d = INDEX_binding_model.useModel) == null ? void 0 : _d.formData) == null ? void 0 : _e.value) == null ? void 0 : _f.asset_houses_id }).then((res) => { INDEX_binding_model.useModel.ownerList.value = (res == null ? void 0 : res.data) || []; console.log(res); }); } } }; exports.method = method;