1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
|
"use strict";(self["webpackChunkwx_manage"]=self["webpackChunkwx_manage"]||[]).push([[809,4348],{24348:function(e,t,a){a.r(t),a.d(t,{default:function(){return m}});var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-dialog",{attrs:{title:e.dataForm.id?"修改":"新增","close-on-click-modal":!1,visible:e.visible},on:{"update:visible":function(t){e.visible=t}}},[a("el-form",{ref:"dataForm",attrs:{model:e.dataForm,rules:e.dataRule,"label-width":"80px"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.dataFormSubmit()}}},[e.dataForm.id?e._e():a("el-form-item",{attrs:{label:"身份码",prop:"userId"}},[a("el-input",{attrs:{placeholder:"登录帐号"},model:{value:e.dataForm.userId,callback:function(t){e.$set(e.dataForm,"userId",t)},expression:"dataForm.userId"}})],1),a("el-form-item",{attrs:{label:"用户名"}},[a("el-input",{attrs:{placeholder:"用户名"},model:{value:e.dataForm.userName,callback:function(t){e.$set(e.dataForm,"userName",t)},expression:"dataForm.userName"}})],1),e.dataForm.id?e._e():a("el-form-item",{attrs:{label:"身份"}},[a("el-select",{attrs:{placeholder:"身份"},model:{value:e.dataForm.identity,callback:function(t){e.$set(e.dataForm,"identity",t)},expression:"dataForm.identity"}},e._l(e.identityes,(function(e){return a("el-option",{key:e.id,attrs:{value:e.value,label:e.name}})})),1)],1),a("el-form-item",{attrs:{label:"所属组"}},[a("el-select",{attrs:{placeholder:"所属组"},model:{value:e.dataForm.groupId,callback:function(t){e.$set(e.dataForm,"groupId",t)},expression:"dataForm.groupId"}},e._l(e.groupIdes,(function(t){return a("el-option",{key:t.id,attrs:{value:t.id,label:t.name}},[e._v(e._s(t.name))])})),1)],1),a("el-form-item",{attrs:{label:"状态",size:"mini",prop:"status"}},[a("el-radio-group",{model:{value:e.dataForm.status,callback:function(t){e.$set(e.dataForm,"status",t)},expression:"dataForm.status"}},[a("el-radio",{attrs:{label:0}},[e._v("禁用")]),a("el-radio",{attrs:{label:1}},[e._v("正常")])],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.visible=!1}}},[e._v("取消")]),a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.dataFormSubmit()}}},[e._v("确定")])],1)],1)},s=[],i=a(89176),n=a(62015),o={data(){var e=(e,t,a)=>{(0,i._7)(t)?a():a(new Error("请输入8位身份码(数字)"))},t=(e,t,a)=>{this.dataForm.id||/\S/.test(t)?a():a(new Error("密码不能为空"))};return{visible:!1,roleList:[],dataForm:{id:0,userName:"",groupId:"",identity:"",userId:"",status:0},identityes:[{id:1,name:"管理员",value:2},{id:2,name:"研究生",value:3},{id:3,name:"本校老师",value:6},{id:4,name:"外校老师",value:9}],groupIdes:[],dataRule:{userName:[{required:!0,message:"用户名不能为空",trigger:"blur"}],password:[{validator:t,trigger:"blur"}],userId:[{required:!0,message:"身份码不能为空",trigger:"blur"},{validator:e,trigger:"blur"}]}}},methods:{init(e){n.Z.getGroupList2(this).then((e=>{this.groupIdes=e.data.list})),void 0==e&&(this.dataForm.userId="",this.dataForm.userName="",this.dataForm.groupId="",this.dataForm.identity="",this.dataForm.status=0),this.dataForm.id=e||0,this.$http({url:this.$http.adornUrl("/sys/role/select"),method:"get",params:this.$http.adornParams()}).then((({data:e})=>{this.roleList=e&&200===e.code?e.list:[]})).then((()=>{this.visible=!0,this.$nextTick((()=>{this.$refs["dataForm"].resetFields()}))})).then((()=>{this.dataForm.id&&(console.log("this.dataForm.id",this.dataForm.id),this.$http({url:this.$http.adornUrl(`/h5/user/info/${this.dataForm.id}`),method:"get",params:this.$http.adornParams()}).then((({data:e})=>{console.log(e),e&&200===e.code&&(this.dataForm.userName=e.user.userName,this.dataForm.groupId=e.user.groupId,this.dataForm.identity=e.user.identity,this.dataForm.userId=e.user.userId,this.dataForm.status=e.user.status)})))}))},dataFormSubmit(){this.$refs["dataForm"].validate((e=>{e&&this.$http({url:this.$http.adornUrl("/h5/user/"+(this.dataForm.id?"update":"save")),method:
|