提交 871c9f87 authored 作者: 龙菲's avatar 龙菲

角色模块完善

上级 cf226cf6
...@@ -141,6 +141,14 @@ export function deleteRole(id) { ...@@ -141,6 +141,14 @@ export function deleteRole(id) {
}) })
} }
// 根据id获取角色详细信息
export function getRoleById(id) {
return request({
url: '/sys/role/'+id,
method: 'get',
})
}
// 获取所有目录菜单树 // 获取所有目录菜单树
export function getPermissionTreeAll(params) { export function getPermissionTreeAll(params) {
return request({ return request({
......
...@@ -121,14 +121,20 @@ ...@@ -121,14 +121,20 @@
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="馆藏介绍" :label-width="formLabelWidth"> <el-form-item label="馆藏介绍" :label-width="formLabelWidth">
<el-input <!-- <el-input
type="textarea" type="textarea"
placeholder="请输入馆藏介绍" placeholder="请输入馆藏介绍"
v-model="dialogForm.intro" v-model="dialogForm.intro"
maxlength="300" maxlength="300"
show-word-limit show-word-limit
> >
</el-input> </el-input> -->
<quill-editor
ref="myQuillEditor"
v-model="dialogForm.intro"
:options="editorOption"
class=".editor"
/>
</el-form-item> </el-form-item>
<el-form-item label="关联文献" :label-width="formLabelWidth"> <el-form-item label="关联文献" :label-width="formLabelWidth">
<el-select <el-select
...@@ -206,7 +212,7 @@ ...@@ -206,7 +212,7 @@
<el-form-item label="文物图片" :label-width="formLabelWidth"> <el-form-item label="文物图片" :label-width="formLabelWidth">
<ManualUploader <ManualUploader
:files="images" :files="images"
:fileLimit="6" :fileLimit="20"
:fileSize="50" :fileSize="50"
listType="picture-card" listType="picture-card"
:fileType="['png', 'jpeg', 'jpg']" :fileType="['png', 'jpeg', 'jpg']"
...@@ -264,10 +270,12 @@ import ManualUploader from "@/components/Uploader/ManualUploader.vue"; ...@@ -264,10 +270,12 @@ import ManualUploader from "@/components/Uploader/ManualUploader.vue";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { uploadV1 } from "@/utils/file"; import { uploadV1 } from "@/utils/file";
import { deleteFiles } from "@/api/file"; import { deleteFiles } from "@/api/file";
import { quillEditor } from "vue-quill-editor";
export default { export default {
name: "InfoEditDialog", name: "InfoEditDialog",
components: { components: {
ManualUploader, ManualUploader,
quillEditor,
}, },
props: { props: {
visible: { visible: {
...@@ -335,6 +343,10 @@ export default { ...@@ -335,6 +343,10 @@ export default {
// 回填馆藏单位 // 回填馆藏单位
if (this.dialogForm.deptId) { if (this.dialogForm.deptId) {
this.dialogForm.deptId = [this.dialogForm.deptId]; this.dialogForm.deptId = [this.dialogForm.deptId];
} else {
// 设置默认值为当前用户的信息
const { deptId, regionCode } = this.userInfo;
this.dialogForm.deptId = deptId;
} }
}, },
immediate: true, immediate: true,
...@@ -342,6 +354,24 @@ export default { ...@@ -342,6 +354,24 @@ export default {
}, },
}, },
data() { data() {
// 工具栏配置
const toolbarOptions = [
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线 -----['bold', 'italic', 'underline', 'strike']
["blockquote", "code-block"], // 引用 代码块-----['blockquote', 'code-block']
[{ header: 1 }, { header: 2 }], // 1、2 级标题-----[{ header: 1 }, { header: 2 }]
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表-----[{ list: 'ordered' }, { list: 'bullet' }]
[{ script: "sub" }, { script: "super" }], // 上标/下标-----[{ script: 'sub' }, { script: 'super' }]
[{ indent: "-1" }, { indent: "+1" }], // 缩进-----[{ indent: '-1' }, { indent: '+1' }]
[{ direction: "rtl" }], // 文本方向-----[{'direction': 'rtl'}]
[{ size: ["small", false, "large", "huge"] }], // 字体大小-----[{ size: ['small', false, 'large', 'huge'] }]
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题-----[{ header: [1, 2, 3, 4, 5, 6, false] }]
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色-----[{ color: [] }, { background: [] }]
[{ font: [] }], // 字体种类-----[{ font: [] }]
[{ align: [] }], // 对齐方式-----[{ align: [] }]
["clean"], // 清除文本格式-----['clean']
// ["image", "video"], // 链接、图片、视频-----['link', 'image', 'video']
];
return { return {
dialogForm: { dialogForm: {
...this.form, ...this.form,
...@@ -376,6 +406,17 @@ export default { ...@@ -376,6 +406,17 @@ export default {
children: "children", children: "children",
checkStrictly: true, //单选选择任意一级选项 checkStrictly: true, //单选选择任意一级选项
}, },
//富文本编辑器配置
editorOption: {
// 富文本编辑器配置
modules: {
//工具栏定义的
toolbar: toolbarOptions,
},
//主题
theme: "snow",
placeholder: "请输入馆藏介绍",
},
}; };
}, },
async created() { async created() {
...@@ -519,8 +560,8 @@ export default { ...@@ -519,8 +560,8 @@ export default {
} }
}); });
if (!that.dialogForm.crId) { if (!that.dialogForm.crId) {
const { deptId, regionCode } = this.userInfo; // const { deptId, regionCode } = this.userInfo;
const params = { ...this.dialogForm, deptId, regionCode }; const params = { ...this.dialogForm };
params.literature = this.literatureValues.join(","); params.literature = this.literatureValues.join(",");
params.status = this.dialogForm.status ? 1 : 0; params.status = this.dialogForm.status ? 1 : 0;
// 处理年份 // 处理年份
......
...@@ -46,13 +46,13 @@ export const title = [{ ...@@ -46,13 +46,13 @@ export const title = [{
label: "所属地", label: "所属地",
columnAlign: 'center', columnAlign: 'center',
}, },
{ // {
prop: "intro", // prop: "intro",
label: "馆藏介绍", // label: "馆藏介绍",
columnAlign: 'center', // columnAlign: 'center',
showOverFlowToolTip: true, // showOverFlowToolTip: true,
width: 120, // width: 120,
}, // },
{ {
prop: "themeWord", prop: "themeWord",
......
...@@ -427,7 +427,7 @@ export default { ...@@ -427,7 +427,7 @@ export default {
}, },
//主题 //主题
theme: "snow", theme: "snow",
placeholder: "请输入单元介绍", placeholder: "请输入展览介绍",
}, },
orgTreeData: [], orgTreeData: [],
optionProps: { optionProps: {
......
...@@ -712,7 +712,8 @@ $blue: #2069c4; ...@@ -712,7 +712,8 @@ $blue: #2069c4;
.imagesVo-image-container { .imagesVo-image-container {
// position: relative; // position: relative;
.img-container { .img-container {
height: 280px; // height: 280px;
height: 100%;
width: 100%; width: 100%;
img { img {
width: 100%; width: 100%;
...@@ -916,53 +917,65 @@ $blue: #2069c4; ...@@ -916,53 +917,65 @@ $blue: #2069c4;
background-size: 1%; background-size: 1%;
padding: 50px 0; padding: 50px 0;
.el-col { .el-col {
&:first-child { .img-container {
.img-container { width: 100%;
width: 100%; height: 460px;
height: 460px; position: relative;
position: relative;
.cr-name-intro { .cr-name-intro {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
padding: 100px 28px 50px; padding: 100px 28px 50px;
background-image: linear-gradient( background-image: linear-gradient(
to top, to top,
rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8),
rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1)
); );
.cr-name { .cr-name {
font-size: 48px; font-size: 48px;
font-weight: bold; font-weight: bold;
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
margin-bottom: 40px; margin-bottom: 40px;
} transition: all 0.5s ease;
.cr-intro {
font-size: 16px;
font-weight: 400;
color: #ccc;
text-indent: 32px;
line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
}
} }
img { .cr-intro {
width: 100%; font-size: 16px;
height: 100%; font-weight: 400;
color: #ccc;
text-indent: 32px;
line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
} }
} }
img {
width: 100%;
height: 100%;
}
} }
&:not(&:first-child) { &:not(&:first-child) {
margin-bottom: 30px; margin-bottom: 30px;
&:hover {
.cr-name {
opacity: 1;
}
}
.cr-name {
font-size: 18px;
opacity: 0;
}
.cr-intro {
display: none;
}
.img-container { .img-container {
height: 214px; height: 214px;
} }
......
...@@ -35,9 +35,11 @@ ...@@ -35,9 +35,11 @@
</el-form-item> </el-form-item>
<el-form-item label="权限" :label-width="formLabelWidth"> <el-form-item label="权限" :label-width="formLabelWidth">
<el-tree <el-tree
:data="permissionTree" ref="tree"
:data="dialogForm.permissionRespNodes"
show-checkbox show-checkbox
:props="props" :props="props"
node-key="id"
@check-change="handleCheckChange" @check-change="handleCheckChange"
> >
</el-tree> </el-tree>
...@@ -54,7 +56,12 @@ ...@@ -54,7 +56,12 @@
</template> </template>
<script> <script>
import { addRole, editRole, getPermissionTreeAll,getPermissionById } from "@/api/user"; import {
addRole,
editRole,
getPermissionTreeAll,
getPermissionById,
} from "@/api/user";
export default { export default {
name: "InfoEditDialog", name: "InfoEditDialog",
props: { props: {
...@@ -72,23 +79,24 @@ export default { ...@@ -72,23 +79,24 @@ export default {
if (this.dialogForm.id) { if (this.dialogForm.id) {
return "修改角色信息"; return "修改角色信息";
} else { } else {
return "添加新角色"; return "新建角色";
} }
}, },
}, },
watch: { watch: {
form: { form: {
handler: function (value) { handler: function (value) {
debugger // debugger
let that = this; let that = this;
that.dialogForm = JSON.parse(JSON.stringify(value)); that.dialogForm = JSON.parse(JSON.stringify(value));
// 编辑状态 // 编辑状态
if (that.dialogForm.id) { if (that.dialogForm.id) {
// 回填状态 // 回填状态
that.status = Boolean(Number(that.dialogForm.status)); that.status = Boolean(Number(that.dialogForm.status));
that.setPer();
// let perm = await getPermissionById // debugger
that.getPer() } else {
that.getDefaultTree();
} }
}, },
immediate: true, immediate: true,
...@@ -109,7 +117,7 @@ export default { ...@@ -109,7 +117,7 @@ export default {
status: false, status: false,
files: [], //文献文件 files: [], //文献文件
dialogVisible: false, dialogVisible: false,
permissionTree: [], // permissionTree: [],
props: { props: {
value: "id", value: "id",
label: "title", label: "title",
...@@ -118,12 +126,11 @@ export default { ...@@ -118,12 +126,11 @@ export default {
}, },
}; };
}, },
async created() { // async created() {
let res = await getPermissionTreeAll();
this.permissionTree = res.data // console.log(this.permissionTree);
console.log(this.permissionTree); // // console.log(res);
// console.log(res); // },
},
methods: { methods: {
handlePreview({ type, file }) { handlePreview({ type, file }) {
console.log(type, file); console.log(type, file);
...@@ -141,18 +148,34 @@ export default { ...@@ -141,18 +148,34 @@ export default {
let params = JSON.parse(JSON.stringify(this.dialogForm)); let params = JSON.parse(JSON.stringify(this.dialogForm));
// 修改状态 // 修改状态
params.status = this.status ? 1 : 0; params.status = this.status ? 1 : 0;
let checkedIds = this.$refs.tree.getCheckedKeys(true); //true代表只获取叶子结点
return;
console.log(checkedIds);
console.log(params);
travesePer(params.permissionRespNodes);
function travesePer(arr) {
// debugger
arr.map((item) => {
item.checked = checkedIds.indexOf(item.id) !== -1;
if (item.children && item.children.length > 0) {
travesePer(item.children);
}
});
}
console.log(params);
if (params.literatureId) { if (params.literatureId) {
let res = await editRole(params); // let res = await editRole(params);
if (res.code == 0) { // if (res.code == 0) {
this.$message.success("修改成功!"); // this.$message.success("修改成功!");
this.reload(); // this.reload();
} // }
} else { } else {
let res = await addRole(params); // let res = await addRole(params);
if (res.code == 0) { // if (res.code == 0) {
this.$message.success("添加成功!"); // this.$message.success("添加成功!");
this.reload(); // this.reload();
} // }
} }
}, },
reload() { reload() {
...@@ -174,11 +197,33 @@ export default { ...@@ -174,11 +197,33 @@ export default {
console.log(data, checked, indeterminate); console.log(data, checked, indeterminate);
}, },
async getPer(){ setPer() {
let res = await getPermissionById(this.dialogForm.id) let checkedIds = [];
debugger getCheckedIds(this.dialogForm.permissionRespNodes);
console.log(res); function getCheckedIds(arr) {
} if (arr.length > 0) {
arr.map((item) => {
if (item.checked) {
checkedIds.push(item.id);
} else if (item.children) {
getCheckedIds(item.children);
}
});
}
}
setTimeout(() => {
if (checkedIds.length > 0) {
this.$refs["tree"].setCheckedKeys(checkedIds);
}
}, 100);
},
async getDefaultTree() {
let res = await getPermissionTreeAll();
// this.permissionTree = res.data;
this.$set(this.dialogForm, "permissionRespNodes", res.data);
// debugger
},
}, },
}; };
</script> </script>
......
...@@ -25,7 +25,7 @@ export const title = [{ ...@@ -25,7 +25,7 @@ export const title = [{
}, },
{ {
prop: "remark", prop: "remark",
label: "描述", label: "备注",
columnAlign: 'center', columnAlign: 'center',
}, },
......
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
import TablePage from "@/components/Table/TablePage.vue"; import TablePage from "@/components/Table/TablePage.vue";
import TableOperation from "@/components/Table/TableOperation.vue"; import TableOperation from "@/components/Table/TableOperation.vue";
import { title, operates, operations } from "./config"; import { title, operates, operations } from "./config";
import { getRoleList } from "@/api/user"; import { getRoleList, getRoleById } from "@/api/user";
import InfoEditDialog from "./components/InfoEditDialog"; import InfoEditDialog from "./components/InfoEditDialog";
import SearchBar from "@/components/SearchBar" import SearchBar from "@/components/SearchBar";
export default { export default {
components: { components: {
...@@ -106,12 +106,10 @@ export default { ...@@ -106,12 +106,10 @@ export default {
], ],
drawerVisible: false, drawerVisible: false,
form: { form: {
name: "", //名称 name:'',
authors: "", //作者 remark:'',
date: "", //日期(出版年份、发布日期) status: 0,
source: "", //文献来源 permissionRespNodes:[]
status: false, //上下架状态
remark: "", //备注
}, },
}; };
}, },
...@@ -171,36 +169,21 @@ export default { ...@@ -171,36 +169,21 @@ export default {
} }
}, },
async handleOperation(value, row) { async handleOperation(value, row) {
console.log("handleOperation", value, row);
switch (value.type) { switch (value.type) {
case "add": case "add":
this.drawerVisible = true; this.drawerVisible = true;
break; this.form = {
case "view": status: 0,
if (row.files && row.files.length > 0 && row.files[0].url) { };
previewFile(row.files[0].url, row.name);
} else {
this.$message.info("暂无文献附件!");
}
break;
case "download":
if (row.files && row.files.length > 0 && row.files[0].url) {
let url = '/files'+row.files[0].url.split('files')[1]
downloadBlob(url, row.name, "pdf");
} else {
this.$message.info("暂无文献!");
}
break; break;
case "edit": case "edit":
this.form = row; const { id } = row;
let res = await getRoleById(id);
this.form = res.data;
this.drawerVisible = true; this.drawerVisible = true;
break; break;
case "delete": case "delete":
let deleteRes = await deleteLt([row.literatureId]);
if (deleteRes.code == 0) {
this.$message.success("删除成功!");
this.loadData();
}
break; break;
} }
}, },
...@@ -237,6 +220,7 @@ export default { ...@@ -237,6 +220,7 @@ export default {
this.drawerVisible = false; this.drawerVisible = false;
this.form = { this.form = {
status: true, status: true,
permissionRespNodes:[]
}; };
}, },
}, },
...@@ -253,7 +237,7 @@ export default { ...@@ -253,7 +237,7 @@ export default {
.pagination { .pagination {
margin: 16px; margin: 16px;
} }
.el-button{ .el-button {
margin-bottom: 22px; margin-bottom: 22px;
} }
::v-deep .el-card__header { ::v-deep .el-card__header {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论