1 |
- import{_ as H,d as L,aD as I,W as J,w as s,x as K,r as p,o as n,G as v,C as u,l as t,u as w,aG as O,c as f,F as h,D as g,b as P,M as Q,au as S}from"./index.1d5f2f42.js";import{c as i}from"./createRequset.f858bea3.js";const X={style:{display:"flex","justify-content":"flex-end",width:"100%"}},Y=L({__name:"template-modal",emits:["refresh"],setup(Z,{expose:B,emit:C}){const D=i("account/depart"),k=i("admin/account/list"),U=i("admin/WeTemplate/getTemplate"),x=i("admin/DepartReport/create"),R=i("admin/DepartReport/edit"),T=[{value:"1",label:"\u6BCF\u5929"}],F=I("crate"),V={report_name:"",template_name:"",template_id:"",template_param:"",push_type:"",depart_id:"",push_arr:[]},q={report_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6A21\u677F\u540D\u79F0",trigger:"change"}],template_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u5FAE\u4FE1\u6A21\u677F",trigger:"change"}],push_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u63A8\u9001\u7C7B\u578B",trigger:"change"}],push_arr:[{required:!0,message:"\u8BF7\u9009\u62E9\u63A8\u9001\u4EBA",trigger:"change"}],depart_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u90E8\u95E8",trigger:"change"}]},M=J(()=>F.value==="create"?"\u521B\u5EFA\u6A21\u677F":"\u4FEE\u6539\u6A21\u677F"),E=s([]),b=s([]),y=s([]),m=s(!1),N=s(!1),A=s(null),a=s({...V});function W(o){const l=E.value.find(({template_id:r})=>r===o);a.value.template_name=l.title,a.value.template_param=l.content}async function z(){try{await A.value.validate();const l=await(F.value==="update"?R:x)(a.value);l.code===1?(C("refresh"),m.value=!1):S.warning(l.message)}catch{}}return K(async()=>{const o=await U({}),l=await D({size:1e4}),r=await k({size:1e4,depart_id:a.value.depart_id,is_wx:1});r.code===1&&(y.value=r.data.list),o.code===1&&(E.value=o.data),l.code===1&&(b.value=[{id:0,name:"\u5168\u90E8\u90E8\u95E8"},...l.data])}),B({onDisplay:(o,l)=>{m.value=!0,F.value=l,l==="update"?(a.value={...o},a.value.push_arr=o.pusher.map(({user_id:r})=>r),delete a.value.pusher):a.value={...V}}}),(o,l)=>{const r=p("el-input"),d=p("el-form-item"),_=p("el-option"),c=p("el-select"),G=p("el-button"),j=p("el-dialog");return n(),v(j,{modelValue:m.value,"onUpdate:modelValue":l[7]||(l[7]=e=>m.value=e),title:w(M),center:""},{default:u(()=>[t(w(O),{"label-width":"100px",model:a.value,rules:q,ref_key:"formRef",ref:A},{default:u(()=>[t(d,{label:"\u6A21\u677F\u540D\u79F0:",prop:"report_name"},{default:u(()=>[t(r,{modelValue:a.value.report_name,"onUpdate:modelValue":l[0]||(l[0]=e=>a.value.report_name=e),placeholder:"\u6A21\u677F\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(d,{label:"\u90E8\u95E8:",prop:"depart_id"},{default:u(()=>[t(c,{modelValue:a.value.depart_id,"onUpdate:modelValue":l[1]||(l[1]=e=>a.value.depart_id=e),placeholder:"\u90E8\u95E8",style:{width:"100%"},onChange:o.handleChange},{default:u(()=>[(n(!0),f(h,null,g(b.value,e=>(n(),v(_,{key:e.id,value:e.id,label:e.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1}),t(d,{label:"\u5FAE\u4FE1\u6A21\u677F:",prop:"template_id"},{default:u(()=>[t(c,{style:{width:"100%"},modelValue:a.value.template_id,"onUpdate:modelValue":l[2]||(l[2]=e=>a.value.template_id=e),placeholder:"\u5FAE\u4FE1\u6A21\u677F",onChange:W},{default:u(()=>[(n(!0),f(h,null,g(E.value,e=>(n(),v(_,{key:e.template_id,value:e.template_id,label:e.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(d,{label:"\u63A8\u9001\u65F6\u95F4:",modelValue:a.value.push_type,"onUpdate:modelValue":l[4]||(l[4]=e=>a.value.push_type=e),prop:"push_type"},{default:u(()=>[t(c,{style:{width:"100%"},placeholder:"\u63A8\u9001\u7C7B\u578B",modelValue:a.value.push_type,"onUpdate:modelValue":l[3]||(l[3]=e=>a.value.push_type=e)},{default:u(()=>[(n(),f(h,null,g(T,e=>t(_,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),t(d,{label:"\u63A8\u9001\u4EBA:",modelValue:a.value.push_arr,"onUpdate:modelValue":l[6]||(l[6]=e=>a.value.push_arr=e),prop:"push_arr"},{default:u(()=>[t(c,{style:{width:"100%"},placeholder:"\u63A8\u9001\u4EBA",multiple:"",filterable:"",modelValue:a.value.push_arr,"onUpdate:modelValue":l[5]||(l[5]=e=>a.value.push_arr=e)},{default:u(()=>[(n(!0),f(h,null,g(y.value,e=>(n(),v(_,{filterable:"",key:e.id,label:e.nickname,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),t(d,null,{default:u(()=>[P("div",X,[t(G,{type:"primary",onClick:z,loading:N.value},{default:u(()=>[Q("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});var le=H(Y,[["__file","D:/work/rep-v3/report-v3/src/views/template/publicTemplate/components/template-modal.vue"]]);export{le as default};
|