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{_ as k}from"./form.vue_vue_type_script_setup_true_lang-f7f23899.js";import{a8 as c,as as I,f as R,t as H}from"./index-fa5d6b3f.js";import{m as p}from"./message-6f31e976.js";import{g as M}from"./system-75614cde.js";import{u as S}from"./hooks-2777bcf3.js";import"./index-47090b5c.js";function O(){const n=Vue.reactive({name:"",status:null}),u=Vue.ref(),l=Vue.ref([]),i=Vue.ref(!0),{tagStyle:r}=S(),o=[{label:"部门名称",prop:"name",width:180,align:"left"},{label:"排序",prop:"sort",minWidth:70},{label:"状态",prop:"status",minWidth:100,cellRenderer:({row:t,props:e})=>Vue.createVNode(Vue.resolveComponent("el-tag"),{size:e.size,style:r.value(t.status)},{default:()=>[t.status===1?"启用":"停用"]})},{label:"创建时间",minWidth:200,prop:"createTime",formatter:({createTime:t})=>dayjs(t).format("YYYY-MM-DD HH:mm:ss")},{label:"备注",prop:"remark",minWidth:320},{label:"操作",fixed:"right",width:160,slot:"operation"}];function d(t){}function h(t){t&&(t.resetFields(),s())}async function s(){i.value=!0;const{data:t}=await M();let e=t;c(n.name)||(e=e.filter(a=>a.name.includes(n.name))),c(n.status)||(e=e.filter(a=>a.status===n.status)),l.value=I(e),setTimeout(()=>{i.value=!1},500)}function m(t){if(!t||!t.length)return;const e=[];for(let a=0;a<t.length;a++)t[a].disabled=t[a].status===0,m(t[a].children),e.push(t[a]);return e}function g(t="新增",e){R({title:`${t}部门`,props:{formInline:{higherDeptOptions:m(H(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:()=>Vue.h(k,{ref:u}),beforeSure:(a,{options:b})=>{const v=u.value.getRef(),V=b.props.formInline;function f(){p(`您${t}了部门名称为${V.name}的这条数据`,{type:"success"}),a(),s()}v.validate(y=>{y&&f()})}})}function D(t){p(`您删除了部门名称为${t.name}的这条数据`,{type:"success"}),s()}return Vue.onMounted(()=>{s()}),{form:n,loading:i,columns:o,dataList:l,onSearch:s,resetForm:h,openDialog:g,handleDelete:D,handleSelectionChange:d}}export{O as useDept};
|