import{M as k,I as q,r as S,Y as U,a5 as D,aG as F,F as P,W as R}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897314.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import{c as V,d as B,e as M,v as A}from"./cardManagement.1703796278973.js";import{O as J,T as $}from"./data.17037962789733.js";import{d as z,k as v,v as E,l as G,m as Q,r as W,o as Y,c as H,a as r,z as I,b as l,u as t,t as K,a5 as _}from"./vue.1703796278973.js";const X={style:{"margin-top":"10px"}},ue=z({__name:"Save",props:{type:{type:String},data:{type:Object,default:void 0}},emits:["change"],setup(i,{emit:g}){const u=i,c=v(!1),C=v([]),p=v(),a=E({id:"",iccId:"",platformConfigId:void 0,operatorName:void 0,cardType:void 0,describe:""}),b=async o=>{var n;const e=await A(o);return e.status===200?(n=e.result)!=null&&n.passed?"":e.result.reason:"请输入输入正确的ICCID"},y={id:[{required:!0,message:"请输入卡号"},{max:64,message:"最多输入64个字符"},{validator:async(o,e)=>{if(e){const n=u.type==="add"?await b(e):"";return n===""?Promise.resolve():Promise.reject(new Error(`${n}`))}},trigger:"blur"}],iccId:[{required:!0,message:"请输入ICCID"},{max:64,message:"最多输入64个字符"}],platformConfigId:[{required:!0,message:"请选择平台对接"}],operatorName:[{required:!0,message:"请选择运营商"}],cardType:[{required:!0,message:"请选择类型"}]},m=(o,e)=>e.componentOptions.children[0].text.toLowerCase().indexOf(o.toLowerCase())>=0,w=G(()=>C.value.filter(o=>o.operatorName===a.operatorName).map(o=>({label:o.name,value:o.id})));Q(()=>u.data,o=>{V({paging:!1,sorts:[{name:"createTime",order:"desc"}],terms:[{column:"state",value:"enabled"}]}).then(e=>{e.status===200&&(C.value=e.result)}),Object.assign(a,o)},{immediate:!0,deep:!0});const h=()=>{g("change",!1),p.value.resetFields()},x=()=>{p.value.validate().then(async()=>{c.value=!0;const o=u.type==="add"?await B(_(a)).catch(e=>e):await M(_(a)).catch(e=>e);c.value=!1,o.status===200&&(k.success("操作成功"),g("change",!0),p.value.resetFields())}).catch(o=>{console.log("error",o)})};return(o,e)=>{const n=q,d=S,T=W("AIcon"),N=U,f=D,j=F,L=P,O=R;return Y(),H(O,{maskClosable:!1,width:"600px",visible:!0,title:i.type==="add"?"新增":"编辑",okText:"确定",cancelText:"取消",onOk:x,onCancel:h,confirmLoading:t(c)},{default:r(()=>[I("div",X,[l(L,{layout:"vertical",ref_key:"formRef",ref:p,rules:y,model:t(a)},{default:r(()=>[l(d,{label:"卡号",name:"id"},{default:r(()=>[l(n,{value:t(a).id,"onUpdate:value":e[0]||(e[0]=s=>t(a).id=s),placeholder:"请输入卡号",disabled:i.type==="edit"},null,8,["value","disabled"])]),_:1}),l(d,{name:"iccId"},{label:r(()=>[I("span",null,[K(" ICCID "),l(N,{title:"IC卡的唯一识别号码"},{default:r(()=>[l(T,{type:"QuestionCircleOutlined",style:{"margin-left":"2px"}})]),_:1})])]),default:r(()=>[l(n,{value:t(a).iccId,"onUpdate:value":e[1]||(e[1]=s=>t(a).iccId=s),placeholder:"请输入ICCID",disabled:i.type==="edit"},null,8,["value","disabled"])]),_:1}),l(d,{label:"运营商",name:"operatorName"},{default:r(()=>[l(f,{allowClear:"",showSearch:"","filter-option":m,disabled:i.type==="edit",options:t(J),value:t(a).operatorName,"onUpdate:value":e[2]||(e[2]=s=>t(a).operatorName=s),placeholder:"请选择运营商",onSelect:e[3]||(e[3]=()=>{t(a).platformConfigId=void 0})},null,8,["disabled","options","value"])]),_:1}),l(d,{label:"平台对接",name:"platformConfigId"},{default:r(()=>[l(f,{showSearch:"","filter-option":m,disabled:i.type==="edit",allowClear:"",options:t(w),value:t(a).platformConfigId,"onUpdate:value":e[4]||(e[4]=s=>t(a).platformConfigId=s),placeholder:"请选择平台对接"},null,8,["disabled","options","value"])]),_:1}),l(d,{label:"类型",name:"cardType"},{default:r(()=>[l(f,{allowClear:"",showSearch:"",disabled:i.type==="edit","filter-option":m,options:t($),value:t(a).cardType,"onUpdate:value":e[5]||(e[5]=s=>t(a).cardType=s),placeholder:"请选择类型"},null,8,["disabled","options","value"])]),_:1}),l(d,{label:"说明",name:"describe"},{default:r(()=>[l(j,{value:t(a).describe,"onUpdate:value":e[6]||(e[6]=s=>t(a).describe=s),placeholder:"请输入说明",showCount:"",maxlength:200},null,8,["value"])]),_:1})]),_:1},8,["model"])])]),_:1},8,["title","confirmLoading"])}}});export{ue as _};
