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

权限管理fixed

parent 87d45eb5
......@@ -85,14 +85,22 @@ export default {
})
.then(({ data }) => {
// console.log(data);
if (data.success == 1) {
this.$message({
message: `已删除${this.deleteItem.department_name}.`,
type: "success",
});
this.deleteItem = null;
this.initDatas(this.tempFilter);
} else {
this.$message({
message: `删除${this.deleteItem.department_name}失败`,
type: "warning",
});
}
})
.catch((error) => {
console.log(error);
this.$message({
message: `删除${this.deleteItem.department_name}失败`,
type: "warning",
......
......@@ -153,18 +153,22 @@ export default {
`/apaas/backmgt/user/list?limit=${this.pageSize}&page=${this.currentPage}&department_id=${this.$route.params.id}&search=${this.input}`
)
.then((response) => {
console.log(response);
// console.log(response);
let data = response.data.data;
this.listTotal = response.data.total;
this.datas = data;
var _this = this
setTimeout(()=>{
var _this = this;
setTimeout(() => {
this.header_arr = [
{
prop: "user_name",
label: "账号",
minWidth: "25%",
align: "left",
type: "button",
callback(item) {
_this.$router.push(`/authority/users/detail/${item.user_id}`);
},
},
{
prop: "system_name",
......@@ -178,7 +182,7 @@ export default {
minWidth: "25%",
align: "center",
getText(item) {
return _this.admin_arr[item.is_admin||0];
return _this.admin_arr[item.is_admin || 0];
},
},
{
......@@ -201,9 +205,11 @@ export default {
],
},
];
});
})
})
.catch((response) => {});
.catch((error) => {
console.log(error);
});
},
adelete(val) {
this.tipsOptions = {
......@@ -213,7 +219,7 @@ export default {
btnCancelText: "",
position: "",
};
this.tipsOptions.message = "是否删除该数据";
this.tipsOptions.message = "是否移除该用户?";
this.tipsOptions.confirmSubmit = () => {
console.log("deleteItem - " + JSON.stringify(val));
this.delete_data(val);
......@@ -226,11 +232,26 @@ export default {
.post(`/apaas/backmgt/user/delete`, {
id: [val.user_id],
})
.then((response) => {
console.log(response);
this.get_list()
.then(({ data }) => {
if (data.success == 1) {
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",
});
});
},
},
};
......
......@@ -2,7 +2,9 @@
<div class="detail_contain">
<p class="now_page_title">
权限管理 / 组织管理 /
<span>组织{{$route.path.indexOf('edit')!==-1?'编辑':'新增'}}</span>
<span
>组织{{ $route.path.indexOf("edit") !== -1 ? "编辑" : "新增" }}</span
>
</p>
<div class="info_contain">
<el-form ref="form" :rules="rules" :model="form" label-width="0px">
......@@ -24,7 +26,7 @@
<upload-file
:multiple="false"
:max="1"
type="picture"
type="cropper"
:readOnly="false"
fit="fill"
:list="imgList"
......@@ -50,252 +52,238 @@
<el-input v-model="form.date" disabled></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')" class="right">保存</el-button>
<el-form-item class="apass_button">
<el-button type="primary" @click="onSubmit('form')" class="right"
>保存</el-button
>
<el-button class="right" @click="backPage()">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import uploadFile from '@/components/upload_file'
import uploadFile from "@/components/upload_file";
import { getRole } from "@/utils/common";
export default {
props: {},
components: {
uploadFile
uploadFile,
},
data() {
return {
form: {
name: '',
shortname:'',
code:'',
desc:'',
person:'',
date:'',
fileList:''
name: "",
shortname: "",
code: "",
desc: "",
person: "",
date: "",
fileList: "",
},
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
edit_flag:0,//0:新增,1:编辑:2详情
edit_flag: 0, //0:新增,1:编辑:2详情
imgList: [],
area_arr:[
area_arr: [
{
label:'应急领域',
value:0,
label: "应急领域",
value: 0,
},
{
label:'公安领域',
value:1,
label: "公安领域",
value: 1,
},
{
label:'交通领域',
value:2,
label: "交通领域",
value: 2,
},
{
label:'全领域',
value:3,
}
label: "全领域",
value: 3,
},
],
type_arr:[
type_arr: [
{
label:'基础工具',
value:0,
label: "基础工具",
value: 0,
},
{
label:'通用应用',
value:1,
label: "通用应用",
value: 1,
},
{
label:'业务应用',
value:2,
label: "业务应用",
value: 2,
},
{
label:'其他',
value:3,
}
label: "其他",
value: 3,
},
],
origin_arr:[],
rules:{
name:[
{ required: true, message: '请输入组织机构名称', trigger: 'blur' },
origin_arr: [],
rules: {
name: [
{ required: true, message: "请输入组织机构名称", trigger: "blur" },
],
shortname:[
shortname: [
// { required: true, message: '请输入组织机构简称', trigger: 'blur' },
],
desc:[
desc: [
// { required: true, message: '请输入组织说明', trigger: 'blur' },
{ max: 200, message: '长度小于200个字符', trigger: 'blur' }
{ max: 200, message: "长度小于200个字符", trigger: "blur" },
],
fileList:[
fileList: [
// {required: true, message: '请上传图片', trigger: 'change'}
]
}
],
},
};
},
watch: {},
computed: {},
created() {
this.get_now_page()
this.get_now_page();
},
mounted() {},
methods: {
get_now_page(){
get_now_page() {
console.log(this.$route);
if(this.$route.path.indexOf('add')!==-1){
this.edit_flag = 0
this.get_now_user()
if (this.$route.path.indexOf("add") !== -1) {
this.edit_flag = 0;
this.get_now_user();
}
if(this.$route.path.indexOf('edit')!==-1){
this.edit_flag = 1
this.get_user()
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()
if (this.$route.path.indexOf("detail") !== -1) {
this.edit_flag = 2;
this.get_user();
}
},
get_now_user(){
get_now_user() {
this.$http
.get(`/apaas/backmgt/user/getCurrentUser`)
.then(response => {
.then((response) => {
console.log(response);
let data = response.data.data
this.form={
person:data.user_name,
date:data.create_date.replace('T',' ').replace('Z',' '),
}
let data = response.data.data;
this.form = {
person: data.user_name,
date: data.create_date.replace("T", " ").replace("Z", " "),
};
})
.catch((response)=> {
});
.catch((response) => {});
},
get_user(){
get_user() {
this.$http
.get(`/apaas/backmgt/department/detail?department_id=${this.$route.params.id}`)
.then(response => {
.get(
`/apaas/backmgt/department/detail?department_id=${this.$route.params.id}`
)
.then((response) => {
console.log(response);
let data = response.data.data
this.form={
let data = response.data.data;
this.form = {
name: data.department_name,
shortname:data.department_display,
code:this.$route.params.id,
desc:data.description,
person:data.create_user,
date:data.create_date,
fileList:data.picture_path
}
this.imgList = data.picture_path.split(';')
shortname: data.department_display,
code: this.$route.params.id,
desc: data.description,
person: data.create_user,
date: data.create_date,
fileList: data.picture_path,
};
this.imgList = data.picture_path.split(";");
})
.catch((response)=> {
});
.catch((response) => {});
},
set_user(){
set_user() {
var temp = {
"department_id":this.form.code,
"department_name":this.form.name,
"description":this.form.desc,
"department_display":this.form.shortname,
"picture_path":this.form.fileList,
}
department_id: this.form.code,
department_name: this.form.name,
description: this.form.desc,
department_display: this.form.shortname,
picture_path: this.form.fileList,
};
this.$http
.put('/apaas/backmgt/department',temp)
.then(response => {
.put("/apaas/backmgt/department", temp)
.then((response) => {
console.log(response);
this.$message.success('保存成功')
this.$router.back(-1)
this.$message.success("保存成功");
this.$router.back(-1);
})
.catch((response)=> {
});
.catch((response) => {});
},
backPage(){
this.$router.back(-1)
backPage() {
this.$router.back(-1);
},
add_user(){
add_user() {
var temp = {
"department_name":this.form.name,
"description":this.form.desc,
"department_display":this.form.shortname,
"picture_path":this.form.fileList,
}
department_name: this.form.name,
description: this.form.desc,
department_display: this.form.shortname,
picture_path: this.form.fileList,
};
this.$http
.post('/apaas/backmgt/department',temp)
.then(response => {
.post("/apaas/backmgt/department", temp)
.then((response) => {
console.log(response);
this.$message.success('保存成功')
this.$router.back(-1)
this.$message.success("保存成功");
this.$router.back(-1);
})
.catch((response)=> {
});
.catch((response) => {});
},
getOriginArr(){
getOriginArr() {
this.$http
.get('/static/serviceedit.json')
.then(response => {
let data = response.data.data
this.origin_arr = data.origin_arr
.get("/static/serviceedit.json")
.then((response) => {
let data = response.data.data;
this.origin_arr = data.origin_arr;
})
.catch(function(response) {
});
.catch(function(response) {});
},
removepic(){
this.$refs.servicepic.remove_pic()
removepic() {
this.$refs.servicepic.remove_pic();
},
onSubmit(formName) {
console.log('submit!');
console.log("submit!");
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.edit_flag == 0){
this.add_user()
if (this.edit_flag == 0) {
this.add_user();
}
if(this.edit_flag == 1){
this.set_user()
if (this.edit_flag == 1) {
this.set_user();
}
} else {
console.log('error submit!!');
console.log("error submit!!");
return false;
}
});
},
getNewList(val) {
console.log(val);
this.form.fileList = ""
this.form.fileList = val.map((v,k)=>{
return v.url
}).join(';')
console.log(this.form.fileList)
}
}
this.form.fileList = val.url;
console.log(this.form.fileList);
},
},
};
</script>
<style>
.info_contain .el-input__inner{
.info_contain .el-input__inner {
background-color: #f7f8f9;
width: 1022px;
}
.info_contain .el-textarea__inner{
.info_contain .el-textarea__inner {
background-color: #f7f8f9;
width: 1022px;
}
.limitsd .timeslect .el-input__inner{
.limitsd .timeslect .el-input__inner {
width: 150px;
border-radius: 0 8px 8px 0;
background-color: rgba(15, 38, 131, 1);
color: rgba(248, 249, 253, 1);
border: 0;
}
.info_contain .el-input.is-disabled .el-input__inner{
.info_contain .el-input.is-disabled .el-input__inner {
background-color: #e3e4e6;
}
</style>
......@@ -323,14 +311,14 @@ export default {
.now_page_title span {
color: #242c43;
}
.formname{
.formname {
color: #58617a;
}
.right{
.right {
float: right;
margin-left: 20px;
}
.removepic{
.removepic {
display: inline-block;
margin-top: -40px;
float: left;
......@@ -344,12 +332,12 @@ export default {
color: #e6ebfe;
cursor: pointer;
}
.edit_change{
.edit_change {
width: 100%;
border-bottom: 2px solid #f4f7fc;
overflow: hidden;
}
.edit_change_box{
.edit_change_box {
width: 163px;
height: 48px;
line-height: 48px;
......@@ -364,48 +352,48 @@ export default {
font-size: 16px;
cursor: pointer;
}
.edit_change_box img{
.edit_change_box img {
vertical-align: -3px;
margin-right: 5px;
}
.safe_title{
.safe_title {
width: 100%;
height: 65px;
line-height: 65px;
border-bottom: 2px solid #f4f7fc;
}
.safe_select{
.safe_select {
float: left;
width: auto;
margin-right: 40px;
height: 65px;
cursor: pointer;
}
.safe_box_select{
.safe_box_select {
padding: 30px 10px 10px 10px;
width: 100%;
height: 100%;
}
.openbgc{
.openbgc {
width: 56px;
height: 23px;
background-image: url('~@/assets/imgs/btn_on_hov.png');
background-size:contain;
background-image: url("~@/assets/imgs/btn_on_hov.png");
background-size: contain;
cursor: pointer;
}
.formtitle{
.formtitle {
color: #58617a;
margin: 15px 0;
}
.savebtn{
.savebtn {
position: absolute;
right: 20px;
bottom:20px;
bottom: 20px;
width: 278px;
overflow: hidden;
}
.btnsty{
.btnsty {
width: 124px;
height: 44px;
line-height: 44px;
......@@ -417,16 +405,16 @@ export default {
margin-right: 30px;
cursor: pointer;
}
.savebtn .btnsty:nth-last-of-type(1){
.savebtn .btnsty:nth-last-of-type(1) {
margin-right: 0px;
background-color: rgba(15, 38, 131, 1);
color: rgba(248, 249, 253, 1);
}
.limitsd{
.limitsd {
position: relative;
width: 1022px;
}
.limitsd .timeslect{
.limitsd .timeslect {
position: absolute;
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