modal.d0980a.js 5.6 KB

1
  1. import{aT as F,_ as $,d as I,w as E,bs as P,ag as G,z as N,r as b,aC as O,o as _,G as V,C as l,H as z,l as d,b1 as H,j as a,c1 as W,b_ as J,c as K,F as X,D as Z,M as L,L as ee,h as B,bW as ue,aq as te}from"./index.js";import{u as T,a as ae}from"./useTask.8a645393.js";const y="http://project.test241.wanyuhengtong.com/admin/",fe=o=>F.request("post",`${y}keepblist`,{data:o}),le=o=>F.request("post",`${y}keepbcreate`,{data:o}),oe=o=>F.request("post",`${y}keepbinfo`,{data:o}),re=o=>F.request("post",`${y}keepbedit`,{data:o}),ve=o=>F.request("post",`${y}keepbstatus`,{data:o}),_e=[{value:"0",label:"\u957F\u671F"},{value:"1",label:"\u975E\u957F\u671F"}],se={gyscode:[{required:!0,message:"\u4F9B\u5E94\u5546\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],brand_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u652F\u6301\u54C1\u724C",trigger:"blur"}],long:[{required:!0,message:"\u8BF7\u9009\u62E9\u6388\u6743\u7C7B\u578B",trigger:"blur"}],starttime:[{required:!0,message:"\u8BF7\u9009\u62E9\u6388\u6743\u5F00\u59CB\u65E5\u671F",trigger:"blur"}],endtime:[{required:!0,message:"\u8BF7\u9009\u62E9\u6388\u6743\u7ED3\u679C\u65E5\u671F",trigger:"blur"}]},ne={class:"flex"},de=B("p",{class:"mx-[10px]"},"-",-1),ie=B("p",null,"\u957F\u671F\u6709\u6548",-1),me={class:"w-full flex justify-end"},pe=I({__name:"modal",props:{visible:{type:Boolean,required:!0},id:{type:String,required:!0},type:{type:String,required:!0}},emits:["refresh"],setup(o,{emit:M}){const i=o,h={gyscode:"",brand_id:"",long:0,authTimeLongTerm:[],authTime:"",brand_book:"",remark:"",status:""},D=E(null),t=E({...h}),q=E(null),U=E(null),k=P(i,"visible"),A=G(()=>`${{create:"\u521B\u5EFA",preview:"\u67E5\u770B",update:"\u7F16\u8F91"}[i.type]}\u652F\u6301\u54C1\u724C`),w=T({success(n){const{brand_book:u,brand_id:r,brand_name:g,endtime:f,starttime:m,long:p,gyscode:c,remark:s,gysname:v,status:e}=n;t.value={authTimeLongTerm:p===1?[m,f]:[],authTime:p===0?m:"",brand_book:u,brand_id:r,gyscode:c,remark:s,status:e,long:p},q.value.initialData({name:v}),U.value.initialData({brand_name:g})}});function x(){k.value=!1,M("refresh")}const R=T({success:x}),S=T({success:x}),Y=ae(R,S);N(()=>i.visible,n=>{!n||(i.id?w.run(oe({id:i.id})):t.value={...h})},{immediate:!0});async function j(){try{await D.value.validate();const{long:n,gyscode:u,brand_id:r,authTimeLongTerm:g,authTime:f,remark:m,status:p}=t.value,c=!i.id,s={id:i.id,long:n,gyscode:u,brand_id:r,remark:m,status:p,starttime:"",endtime:"",brand_book:""};if(n===1){const[C,Q]=g;s.starttime=C+" 00:00:00",s.endtime=Q+" 23:59:59"}else s.starttime=f+" 00:00:00",delete s.endtime;c&&(delete s.id,delete s.status);const v=c?R:S,e=c?le:re;v.run(e(s))}catch{}}return(n,u)=>{const r=b("ElFormItem"),g=b("ElRadio"),f=b("ElRadioGroup"),m=b("ElDatePicker"),p=b("ElInput"),c=b("ElButton"),s=b("ElDialog"),v=O("loading");return _(),V(s,{modelValue:d(k),"onUpdate:modelValue":u[8]||(u[8]=e=>te(k)?k.value=e:null),title:d(A),center:""},{default:l(()=>[z((_(),V(d(H),{modelValue:t.value,"onUpdate:modelValue":u[7]||(u[7]=e=>t.value=e),"label-width":"100px",rules:d(se),disabled:o.type==="preview",ref_key:"formRef",ref:D},{default:l(()=>[a(r,{label:"\u4F9B\u5E94\u5546",prop:"gyscode"},{default:l(()=>[a(d(W),{modelValue:t.value.gyscode,"onUpdate:modelValue":u[0]||(u[0]=e=>t.value.gyscode=e),placeholder:"\u4F9B\u5E94\u5546",ref_key:"supplierQueryRef",ref:q},null,8,["modelValue"])]),_:1}),a(r,{label:"\u652F\u6301\u54C1\u724C",prop:"brand_id"},{default:l(()=>[a(d(J),{modelValue:t.value.brand_id,"onUpdate:modelValue":u[1]||(u[1]=e=>t.value.brand_id=e),placeholder:"\u652F\u6301\u54C1\u724C",ref_key:"brandQueyRef",ref:U},null,8,["modelValue"])]),_:1}),a(r,{label:"\u6388\u6743\u7C7B\u578B",prop:"long"},{default:l(()=>[a(f,{modelValue:t.value.long,"onUpdate:modelValue":u[2]||(u[2]=e=>t.value.long=e)},{default:l(()=>[(_(),K(X,null,Z([{value:1,label:"\u975E\u957F\u671F"},{value:0,label:"\u957F\u671F"}],(e,C)=>a(g,{key:C,label:e.value},{default:l(()=>[L(ee(e.label),1)]),_:2},1032,["label"])),64))]),_:1},8,["modelValue"])]),_:1}),t.value.long===1?(_(),V(r,{key:0,label:"\u6388\u6743\u65F6\u95F4",prop:"authTimeLongTerm"},{default:l(()=>[a(m,{type:"daterange","value-format":"YYYY-MM-DD",modelValue:t.value.authTimeLongTerm,"onUpdate:modelValue":u[3]||(u[3]=e=>t.value.authTimeLongTerm=e),"start-placeholder":"\u5F00\u59CB\u65F6\u95F4","end-placeholder":"\u5F00\u59CB\u65F6\u95F4"},null,8,["modelValue"])]),_:1})):(_(),V(r,{key:1,label:"\u6388\u6743\u65F6\u95F4",prop:"authTime"},{default:l(()=>[B("div",ne,[a(m,{type:"date","value-format":"YYYY-MM-DD",modelValue:t.value.authTime,"onUpdate:modelValue":u[4]||(u[4]=e=>t.value.authTime=e),placeholder:"\u5F00\u59CB\u65F6\u95F4"},null,8,["modelValue"]),de,ie])]),_:1})),a(r,{label:"\u6388\u6743\u56FE\u7247",prop:"brand_book"},{default:l(()=>[a(d(ue),{modelValue:t.value.brand_book,"onUpdate:modelValue":u[5]||(u[5]=e=>t.value.brand_book=e),placeholder:"\u6388\u6743\u56FE\u7247"},null,8,["modelValue"])]),_:1}),a(r,{label:"\u5907\u6CE8",prop:"remark"},{default:l(()=>[a(p,{type:"textarea",modelValue:t.value.remark,"onUpdate:modelValue":u[6]||(u[6]=e=>t.value.remark=e),placeholder:"\u5907\u6CE8"},null,8,["modelValue"])]),_:1}),a(r,null,{default:l(()=>[B("div",me,[a(c,{type:"primary",loading:d(Y).loading,onClick:j},{default:l(()=>[L("\u63D0\u4EA4")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["modelValue","rules","disabled"])),[[v,d(w).loading]])]),_:1},8,["modelValue","title"])}}});var ce=$(pe,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/supplierBrand/modal.vue"]]),Fe=Object.freeze(Object.defineProperty({__proto__:null,default:ce},Symbol.toStringTag,{value:"Module"}));export{ce as M,ve as a,fe as h,_e as l,Fe as m};