mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
var k=(l,m,s)=>new Promise((u,c)=>{var p=t=>{try{f(s.next(t))}catch(i){c(i)}},r=t=>{try{f(s.throw(t))}catch(i){c(i)}},f=t=>t.done?u(t.value):Promise.resolve(t.value).then(p,r);f((s=s.apply(l,m)).next())});import{r as F,a as o,m as O,f as _,aZ as j,a$ as R,gL as x,J as $,ai as z,L as J,X as N,ag as P,h as V}from"./index-DMqaFtX4.js";import{_ as X}from"./form.vue_vue_type_script_setup_true_lang-TuPMPKxI.js";import{e as Z}from"./system-rA6lrtqS.js";import{u as q}from"./hooks-BE0p9dqE.js";import"./index-Coz9hxU2.js";function E(){const l=F({name:"",status:null}),m=o(),s=o([]),u=o(!0),{tagStyle:c}=q(),p=[{label:"部门名称",prop:"name",width:180,align:"left"},{label:"排序",prop:"sort",minWidth:70},{label:"状态",prop:"status",minWidth:100,cellRenderer:({row:a,props:e})=>_(V("el-tag"),{size:e.size,style:c.value(a.status)},{default:()=>[a.status===1?"启用":"停用"]})},{label:"创建时间",minWidth:200,prop:"createTime",formatter:({createTime:a})=>j(a).format("YYYY-MM-DD HH:mm:ss")},{label:"备注",prop:"remark",minWidth:320},{label:"操作",fixed:"right",width:210,slot:"operation"}];function r(a){}function f(a){a&&(a.resetFields(),t())}function t(){return k(this,null,function*(){u.value=!0;const{data:a}=yield Z();let e=a;R(l.name)||(e=e.filter(n=>n.name.includes(l.name))),R(l.status)||(e=e.filter(n=>n.status===l.status)),s.value=x(e),setTimeout(()=>{u.value=!1},500)})}function i(a){if(!a||!a.length)return;const e=[];for(let n=0;n<a.length;n++)a[n].disabled=a[n].status===0,i(a[n].children),e.push(a[n]);return e}function C(a="新增",e){var n,d,h,g,D,b,v,y;z({title:`${a}部门`,props:{formInline:{higherDeptOptions:i(P(s.value)),parentId:(n=e==null?void 0:e.parentId)!=null?n:0,name:(d=e==null?void 0:e.name)!=null?d:"",principal:(h=e==null?void 0:e.principal)!=null?h:"",phone:(g=e==null?void 0:e.phone)!=null?g:"",email:(D=e==null?void 0:e.email)!=null?D:"",sort:(b=e==null?void 0:e.sort)!=null?b:0,status:(v=e==null?void 0:e.status)!=null?v:1,remark:(y=e==null?void 0:e.remark)!=null?y:""}},width:"40%",draggable:!0,fullscreen:N(),fullscreenIcon:!0,closeOnClickModal:!1,contentRenderer:()=>J(X,{ref:m,formInline:null}),beforeSure:(M,{options:S})=>{const T=m.value.getRef(),W=S.props.formInline;function I(){$(`您${a}了部门名称为${W.name}的这条数据`,{type:"success"}),M(),t()}T.validate(Y=>{Y&&I()})}})}function H(a){$(`您删除了部门名称为${a.name}的这条数据`,{type:"success"}),t()}return O(()=>{t()}),{form:l,loading:u,columns:p,dataList:s,onSearch:t,resetForm:f,openDialog:C,handleDelete:H,handleSelectionChange:r}}export{E as useDept};
|