Commit dea4e41f authored by 黄奎's avatar 黄奎

组件修改

parent 2d7d0c82
<template> <template>
<div style="max-width:300px"> <div style="width:300px" :id="id">
<q-select filled v-model="resultObj" :options="selectList" clearable @clear="clearData()" :label="tipText" <q-select filled v-model="resultObj" :options="selectList" clearable @clear="clearData()" :label="tipText"
:multiple="multiple" emit-value map-options> :multiple="multiple" emit-value map-options>
<template v-slot:option="scope"> <template v-slot:option="scope">
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
}, },
data() { data() {
return { return {
id: 'selectTree' + (Math.floor((Math.random() * 10000) + 1)),
//下拉框列表 //下拉框列表
selectList: [{ selectList: [{
value: "", value: "",
...@@ -87,9 +88,9 @@ ...@@ -87,9 +88,9 @@
this.defaultArray.forEach(item => { this.defaultArray.forEach(item => {
if (item != '') { if (item != '') {
if (this.multiple) { if (this.multiple) {
this.chooseTreeNodeArray.push(item) this.chooseTreeNodeArray.push(Number(item))
} else { } else {
this.chooseTreeNodeArray = [item]; this.chooseTreeNodeArray = [Number(item)];
} }
} }
}) })
...@@ -99,7 +100,15 @@ ...@@ -99,7 +100,15 @@
immediate: true immediate: true
}, },
resultObj(val) { resultObj(val) {
this.$emit('getChild', this.resultObj); var resultStr = "";
if (this.resultObj && this.resultObj.length > 0) {
if (this.multiple) {
resultStr = this.resultObj.toString();
} else {
resultStr = this.resultObj[0]
}
}
this.$emit('getChild', resultStr);
} }
}, },
mounted() {}, mounted() {},
...@@ -129,8 +138,10 @@ ...@@ -129,8 +138,10 @@
}); });
if (this.multiple) { if (this.multiple) {
this.resultObj.push(item.value); this.resultObj.push(item.value);
this.$forceUpdate();
} else { } else {
this.resultObj = [item.value]; this.resultObj = [item.value];
this.$forceUpdate();
} }
} }
}) })
...@@ -142,11 +153,13 @@ ...@@ -142,11 +153,13 @@
label: "" label: ""
}]; }];
} }
console.log("this.selectList ", this.selectList);
console.log("resultObj", this.resultObj);
}, },
//获取所有节点 //获取树中所有节点
findTreeNode(tree) { findTreeNode(tree) {
var temp = [];
var that = this; var that = this;
var temp = [];
//获取子节点 //获取子节点
var getChildNodes = function (tree) { var getChildNodes = function (tree) {
if (tree && tree.length > 0) { if (tree && tree.length > 0) {
......
...@@ -82,7 +82,12 @@ ...@@ -82,7 +82,12 @@
this.objOption.CourseIntro = obj; this.objOption.CourseIntro = obj;
}, },
getChild(obj) { getChild(obj) {
this.objOption.CateId = obj; // if (obj == "") {
// this.objOption.CateId = 0;
// } else
// {
// this.objOption.CateId = obj;
// }
}, },
uploadFile(files) { uploadFile(files) {
UploadSelfFile('course', files[0], res => { UploadSelfFile('course', files[0], res => {
......
...@@ -75,14 +75,9 @@ ...@@ -75,14 +75,9 @@
}, },
methods: { methods: {
getChild(menuArray) { getChild(menuArray) {
var tempStr = ""; var tempStr = "";
if (menuArray && Array.isArray(menuArray) && menuArray.length > 0) { if (menuArray && menuArray != '') {
menuArray.forEach(item => { tempStr = menuArray;
tempStr += "," + item;
})
}
if (tempStr != '') {
tempStr = tempStr.substring(1, tempStr.length);
} }
this.objOption.RoleAuth = tempStr; this.objOption.RoleAuth = tempStr;
}, },
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { import {
queryCoursePage, queryCoursePage,
...@@ -179,15 +178,10 @@ ...@@ -179,15 +178,10 @@
}); });
}, },
//分类改变 //分类改变
getChild(cateArray) { getChild(cateObj) {
var tempStr = ""; var tempStr = "";
if (cateArray && Array.isArray(cateArray) && cateArray.length > 0) { if (cateObj && cateObj != '') {
cateArray.forEach(item => { tempStr = cateObj;
tempStr += "," + item;
})
}
if (tempStr != '') {
tempStr = tempStr.substring(1, tempStr.length);
} }
this.msg.QCateIds = tempStr; this.msg.QCateIds = tempStr;
this.msg.pageIndex = 1; this.msg.pageIndex = 1;
......
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