2 lines
7.9 KiB
JavaScript
2 lines
7.9 KiB
JavaScript
import{G as e,r as l,I as a,U as t,d,T as o,o as i,c as u,K as n,M as s,f as r,e as c,w as p,j as m,V as f,W as y,k as v,J as g,n as b,l as h,A as _,v as w,$ as V}from"./index.e5c8b0d6.js";import{l as k,g as x,u as T,a as C,d as N,r as U}from"./type.b030370e.js";const S={class:"app-container"},D={class:"dialog-footer"},I=e({name:"Dict"}),R=Object.assign(I,{setup(e){const{proxy:I}=w(),{sys_normal_disable:R}=I.useDict("sys_normal_disable"),$=l([]),q=l(!1),K=l(!0),P=l(!0),j=l([]),Y=l(!0),z=l(!0),M=l(0),E=l(""),F=l([]),A=a({form:{},queryParams:{pageNum:1,pageSize:10,dictName:void 0,dictType:void 0,status:void 0},rules:{dictName:[{required:!0,message:"字典名称不能为空",trigger:"blur"}],dictType:[{required:!0,message:"字典类型不能为空",trigger:"blur"}]}}),{queryParams:G,form:J,rules:O}=t(A);function Q(){K.value=!0,k(I.addDateRange(G.value,F.value)).then((e=>{$.value=e.rows,M.value=e.total,K.value=!1}))}function W(){q.value=!1,B()}function B(){J.value={dictId:void 0,dictName:void 0,dictType:void 0,status:"0",remark:void 0},I.resetForm("dictRef")}function H(){G.value.pageNum=1,Q()}function L(){F.value=[],I.resetForm("queryRef"),H()}function X(){B(),q.value=!0,E.value="添加字典类型"}function Z(e){j.value=e.map((e=>e.dictId)),Y.value=1!=e.length,z.value=!e.length}function ee(e){B();const l=e.dictId||j.value;x(l).then((e=>{J.value=e.data,q.value=!0,E.value="修改字典类型"}))}function le(){I.$refs.dictRef.validate((e=>{e&&(null!=J.value.dictId?T(J.value).then((e=>{I.$modal.msgSuccess("修改成功"),q.value=!1,Q()})):C(J.value).then((e=>{I.$modal.msgSuccess("新增成功"),q.value=!1,Q()})))}))}function ae(e){const l=e.dictId||j.value;I.$modal.confirm('是否确认删除字典编号为"'+l+'"的数据项?').then((function(){return N(l)})).then((()=>{Q(),I.$modal.msgSuccess("删除成功")})).catch((()=>{}))}function te(){I.download("system/dict/type/export",{...G.value},`dict_${(new Date).getTime()}.xlsx`)}function de(){U().then((()=>{I.$modal.msgSuccess("刷新成功"),V().cleanDict()}))}return Q(),(e,l)=>{const a=d("el-input"),t=d("el-form-item"),w=d("el-option"),V=d("el-select"),k=d("el-date-picker"),x=d("el-button"),T=d("el-form"),C=d("el-col"),N=d("right-toolbar"),U=d("el-row"),I=d("el-table-column"),j=d("router-link"),A=d("dict-tag"),B=d("el-table"),oe=d("pagination"),ie=d("el-radio"),ue=d("el-radio-group"),ne=d("el-dialog"),se=o("hasPermi"),re=o("loading");return i(),u("div",S,[n(c(T,{model:r(G),ref:"queryRef",inline:!0,"label-width":"68px"},{default:p((()=>[c(t,{label:"字典名称",prop:"dictName"},{default:p((()=>[c(a,{modelValue:r(G).dictName,"onUpdate:modelValue":l[0]||(l[0]=e=>r(G).dictName=e),placeholder:"请输入字典名称",clearable:"",style:{width:"240px"},onKeyup:m(H,["enter"])},null,8,["modelValue","onKeyup"])])),_:1}),c(t,{label:"字典类型",prop:"dictType"},{default:p((()=>[c(a,{modelValue:r(G).dictType,"onUpdate:modelValue":l[1]||(l[1]=e=>r(G).dictType=e),placeholder:"请输入字典类型",clearable:"",style:{width:"240px"},onKeyup:m(H,["enter"])},null,8,["modelValue","onKeyup"])])),_:1}),c(t,{label:"状态",prop:"status"},{default:p((()=>[c(V,{modelValue:r(G).status,"onUpdate:modelValue":l[2]||(l[2]=e=>r(G).status=e),placeholder:"字典状态",clearable:"",style:{width:"240px"}},{default:p((()=>[(i(!0),u(f,null,y(r(R),(e=>(i(),v(w,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),c(t,{label:"创建时间",style:{width:"308px"}},{default:p((()=>[c(k,{modelValue:r(F),"onUpdate:modelValue":l[3]||(l[3]=e=>g(F)?F.value=e:null),"value-format":"YYYY-MM-DD",type:"daterange","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期"},null,8,["modelValue"])])),_:1}),c(t,null,{default:p((()=>[c(x,{type:"primary",icon:"Search",onClick:H},{default:p((()=>[b("搜索")])),_:1}),c(x,{icon:"Refresh",onClick:L},{default:p((()=>[b("重置")])),_:1})])),_:1})])),_:1},8,["model"]),[[s,r(P)]]),c(U,{gutter:10,class:"mb8"},{default:p((()=>[c(C,{span:1.5},{default:p((()=>[n((i(),v(x,{type:"primary",plain:"",icon:"Plus",onClick:X},{default:p((()=>[b("新增")])),_:1})),[[se,["system:dict:add"]]])])),_:1},8,["span"]),c(C,{span:1.5},{default:p((()=>[n((i(),v(x,{type:"success",plain:"",icon:"Edit",disabled:r(Y),onClick:ee},{default:p((()=>[b("修改")])),_:1},8,["disabled"])),[[se,["system:dict:edit"]]])])),_:1},8,["span"]),c(C,{span:1.5},{default:p((()=>[n((i(),v(x,{type:"danger",plain:"",icon:"Delete",disabled:r(z),onClick:ae},{default:p((()=>[b("删除")])),_:1},8,["disabled"])),[[se,["system:dict:remove"]]])])),_:1},8,["span"]),c(C,{span:1.5},{default:p((()=>[n((i(),v(x,{type:"warning",plain:"",icon:"Download",onClick:te},{default:p((()=>[b("导出")])),_:1})),[[se,["system:dict:export"]]])])),_:1},8,["span"]),c(C,{span:1.5},{default:p((()=>[n((i(),v(x,{type:"danger",plain:"",icon:"Refresh",onClick:de},{default:p((()=>[b("刷新缓存")])),_:1})),[[se,["system:dict:remove"]]])])),_:1},8,["span"]),c(N,{showSearch:r(P),"onUpdate:showSearch":l[4]||(l[4]=e=>g(P)?P.value=e:null),onQueryTable:Q},null,8,["showSearch"])])),_:1}),n((i(),v(B,{data:r($),onSelectionChange:Z},{default:p((()=>[c(I,{type:"selection",width:"55",align:"center"}),c(I,{label:"字典编号",align:"center",prop:"dictId"}),c(I,{label:"字典名称",align:"center",prop:"dictName","show-overflow-tooltip":!0}),c(I,{label:"字典类型",align:"center","show-overflow-tooltip":!0},{default:p((e=>[c(j,{to:"/system/dict-data/index/"+e.row.dictId,class:"link-type"},{default:p((()=>[h("span",null,_(e.row.dictType),1)])),_:2},1032,["to"])])),_:1}),c(I,{label:"状态",align:"center",prop:"status"},{default:p((e=>[c(A,{options:r(R),value:e.row.status},null,8,["options","value"])])),_:1}),c(I,{label:"备注",align:"center",prop:"remark","show-overflow-tooltip":!0}),c(I,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:p((l=>[h("span",null,_(e.parseTime(l.row.createTime)),1)])),_:1}),c(I,{label:"操作",align:"center",width:"160","class-name":"small-padding fixed-width"},{default:p((e=>[n((i(),v(x,{link:"",type:"primary",icon:"Edit",onClick:l=>ee(e.row)},{default:p((()=>[b("修改")])),_:2},1032,["onClick"])),[[se,["system:dict:edit"]]]),n((i(),v(x,{link:"",type:"primary",icon:"Delete",onClick:l=>ae(e.row)},{default:p((()=>[b("删除")])),_:2},1032,["onClick"])),[[se,["system:dict:remove"]]])])),_:1})])),_:1},8,["data"])),[[re,r(K)]]),n(c(oe,{total:r(M),page:r(G).pageNum,"onUpdate:page":l[5]||(l[5]=e=>r(G).pageNum=e),limit:r(G).pageSize,"onUpdate:limit":l[6]||(l[6]=e=>r(G).pageSize=e),onPagination:Q},null,8,["total","page","limit"]),[[s,r(M)>0]]),c(ne,{title:r(E),modelValue:r(q),"onUpdate:modelValue":l[11]||(l[11]=e=>g(q)?q.value=e:null),width:"500px","append-to-body":""},{footer:p((()=>[h("div",D,[c(x,{type:"primary",onClick:le},{default:p((()=>[b("确 定")])),_:1}),c(x,{onClick:W},{default:p((()=>[b("取 消")])),_:1})])])),default:p((()=>[c(T,{ref:"dictRef",model:r(J),rules:r(O),"label-width":"80px"},{default:p((()=>[c(t,{label:"字典名称",prop:"dictName"},{default:p((()=>[c(a,{modelValue:r(J).dictName,"onUpdate:modelValue":l[7]||(l[7]=e=>r(J).dictName=e),placeholder:"请输入字典名称"},null,8,["modelValue"])])),_:1}),c(t,{label:"字典类型",prop:"dictType"},{default:p((()=>[c(a,{modelValue:r(J).dictType,"onUpdate:modelValue":l[8]||(l[8]=e=>r(J).dictType=e),placeholder:"请输入字典类型"},null,8,["modelValue"])])),_:1}),c(t,{label:"状态",prop:"status"},{default:p((()=>[c(ue,{modelValue:r(J).status,"onUpdate:modelValue":l[9]||(l[9]=e=>r(J).status=e)},{default:p((()=>[(i(!0),u(f,null,y(r(R),(e=>(i(),v(ie,{key:e.value,label:e.value},{default:p((()=>[b(_(e.label),1)])),_:2},1032,["label"])))),128))])),_:1},8,["modelValue"])])),_:1}),c(t,{label:"备注",prop:"remark"},{default:p((()=>[c(a,{modelValue:r(J).remark,"onUpdate:modelValue":l[10]||(l[10]=e=>r(J).remark=e),type:"textarea",placeholder:"请输入内容"},null,8,["modelValue"])])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["title","modelValue"])])}}});export{R as default};
|