PageSourceSearch

https://mhtclouding.com/tongying/assets/index-CyFYJYpQ.js

js mhtclouding.com collected 2026-10-02 16:02:59 UTC 11,736 bytes, 1 lines download raw bytes

1import{_ as W,u as Z,a as ee,r as _,M as le,C as ae,Y as S,w as B,d as p,o as f,c as y,f as e,h as t,e as V,H as P,I as C,m as N,x as T,p as b,ag as te,ah as oe,n as ne,A as re,X as m,E as se,s as ie,t as de,v as ce}from"./index-uGWb9Yh4.js";import{g as ue,u as me}from"./client--wdBgmOq.js";import{l as pe}from"./level-5Cit4iud.js";import{R as fe}from"./index-DJfEwVmX.js";/* empty css                                                              */const _e=v=>(ie("data-v-444cc04e"),v=v(),de(),v),ge={class:"app-container"},he={class:"section-container"},ye=_e(()=>V("div",{class:"section-title"},"基本信息",-1)),be={class:"section-container"},Ve={class:"section-title"},ve={class:"contact-actions"},we={__name:"index",setup(v){const{proxy:U}=ce(),w=Z();ee();const g=_(w.query.clientId||w.params.clientId||null),O=_(),c=_(!1),a=le({clientId:null,clientCode:null,clientOfficial:"",clientPlan:"",clientType:void 0,clientAddress:"",levelId:void 0,companyName:"",clientSource:void 0,ownerUserId:void 0,aggregateAmount:0,remark:"",addressInfo:"",flowToPoolReason:"",contacts:[{contactCoreId:null,realName:"",phone:"",email:"",wechatId:"",department:"",position:"",isPrimary:1}]}),L=_([]),q=_([]),A=_([]),D=_([]);_([]),_(!1);const k={realName:[{required:!0,message:"联系人姓名不能为空",trigger:"blur"},{min:1,max:50,message:"姓名长度必须介于 1 和 50 个字符之间",trigger:"blur"}],email:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}]},E={companyName:[{required:!0,message:"公司名称不能为空",trigger:"blur"},{min:1,max:100,message:"公司名称长度必须介于 1 和 100 个字符之间",trigger:"blur"}],clientType:[{required:!0,message:"请选择客户类型",trigger:"change"}],clientSource:[{required:!0,message:"请选择客户来源",trigger:"change"}],clientPlan:[{required:!0,message:"请选择客户状态",trigger:"change"}],clientAddress:[{required:!0,message:"请选择客户区域",trigger:"change"}]},$=async()=>{if(g.value)try{c.value=!0;const n=await ue(g.value);if(n.code===200&&n.data){const l=n.data;a.clientId=l.clientId,a.companyName=l.companyName||"",a.clientOfficial=l.clientOfficial||"",a.clientPlan=l.clientPlan||"",a.clientType=l.clientType||void 0,a.clientAddress=l.clientAddress||"",a.clientCode=l.clientCode||"",a.clientSource=l.clientSource||void 0,a.remark=l.remark||"",a.intro=l.intro||"",a.termsText=l.termsText||"",a.addressInfo=l.addressInfo||"",l.contactList&&l.contactList.length>0?a.contacts=l.contactList.map(r=>({contactCoreId:r.contactCoreId||null,realName:r.realName||"",phone:r.phone||"",email:r.email||"",wechatId:r.wechatId||"",department:r.department||"",position:r.position||"",isPrimary:r.isPrimary||0})):a.contacts=[{contactCoreId:null,realName:"",phone:"",email:"",wechatId:"",department:"",position:"",isPrimary:1}]}else m.error("获取客户信息失败")}catch(n){console.error("获取客户详情失败:",n),m.error("获取客户信息失败")}finally{c.value=!1}};ae(async()=>{try{const[n,l,r,s]=await Promise.all([S("customer_type"),S("client_source"),S("client_plan"),pe()]);L.value=n.data||[],q.value=l.data||[],A.value=r.data||[],D.value=s.data||[]}catch(n){console.error("初始化字典数据失败:",n)}g.value&&await $()}),B(()=>w.query.clientId,n=>{n&&(g.value=n,$())}),B(()=>w.params.clientId,n=>{n&&(g.value=n,$())});const F=()=>{a.contacts.push({contactCoreId:null,realName:"",phone:"",email:"",wechatId:"",department:"",position:"",isPrimary:0})},M=n=>{if(a.contacts.length<=1){m.warning("至少需要保留一个联系人");return}if(a.contacts[n].isPrimary===1&&a.contacts.length>1){const r=n===0?1:0;a.contacts[r].isPrimary=1}a.contacts.splice(n,1)},H=n=>
1{a.contacts[n].isPrimary===1?a.contacts.forEach((l,r)=>{r!==n&&(l.isPrimary=0)}):!a.contacts.some(r=>r.isPrimary===1)&&a.contacts.length>0&&(a.contacts[0].isPrimary=1)},X=()=>{const n={...a};return!n.contacts.some(r=>r.isPrimary===1)&&n.contacts.length>0&&(n.contacts[0].isPrimary=1),n},Y=()=>{for(let n=0;n<a.contacts.length;n++){const l=a.contacts[n];if(!l.realName||!l.realName.trim())return m.error(`请输入第${n+1}个联系人的姓名`),!1;if(l.realName.length<1||l.realName.length>50)return m.error(`第${n+1}个联系人的姓名长度必须在1-50个字符之间`),!1;if(l.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.email))return m.error(`第${n+1}个联系人的邮箱格式不正确`),!1}return!0},j=async()=>{try{return await O.value.validate(),!0}catch(n){return console.error("表单验证失败:",n),!1}};async function z(){var n,l;if(c.value){m.warning("正在提交,请稍候...");return}try{if(!await j()){m.error("请检查表单必填项");return}if(!Y())return;c.value=!0;const i=X();g.value?(await me(i),m.success("更新客户成功")):(await addClient(i),m.success("新增客户成功")),U.$tab.closePage()}catch(r){console.error("提交失败:",r);const s=g.value?"更新客户失败":"新增客户失败";m.error(((l=(n=r.response)==null?void 0:n.data)==null?void 0:l.msg)||r.message||s)}finally{c.value=!1}}function G(){c.value?se.confirm("正在提交数据,确定要取消吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{U.$tab.closePage()}):U.$tab.closePage()}return(n,l)=>{const r=p("el-input"),s=p("el-form-item"),i=p("el-col"),x=p("el-option"),R=p("el-select"),h=p("el-row"),I=p("el-button"),J=p("el-checkbox"),K=p("el-divider"),Q=p("el-form");return f(),y("div",ge,[e(Q,{ref_key:"clientFormRef",ref:O,model:a,rules:E,"label-width":"100px"},{default:t(()=>[V("div",he,[ye,e(h,{gutter:20},{default:t(()=>[e(i,{span:8},{default:t(()=>[e(s,{label:"公司名称",prop:"companyName"},{default:t(()=>[e(r,{modelValue:a.companyName,"onUpdate:modelValue":l[0]||(l[0]=o=>a.companyName=o),placeholder:"请输入公司名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),e(i,{span:8},{default:t(()=>[e(s,{label:"客户类型",prop:"clientType"},{default:t(()=>[e(R,{modelValue:a.clientType,"onUpdate:modelValue":l[1]||(l[1]=o=>a.clientType=o),placeholder:"请选择客户类型",clearable:"",style:{width:"100%"}},{default:t(()=>[(f(!0),y(P,null,C(L.value,o=>(f(),N(x,{key:o.value,label:o.dictLabel,value:o.dictValue},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(i,{span:8},{default:t(()=>[e(s,{label:"客户来源",prop:"clientSource"},{default:t(()=>[e(R,{modelValue:a.clientSource,"onUpdate:modelValue":l[2]||(l[2]=o=>a.clientSource=o),placeholder:"请选择客户来源",clearable:"",style:{width:"100%"}},{default:t(()=>[(f(!0),y(P,null,C(q.value,o=>(f(),N(x,{key:o.value,label:o.dictLabel,value:o.dictValue},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(i,{span:8},{default:t(()=>[e(s,{label:"公司官网",prop:"clientOfficial"},{default:t(()=>[e(r,{modelValue:a.clientOfficial,"onUpdate:modelValue":l[3]||(l[3]=o=>a.clientOfficial=o),placeholder:"请输入官方网站",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),e(i,{span:8},{default:t(()=>[e(s,{label:"客户状态",prop:"clientPlan"},{default:t(()=>[e(R,{modelValue:a.clientPlan,"onUpdate:modelValue":l[4]||(l[4]=o=>a.clientPlan=o),placeholder:"请客户状态客户来源",clearable:"",style:{width:"100%"}},{default:t(()=>[(f(!0),y(P,null,C(A.value,o=>(f(),N(x,{key:o.value,label:o.dictLabel,value:o.dictValue},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(i,{span:8},{default:t(()=>[e(s,{label:"客户区域",prop:"region"},{default:t(()=>[e(T(fe),{modelValue:a.clientAddress,"onUpdate:modelValue":l[5]||(l[5]=o=>a.clientAddress=o),placeholder:"请选择客户区域"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(h,null,{default:t(()=>[e(i,{span:24},{default:t(()=>[e(s,{label:"详细地址"},{default:t(()=>[e(r,{modelValue:a.addressInfo,"onUpdate:modelValue":l[6]||(l[6]=o=>a.addressInfo=o),rows:3,placeholder:"请输入详细地址",maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(h,null,{default:t(()=>[e(i,{span:24},{default:t(()=>[e(s,{label:"客户编号"},{default:t(()=>
1[e(r,{modelValue:a.clientCode,"onUpdate:modelValue":l[7]||(l[7]=o=>a.clientCode=o),rows:3,maxlength:"200","show-word-limit":"",disabled:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(h,null,{default:t(()=>[e(i,{span:24},{default:t(()=>[e(s,{label:"备注"},{default:t(()=>[e(r,{modelValue:a.remark,"onUpdate:modelValue":l[8]||(l[8]=o=>a.remark=o),type:"textarea",rows:3,placeholder:"请输入备注信息",maxlength:"500","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),V("div",be,[V("div",Ve,[b(" 联系人信息 "),e(I,{type:"primary",link:"",onClick:F,class:"add-contact-btn",icon:T(te),disabled:c.value},{default:t(()=>[b(" 添加联系人 ")]),_:1},8,["icon","disabled"])]),(f(!0),y(P,null,C(a.contacts,(o,u)=>(f(),y("div",{key:o.contactCoreId||`new_${u}`,class:"contact-item"},[e(h,{gutter:20},{default:t(()=>[e(i,{span:8},{default:t(()=>[e(s,{label:`联系人${u+1}`,prop:`contacts.${u}.realName`,rules:k.realName},{default:t(()=>[e(r,{modelValue:o.realName,"onUpdate:modelValue":d=>o.realName=d,placeholder:"请输入联系人姓名",clearable:"",style:{width:"calc(100% - 40px)","margin-right":"8px"}},null,8,["modelValue","onUpdate:modelValue"]),e(J,{modelValue:o.isPrimary,"onUpdate:modelValue":d=>o.isPrimary=d,"true-label":1,"false-label":0,onChange:d=>H(u)},{default:t(()=>[b(" 主要 ")]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","prop","rules"])]),_:2},1024),e(i,{span:8},{default:t(()=>[e(s,{label:"手机",prop:`contacts.${u}.phone`,rules:k.phone},{default:t(()=>[e(r,{modelValue:o.phone,"onUpdate:modelValue":d=>o.phone=d,placeholder:"请输入手机号码",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop","rules"])]),_:2},1024),e(i,{span:8},{default:t(()=>[e(s,{label:"邮箱",prop:`contacts.${u}.email`,rules:k.email},{default:t(()=>[e(r,{modelValue:o.email,"onUpdate:modelValue":d=>o.email=d,placeholder:"请输入邮箱",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop","rules"])]),_:2},1024)]),_:2},1024),e(h,{gutter:20},{default:t(()=>[e(i,{span:8},{default:t(()=>[e(s,{label:"微信",prop:`contacts.${u}.wechatId`},{default:t(()=>[e(r,{modelValue:o.wechatId,"onUpdate:modelValue":d=>o.wechatId=d,placeholder:"请输入微信号",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),e(i,{span:8},{default:t(()=>[e(s,{label:"部门",prop:`contacts.${u}.department`},{default:t(()=>[e(r,{modelValue:o.department,"onUpdate:modelValue":d=>o.department=d,placeholder:"请输入部门",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),e(i,{span:8},{default:t(()=>[e(s,{label:"职位",prop:`contacts.${u}.position`},{default:t(()=>[e(r,{modelValue:o.position,"onUpdate:modelValue":d=>o.position=d,placeholder:"请输入职位",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024),V("div",ve,[e(I,{type:"danger",link:"",icon:T(oe),onClick:d=>M(u),disabled:a.contacts.length===1||c.value},{default:t(()=>[b(" 删除联系人 ")]),_:2},1032,["icon","onClick","disabled"])]),u<a.contacts.length-1?(f(),N(K,{key:0})):ne("",!0)]))),128))]),e(h,null,{default:t(()=>[e(i,{span:24,class:"button-container"},{default:t(()=>[e(I,{type:"primary",onClick:z,loading:c.value,disabled:c.value},{default:t(()=>[b(re(c.value?"提交中...":g.value?"更新":"保 存"),1)]),_:1},8,["loading","disabled"]),e(I,{onClick:G,disabled:c.value},{default:t(()=>[b("取 消")]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["model"])])}}},ke=W(we,[["__scopeId","data-v-444cc04e"]]);export{ke as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.