1 line
8.4 KiB
JavaScript
1 line
8.4 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1de6578b"],{"72db":function(e,t,r){"use strict";r.d(t,"h",function(){return n}),r.d(t,"k",function(){return s}),r.d(t,"b",function(){return o}),r.d(t,"l",function(){return i}),r.d(t,"f",function(){return c}),r.d(t,"j",function(){return l}),r.d(t,"d",function(){return u}),r.d(t,"m",function(){return d}),r.d(t,"a",function(){return p}),r.d(t,"g",function(){return m}),r.d(t,"i",function(){return g}),r.d(t,"c",function(){return f}),r.d(t,"e",function(){return h});var a=r("1f75");function n(){return a["a"].get("/apps")}function s(e){return a["a"].get("/apps/".concat(e))}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["a"].post("/apps",e)}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/apps/".concat(e),t)}function c(e){return a["a"].delete("/apps/".concat(e))}function l(){return a["a"].get("/users")}function u(e){return a["a"].post("/users",e)}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/users/".concat(e),t)}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a["a"].put("/change_pwd/".concat(e),t)}function m(e){return a["a"].delete("/users/".concat(e))}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a["a"].get("/banned",{params:e})}function f(e){return a["a"].post("/banned",e)}function h(e){var t=e.who,r=e.as;return a["a"].delete("/banned/".concat(r,"/").concat(encodeURIComponent(t)))}},"872a1":function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"users"},[r("page-header",[r("div",{staticClass:"page-header-content-view"},[r("div",{staticClass:"content"},[e._v("\n "+e._s(e.$t("General.manageDashboardUsers"))+"\n ")])])]),r("div",{staticClass:"app-wrapper"},[r("a-card",{staticClass:"emq-list-card"},[r("div",{staticClass:"emq-table-header"},[r("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-plus"},on:{click:function(t){return e.showDialog("create")}}},[e._v("\n "+e._s(e.$t("Base.create"))+"\n ")])],1),r("el-table",{staticClass:"data-list",attrs:{data:e.tableData}},[r("el-table-column",{attrs:{"min-width":"120px",prop:"username",label:e.$t("General.userName")}}),r("el-table-column",{attrs:{"min-width":"60px",prop:"tags",label:e.$t("General.remark")}}),r("el-table-column",{attrs:{width:"120px"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[r("el-button",{attrs:{type:"dashed",size:"mini"},on:{click:function(t){return e.showDialog("edit",a)}}},[e._v(e._s(e.$t("General.edit"))+"\n ")]),"administrator"!==a.tags&&"admin"!==a.username?r("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(t){return e.deleteConfirm(a)}}},[e._v(e._s(e.$t("General.delete"))+"\n ")]):e._e()]}}])})],1)],1)],1),r("el-dialog",{attrs:{width:"520px",title:"edit"===e.accessType?e.$t("General.editorUser"):e.$t("General.creatingUser"),visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t},close:e.clearInput}},[r("el-form",{ref:"recordForm",attrs:{size:"small",model:e.record,rules:e.rules}},[r("el-form-item",{attrs:{prop:"username",label:e.$t("General.userName")}},[r("el-input",{attrs:{disabled:"edit"===e.accessType},model:{value:e.record.username,callback:function(t){e.$set(e.record,"username",t)},expression:"record.username"}})],1),r("el-form-item",{attrs:{prop:"tags",label:e.$t("General.remark")}},[r("el-input",{model:{value:e.record.tags,callback:function(t){e.$set(e.record,"tags",t)},expression:"record.tags"}})],1),"edit"!==e.accessType||e.allowChange?r("el-form-item",{attrs:{prop:"password",label:"edit"===e.accessType?e.$t("General.oldPassword"):e.$t("General.password")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.password,callback:function(t){e.$set(e.record,"password",t)},expression:"record.password"}})],1):e._e(),e.allowChange?r("el-form-item",{attrs:{prop:"newPassword",label:e.$t("General.newPassword")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.newPassword,callback:function(t){e.$set(e.record,"newPassword",t)},expression:"record.newPassword"}})],1):e._e(),e.allowChange?r("el-form-item",{attrs:{prop:"repeatPassword",label:e.$t("General.confirmPassword")}},[r("el-input",{attrs:{type:"password"},model:{value:e.record.repeatPassword,callback:function(t){e.$set(e.record,"repeatPassword",t)},expression:"record.repeatPassword"}})],1):e._e(),"edit"===e.accessType?r("el-link",{attrs:{underline:!1},on:{click:e.togglePassword}},[e._v("\n "+e._s(e.allowChange?e.$t("General.dontChangePassword"):e.$t("General.changePassword"))+"\n ")]):e._e()],1),r("div",{staticClass:"dialog-align-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{attrs:{plain:"",size:"small"},on:{click:e.closeDialog}},[e._v(e._s(e.$t("Base.cancel")))]),r("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.save}},[e._v(e._s(e.$t("Base.confirm")))])],1)],1)],1)},n=[],s=(r("96cf"),r("3b8d")),o=r("72db"),i={name:"Users",components:{},props:{},data:function(){var e=this,t=function(t,r,a){""===r?a(new Error(e.$t("General.pleaseEnterYourPasswordAgain"))):r!==e.record.newPassword?a(new Error(e.$t("General.confirmNotMatch"))):a()};return{dialogVisible:!1,tableData:[],accessType:"",allowChange:!1,record:{},rules:{username:[{required:!0,message:this.$t("General.enterOneUserName")}],tags:[{required:!0,message:this.$t("General.pleaseEnterNotes")}],password:[{required:!0,message:this.$t("General.pleaseEnterPassword"),trigger:["blur","change"]},{min:3,max:32,message:this.$t("General.passwordLength"),trigger:["blur","change"]}],newPassword:[{required:!0,message:this.$t("General.pleaseEnterNewPassword"),trigger:["blur","change"]},{min:3,max:32,message:this.$t("General.passwordLength"),trigger:["blur","change"]}],repeatPassword:[{required:!0,message:this.$t("General.pleaseEnterAConfirmationPassword")},{validator:t,trigger:["blur","change"]}]}}},created:function(){this.loadData()},methods:{clearInput:function(){this.$refs.recordForm&&this.$refs.recordForm.resetFields()},loadData:function(){var e=Object(s["a"])(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["j"])();case 2:this.tableData=e.sent;case 3:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),showDialog:function(e,t){this.record={username:"",tags:""},this.accessType="create","edit"===e&&(Object.assign(this.record,t),this.accessType="edit"),this.dialogVisible=!0},closeDialog:function(){this.dialogVisible=!1,this.allowChange=!1},togglePassword:function(){this.allowChange=!this.allowChange,this.allowChange||(this.record={tags:this.record.tags,username:this.record.username})},save:function(){var e=Object(s["a"])(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:t=this,this.$refs.recordForm.validate(function(e){if(!e)return!1;if("edit"===t.accessType){var r=t.record,a=r.username,n=r.password;Object(o["m"])(a,t.record).then(Object(s["a"])(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!t.allowChange){e.next=5;break}return r={new_pwd:t.record.newPassword,old_pwd:t.record.password},e.next=4,Object(o["a"])(a,r);case 4:t.$store.dispatch("UPDATE_USER_INFO",{username:a,password:n});case 5:t.$message.success(t.$t("General.editorialSuccess")),t.dialogVisible=!1,t.allowChange=!1,t.accessType="",t.record={},t.loadData();case 11:case"end":return e.stop()}},e)})))}else Object(o["d"])(t.record).then(function(){t.$message.success(t.$t("General.createUserSuccess")),t.dialogVisible=!1,t.accessType="",t.record={},t.loadData()})});case 2:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),deleteConfirm:function(e){var t=this,r=this;this.$msgbox.confirm(this.$t("General.confirmDeleteUser"),{confirmButtonText:this.$t("Base.confirm"),cancelButtonText:this.$t("Base.cancel"),type:"warning"}).then(Object(s["a"])(regeneratorRuntime.mark(function a(){return regeneratorRuntime.wrap(function(a){while(1)switch(a.prev=a.next){case 0:Object(o["g"])(e.username).then(function(){r.$message.success(t.$t("General.successfulDeletion")),r.loadData()});case 1:case"end":return a.stop()}},a)}))).catch(function(){})}}},c=i,l=r("2877"),u=Object(l["a"])(c,a,n,!1,null,null,null);t["default"]=u.exports}}]); |