Commit 7ae68605 authored by Mac's avatar Mac
parents c9c84034 ac549b8b
......@@ -153,6 +153,11 @@
<el-input type="text" size="small" v-model="addMsg.SortNum"
@keyup.native="checkInteger(addMsg,'SortNum')"></el-input>
</el-form-item>
<el-form-item label="分类编号">
<el-input type="text" size="small" v-model="addMsg.CateId">
<el-button slot="append" @click="CateDialog=true">选择分类</el-button>
</el-input>
</el-form-item>
</el-form>
</div>
</div>
......@@ -164,14 +169,24 @@
<el-dialog title="选择文件" :visible.sync="imgDialog" width="1240px">
<ChooseImg @SelectId="SelectId" :IsMultiple="true"></ChooseImg>
</el-dialog>
<!-- 选择分类 -->
<el-dialog title="选择分类" :visible.sync="CateDialog" width="600px">
<choiceMaterial ref="choiceMater"></choiceMaterial>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="CateDialog=false">取消</el-button>
<el-button type="primary" size="small" @click="getCkedMater">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import ChooseImg from "@/components/global/ChooseImg.vue";
import choiceMaterial from "@/components/common/choiceMaterial.vue";
export default {
components: {
ChooseImg
ChooseImg,
choiceMaterial
},
data() {
return {
......@@ -210,6 +225,7 @@
trigger: "change"
}]
},
CateDialog:false, //选择分类弹窗
};
},
methods: {
......@@ -404,7 +420,12 @@
delImgArr(index) {
this.addMsg.ImgList.splice(index, 1);
},
//选择分类
getCkedMater(){
var obj = this.$refs.choiceMater.getMaterial();
this.CateDialog=false;
this.addMsg.CateId = obj.Id;
}
},
mounted() {
this.getList();
......
<style>
.other_Style{
color:#409EFF;
}
</style>
<template>
<div>
<el-input placeholder="输入关键字进行过滤" size="small" style="width:99%;margin-bottom:10px;" v-model="filterText">
</el-input>
<el-tree :data="dataList" node-key="Id" ref="tree" :props="defaultProps" filter
:filter-node-method="filterNode" @check="handleCheck" :check-strictly="true" show-checkbox
:check-on-click-node="true">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :class="{'other_Style':data.children&&data.children.length>0}">{{ data.Name }}</span>
</span>
</el-tree>
</div>
</template>
<script>
export default {
data() {
return {
dataList: [],
activeName: "1",
filterText: '',
msg: {
Name: "", //页面名称
pageIndex: 1,
pageSize: 10,
},
defaultProps: {
children: 'children',
label: 'Name'
},
checkedObj: {}
};
},
created() {},
watch: {
filterText(val) {
this.$refs.tree.filter(val.trim());
}
},
methods: {
//获取所有菜单
getList() {
this.apipost("/api/Share/GetShareCategoryList", this.msg, res => {
if (res.data.resultCode == 1) {
var dataArray = res.data.data;
this.dataList = dataArray;
console.log(this.dataList,'dataList');
} else {
this.Error(res.data.message);
}
})
},
filterNode(value, data) {
if (!value) return true;
return data.Name.indexOf(value) !== -1;
},
//check单选
handleCheck(a, b) {
//a为传递给 data 属性的数组中该节点所对应的对象;b为树目前的选中状态对象
if (b.checkedKeys.length > 0) {
this.$refs.tree.setCheckedKeys([a.Id]);
this.checkedObj = a;
}
},
//父组件调用方法
getMaterial(){
return this.checkedObj;
},
},
mounted() {
this.getList();
}
};
</script>
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