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);
if (data.success == 1) {
this.$message({ this.$message({
message: `已删除${this.deleteItem.department_name}.`, message: `已删除${this.deleteItem.department_name}.`,
type: "success", type: "success",
}); });
this.deleteItem = null; this.deleteItem = null;
this.initDatas(this.tempFilter); 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,18 +153,22 @@ export default { ...@@ -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}` `/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", prop: "system_name",
...@@ -178,7 +182,7 @@ export default { ...@@ -178,7 +182,7 @@ export default {
minWidth: "25%", minWidth: "25%",
align: "center", align: "center",
getText(item) { getText(item) {
return _this.admin_arr[item.is_admin||0]; return _this.admin_arr[item.is_admin || 0];
}, },
}, },
{ {
...@@ -201,9 +205,11 @@ export default { ...@@ -201,9 +205,11 @@ export default {
], ],
}, },
]; ];
});
}) })
}) .catch((error) => {
.catch((response) => {}); 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",
});
});
}, },
}, },
}; };
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
<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">
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
<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"
...@@ -50,252 +52,238 @@ ...@@ -50,252 +52,238 @@
<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:超级管理员 now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
edit_flag:0,//0:新增,1:编辑:2详情 edit_flag: 0, //0:新增,1:编辑:2详情
imgList: [], imgList: [],
area_arr:[ area_arr: [
{ {
label:'应急领域', label: "应急领域",
value:0, value: 0,
}, },
{ {
label:'公安领域', label: "公安领域",
value:1, value: 1,
}, },
{ {
label:'交通领域', label: "交通领域",
value:2, value: 2,
}, },
{ {
label:'全领域', label: "全领域",
value:3, value: 3,
} },
], ],
type_arr:[ type_arr: [
{ {
label:'基础工具', label: "基础工具",
value:0, value: 0,
}, },
{ {
label:'通用应用', label: "通用应用",
value:1, value: 1,
}, },
{ {
label:'业务应用', label: "业务应用",
value:2, value: 2,
}, },
{ {
label:'其他', label: "其他",
value:3, value: 3,
} },
], ],
origin_arr:[], origin_arr: [],
rules:{ rules: {
name:[ name: [
{ required: true, message: '请输入组织机构名称', trigger: 'blur' }, { required: true, message: "请输入组织机构名称", trigger: "blur" },
], ],
shortname:[ shortname: [
// { required: true, message: '请输入组织机构简称', trigger: 'blur' }, // { required: true, message: '请输入组织机构简称', trigger: 'blur' },
], ],
desc:[ desc: [
// { required: true, message: '请输入组织说明', trigger: 'blur' }, // { required: true, message: '请输入组织说明', trigger: 'blur' },
{ max: 200, message: '长度小于200个字符', trigger: 'blur' } { max: 200, message: "长度小于200个字符", trigger: "blur" },
], ],
fileList:[ fileList: [
// {required: true, message: '请上传图片', trigger: 'change'} // {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}`
)
.then((response) => {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data;
this.form={ this.form = {
name: data.department_name, name: data.department_name,
shortname:data.department_display, shortname: data.department_display,
code:this.$route.params.id, code: this.$route.params.id,
desc:data.description, desc: data.description,
person:data.create_user, person: data.create_user,
date:data.create_date, date: data.create_date,
fileList:data.picture_path fileList: data.picture_path,
} };
this.imgList = data.picture_path.split(';') this.imgList = data.picture_path.split(";");
}) })
.catch((response)=> { .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){ if (this.edit_flag == 1) {
this.set_user() this.set_user();
} }
} else { } else {
console.log('error submit!!'); console.log("error submit!!");
return false; return false;
} }
}); });
}, },
getNewList(val) { getNewList(val) {
console.log(val); this.form.fileList = val.url;
this.form.fileList = "" console.log(this.form.fileList);
this.form.fileList = val.map((v,k)=>{ },
return v.url },
}).join(';')
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>
...@@ -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,12 +332,12 @@ export default { ...@@ -344,12 +332,12 @@ 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;
...@@ -364,48 +352,48 @@ export default { ...@@ -364,48 +352,48 @@ 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;
...@@ -417,16 +405,16 @@ export default { ...@@ -417,16 +405,16 @@ export default {
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