import{E as j}from"./index.ad11f307.js";import{t as z,d as F,s as q}from"./tagsManage.d96e36d0.js";import{d as H,G as J,D as K,b as A,r as d,o as Q,c as n,e as D,f as W,h as e,i as a,u as C,I as X,k as Y,g as m,j as _,F as Z,x as ee}from"./index.5bb861d3.js";import{g as w,a as ae}from"./getIsShowRegionTree.e814bad7.js";const le={class:"flex justify-between items-center"},te=m("span",null,"\u6807\u7B7E\u5217\u8868",-1),oe=["onClick"],ne=["onClick"],se={class:"dialog-footer"},re=H({name:"tagsManage"}),ce=Object.assign(re,{setup(ue){const{proxy:g}=ee(),G=J(K.userStore).userInfo,s=A({name:void 0}),f=d(),N=d(2),M=A([{label:"\u5E8F\u53F7",type:"index",width:"80"},{label:"\u6807\u7B7E\u540D\u79F0",key:"name",prop:"name"},{label:"\u5907\u6CE8",key:"remark",prop:"remark"},{label:"\u521B\u5EFA\u65F6\u95F4",key:"createOn",prop:"createOn",width:"170"},{label:"\u64CD\u4F5C",slot:"action",width:"140",fixed:"right"}]),R=d([]),u=async(t=f.value.pageParams)=>{const l=await z(s.regionCode,{...t,...s});R.value=l.data.records,N.value=l.data.total},P=()=>{u()},T=()=>{s.name=void 0,f.value.pageParams.pageNumber=1,f.value.pageParams.pageSize=10,u()},$=t=>{s.regionCode=t.regionLevel===3?t.regionCode:void 0,f.value.pageParams.pageNumber=1,u()},O=t=>{g.$messageBox.confirm(`\u662F\u5426\u5220\u9664${t.name}?`,"\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await F(t.id),g.$message.success("\u5220\u9664\u6210\u529F\uFF01"),u()})},v=d(!1),r=d(),b=d(),h=d(!1),x=(t,l)=>{h.value=t,v.value=!0,r.value=l||{}},S=async t=>{!t||await t.validate(async l=>{if(l){const i={...r.value,areaCode:s.regionCode||G.regionCode};await q(i),g.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),k()}})},k=()=>{r.value={},b.value.clearValidate(),v.value=!1,u()};return Q(()=>{w(["SUPER_ADMIN","REGION_MANAGER"])||u()}),(t,l)=>{const i=n("el-col"),y=n("el-input"),p=n("el-form-item"),c=n("el-button"),E=n("el-row"),V=n("el-form"),I=n("el-card"),U=n("table-list"),B=n("el-dialog");return D(),W(Z,null,[e(E,null,{default:a(()=>[C(w)(["SUPER_ADMIN","REGION_MANAGER"])?(D(),X(i,{key:0,style:{"padding-right":"16px"},span:4},{default:a(()=>[e(j,{params:C(ae)({SUPER_ADMIN:!1,REGION_MANAGER:!1}),onGetTree:$},null,8,["params"])]),_:1})):Y("",!0),e(i,{span:C(w)(["SUPER_ADMIN","REGION_MANAGER"])?20:24},{default:a(()=>[m("div",null,[e(I,{class:"search mb-16"},{default:a(()=>[e(V,{"label-suffix":":",model:s,size:"small"},{default:a(()=>[e(E,{gutter:16},{default:a(()=>[e(i,{span:8},{default:a(()=>[e(p,{label:"\u6807\u7B7E\u540D\u79F0"},{default:a(()=>[e(y,{modelValue:s.name,"onUpdate:modelValue":l[0]||(l[0]=o=>s.name=o),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),e(i,{span:16},{default:a(()=>[e(p,{class:"btn"},{default:a(()=>[e(c,{type:"primary",onClick:P},{default:a(()=>[_("\u67E5\u8BE2")]),_:1}),e(c,{onClick:T},{default:a(()=>[_("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),e(I,null,{header:a(()=>[m("div",le,[te,e(c,{type:"primary",icon:"Plus",size:"small",onClick:l[1]||(l[1]=o=>x(!1))},{default:a(()=>[_(" \u65B0\u589E\u6807\u7B7E ")]),_:1})])]),default:a(()=>[e(U,{ref_key:"tableListRef",ref:f,column:M,data:R.value,total:N.value,onGetTableData:u},{action:a(({scope:o})=>[m("a",{onClick:L=>x(!0,o.row)},"\u7F16\u8F91",8,oe),m("a",{class:"text-danger",onClick:L=>O(o.row)},"\u5220\u9664",8,ne)]),_:1},8,["column","data","total"])]),_:1})])]),_:1},8,["span"])]),_:1}),e(B,{title:h.value?"\u7F16\u8F91\u6307\u6807":"\u65B0\u589E\u6307\u6807","model-value":v.value,onClose:k},{footer:a(()=>[m("span",se,[e(c,{type:"primary",onClick:l[4]||(l[4]=o=>S(b.value))},{default:a(()=>[_("\u63D0\u4EA4")]),_:1}),e(c,{onClick:k},{default:a(()=>[_("\u5173\u95ED")]),_:1})])]),default:a(()=>[e(V,{ref_key:"formRef",ref:b,model:r.value,"label-suffix":"\uFF1A","label-width":"100"},{default:a(()=>[e(p,{label:"\u6307\u6807\u540D\u79F0",prop:"name",rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:a(()=>[e(y,{modelValue:r.value.name,"onUpdate:modelValue":l[2]||(l[2]=o=>r.value.name=o),maxlength:50,placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue"])]),_:1}),e(p,{label:"\u5907\u6CE8"},{default:a(()=>[e(y,{modelValue:r.value.remark,"onUpdate:modelValue":l[3]||(l[3]=o=>r.value.remark=o),maxlength:100,placeholder:"\u8BF7\u586B\u5199",type:"textarea","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","model-value"])],64)}}});export{ce as default};
