"use strict";const e=require("../../../common/vendor.js"),l=require("../../../common/libraries/apiLoading.js"),a=require("../../../gen/Apis.js"),u=require("./model.js"),o=()=>{var e,o;l.getApiLoading(a.Apis.Meter.HouseMeters.List,null==(o=null==(e=u.useModel)?void 0:e.formData)?void 0:o.value).then(e=>{u.useModel.listData.value=[...u.useModel.listData.value,...null==e?void 0:e.data],u.useModel.metaData.value=null==e?void 0:e.meta})},d=()=>{u.useModel.formData.value.page=1,u.useModel.listData.value=[],o()},i={getList:o,getMenuList:()=>{var e,o;l.getApiLoading(a.Apis.Asset.AssetHouses.SelectPermissionUnit,null==(o=null==(e=u.useModel)?void 0:e.formData)?void 0:o.value).then(e=>{var l,a,o,i,s;u.useModel.listMenuData.value=null==e?void 0:e.data,(null==(l=null==e?void 0:e.data)?void 0:l.length)&&((null==(o=null==(a=u.useModel)?void 0:a.currentTabs)?void 0:o.value)||(u.useModel.formData.value.asset_units_id=null==(s=null==(i=null==e?void 0:e.data)?void 0:i[0])?void 0:s.id),d())})},handleSearch(){d()},handleChangeUsageTypeFilter(e){u.useModel.formData.value.usage_type=(null==e?void 0:e.value)||void 0,d(),console.log("e",e)},handleChangeOverdueDaysFilter(e){var l,a,o;(null==(o=null==(a=null==(l=u.useModel)?void 0:l.formData)?void 0:a.value)?void 0:o.overdue_days)===(null==e?void 0:e.value)?(u.useModel.formData.value.overdue_days=void 0,u.useModel.activeColor.value=""):(u.useModel.formData.value.overdue_days=null==e?void 0:e.value,u.useModel.activeColor.value=null==e?void 0:e.color),d()},handleChangeFilter(e){u.useModel.formData.value={...u.useModel.formData.value,...e,page:1},u.useModel.listData.value=[],o()},handleChangeFilterReadingStatus(e){u.useModel.formData.value={...u.useModel.formData.value,reading_status:(null==e?void 0:e.value)||void 0},u.useModel.listData.value=[],o()},handleChangeTabs(e,l){var a,o,i,s,t,v,n,r,M,m;u.useModel.currentTabs.value=e,u.useModel.formData.value=e?{meter_type:null==l?void 0:l.value,asset_projects_id:null==(i=null==(o=null==(a=u.useModel)?void 0:a.formData)?void 0:o.value)?void 0:i.asset_projects_id}:{meter_type:null==l?void 0:l.value,asset_projects_id:null==(v=null==(t=null==(s=u.useModel)?void 0:s.formData)?void 0:t.value)?void 0:v.asset_projects_id,asset_units_id:null==(m=null==(M=null==(r=null==(n=u.useModel)?void 0:n.listMenuData)?void 0:r.value)?void 0:M[0])?void 0:m.id},d()},handleLoad(e){u.useModel.formData.value.page=null==e?void 0:e.page,o()},handleToAdd(l){e.index.navigateTo({url:`/ME/instrument/add/index?id=${null==l?void 0:l.id}`})},handleToLog(){e.index.navigateTo({url:"/ME/instrument/log/index?id="})}};exports.method=i;
