Files
threeonecheck_web/unpackage/dist/build/mp-weixin/pages/index/index.js
2026-06-30 09:47:10 +08:00

2 lines
7.2 KiB
JavaScript

"use strict";const e=require("../../common/vendor.js"),a=require("../../common/assets.js"),n=require("../../request/api.js"),t=require("../../request/three_one_api/info.js"),o=require("../../request/request.js");if(!Array){(e.resolveComponent("u-navbar")+e.resolveComponent("u-icon"))()}Math||((()=>"../../uni_modules/uview-plus/components/u-navbar/u-navbar.js")+(()=>"../../uni_modules/uview-plus/components/u-icon/u-icon.js"))();const s={__name:"index",setup(s){const r=e.ref(!0),i=e.reactive({userId:"",username:"",nickName:"",deptId:"",deptName:"",role:"",avatar:"",phone:""}),d=e.computed((()=>"admin"===i.role||"manage"===i.role)),l=[{name:"成员管理",src:"/static/home_icon/chengyuangaunli.png"},{name:"信息填报",src:"/static/home_icon/xinxitianbao.png"},{name:"区域设置",src:"/static/home_icon/quyushezhi.png"},{name:"检查清单",src:"/static/home_icon/jiachaqingdan.png"},{name:"证件管理",src:"/static/home_icon/zhengjianguanli.png"},{name:"隐患排查",src:"/static/home_icon/yinhuanpaicha.png"},{name:"隐患销号",src:"/static/home_icon/yinhuanxiaohao.png"}],c=["隐患排查","隐患销号"],u=e.computed((()=>"common"===i.role?l.filter((e=>c.includes(e.name))):l)),m=e=>{const a=Number(e);return Number.isNaN(a)?0:Math.min(100,Math.max(0,a))},g=a=>{const n=a.id,t=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),o=a.tableId??a.id;if(!n||!t)return void e.index.showToast({title:"缺少任务参数",icon:"none"});const s=a.name||"",r=o?`&tableId=${o}`:"";e.index.navigateTo({url:`/pages/Inspectionresult/detail?oneTableId=${n}&taskDate=${encodeURIComponent(t)}&name=${encodeURIComponent(s)}${r}`})},p=e.ref({pageNum:1,pageSize:4,name:""}),v=e.ref([]),h=e.ref(0),I=e.ref(!1),f=e.ref({}),N=e.computed((()=>!I.value&&h.value>4)),b=(e=[],{reset:a=!1,expandFirst:n=!1}={})=>{const t=a?{}:{...f.value};e.forEach(((e,o)=>{a?t[e.id]=n&&0===o:e.id in t||(t[e.id]=!1)})),f.value=t},x=e=>!!f.value[e],y=e=>{f.value={...f.value,[e]:!f.value[e]}},$=async()=>{var a;if(N.value)try{const t=await n.getCheckPlanList({pageNum:1,pageSize:h.value,name:p.value.name});if(0===t.code){const e=(null==(a=t.data)?void 0:a.records)||[];b(e),v.value=e,I.value=!0}else e.index.showToast({title:t.msg||"加载失败",icon:"none"})}catch(t){console.error(t),e.index.showToast({title:"加载失败",icon:"none"})}},z=e=>e?e.split(" ")[0]:"";e.onShow((()=>{(async()=>{try{const e=await t.getProfileDetail();0===e.code&&e.data&&(i.userId=e.data.userId||"",i.username=e.data.userName||"",i.nickName=e.data.nickName||"",i.deptId=e.data.deptId||"",i.deptName=e.data.deptName||"",i.avatar=e.data.avatar||"",i.phone=e.data.phonenumber||e.data.phone||"",e.data.roles&&e.data.roles.length>0&&(i.role=e.data.roles[0].roleKey||""))}catch(a){console.error("获取用户信息失败:",a);try{const a=e.index.getStorageSync("userInfo");if(a){const e=JSON.parse(a);i.userId=e.userId||"",i.username=e.username||"",i.nickName=e.nickName||"",i.deptId=e.deptId||"",i.deptName=e.deptName||"",i.role=e.role||"",i.avatar=e.avatar||"",i.phone=e.phone||""}}catch(n){console.error("从本地存储获取用户信息失败:",n)}}})(),(async()=>{var e,a;I.value=!1;try{const t=await n.getCheckPlanList({pageNum:1,pageSize:4,name:p.value.name});if(0===t.code){const n=(null==(e=t.data)?void 0:e.records)||[];h.value=Number((null==(a=t.data)?void 0:a.total)??n.length),v.value=n,b(n,{reset:!0,expandFirst:!0})}}catch(t){console.error(t)}finally{r.value=!1}})(),C()}));const _=e.ref({pageNum:1,pageSize:10,name:""}),w=e.ref([]),T=e.ref([{label:"全部",value:null},{label:"待交办",value:1},{label:"待整改",value:2},{label:"待验收",value:3},{label:"待销号",value:4},{label:"已完成",value:5}]),q=e.ref(0),k=e.computed((()=>{const e=T.value[q.value];return e&&null!==e.value?w.value.filter((a=>a.status===e.value)):w.value})),C=async()=>{try{const e=await n.getHiddenDangerList(_.value);console.log(e),0===e.code&&(w.value=e.data.records,console.log(w.value,1111))}catch(e){console.error(e)}finally{r.value=!1}};e.onLoad((()=>{C()}));return(n,t)=>{return e.e({a:a._imports_0,b:e.p({title:"湘西州“三个一”安全管理平台",placeholder:!1,fixed:!1,safeAreaInsetTop:!0,bgColor:"transparent",titleColor:"#fff",border:!1,leftIcon:""}),c:(s=i.avatar,(s?o.toImageUrl(s):"")||"/static/my/default_avater.png"),d:e.t(i.deptName||"未知部门"),e:e.t(i.phone||"未绑定"),f:e.f(u.value,((a,n,t)=>({a:a.src,b:e.t(a.name),c:n,d:e.o((n=>(a=>{const n={"成员管理":"/pages/membermanagemen/membermanagemen","信息填报":"/pages/corporateInformation/corporateInformation","区域设置":"/pages/area/management","检查清单":"/pages/checklist/checklist","检查记录":"/pages/Inspectionlog/Inspectionlog","证件管理":"/pages/Idphotomanagement/Idphotomanagement","隐患排查":"/pages/hiddendanger/Inspection","隐患销号":"/pages/closeout/application","设备登记":"/pages/equipmentregistration/equipmentregistration"}[a.name];n?e.index.navigateTo({url:n}):e.index.showToast({title:"功能开发中",icon:"none"})})(a)),n)}))),g:0===v.value.length},(v.value.length,{}),{h:e.f(v.value,((a,n,t)=>({a:e.t(a.name),b:"02737cee-1-"+t,c:e.p({name:x(a.id)?"arrow-down":"arrow-up",color:"#ffffff",size:"18"}),d:e.o((e=>y(a.id)),a.id),e:e.o((e=>y(a.id)),a.id),f:e.t(a.runModeName),g:e.t(a.cycle),h:e.t(z(a.planStartTime)),i:e.t(z(a.planEndTime)),j:m(a.progress)+"%",k:e.t(m(a.progress)),l:e.t(a.pendingCount??0),m:e.t(a.waitCheckNum??0),n:e.t(a.unusualNum??0),o:e.t(a.finishedCount??0),p:e.o((e=>g(a)),a.id),q:e.o((n=>(a=>{const n=a.tableId??a.id;n?e.index.navigateTo({url:`/pages/Inspectionresult/list?tableId=${n}&name=${encodeURIComponent(a.name||"")}`}):e.index.showToast({title:"缺少检查表ID",icon:"none"})})(a)),a.id),r:x(a.id),s:x(a.id)?"":1,t:a.id}))),i:N.value},N.value?{j:e.o($)}:{},{k:e.f(T.value,((a,n,t)=>({a:e.t(a.label),b:q.value===n?1:"",c:n,d:e.o((e=>(e=>{q.value=e})(n)),n)}))),l:0===k.value.length},(k.value.length,{}),{m:e.f(k.value,((a,n,t)=>e.e({a:e.t(a.title),b:e.t(a.levelName),c:"轻微隐患"===a.levelName?1:"",d:"一般隐患"===a.levelName?1:"",e:"重大隐患"===a.levelName?1:"",f:e.t(a.address),g:e.t(a.source),h:e.t(a.statusName),i:e.t(a.createdAt),j:e.o((n=>(a=>{e.index.navigateTo({url:`/pages/hiddendanger/detail2?hazardId=${a.hazardId}&assignId=${a.assignId||""}`})})(a)),a.hazardId),k:"待整改"===a.statusName&&a.canEdit},"待整改"===a.statusName&&a.canEdit?{l:e.o((n=>(a=>{let n=`/pages/hiddendanger/rectification?hazardId=${a.hazardId}&assignId=${a.assignId}`;a.deadline&&(n+=`&deadline=${encodeURIComponent(a.deadline)}`),a.assigneeId&&(n+=`&assigneeId=${a.assigneeId}`),a.assigneeName&&(n+=`&assigneeName=${encodeURIComponent(a.assigneeName)}`),e.index.navigateTo({url:n})})(a)),a.hazardId)}:{},{m:"待验收"===a.statusName&&d.value},"待验收"===a.statusName&&d.value?{n:e.o((n=>(a=>{e.index.navigateTo({url:`/pages/hiddendanger/acceptance?hazardId=${a.hazardId}&assignId=${a.assignId}&rectifyId=${a.rectifyId}`})})(a)),a.hazardId)}:{},{o:"待交办"===a.statusName},"待交办"===a.statusName?{p:e.o((n=>(a=>{e.index.navigateTo({url:`/pages/hiddendanger/assignment?hazardId=${a.hazardId}&assignId=${a.assignId}`})})(a)),a.hazardId)}:{},{q:a.hazardId}))),n:e.gei(n,"")});var s}}},r=e._export_sfc(s,[["__scopeId","data-v-02737cee"]]);wx.createPage(r);