engineering/public/admin/assets/edit.b2ea6d61.js
2024-03-04 15:04:21 +08:00

2 lines
16 KiB
JavaScript

import{G as he,H as Ae,I as ve,y as Ce,A as De,P as ke,Q as Ue,B as xe,C as we,w as Oe,L as Re,K as Ie,M as Le,D as Se,k as Pe}from"./element-plus.258bf9e7.js";import{e as qe,f as ze,h as $e}from"./common.c510575b.js";import{u as je,c as $,f as j,_ as Te}from"./index.ec401e3b.js";import{a as Ze,c as Ne,d as Me}from"./custom.13e75d58.js";import{P as Ge}from"./index.9492d03b.js";import{d as K,s as T,r as Z,a0 as h,e as He,o as p,c as _,V as l,M as u,u as N,a as g,W as F,a8 as E,L as V,S as M,T as k,U as G,b7 as Ke,b6 as Qe}from"./@vue.ab566ce7.js";import"./lodash.1d82ee7c.js";import{d as H}from"./department.1c914e1a.js";import{g as We}from"./organization.f0387125.js";import"./@vueuse.8fcae4c2.js";import"./@element-plus.b89f1627.js";import"./lodash-es.49f4af13.js";import"./dayjs.4afe12d3.js";import"./axios.37fc980d.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.87ebc608.js";import"./pinia.b6700c26.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.d0bec2c9.js";import"./color.ea90db3f.js";import"./clone.cbd692e6.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.ad6bc3c0.js";import"./ms.a9ae1d6d.js";import"./nprogress.bcdf1f46.js";import"./vue-clipboard3.c45111bf.js";import"./clipboard.1cb79a0d.js";import"./echarts.50cbfcc9.js";import"./tslib.60310f1a.js";import"./zrender.a255a587.js";import"./highlight.js.4ebdf9a4.js";import"./@highlightjs.62ff6725.js";const U=y=>(Ke("data-v-7f7a4a35"),y=y(),Qe(),y),Je={class:"edit-popup"},Xe={style:{display:"flex","flex-direction":"row-reverse","justify-content":"flex-start","margin-bottom":"30px"}},Ye=U(()=>g("div",{class:"tit"},"\u5BA2\u6237\u57FA\u672C\u8D44\u6599",-1)),el=U(()=>g("div",{class:"tit"},"\u4E3B\u8981\u8D1F\u8D23\u4EBA",-1)),ll=U(()=>g("div",{class:"tit"},"\u5176\u4ED6\u8054\u7CFB\u4EBA",-1)),al=k("+"),ul=k("-"),tl=k(" \u4E0A\u4F20 "),ol={key:0},nl={style:{"margin-left":"5px",display:"block"}},dl=["href"],sl=["onClick"],rl=U(()=>g("div",{class:"tit"},"\u5F00\u7968\u4FE1\u606F",-1)),pl=K({name:"customEdit"}),il=K({...pl,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(y,{expose:Q,emit:O}){const W=je(),J=$.baseUrl+$.urlPrefix,R=T(),x=T(),A=Z("add"),I=h([]);Z(!1);const v=h([]),m=h([{}]),B=h({provinceOptions:[],cityOptions:[],areaOptions:[]}),X=o=>{const a=m.indexOf(o);m.splice(a+1,0,{})},Y=o=>{const a=m.indexOf(o);m.splice(a,1)},ee=He(()=>A.value=="edit"?"\u7F16\u8F91\u5BA2\u6237\u8868":"\u65B0\u589E\u5BA2\u6237\u8868"),le=(o,a,i)=>{a&&!/^1[3|4|5|7|8][0-9]{9}$/.test(a)?i(new Error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801")):i()},ae=(o,a)=>{console.log(o,a),o.phone&&!/^1[3|4|5|7|8][0-9]{9}$/.test(o.phone)&&(j.msgError("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801"),o.phone="")},ue=(o,a)=>{const i=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;o.email&&!i.test(o.email)&&(j.msgError("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801"),o.email="")},te=(o,a,i)=>{if(a&&!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(a))return i(new Error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1\u683C\u5F0F"));i()},oe=()=>{We().then(o=>{Object.assign(I,o),o.length>0&&!t.org_id&&(t.org_id=o[0].id,H({org_id:o[0].id}).then(a=>{a.length>0&&(Object.assign(v,a),t.dept_id=a[0].id)}))})},ne=o=>{t.dept_id="",L(o)},L=o=>{H({org_id:o}).then(a=>{v.splice(0,v.length,...a)})},t=h({id:"",dept_id:"",org_id:"",name:"",custom_type:"",phone:"",credit_rating:"",province:"",city:"",street:"",address:"",notes:"",master_name:"",master_position:"",master_phone:"",master_email:"",master_telephone:"",master_notes:"",company_name:"",company_tin:"",bank_open_address:"",company_telephone:"",bank_name:"",bank_account:"",status:"",other_contacts:[],area:""}),de=h({}),se=(o,a,i,f)=>{if(a.code==0){Pe.error(a.msg);return}m[o].annex||(m[o].annex=[]),m[o].annex.push({uri:a.data.uri,name:a.data.name})},re=o=>{row.annex.splice(o,1)},S=async o=>{for(const a in t)o[a]!=null&&o[a]!=null&&(t[a]=o[a],a=="province"&&await P(),a=="city"&&await q());o.dept_id&&L(o.org_id),t.company_name&&(companyname.value=o.company_name)},pe=async o=>{const a=await Ze({id:o.id});S(a)},ie=async()=>{var a,i;console.log(),A.value=="add"&&m.length>0&&Object.keys(m[0]).length>0&&(t.other_contacts=m),await((a=R.value)==null?void 0:a.validate());const o={...t};A.value=="edit"?await Ne(o):await Me(o),(i=x.value)==null||i.close(),O("success")},me=(o="add")=>{var a;A.value=o,(a=x.value)==null||a.open(),oe()},_e=()=>{O("close")};function ce(o){P()}function fe(o){q()}const be=async()=>{const o=await qe({});B.provinceOptions=o},P=async()=>{const o=await ze({province_code:t.province});B.cityOptions=o},q=async()=>{const o=await $e({city_code:t.city});B.areaOptions=o};return be(),Q({open:me,setFormData:S,getDetail:pe}),(o,a)=>{const i=he,f=Ae,d=ve,s=Ce,r=De,Fe=ke,Ee=Ue,C=xe,D=we,w=Oe,b=Re,Ve=Ie,ge=Le,ye=Se;return p(),_("div",Je,[l(Ge,{ref_key:"popupRef",ref:x,title:N(ee),async:!0,width:"80%",onConfirm:ie,onClose:_e},{default:u(()=>[l(ye,{ref_key:"formRef",ref:R,model:t,"label-width":"90px",rules:de},{default:u(()=>[g("div",Xe,[l(f,{class:"w-[180px]",modelValue:t.dept_id,"onUpdate:modelValue":a[0]||(a[0]=e=>t.dept_id=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u90E8\u95E8"},{default:u(()=>[(p(!0),_(F,null,E(v,(e,n)=>(p(),V(i,{key:n,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l(f,{class:"w-[180px]",modelValue:t.org_id,"onUpdate:modelValue":a[1]||(a[1]=e=>t.org_id=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7EC4\u7EC7",onChange:ne},{default:u(()=>[(p(!0),_(F,null,E(I,(e,n)=>(p(),V(i,{key:n,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),l(D,{class:"mb-2"},{default:u(()=>[Ye,l(C,null,{default:u(()=>[l(r,{span:8},{default:u(()=>[l(s,{label:"\u5BA2\u6237\u59D3\u540D",prop:"name",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(d,{modelValue:t.name,"onUpdate:modelValue":a[2]||(a[2]=e=>t.name=e),placeholder:"\u8BF7\u8F93\u5165\u5BA2\u6237\u59D3\u540D",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u5BA2\u6237\u5C5E\u6027",prop:"custom_type",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(f,{class:"flex-1",modelValue:t.custom_type,"onUpdate:modelValue":a[3]||(a[3]=e=>t.custom_type=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5BA2\u6237\u5C5E\u6027"},{default:u(()=>[(p(!0),_(F,null,E(y.dictData.custom_type,(e,n)=>(p(),V(i,{key:n,label:e.name,value:parseInt(e.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u7535\u8BDD",prop:"phone",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(d,{modelValue:t.phone,"onUpdate:modelValue":a[4]||(a[4]=e=>t.phone=e),placeholder:"\u8BF7\u8F93\u5165\u7535\u8BDD",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:4},{default:u(()=>[l(s,{label:"\u7701",prop:"province",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(f,{modelValue:t.province,"onUpdate:modelValue":a[5]||(a[5]=e=>t.province=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7701",onChange:ce},{default:u(()=>[(p(!0),_(F,null,E(B.provinceOptions,(e,n)=>(p(),V(i,{key:n,label:e.province_name,value:parseInt(e.province_code)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:4},{default:u(()=>[l(s,{label:"\u5E02",prop:"city",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(f,{modelValue:t.city,"onUpdate:modelValue":a[6]||(a[6]=e=>t.city=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5E02",onChange:fe},{default:u(()=>[(p(!0),_(F,null,E(B.cityOptions,(e,n)=>(p(),V(i,{key:n,label:e.city_name,value:parseInt(e.city_code)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:4},{default:u(()=>[l(s,{label:"\u533A",prop:"area",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(f,{modelValue:t.area,"onUpdate:modelValue":a[7]||(a[7]=e=>t.area=e),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u533A",onChange:o.area_change},{default:u(()=>[(p(!0),_(F,null,E(B.areaOptions,(e,n)=>(p(),V(i,{key:n,label:e.area_name,value:parseInt(e.area_code)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1})]),_:1}),l(r,{span:6},{default:u(()=>[l(s,{label:"\u5730\u5740",prop:"address"},{default:u(()=>[l(d,{modelValue:t.address,"onUpdate:modelValue":a[8]||(a[8]=e=>t.address=e),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5730\u5740"},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:6},{default:u(()=>[l(s,{label:"\u4FE1\u7528\u5EA6",prop:"credit_rating",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(Ee,{modelValue:t.credit_rating,"onUpdate:modelValue":a[9]||(a[9]=e=>t.credit_rating=e),placeholder:"\u8BF7\u9009\u62E9\u4FE1\u7528\u5EA6"},{default:u(()=>[(p(!0),_(F,null,E(y.dictData.credit_rating,(e,n)=>(p(),V(Fe,{key:n,label:parseInt(e.value)},{default:u(()=>[k(G(e.name),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{span:24},{default:u(()=>[l(s,{label:"\u5907\u6CE8",prop:"notes"},{default:u(()=>[l(d,{modelValue:t.notes,"onUpdate:modelValue":a[10]||(a[10]=e=>t.notes=e),type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8",autosize:{minRows:4,maxRows:4},style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),l(D,{class:"mb-2"},{default:u(()=>[el,l(C,null,{default:u(()=>[l(r,{span:8},{default:u(()=>[l(s,{label:"\u59D3\u540D",prop:"master_name",rules:[{required:!0,message:"\u4E0D\u53EF\u4E3A\u7A7A",trigger:"blur"}]},{default:u(()=>[l(d,{modelValue:t.master_name,"onUpdate:modelValue":a[11]||(a[11]=e=>t.master_name=e),placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u804C\u4F4D",prop:"master_position"},{default:u(()=>[l(d,{modelValue:t.master_position,"onUpdate:modelValue":a[12]||(a[12]=e=>t.master_position=e),placeholder:"\u8BF7\u8F93\u5165\u804C\u4F4D",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u624B\u673A",prop:"master_phone",rules:[{validator:le,trigger:"blur"}]},{default:u(()=>[l(d,{modelValue:t.master_phone,"onUpdate:modelValue":a[13]||(a[13]=e=>t.master_phone=e),placeholder:"\u8BF7\u8F93\u5165\u624B\u673A",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u90AE\u7BB1",prop:"master_email",rules:[{validator:te,trigger:"blur"}]},{default:u(()=>[l(d,{modelValue:t.master_email,"onUpdate:modelValue":a[14]||(a[14]=e=>t.master_email=e),placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1},8,["rules"])]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u5EA7\u673A",prop:"master_telephone"},{default:u(()=>[l(d,{modelValue:t.master_telephone,"onUpdate:modelValue":a[15]||(a[15]=e=>t.master_telephone=e),placeholder:"\u8BF7\u8F93\u5165\u5EA7\u673A",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u5907\u6CE8",prop:"master_notes"},{default:u(()=>[l(d,{modelValue:t.master_notes,"onUpdate:modelValue":a[16]||(a[16]=e=>t.master_notes=e),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),A.value=="add"?(p(),V(D,{key:0,class:"mb-2"},{default:u(()=>[ll,l(C,null,{default:u(()=>[l(ge,{data:m},{default:u(()=>[l(b,{label:"\u5E8F\u53F7"},{default:u(({row:e})=>[l(w,{onClick:n=>X(e)},{default:u(()=>[al]),_:2},1032,["onClick"]),l(w,{onClick:n=>Y(e)},{default:u(()=>[ul]),_:2},1032,["onClick"])]),_:1}),l(b,{label:"\u59D3\u540D",prop:"name"},{default:u(({row:e})=>[l(d,{modelValue:e.name,"onUpdate:modelValue":n=>e.name=n},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),l(b,{label:"\u804C\u4F4D",prop:"position"},{default:u(({row:e})=>[l(d,{modelValue:e.position,"onUpdate:modelValue":n=>e.position=n},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),l(b,{label:"\u624B\u673A",prop:"phone"},{default:u(({row:e,$index:n})=>[l(d,{modelValue:e.phone,"onUpdate:modelValue":c=>e.phone=c,onBlur:c=>ae(e,n)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1}),l(b,{label:"\u90AE\u7BB1",prop:"email"},{default:u(({row:e,$index:n})=>[l(d,{modelValue:e.email,"onUpdate:modelValue":c=>e.email=c,onBlur:c=>ue(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])]),_:1}),l(b,{label:"\u7535\u8BDD",prop:"telephone"},{default:u(({row:e})=>[l(d,{modelValue:e.telephone,"onUpdate:modelValue":n=>e.telephone=n},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),l(b,{label:"\u5907\u6CE8",prop:"notes"},{default:u(({row:e})=>[l(d,{modelValue:e.notes,"onUpdate:modelValue":n=>e.notes=n},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),l(b,{label:"\u9644\u4EF6",prop:"annex"},{default:u(({row:e,$index:n})=>[g("div",null,[l(Ve,{accept:"doc, docx, xls, xlsx, ppt, pptx, pdf, txt, zip, rar, tar, jpg, png, gif, jpeg, webp, wmv, avi, mpg, mpeg, 3gp, mov, mp4, flv, f4v, rmvb, mkv",class:"upload-demo","show-file-list":!1,"aria-hidden":"true",headers:{Token:N(W).token},action:J+"/upload/file","on-success":(c,z,Be)=>se(n,c),ref:"upload"},{default:u(()=>[l(w,{type:"primary"},{default:u(()=>[tl]),_:1})]),_:2},1032,["headers","action","on-success"]),e.annex?(p(),_("div",ol,[(p(!0),_(F,null,E(e.annex,(c,z)=>(p(),_("div",nl,[g("a",{style:{"margin-left":"10px",color:"#4a5dff","align-self":"flex-start"},href:c,target:"_blank"},"\u6587\u4EF6"+G(z+1),9,dl),g("span",{style:{cursor:"pointer","margin-left":"5px"},onClick:Be=>re(e)},"x",8,sl)]))),256))])):M("",!0)])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1})):M("",!0),l(D,{class:"mb-2"},{default:u(()=>[rl,l(C,null,{default:u(()=>[l(r,{span:8},{default:u(()=>[l(s,{label:"\u5F00\u7968\u516C\u53F8",prop:"company_name"},{default:u(()=>[l(d,{modelValue:t.company_name,"onUpdate:modelValue":a[17]||(a[17]=e=>t.company_name=e),placeholder:"\u8BF7\u8F93\u5165\u5F00\u7968\u516C\u53F8",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u7EB3\u7A0E\u4EBA\u8BC6\u522B",prop:"company_tin"},{default:u(()=>[l(d,{modelValue:t.company_tin,"onUpdate:modelValue":a[18]||(a[18]=e=>t.company_tin=e),placeholder:"\u8BF7\u8F93\u5165\u7EB3\u7A0E\u4EBA\u8BC6\u522B",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u5F00\u6237\u5730\u5740",prop:"bank_open_address"},{default:u(()=>[l(d,{modelValue:t.bank_open_address,"onUpdate:modelValue":a[19]||(a[19]=e=>t.bank_open_address=e),placeholder:"\u8BF7\u8F93\u5165\u5F00\u6237\u5730\u5740",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u516C\u53F8\u7535\u8BDD",prop:"company_telephone"},{default:u(()=>[l(d,{modelValue:t.company_telephone,"onUpdate:modelValue":a[20]||(a[20]=e=>t.company_telephone=e),placeholder:"\u8BF7\u8F93\u5165\u516C\u53F8\u7535\u8BDD",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u5F00\u6237\u94F6\u884C",prop:"bank_name"},{default:u(()=>[l(d,{modelValue:t.bank_name,"onUpdate:modelValue":a[21]||(a[21]=e=>t.bank_name=e),placeholder:"\u8BF7\u8F93\u5165\u5F00\u6237\u94F6\u884C",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{span:8},{default:u(()=>[l(s,{label:"\u94F6\u884C\u8D26\u53F7",prop:"bank_account"},{default:u(()=>[l(d,{modelValue:t.bank_account,"onUpdate:modelValue":a[22]||(a[22]=e=>t.bank_account=e),placeholder:"\u8BF7\u8F93\u5165\u94F6\u884C\u8D26\u53F7",clearable:"",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const Wl=Te(il,[["__scopeId","data-v-7f7a4a35"]]);export{Wl as default};