chunk-11ced52a.65c2bde4.js 11 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-11ced52a"],{"1cb5":function(e,t,s){},"1f34":function(e,t,s){"use strict";s.r(t);var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"system-user"},[t("div",{staticClass:"_box"},[t("div",{staticClass:"dept scroller1",class:[e.dept.expand?"_expand":"_collapse"]},[t("div",{staticClass:"label"},[t("div",[e._v("组织架构")]),t("ul",[t("li",[t("el-tooltip",{attrs:{content:"刷新"}},[t("i",{staticClass:"el-icon-refresh",on:{click:function(t){return e.deptRefresh()}}})])],1),t("li",[t("el-tooltip",{attrs:{content:"拖动排序"}},[t("i",{staticClass:"el-icon-s-operation",on:{click:function(t){e.dept.isDrag=!0}}})])],1),t("li",{directives:[{name:"show",rawName:"v-show",value:e.dept.isDrag,expression:"dept.isDrag"}],staticClass:"no"},[t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(t){return e.deptOrder(!0)}}},[e._v("保存")]),t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(t){return e.deptOrder(!1)}}},[e._v("取消")])],1)])]),t("div",{staticClass:"container",on:{contextmenu:function(t){return t.preventDefault(),e.deptCM.apply(null,arguments)}}},[t("el-tree",{directives:[{name:"loading",rawName:"v-loading",value:e.dept.loading,expression:"dept.loading"}],attrs:{data:e.dept.list,props:{label:"name"},draggable:e.dept.isDrag,"allow-drag":e.deptAllowDrag,"allow-drop":e.deptAllowDrop,"node-key":"id","highlight-current":"","default-expand-all":"","expand-on-click-node":!1},on:{"node-contextmenu":e.deptCM,"node-click":e.deptClick}})],1)]),t("div",{staticClass:"user"},[e._m(0),t("div",{staticClass:"container"},[t("x-crud",{on:{load:e.onLoad},scopedSlots:e._u([{key:"table-column-headImg",fn:function({scope:s}){return[t("cl-avatar",{style:{margin:"auto"},attrs:{shape:"square",size:"medium",src:e._f("default_avatar")(s.row.headImg)}})]}},{key:"table-column-status",fn:function({scope:s}){return[1==s.row.status?t("el-tag",{attrs:{size:"medium",type:"success"}},[e._v("启用")]):t("el-tag",{attrs:{size:"medium",type:"danger"}},[e._v("禁用")])]}},{key:"table-column-roleName",fn:function({scope:s}){return e._l(s.row.roleNameList,(function(s,n){return t("el-tag",{key:n,staticStyle:{margin:"2px"},attrs:{size:"medium","disable-transitions":""}},[e._v(e._s(s))])}))}},{key:"slot-multi-move",fn:function(){return[t("el-button",{directives:[{name:"permission",rawName:"v-permission",value:e.$service.system.user.permission.move,expression:"$service.system.user.permission.move"}],attrs:{size:"mini",type:"success",disabled:0==e.selects.ids.length},on:{click:function(t){return e.toMove()}}},[e._v("转移")])]},proxy:!0},{key:"slot-move",fn:function({scope:s}){return[t("el-button",{directives:[{name:"permission",rawName:"v-permission",value:e.$service.system.user.permission.move,expression:"$service.system.user.permission.move"}],attrs:{type:"text",size:"mini"},on:{click:function(t){return e.toMove(s.row)}}},[e._v("转移")])]}}])})],1)]),t("div",{staticClass:"icon-arrow",class:[e.dept.expand?"_expand":"_collapse"],on:{click:e.deptExpand}},[e.dept.expand?t("i",{staticClass:"el-icon-arrow-left"}):t("i",{staticClass:"el-icon-arrow-right"})])]),t("x-form",{ref:"x-form",scopedSlots:e._u([{key:"slot-move-dept",fn:function({scope:s}){return[t("div",{staticClass:"system-user-move-dept"},[t("el-tree",{attrs:{data:e.dept.list,props:{label:"name"},"node-key":"id","highlight-current":""},on:{"node-click":e.moveDeptClick}})],1)]}}])}),t("cl-context-menu",{ref:"context-menu"})],1)},i=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"label"},[t("div",[e._v("成员列表")])])}],a=(s("f16c"),s("45d2"),s("8160"),s("9052"),s("8bc2")),r={data(){return{crud:null,dept:{isDrag:!1,loading:!1,expand:!0,list:[]},selects:{dept:{},ids:[]}}},created(){this.deptRefresh()},methods:{refresh(e){this.crud.refresh(e)},onLoad({ctx:e,app:t}){const s=this.$createElement;this.crud=t,e.service(this.$service.system.user).set("table",{columns:[{type:"selection",align:"center",width:"60"},{prop:"headImg",label:"头像",align:"center",slot:!0},{prop:"name",label:"姓名",align:"center","min-width":150},{prop:"username",label:"用户名",align:"center","min-width":150},{prop:"nickName",label:"昵称",align:"center","min-width":150},{prop:"departmentName",label:"部门名称",align:"center",emptyText:"无","min-width":150},{prop:"roleName",label:"角色","header-align":"center",emptyText:"无","min-width":200},{prop:"phone",label:"手机号码",align:"center","min-width":150,emptyText:"无"},{prop:"remark",label:"备注",align:"center","min-width":150,emptyText:"无"},{prop:"status",label:"状态",align:"center","min-width":150},{prop:"createTime",label:"创建时间",align:"center",sortable:!0,width:150}],props:{"default-sort":{prop:"createTime",order:"descending"}},on:{"selection-change":e=>{this.selects.ids=e.map(e=>e.id)}},op:{layout:["slot-move","edit","delete"]}}).set("upsert",{props:{with:"800px"},items:[{prop:"headImg",label:"头像",span:24,component:{name:"cl-upload"}},{prop:"name",label:"姓名",span:24,component:{name:"el-input",props:{placeholder:"请填写姓名"}},rules:{required:!0,message:"姓名不能为空"}},{prop:"nickName",label:"昵称",span:12,component:{name:"el-input",props:{placeholder:"请填写昵称"}},rules:{required:!0,message:"昵称不能为空"}},{prop:"username",label:"用户名",span:12,component:{name:"el-input",props:{placeholder:"请填写用户名"}},rules:[{required:!0,message:"用户名不能为空"}]},{prop:"password",label:"密码",span:12,hidden:!0,component:{name:"el-input",props:{placeholder:"请填写密码",type:"password"}},rules:[{min:6,max:16,message:"密码长度在 6 到 16 个字符"}]},{prop:"roleIdList",label:"角色",span:24,value:[],component:{name:"cl-role-select",props:{"multiple-limit":3}},rules:{required:!0,message:"角色不能为空"}},{prop:"phone",label:"手机号码",span:12,component:{name:"el-input",props:{placeholder:"请填写手机号码"}}},{prop:"email",label:"邮箱",span:12,component:{name:"el-input",props:{placeholder:"请填写邮箱"}}},{prop:"remark",label:"备注",span:24,component:{name:"el-input",props:{type:"textarea",rows:4}}},{prop:"status",label:"状态",value:1,component:{name:"el-radio-group",options:[{label:"开启",value:1},{label:"关闭",value:0}]}},{prop:"tips",hidden:!0,component:s("div",[s("i",{class:"el-icon-warning"}),s("span",{style:"margin-left: 6px"},["新增用户默认密码为:123456"])])}]}).set("layout",[["refresh-btn","add-btn","multi-delete-btn","slot-multi-move","flex1","search-key"],["data-table"],["flex1","pagination"]]).on("open",e=>{t.setData("upsert.items[prop:password].hidden",!e),t.setData("upsert.items[prop:tips].hidden",e)}).on("submit",(e,t,{next:s})=>{let n=this.selects.dept.id;n||(n=this.dept.list[0].id),s({...t,departmentId:n})}).on("refresh",async(e,{next:t,render:s})=>{let{list:n}=await t(e);n.map(e=>{e.roleName&&this.$set(e,"roleNameList",e.roleName.split(",")),e.status=Boolean(e.status)}),s(n)}).done(),t.refresh()},deptRefresh(){this.dept.isDrag=!1,this.dept.loading=!0,this.$service.system.dept.list().then(e=>{this.dept.list=Object(a["deepTree"])(e)}).done(()=>{this.dept.loading=!1})},deptCM(e,t){let s=[{label:"新增","suffix-icon":"el-icon-plus",callback:(e,s)=>{this.deptEdit({name:"",parentName:t.name,parentId:t.id}),s()}},{label:"编辑","suffix-icon":"el-icon-edit",callback:(e,s)=>{this.deptEdit(t),s()}}];t||(t=this.dept.list[0]),t.parentId&&s.push({label:"删除","suffix-icon":"el-icon-delete",callback:(e,s)=>{this.deptDel(t),s()}}),s.push({label:"新增成员","suffix-icon":"el-icon-user",callback:(e,t)=>{this.crud.append(),t()}}),this.$refs["context-menu"].open(e,{list:s})},deptExpand(){this.dept.expand=!this.dept.expand},deptClick(e){this.$refs["context-menu"].close(),this.selects.dept=e;let t=Object(a["revDeepTree"])(e.children).map(e=>e.id);t.unshift(e.id),this.refresh({departmentIds:t.join(",")})},deptAllowDrag({data:e}){return e.parentId},deptAllowDrop(e,t){return t.data.parentId},deptEdit(e){const t=e.id?"update":"add";this.$refs["x-form"].open({props:{title:"编辑部门",width:"550px","label-width":"100px"},items:[{label:"部门名称",prop:"name",value:e.name,component:{name:"el-input",attrs:{placeholder:"请填写部门名称"}},rules:{required:!0,message:"部门名称不能为空"}},{label:"上级部门",prop:"parentId",value:e.parentName||"...",component:{name:"el-input",attrs:{disabled:!0}}},{label:"排序",prop:"orderNum",value:e.orderNum||0,component:{name:"el-input-number",props:{"controls-position":"right",min:0,max:100}}}],on:{submit:({data:s,done:n,close:i})=>{this.$service.system.dept[t]({id:e.id,parentId:e.parentId,name:s.name,orderNum:s.orderNum}).then(()=>{this.$message.success(`新增部门${s.name}成功`),i(),this.deptRefresh()}).catch(e=>{this.$message.error(e),n()})}}})},deptDel(e){const t=t=>{this.$service.system.dept.delete({ids:e.id,deleteUser:t}).then(()=>{t?this.$message.success("删除成功"):this.$confirm("该部门用户已移动到部门顶级","删除成功")}).done(()=>{this.deptRefresh()})};this.$confirm("该操作会删除部门下的所有用户,是否确认?","提示",{type:"warning",confirmButtonText:"直接删除",cancelButtonText:"保留用户",distinguishCancelAndClose:!0}).then(()=>{t(!0)}).catch(e=>{"cancel"==e&&t(!1)})},deptOrder(e){e?this.$confirm("部门架构已发生改变,是否保存?","提示",{type:"warning"}).then(()=>{const e=(s,n)=>{s.forEach(s=>{s.parentId=n,t.push(s),s.children&&Object(a["isArray"])(s.children)&&e(s.children,s.id)})};let t=[];e(this.dept.list,null),this.$service.system.dept.order(t.map((e,t)=>({id:e.id,parentId:e.parentId,orderNum:t}))).then(()=>{this.$message.success("更新排序成功")}).catch(e=>{this.$message.error(e)}).done(()=>{this.deptRefresh(),this.dept.isDrag=!1})}).catch(()=>{}):this.deptRefresh()},async toMove(e){this.$createElement;let t=[];t=e?[e.id]:this.selects.ids;let s=this;this.$refs["x-form"].open({props:{title:"部门转移",width:"600px","label-width":"80px"},items:[{label:"选择部门",prop:"dept",component:{name:"system-user-move-dept",methods:{selectRow(e){this.$emit("input",e)}},render(){const e=arguments[0];return e("div",{class:"system-user-move-dept"},[e("el-tree",{attrs:{data:s.dept.list,"node-key":"id","highlight-current":!0},props:{props:{label:"name"}},on:{"node-click":this.selectRow}})])}}}],on:{submit:({data:e,done:s,close:n})=>{if(!e.dept)return this.$message.warning("请选择部门"),s();const{name:i,id:a}=e.dept;this.$confirm(`是否将用户转移到部门 ${i} 下`,"提示",{type:"warning"}).then(()=>{this.$service.system.user.move({departmentId:a,userIds:t}).then(()=>{this.$message.success("转移成功"),n(),this.refresh()}).catch(e=>{this.$message.error(e),s()})}).catch(()=>{})}}})}}},l=r,o=(s("ca26"),s("8ea4"),s("1805")),p=Object(o["a"])(l,n,i,!1,null,"25164e4f",null);t["default"]=p.exports},"8ea4":function(e,t,s){"use strict";s("1cb5")},ca26:function(e,t,s){"use strict";s("e5a6")},e5a6:function(e,t,s){}}]);