"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");
const WORKORDER_show_model = require("./model.js");
const method = {
  getShow(id) {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.WorkOrder.HouseWorkOrders.Show, { id }).then((res) => {
      WORKORDER_show_model.useModel.dataShow.value = res == null ? void 0 : res.data;
    });
  },
  getHouseWorkLogs(id) {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.WorkOrder.HouseWorkLogs.List, { house_work_orders_id: id }).then((res) => {
      WORKORDER_show_model.useModel.logsData.value = res == null ? void 0 : res.data;
    });
  },
  toPageAddLogs() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
    if (((_c = (_b = (_a = WORKORDER_show_model.useModel) == null ? void 0 : _a.dataShow) == null ? void 0 : _b.value) == null ? void 0 : _c.type) === "SecurityInspection") {
      common_vendor.index.navigateTo({
        url: `/WORKORDER/show_patrol_task_locations/index?id=${(_f = (_e = (_d = WORKORDER_show_model.useModel) == null ? void 0 : _d.dataShow) == null ? void 0 : _e.value) == null ? void 0 : _f.id}`
      });
      return;
    }
    if (((_i = (_h = (_g = WORKORDER_show_model.useModel) == null ? void 0 : _g.dataShow) == null ? void 0 : _h.value) == null ? void 0 : _i.type) === "RenovationInspection" || ((_l = (_k = (_j = WORKORDER_show_model.useModel) == null ? void 0 : _j.dataShow) == null ? void 0 : _k.value) == null ? void 0 : _l.type) === "RenovationAcceptance") {
      common_vendor.index.navigateTo({
        url: `/WORKORDER/patrol_update/index?id=${(_o = (_n = (_m = WORKORDER_show_model.useModel) == null ? void 0 : _m.dataShow) == null ? void 0 : _n.value) == null ? void 0 : _o.id}&type=${(_r = (_q = (_p = WORKORDER_show_model.useModel) == null ? void 0 : _p.dataShow) == null ? void 0 : _q.value) == null ? void 0 : _r.type}`
      });
      return false;
    }
    if (((_u = (_t = (_s = WORKORDER_show_model.useModel) == null ? void 0 : _s.dataShow) == null ? void 0 : _t.value) == null ? void 0 : _u.status) === "PendingPayment") {
      common_vendor.index.navigateTo({
        url: `/WORKORDER/poster/index?id=${(_x = (_w = (_v = WORKORDER_show_model.useModel) == null ? void 0 : _v.dataShow) == null ? void 0 : _w.value) == null ? void 0 : _x.id}&full_name=${(_B = (_A = (_z = (_y = WORKORDER_show_model.useModel) == null ? void 0 : _y.dataShow) == null ? void 0 : _z.value) == null ? void 0 : _A.asset_house) == null ? void 0 : _B.full_name}&amount=${(_E = (_D = (_C = WORKORDER_show_model.useModel) == null ? void 0 : _C.dataShow) == null ? void 0 : _D.value) == null ? void 0 : _E.amount}`
      });
      return;
    }
    if (((_H = (_G = (_F = WORKORDER_show_model.useModel) == null ? void 0 : _F.dataShow) == null ? void 0 : _G.value) == null ? void 0 : _H.status) === "Processing") {
      common_vendor.index.navigateTo({
        url: `/WORKORDER/update/index?id=${(_K = (_J = (_I = WORKORDER_show_model.useModel) == null ? void 0 : _I.dataShow) == null ? void 0 : _J.value) == null ? void 0 : _K.id}&projects_id=${(_N = (_M = (_L = WORKORDER_show_model.useModel) == null ? void 0 : _L.dataShow) == null ? void 0 : _M.value) == null ? void 0 : _N.asset_projects_id}&location=${(_Q = (_P = (_O = WORKORDER_show_model.useModel) == null ? void 0 : _O.dataShow) == null ? void 0 : _P.value) == null ? void 0 : _Q.location}`
      });
    }
  },
  handlePreviewImage(idx) {
    var _a, _b, _c, _d;
    let urlList = ((_d = (_c = (_b = (_a = WORKORDER_show_model.useModel) == null ? void 0 : _a.dataShow) == null ? void 0 : _b.value) == null ? void 0 : _c.attachments) == null ? void 0 : _d.map((item) => item == null ? void 0 : item.url)) || [];
    common_vendor.index.previewImage({
      urls: urlList,
      current: idx
    });
  },
  handlePendingPaymentQrCode(e) {
  },
  handleCopyPhone() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
    if ((_c = (_b = (_a = WORKORDER_show_model.useModel) == null ? void 0 : _a.dataShow) == null ? void 0 : _b.value) == null ? void 0 : _c.contact_phone) {
      common_vendor.index.makePhoneCall({
        phoneNumber: (_f = (_e = (_d = WORKORDER_show_model.useModel) == null ? void 0 : _d.dataShow) == null ? void 0 : _e.value) == null ? void 0 : _f.contact_phone
      });
      return;
    }
    if ((_i = (_h = (_g = WORKORDER_show_model.useModel) == null ? void 0 : _g.dataShow) == null ? void 0 : _h.value) == null ? void 0 : _i.reporter_phone) {
      common_vendor.index.makePhoneCall({
        phoneNumber: (_l = (_k = (_j = WORKORDER_show_model.useModel) == null ? void 0 : _j.dataShow) == null ? void 0 : _k.value) == null ? void 0 : _l.reporter_phone
      });
      return;
    }
    common_vendor.index.showToast({
      title: "暂无电话号码",
      icon: "none"
    });
  }
};
exports.method = method;
