"use strict";
require("../../common/libraries/request.js");
require("../../common/store/useWatermarkStore.js");
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWorkStore.js");
const WORKORDER_acceptance_model = require("./model.js");
const gen_Apis = require("../../gen/Apis.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const common_libraries_naviHelper = require("../../common/libraries/naviHelper.js");
common_store_useWeAppAuthStore.useWeAppAuthStore();
const method = {
  init(data) {
    WORKORDER_acceptance_model.useModel.HouseWorkOrdersAcceptResultEnum.value = {
      Processing2: { text: "是", value: "1" },
      Processing1: { text: "否", value: "0" }
    };
    WORKORDER_acceptance_model.useModel.formData.value = {
      ...data
    };
  },
  handleSubmit() {
    var _a, _b;
    let data = (_b = (_a = WORKORDER_acceptance_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value;
    if (!(data == null ? void 0 : data.is_completed)) {
      return common_libraries_naviHelper.showToast("请选择是否已经完工！");
    }
    if ((data == null ? void 0 : data.is_completed) === "0" && !(data == null ? void 0 : data.accept_remark)) {
      return common_libraries_naviHelper.showToast("请先输入原因！");
    }
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.WorkOrder.HouseWorkOrders.Accept, {
      ...data,
      is_completed: (data == null ? void 0 : data.is_completed) === "1" ? true : false
    }).then((res) => {
      common_libraries_naviHelper.showToastBack("提交成功！", 1, true);
      console.log(res);
    });
  }
};
exports.method = method;
