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