import{az as p,d as K,Q as D,r as m,x as J,o as _,A as V,B as d,f as t,a,E as g,k as P,c as Q,F as W,R as Z,a2 as G,a8 as H,V as M,S as O,U as X,J as Y,W as $,K as ee,Z as ae,__tla as le}from"./index-92ad187a.js";import{_ as oe,__tla as te}from"./Dialog-44c9fa34.js";import{d as de,__tla as re}from"./index-4ab7b3e0.js";import{u as ue,__tla as se}from"./useMessage-d9788660.js";let x,I,k,T,me=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return se}catch{}})()]).then(async()=>{T=async c=>await p.get({url:"/crm/clue/page",params:c}),I=async c=>await p.delete({url:"/crm/clue/delete?id="+c}),k=async c=>await p.download({url:"/crm/clue/export-excel",params:c}),x=K({__name:"ClueForm",emits:["success"],setup(c,{expose:N,emit:S}){const{t:f}=D(),y=ue(),i=m(!1),b=m(""),n=m(!1),h=m(""),w=m([]),o=m({id:void 0,name:void 0,customerId:void 0,contactNextTime:void 0,telephone:void 0,mobile:void 0,address:void 0,ownerUserId:void 0,contactLastTime:void 0,remark:void 0}),C=J({name:[{required:!0,message:"\u7EBF\u7D22\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],customerId:[{required:!0,message:"\u5BA2\u6237\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),v=m();N({open:async(u,e)=>{i.value=!0,b.value=f("action."+u),h.value=u,q();const s=await de({pageNo:1,pageSize:100,pool:!1});if(w.value=s.list,e){n.value=!0;try{o.value=await(async r=>await p.get({url:"/crm/clue/get?id="+r}))(e)}finally{n.value=!1}}}});const F=S,j=async()=>{if(v&&await v.value.validate()){n.value=!0;try{const u=o.value;h.value==="create"?(await(async e=>await p.post({url:"/crm/clue/create",data:e}))(u),y.success(f("common.createSuccess"))):(await(async e=>await p.put({url:"/crm/clue/update",data:e}))(u),y.success(f("common.updateSuccess"))),i.value=!1,F("success")}finally{n.value=!1}}},q=()=>{var u;o.value={id:void 0,name:void 0,customerId:void 0,contactNextTime:void 0,telephone:void 0,mobile:void 0,address:void 0,ownerUserId:void 0,contactLastTime:void 0,remark:void 0},(u=v.value)==null||u.resetFields()};return(u,e)=>{const s=H,r=M,z=O,L=X,R=Y,A=$,U=ee,B=oe,E=ae;return _(),V(B,{title:a(b),modelValue:a(i),"onUpdate:modelValue":e[9]||(e[9]=l=>G(i)?i.value=l:null)},{footer:d(()=>[t(U,{onClick:j,type:"primary",disabled:a(n)},{default:d(()=>[g("\u786E \u5B9A")]),_:1},8,["disabled"]),t(U,{onClick:e[8]||(e[8]=l=>i.value=!1)},{default:d(()=>[g("\u53D6 \u6D88")]),_:1})]),default:d(()=>[P((_(),V(A,{ref_key:"formRef",ref:v,model:a(o),rules:a(C),"label-width":"100px"},{default:d(()=>[t(r,{label:"\u7EBF\u7D22\u540D\u79F0",prop:"name"},{default:d(()=>[t(s,{modelValue:a(o).name,"onUpdate:modelValue":e[0]||(e[0]=l=>a(o).name=l),placeholder:"\u8BF7\u8F93\u5165\u7EBF\u7D22\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u5BA2\u6237",prop:"customerId"},{default:d(()=>[t(L,{modelValue:a(o).customerId,"onUpdate:modelValue":e[1]||(e[1]=l=>a(o).customerId=l),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5BA2\u6237"},{default:d(()=>[(_(!0),Q(W,null,Z(a(w),l=>(_(),V(z,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(r,{label:"\u4E0B\u6B21\u8054\u7CFB\u65F6\u95F4",prop:"contactNextTime"},{default:d(()=>[t(R,{modelValue:a(o).contactNextTime,"onUpdate:modelValue":e[2]||(e[2]=l=>a(o).contactNextTime=l),type:"date","value-format":"x",placeholder:"\u9009\u62E9\u4E0B\u6B21\u8054\u7CFB\u65F6\u95F4"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u7535\u8BDD",prop:"telephone"},{default:d(()=>[t(s,{modelValue:a(o).telephone,"onUpdate:modelValue":e[3]||(e[3]=l=>a(o).telephone=l),placeholder:"\u8BF7\u8F93\u5165\u7535\u8BDD"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u624B\u673A\u53F7",prop:"mobile"},{default:d(()=>[t(s,{modelValue:a(o).mobile,"onUpdate:modelValue":e[4]||(e[4]=l=>a(o).mobile=l),placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u5730\u5740",prop:"address"},{default:d(()=>[t(s,{modelValue:a(o).address,"onUpdate:modelValue":e[5]||(e[5]=l=>a(o).address=l),placeholder:"\u8BF7\u8F93\u5165\u5730\u5740"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u8D1F\u8D23\u4EBA",prop:"ownerUserId"},{default:d(()=>[t(s,{modelValue:a(o).ownerUserId,"onUpdate:modelValue":e[6]||(e[6]=l=>a(o).ownerUserId=l),placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA"},null,8,["modelValue"])]),_:1}),t(r,{label:"\u5907\u6CE8",prop:"remark"},{default:d(()=>[t(s,{modelValue:a(o).remark,"onUpdate:modelValue":e[7]||(e[7]=l=>a(o).remark=l),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[E,a(n)]])]),_:1},8,["title","modelValue"])}}})});export{x as _,me as __tla,I as d,k as e,T as g};
