2025-05-29 15:03:59 +08:00

2 lines
9.2 KiB
JavaScript

import{C as Ce,d as we,r as m,u as ke,O as Te,S as Se,j as s,H as J,c as w,o as i,F as g,e as t,R as W,k as a,w as o,I as D,J as U,h as c,l as De,m as r,P as X,B as x,f as Y,T as Ue,U as xe,V as F,W as Le,X as Re,Y as he}from"./index-CrAWI0wi.js";import{g as Ne,o as $e}from"./type-DhGCOOB_.js";const Pe={class:"app-container"},qe={key:0},Be={class:"dialog-footer"},Fe=Ce({name:"Data"}),je=Object.assign(Fe,{setup(Oe){const{proxy:v}=we(),{sys_normal_disable:L}=v.useDict("sys_normal_disable"),O=m([]),_=m(!1),R=m(!0),S=m(!0),h=m([]),E=m(!0),I=m(!0),N=m(0),$=m(""),j=m(""),z=m([]),Q=ke(),G=m([{value:"default",label:"默认"},{value:"primary",label:"主要"},{value:"success",label:"成功"},{value:"info",label:"信息"},{value:"warning",label:"警告"},{value:"danger",label:"危险"}]),M=Te({form:{},queryParams:{pageNum:1,pageSize:10,dictName:void 0,dictType:void 0,status:void 0},rules:{dictLabel:[{required:!0,message:"数据标签不能为空",trigger:"blur"}],dictValue:[{required:!0,message:"数据键值不能为空",trigger:"blur"}],dictSort:[{required:!0,message:"数据顺序不能为空",trigger:"blur"}]}}),{queryParams:d,form:n,rules:Z}=Se(M);function ee(u){Ne(u).then(e=>{d.value.dictType=e.data.dictType,j.value=e.data.dictType,y()})}function le(){$e().then(u=>{z.value=u.data})}function y(){R.value=!0,Le(d.value).then(u=>{O.value=u.rows,N.value=u.total,R.value=!1})}function te(){_.value=!1,P()}function P(){n.value={dictCode:void 0,dictLabel:void 0,dictValue:void 0,cssClass:void 0,listClass:"default",dictSort:0,status:"0",remark:void 0},v.resetForm("dataRef")}function q(){d.value.pageNum=1,y()}function ae(){const u={path:"/system/dict"};v.$tab.closeOpenPage(u)}function oe(){v.resetForm("queryRef"),d.value.dictType=j,q()}function ne(){P(),_.value=!0,$.value="添加字典数据",n.value.dictType=d.value.dictType}function de(u){h.value=u.map(e=>e.dictCode),E.value=u.length!=1,I.value=!u.length}function K(u){P();const e=u.dictCode||h.value;Ue(e).then(k=>{n.value=k.data,_.value=!0,$.value="修改字典数据"})}function ue(){v.$refs.dataRef.validate(u=>{u&&(n.value.dictCode!=null?Re(n.value).then(e=>{F().removeDict(d.value.dictType),v.$modal.msgSuccess("修改成功"),_.value=!1,y()}):he(n.value).then(e=>{F().removeDict(d.value.dictType),v.$modal.msgSuccess("新增成功"),_.value=!1,y()}))})}function A(u){const e=u.dictCode||h.value;v.$modal.confirm('是否确认删除字典编码为"'+e+'"的数据项?').then(function(){return xe(e)}).then(()=>{y(),v.$modal.msgSuccess("删除成功"),F().removeDict(d.value.dictType)}).catch(()=>{})}function se(){v.download("system/dict/data/export",{...d.value},`dict_data_${new Date().getTime()}.xlsx`)}return ee(Q.params&&Q.params.dictId),le(),(u,e)=>{const k=s("el-option"),B=s("el-select"),p=s("el-form-item"),V=s("el-input"),f=s("el-button"),H=s("el-form"),T=s("el-col"),ie=s("right-toolbar"),re=s("el-row"),b=s("el-table-column"),pe=s("el-tag"),me=s("dict-tag"),ce=s("el-table"),fe=s("pagination"),ve=s("el-input-number"),be=s("el-radio"),ge=s("el-radio-group"),_e=s("el-dialog"),C=J("hasPermi"),ye=J("loading");return i(),w("div",Pe,[g(t(H,{model:a(d),ref:"queryRef",inline:!0},{default:o(()=>[t(p,{label:"字典名称",prop:"dictType"},{default:o(()=>[t(B,{modelValue:a(d).dictType,"onUpdate:modelValue":e[0]||(e[0]=l=>a(d).dictType=l),style:{width:"200px"}},{default:o(()=>[(i(!0),w(D,null,U(a(z),l=>(i(),c(k,{key:l.dictId,label:l.dictName,value:l.dictType},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"字典标签",prop:"dictLabel"},{default:o(()=>[t(V,{modelValue:a(d).dictLabel,"onUpdate:modelValue":e[1]||(e[1]=l=>a(d).dictLabel=l),placeholder:"请输入字典标签",clearable:"",style:{width:"200px"},onKeyup:De(q,["enter"])},null,8,["modelValue"])]),_:1}),t(p,{label:"状态",prop:"status"},{default:o(()=>[t(B,{modelValue:a(d).status,"onUpdate:modelValue":e[2]||(e[2]=l=>a(d).status=l),placeholder:"数据状态",clearable:"",style:{width:"200px"}},{default:o(()=>[(i(!0),w(D,null,U(a(L),l=>(i(),c(k,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(p,null,{default:o(()=>[t(f,{type:"primary",icon:"Search",onClick:q},{default:o(()=>e[15]||(e[15]=[r("搜索")])),_:1}),t(f,{icon:"Refresh",onClick:oe},{default:o(()=>e[16]||(e[16]=[r("重置")])),_:1})]),_:1})]),_:1},8,["model"]),[[W,a(S)]]),t(re,{gutter:10,class:"mb8"},{default:o(()=>[t(T,{span:1.5},{default:o(()=>[g((i(),c(f,{type:"primary",plain:"",icon:"Plus",onClick:ne},{default:o(()=>e[17]||(e[17]=[r("新增")])),_:1})),[[C,["system:dict:add"]]])]),_:1}),t(T,{span:1.5},{default:o(()=>[g((i(),c(f,{type:"success",plain:"",icon:"Edit",disabled:a(E),onClick:K},{default:o(()=>e[18]||(e[18]=[r("修改")])),_:1},8,["disabled"])),[[C,["system:dict:edit"]]])]),_:1}),t(T,{span:1.5},{default:o(()=>[g((i(),c(f,{type:"danger",plain:"",icon:"Delete",disabled:a(I),onClick:A},{default:o(()=>e[19]||(e[19]=[r("删除")])),_:1},8,["disabled"])),[[C,["system:dict:remove"]]])]),_:1}),t(T,{span:1.5},{default:o(()=>[g((i(),c(f,{type:"warning",plain:"",icon:"Download",onClick:se},{default:o(()=>e[20]||(e[20]=[r("导出")])),_:1})),[[C,["system:dict:export"]]])]),_:1}),t(T,{span:1.5},{default:o(()=>[t(f,{type:"warning",plain:"",icon:"Close",onClick:ae},{default:o(()=>e[21]||(e[21]=[r("关闭")])),_:1})]),_:1}),t(ie,{showSearch:a(S),"onUpdate:showSearch":e[3]||(e[3]=l=>X(S)?S.value=l:null),onQueryTable:y},null,8,["showSearch"])]),_:1}),g((i(),c(ce,{data:a(O),onSelectionChange:de},{default:o(()=>[t(b,{type:"selection",width:"55",align:"center"}),t(b,{label:"字典编码",align:"center",prop:"dictCode"}),t(b,{label:"字典标签",align:"center",prop:"dictLabel"},{default:o(l=>[l.row.listClass==""||l.row.listClass=="default"?(i(),w("span",qe,x(l.row.dictLabel),1)):(i(),c(pe,{key:1,type:l.row.listClass},{default:o(()=>[r(x(l.row.dictLabel),1)]),_:2},1032,["type"]))]),_:1}),t(b,{label:"字典键值",align:"center",prop:"dictValue"}),t(b,{label:"字典排序",align:"center",prop:"dictSort"}),t(b,{label:"状态",align:"center",prop:"status"},{default:o(l=>[t(me,{options:a(L),value:l.row.status},null,8,["options","value"])]),_:1}),t(b,{label:"备注",align:"center",prop:"remark","show-overflow-tooltip":!0}),t(b,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:o(l=>[Y("span",null,x(u.parseTime(l.row.createTime)),1)]),_:1}),t(b,{label:"操作",align:"center",width:"160","class-name":"small-padding fixed-width"},{default:o(l=>[g((i(),c(f,{link:"",type:"primary",icon:"Edit",onClick:Ve=>K(l.row)},{default:o(()=>e[22]||(e[22]=[r("修改")])),_:2},1032,["onClick"])),[[C,["system:dict:edit"]]]),g((i(),c(f,{link:"",type:"primary",icon:"Delete",onClick:Ve=>A(l.row)},{default:o(()=>e[23]||(e[23]=[r("删除")])),_:2},1032,["onClick"])),[[C,["system:dict:remove"]]])]),_:1})]),_:1},8,["data"])),[[ye,a(R)]]),g(t(fe,{total:a(N),page:a(d).pageNum,"onUpdate:page":e[4]||(e[4]=l=>a(d).pageNum=l),limit:a(d).pageSize,"onUpdate:limit":e[5]||(e[5]=l=>a(d).pageSize=l),onPagination:y},null,8,["total","page","limit"]),[[W,a(N)>0]]),t(_e,{title:a($),modelValue:a(_),"onUpdate:modelValue":e[14]||(e[14]=l=>X(_)?_.value=l:null),width:"500px","append-to-body":""},{footer:o(()=>[Y("div",Be,[t(f,{type:"primary",onClick:ue},{default:o(()=>e[24]||(e[24]=[r("确 定")])),_:1}),t(f,{onClick:te},{default:o(()=>e[25]||(e[25]=[r("取 消")])),_:1})])]),default:o(()=>[t(H,{ref:"dataRef",model:a(n),rules:a(Z),"label-width":"80px"},{default:o(()=>[t(p,{label:"字典类型"},{default:o(()=>[t(V,{modelValue:a(n).dictType,"onUpdate:modelValue":e[6]||(e[6]=l=>a(n).dictType=l),disabled:!0},null,8,["modelValue"])]),_:1}),t(p,{label:"数据标签",prop:"dictLabel"},{default:o(()=>[t(V,{modelValue:a(n).dictLabel,"onUpdate:modelValue":e[7]||(e[7]=l=>a(n).dictLabel=l),placeholder:"请输入数据标签"},null,8,["modelValue"])]),_:1}),t(p,{label:"数据键值",prop:"dictValue"},{default:o(()=>[t(V,{modelValue:a(n).dictValue,"onUpdate:modelValue":e[8]||(e[8]=l=>a(n).dictValue=l),placeholder:"请输入数据键值"},null,8,["modelValue"])]),_:1}),t(p,{label:"样式属性",prop:"cssClass"},{default:o(()=>[t(V,{modelValue:a(n).cssClass,"onUpdate:modelValue":e[9]||(e[9]=l=>a(n).cssClass=l),placeholder:"请输入样式属性"},null,8,["modelValue"])]),_:1}),t(p,{label:"显示排序",prop:"dictSort"},{default:o(()=>[t(ve,{modelValue:a(n).dictSort,"onUpdate:modelValue":e[10]||(e[10]=l=>a(n).dictSort=l),"controls-position":"right",min:0},null,8,["modelValue"])]),_:1}),t(p,{label:"回显样式",prop:"listClass"},{default:o(()=>[t(B,{modelValue:a(n).listClass,"onUpdate:modelValue":e[11]||(e[11]=l=>a(n).listClass=l)},{default:o(()=>[(i(!0),w(D,null,U(a(G),l=>(i(),c(k,{key:l.value,label:l.label+"("+l.value+")",value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"状态",prop:"status"},{default:o(()=>[t(ge,{modelValue:a(n).status,"onUpdate:modelValue":e[12]||(e[12]=l=>a(n).status=l)},{default:o(()=>[(i(!0),w(D,null,U(a(L),l=>(i(),c(be,{key:l.value,value:l.value},{default:o(()=>[r(x(l.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"备注",prop:"remark"},{default:o(()=>[t(V,{modelValue:a(n).remark,"onUpdate:modelValue":e[13]||(e[13]=l=>a(n).remark=l),type:"textarea",placeholder:"请输入内容"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}});export{je as default};