16.9345cc7e715ff4b7b8d0.js 7.1 KB

12
  1. webpackJsonp([16],{"0II0":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("l/JR"),l=a("t4zo"),s=a.n(l),o=a("uXZL"),n=a.n(o),i={name:"User",data:function(){var e=this;return{form:{addUserName:"",addUserPwd:"",addUserRoleValue:"",addUserStateValue:""},radio:1,dialogVisible:!1,rules:{userName:[{required:!0,validator:function(t,a,r){""===e.form.addUserName?r(new Error("用户名不能为空")):(e.userTableData.forEach(function(t,a,l){e.form.addUserName==t.username&&r(new Error("用户名已存在"))}),r())},trigger:["blur","change"]}],userPwd:[{required:!0,validator:function(t,a,r){""===e.form.addUserPwd?r(new Error("密码不能为空")):e.form.addUserPwd.length<6?r(new Error("密码不能小于6位")):r()},trigger:["blur","change"]}],userRole:[{required:!0,message:"请选择类型",trigger:"blur"}],userState:[{required:!0,message:"请选择状态",trigger:"blur"}]},isAdmin:!1,userTableData:[{username:"165asas",password:"123456",role:"user",state:"unlock"},{username:"sa223sas",password:"123456",role:"user",state:"unlock"},{username:"admin4",password:"123456",role:"admin",state:"unlock"}],addUserRole:[{value:"admin",label:"admin"},{value:"user",label:"user"}],addUserState:[{value:"lock",label:"lock"},{value:"unlock",label:"unlock"}]}},created:function(){this.GetUser(),"admin"==JSON.parse(sessionStorage.getItem("userData")).userName&&(this.isAdmin=!0)},methods:{GetUser:function(){var e=this;Object(r.l)().then(function(t){console.log(t.UsersManagement),e.userTableData=t.UsersManagement})},handleClick:function(e){var t=this,a={username:e.username};this.$confirm("是否删除当前用户?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Object(r.G)(a).then(function(e){t.$message({type:"success",message:"导出成功!"}),t.GetUser()})}).catch(function(){})},btnOK:function(){var e=this,t={username:this.form.addUserName,password:this.form.addUserPwd,role:this.form.addUserRoleValue,state:this.form.addUserStateValue};Object(r.o)(t).then(function(t){console.log(t),e.dialogVisible=!1,e.$message({type:"success",message:"创建成功"}),e.GetUser()})},btnNO:function(){this.dialogVisible=!this.dialogVisible},goTo:function(){this.$router.push("/Alarm/RealTime")},downlodTable:function(){var e=this;this.$confirm("是否需要导出xlsx文档, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){e.downFile(),e.$message({type:"success",message:"导出成功!"})}).catch(function(){e.$message({type:"info",message:"已取消导出"})})},downFile:function(){var e=n.a.utils.table_to_book(document.querySelector("#userTableData")),t=n.a.write(e,{bookType:"xlsx",bookSST:!0,type:"array"});try{s.a.saveAs(new Blob([t],{type:"application/octet-stream"}),"user.xlsx")}catch(e){"undefined"!=typeof console&&console.log(e,t)}return t},addUser:function(){this.dialogVisible=!0}}},d={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"logBox"},[a("div",{staticClass:"border_left_top border"}),e._v(" "),a("div",{staticClass:"border_top border"}),e._v(" "),a("div",{staticClass:"border_right_top border"}),e._v(" "),a("div",{staticClass:"border_left border"}),e._v(" "),a("div",{staticClass:"border_right border"}),e._v(" "),a("div",{staticClass:"border_left_bottom border"}),e._v(" "),a("div",{staticClass:"border_bottom border"}),e._v(" "),a("div",{staticClass:"border_right_bottom border"}),e._v(" "),a("el-button-group",{attrs:{id:"topButton2"}},[a("el-button",{staticClass:"active",attrs:{type:"primary"}},[e._v("用户管理")])],1),e._v(" "),e.isAdmin?a("el-button",{staticClass:"addUser",attrs:{type:"primary"},on:{click:e.addUser}},[e._v("新增用户")]):e._e(),e._v(" "),a("el-table",{ref:"userTableData",staticStyle:{width:"100%",color:"#2DAFF5","max-height":"100%","overflow-y":"auto","background-color":"none"},attrs:{data:e.userTableData,id:"userTableData"}},[a("el-table-column",{attrs:{prop:"username",align:"center",label:"用户名"}}),e._v(" "),e.isAdmin?a("el-table-column",{attrs:{prop:"password",align:"center",label:"密码"}}):e._e(),e._v(" "),a("el-table-column",{attrs:{prop:"mianJd",align:"center",label:"主界面"},scopedSlots:e._u([{key:"default",fn:function(t){return["administrator"==t.row.role?a("label",[e._v("修改")]):a("label",[e._v("查看")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"username",align:"center",label:"AMR管理"},scopedSlots:e._u([{key:"default",fn:function(t){return["administrator"==t.row.role?a("label",[e._v("修改")]):a("label",[e._v("查看")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"username",align:"center",label:"系统管理"},scopedSlots:e._u([{key:"default",fn:function(t){return["administrator"==t.row.role?a("label",[e._v("修改")]):a("label",[e._v("查看")])]}}])}),e._v(" "),e.isAdmin?a("el-table-column",{attrs:{label:"操作",align:"center",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return["administrator"!=t.row.role?a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.handleClick(t.row)}}},[e._v("删除")]):e._e()]}}],null,!1,8619185)}):e._e()],1),e._v(" "),a("el-dialog",{attrs:{title:"编辑用户",visible:e.dialogVisible,width:"600px",id:"addUserDialog"},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules}},[a("el-form-item",{attrs:{label:"用户名:",prop:"userName","label-width":"90px"}},[a("el-input",{attrs:{type:"text",autocomplete:"off"},model:{value:e.form.addUserName,callback:function(t){e.$set(e.form,"addUserName",t)},expression:"form.addUserName"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"密码:",prop:"userPwd","label-width":"90px"}},[a("el-input",{attrs:{type:"password","auto-complete":"off"},model:{value:e.form.addUserPwd,callback:function(t){e.$set(e.form,"addUserPwd",t)},expression:"form.addUserPwd"}})],1),e._v(" "),a("el-form-item",{staticStyle:{"margin-bottom":"20px"},attrs:{label:"角色类型:",prop:"userRole","label-width":"90px"}},[[a("el-select",{attrs:{placeholder:"请选择类型"},model:{value:e.form.addUserRoleValue,callback:function(t){e.$set(e.form,"addUserRoleValue",t)},expression:"form.addUserRoleValue"}},e._l(e.addUserRole,function(e,t){return a("el-option",{key:t,attrs:{label:e.label,value:e.value},on:{click:function(e){}}})}),1)]],2),e._v(" "),a("el-form-item",{staticStyle:{"margin-bottom":"0"},attrs:{label:"状态:",prop:"userState","label-width":"90px"}},[[a("el-select",{attrs:{placeholder:"请选择状态"},model:{value:e.form.addUserStateValue,callback:function(t){e.$set(e.form,"addUserStateValue",t)},expression:"form.addUserStateValue"}},e._l(e.addUserState,function(e,t){return a("el-option",{key:t,attrs:{label:e.label,value:e.value}})}),1)]],2)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary",id:"sureBtn"},on:{click:e.btnOK}},[e._v("确 定")]),e._v(" "),a("el-button",{attrs:{type:"primary",id:"sureBtn"},on:{click:e.btnNO}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var u=a("VU/8")(i,d,!1,function(e){a("RxRM")},"data-v-5c03bbe4",null);t.default=u.exports},RxRM:function(e,t){}});
  2. //# sourceMappingURL=16.9345cc7e715ff4b7b8d0.js.map