You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
11 KiB
2 lines
11 KiB
6 years ago
|
webpackJsonp([33],{1017:function(e,t,s){"use strict";t.__esModule=!0;var n=l(s(30)),a=l(s(36)),i=l(s(92)),o=l(s(222)),r=l(s(223)),u=l(s(224));function l(e){return e&&e.__esModule?e:{default:e}}t.default={name:"create-user",data:function(){return{store:i.default,router:o.default,queueList:[],userName:"",userPassword:"",tenantId:{},queueName:{},email:"",phone:"",tenantList:[],isADMIN:"ADMIN_USER"===i.default.state.user.userInfo.userType&&"account"!==o.default.history.current.name}},props:{item:Object},methods:{_ok:function(){var e=this;if(this._verification()){if(this.item&&this.item.groupName===this.groupName)return void this._submit();this.store.dispatch("security/verifyName",{type:"user",userName:this.userName}).then(function(t){e._submit()}).catch(function(t){e.$message.error(t.msg||"")})}},_verification:function(){return this.userName?this.userPassword||this.item?this.email?/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(this.email)?!(this.phone&&!/^1(3|4|5|6|7|8)\d{9}$/.test(this.phone))||(this.$message.warning(""+a.default.$t("Please enter the correct mobile phone format")),!1):(this.$message.warning(""+a.default.$t("Please enter the correct email format")),!1):(this.$message.warning(""+a.default.$t("Please enter email")),!1):(this.$message.warning(""+a.default.$t("Please enter your password")),!1):(this.$message.warning(""+a.default.$t("Please enter user name")),!1)},_getQueueList:function(){var e=this;return new Promise(function(t,s){e.store.dispatch("security/getQueueList").then(function(s){e.queueList=n.default.map(s,function(e){return{id:e.id,code:e.queueName}}),e.$nextTick(function(){e.queueName=e.queueList[0]}),t()})})},_getTenantList:function(){var e=this;return new Promise(function(t,s){e.store.dispatch("security/getTenantList").then(function(s){e.tenantList=n.default.map(s,function(e){return{id:e.id,code:e.tenantName}}),e.$nextTick(function(){e.tenantId=e.tenantList[0]}),t()})})},_submit:function(){var e=this;this.$refs.popup.spinnerLoading=!0;var t={userName:this.userName,userPassword:this.userPassword,tenantId:this.tenantId.id,email:this.email,queue:this.queueName.code,phone:this.phone};this.item&&(t.id=this.item.id),this.store.dispatch("security/"+(this.item?"updateUser":"createUser"),t).then(function(s){setTimeout(function(){e.$refs.popup.spinnerLoading=!1},800),e.$emit("onUpdate",t),e.$message.success(s.msg)}).catch(function(t){e.$message.error(t.msg||""),e.$refs.popup.spinnerLoading=!1})}},watch:{},created:function(){var e=this;this.isADMIN?Promise.all([this._getQueueList(),this._getTenantList()]).then(function(){e.item&&(e.userName=e.item.userName,e.userPassword="",e.email=e.item.email,e.phone=e.item.phone,e.tenantId=n.default.find(e.tenantList,["id",e.item.tenantId]),e.$nextTick(function(){e.queueName=n.default.find(e.queueList,["code",e.item.queue])}))}):this.item&&(this.userName=this.item.userName,this.userPassword="",this.email=this.item.email,this.phone=this.item.phone,this.tenantId.id=this.item.tenantId,this.queueName={queue:this.item.queue})},mounted:function(){},components:{mPopup:r.default,mListBoxF:u.default}}},1062:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(1017),a=s.n(n);for(var i in n)"default"!==i&&function(e){s.d(t,e,function(){return n[e]})}(i);var o=s(1063),r=s(29)(a.a,o.a,!1,null,null,null);t.default=r.exports},1063:function(e,t,s){"use strict";var n={render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("m-popup",{ref:"popup",attrs:{"ok-text":e.item?e.$t("Edit"):e.$t("Submit"),nameText:e.item?e.$t("Edit User"):e.$t("Create User")},on:{ok:e._ok}},[s("template",{slot:"content"},[s("div",{staticClass:"create-user-model"},[s("m-list-box-f",[s("template",{slot:"name"},[s("b",[e._v("*")]),e._v(e._s(e.$t("User Name")))]),e._v(" "),s("template",{slot:"content"},[s("x-input",{attrs:{type:"input",placeholder:e.$t("Please enter user name")},model:{value:e.userName,callback:function(t){e.userName=t},expression:"userName"}})],1)],2),e._v(" "),"account"!==e.router.history.current.n
|
||
|
//# sourceMappingURL=33.d41356b.js.map
|