Commit 56464e59 authored by 徐一鸣's avatar 徐一鸣

权限管理fixed

parent 87d45eb5
...@@ -85,14 +85,22 @@ export default { ...@@ -85,14 +85,22 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
// console.log(data); // console.log(data);
this.$message({ if (data.success == 1) {
message: `已删除${this.deleteItem.department_name}.`, this.$message({
type: "success", message: `已删除${this.deleteItem.department_name}.`,
}); type: "success",
this.deleteItem = null; });
this.initDatas(this.tempFilter); this.deleteItem = null;
this.initDatas(this.tempFilter);
} else {
this.$message({
message: `删除${this.deleteItem.department_name}失败`,
type: "warning",
});
}
}) })
.catch((error) => { .catch((error) => {
console.log(error);
this.$message({ this.$message({
message: `删除${this.deleteItem.department_name}失败`, message: `删除${this.deleteItem.department_name}失败`,
type: "warning", type: "warning",
......
...@@ -153,57 +153,63 @@ export default { ...@@ -153,57 +153,63 @@ export default {
`/apaas/backmgt/user/list?limit=${this.pageSize}&page=${this.currentPage}&department_id=${this.$route.params.id}&search=${this.input}` `/apaas/backmgt/user/list?limit=${this.pageSize}&page=${this.currentPage}&department_id=${this.$route.params.id}&search=${this.input}`
) )
.then((response) => { .then((response) => {
console.log(response); // console.log(response);
let data = response.data.data; let data = response.data.data;
this.listTotal = response.data.total; this.listTotal = response.data.total;
this.datas = data; this.datas = data;
var _this = this var _this = this;
setTimeout(()=>{ setTimeout(() => {
this.header_arr = [ this.header_arr = [
{ {
prop: "user_name", prop: "user_name",
label: "账号", label: "账号",
minWidth: "25%", minWidth: "25%",
align: "left", align: "left",
type: "button",
callback(item) {
_this.$router.push(`/authority/users/detail/${item.user_id}`);
}, },
{ },
prop: "system_name", {
label: "业务系统名称", prop: "system_name",
minWidth: "25%", label: "业务系统名称",
align: "left", minWidth: "25%",
align: "left",
},
{
prop: "is_admin",
label: "用户类型",
minWidth: "25%",
align: "center",
getText(item) {
return _this.admin_arr[item.is_admin || 0];
}, },
{ },
prop: "is_admin", {
label: "用户类型", prop: "operat_time",
minWidth: "25%", label: "上次操作修改时间",
align: "center", minWidth: "25%",
getText(item) { align: "center",
return _this.admin_arr[item.is_admin||0]; },
{
label: "操作",
type: "buttons",
width: "120px",
align: "center",
width: 140,
actionList: [
{
label: "删除",
callback: this.adelete,
}, },
}, ],
{ },
prop: "operat_time", ];
label: "上次操作修改时间", });
minWidth: "25%",
align: "center",
},
{
label: "操作",
type: "buttons",
width: "120px",
align: "center",
width: 140,
actionList: [
{
label: "删除",
callback: this.adelete,
},
],
},
];
})
}) })
.catch((response) => {}); .catch((error) => {
console.log(error);
});
}, },
adelete(val) { adelete(val) {
this.tipsOptions = { this.tipsOptions = {
...@@ -213,7 +219,7 @@ export default { ...@@ -213,7 +219,7 @@ export default {
btnCancelText: "", btnCancelText: "",
position: "", position: "",
}; };
this.tipsOptions.message = "是否删除该数据"; this.tipsOptions.message = "是否移除该用户?";
this.tipsOptions.confirmSubmit = () => { this.tipsOptions.confirmSubmit = () => {
console.log("deleteItem - " + JSON.stringify(val)); console.log("deleteItem - " + JSON.stringify(val));
this.delete_data(val); this.delete_data(val);
...@@ -226,11 +232,26 @@ export default { ...@@ -226,11 +232,26 @@ export default {
.post(`/apaas/backmgt/user/delete`, { .post(`/apaas/backmgt/user/delete`, {
id: [val.user_id], id: [val.user_id],
}) })
.then((response) => { .then(({ data }) => {
console.log(response); if (data.success == 1) {
this.get_list() this.$message({
message: `删除${val.user_name}成功`,
type: "success",
});
this.get_list();
} else {
this.$message({
message: `删除${val.user_name}失败`,
type: "warning",
});
}
}) })
.catch((response) => {}); .catch((error) => {
this.$message({
message: `删除${val.user_name}失败`,
type: "warning",
});
});
}, },
}, },
}; };
......
<template> <template>
<div class="detail_contain"> <div class="detail_contain">
<p class="now_page_title"> <p class="now_page_title">
权限管理 / 组织管理 / 权限管理 / 组织管理 /
<span>组织{{$route.path.indexOf('edit')!==-1?'编辑':'新增'}}</span> <span
>组织{{ $route.path.indexOf("edit") !== -1 ? "编辑" : "新增" }}</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">
...@@ -18,13 +20,13 @@ ...@@ -18,13 +20,13 @@
<p class="formname">组织机构编码:</p> <p class="formname">组织机构编码:</p>
<el-input v-model="form.code" disabled></el-input> <el-input v-model="form.code" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="fileList"> <el-form-item prop="fileList">
<p class="formname">组织机构图标:</p> <p class="formname">组织机构图标:</p>
<upload-file <upload-file
:multiple="false" :multiple="false"
:max="1" :max="1"
type="picture" type="cropper"
:readOnly="false" :readOnly="false"
fit="fill" fit="fill"
:list="imgList" :list="imgList"
...@@ -33,7 +35,7 @@ ...@@ -33,7 +35,7 @@
directory="manage" directory="manage"
></upload-file> ></upload-file>
<span class="removepic" @click="removepic">更换封面</span> <span class="removepic" @click="removepic">更换封面</span>
</el-form-item> </el-form-item>
<el-form-item prop="desc"> <el-form-item prop="desc">
<p class="formname">说明:</p> <p class="formname">说明:</p>
...@@ -49,254 +51,240 @@ ...@@ -49,254 +51,240 @@
<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 class="apass_button">
<el-button type="primary" @click="onSubmit('form')" class="right">保存</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 } from "@/utils/common";
export default { export default {
props: {}, props: {},
components: { components: {
uploadFile uploadFile,
}, },
data() { data() {
return { return {
form: { form: {
name: '', name: "",
shortname:'', shortname: "",
code:'', code: "",
desc:'', desc: "",
person:'', person: "",
date:'', date: "",
fileList:'' fileList: "",
},
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
edit_flag: 0, //0:新增,1:编辑:2详情
imgList: [],
area_arr: [
{
label: "应急领域",
value: 0,
}, },
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员 {
edit_flag:0,//0:新增,1:编辑:2详情 label: "公安领域",
imgList: [], value: 1,
area_arr:[ },
{ {
label:'应急领域', label: "交通领域",
value:0, value: 2,
}, },
{ {
label:'公安领域', label: "全领域",
value:1, value: 3,
}, },
{ ],
label:'交通领域', type_arr: [
value:2, {
}, label: "基础工具",
{ value: 0,
label:'全领域', },
value:3, {
} label: "通用应用",
value: 1,
},
{
label: "业务应用",
value: 2,
},
{
label: "其他",
value: 3,
},
],
origin_arr: [],
rules: {
name: [
{ required: true, message: "请输入组织机构名称", trigger: "blur" },
], ],
type_arr:[ shortname: [
{ // { required: true, message: '请输入组织机构简称', trigger: 'blur' },
label:'基础工具',
value:0,
},
{
label:'通用应用',
value:1,
},
{
label:'业务应用',
value:2,
},
{
label:'其他',
value:3,
}
], ],
origin_arr:[], desc: [
rules:{ // { required: true, message: '请输入组织说明', trigger: 'blur' },
name:[ { max: 200, message: "长度小于200个字符", trigger: "blur" },
{ required: true, message: '请输入组织机构名称', trigger: 'blur' }, ],
], fileList: [
shortname:[ // {required: true, message: '请上传图片', trigger: 'change'}
// { required: true, message: '请输入组织机构简称', trigger: 'blur' }, ],
], },
desc:[
// { required: true, message: '请输入组织说明', trigger: 'blur' },
{ max: 200, message: '长度小于200个字符', trigger: 'blur' }
],
fileList:[
// {required: true, message: '请上传图片', trigger: 'change'}
]
}
}; };
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() { created() {
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;
this.get_now_user() this.get_now_user();
} }
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();
} }
}, },
get_now_user(){ get_now_user() {
this.$http this.$http
.get(`/apaas/backmgt/user/getCurrentUser`) .get(`/apaas/backmgt/user/getCurrentUser`)
.then(response => { .then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
this.form={ this.form = {
person:data.user_name, person: data.user_name,
date:data.create_date.replace('T',' ').replace('Z',' '), date: data.create_date.replace("T", " ").replace("Z", " "),
} };
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
get_user(){ get_user() {
this.$http this.$http
.get(`/apaas/backmgt/department/detail?department_id=${this.$route.params.id}`) .get(
.then(response => { `/apaas/backmgt/department/detail?department_id=${this.$route.params.id}`
console.log(response); )
let data = response.data.data .then((response) => {
this.form={ console.log(response);
name: data.department_name, let data = response.data.data;
shortname:data.department_display, this.form = {
code:this.$route.params.id, name: data.department_name,
desc:data.description, shortname: data.department_display,
person:data.create_user, code: this.$route.params.id,
date:data.create_date, desc: data.description,
fileList:data.picture_path person: data.create_user,
} date: data.create_date,
this.imgList = data.picture_path.split(';') fileList: data.picture_path,
}) };
.catch((response)=> { this.imgList = data.picture_path.split(";");
})
}); .catch((response) => {});
}, },
set_user(){ set_user() {
var temp = { var temp = {
"department_id":this.form.code, department_id: this.form.code,
"department_name":this.form.name, department_name: this.form.name,
"description":this.form.desc, description: this.form.desc,
"department_display":this.form.shortname, department_display: this.form.shortname,
"picture_path":this.form.fileList, picture_path: this.form.fileList,
} };
this.$http this.$http
.put('/apaas/backmgt/department',temp) .put("/apaas/backmgt/department", temp)
.then(response => { .then((response) => {
console.log(response); console.log(response);
this.$message.success('保存成功') this.$message.success("保存成功");
this.$router.back(-1) this.$router.back(-1);
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
backPage(){ backPage() {
this.$router.back(-1) this.$router.back(-1);
}, },
add_user(){ add_user() {
var temp = { var temp = {
"department_name":this.form.name, department_name: this.form.name,
"description":this.form.desc, description: this.form.desc,
"department_display":this.form.shortname, department_display: this.form.shortname,
"picture_path":this.form.fileList, picture_path: this.form.fileList,
} };
this.$http this.$http
.post('/apaas/backmgt/department',temp) .post("/apaas/backmgt/department", temp)
.then(response => { .then((response) => {
console.log(response); console.log(response);
this.$message.success('保存成功') this.$message.success("保存成功");
this.$router.back(-1) this.$router.back(-1);
}) })
.catch((response)=> { .catch((response) => {});
});
}, },
getOriginArr(){ getOriginArr() {
this.$http this.$http
.get('/static/serviceedit.json') .get("/static/serviceedit.json")
.then(response => { .then((response) => {
let data = response.data.data let data = response.data.data;
this.origin_arr = data.origin_arr this.origin_arr = data.origin_arr;
}) })
.catch(function(response) { .catch(function(response) {});
});
}, },
removepic(){ removepic() {
this.$refs.servicepic.remove_pic() this.$refs.servicepic.remove_pic();
}, },
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();
}
if(this.edit_flag == 1){
this.set_user()
}
} else {
console.log('error submit!!');
return false;
} }
}); if (this.edit_flag == 1) {
}, this.set_user();
getNewList(val) { }
console.log(val); } else {
this.form.fileList = "" console.log("error submit!!");
this.form.fileList = val.map((v,k)=>{ return false;
return v.url }
}).join(';') });
console.log(this.form.fileList) },
} getNewList(val) {
} this.form.fileList = val.url;
console.log(this.form.fileList);
},
},
}; };
</script> </script>
<style> <style>
.info_contain .el-input__inner{ .info_contain .el-input__inner {
background-color: #f7f8f9; background-color: #f7f8f9;
width: 1022px; width: 1022px;
} }
.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>
...@@ -313,8 +301,8 @@ export default { ...@@ -313,8 +301,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;
...@@ -323,14 +311,14 @@ export default { ...@@ -323,14 +311,14 @@ 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;
} }
.removepic{ .removepic {
display: inline-block; display: inline-block;
margin-top: -40px; margin-top: -40px;
float: left; float: left;
...@@ -344,16 +332,16 @@ export default { ...@@ -344,16 +332,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;
...@@ -364,69 +352,69 @@ export default { ...@@ -364,69 +352,69 @@ 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;
} }
......
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