Commit eb77f52a authored by 周远喜's avatar 周远喜

ok

parent 532b240f
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
export default { export default {
props: ['error'], props: ['error'],
// layout: 'blog' // you can set a custom layout for the error page // layout: 'blog' // you can set a custom layout for the error page
// watch:{ watch:{
// error(v){ error(v){
// debugger; debugger;
// if(v.statusCode==404){ if(v.statusCode==404){
// this.$router.push("/error/404"); this.$router.push("/error/404");
// } }
// } }
// } }
} }
</script> </script>
\ No newline at end of file
<template> <template>
<div> <div>
<ResourceSelect v-model="model" @on-change="change"></ResourceSelect> <ResourceSelect v-model="model" @on-change="change"></ResourceSelect>
<p>{{model}}</p> <p>{{model}}</p>
<p>{{text}}</p> <p>{{text}}</p>
<Button @click="set">赋值</Button> <Button @click="set">赋值</Button>
<ProductSelect v-model="product" @on-change="pchange"></ProductSelect> <ProductSelect v-model="product" @on-change="pchange"></ProductSelect>
<p>{{product}}</p> <p>{{product}}</p>
<Button @click="setp">赋值</Button> <Button @click="setp">赋值</Button>
</div> <p>
<TreeNode :data="result"></TreeNode>
</p>
<p>
<Tree :data="result"></Tree>
</p>
</div>
</template> </template>
<script> <script>
import ResourceSelect from "@/components/page/resourceSelect" import ResourceSelect from "@/components/page/resourceSelect";
export default { import TreeNode from "./treeNode";
components:{ResourceSelect}, export default {
name: '', components: { TreeNode },
data() { name: "",
return { data() {
model:[], return {
text:"", model: [],
product:"", result: [
{
title: "五二九纵",
id: 41,
expand: false,
selected: false,
checked: false,
upId: 0,
rootId: 0,
children: [
{
title: "气源分配器壳体",
id: 82,
expand: false,
selected: false,
checked: false,
upId: 0,
rootId: 0,
children: [
{
title: "truio",
id: 83,
expand: false,
selected: false,
checked: false,
upId: 82,
rootId: 0,
children: [],
isProduct: 1,
productId: 83,
classType: 0,
drawingNo: "34567"
},
{
title: "北京吉普",
id: 84,
expand: false,
selected: false,
checked: false,
upId: 82,
rootId: 0,
children: [],
isProduct: 1,
productId: 84,
classType: 0,
drawingNo: "BJJP-0001"
}
],
isProduct: 1,
productId: 82,
classType: 41,
drawingNo: "TY9-06-0803"
} }
],
isProduct: 0,
productId: 0,
classType: 0
}, },
methods:{ {
change(v,items){ title: "北京汽车",
this.text=items.map(u=>u.label).join('/'); id: 45,
}, expand: false,
set(){ selected: false,
this.model=[ "1", 5 ]; checked: false,
}, upId: 0,
pchange(v,item){ rootId: 0,
// this.text=items.map(u=>u.label).join('/'); children: [
if(item.isProduct==0){ {
this.$Message.error("层级不能选择") title: "北京吉普",
this.product="" id: 85,
expand: false,
selected: false,
checked: false,
upId: 0,
rootId: 0,
children: [],
isProduct: 1,
productId: 85,
classType: 45,
drawingNo: "BJJP-0001"
} }
}, ],
setp(){ isProduct: 0,
this.prodcut=8; productId: 0,
}, classType: 0
} }
],
text: "",
product: ""
};
},
methods: {
change(v, items) {
this.text = items.map(u => u.label).join("/");
},
set() {
this.model = ["1", 5];
},
pchange(v, item) {
// this.text=items.map(u=>u.label).join('/');
if (item.isProduct == 0) {
this.$Message.error("层级不能选择");
this.product = "";
}
},
setp() {
this.prodcut = 8;
} }
}
};
</script> </script>
<style lang="less" > <style lang="less" >
</style> </style>
\ No newline at end of file
<template>
<ul class="treeNode">
<li v-for="(li,i) in list" :key="i">
<span>{{li.title}}</span>
<treeNode v-if="li.children&&li.children.length>0" :data="li.children"></treeNode>
</li>
</ul>
</template>
<script>
export default {
name: "treeNode",
props: {
data: {
type: Array,
default: () => {
return [];
}
}
},
data() {
return {
list: []
};
},
created() {
this.list = this.data;
}
};
</script>
<style lang="less" >
.treeNode {
li {
line-height: 35px;
span:hover {
background-color: royalblue;
}
}
li > ul {
padding-left: 20px;
}
}
</style>
\ No newline at end of file
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