diff --git a/src/pages/authority/addroles.vue b/src/pages/authority/addroles.vue
index bf42119cb39d6c30cc182c1256214d6754aaba18..739b8521de9e673ff0d2d1f08e49d11ee05428cb 100644
--- a/src/pages/authority/addroles.vue
+++ b/src/pages/authority/addroles.vue
@@ -280,17 +280,13 @@ export default {
{ max: 200, message: "长度小于200个字符", trigger: "blur" },
],
},
+ edit_flag:0,
};
},
watch: {},
computed: {},
created() {
- this.now_user = this.$store.state.role;
- getRole().then((data) => {
- this.now_user = data;
- this.$store.commit("rolefun", data);
- this.now_page();
- });
+ this.get_now_page()
console.log(this.$route);
},
mounted() {},
@@ -306,16 +302,31 @@ export default {
}
});
},
- now_page() {
- if (this.$route.path.indexOf("edit") !== -1) {
- this.getInfo();
- }
- if (this.$route.path.indexOf("allot") !== -1) {
- this.getInfo();
- }
+ get_now_page(){
+ console.log(this.$route);
+ if(this.$route.path.indexOf('add')!==-1){
+ this.edit_flag = 0
+ }
+ if(this.$route.path.indexOf('edit')!==-1){
+ this.edit_flag = 1
+ this.getInfo()
+ }
+ if(this.$route.path.indexOf('detail')!==-1){
+ this.edit_flag = 2
+ this.getInfo()
+ }
},
getInfo() {
- console.log("111");
+ this.$http
+ .get(`/apaas/backmgt/role/id/${this.$route.params.id}`)
+ .then(response => {
+ console.log(response);
+ let data = response.data.data
+
+ })
+ .catch((response)=> {
+
+ });
},
changePermissions(values) {
console.log(values);
diff --git a/src/pages/authority/organizationuser.vue b/src/pages/authority/organizationuser.vue
index d702b81a925acede473816a52811c4ee4a3689c2..8d5ad96687674dcd05e9e6344e05d4cfe30e3397 100644
--- a/src/pages/authority/organizationuser.vue
+++ b/src/pages/authority/organizationuser.vue
@@ -10,9 +10,10 @@
用户账号:
-
+
登录密码:
-
+
+ 修改密码
昵称:
@@ -33,11 +34,11 @@
业务系统名称:
-
+
域名:
-
+
IP白名单:
@@ -58,7 +59,7 @@
@@ -69,7 +70,7 @@
@@ -94,7 +95,7 @@
重置
保存
- 取消
+ 取消
@@ -113,6 +114,16 @@ export default {
uploadFile,
},
data() {
+ var checkip = (rule, value, callback) => {
+ var reg = /(((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3});/g
+ setTimeout(() => {
+ if (!reg.test(value)) {
+ callback(new Error('请使用;隔开ip地址'));
+ } else {
+ callback();
+ }
+ }, 1000);
+ };
return {
form: {
account:'',
@@ -128,27 +139,26 @@ export default {
desc:'',
person:'',
date:'',
+ ip:'',
+ domain:''
},
- open:true,
- open1:false,
- open2:'true',
now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员
typeoptions:[
{
label:'普通用户',
- value:0,
+ value:3,
},
{
label:'组织管理员',
- value:1,
+ value:2,
},
{
label:'超级管理员',
- value:2,
+ value:1,
},
{
label:'开发者',
- value:3,
+ value:4,
}
],
originoptions:[
@@ -168,11 +178,11 @@ export default {
ableoptions:[
{
label:'是',
- value:1,
+ value:0,
},
{
label:'否',
- value:0,
+ value:1,
},
],
origin_arr:[],
@@ -180,38 +190,95 @@ export default {
able:[
{ required: true, message: '请选择是否禁用', trigger: 'change' }
],
- domain:[
- { required: true, message: '请输入域名', trigger: 'blur' }
- ],
+ // domain:[
+ // { required: true, message: '请输入域名', trigger: 'blur' }
+ // ],
ip:[
- { required: true, message: '请输入ip地址', trigger: 'blur' }
+ // { required: true, message: '请输入ip地址', trigger: 'blur' }
],
-
-
- }
+ },
+ edit_flag:0,
};
},
watch: {},
computed: {},
created() {
- this.now_user = this.$store.state.role
- getRole().then(data => {
- this.now_user = data;
- this.now_user = 0;
- console.log(data);
- this.$store.commit('rolefun',data)
- this.getOriginArr()
- });
- console.log(this.$route);
+ this.getOriginArr()
+ this.get_now_page()
},
mounted() {},
methods: {
+ get_now_page(){
+ console.log(this.$route);
+ if(this.$route.path.indexOf('add')!==-1){
+ this.edit_flag = 0
+ }
+ if(this.$route.path.indexOf('edit')!==-1){
+ this.edit_flag = 1
+ this.get_user()
+ }
+ if(this.$route.path.indexOf('detail')!==-1){
+ this.edit_flag = 2
+ this.get_user()
+ }
+ },
+ tranform_flag(val){
+ return val?true:false
+ },
+ change_pass(){
+ this.$http
+ .put(`/apaas/backmgt/user/initalPasswd/${this.$route.params.id}`)
+ .then(response => {
+ console.log(response);
+ this.$message.success('修改成默认密码成功 默认密码:123456')
+ })
+ .catch((response)=> {
+
+ });
+ },
+ get_user(){
+ this.$http
+ .get(`/apaas/backmgt/user/detail/${this.$route.params.id}`)
+ .then(response => {
+ console.log(response);
+ let data = response.data.data
+ this.form={
+ account:data.user_id,
+ password:'******',
+ nickname:data.user_name,
+ type:data.is_admin,
+ systemname:data.system_name,
+ contact:data.link_man,
+ phone:data.phone,
+ email:data.email,
+ origin:data.department_id,
+ able:data.state,
+ desc:data.description,
+ person:data.create_user,
+ date:data.create_date,
+ ip:data.ip_whitelist.map((v,k)=>{
+ return v
+ }).join(';'),
+ domain:data.domain_name
+ }
+ })
+ .catch((response)=> {
+
+ });
+ },
getOriginArr(){
+ this.originoptions = []
this.$http
- .get('/static/serviceedit.json')
+ .get('/apaas/backmgt/department/list')
.then(response => {
let data = response.data.data
- this.origin_arr = data.origin_arr
+ // this.originoptions = data
+ data.forEach(e => {
+ this.originoptions.push({
+ label:e.department_name,
+ value:e.department_id
+ })
+ });
})
.catch(function(response) {
@@ -219,26 +286,78 @@ export default {
},
removepic(){
this.$refs.servicepic.handleRemove()
+ },
+ backPage(){
+ this.$router.back(-1)
+ },
+ add_user(){
+ var temp = {
+ "user_id":this.form.account, // 用户名
+ "user_name":this.form.nickname, // 昵称
+ "system_name":this.form.systemname,//系统名称
+ "phone":this.form.phone, // 电话号
+ "email":this.form.email, // 邮箱
+ "department_id":this.form.origin, // 组织id
+ "is_admin":this.form.type,
+ "state":this.form.able, // 用户状态,1——启用,0 禁用
+ "domain_name":this.form.domain,//
+ "ip_whitelist":this.form.ip.split(';'),//
+ "description":this.form.desc, //描述
+ "link_man":this.form.contact
+ }
+ this.$http
+ .post(`/apaas/backmgt/user/register`,temp)
+ .then(response => {
+ console.log(response);
+ this.backPage()
+ this.$message.success('新增成功')
+ })
+ .catch((response)=> {
+ this.$message.success('新增失败')
+ });
+ },
+ set_user(){
+ var temp = {
+ "user_id":this.form.account, // 用户名
+ "user_name":this.form.nickname, // 昵称
+ "system_name":this.form.systemname,//系统名称
+ "phone":this.form.phone, // 电话号
+ "email":this.form.email, // 邮箱
+ "department_id":this.form.origin, // 组织id
+ "is_admin":this.form.type,
+ "state":this.form.able, // 用户状态,1——启用,0 禁用
+ "domain_name":this.form.domain,//
+ "ip_whitelist":this.form.ip.split(';'),//
+ "description":this.form.desc, //描述
+ "link_man":this.form.contact
+ }
+ this.$http
+ .put(`/apaas/backmgt/user/put`,temp)
+ .then(response => {
+ console.log(response);
+ this.backPage()
+ this.$message.success('修改成功')
+ })
+ .catch((response)=> {
+ this.$message.success('修改失败')
+ });
},
onSubmit(formName) {
console.log('submit!');
this.$refs[formName].validate((valid) => {
if (valid) {
- alert('submit!');
+ if(this.edit_flag == 0){
+ this.add_user()
+ }else{
+ this.set_user()
+ }
+
} else {
console.log('error submit!!');
return false;
}
});
},
- getNewList(val) {
- console.log(val);
- this.form.fileList = ""
- this.form.fileList = url.map((v,k)=>{
- return v.url
- }).join(';')
- console.log(this.form.fileList)
- },
resetForm(formName) {
this.$refs[formName].resetFields();
}
@@ -252,6 +371,13 @@ export default {
background-color: #f7f8f9;
width: 1022px;
}
+.shortpass .el-input__inner{
+ background-color: #f7f8f9;
+ width: 888px;
+}
+.shortpass .el-input{
+ width: 888px;
+}
.info_contain .el-textarea__inner{
background-color: #f7f8f9;
width: 1022px;
@@ -401,4 +527,17 @@ export default {
position: absolute;
right: 0;
}
+.fixpass{
+ width: 124px;
+ height: 44px;
+ line-height: 44px;
+ text-align: center;
+ font-size: 16px;
+ color: #fff;
+ background-color: #495feb;
+ border-radius: 8px;
+ display: inline-block;
+ margin-left: 5px;
+ cursor: pointer;
+}