Commit 35440dce authored by 徐一鸣's avatar 徐一鸣

权限管理fixed

parent 56464e59
...@@ -17,12 +17,16 @@ ...@@ -17,12 +17,16 @@
<el-form ref="form" :rules="rules" :model="form" label-width="0px"> <el-form ref="form" :rules="rules" :model="form" label-width="0px">
<el-form-item prop="name"> <el-form-item prop="name">
<p class="formname">角色名称:</p> <p class="formname">角色名称:</p>
<el-input v-model="form.name" :disabled="edit_flag==3"></el-input> <el-input v-model="form.name" :disabled="edit_flag == 3"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="desc"> <el-form-item prop="desc">
<p class="formname">角色描述:</p> <p class="formname">角色描述:</p>
<el-input type="textarea" v-model="form.desc" :disabled="edit_flag==3"></el-input> <el-input
type="textarea"
v-model="form.desc"
:disabled="edit_flag == 3"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="person"> <el-form-item prop="person">
...@@ -60,7 +64,7 @@ ...@@ -60,7 +64,7 @@
</template> </template>
<script> <script>
import { getRole } from "@/utils/common"; import { getRolegetRole, formatDateTime_date } from "@/utils/common";
import menuPermission from "@/components/menu-permission"; import menuPermission from "@/components/menu-permission";
export default { export default {
props: {}, props: {},
...@@ -72,8 +76,8 @@ export default { ...@@ -72,8 +76,8 @@ export default {
form: { form: {
name: "", name: "",
desc: "", desc: "",
person: "", person: this.$store.state.userInfo.user_name,
date: "", date: formatDateTime_date(new Date()),
}, },
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员 now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
permissionData: [], permissionData: [],
...@@ -84,15 +88,15 @@ export default { ...@@ -84,15 +88,15 @@ export default {
{ max: 200, message: "长度小于200个字符", trigger: "blur" }, { max: 200, message: "长度小于200个字符", trigger: "blur" },
], ],
}, },
edit_flag:0, edit_flag: 0,
service_node:[], service_node: [],
permission_arr:[] permission_arr: [],
}; };
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() { created() {
this.get_now_page() this.get_now_page();
console.log(this.$route); console.log(this.$route);
}, },
mounted() {}, mounted() {},
...@@ -100,26 +104,28 @@ export default { ...@@ -100,26 +104,28 @@ export default {
onSubmit(formName) { onSubmit(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if(this.edit_flag == 0){ if (this.edit_flag == 0) {
this.add_role() this.add_role();
}else if(this.edit_flag == 1){ } else if (this.edit_flag == 1) {
this.set_role() this.set_role();
}else if(this.edit_flag == 3){ } else if (this.edit_flag == 3) {
this.deal_node(this.permissionData,this.permission_arr) this.deal_node(this.permissionData, this.permission_arr);
console.log(this.permission_arr,this.service_node); console.log(this.permission_arr, this.service_node);
var temp = this.compare_arr(this.permission_arr,this.service_node) var temp = this.compare_arr(this.permission_arr, this.service_node);
var temp_arr = [] var temp_arr = [];
if(temp[0].length){ if (temp[0].length) {
temp_arr.push(this.add_node(temp[0])) temp_arr.push(this.add_node(temp[0]));
} }
temp[1].forEach(e => { temp[1].forEach((e) => {
temp_arr.push(this.delete_node(e)) temp_arr.push(this.delete_node(e));
}); });
Promise.all(temp_arr).then((result) => { Promise.all(temp_arr)
this.get_now_page() .then((result) => {
}).catch((error) => { this.get_now_page();
console.log(error) })
}) .catch((error) => {
console.log(error);
});
} }
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
...@@ -127,187 +133,185 @@ export default { ...@@ -127,187 +133,185 @@ export default {
} }
}); });
}, },
get_now_page(){ get_now_page() {
console.log(this.$route); console.log(this.$route);
if(this.$route.path.indexOf('add')!==-1){ if (this.$route.path.indexOf("add") !== -1) {
this.edit_flag = 0 this.edit_flag = 0;
} }
if(this.$route.path.indexOf('edit')!==-1){ if (this.$route.path.indexOf("edit") !== -1) {
this.edit_flag = 1 this.edit_flag = 1;
this.getInfo() this.getInfo();
} }
if(this.$route.path.indexOf('detail')!==-1){ if (this.$route.path.indexOf("detail") !== -1) {
this.edit_flag = 2 this.edit_flag = 2;
this.getInfo() this.getInfo();
} }
if(this.$route.path.indexOf('allot')!==-1){ if (this.$route.path.indexOf("allot") !== -1) {
this.edit_flag = 3 this.edit_flag = 3;
this.getInfo() this.getInfo();
Promise.all([this.get_tree(), this.get_use_tree()]).then((result) => { Promise.all([this.get_tree(), this.get_use_tree()])
console.log(result) .then((result) => {
this.permissionData = result[0].data.data console.log(result);
this.service_node = result[1].data.data this.permissionData = result[0].data.data;
this.permission_arr = [] this.service_node = result[1].data.data;
this.deal_tree_data(result[0].data.data,result[1].data.data) this.permission_arr = [];
}).catch((error) => { this.deal_tree_data(result[0].data.data, result[1].data.data);
console.log(error) })
}) .catch((error) => {
} console.log(error);
});
}
}, },
backPage(){ backPage() {
this.$router.back(-1) this.$router.back(-1);
}, },
add_role(){ add_role() {
var temp = { var temp = {
"role_name":this.form.name, role_name: this.form.name,
"detail":this.form.desc detail: this.form.desc,
} };
this.$http this.$http
.post(`/apaas/backmgt/role`,temp) .post(`/apaas/backmgt/role`, temp)
.then(response => { .then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
if(response.data.success){ if (response.data.success) {
this.$message.success('新增成功') this.$message.success("新增成功");
this.backPage() this.backPage();
}else{ } else {
this.$message.error('新增失败') this.$message.error("新增失败");
} }
})
}) .catch((response) => {
.catch((response)=> { this.$message.error("新增失败");
this.$message.error('新增失败') });
});
}, },
set_role(){ set_role() {
var temp = { var temp = {
"role_id":this.$route.params.id, role_id: this.$route.params.id,
"role_name":this.form.name, role_name: this.form.name,
"detail":this.form.desc detail: this.form.desc,
} };
this.$http this.$http
.put(`/apaas/backmgt/role`,temp) .put(`/apaas/backmgt/role`, temp)
.then(response => { .then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
if(response.data.success){ if (response.data.success) {
this.$message.success('修改成功') this.$message.success("修改成功");
this.backPage() this.backPage();
}else{ } else {
this.$message.error('修改失败') this.$message.error("修改失败");
} }
}) })
.catch((response)=> { .catch((response) => {
this.$message.error('修改失败') this.$message.error("修改失败");
}); });
}, },
delete_node(val){ delete_node(val) {
return this.$http return this.$http
.post(`/apaas/backmgt/role/menuDel`,{ .post(`/apaas/backmgt/role/menuDel`, {
"role_id":this.$route.params.id, role_id: this.$route.params.id,
"menu_id":val menu_id: val,
}) })
.then(response => { .then((response) => {
if(response.data.success){ if (response.data.success) {
this.$message.success('删除分配菜单成功') this.$message.success("删除分配菜单成功");
}else{ } else {
this.$message.error('删除分配菜单失败') this.$message.error("删除分配菜单失败");
} }
}) })
.catch((response)=> { .catch((response) => {
this.$message.error('删除分配菜单失败') this.$message.error("删除分配菜单失败");
}); });
}, },
add_node(arr){ add_node(arr) {
return this.$http return this.$http
.post(`/apaas/backmgt/role/menuAdd`,{ .post(`/apaas/backmgt/role/menuAdd`, {
"role_id":this.$route.params.id, role_id: this.$route.params.id,
"menu_id":arr menu_id: arr,
}) })
.then(response => { .then((response) => {
if(response.data.success){ if (response.data.success) {
this.$message.success('分配菜单成功') this.$message.success("分配菜单成功");
}else{ } else {
this.$message.error('分配菜单失败') this.$message.error("分配菜单失败");
} }
}) })
.catch((response)=> { .catch((response) => {
this.$message.error('分配菜单失败') this.$message.error("分配菜单失败");
}); });
}, },
deal_node(data,data1){ deal_node(data, data1) {
data.forEach(e => { data.forEach((e) => {
if(e.selected){ if (e.selected) {
data1.push(e.menu_id) data1.push(e.menu_id);
} }
if(e.Child){ if (e.Child) {
this.deal_node(e.Child,data1) this.deal_node(e.Child, data1);
} }
}); });
}, },
compare_arr(arr1,arr2){ compare_arr(arr1, arr2) {
var nowtemp = {} var nowtemp = {};
var oldtemp = {} var oldtemp = {};
var increase = [] var increase = [];
var reduce = [] var reduce = [];
arr1.forEach(e => { arr1.forEach((e) => {
nowtemp[e] = e nowtemp[e] = e;
}); });
arr2.forEach(e => { arr2.forEach((e) => {
oldtemp[e.menu_id] = e.menu_id oldtemp[e.menu_id] = e.menu_id;
}); });
for (const key in nowtemp) { for (const key in nowtemp) {
if (!oldtemp.hasOwnProperty(key)) { if (!oldtemp.hasOwnProperty(key)) {
increase.push(key) increase.push(key);
} }
} }
for (const key in oldtemp) { for (const key in oldtemp) {
if (!nowtemp.hasOwnProperty(key)) { if (!nowtemp.hasOwnProperty(key)) {
reduce.push(key) reduce.push(key);
} }
} }
return [increase,reduce] return [increase, reduce];
}, },
getInfo() { getInfo() {
this.$http this.$http
.get(`/apaas/backmgt/role/id/${this.$route.params.id}`) .get(`/apaas/backmgt/role/id/${this.$route.params.id}`)
.then(response => { .then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
this.form={ this.form = {
name: data.role_name, name: data.role_name,
desc: data.detail, desc: data.detail,
person: data.create_user, person: data.create_user,
date: data.create_date, date: data.create_date,
} };
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
get_tree() { get_tree() {
return this.$http return this.$http.get(`/apaas/backmgt/menu/list`);
.get(`/apaas/backmgt/menu/list`)
}, },
get_use_tree() { get_use_tree() {
return this.$http return this.$http.get(
.get(`/apaas/backmgt/role/menu/id/${this.$route.params.id}`) `/apaas/backmgt/role/menu/id/${this.$route.params.id}`
);
}, },
deal_tree_data(data1,data2){ deal_tree_data(data1, data2) {
var temp = {} var temp = {};
data2.forEach(e => { data2.forEach((e) => {
temp[e.menu_id] = e.menu_id temp[e.menu_id] = e.menu_id;
}); });
this.merge_data(data1,temp) this.merge_data(data1, temp);
}, },
merge_data(data,temp){ merge_data(data, temp) {
data.forEach(e => { data.forEach((e) => {
if(temp[e.menu_id]){ if (temp[e.menu_id]) {
e.selected = true e.selected = true;
} }
if(e.Child){ if (e.Child) {
this.merge_data(e.Child,temp) this.merge_data(e.Child, temp);
} }
}); });
}, },
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<script> <script>
import uploadFile from "@/components/upload_file"; import uploadFile from "@/components/upload_file";
import { getRole } from "@/utils/common"; import { getRole, formatDateTime_date } from "@/utils/common";
export default { export default {
props: {}, props: {},
components: { components: {
...@@ -162,17 +162,12 @@ export default { ...@@ -162,17 +162,12 @@ export default {
} }
}, },
get_now_user() { get_now_user() {
this.$http let userName = this.$store.state.userInfo.user_name;
.get(`/apaas/backmgt/user/getCurrentUser`)
.then((response) => { this.form = {
console.log(response); person: userName,
let data = response.data.data; date: formatDateTime_date(new Date()),
this.form = { };
person: data.user_name,
date: data.create_date.replace("T", " ").replace("Z", " "),
};
})
.catch((response) => {});
}, },
get_user() { get_user() {
this.$http this.$http
......
<template> <template>
<div class="detail_contain"> <div class="detail_contain">
<p class="now_page_title"> <p class="now_page_title">
{{$route.name =='organizationuser'?'权限管理 / 组织管理 / 组织详情 /':'权限管理 / 用户管理 /' }} {{
<span>{{$route.name =='organizationuser'?'用户管理':$route.name =='usersadd'?'新增用户':'用户详情'}}</span> $route.name == "organizationuser"
? "权限管理 / 组织管理 / 组织详情 /"
: "权限管理 / 用户管理 /"
}}
<span>{{
$route.name == "organizationuser"
? "用户管理"
: $route.name == "usersadd"
? "新增用户"
: "用户详情"
}}</span>
</p> </p>
<div class="info_contain"> <div class="info_contain">
<el-form ref="form" :rules="rules" :model="form" label-width="0px"> <el-form ref="form" :rules="rules" :model="form" label-width="0px">
...@@ -10,10 +20,15 @@ ...@@ -10,10 +20,15 @@
<p class="formname">用户账号:</p> <p class="formname">用户账号:</p>
<el-input v-model="form.account"></el-input> <el-input v-model="form.account"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password" :class="{'shortpass':edit_flag}"> <el-form-item prop="password" :class="{ shortpass: edit_flag }">
<p class="formname">登录密码:</p> <p class="formname">登录密码:</p>
<el-input v-model="form.password" :disabled="tranform_flag(edit_flag)"></el-input> <el-input
<div v-if="edit_flag" class="fixpass" @click="change_pass()">修改密码</div> v-model="form.password"
:disabled="tranform_flag(edit_flag)"
></el-input>
<div v-if="edit_flag" class="fixpass" @click="change_pass()">
修改密码
</div>
</el-form-item> </el-form-item>
<el-form-item prop="nickname"> <el-form-item prop="nickname">
<p class="formname">昵称:</p> <p class="formname">昵称:</p>
...@@ -23,10 +38,11 @@ ...@@ -23,10 +38,11 @@
<p class="formname">用户类型:</p> <p class="formname">用户类型:</p>
<el-select v-model="form.type" placeholder="请选择"> <el-select v-model="form.type" placeholder="请选择">
<el-option <el-option
v-for="item in typeoptions" v-for="item in typeoptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -58,10 +74,11 @@ ...@@ -58,10 +74,11 @@
<p class="formname">用户组织机构:</p> <p class="formname">用户组织机构:</p>
<el-select v-model="form.origin" placeholder="请选择"> <el-select v-model="form.origin" placeholder="请选择">
<el-option <el-option
v-for="item in originoptions" v-for="item in originoptions"
:key="item.value+100" :key="item.value + 100"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -69,10 +86,11 @@ ...@@ -69,10 +86,11 @@
<p class="formname">是否禁用:</p> <p class="formname">是否禁用:</p>
<el-select v-model="form.able" placeholder="请选择"> <el-select v-model="form.able" placeholder="请选择">
<el-option <el-option
v-for="item in ableoptions" v-for="item in ableoptions"
:key="item.value+200" :key="item.value + 200"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -91,23 +109,27 @@ ...@@ -91,23 +109,27 @@
<p class="formname">登记日期:</p> <p class="formname">登记日期:</p>
<el-input v-model="form.date" disabled></el-input> <el-input v-model="form.date" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="resetForm('form')" class="left" v-if="$route.name =='usersadd'">重置</el-button> <el-button
<el-button type="primary" @click="onSubmit('form')" class="right">保存</el-button> @click="resetForm('form')"
class="left"
v-if="$route.name == 'usersadd'"
>重置</el-button
>
<el-button type="primary" @click="onSubmit('form')" class="right"
>保存</el-button
>
<el-button class="right" @click="backPage">取消</el-button> <el-button class="right" @click="backPage">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import uploadFile from '@/components/upload_file' import uploadFile from "@/components/upload_file";
import { getRole } from "@/utils/common"; import { getRole, formatDateTime_date } from "@/utils/common";
export default { export default {
props: {}, props: {},
components: { components: {
...@@ -115,288 +137,267 @@ export default { ...@@ -115,288 +137,267 @@ export default {
}, },
data() { data() {
var checkip = (rule, value, callback) => { 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 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(() => { setTimeout(() => {
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error('请使用;隔开ip地址')); callback(new Error("请使用;隔开ip地址"));
} else { } else {
callback(); callback();
} }
}, 1000); }, 1000);
}; };
return { return {
form: { form: {
account:'', account: "",
password:'', password: "",
nickname:'', nickname: "",
type:'', type: "",
systemname:'', systemname: "",
contact:'', contact: "",
phone:'', phone: "",
email:'', email: "",
origin:'', origin: "",
able:'', able: "",
desc:'', desc: "",
person:'', person: this.$store.state.userInfo.user_name,
date:'', date: formatDateTime_date(new Date()),
ip:'', ip: "",
domain:'' domain: "",
},
now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员
typeoptions: [
{
label: "普通用户",
value: 3,
}, },
now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员 {
typeoptions:[ label: "组织管理员",
{ value: 2,
label:'普通用户', },
value:3, {
}, label: "超级管理员",
{ value: 1,
label:'组织管理员', },
value:2, {
}, label: "开发者",
{ value: 4,
label:'超级管理员', },
value:1, ],
}, originoptions: [],
{ ableoptions: [
label:'开发者', {
value:4, label: "",
} value: 0,
], },
originoptions:[ {
{ label: "",
label:'贵阳水利局', value: 1,
value:0, },
}, ],
{ origin_arr: [],
label:'云上贵州', rules: {
value:1, able: [
}, { required: true, message: "请选择是否禁用", trigger: "change" },
{
label:'迪艾斯',
value:2,
},
], ],
ableoptions:[ // domain:[
{ // { required: true, message: '请输入域名', trigger: 'blur' }
label:'', // ],
value:0, ip: [
}, // { required: true, message: '请输入ip地址', trigger: 'blur' }
{
label:'',
value:1,
},
], ],
origin_arr:[], },
rules:{ edit_flag: 0,
able:[
{ required: true, message: '请选择是否禁用', trigger: 'change' }
],
// domain:[
// { required: true, message: '请输入域名', trigger: 'blur' }
// ],
ip:[
// { required: true, message: '请输入ip地址', trigger: 'blur' }
],
},
edit_flag:0,
}; };
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() { created() {
this.getOriginArr() this.getOriginArr();
this.get_now_page() this.get_now_page();
}, },
mounted() {}, mounted() {},
methods: { methods: {
get_now_page(){ get_now_page() {
console.log(this.$route); console.log(this.$route);
if(this.$route.path.indexOf('add')!==-1){ if (this.$route.path.indexOf("add") !== -1) {
this.edit_flag = 0 this.edit_flag = 0;
} }
if(this.$route.path.indexOf('edit')!==-1){ if (this.$route.path.indexOf("edit") !== -1) {
this.edit_flag = 1 this.edit_flag = 1;
this.get_user() this.get_user();
} }
if(this.$route.path.indexOf('detail')!==-1){ if (this.$route.path.indexOf("detail") !== -1) {
this.edit_flag = 2 this.edit_flag = 2;
this.get_user() this.get_user();
} }
}, },
tranform_flag(val){ tranform_flag(val) {
return val?true:false return val ? true : false;
}, },
change_pass(){ change_pass() {
this.$http this.$http
.put(`/apaas/backmgt/user/initalPasswd/${this.$route.params.id}`) .put(`/apaas/backmgt/user/initalPasswd/${this.$route.params.id}`)
.then(response => { .then((response) => {
console.log(response); console.log(response);
this.$message.success('修改成默认密码成功 默认密码:123456') this.$message.success("修改成默认密码成功 默认密码:123456");
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
get_user(){ get_user() {
this.$http this.$http
.get(`/apaas/backmgt/user/detail/${this.$route.params.id}`) .get(`/apaas/backmgt/user/detail/${this.$route.params.id}`)
.then(response => { .then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
this.form={ this.form = {
account:data.user_id, account: data.user_id,
password:'******', password: "******",
nickname:data.user_name, nickname: data.user_name,
type:data.is_admin, type: data.is_admin,
systemname:data.system_name, systemname: data.system_name,
contact:data.link_man, contact: data.link_man,
phone:data.phone+'', phone: data.phone + "",
email:data.email, email: data.email,
origin:data.department_id, origin: data.department_id,
able:data.state, able: data.state,
desc:data.description, desc: data.description,
person:data.create_user, person: data.create_user,
date:data.create_date, date: data.create_date,
ip:this.transform_func(data.ip_whitelist), ip: this.transform_func(data.ip_whitelist),
domain:data.domain_name domain: data.domain_name,
} };
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
transform_func(arr){ transform_func(arr) {
var temp = '' var temp = "";
arr.forEach(e => { arr.forEach((e) => {
temp = temp + e + ';' temp = temp + e + ";";
}); });
return temp return temp;
}, },
getOriginArr(){ getOriginArr() {
this.originoptions = [] this.originoptions = [];
this.$http this.$http
.get('/apaas/backmgt/department/list') .get("/apaas/backmgt/department/list")
.then(response => { .then((response) => {
let data = response.data.data let data = response.data.data;
// this.originoptions = data // this.originoptions = data
data.forEach(e => { data.forEach((e) => {
this.originoptions.push({ this.originoptions.push({
label:e.department_name, label: e.department_name,
value:e.department_id value: e.department_id,
})
});
})
.catch(function(response) {
}); });
});
})
.catch(function(response) {});
}, },
removepic(){ removepic() {
this.$refs.servicepic.handleRemove() this.$refs.servicepic.handleRemove();
}, },
backPage(){ backPage() {
this.$router.back(-1) this.$router.back(-1);
}, },
add_user(){ add_user() {
var temp = { var temp = {
"user_id":this.form.account, // 用户名 user_id: this.form.account, // 用户名
"user_name":this.form.nickname, // 昵称 user_name: this.form.nickname, // 昵称
"system_name":this.form.systemname,//系统名称 system_name: this.form.systemname, //系统名称
"phone":this.form.phone+'', // 电话号 phone: this.form.phone + "", // 电话号
"email":this.form.email, // 邮箱 email: this.form.email, // 邮箱
"department_id":this.form.origin, // 组织id department_id: this.form.origin, // 组织id
"is_admin":this.form.type, is_admin: this.form.type,
"state":this.form.able, // 用户状态,1——启用,0 禁用 state: this.form.able, // 用户状态,1——启用,0 禁用
"domain_name":this.form.domain,// domain_name: this.form.domain, //
"ip_whitelist":this.form.ip.split(';'),// ip_whitelist: this.form.ip.split(";"), //
"description":this.form.desc, //描述 description: this.form.desc, //描述
"link_man":this.form.contact link_man: this.form.contact,
} };
this.$http this.$http
.post(`/apaas/backmgt/user/register`,temp) .post(`/apaas/backmgt/user/register`, temp)
.then(response => { .then((response) => {
console.log(response); console.log(response);
this.backPage() this.backPage();
this.$message.success('新增成功') this.$message.success("新增成功");
}) })
.catch((response)=> { .catch((response) => {
this.$message.error('新增失败') this.$message.error("新增失败");
}); });
}, },
set_user(){ set_user() {
var temp = { var temp = {
"user_id":this.form.account, // 用户名 user_id: this.form.account, // 用户名
"user_name":this.form.nickname, // 昵称 user_name: this.form.nickname, // 昵称
"system_name":this.form.systemname,//系统名称 system_name: this.form.systemname, //系统名称
"phone":this.form.phone+'', // 电话号 phone: this.form.phone + "", // 电话号
"email":this.form.email, // 邮箱 email: this.form.email, // 邮箱
"department_id":this.form.origin, // 组织id department_id: this.form.origin, // 组织id
"is_admin":this.form.type, is_admin: this.form.type,
"state":this.form.able, // 用户状态,1——启用,0 禁用 state: this.form.able, // 用户状态,1——启用,0 禁用
"domain_name":this.form.domain,// domain_name: this.form.domain, //
"ip_whitelist":this.form.ip&&this.form.ip.length?this.form.ip.split(';'):[],// ip_whitelist:
"description":this.form.desc, //描述 this.form.ip && this.form.ip.length ? this.form.ip.split(";") : [], //
"link_man":this.form.contact description: this.form.desc, //描述
} link_man: this.form.contact,
this.$http };
.put(`/apaas/backmgt/user/put`,temp) this.$http
.then(response => { .put(`/apaas/backmgt/user/put`, temp)
console.log(response); .then((response) => {
this.backPage() console.log(response);
this.$message.success('修改成功') this.backPage();
}) this.$message.success("修改成功");
.catch((response)=> { })
this.$message.error('修改失败') .catch((response) => {
}); this.$message.error("修改失败");
});
}, },
onSubmit(formName) { onSubmit(formName) {
console.log('submit!'); console.log("submit!");
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if(this.edit_flag == 0){ if (this.edit_flag == 0) {
this.add_user() this.add_user();
}else{
this.set_user()
}
} else { } else {
console.log('error submit!!'); this.set_user();
return false;
} }
}); } else {
}, console.log("error submit!!");
resetForm(formName) { return false;
this.$refs[formName].resetFields(); }
} });
} },
resetForm(formName) {
this.$refs[formName].resetFields();
},
},
}; };
</script> </script>
<style> <style>
.info_contain .el-input__inner{ .info_contain .el-input__inner {
background-color: #f7f8f9; background-color: #f7f8f9;
width: 1022px; width: 1022px;
} }
.shortpass .el-input__inner{ .shortpass .el-input__inner {
background-color: #f7f8f9; background-color: #f7f8f9;
width: 888px; width: 888px;
} }
.shortpass .el-input{ .shortpass .el-input {
width: 888px; width: 888px;
} }
.info_contain .el-textarea__inner{ .info_contain .el-textarea__inner {
background-color: #f7f8f9; background-color: #f7f8f9;
width: 1022px; width: 1022px;
} }
.limitsd .timeslect .el-input__inner{ .limitsd .timeslect .el-input__inner {
width: 150px; width: 150px;
border-radius: 0 8px 8px 0; border-radius: 0 8px 8px 0;
background-color: rgba(15, 38, 131, 1); background-color: rgba(15, 38, 131, 1);
color: rgba(248, 249, 253, 1); color: rgba(248, 249, 253, 1);
border: 0; border: 0;
} }
.info_contain .el-input.is-disabled .el-input__inner{ .info_contain .el-input.is-disabled .el-input__inner {
background-color: #e3e4e6; background-color: #e3e4e6;
} }
</style> </style>
...@@ -413,8 +414,8 @@ export default { ...@@ -413,8 +414,8 @@ export default {
box-shadow: 0px 3px 6px 0px #f4f7fc; box-shadow: 0px 3px 6px 0px #f4f7fc;
border-radius: 12px; border-radius: 12px;
min-height: calc(100% - 20px); min-height: calc(100% - 20px);
margin-bottom: 20px; margin-bottom: 20px;
position: relative; position: relative;
} }
.now_page_title { .now_page_title {
margin: 15px 0; margin: 15px 0;
...@@ -423,17 +424,17 @@ export default { ...@@ -423,17 +424,17 @@ export default {
.now_page_title span { .now_page_title span {
color: #242c43; color: #242c43;
} }
.formname{ .formname {
color: #58617a; color: #58617a;
} }
.right{ .right {
float: right; float: right;
margin-left: 20px; margin-left: 20px;
} }
.left{ .left {
float: left; float: left;
} }
.removepic{ .removepic {
display: inline-block; display: inline-block;
margin-top: -40px; margin-top: -40px;
float: left; float: left;
...@@ -447,16 +448,16 @@ export default { ...@@ -447,16 +448,16 @@ export default {
color: #e6ebfe; color: #e6ebfe;
cursor: pointer; cursor: pointer;
} }
.edit_change{ .edit_change {
width: 100%; width: 100%;
border-bottom: 2px solid #f4f7fc; border-bottom: 2px solid #f4f7fc;
overflow: hidden; overflow: hidden;
} }
.edit_change_box{ .edit_change_box {
width: 163px; width: 163px;
height: 48px; height: 48px;
line-height: 48px; line-height: 48px;
background-color: #e3e5ef; background-color: #e3e5ef;
border-radius: 8px; border-radius: 8px;
color: #8890a7; color: #8890a7;
text-align: center; text-align: center;
...@@ -467,81 +468,81 @@ export default { ...@@ -467,81 +468,81 @@ export default {
font-size: 16px; font-size: 16px;
cursor: pointer; cursor: pointer;
} }
.edit_change_box img{ .edit_change_box img {
vertical-align: -3px; vertical-align: -3px;
margin-right: 5px; margin-right: 5px;
} }
.safe_title{ .safe_title {
width: 100%; width: 100%;
height: 65px; height: 65px;
line-height: 65px; line-height: 65px;
border-bottom: 2px solid #f4f7fc; border-bottom: 2px solid #f4f7fc;
} }
.safe_select{ .safe_select {
float: left; float: left;
width: auto; width: auto;
margin-right: 40px; margin-right: 40px;
height: 65px; height: 65px;
cursor: pointer; cursor: pointer;
} }
.safe_box_select{ .safe_box_select {
padding: 30px 10px 10px 10px; padding: 30px 10px 10px 10px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.openbgc{ .openbgc {
width: 56px; width: 56px;
height: 23px; height: 23px;
background-image: url('~@/assets/imgs/btn_on_hov.png'); background-image: url("~@/assets/imgs/btn_on_hov.png");
background-size:contain; background-size: contain;
cursor: pointer; cursor: pointer;
} }
.formtitle{ .formtitle {
color: #58617a; color: #58617a;
margin: 15px 0; margin: 15px 0;
} }
.savebtn{ .savebtn {
position: absolute; position: absolute;
right: 20px; right: 20px;
bottom:20px; bottom: 20px;
width: 278px; width: 278px;
overflow: hidden; overflow: hidden;
} }
.btnsty{ .btnsty {
width: 124px; width: 124px;
height: 44px; height: 44px;
line-height: 44px; line-height: 44px;
background-color: rgba(195, 202, 248, 0.5); background-color: rgba(195, 202, 248, 0.5);
border-radius: 8px; border-radius: 8px;
color: rgba(15, 38, 131, 1); color: rgba(15, 38, 131, 1);
text-align: center; text-align: center;
float: left; float: left;
margin-right: 30px; margin-right: 30px;
cursor: pointer; cursor: pointer;
} }
.savebtn .btnsty:nth-last-of-type(1){ .savebtn .btnsty:nth-last-of-type(1) {
margin-right: 0px; margin-right: 0px;
background-color: rgba(15, 38, 131, 1); background-color: rgba(15, 38, 131, 1);
color: rgba(248, 249, 253, 1); color: rgba(248, 249, 253, 1);
} }
.limitsd{ .limitsd {
position: relative; position: relative;
width: 1022px; width: 1022px;
} }
.limitsd .timeslect{ .limitsd .timeslect {
position: absolute; position: absolute;
right: 0; right: 0;
} }
.fixpass{ .fixpass {
width: 124px; width: 124px;
height: 44px; height: 44px;
line-height: 44px; line-height: 44px;
text-align: center; text-align: center;
font-size: 16px; font-size: 16px;
color: #fff; color: #fff;
background-color: #495feb; background-color: #495feb;
border-radius: 8px; border-radius: 8px;
display: inline-block; display: inline-block;
margin-left: 5px; margin-left: 5px;
cursor: pointer; cursor: pointer;
......
...@@ -10,7 +10,6 @@ function getRole(){ ...@@ -10,7 +10,6 @@ function getRole(){
//时间戳转时间格式 //时间戳转时间格式
var formatDateTime_date = function (date) { var formatDateTime_date = function (date) {
debugger
var y = date.getFullYear(); var y = date.getFullYear();
var M = date.getMonth() + 1; var M = date.getMonth() + 1;
M = M < 10 ? ('0' + M) : M; M = M < 10 ? ('0' + M) : M;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment