1
0
Files
build.ems/build/usr/local/omc/htdocs/front/js/index.Dg0psAP3.js
2024-10-25 14:59:47 +08:00

2 lines
14 KiB
JavaScript

import{g as ve,_ as O,l as d,W as ge,j as ye,A as be,k as v,m as g,n as t,B as N,am as we,p as e,t as a,az as h,E as r,F as u,I as B,a6 as R,ak as he,an as Q,aA as xe,aB as ke,aC as Ie,V as Ne,aK as Ce,aE as De,aL as Se,aF as Te}from"./vendor/index.CRpmXtWV.js";import{_ as Oe}from"./index.vue_vue_type_script_setup_true_lang.m9m5k4_V.js";import{u as Re,a as ze,l as Be,g as J,b as Ee,d as Fe}from"./dept.w3UZhzre.js";import{d as Le,p as Ue,n as Me,m as Pe,R as C}from"../index.D-NvtsOM.js";import{u as Ve}from"./dict.DBZ2k0Lk.js";import{a as X}from"./parse-tree-utils.CVXqlbRx.js";const Ge=ve({__name:"index",setup(We){const{t:l}=Le(),{getDict:Y}=Ve();let D=O({sysNormalDisable:[]}),b=O({deptName:"",status:void 0});function Z(){b=Object.assign(b,{deptName:"",status:void 0}),k()}let P=[],c=O({loading:!1,size:"middle",seached:!1,data:[],expandedRowAll:!1,expandedRowKeys:[]}),V=[{title:l("views.system.dept.className"),dataIndex:"deptName",align:"left",width:300},{title:l("views.system.dept.classId"),dataIndex:"deptId",align:"left",width:150},{title:l("views.system.dept.classSort"),dataIndex:"orderNum",align:"left",width:200},{title:l("views.system.dept.status"),dataIndex:"status",key:"status",align:"center",width:150},{title:l("views.system.dept.createTime"),dataIndex:"createTime",align:"center",width:150,customRender(o){return+o.value<=0?"":Ue(+o.value)}},{title:l("common.operate"),key:"deptId",align:"left"}];function ee({key:o}){c.size=o}function W(o){c.expandedRowKeys=o?P:[]}function te(o){c.expandedRowKeys=o}let S=[],n=O({visibleByView:!1,visibleByEdit:!1,title:"部门",from:{deptId:void 0,deptName:"",email:"",leader:"",orderNum:0,parentId:"100",ancestors:"",parentName:null,phone:"",status:"0"},confirmLoading:!1,treeData:[]});const y=d.Form.useForm(n.from,O({parentId:[{required:!0,message:l("views.system.dept.highClass")+l("common.unableNull")}],deptName:[{required:!0,min:1,max:50,message:l("views.system.dept.className")+l("common.unableNull")}],email:[{required:!1,pattern:Me,message:l("views.system.dept.emailTip")}],phone:[{required:!1,pattern:Pe,message:l("views.system.dept.phoneTip")}]}));function ae(o){if(!o){d.message.error(l("common.getInfoFail"),2);return}if(n.confirmLoading)return;const s=d.message.loading(l("common.loading"),0);n.confirmLoading=!0,J(o).then(p=>{n.confirmLoading=!1,s(),p.code===C&&p.data?(p.data.parentId==="0"?n.treeData=[{deptId:"0",parentId:"0",deptName:l("views.system.dept.node")}]:n.treeData=S,n.from=Object.assign(n.from,p.data),n.title=l("views.system.dept.classInfo"),n.visibleByView=!0):d.message.error(l("common.getInfoFail"),2)})}function E(o,s){if(!o)y.resetFields(),s&&(n.from.parentId=s),n.treeData=S,n.title=l("common.addText")+l("views.system.dept.classInfo"),n.visibleByEdit=!0;else{if(n.confirmLoading)return;const p=d.message.loading(l("common.loading"),0);n.confirmLoading=!0,Promise.all([J(o),Ee(o)]).then(i=>{i[0].code===C&&i[0].data?(n.from=Object.assign(n.from,i[0].data),i[1].code===C&&Array.isArray(i[1].data)&&(i[1].data.length===0?n.treeData=[{deptId:"0",parentId:"0",deptName:l("views.system.dept.node")}]:n.treeData=X(i[1].data,"deptId")),n.title=l("common.editText")+l("views.system.dept.classInfo"),n.visibleByEdit=!0):d.message.error(l("common.getInfoFail"),2)}).finally(()=>{n.confirmLoading=!1,p()})}}function le(){y.validate().then(()=>{n.confirmLoading=!0;const o=Q(n.from),s=o.deptId?Re(o):ze(o),p=d.message.loading(l("common.loading"),0);s.then(i=>{i.code===C?(d.message.success({content:l("common.msgSuccess",{msg:n.title}),duration:2}),n.visibleByEdit=!1,o.deptId||(S=[]),y.resetFields(),k()):d.message.error({content:`${i.msg}`,duration:2})}).finally(()=>{p(),n.confirmLoading=!1})}).catch(o=>{d.message.error(l("common.errorFields",{num:o.errorFields.length}),2)})}function F(){n.visibleByEdit=!1,n.visibleByView=!1,y.resetFields()}function ne(o){d.Modal.confirm({title:l("common.tipTitle"),content:l("views.system.dept.delSure",{deptId:o}),onOk(){const s=d.message.loading(l("common.loading"),0);Fe(o).then(p=>{s(),p.code===C?(d.message.success({content:l("common.msgSuccess",{msg:l("common.deleteText")}),duration:2}),k()):d.message.error({content:`${p.msg}`,duration:2})})}})}function k(){c.loading||(c.loading=!0,Be(Q(b)).then(o=>{if(o.code===C&&Array.isArray(o.data)){const s=X(o.data,"deptId");S.length<=0&&(S=s,P=[...new Set(o.data.map(p=>p.parentId))],W(c.expandedRowAll)),c.data=s}c.loading=!1}))}return ge(()=>{Promise.allSettled([Y("sys_normal_disable")]).then(o=>{o[0].status==="fulfilled"&&(D.sysNormalDisable=o[0].value)}),k()}),(o,s)=>{const p=d.Input,i=d.FormItem,f=d.Col,$=d.Select,se=xe,_=d.Button,oe=ke,z=d.Space,I=d.Row,L=d.Form,q=d.Card,K=Ie,A=d.Switch,w=d.Tooltip,de=Ne,ie=Ce,U=d.MenuItem,me=d.Menu,re=d.Dropdown,j=Oe,ue=De,pe=Se,ce=Te,fe=d.Table,H=d.TreeSelect,G=ye("ProModal"),_e=d.InputNumber,T=be("perms");return v(),g(e(he),null,{default:t(()=>[N(a(q,{bordered:!1,"body-style":{marginBottom:"24px",paddingBottom:0}},{default:t(()=>[a(L,{model:e(b),name:"queryParams",layout:"horizontal"},{default:t(()=>[a(I,{gutter:16},{default:t(()=>[a(f,{lg:6,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.className"),name:"deptName"},{default:t(()=>[a(p,{value:e(b).deptName,"onUpdate:value":s[0]||(s[0]=m=>e(b).deptName=m),"allow-clear":""},null,8,["value"])]),_:1},8,["label"])]),_:1}),a(f,{lg:6,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.status"),name:"status"},{default:t(()=>[a($,{value:e(b).status,"onUpdate:value":s[1]||(s[1]=m=>e(b).status=m),"allow-clear":"",options:e(D).sysNormalDisable},null,8,["value","options"])]),_:1},8,["label"])]),_:1}),a(f,{lg:6,md:12,xs:24},{default:t(()=>[a(i,null,{default:t(()=>[a(z,{size:8},{default:t(()=>[a(_,{type:"primary",onClick:h(k,["prevent"])},{icon:t(()=>[a(se)]),default:t(()=>[r(" "+u(e(l)("common.search")),1)]),_:1}),a(_,{type:"default",onClick:h(Z,["prevent"])},{icon:t(()=>[a(oe)]),default:t(()=>[r(" "+u(e(l)("common.reset")),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},512),[[we,e(c).seached]]),a(q,{bordered:!1,"body-style":{padding:"0px"}},{title:t(()=>[a(z,{size:8,align:"center"},{default:t(()=>[N((v(),g(_,{type:"primary",onClick:s[2]||(s[2]=h(m=>E(),["prevent"]))},{icon:t(()=>[a(K)]),default:t(()=>[r(" "+u(e(l)("common.addText")),1)]),_:1})),[[T,["system:dept:add"],"has"]])]),_:1})]),extra:t(()=>[a(z,{size:8,align:"center"},{default:t(()=>[a(w,null,{title:t(()=>[r(u(e(l)("views.system.role.openSwitch")),1)]),default:t(()=>[a(A,{checked:e(c).expandedRowAll,"onUpdate:checked":s[3]||(s[3]=m=>e(c).expandedRowAll=m),"checked-children":e(l)("views.system.dept.open"),"un-checked-children":e(l)("views.system.dept.open"),size:"small",onChange:W},null,8,["checked","checked-children","un-checked-children"])]),_:1}),a(w,null,{title:t(()=>[r(u(e(l)("common.searchBarText")),1)]),default:t(()=>[a(A,{checked:e(c).seached,"onUpdate:checked":s[4]||(s[4]=m=>e(c).seached=m),"checked-children":e(l)("common.switch.show"),"un-checked-children":e(l)("common.switch.hide"),size:"small"},null,8,["checked","checked-children","un-checked-children"])]),_:1}),a(w,null,{title:t(()=>[r(u(e(l)("common.reloadText")),1)]),default:t(()=>[a(_,{type:"text",onClick:h(k,["prevent"])},{icon:t(()=>[a(de)]),_:1})]),_:1}),a(w,{placement:"topRight"},{title:t(()=>[r(u(e(l)("common.sizeText")),1)]),default:t(()=>[a(re,{placement:"bottomRight",trigger:"click"},{overlay:t(()=>[a(me,{"selected-keys":[e(c).size],onClick:ee},{default:t(()=>[a(U,{key:"default"},{default:t(()=>[r(u(e(l)("common.size.default")),1)]),_:1}),a(U,{key:"middle"},{default:t(()=>[r(u(e(l)("common.size.middle")),1)]),_:1}),a(U,{key:"small"},{default:t(()=>[r(u(e(l)("common.size.small")),1)]),_:1})]),_:1},8,["selected-keys"])]),default:t(()=>[a(_,{type:"text"},{icon:t(()=>[a(ie)]),_:1})]),_:1})]),_:1})]),_:1})]),default:t(()=>[a(fe,{class:"table","row-key":"deptId",columns:e(V),loading:e(c).loading,"data-source":e(c).data,size:e(c).size,pagination:!1,scroll:{x:e(V).length*120},"children-column-name":"children","expanded-row-keys":e(c).expandedRowKeys,onExpandedRowsChange:te},{bodyCell:t(({column:m,record:x})=>[m.key==="status"?(v(),g(j,{key:0,options:e(D).sysNormalDisable,value:x.status},null,8,["options","value"])):B("",!0),m.key==="deptId"?(v(),g(z,{key:1,size:8,align:"center"},{default:t(()=>[a(w,null,{title:t(()=>[r(u(e(l)("common.viewText")),1)]),default:t(()=>[N((v(),g(_,{type:"link",onClick:h(M=>ae(x.deptId),["prevent"])},{icon:t(()=>[a(ue)]),_:2},1032,["onClick"])),[[T,["system:dept:query"],"has"]])]),_:2},1024),a(w,null,{title:t(()=>[r(u(e(l)("common.editText")),1)]),default:t(()=>[N((v(),g(_,{type:"link",onClick:h(M=>E(x.deptId),["prevent"])},{icon:t(()=>[a(pe)]),_:2},1032,["onClick"])),[[T,["system:dept:edit"],"has"]])]),_:2},1024),x.parentId!=="0"?(v(),g(w,{key:0},{title:t(()=>[r(u(e(l)("common.deleteText")),1)]),default:t(()=>[N((v(),g(_,{type:"link",onClick:h(M=>ne(x.deptId),["prevent"])},{icon:t(()=>[a(ce)]),_:2},1032,["onClick"])),[[T,["system:dept:remove"],"has"]])]),_:2},1024)):B("",!0),x.status!=="0"?(v(),g(w,{key:1,placement:"topRight"},{title:t(()=>[r(u(e(l)("views.system.dept.addClass")),1)]),default:t(()=>[N((v(),g(_,{type:"link",onClick:h(M=>E(void 0,x.deptId),["prevent"])},{icon:t(()=>[a(K)]),_:2},1032,["onClick"])),[[T,["system:dept:add"],"has"]])]),_:2},1024)):B("",!0)]),_:2},1024)):B("",!0)]),_:1},8,["columns","loading","data-source","size","scroll","expanded-row-keys"])]),_:1}),a(G,{drag:!0,width:800,visible:e(n).visibleByView,title:e(n).title,onCancel:F},{footer:t(()=>[a(_,{key:"cancel",onClick:F},{default:t(()=>[r(u(e(l)("common.cancel")),1)]),_:1})]),default:t(()=>[a(L,{layout:"horizontal","label-col":{span:6},labelWrap:!0},{default:t(()=>[a(i,{label:e(l)("views.system.dept.highClass"),name:"parentId","label-col":{span:3},labelWrap:!0},{default:t(()=>[a(H,{value:e(n).from.parentId,disabled:"","tree-data":e(n).treeData,"field-names":{children:"children",label:"deptName",value:"deptId"},"tree-node-label-prop":"deptName"},{suffixIcon:t(()=>[]),_:1},8,["value","tree-data"])]),_:1},8,["label"]),a(I,{gutter:16},{default:t(()=>[a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.className"),name:"deptName"},{default:t(()=>[r(u(e(n).from.deptName),1)]),_:1},8,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.classSort"),name:"orderNum"},{default:t(()=>[r(u(e(n).from.orderNum),1)]),_:1},8,["label"])]),_:1})]),_:1}),a(I,{gutter:16},{default:t(()=>[a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.status"),name:"status"},{default:t(()=>[a(j,{options:e(D).sysNormalDisable,value:e(n).from.status},null,8,["options","value"])]),_:1},8,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.classId"),name:"deptId"},{default:t(()=>[r(u(e(n).from.deptId),1)]),_:1},8,["label"])]),_:1})]),_:1}),a(I,{gutter:16},{default:t(()=>[a(f,{lg:24,md:24,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.admin"),name:"leader","label-col":{span:3},labelWrap:!0},{default:t(()=>[r(u(e(n).from.leader),1)]),_:1},8,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.phone"),name:"phone"},{default:t(()=>[r(u(e(n).from.phone),1)]),_:1},8,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.email"),name:"email"},{default:t(()=>[r(u(e(n).from.email),1)]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible","title"]),a(G,{drag:!0,width:800,destroyOnClose:!0,keyboard:!1,"mask-closable":!1,visible:e(n).visibleByEdit,title:e(n).title,"confirm-loading":e(n).confirmLoading,onOk:le,onCancel:F},{default:t(()=>[a(L,{name:"modalStateFrom",layout:"horizontal","label-col":{span:6},labelWrap:!0},{default:t(()=>[a(i,R({label:e(l)("views.system.dept.highClass"),name:"parentId"},e(y).validateInfos.parentId,{"label-col":{span:3},labelWrap:!0}),{default:t(()=>[a(H,{value:e(n).from.parentId,"onUpdate:value":s[5]||(s[5]=m=>e(n).from.parentId=m),"show-search":"","tree-default-expand-all":"","tree-data":e(n).treeData,"field-names":{children:"children",label:"deptName",value:"deptId"},"tree-node-label-prop":"deptName","tree-node-filter-prop":"deptName",style:{width:"100%"},"dropdown-style":{maxHeight:"400px",overflow:"auto"}},null,8,["value","tree-data"])]),_:1},16,["label"]),a(i,R({label:e(l)("views.system.dept.className"),name:"deptName"},e(y).validateInfos.deptName,{"label-col":{span:3},labelWrap:!0}),{default:t(()=>[a(p,{value:e(n).from.deptName,"onUpdate:value":s[6]||(s[6]=m=>e(n).from.deptName=m),"allow-clear":"",maxlength:30},null,8,["value"])]),_:1},16,["label"]),a(I,{gutter:16},{default:t(()=>[a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.status"),name:"status"},{default:t(()=>[a($,{value:e(n).from.status,"onUpdate:value":s[7]||(s[7]=m=>e(n).from.status=m),"default-value":"0",options:e(D).sysNormalDisable},null,8,["value","options"])]),_:1},8,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,{label:e(l)("views.system.dept.classSort"),name:"orderNum"},{default:t(()=>[a(_e,{value:e(n).from.orderNum,"onUpdate:value":s[8]||(s[8]=m=>e(n).from.orderNum=m),min:0,max:9999,step:1},null,8,["value"])]),_:1},8,["label"])]),_:1})]),_:1}),a(I,{gutter:16},{default:t(()=>[a(f,{span:24},{default:t(()=>[a(i,R({label:e(l)("views.system.dept.admin"),name:"leader"},e(y).validateInfos.leader,{"label-col":{span:3},labelWrap:!0}),{default:t(()=>[a(p,{value:e(n).from.leader,"onUpdate:value":s[9]||(s[9]=m=>e(n).from.leader=m),"allow-clear":""},null,8,["value"])]),_:1},16,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,R({label:e(l)("views.system.dept.phone"),name:"phone"},e(y).validateInfos.phone),{default:t(()=>[a(p,{value:e(n).from.phone,"onUpdate:value":s[10]||(s[10]=m=>e(n).from.phone=m),"allow-clear":"",maxlength:11},null,8,["value"])]),_:1},16,["label"])]),_:1}),a(f,{lg:12,md:12,xs:24},{default:t(()=>[a(i,R({label:e(l)("views.system.dept.email"),name:"email"},e(y).validateInfos.email),{default:t(()=>[a(p,{value:e(n).from.email,"onUpdate:value":s[11]||(s[11]=m=>e(n).from.email=m),"allow-clear":"",maxlength:40},null,8,["value"])]),_:1},16,["label"])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible","title","confirm-loading"])]),_:1})}}});export{Ge as default};