Commit 2a7a1c0b authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/master'

parents 0ae8d1e7 05d0b025
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<a-modal <a-modal
:title="formTitle" :title="formTitle"
:centered="true" :centered="true"
:destroyOnClose="true"
:getContainer="() => $refs.EditModal_box" :getContainer="() => $refs.EditModal_box"
:visible="visible" :visible="visible"
:confirmLoading="EditModalLoading" :confirmLoading="EditModalLoading"
...@@ -117,7 +116,7 @@ ...@@ -117,7 +116,7 @@
@change="handleChangeFile" @change="handleChangeFile"
accept="image/jpeg,image/png" accept="image/jpeg,image/png"
> >
<a-button type="primary" class="addclass" > <a-button type="primary" class="addclass">
<a-icon type="upload" /> 选择文件 <a-icon type="upload" /> 选择文件
</a-button> </a-button>
</a-upload> </a-upload>
...@@ -141,7 +140,9 @@ ...@@ -141,7 +140,9 @@
</a-form-model> </a-form-model>
<template slot="footer"> <template slot="footer">
<a-button @click="resetForm">重置</a-button> <a-button @click="resetForm">重置</a-button>
<a-button type="primary" class="addclass" @click="Modal_Ok">确定</a-button> <a-button type="primary" class="addclass" @click="Modal_Ok"
>确定</a-button
>
</template> </template>
</a-modal> </a-modal>
</div> </div>
...@@ -340,6 +341,7 @@ export default { ...@@ -340,6 +341,7 @@ export default {
// 重置还原表单信息内容 // 重置还原表单信息内容
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.compileInfoForm.resetFields(); this.$refs.compileInfoForm.resetFields();
this.fileList = [];
}); });
}, },
// 新增 // 新增
...@@ -351,15 +353,17 @@ export default { ...@@ -351,15 +353,17 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.compileInfoForm = { ...row }; setTimeout(() => {
this.fileList = [ this.compileInfoForm = { ...row };
{ this.fileList = [
uid: -1, {
name: this.compileInfoForm.imgPath, uid: -1,
url: this.compileInfoForm.imgPath, name: this.compileInfoForm.imgPath,
status: "done", url: this.compileInfoForm.imgPath,
}, status: "done",
]; },
];
}, 10);
}, },
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
...@@ -379,4 +383,4 @@ export default { ...@@ -379,4 +383,4 @@ export default {
overflow-y: auto !important; overflow-y: auto !important;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="authorityMis"> <div class="authorityMis">
<div class="header_box"> <div class="header_box">
<!-- <button class="addRoles_btn" @click="showRoleEditModal(false)">
<span>新增角色</span>
</button> -->
<a-button <a-button
type="primary" type="primary"
class="addclass" class="addclass"
...@@ -18,11 +15,6 @@ ...@@ -18,11 +15,6 @@
v-model="searchRoleName" v-model="searchRoleName"
@search="getRoleList" @search="getRoleList"
/> />
<!-- <a-input v-model="searchRoleName" placeholder="请输入角色名称搜索">
<a-icon slot="prefix" type="search" />
</a-input> -->
<!-- <button class="search_btn" @click="getRoleList">搜索</button> -->
<!-- <a-button type="primary" class="addclass" @click="getRoleList">搜索</a-button> -->
</span> </span>
</div> </div>
<div class="main"> <div class="main">
...@@ -57,7 +49,6 @@ ...@@ -57,7 +49,6 @@
</a-table> </a-table>
<AddEditRole <AddEditRole
ref="AddEditRole" ref="AddEditRole"
:sourceInfoForm="sourceInfoForm"
:formTitle="formTitle" :formTitle="formTitle"
:roleDict="roleDict" :roleDict="roleDict"
@getRoleList="getRoleList" @getRoleList="getRoleList"
...@@ -123,8 +114,7 @@ export default { ...@@ -123,8 +114,7 @@ export default {
}, },
], ],
tableSourceData: [], tableSourceData: [],
formTitle: undefined, //表单title formTitle: "", //表单title
sourceInfoForm: {},
roleDict: {}, roleDict: {},
}; };
}, },
...@@ -171,15 +161,11 @@ export default { ...@@ -171,15 +161,11 @@ export default {
}, },
showRoleEditModal(isEdit, row) { showRoleEditModal(isEdit, row) {
if (isEdit) { if (isEdit) {
this.sourceInfoForm = deepClone(row);
this.formTitle = "编辑"; this.formTitle = "编辑";
this.$refs.AddEditRole.onEdit(row);
} else { } else {
let obj = {
name: undefined, //姓名
remark: undefined, //描述
};
this.sourceInfoForm = obj;
this.formTitle = "添加"; this.formTitle = "添加";
this.$refs.AddEditRole.onAdd();
} }
this.$refs.AddEditRole.roleEditModalVisible = true; this.$refs.AddEditRole.roleEditModalVisible = true;
}, },
...@@ -192,16 +178,16 @@ export default { ...@@ -192,16 +178,16 @@ export default {
content: "此操作将删除该角色及权限信息,是否继续?", content: "此操作将删除该角色及权限信息,是否继续?",
okText: "", okText: "",
cancelText: "", cancelText: "",
centered: true,
onOk() { onOk() {
roleDelete({ roleDelete({
id: row.id, id: row.id,
}).then((res) => { }).then((res) => {
// console.log(res);
if (res.code == 1) { if (res.code == 1) {
_this.$message.success("删除成功");
//重新获取table数据 //重新获取table数据
_this.$nextTick(() => { _this.$nextTick(() => {
_this.getRoleList(); _this.getRoleList();
// _this.$message.success(res.data.message);
}); });
} else { } else {
_this.$message.error(res.data.message); _this.$message.error(res.data.message);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
:label-col="{ span: 6 }" :label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }" :wrapper-col="{ span: 18 }"
> >
<a-form-model-item label="用户名" prop="loginName"> <a-form-model-item label="用户名">
<a-input <a-input
disabled disabled
v-model="form.loginName" v-model="form.loginName"
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</a-form-model> </a-form-model>
<div slot="footer"> <div slot="footer">
<a-button style="margin-left: 10px" @click="handleClose">取消</a-button> <a-button style="margin-left: 10px" @click="handleReset">重置</a-button>
<a-button type="primary" class="addclass" @click="handleOk" <a-button type="primary" class="addclass" @click="handleOk"
>确定</a-button >确定</a-button
> >
...@@ -117,6 +117,9 @@ export default { ...@@ -117,6 +117,9 @@ export default {
} }
}); });
}, },
handleReset() {
this.$refs.formData.resetFields();
},
handleClose() { handleClose() {
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.Visible = false; this.Visible = false;
...@@ -125,5 +128,4 @@ export default { ...@@ -125,5 +128,4 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>
\ No newline at end of file
<template> <template>
<div> <div>
<a-modal <a-modal
:destroyOnClose="true"
title="编辑" title="编辑"
:centered="true" :centered="true"
:visible="Visible" :visible="Visible"
@cancel="Visible = false" @cancel="handelCancel"
:maskClosable="false" :maskClosable="false"
> >
<a-form-model <a-form-model
...@@ -29,7 +28,7 @@ ...@@ -29,7 +28,7 @@
@change="handleSelect" @change="handleSelect"
/> />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="电话"> <a-form-model-item label="电话" prop="mobile">
<a-input placeholder="请输入电话号码" v-model="form.mobile" /> <a-input placeholder="请输入电话号码" v-model="form.mobile" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item ref="realName" label="用户姓名" prop="realName"> <a-form-model-item ref="realName" label="用户姓名" prop="realName">
...@@ -152,25 +151,24 @@ export default { ...@@ -152,25 +151,24 @@ export default {
}, },
// 编辑 // 编辑
onEdit(row) { onEdit(row) {
this.form = { ...row }; setTimeout(() => {
try { this.form = { ...row };
this.form.areaNames = JSON.parse(this.form.areaNames); try {
} catch (err) { this.form.areaNames = JSON.parse(this.form.areaNames);
this.form.areaNames = this.form.areaNames; } catch (err) {
console.log(typeof this.form.areaNames); this.form.areaNames = this.form.areaNames;
} }
if (typeof this.form.areaNames == "string") { if (typeof this.form.areaNames == "string") {
this.selectAreaList = [this.form.areaNames]; this.selectAreaList = [this.form.areaNames];
} else {
if (this.form.areaNames.length) {
this.selectAreaList = this.form.areaNames.map((v) => v.label);
} else { } else {
this.selectAreaList = []; if (this.form.areaNames.length) {
this.selectAreaList = this.form.areaNames.map((v) => v.label);
} else {
this.selectAreaList = [];
}
} }
} this.form.loginPwd && this.$delete(this.form, "loginPwd");
}, 10);
// this.form.areaCodes = this.form.areaCodes.split(",");
this.form.loginPwd && this.$delete(this.form, "loginPwd");
}, },
// 提交 // 提交
onSubmit() { onSubmit() {
...@@ -187,6 +185,10 @@ export default { ...@@ -187,6 +185,10 @@ export default {
: (hash[next.areaCode] = true && item.push(next)); : (hash[next.areaCode] = true && item.push(next));
return item; return item;
}, []); }, []);
if (!this.form.areaNames.length) {
this.$message.warning("请选择站点区域");
return;
}
let res = await userSave({ let res = await userSave({
...this.form, ...this.form,
areaNames: JSON.stringify(this.form.areaNames), areaNames: JSON.stringify(this.form.areaNames),
...@@ -197,13 +199,19 @@ export default { ...@@ -197,13 +199,19 @@ export default {
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.$emit("EditSuccess"); this.$emit("EditSuccess");
this.Visible = false; this.handelCancel();
} }
} }
}); });
}, },
resetForm() { resetForm() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.selectAreaList = [];
},
handelCancel() {
this.$refs.ruleForm.resetFields();
this.selectAreaList = [];
this.Visible = false;
}, },
// 选中树节点 // 选中树节点
handleSelect(value, node, extra) { handleSelect(value, node, extra) {
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
:title="formTitle" :title="formTitle"
:getContainer="() => $refs.roleEditModal_box" :getContainer="() => $refs.roleEditModal_box"
:centered="true" :centered="true"
:destroyOnClose="true"
:visible="roleEditModalVisible" :visible="roleEditModalVisible"
:confirmLoading="roleEditModalLoading" :confirmLoading="roleEditModalLoading"
@cancel="roleEditModalVisible = false" @cancel="handleCancel"
width="30%" width="30%"
:maskClosable="false" :maskClosable="false"
> >
...@@ -41,22 +40,32 @@ ...@@ -41,22 +40,32 @@
</a-form-model> </a-form-model>
<template slot="footer"> <template slot="footer">
<a-button @click="resetForm">重置</a-button> <a-button @click="resetForm">重置</a-button>
<a-button type="primary" class="addclass" @click="roleEditModal_Ok">确定</a-button> <a-button type="primary" class="addclass" @click="roleEditModal_Ok"
>确定</a-button
>
</template> </template>
</a-modal> </a-modal>
</div> </div>
</template> </template>
<script> <script>
import { deepClone } from "@/utils/js/common.js";
import { roleSave } from "@/api/authorityMis.js"; import { roleSave } from "@/api/authorityMis.js";
export default { export default {
name: "PortalAdminVueNewRole", name: "PortalAdminVueNewRole",
props: {
formTitle: {
type: String,
default: "编辑",
},
},
data() { data() {
return { return {
roleEditModalVisible: false, //模态 roleEditModalVisible: false, //模态
roleEditModalLoading: false, //确定回调 loading roleEditModalLoading: false, //确定回调 loading
compileInfoForm: {}, //页面表单信息 compileInfoForm: {
name: "", //姓名
remark: "", //描述
}, //页面表单信息
roleRules: { roleRules: {
name: [ name: [
{ {
...@@ -65,10 +74,6 @@ export default { ...@@ -65,10 +74,6 @@ export default {
message: "请输入角色名称", message: "请输入角色名称",
trigger: "blur", trigger: "blur",
}, },
// {
// pattern: /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/,
// message: "不能有特殊字符和数字、长度在1-20",
// },
], ],
remark: [ remark: [
{ {
...@@ -81,57 +86,24 @@ export default { ...@@ -81,57 +86,24 @@ export default {
}, },
}; };
}, },
props: { methods: {
roleDict: { onAdd() {
type: Object, Object.assign(this.compileInfoForm, this.$options.data().compileInfoForm);
default: () => { this.compileInfoForm.id && this.$delete(this.compileInfoForm, "id");
return {};
},
},
formTitle: {
type: String,
default: () => {
return "编辑";
},
},
sourceInfoForm: {
type: Object,
default: () => {
return {};
},
}, },
}, onEdit(row) {
watch: { setTimeout(() => {
sourceInfoForm: { this.compileInfoForm = { ...row };
handler(newValue, oldValue) { }, 10);
// console.log(newValue);
// console.log(oldValue);
this.compileInfoForm = deepClone(newValue);
for (let key in this.roleRules) {
this.roleRules[key][0].required = this.formTitle == "添加";
}
},
deep: true,
}, },
},
mounted() {},
methods: {
roleEditModal_Ok() { roleEditModal_Ok() {
this.$refs.compileInfoForm.validate((valid) => { this.$refs.compileInfoForm.validate((valid) => {
if (valid) { if (valid) {
// this.roleEditModalLoading = true; roleSave(this.compileInfoForm).then((res) => {
let submitObj = {
name: this.compileInfoForm.name,
remark: this.compileInfoForm.remark,
};
if (this.formTitle == "编辑") {
submitObj["id"] = this.compileInfoForm["id"];
}
roleSave(submitObj).then((res) => {
if (res.code == 1) { if (res.code == 1) {
this.$emit("getRoleList"); this.$emit("getRoleList");
// this.$message.success(res.msg); this.$message.success(res.msg);
this.roleEditModalVisible = false; this.handleCancel();
} }
}); });
} else { } else {
...@@ -142,10 +114,12 @@ export default { ...@@ -142,10 +114,12 @@ export default {
}, },
resetForm() { resetForm() {
// 重置还原表单信息内容 // 重置还原表单信息内容
this.$set(this, "compileInfoForm", this.sourceInfoForm); this.$refs.compileInfoForm.resetFields();
this.$nextTick(() => { },
this.$refs.compileInfoForm.resetFields(); handleCancel() {
}); // 重置还原表单信息内容
this.$refs.compileInfoForm.resetFields();
this.roleEditModalVisible = false;
}, },
}, },
}; };
...@@ -158,30 +132,5 @@ export default { ...@@ -158,30 +132,5 @@ export default {
max-height: 550px !important; max-height: 550px !important;
overflow-y: auto !important; overflow-y: auto !important;
} }
//.ant-modal-footer {
// text-align: left !important;
// }
//.ant-form-item-label > label::after {
// display: none !important;
// }
//.ant-form-item {
// .ant-form-item-label {
// &::after {
// content: ":";
// position: relative;
// top: -0.5px;
// margin: 0 8px 0 2px;
// }
// }
// }
//.ant-form-item:last-child {
// .ant-form-item-label {
// &::after {
// display: none !important;
// }
// }
// }
} }
</style> </style>
\ No newline at end of file
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
> >
<a-form-model-item label="站点授权" prop="areaCodes"> <a-form-model-item label="站点授权" prop="areaCodes">
<a-tree-select <a-tree-select
v-model="form.areaCodes" v-model="changeSelect"
style="width: 100%" style="width: 100%"
:tree-data="treeData" :tree-data="treeData"
allowClear allowClear
:load-data="onLoadData" :load-data="onLoadData"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
tree-checkable tree-checkable
labelInValue
:show-checked-strategy="SHOW_PARENT" :show-checked-strategy="SHOW_PARENT"
placeholder="请选择站点区域" placeholder="请选择站点区域"
:replaceFields="replaceFields" :replaceFields="replaceFields"
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
" "
/> />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="电话"> <a-form-model-item label="电话" prop="mobile">
<a-input placeholder="请输入电话号码" v-model="form.mobile" /> <a-input placeholder="请输入电话号码" v-model="form.mobile" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item ref="realName" label="用户姓名" prop="realName"> <a-form-model-item ref="realName" label="用户姓名" prop="realName">
...@@ -101,6 +102,7 @@ export default { ...@@ -101,6 +102,7 @@ export default {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 20 }, wrapperCol: { span: 20 },
changeSelect: [], changeSelect: [],
form: { form: {
loginName: undefined, loginName: undefined,
loginPwd: undefined, loginPwd: undefined,
...@@ -111,6 +113,9 @@ export default { ...@@ -111,6 +113,9 @@ export default {
areaNames: undefined, areaNames: undefined,
}, },
rules: { rules: {
areaCodes: [
{ required: true, message: "请选择站点区域", trigger: "change" },
],
loginName: [ loginName: [
{ required: true, validator: changeAccount, trigger: "blur" }, { required: true, validator: changeAccount, trigger: "blur" },
], ],
...@@ -188,10 +193,15 @@ export default { ...@@ -188,10 +193,15 @@ export default {
onSubmit() { onSubmit() {
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
let areas = this.changeSelect.map((v) => {
return {
areaCode: v.value,
label: v.label,
};
});
let res = await userSave({ let res = await userSave({
...this.form, ...this.form,
areaCodes: this.form.areaCodes.join(","), areaNames: JSON.stringify(areas),
areaNames: JSON.stringify(this.changeSelect),
loginName: encrypt(this.form.loginName), loginName: encrypt(this.form.loginName),
loginPwd: encrypt(this.form.loginPwd), loginPwd: encrypt(this.form.loginPwd),
}); });
...@@ -209,21 +219,8 @@ export default { ...@@ -209,21 +219,8 @@ export default {
this.changeSelect = []; this.changeSelect = [];
}, },
// 选择区域 // 选择区域
handleSelect(value, node, extra) { handleSelect() {
let { allCheckedNodes } = extra; this.form.areaCodes = this.changeSelect.map((v) => v.value).join(",");
this.changeSelect = allCheckedNodes.map((v) => {
if (v.node) {
return {
areaCode: v.node.data.props.areaCode,
label: v.node.data.props.label,
};
} else {
return {
areaCode: v.data.props.areaCode,
label: v.data.props.label,
};
}
});
}, },
}, },
}; };
......
...@@ -250,6 +250,7 @@ export default { ...@@ -250,6 +250,7 @@ export default {
content: "此操作将删除该角色及权限信息,是否继续?", content: "此操作将删除该角色及权限信息,是否继续?",
okText: "", okText: "",
cancelText: "", cancelText: "",
centered: true,
onOk() { onOk() {
userDelete({ userDelete({
id: val, id: val,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:width="modalInfo.width" :width="modalInfo.width"
:visible="modalInfo.visible" :visible="modalInfo.visible"
:title="modalInfo.title" :title="modalInfo.title"
@cancel="modalInfo.visible = false" @cancel="resetForm"
centered centered
destroyOnClose destroyOnClose
> >
...@@ -61,11 +61,10 @@ ...@@ -61,11 +61,10 @@
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<template slot="footer"> <template slot="footer">
<a-button type="primary" class="addclass" @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
<a-button type="primary" class="addclass" @click="Modal_Ok" <a-button type="primary" class="addclass" @click="Modal_Ok"
>确定</a-button >确定</a-button
> >
<a-button @click="resetForm">取消</a-button>
</template> </template>
</a-modal> </a-modal>
</template> </template>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:width="modalInfo.width" :width="modalInfo.width"
:visible="modalInfo.visible" :visible="modalInfo.visible"
:title="modalInfo.title" :title="modalInfo.title"
@cancel="modalInfo.visible = false" @cancel="resetForm"
centered centered
destroyOnClose destroyOnClose
> >
...@@ -44,11 +44,10 @@ ...@@ -44,11 +44,10 @@
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<template slot="footer"> <template slot="footer">
<a-button type="primary" class="addclass" @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
<a-button type="primary" class="addclass" @click="Modal_Ok" <a-button type="primary" class="addclass" @click="Modal_Ok"
>确定</a-button >确定</a-button
> >
<a-button @click="resetForm">取消</a-button>
</template> </template>
</a-modal> </a-modal>
</template> </template>
......
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