mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
import{af as R,r as u,a as H,g as M,c as S,bv as T,bh as p,bG as W,a1 as Y,K as $,L as C}from"./index-7f2011bd.js";import{_ as F}from"./form.vue_vue_type_script_setup_true_lang-d11f7e85.js";import{m as o}from"./message-62aa4b26.js";import{g as O}from"./system-8fc0bc8a.js";import{u as _}from"./hooks-24db2860.js";function G(){const n=R({name:"",status:null}),m=u(),l=u([]),i=u(!0),{tagStyle:r}=_(),d=[{label:"部门名称",prop:"name",width:180,align:"left"},{label:"排序",prop:"sort",minWidth:70},{label:"状态",prop:"status",minWidth:100,cellRenderer:({row:a,props:e})=>M(S("el-tag"),{size:e.size,style:r.value(a.status)},{default:()=>[a.status===1?"启用":"停用"]})},{label:"创建时间",minWidth:200,prop:"createTime",formatter:({createTime:a})=>T(a).format("YYYY-MM-DD HH:mm:ss")},{label:"备注",prop:"remark",minWidth:320},{label:"操作",fixed:"right",width:160,slot:"operation"}];function h(a){}function g(a){a&&(a.resetFields(),s())}async function s(){i.value=!0;const{data:a}=await O();let e=a;p(n.name)||(e=e.filter(t=>t.name.includes(n.name))),p(n.status)||(e=e.filter(t=>t.status===n.status)),l.value=W(e),setTimeout(()=>{i.value=!1},500)}function c(a){if(!a||!a.length)return;const e=[];for(let t=0;t<a.length;t++)a[t].disabled=a[t].status===0,c(a[t].children),e.push(a[t]);return e}function b(a="新增",e){Y({title:`${a}部门`,props:{formInline:{higherDeptOptions:c($(l.value)),parentId:(e==null?void 0:e.parentId)??0,name:(e==null?void 0:e.name)??"",principal:(e==null?void 0:e.principal)??"",phone:(e==null?void 0:e.phone)??"",email:(e==null?void 0:e.email)??"",sort:(e==null?void 0:e.sort)??0,status:(e==null?void 0:e.status)??1,remark:(e==null?void 0:e.remark)??""}},width:"40%",draggable:!0,fullscreenIcon:!0,closeOnClickModal:!1,contentRenderer:()=>C(F,{ref:m}),beforeSure:(t,{options:D})=>{const y=m.value.getRef(),k=D.props.formInline;function f(){o(`您${a}了部门名称为${k.name}的这条数据`,{type:"success"}),t(),s()}y.validate(I=>{I&&f()})}})}function v(a){o(`您删除了部门名称为${a.name}的这条数据`,{type:"success"}),s()}return H(()=>{s()}),{form:n,loading:i,columns:d,dataList:l,onSearch:s,resetForm:g,openDialog:b,handleDelete:v,handleSelectionChange:h}}export{G as useDept};
|