Commit 7601d90b authored by 黄奎's avatar 黄奎

页面修改

parent e1b0ccd6
......@@ -38,8 +38,12 @@
type: Boolean,
default: false
},
//返回类型
id: [String, Array],
//默认选中值
defaultArray: {
type: Array,
required: true,
},
//节点Key
nodeKey: {
type: String,
......@@ -90,20 +94,25 @@
this.chooseArray = [lastItem];
}
this.setTreeCheckNode()
}
},
mounted() {
// 把传进来的参数转成数组处理
if (this.id) {
if (this.multiple && Array.isArray(this.id)) {
this.chooseArray = this.id
} else {
if (this.id != '') {
this.chooseArray.push(this.id)
},
defaultArray(val) {
if (val) {
if (this.defaultArray && Array.isArray(this.defaultArray) && this.defaultArray.length > 0) {
this.defaultArray.forEach(item => {
if (item != '') {
if (this.multiple) {
this.chooseArray.push(item)
} else {
this.chooseArray = [item];
}
}
})
}
this.setTreeCheckNode();
}
}
this.setTreeCheckNode();
},
mounted() {
},
methods: {
//全选
......
......@@ -11,8 +11,8 @@
class="col-6 q-pr-lg q-pb-lg" label="课程名称" :rules="[val => !!val || '请填写课程名称']" />
<div class="col-6 q-pr-lg q-pb-lg">
<selectTree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList'
:id.sync="returnString" nodeKey="CateId" :multiple="false" labelKey="CateName" childrenKey="ChildList"
tipText="课程分类" @getChild="getChild"></selectTree>
:defaultArray="defaultArray" nodeKey="CateId" :multiple="false" labelKey="CateName"
childrenKey="ChildList" tipText="课程分类" @getChild="getChild"></selectTree>
</div>
<div class="col-6 q-pb-lg upload-assiatant-box">
<q-uploader :style="{backgroundImage:'url(' + objOption.CoverImg + ')'}" flat hide-upload-btn max-files="1"
......@@ -22,8 +22,7 @@
</div>
<div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍
</div>
<q-editor :toolbar="toolbar" :fonts="fonts" v-model="objOption.CourseIntro" class="col-12"
:definitions="{bold: {label: 'Bold', icon: null, tip: 'My bold tooltip'}}" />
<editor :defaultMsg="objOption.CourseIntro" classStr="col-12"></editor>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
......@@ -42,15 +41,15 @@
queryCourseInfo,
} from '../../api/course/index'
import {
getToolBarConfig,
getFontConfig,
uploadConfig,
UploadSelfFile
} from '../../api/common/common'
import selectTree from '../common/select-tree'
import editor from '../common/editor'
export default {
components: {
selectTree
selectTree,
editor,
},
props: {
saveObj: {
......@@ -69,86 +68,16 @@
CateId: 0, //课程编号
},
optionTitle: "",
returnString: "",
defaultArray: [],
saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表
toolbar: [],
fonts: {},
}
},
mounted() {
this.initToolBar();
this.getCategorytree();
this.initObj()
},
methods: {
initToolBar() {
this.toolbar = [
[{
label: '对齐',
icon: this.$q.iconSet.editor.align,
fixedLabel: true,
list: 'only-icons',
options: ['left', 'center', 'right', 'justify']
}],
['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
[{
label: '格式',
icon: this.$q.iconSet.editor.formatting,
list: 'no-icons',
fixedLabel: true,
fixedIcon: true,
options: [
'p',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'code'
]
},
{
label: '字号',
icon: this.$q.iconSet.editor.fontSize,
fixedLabel: true,
fixedIcon: true,
list: 'no-icons',
options: [
'size-1',
'size-2',
'size-3',
'size-4',
'size-5',
'size-6',
'size-7'
]
},
{
label: '字体',
icon: this.$q.iconSet.editor.font,
fixedLabel: true,
fixedIcon: true,
list: 'no-icons',
options: [
'default_font',
'arial',
'arial_black',
'comic_sans',
'courier_new',
'impact',
'lucida_grande',
'times_new_roman',
'verdana'
]
},
'removeFormat'
],
['ordered', 'outdent', 'indent'],
];
this.fonts = getFontConfig();
},
getChild(obj) {
this.objOption.CateId = obj;
},
......@@ -168,6 +97,7 @@
},
//初始化表单
initObj() {
this.defaultArray = [];
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
......@@ -177,7 +107,7 @@
this.objOption.CourseName = res.Data.CourseName;
this.objOption.CourseIntro = res.Data.CourseIntro;
this.objOption.CateId = res.Data.CateId;
this.returnString = res.Data.CateId;
this.defaultArray.push(res.Data.CateId);
})
this.optionTitle = "修改课程信息"
} else {
......
<template>
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.RoleId==0?'新增角色信息':'修改角色信息'}}</div>
......@@ -18,14 +18,9 @@
</div>
<div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div>
<div class="row wrap">
<div class="q-pa-md q-gutter-sm">
<q-tree :nodes="TreeMenuList" node-key="MenuId" label-key="MenuName" children-key="SubList"
tick-strategy="leaf-filtered" default-expand-all :ticked.sync="checkMenuArray" no-connectors>
</q-tree>
</div>
<!-- <selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :id.sync="returnString"
nodeKey="MenuId" :multiple="false" labelKey="MenuName" childrenKey="SubList" tipText="课程分类"
@getChild="getChild"></selectTree> -->
<selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :defaultArray="returnString"
nodeKey="MenuId" :multiple="true" labelKey="MenuName" childrenKey="SubList" tipText="选择菜单"
@getChild="getChild"></selectTree>
</div>
</q-card-section>
<q-separator />
......@@ -65,7 +60,7 @@
RoleAuth: "", //角色权限
Status: 0, //状态(0-正常,1-禁用)},
},
returnString: "",
returnString: [],
optionTitle: "",
//菜单列表
TreeMenuList: [],
......@@ -79,8 +74,17 @@
this.initObj()
},
methods: {
getChild(obj) {
console.log("obj", obj);
getChild(menuArray) {
var tempStr = "";
if (menuArray && Array.isArray(menuArray) && menuArray.length > 0) {
menuArray.forEach(item => {
tempStr += "," + item;
})
}
if (tempStr != '') {
tempStr = tempStr.substring(1, tempStr.length);
}
this.objOption.RoleAuth = tempStr;
},
//获取菜单列表
queryMenuList() {
......@@ -92,6 +96,7 @@
},
//初始化表单
initObj() {
this.returnString = [];
if (this.saveObj && this.saveObj.RoleId > 0) {
queryRoleInfo({
RoleId: this.saveObj.RoleId
......@@ -101,7 +106,7 @@
this.objOption.RoleIntro = res.Data.RoleIntro;
this.objOption.RoleAuth = res.Data.RoleAuth;
this.objOption.Status = res.Data.Status;
this.checkMenuArray = res.Data.CheckMenuList;
this.returnString = res.Data.CheckMenuList;
})
this.optionTitle = "修改角色信息"
} else {
......@@ -120,16 +125,6 @@
},
//保存菜单
saveRole() {
var tempKeys = "";
if (this.checkMenuArray && this.checkMenuArray.length > 0) {
this.checkMenuArray.forEach(item => {
tempKeys += "," + item;
})
}
if (tempKeys && tempKeys != '') {
tempKeys = tempKeys.substring(1, tempKeys.length);
}
this.objOption.RoleAuth = tempKeys;
this.saveLoading = true
saveRoleInfo(this.objOption).then(res => {
this.saveLoading = false
......
......@@ -8,7 +8,7 @@
</div>
<div class="col-3">
<select-tree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList'
:id.sync="returnString" nodeKey="CateId" :multiple="true" labelKey="CateName" childrenKey="ChildList"
:defaultArray="returnString" nodeKey="CateId" :multiple="true" labelKey="CateName" childrenKey="ChildList"
tipText="课程分类" @getChild="getChild"></select-tree>
</div>
<div class="col-3">
......@@ -157,7 +157,7 @@
},
//课程分类树形列表
TreeCategoryList: [],
returnString: "", //返回字符串
returnString: [], //默认值
pageCount: 0,
isShowCourseForm: false,
courseObjOption: null,
......
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