liuxiaolong
2019-05-06 f99bc8c6a1d10610373738edd7d0aa0181c81d99
1
webpackJsonp([5,8],{"5j9z":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("Q32s"),a=r("NYaw"),s=r("qaB4"),o=r("rA5e"),i=r("ziRP");var c={props:{title:{type:String,default:"请选择人员关系"}},data:function(){return{modelList:[],total:0,length:9,currentPage:1,searchValue:"",selected:[],focused:null,dropdownOpened:null}},computed:{orgId:function(){return this.$store.getters.basicUserInfo.orgId}},methods:{showModal:function(){this.$refs.myModalRef.show(),this.getRelation()},hideModal:function(){this.$refs.myModalRef.hide()},getRelation:function(){var e,t=this;return(e=regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(i.m)({orgId:t.orgId,id:1,length:t.length,start:t.length*(t.currentPage-1),type:"",isAll:0,name:t.searchValue});case 2:(r=e.sent)&&(t.modelList=r.data,t.total=r.total);case 4:case"end":return e.stop()}},e,t)}),function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(a,s){try{var o=t[a](s),i=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(i).then(function(e){n("next",e)},function(e){n("throw",e)});e(i)}("next")})})()},changePage:function(e){this.currentPage=e,this.getRelation()},handleSearch:function(){this.currentPage=1,this.getRelation()},toggleSelect:function(e,t){e?this.selected=[t]:this.selected.splice(this.selected.indexOf(t),1)},handleSave:function(){this.$emit("relationData",this.selected),this.selected=[],this.hideModal()}}},u=r("XyMi");var l=function(e){r("6Inw"),r("aIuE")},d=Object(u.a)(c,function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("b-modal",{ref:"myModalRef",attrs:{title:e.title,size:"lg","ok-title":"确定","cancel-title":"取消"},on:{ok:e.handleSave,cancel:e.hideModal}},[r("div",{staticClass:"ml10"},[r("span",[e._v("姓名:")]),e._v(" "),r("b-input",{staticStyle:{width:"200px",display:"inline-block"},attrs:{placeholder:"请输入姓名"},nativeOn:{change:function(t){return e.handleSearch(t)}},model:{value:e.searchValue,callback:function(t){e.searchValue=t},expression:"searchValue"}}),e._v(" "),r("b-btn",{attrs:{variant:"primary"},on:{click:e.handleSearch}},[e._v("\n      搜索\n    ")])],1),e._v(" "),r("div",{staticClass:"row pt-3",staticStyle:{"margin-left":"0","margin-right":"0"}},e._l(e.modelList,function(t){return r("div",{key:t.id,staticClass:"col-md-6 col-xl-4"},[r("b-card",{staticClass:"card-condenced mb-3 person-card overflow-hidden",attrs:{"body-class":"media align-items-center"},on:{click:function(r){e.toggleSelect(r,t)}}},[r("b-check",{staticClass:"file-item-checkbox",attrs:{checked:e.selected.includes(t)},on:{change:function(r){e.toggleSelect(r,t)}}}),e._v(" "),r("httpImg",{staticClass:"max-img",attrs:{src:t.photos,height:"100px"}}),e._v(" "),r("div",{staticClass:"media-body ml-3"},[r("a",{staticClass:"text-dark font-weight-semibold mb-2",attrs:{href:"javascript:void(0)"}},[e._v("\n            "+e._s(t.name)+"\n          ")])])],1)],1)})),e._v(" "),r("div",{staticClass:"fr"},[e.total?r("b-pagination",{staticClass:"ml10",attrs:{size:"md","total-rows":e.total,"per-page":e.length},on:{change:e.changePage},model:{value:e.currentPage,callback:function(t){e.currentPage=t},expression:"currentPage"}}):e._e()],1)])},[],!1,l,null,null).exports,f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function m(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function h(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function p(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(a,s){try{var o=t[a](s),i=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(i).then(function(e){n("next",e)},function(e){n("throw",e)});e(i)}("next")})}}var g={props:{title:String,orgId:[String,Number]},data:function(){return{roleList:[],initFileIds:"",fileIds:[],form:{nickname:"",idCard:"",username:"",password:"",phone:"",sex:"1",email:"",headImgUrl:"",confirmPassword:""},optionsSex:[{text:"男",value:"1"},{text:"女",value:"0"}],ischeckUp:!1,saveLoading:!1,fileList:[]}},computed:{headerTitle:function(){return this.$route.query.userId?"编辑人员 -- "+this.$route.query.currentName:"添加人员 -- "+this.$route.query.currentName},userInfo:function(){return this.$store.getters.basicUserInfo},stateUserName:function(){return this.ischeckUp?this.form.username.length>0:null},invalidUserName:function(){return this.ischeckUp?"请输入用户名":""},statePassword:function(){return this.ischeckUp?this.form.password.length>0:null},invalidPassword:function(){return this.ischeckUp?"请输入密码":""},stateConfirmPassword:function(){return this.ischeckUp?this.form.confirmPassword.length>0:null},invalidConfirmPassword:function(){return this.ischeckUp?"请输入确认密码":""},stateNickname:function(){return this.ischeckUp?this.form.nickname.length>0:null},invalidNickname:function(){return this.ischeckUp?"请输入姓名":""},statePhone:function(){return this.ischeckUp?/^1[3-9]\d{9}$/.test(this.form.phone):null},invalidPhone:function(){return this.ischeckUp?"请正确输入手机号":""},stateIdCard:function(){return this.ischeckUp?/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/.test(this.form.idCard):null},invalidIdCard:function(){return this.ischeckUp?"请正确输入身份证":""}},mounted:function(){this.fetchUserInfo()},methods:{fetchUserInfo:function(){var e=this;return p(regeneratorRuntime.mark(function t(){var r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.$route.query.userId){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,Object(o.a)({orgId:e.$route.query.currentId,id:e.$route.query.userId});case 4:(r=t.sent)&&(Object.keys(e.form).map(function(t){e.form[t]=r[t]}),e.form.password="123456",e.form.confirmPassword="123456");case 6:case"end":return t.stop()}},t,e)}))()},showModel:function(){this.$refs.myModalRef.show(),this.fetchRoleList()},fetchRoleList:function(){var e=this;return p(regeneratorRuntime.mark(function t(){var r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(a.c)({orgId:e.userInfo.orgId});case 2:(r=t.sent)&&r.data&&(e.roleList=r.data);case 4:case"end":return t.stop()}},t,e)}))()},handleConnectUser:function(){this.$refs.personnelFormRelation.showModal()},relationData:function(e){var t=[].concat(h(e))[0];this.form.idCard=t.cardId,this.form.nickname=t.name,this.form.phone=t.phone,this.form.headImgUrl=t.photos,this.form.sex="女"===t.gender?"0":"1"},saveUser:function(){var e=this;return p(regeneratorRuntime.mark(function t(){var r,n,a,s,i,c;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.ischeckUp=!0,e.verifyRequrie()){t.next=4;break}return t.abrupt("return");case 4:if(e.verifyPassword(e.form.password,e.form.confirmPassword)){t.next=8;break}return e.$toast({type:"warning",message:"两次输入密码不一致"}),t.abrupt("return");case 8:if(!e.$route.query.userId){t.next=16;break}return r=e.form,r.confirmPassword,r.password,n=m(r,["confirmPassword","password"]),t.next=12,Object(o.i)(f({orgId:e.$route.query.currentId,id:e.$route.query.userId},n));case 12:(a=t.sent)&&a.success?(e.$toast({type:"success",message:"编辑用户成功"}),e.$router.push({path:"/user",query:{currentId:e.$route.query.currentId}})):e.$toast({type:"warning",message:a.message}),t.next=21;break;case 16:return s=e.form,s.confirmPassword,i=m(s,["confirmPassword"]),t.next=19,Object(o.g)(f({orgId:e.$route.query.currentId,officeId:e.$route.query.officeId},i));case 19:(c=t.sent)&&400===c.code?e.$toast({type:"warning",message:c.message}):(e.$toast({type:"success",message:"添加用户成功"}),e.$router.push({path:"/user",query:{currentId:e.$route.query.currentId}}));case 21:case"end":return t.stop()}},t,e)}))()},verifyPassword:function(e,t){return e===t},verifyRequrie:function(){return this.form.username?this.form.password?this.form.confirmPassword?this.form.nickname?/^1[3-9]\d{9}$/.test(this.form.phone)?!!/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/.test(this.form.idCard)||(this.$toast({type:"warning",message:"请正确输入身份证号"}),!1):(this.$toast({type:"warning",message:"请正确输入手机号"}),!1):(this.$toast({type:"warning",message:"请输入姓名"}),!1):(this.$toast({type:"warning",message:"请输入确认密码"}),!1):(this.$toast({type:"warning",message:"请输入密码"}),!1):(this.$toast({type:"warning",message:"请输入用户名"}),!1)},addFiles:function(e){var t=e.fileIds,r=e.fileList;this.fileList=[].concat(h(r)),this.fileIds=t,console.log(r,"fileIds"),this.form.headImgUrl=r.length&&r[r.length-1].data.path},handleDelImg:function(){this.form.headImgUrl=""},clearName:function(){console.log("cancel")}},components:{UpLoad:n.a,LaddaBtn:s.a,PersonnelFormRelation:d}};var v=function(e){r("jh5A")},b=Object(u.a)(g,function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("h4",{staticClass:"font-weight-bold py-3 mb-2"},[r("router-link",{attrs:{to:"/user"}},[r("span",{staticClass:"text-muted font-weight-light"},[e._v("用户管理 /")])]),e._v("\n    "+e._s(e.headerTitle)+"\n  ")],1),e._v(" "),r("b-card",{staticClass:"pt30 pl20 pr20 pb30",attrs:{"no-body":""}},[r("div",{staticClass:"btn-content mb10"},[e.$route.query.userId?e._e():r("b-btn",{attrs:{variant:"primary"},on:{click:e.handleConnectUser}},[e._v("\n        关联人员信息\n      ")])],1),e._v(" "),r("b-form",{on:{submit:e.saveUser}},[r("div",{staticClass:"row"},[r("div",{staticClass:"col"},[r("b-form-group",{attrs:{horizontal:"",label:"用户名:","label-cols":4,"label-class":"text-sm-right","label-for":"input_username","invalid-feedback":e.invalidUserName}},[r("b-form-input",{attrs:{autocomplete:"off",required:"",id:"input_username",state:e.stateUserName,placeholder:"请输入用户名"},model:{value:e.form.username,callback:function(t){e.$set(e.form,"username",t)},expression:"form.username"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"",label:"密码:","label-cols":4,"label-for":"input_password","label-class":"text-sm-right","invalid-feedback":e.invalidPassword}},[r("b-form-input",{attrs:{disabled:!!e.$route.query.userId,autocomplete:"off",required:"",id:"input_password",type:"password",state:e.statePassword,placeholder:"请输入密码"},model:{value:e.form.password,callback:function(t){e.$set(e.form,"password",t)},expression:"form.password"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"",label:"确认密码:","label-cols":4,"label-for":"input_confirmPassword","label-class":"text-sm-right","invalid-feedback":e.invalidConfirmPassword}},[r("b-form-input",{attrs:{disabled:!!e.$route.query.userId,autocomplete:"off",required:"",id:"input_confirmPassword",type:"password",state:e.stateConfirmPassword,placeholder:"请输入确认密码"},model:{value:e.form.confirmPassword,callback:function(t){e.$set(e.form,"confirmPassword",t)},expression:"form.confirmPassword"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"","label-cols":4,"label-class":"text-sm-right",label:"姓名:","label-for":"input_nickname","invalid-feedback":e.invalidNickname}},[r("b-form-input",{attrs:{autocomplete:"off",id:"input_nickname",state:e.stateNickname,placeholder:"请输入姓名"},model:{value:e.form.nickname,callback:function(t){e.$set(e.form,"nickname",t)},expression:"form.nickname"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"","label-cols":4,"label-class":"text-sm-right",label:"头像:"}},[e.form.headImgUrl?e._e():r("UpLoad",{attrs:{isShowHr:!1,layout:1,title:"",isList:!1,initFileIds:e.initFileIds},on:{addFilesBaBackFN:e.addFiles}}),e._v(" "),e.form.headImgUrl?r("div",{staticClass:"img-content",on:{click:e.handleDelImg}},[r("span",{staticClass:"ion-md-close"}),e._v(" "),r("httpImg",{attrs:{src:e.form.headImgUrl,alt:"",width:"100%"}})],1):e._e()],1)],1),e._v(" "),r("div",{staticClass:"col"},[r("b-form-group",{attrs:{horizontal:"","label-cols":4,"label-class":"text-sm-right",label:"性别:","label-for":"radios1"}},[r("b-form-radio-group",{attrs:{id:"radios1",options:e.optionsSex,name:"radioOpenions"},model:{value:e.form.sex,callback:function(t){e.$set(e.form,"sex",t)},expression:"form.sex"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"","label-cols":4,label:"电话:","label-class":"text-sm-right","label-for":"input_phone","invalid-feedback":e.invalidPhone}},[r("b-form-input",{attrs:{autocomplete:"off",id:"input_phone",state:e.statePhone,placeholder:"请输入电话"},model:{value:e.form.phone,callback:function(t){e.$set(e.form,"phone",t)},expression:"form.phone"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"","label-cols":4,label:"电子邮件:","label-class":"text-sm-right","label-for":"input_email"}},[r("b-form-input",{attrs:{autocomplete:"off",id:"input_email",placeholder:"请输入电子邮件"},model:{value:e.form.email,callback:function(t){e.$set(e.form,"email",t)},expression:"form.email"}})],1),e._v(" "),r("b-form-group",{attrs:{horizontal:"","label-cols":4,"label-class":"text-sm-right",label:"身份证:","label-for":"input_idCard","invalid-feedback":e.invalidIdCard}},[r("b-form-input",{attrs:{autocomplete:"off",id:"input_idCard",state:e.stateIdCard,placeholder:"请输入身份证"},model:{value:e.form.idCard,callback:function(t){e.$set(e.form,"idCard",t)},expression:"form.idCard"}})],1)],1)]),e._v(" "),r("div",{staticClass:"text-right mt-3"},[r("LaddaBtn",{staticClass:"btn btn-primary",attrs:{loading:e.saveLoading,"data-style":"slide-down"},nativeOn:{click:function(t){return e.saveUser(t)}}},[e._v("\n          保存\n        ")]),e._v("\n         \n        "),r("b-btn",{attrs:{variant:"default"},on:{click:function(t){e.$router.push({path:"/user"})}}},[e._v("返回")])],1)])],1),e._v(" "),r("PersonnelFormRelation",{ref:"personnelFormRelation",attrs:{title:"选择人员"},on:{relationData:e.relationData}})],1)},[],!1,v,"data-v-b991c53e",null);t.default=b.exports},"6Inw":function(e,t){},aIuE:function(e,t){},"bx/Q":function(e,t){},jh5A:function(e,t){},rA5e:function(e,t,r){"use strict";r.d(t,"c",function(){return a}),r.d(t,"g",function(){return s}),r.d(t,"h",function(){return o}),r.d(t,"e",function(){return i}),r.d(t,"b",function(){return c}),r.d(t,"i",function(){return u}),r.d(t,"a",function(){return l}),r.d(t,"d",function(){return d}),r.d(t,"f",function(){return f});var n=r("59if"),a=function(e){return Object(n.b)("data/api-u/users",{body:e})},s=function(e){return Object(n.c)("data/api-u/users-anon/register",{body:e})},o=function(e){return Object(n.b)("data/api-u/users-anon/delete",{body:e})},i=function(e){return Object(n.c)("data/api-u/users/setRoleToUser",{body:e})},c=function(e){return Object(n.b)("data/api-u/users/findRolesIdsByUserId",{body:e})},u=function(e){return Object(n.c)("data/api-u/users-anon/update",{body:e})},l=function(e){return Object(n.b)("data/api-u/users/findUserById",{body:e})},d=function(e){return Object(n.b)("data/api-u/users/setPassWord",{body:e})},f=function(e){return Object(n.b)("data/api-u/users/updateOfficeId",{body:e})}},x7Nh:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r("Dte2"),r("+BTi");var n=r("q4le"),a=r.n(n),s=(r("isE6"),r("LR6y")),o=r.n(s),i=(r("jZDA"),r("91Nw")),c=r.n(i),u=(r("d7TW"),r("ajQY")),l=r.n(u),d=r("5j9z"),f=r("7wcY"),m=r("6nPA"),h=r("52HV"),p=r("5t7w"),g=r("Ls4C"),v=r("rA5e"),b=r("nznj"),I=r("NYaw");function w(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function y(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(a,s){try{var o=t[a](s),i=o.value}catch(e){return void r(e)}if(!o.done)return Promise.resolve(i).then(function(e){n("next",e)},function(e){n("throw",e)});e(i)}("next")})}}var x={metaInfo:{title:"用户管理"},data:function(){return{total:0,length:10,userData:[],treeData:[],currentId:"",currentPage:1,selected:null,searchName:"",currentUserId:"",sideboxOpen:!1,sideboxOpened:!1,currentOrgItem:null,currentRoleInUser:[],role:{name:"",total:0,length:999,roleList:[],currentPage:1},allNodeOptions:["全部","当前机构"],allNode:"全部",isCheckAll:!1,checkIds:[]}},computed:{orgId:function(){return this.$store.getters.basicUserInfo.orgId}},mounted:function(){var e=this;return y(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getTree();case 2:e.$nextTick(y(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.fetchUserList();case 2:return t.next=4,e.fetchRoleList();case 4:case"end":return t.stop()}},t,e)})));case 3:case"end":return t.stop()}},t,e)}))()},methods:{fetchUserList:function(){var e=this;return y(regeneratorRuntime.mark(function t(){var r,n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.currentOrgItem){t.next=2;break}return t.abrupt("return");case 2:return r=Object(b.e)(e.currentOrgItem.type),console.log(r,"this.currentOrgItem"),n=r?e.currentOrgItem.id:e.currentOrgItem.orgId,console.log(n,"orgId"),t.next=8,Object(v.c)({orgId:n,id:e.currentOrgItem.id,start:e.length*(e.currentPage-1),name:e.searchName,length:e.length,isAll:"全部"===e.allNode?0:1});case 8:(a=t.sent)&&(e.userData=a.data,e.total=a.total);case 10:case"end":return t.stop()}},t,e)}))()},handleSearch:function(){this.currentPage=1,this.fetchUserList()},fetchRoleList:function(){var e=this;return y(regeneratorRuntime.mark(function t(){var r,n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=Object(b.e)(e.currentOrgItem.type),console.log(r,"this.currentOrgItem"),n=r?e.currentOrgItem.id:e.currentOrgItem.orgId,t.next=5,Object(I.b)({orgId:n,start:0,name:e.role.name,length:e.role.length});case 5:(a=t.sent)&&(e.role.roleList=a.data);case 7:case"end":return t.stop()}},t,e)}))()},index:function(e){return this.currentPage>1?this.length*(this.currentPage-1)+e+1:e+1},getTree:function(){var e=this;return y(regeneratorRuntime.mark(function t(){var r,n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(m.d)({orgById:e.orgId});case 2:(r=t.sent)&&(e.treeData=r,e.$route.query.currentId?(e.$refs.tree.setCurrentKey(e.$route.query.currentId),e.currentId=e.$route.query.currentId,e.$nextTick(function(){e.currentOrgItem=e.$refs.tree.getCurrentNode()})):(n=e.treeData[0],n.child,a=w(n,["child"]),e.currentOrgItem=a,e.$refs.tree.setCurrentKey(a.id),e.currentId=a.id));case 4:case"end":return t.stop()}},t,e)}))()},handleAdd:function(){var e=this;return y(regeneratorRuntime.mark(function t(){var r,n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.currentId){t.next=3;break}return e.$toast({type:"warning",message:"请先选择一个机构"}),t.abrupt("return");case 3:r=e.currentOrgItem.id,n=Object(b.e)(e.currentOrgItem.type),a=n?e.currentOrgItem.id:e.currentOrgItem.orgId,e.$router.push({path:"/user/add",query:{officeId:r,currentId:a,currentName:e.currentOrgItem.name}});case 7:case"end":return t.stop()}},t,e)}))()},changePage:function(e){this.currentPage=e,this.fetchUserList()},handleRole:function(e){this.$refs.userEditRole.showModel(),this.currentUserId=e,this.getRoleInUser()},handleDel:function(e){var t=this;this.$swal({title:"确定删除吗?",type:"error",showCancelButton:!0,allowOutsideClick:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnConfirm:!0},y(regeneratorRuntime.mark(function r(){var n;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Object(v.h)({id:e});case 2:(n=r.sent)&&n.code-0==0?(t.$toast({type:"success",message:"删除成功!"}),1===t.userData.length&&t.currentPage-0>1&&(t.currentPage=t.currentPage-1),t.fetchUserList()):t.$toast({type:"warning",message:"删除失败!"});case 4:case"end":return r.stop()}},r,t)})))},handleReset:function(e,t){var r=this;this.$swal({title:"确定重置当前用户登陆密码为123456?",type:"warning",showCancelButton:!0,allowOutsideClick:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnConfirm:!0},y(regeneratorRuntime.mark(function n(){var a;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Object(v.d)({orgId:t,id:e});case 2:(a=n.sent)&&a.success?r.$toast({type:"success",message:"重置成功"}):r.$toast({type:"warning",message:a.message});case 4:case"end":return n.stop()}},n,r)})))},handleEdit:function(e){var t=e.id,r=e.orgId;this.$router.push({path:"/user/add",query:{currentId:r,userId:t,currentName:this.currentOrgItem.name}})},getRoleInUser:function(){var e=this;return y(regeneratorRuntime.mark(function t(){var r,n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=Object(b.e)(e.currentOrgItem.type),n=r?e.currentOrgItem.id:e.currentOrgItem.orgId,t.next=4,Object(v.b)({id:e.currentUserId,orgId:n});case 4:(a=t.sent)&&a.code-0==0?e.currentRoleInUser=a.data:e.currentRoleInUser=[];case 6:case"end":return t.stop()}},t,e)}))()},savaRoleInUser:function(e){var t=this;return y(regeneratorRuntime.mark(function r(){var n,a,s;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return n=Object(b.e)(t.currentOrgItem.type),a=n?t.currentOrgItem.id:t.currentOrgItem.orgId,r.next=4,Object(v.e)({id:t.currentUserId,orgId:a,roleIds:e});case 4:(s=r.sent)&&s.code-0==0?(t.$toast({type:"success",message:"分配角色成功"}),t.$refs.userEditRole.hideModel()):t.$toast({type:"error",message:s.message});case 6:case"end":return r.stop()}},r,t)}))()},currentNode:function(e){this.currentOrgItem=e,this.currentId=e.id,this.searchName="",this.fetchUserList(),this.fetchRoleList()},updateUserToOrg:function(e){var t=this;return y(regeneratorRuntime.mark(function r(){var n;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Object(v.f)(e);case 2:(n=r.sent)&&n.success&&(t.$refs.treeModel.hideModel(),1===t.userData.length&&t.currentPage-0>1&&(t.currentPage=t.currentPage-1),t.fetchUserList()),t.$toast({type:n&&n.success?"success":"error",message:n&&n.msg?n.msg:"变更失败"});case 5:case"end":return r.stop()}},r,t)}))()},handleSelectionChange:function(e){this.checkIds=e.map(function(e){return e.id})},handleEditOrg:function(){this.isCheckAll||this.checkIds.length?this.$refs.treeModel.showModel():this.$toast({type:"error",message:"请选择需要变更的组织机构的用户"})},submitEditOrg:function(e){var t=this,r=e.node;if(r){var n=this.currentOrgItem.id,a={orgId:Object(b.e)(this.currentOrgItem.type)?this.currentOrgItem.id:this.currentOrgItem.orgId,updateOfficeId:r.id,updateOrgId:Object(b.e)(r.type)?r.id:r.orgId};this.isCheckAll?(a.officeId=n,this.$swal({title:"确定将”"+this.currentOrgItem.name+"“下全部用户移动到”"+r.name+"“吗?",type:"warning",showCancelButton:!0,allowOutsideClick:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnConfirm:!0},function(){t.updateUserToOrg(a)})):(a.userIds=this.checkIds.toString(),this.updateUserToOrg(a))}}},watch:{allNode:function(e,t){e!==t&&this.fetchUserList()}},components:{elRow:l.a,elCol:c.a,Table:o.a,UserForm:d.default,TableColumn:a.a,UserEditRole:f.a,PersonnelTree:h.a,PersonnelTreeModel:p.a,PerfectScrollbar:g.a}},k=r("XyMi");var O=function(e){r("bx/Q")},_=Object(k.a)(x,function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"container-p-y container-p-x"},[r("Row",[r("h4",{staticClass:"d-flex flex-wrap justify-content-between align-items-center pt-2 mb-2"},[r("div",{staticClass:"mb-2"},[e._v("用户管理")]),e._v(" "),r("div",{staticClass:"mb-2",staticStyle:{"max-width":"200px"}},[r("fButton",{attrs:{type:"warning",authority:"sys:user:add"},nativeOn:{click:function(t){return e.handleAdd(t)}}},[r("span",{staticClass:"fas fa-plus pr10"}),e._v("\n            添加用户\n          ")])],1)]),e._v(" "),r("el-col",{attrs:{span:6}},[r("b-card",{staticStyle:{"margin-right":"10px"}},[r("PersonnelTree",{ref:"tree",attrs:{data:e.treeData,currentId:e.currentId},on:{currentNode:e.currentNode}})],1)],1),e._v(" "),r("el-col",{attrs:{span:18}},[r("div",{staticClass:"clients-wrapper",class:{"clients-sidebox-open":e.sideboxOpened,"messages-sidebox-open":e.sideboxOpen}},[r("perfect-scrollbar",{staticClass:"clients-content clients-scroll",attrs:{options:{suppressScrollX:!0,wheelPropagation:!0}}},[r("b-card",[r("div",{staticClass:"clearfix mb10"},[r("div",{staticClass:"fl"},[r("b-form-radio-group",{staticClass:"mr10",attrs:{id:"btnradios2",buttons:"","button-variant":"outline-primary",name:"radioBtnOutline"},model:{value:e.allNode,callback:function(t){e.allNode=t},expression:"allNode"}},e._l(e.allNodeOptions,function(t,n){return r("b-form-radio",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],key:n,attrs:{value:t,title:"当前机构"===t?"选中后,只查询本机构人员,不查询下属机构":""}},[e._v(e._s(t))])})),e._v(" "),r("span",[e._v("姓名:")]),e._v(" "),r("b-input",{staticClass:"mr10",staticStyle:{width:"200px",display:"inline-block"},attrs:{autocomplete:"off",placeholder:"请输入关键字"},model:{value:e.searchName,callback:function(t){e.searchName=t},expression:"searchName"}}),e._v(" "),r("b-btn",{attrs:{variant:"primary"},on:{click:e.handleSearch}},[r("span",{staticClass:"fas fa-search"}),e._v("\n                  搜 索\n                ")])],1),e._v(" "),r("fTemplate",{staticClass:"fr",attrs:{authority:"sys:user:editOrg"}},[r("b-form-checkbox",{attrs:{value:!0,"unchecked-value":!1},model:{value:e.isCheckAll,callback:function(t){e.isCheckAll=t},expression:"isCheckAll"}},[e._v("\n                  选择全部用户\n                ")]),e._v(" "),r("b-btn",{attrs:{variant:"success"},on:{click:e.handleEditOrg}},[r("span",{staticClass:"fas fa-edit pr5"}),e._v("机构变更\n                ")])],1)],1),e._v(" "),r("Table",{attrs:{data:e.userData},on:{"selection-change":e.handleSelectionChange}},[r("TableColumn",{attrs:{type:"selection",width:"55"}}),e._v(" "),r("TableColumn",{attrs:{type:"index",label:"序号",index:e.index,width:"50"}}),e._v(" "),r("TableColumn",{attrs:{label:"姓名",prop:"nickname",width:"200"}}),e._v(" "),r("TableColumn",{attrs:{label:"用户名",prop:"username",width:"200"}}),e._v(" "),r("TableColumn",{attrs:{label:"电话",prop:"phone",width:"200"}}),e._v(" "),r("TableColumn",{attrs:{label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("fButton",{attrs:{type:"link",authority:"sys:user:edit"},nativeOn:{click:function(r){e.handleEdit(t.row)}}},[e._v("\n                    编辑\n                  ")]),e._v(" "),r("fButton",{attrs:{type:"link",authority:"sys:user:role"},nativeOn:{click:function(r){e.handleRole(t.row.id)}}},[e._v("\n                    分配角色\n                  ")]),e._v(" "),r("fButton",{attrs:{type:"link",authority:"sys:user:resetpassword"},nativeOn:{click:function(r){e.handleReset(t.row.id,t.row.orgId)}}},[e._v("\n                    重置密码\n                  ")]),e._v(" "),r("fButton",{attrs:{type:"link",authority:"sys:user:delete"},nativeOn:{click:function(r){e.handleDel(t.row.id)}}},[e._v("\n                    删除\n                  ")])]}}])})],1),e._v(" "),r("div",{staticClass:"pt20 pb20"},[e.total?r("b-pagination",{staticClass:"justify-content-center justify-content-sm-end m-0",attrs:{"total-rows":e.total,"per-page":e.length},on:{change:e.changePage},model:{value:e.currentPage,callback:function(t){e.currentPage=t},expression:"currentPage"}}):e._e()],1)],1)],1)],1)]),e._v(" "),r("UserEditRole",{ref:"userEditRole",attrs:{roleList:e.role.roleList,currentRoleInUser:e.currentRoleInUser},on:{submit:e.savaRoleInUser}}),e._v(" "),r("PersonnelTreeModel",{ref:"treeModel",attrs:{treeData:e.treeData,currentId:e.currentId,item:null,title:"选择要变更的组织机构"},on:{submit:e.submitEditOrg}})],1)],1)},[],!1,O,null,null);t.default=_.exports}});