"use strict";const e=require("../../common/vendor.js"),t=require("../../common/assets.js"),a=require("../../request/api.js");if(!Array){(e.resolveComponent("up-datetime-picker")+e.resolveComponent("up-input")+e.resolveComponent("u-loadmore"))()}Math||((()=>"../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js")+(()=>"../../uni_modules/uview-plus/components/u-input/u-input.js")+(()=>"../../uni_modules/uview-plus/components/u-loadmore/u-loadmore.js"))();const o={__name:"Inspectionwarning",setup(o){const l=e.reactive({startDate:"",endDate:"",deptName:""}),u=e.ref(!1),s=e.ref(!1),n=e.ref(Number(new Date)),r=e.ref(Number(new Date)),d=e.reactive({total:0,overdue:0,pending:0,completed:0,overdueCompleted:0,onTimeCompleted:0});e.reactive({total:0,overdue:0,completed:0,pending:0});const i=e.ref([]),v=e.ref(1),c=e.ref(20),m=e.ref("loadmore"),p=e.ref([{label:"全部状态",value:0,count:null},{label:"逾期未检",value:1,count:null},{label:"严重逾期",value:2,count:null},{label:"期限内待检",value:3,count:null},{label:"逾期已完成",value:4,count:null},{label:"按期已完成",value:5,count:null}]),g=e.ref(0),f=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},D=e=>{const t=f(e.value);l.startDate=t,u.value=!1},h=e=>{const t=f(e.value);l.endDate=t,s.value=!1},N=e=>{if(!e||"按期"===e)return"status-normal";const t=parseInt(e);return t>=7?"status-serious":t>=1?"status-overdue":"status-normal"},b=(e,t)=>{if(!e||"按期"===e)return"已完成"===t?"按期已完成":"期限内待检";const a=parseInt(e);return a>=7?"严重逾期":a>=1?"已完成"===t?"逾期已完成":"逾期未检":"期限内待检"},w=async()=>{try{const e={pageNum:v.value,pageSize:c.value};l.startDate&&(e.startDate=l.startDate),l.endDate&&(e.endDate=l.endDate),l.deptName&&l.deptName.trim()&&(e.deptName=l.deptName.trim());const t=p.value[g.value].value;0!==t&&(e.inspectionStatus=t);const o=await a.getInspectionWarningList(e);if(0===o.code)if(o.data.statistics&&(d.total=o.data.statistics.total||0,d.overdue=o.data.statistics.overdue||0,d.pending=o.data.statistics.pending||0,d.completed=o.data.statistics.completed||0,d.overdueCompleted=o.data.statistics.overdueCompleted||0,d.onTimeCompleted=o.data.statistics.onTimeCompleted||0,p.value[0].count=o.data.statistics.total||0,p.value[1].count=o.data.statistics.overdue||0,p.value[2].count=o.data.statistics.pending||0,p.value[3].count=o.data.statistics.completed||0,p.value[4].count=o.data.statistics.overdueCompleted||0,p.value[5].count=o.data.statistics.onTimeCompleted||0),o.data.page&&o.data.page.records){const e=o.data.page.records;1===v.value?i.value=e:i.value=[...i.value,...e];const t=o.data.page.total||0;i.value.length>=t?m.value="nomore":m.value="loadmore"}else m.value="nomore"}catch(e){console.error("获取预警列表失败:",e)}},C=()=>{v.value=1,i.value=[],w()};return e.onReachBottom((()=>{"loadmore"===m.value&&(v.value++,w())})),e.onShow((()=>{w()})),(a,o)=>e.e({a:t._imports_0$1,b:e.t(l.startDate||"请选择"),c:e.n(l.startDate?"date-value":"date-placeholder"),d:e.o((e=>u.value=!0)),e:e.o(D),f:e.o((e=>u.value=!1)),g:e.o((e=>u.value=!1)),h:e.o((e=>n.value=e)),i:e.p({show:u.value,mode:"date",modelValue:n.value}),j:e.t(l.endDate||"请选择"),k:e.n(l.endDate?"date-value":"date-placeholder"),l:e.o((e=>s.value=!0)),m:e.o(h),n:e.o((e=>s.value=!1)),o:e.o((e=>s.value=!1)),p:e.o((e=>r.value=e)),q:e.p({show:s.value,mode:"date",modelValue:r.value}),r:e.o((e=>l.deptName=e)),s:e.p({placeholder:"请输入公司名称",border:"surround",modelValue:l.deptName}),t:e.o(C),v:t._imports_1,w:e.t(d.total),x:e.t(d.overdue),y:e.t(d.onTimeCompleted),z:e.t(d.completed),A:e.f(p.value,((t,a,o)=>e.e({a:e.t(t.label),b:e.t(null!=t.count?t.count:""),c:g.value===a},(g.value,{}),{d:a,e:g.value===a?1:"",f:e.o((e=>(e=>{g.value=e,v.value=1,i.value=[],w()})(a)),a)}))),B:e.f(i.value,((t,a,o)=>({a:e.t(t.deptName||"-"),b:e.t(b(t.overdueDays,t.statusName)),c:e.n(N(t.overdueDays)),d:e.t(t.planName||"-"),e:e.t(t.cycleName||"-"),f:e.t(t.taskDate||"-"),g:e.t(t.finishTime||"未完成"),h:e.t(t.executorName||"-"),i:e.t(t.overdueDays||"-"),j:t.id}))),C:i.value.length>0},i.value.length>0?{D:e.p({status:m.value})}:{},{E:0===i.value.length},(i.value.length,{}),{F:e.gei(a,"")})}},l=e._export_sfc(o,[["__scopeId","data-v-b713017f"]]);wx.createPage(l);