Agriculture-front-end/dist/assets/index.fcfab7e3.js

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((()=>[_("展开/折叠")])),_:1})])),_:1},8,["span"]),m(F,{showSearch:i($),"onUpdate:showSearch":l[2]||(l[2]=e=>b($)?$.value=e:null),onQueryTable:G},null,8,["showSearch"])])),_:1}),i(K)?p((r(),y(ee,{key:0,data:i(T),"row-key":"deptId","default-expand-all":i(D),"tree-props":{children:"children",hasChildren:"hasChildren"}},{default:c((()=>[m(Y,{prop:"deptName",label:"部门名称",width:"260"}),m(Y,{prop:"orderNum",label:"排序",width:"200"}),m(Y,{prop:"status",label:"状态",width:"100"},{default:c((e=>[m(Z,{options:i(S),value:e.row.status},null,8,["options","value"])])),_:1}),m(Y,{label:"创建时间",align:"center",prop:"createTime",width:"200"},{default:c((l=>[g("span",null,V(e.parseTime(l.row.createTime)),1)])),_:1}),m(Y,{label:"操作",align:"center","class-name":"small-padding fixed-width"},{default:c((e=>[p((r(),y(I,{link:"",type:"primary",icon:"Edit",onClick:l=>H(e.row)},{default:c((()=>[_("修改")])),_:2},1032,["onClick"])),[[oe,["system:dept:edit"]]]),p((r(),y(I,{link:"",type:"primary",icon:"Plus",onClick:l=>z(e.row)},{default:c((()=>[_("新增")])),_:2},1032,["onClick"])),[[oe,["system:dept:add"]]]),0!=e.row.parentId?p((r(),y(I,{key:0,link:"",type:"primary",icon:"Delete",onClick:l=>X(e.row)},{default:c((()=>[_("删除")])),_:2},1032,["onClick"])),[[oe,["system:dept:remove"]]]):k("",!0)])),_:1})])),_:1},8,["data","default-expand-all"])),[[re,i(R)]]):k("",!0),m(ue,{title:i(P),modelValue:i(q),"onUpdate:modelValue":l[10]||(l[10]=e=>b(q)?q.value=e:null),width:"600px","append-to-body":""},{footer:c((()=>[g("div",C,[m(I,{type:"primary",onClick:L},{default:c((()=>[_("确 定")])),_:1}),m(I,{onClick:J},{default:c((()=>[_("取 消")])),_:1})])])),default:c((()=>[m(N,{ref:"deptRef",model:i(A),rules:i(E),"label-width":"80px"},{default:c((()=>[m(M,null,{default:c((()=>[0!==i(A).parentId?(r(),y(U,{key:0,span:24},{default:c((()=>[m(t,{label:"上级部门",prop:"parentId"},{default:c((()=>[m(le,{modelValue:i(A).parentId,"onUpdate:modelValue":l[3]||(l[3]=e=>i(A).parentId=e),data:i(j),props:{value:"deptId",label:"deptName",children:"children"},"value-key":"deptId",placeholder:"选择上级部门","check-strictly":""},null,8,["modelValue","data"])])),_:1})])),_:1})):k("",!0),m(U,{span:12},{default:c((()=>[m(t,{label:"部门名称",prop:"deptName"},{default:c((()=>[m(a,{modelValue:i(A).deptName,"onUpdate:modelValue":l[4]||(l[4]=e=>i(A).deptName=e),placeholder:"请输入部门名称"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{span:12},{default:c((()=>[m(t,{label:"显示排序",prop:"orderNum"},{default:c((()=>[m(ae,{modelValue:i(A).orderNum,"onUpdate:modelValue":l[5]||(l[5]=e=>i(A).orderNum=e),"controls-position":"right",min:0},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{span:12},{default:c((()=>[m(t,{label:"负责人",prop:"leader"},{default:c((()=>[m(a,{modelValue:i(A).leader,"onUpdate:modelValue":l[6]||(l[6]=e=>i(A).leader=e),placeholder:"请输入负责人",maxlength:"20"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{span:12},{default:c((()=>[m(t,{label:"联系电话",prop:"phone"},{default:c((()=>[m(a,{modelValue:i(A).phone,"onUpdate:modelValue":l[7]||(l[7]=e=>i(A).phone=e),placeholder:"请输入联系电话",maxlength:"11"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{span:12},{default:c((()=>[m(t,{label:"邮箱",prop:"email"},{default:c((()=>[m(a,{modelValue:i(A).email,"onUpdate:modelValue":l[8]||(l[8]=e=>i(A).email=e),placeholder:"请输入邮箱",maxlength:"50"},null,8,["modelValue"])])),_:1})])),_:1}),m(U,{span:12},{default:c((()=>[m(t,{label:"部门状态"},{default:c((()=>[m(de,{modelValue:i(A).status,"onUpdate:modelValue":l[9]||(l[9]=e=>i(A).status=e)},{default:c((()=>[(r(!0),n(h,null,v(i(S),(e=>(r(),y(te,{key:e.value,label:e.value},{default:c((()=>[_(V(e.label),1)])),_:2},1032,["label"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["title","modelValue"])])}}});export{S as default};