import{d as re,K as ce,k as f,p as de,r as I,o as _,c as x,a,b as n,u as l,t as h,M as pe,y as ue,j as me,z as r,A as c,x as K,F as U,h as ve,B as R,G as fe,H as ye}from"./vue.1703796278973.js";import{M as u,a0 as _e,av as he,aw as Ce,$ as ge,aU as xe,ax as ke}from"./index.17037962789732.js";import"./index.1703796278973300.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import{_ as we}from"./index.170379627897313.js";import"./index.170379627897330.js";import"./index.170379627897335.js";import"./index.170379627897319.js";import"./index.170379627897327.js";import"./index.170379627897336.js";import{_ as Se}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import{a as G}from"./dayjs.min.1703796278973.js";import{c as Te,h as Ie,u as be,i as Fe,r as Me,j as De,k as Be,l as Oe,m as Ae,s as Ne,n as Re}from"./cardManagement.1703796278973.js";import{a as je}from"./comm.1703796278973.js";import{_ as $e}from"./BindDevice.vue_vue_type_script_setup_true_lang.1703796278973.js";import Pe from"./Import.1703796278973.js";import{_ as Ye}from"./Export.vue_vue_type_script_setup_true_lang.1703796278973.js";import{_ as Ve}from"./Save.vue_vue_type_script_setup_true_lang.17037962789737.js";import{h as Ee}from"./system.1703796278973.js";import{_ as He}from"./index.vue_vue_type_script_setup_true_lang.17037962789733.js";import{_ as Je}from"./index.vue_vue_type_script_setup_true_lang.170379627897333.js";import{u as qe}from"./permission.1703796278973.js";import{u as Le}from"./useParams.1703796278973.js";import{O as ze,a as Ke}from"./data.17037962789733.js";import{_ as Ue}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./index.170379627897337.js";import"./index.170379627897333.js";import"./moment.1703796278973.js";import"./index.170379627897318.js";import"./UploadFile.vue_vue_type_script_setup_true_lang.1703796278973.js";import"./index.170379627897329.js";import"./utils.1703796278973.js";import"./consts.1703796278973.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./404.1703796278973.js";const V=b=>(fe("data-v-44451425"),b=b(),ye(),b),Ge=["src"],Qe={style:{"font-size":"16px","font-weight":"600"}},We=V(()=>r("div",{class:"card-item-content-text"}," 平台对接 ",-1)),Xe=V(()=>r("div",{class:"card-item-content-text"},"类型",-1)),Ze=V(()=>r("div",{class:"card-item-content-text"}," 绑定设备 ",-1)),et={class:"content-bottom"},tt={class:"progress-text"},at={class:"card-item-content-text"},ot=re({__name:"index",setup(b){ce();const E=Ee(),m=f({}),H=f({}),s=f([]),j=f(!1),F=f(!1),$=f(!1),M=f(!1),P=f(),D=f({}),Y=f(""),w=f(!1),J=[{title:"卡号",dataIndex:"id",key:"id",width:200,ellipsis:!0,fixed:"left",search:{type:"string"}},{title:"ICCID",dataIndex:"iccId",key:"iccId",ellipsis:!0,width:200,search:{type:"string",defaultTermType:"eq"}},{title:"绑定设备",dataIndex:"deviceId",key:"deviceId",ellipsis:!0,scopedSlots:!0,width:200,search:{type:"string",rename:"deviceName"}},{title:"平台对接",dataIndex:"platformConfigName",key:"platformConfigName",width:200,search:{rename:"platformConfigId",type:"select",options:async()=>new Promise(e=>{Te({sorts:[{name:"createTime",order:"desc"}],terms:[{column:"state",value:"enabled"}]}).then(o=>{const p=o.result.map(d=>({label:d.name,value:d.id}));e(p)})})}},{title:"运营商",dataIndex:"operatorName",key:"operatorName",width:120,search:{type:"select",options:ze}},{title:"类型",dataIndex:"cardType",key:"cardType",scopedSlots:!0,width:120,search:{type:"select",options:[{label:"年卡",value:"year"},{label:"季卡",value:"season"},{label:"月卡",value:"month"},{label:"其他",value:"other"}]}},{title:"总流量",dataIndex:"totalFlow",width:120,scopedSlots:!0},{title:"使用流量",dataIndex:"usedFlow",width:120,scopedSlots:!0},{title:"剩余流量",dataIndex:"residualFlow",width:120,scopedSlots:!0},{title:"激活日期",dataIndex:"activationDate",key:"activationDate",scopedSlots:!0,width:200,search:{type:"date"}},{title:"更新时间",dataIndex:"updateTime",key:"updateTime",scopedSlots:!0,width:200,search:{type:"date"}},{title:"状态",dataIndex:"cardStateType",key:"cardStateType",width:180,scopedSlots:!0,search:{type:"select",options:[{label:"激活",value:"using"},{label:"未激活",value:"toBeActivated"},{label:"停机",value:"deactivate"},{label:"其它",value:"using,toBeActivated,deactivate"}]}},{title:"操作",key:"action",fixed:"right",width:250,scopedSlots:!0}],Q=qe().hasPermission,W=Q("iot-card/Platform:add"),X=()=>{var e;(e=m.value)==null||e.reload(),M.value=!1},Z=Le(),q=(e,o)=>{var d,v,S,T,k,B,O,A,N;if(!e)return[];const p=[{key:"update",text:"编辑",tooltip:{title:"编辑"},icon:"EditOutlined",onClick:()=>{F.value=!0,D.value=e,Y.value="edit"}},{key:"bind",text:e.deviceId?"解绑设备":"绑定设备",tooltip:{title:e.deviceId?"解绑设备":"绑定设备"},icon:e.deviceId?"DisconnectOutlined":"LinkOutlined",popConfirm:e.deviceId?{title:"确认解绑设备?",okText:"确定",cancelText:"取消",onConfirm:async()=>{be(e.id).then(C=>{var y;C.status===200&&(u.success("操作成功"),(y=m.value)==null||y.reload())})}}:void 0,onClick:()=>{e.deviceId||(j.value=!0,P.value=e.id)}},{key:((d=e.cardStateType)==null?void 0:d.value)==="toBeActivated"?"active":"action",text:((v=e.cardStateType)==null?void 0:v.value)==="toBeActivated"?"激活":((S=e.cardStateType)==null?void 0:S.value)==="deactivate"?"复机":"停用",tooltip:{title:((T=e.cardStateType)==null?void 0:T.value)==="toBeActivated"?"激活":((k=e.cardStateType)==null?void 0:k.value)==="deactivate"?"复机":"停用"},icon:((B=e.cardStateType)==null?void 0:B.value)==="toBeActivated"?"CheckCircleOutlined":((O=e.cardStateType)==null?void 0:O.value)==="deactivate"?"PoweroffOutlined":"StopOutlined",popConfirm:{title:((A=e.cardStateType)==null?void 0:A.value)==="toBeActivated"?"确认激活?":((N=e.cardStateType)==null?void 0:N.value)==="deactivate"?"确认复机?":"确认停用?",okText:"确定",cancelText:"取消",onConfirm:async()=>{var C,y;((C=e.cardStateType)==null?void 0:C.value)==="toBeActivated"?Fe(e.id).then(g=>{var t;g.status===200&&(u.success("操作成功"),(t=m.value)==null||t.reload())}):((y=e.cardStateType)==null?void 0:y.value)==="deactivate"?Me(e.id).then(g=>{var t;g.status===200&&(u.success("操作成功"),(t=m.value)==null||t.reload())}):De(e.id).then(g=>{var t;g.status===200&&(u.success("操作成功"),(t=m.value)==null||t.reload())})}}},{key:"delete",text:"删除",tooltip:{title:"删除"},popConfirm:{title:"确认删除?",okText:"确定",cancelText:"取消",onConfirm:async()=>{var y;(await Be(e.id)).status===200?(u.success("操作成功"),(y=m.value)==null||y.reload()):u.error("操作失败!")}},icon:"DeleteOutlined"}];return o==="card"?p:[{key:"view",text:"查看",tooltip:{title:"查看"},icon:"EyeOutlined",onClick:()=>{E.jumpPage("iot-card/CardManagement/Detail",{id:e.id})}},...p]},ee=e=>{var p;const o=(p=e==null?void 0:e.terms)==null?void 0:p.map(d=>(d.terms=d.terms.map(v=>(["cardStateType"].includes(v.column)&&!["using","toBeActivated","deactivate"].includes(v.value)&&(v.termType="nin"),v)),d));H.value={terms:o||[]}},te=(e,o)=>{s.value=[...e]},ae=()=>{s.value=[]},oe=e=>{if(w.value)if(s.value.includes(e.id)){const o=s.value.findIndex(p=>p===e.id);s.value.splice(o,1)}else s.value=[...s.value,e.id];else E.jumpPage("iot-card/CardManagement/Detail",{id:e.id})},ie=()=>{s.value=[]},L=()=>{F.value=!0,D.value={},Y.value="add"},ne=e=>{var o;F.value=!1,D.value={},e&&((o=m.value)==null||o.reload())},se=e=>{var o;j.value=!1,P.value="",e&&((o=m.value)==null||o.reload())},le=[{key:"export",text:"批量导出",permission:"iot-card/CardManagement:export",icon:"ExportOutlined",onClick:()=>{$.value=!0}},{key:"import",text:"批量导入",permission:"iot-card/CardManagement:import",icon:"ImportOutlined",onClick:()=>{M.value=!0}},{key:"stop",text:"批量停用",permission:"iot-card/CardManagement:action",icon:"StopOutlined",selected:{popConfirm:{title:"确认停用吗?",onConfirm:()=>{s.value.length>=10&&s.value.length<=100?Oe(s.value).then(e=>{e.status===200&&u.success("操作成功")}):u.warn("仅支持同一个运营商下且最少10条数据,最多100条数据")}}}},{key:"resumption",text:"批量复机",ghost:!0,type:"primary",permission:"iot-card/CardManagement:action",icon:"PoweroffOutlined",selected:{popConfirm:{title:"确认复机吗?",onConfirm:()=>{s.value.length>=10&&s.value.length<=100?Ae(s.value).then(e=>{e.status===200&&u.success("操作成功")}):u.warn("仅支持同一个运营商下且最少10条数据,最多100条数据")}}}},{key:"sync",text:"同步状态",ghost:!0,type:"primary",permission:"iot-card/CardManagement:sync",icon:"SwapOutlined",popConfirm:{title:"确认同步状态吗?",onConfirm:()=>{Ne().then(e=>{var o;e.status===200&&((o=m.value)==null||o.reload(),u.success("同步状态成功"))})}}},{key:"delete",text:"批量删除",danger:!0,permission:"iot-card/CardManagement:delete",icon:"StopOutlined",selected:{popConfirm:{title:"确认删除吗?",onConfirm:async()=>{var o;if(!s.value.length){u.error("请选择数据");return}(await Re(s.value.map(p=>({id:p})))).status===200&&(u.success("操作成功"),s.value=[],(o=m.value)==null||o.reload())}}}}];return de(()=>{Z.params.value.type==="add"&&W&&L()}),(e,o)=>{const p=I("pro-search"),d=I("AIcon"),v=Se,S=_e,T=I("Ellipsis"),k=he,B=Ce,O=ge,A=xe,N=we,C=ke,y=I("FullPage"),g=I("page-container");return _(),x(g,null,{default:a(()=>[n(p,{columns:J,target:"iot-card-management-search",onSearch:ee}),n(y,null,{default:a(()=>[n(C,{scroll:{x:1366},ref_key:"cardManageRef",ref:m,columns:J,request:l(Ie),defaultParams:{sorts:[{name:"createTime",order:"desc"}]},rowSelection:l(w)?{selectedRowKeys:l(s),onChange:te}:!1,onCancelSelect:ae,params:l(H),gridColumn:3},{headerTitle:a(()=>[n(S,null,{default:a(()=>[n(v,{onClick:L,hasPermission:"iot-card/CardManagement:add",type:"primary"},{default:a(()=>[n(d,{type:"PlusOutlined"}),h("新增 ")]),_:1}),n(Je,{isCheck:l(w),"onUpdate:isCheck":o[0]||(o[0]=t=>pe(w)?w.value=t:null),actions:le,onChange:ie},null,8,["isCheck"])]),_:1})]),card:a(t=>[n(N,ue({value:t,onClick:oe,actions:q(t,"card")},t,{active:l(s).includes(t.id),status:t.cardStateType.value,statusText:t.cardStateType.text,statusNames:{using:"processing",toBeActivated:"default",deactivate:"error"}}),{img:a(()=>[me(e.$slots,"img",{},()=>[r("img",{src:l(je)("/iot-card/iot-card-bg.png")},null,8,Ge)],!0)]),content:a(()=>[r("span",Qe,[n(T,{style:{width:"calc(100% - 100px)"}},{default:a(()=>[h(c(t.id),1)]),_:2},1024)]),n(B,{style:{"margin-top":"20px"}},{default:a(()=>[n(k,{span:8},{default:a(()=>[We,r("div",null,c(t.platformConfigName),1)]),_:2},1024),n(k,{span:6},{default:a(()=>[Xe,r("div",null,c(t.cardType.text),1)]),_:2},1024),n(k,{span:6},{default:a(()=>[Ze,n(T,null,{default:a(()=>[h(c(t.deviceName),1)]),_:2},1024)]),_:2},1024)]),_:2},1024),n(O,{style:{margin:"12px 0"}}),r("div",et,[r("div",null,[r("div",tt,[r("div",null,c((t.usedFlow/t.totalFlow*100).toFixed(2))+" % ",1),r("div",at," 总共 "+c(t.totalFlow)+" M ",1)]),n(A,{strokeColor:"#ADC6FF",showInfo:!1,percent:t.usedFlow/t.totalFlow*100},null,8,["percent"])])])]),actions:a(i=>[n(v,{disabled:i.disabled,popConfirm:i.popConfirm,tooltip:{...i.tooltip},onClick:i.onClick,hasPermission:"iot-card/CardManagement:"+i.key},{default:a(()=>[i.key==="delete"?(_(),x(d,{key:0,type:"DeleteOutlined"})):(_(),K(U,{key:1},[n(d,{type:i.icon},null,8,["type"]),r("span",null,c(i==null?void 0:i.text),1)],64))]),_:2},1032,["disabled","popConfirm","tooltip","onClick","hasPermission"])]),_:2},1040,["value","actions","active","status","statusText"])]),deviceId:a(t=>[h(c(t.deviceName),1)]),totalFlow:a(t=>[r("div",null,c(t.totalFlow?t.totalFlow.toFixed(2)+" M":""),1)]),usedFlow:a(t=>[r("div",null,c(t.usedFlow?t.usedFlow.toFixed(2)+" M":""),1)]),residualFlow:a(t=>[r("div",null,c(t.residualFlow?t.residualFlow.toFixed(2)+" M":""),1)]),operatorName:a(t=>[h(c(l(Ke)[t.operatorName]),1)]),cardType:a(t=>[h(c(t.cardType.text),1)]),cardStateType:a(t=>{var i,z;return[n(He,{status:(i=t.cardStateType)==null?void 0:i.value,text:(z=t.cardStateType)==null?void 0:z.text,statusNames:{using:"processing",toBeActivated:"default",deactivate:"error"}},null,8,["status","text"])]}),activationDate:a(t=>[h(c(t.activationDate?l(G)(t.activationDate).format("YYYY-MM-DD HH:mm:ss"):""),1)]),updateTime:a(t=>[h(c(t.updateTime?l(G)(t.updateTime).format("YYYY-MM-DD HH:mm:ss"):""),1)]),action:a(t=>[n(S,{size:16},{default:a(()=>[(_(!0),K(U,null,ve(q(t,"table"),i=>(_(),x(v,{key:i.key,disabled:i.disabled,popConfirm:i.popConfirm,tooltip:{...i.tooltip},onClick:i.onClick,type:"link",style:{padding:"0px"},hasPermission:i.key==="view"?!0:"iot-card/CardManagement:"+i.key,danger:i.key==="delete"},{icon:a(()=>[n(d,{type:i.icon},null,8,["type"])]),_:2},1032,["disabled","popConfirm","tooltip","onClick","hasPermission","danger"]))),128))]),_:2},1024)]),_:3},8,["request","rowSelection","params"])]),_:3}),l(M)?(_(),x(Pe,{key:0,onClose:o[1]||(o[1]=t=>M.value=!1),onSave:X})):R("",!0),l($)?(_(),x(Ye,{key:1,onClose:o[2]||(o[2]=t=>$.value=!1),data:l(s)},null,8,["data"])):R("",!0),l(j)?(_(),x($e,{key:2,cardId:l(P),onChange:se},null,8,["cardId"])):R("",!0),l(F)?(_(),x(Ve,{key:3,type:l(Y),data:l(D),onChange:ne},null,8,["type","data"])):R("",!0)]),_:3})}}});const ra=Ue(ot,[["__scopeId","data-v-44451425"]]);export{ra as default};