2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
|
import{Q as e,G as l,r as a,I as t,U as d,d as u,T as o,o as r,c as n,K as p,M as s,f as i,e as m,w as c,j as f,V as h,W as v,k as y,n as _,J as b,l as g,A as V,m as k,v as w,S as I}from"./index.e5c8b0d6.js";function N(l){return e({url:"/system/dept/list",method:"get",params:l})}const x={class:"app-container"},C={class:"dialog-footer"},U=l({name:"Dept"}),S=Object.assign(U,{setup(l){const{proxy:U}=w(),{sys_normal_disable:S}=U.useDict("sys_normal_disable"),T=a([]),q=a(!1),R=a(!0),$=a(!0),P=a(""),j=a([]),D=a(!0),K=a(!0),F=t({form:{},queryParams:{deptName:void 0,status:void 0},rules:{parentId:[{required:!0,message:"上级部门不能为空",trigger:"blur"}],deptName:[{required:!0,message:"部门名称不能为空",trigger:"blur"}],orderNum:[{required:!0,message:"显示排序不能为空",trigger:"blur"}],email:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],phone:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}),{queryParams:Q,form:A,rules:E}=d(F);function G(){R.value=!0,N(Q.value).then((e=>{T.value=U.handleTree(e.data,"deptId"),R.value=!1}))}function J(){q.value=!1,M()}function M(){A.value={deptId:void 0,parentId:void 0,deptName:void 0,orderNum:0,leader:void 0,phone:void 0,email:void 0,status:"0"},U.resetForm("deptRef")}function O(){G()}function W(){U.resetForm("queryRef"),O()}function z(e){M(),N().then((e=>{j.value=U.handleTree(e.data,"deptId")})),null!=e&&(A.value.parentId=e.deptId),q.value=!0,P.value="添加部门"}function B(){K.value=!1,D.value=!D.value,I((()=>{K.value=!0}))}function H(l){var a;M(),(a=l.deptId,e({url:"/system/dept/list/exclude/"+a,method:"get"})).then((e=>{j.value=U.handleTree(e.data,"deptId")})),function(l){return e({url:"/system/dept/"+l,method:"get"})}(l.deptId).then((e=>{A.value=e.data,q.value=!0,P.value="修改部门"}))}function L(){U.$refs.deptRef.validate((l=>{l&&(null!=A.value.deptId?function(l){return e({url:"/system/dept",method:"put",data:l})}(A.value).then((e=>{U.$modal.msgSuccess("修改成功"),q.value=!1,G()})):function(l){return e({url:"/system/dept",method:"post",data:l})}(A.value).then((e=>{U.$modal.msgSuccess("新增成功"),q.value=!1,G()})))}))}function X(l){U.$modal.confirm('是否确认删除名称为"'+l.deptName+'"的数据项?').then((function(){return a=l.deptId,e({url:"/system/dept/"+a,method:"delete"});var a})).then((()=>{G(),U.$modal.msgSuccess("删除成功")})).catch((()=>{}))}return G(),(e,l)=>{const a=u("el-input"),t=u("el-form-item"),d=u("el-option"),w=u("el-select"),I=u("el-button"),N=u("el-form"),U=u("el-col"),F=u("right-toolbar"),M=u("el-row"),Y=u("el-table-column"),Z=u("dict-tag"),ee=u("el-table"),le=u("el-tree-select"),ae=u("el-input-number"),te=u("el-radio"),de=u("el-radio-group"),ue=u("el-dialog"),oe=o("hasPermi"),re=o("loading");return r(),n("div",x,[p(m(N,{model:i(Q),ref:"queryRef",inline:!0},{default:c((()=>[m(t,{label:"部门名称",prop:"deptName"},{default:c((()=>[m(a,{modelValue:i(Q).deptName,"onUpdate:modelValue":l[0]||(l[0]=e=>i(Q).deptName=e),placeholder:"请输入部门名称",clearable:"",style:{width:"200px"},onKeyup:f(O,["enter"])},null,8,["modelValue","onKeyup"])])),_:1}),m(t,{label:"状态",prop:"status"},{default:c((()=>[m(w,{modelValue:i(Q).status,"onUpdate:modelValue":l[1]||(l[1]=e=>i(Q).status=e),placeholder:"部门状态",clearable:"",style:{width:"200px"}},{default:c((()=>[(r(!0),n(h,null,v(i(S),(e=>(r(),y(d,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),m(t,null,{default:c((()=>[m(I,{type:"primary",icon:"Search",onClick:O},{default:c((()=>[_("搜索")])),_:1}),m(I,{icon:"Refresh",onClick:W},{default:c((()=>[_("重置")])),_:1})])),_:1})])),_:1},8,["model"]),[[s,i($)]]),m(M,{gutter:10,class:"mb8"},{default:c((()=>[m(U,{span:1.5},{default:c((()=>[p((r(),y(I,{type:"primary",plain:"",icon:"Plus",onClick:z},{default:c((()=>[_("新增")])),_:1})),[[oe,["system:dept:add"]]])])),_:1},8,["span"]),m(U,{span:1.5},{default:c((()=>[m(I,{type:"info",plain:"",icon:"Sort",onClick:B},{default:c((()=>[_(
|