Files
vue-pure-admin/static/js/hook-C7vg8_KG.js

2 lines
2.5 KiB
JavaScript

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