| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <el-cascader
- :options="problemList"
- :show-all-levels="false"
- v-model="selectedOptions"
- popper-class="cascader_option_width"
- @change="handleChange">
- <template slot-scope="{ node, data }">
- <!-- <span v-if="data.sn"> {{ data.sn }}</span> -->
- <span>{{ data.label }}</span>
- </template>
- </el-cascader>
- </template>
- <script>
- export default {
- props: ['pblmDescList'],
- data(){
- return{
- selectedOptions: [],
- problemList: []
- }
- },
- mounted(){
- },
- methods:{
- handleChange(value) {
- this.problemList.forEach(ele=>{
- ele.children.forEach(element=>{
- if(element.id == value[1]){
- this.$emit('sendPblmsTypeIdHetong',element)
- }
- })
- })
- }
- },
- watch:{
- pblmDescList(val){
- console.log(this.pblmDescList)
- Object.assign(this.problemList,val)
- this.problemList.forEach((ele,index)=>{
- ele['label'] = ele.checkPoint
- ele['value'] = ele.id ? ele.id : index
- ele['children'] = ele.keyDicList
- ele.children.forEach(element=>{
- element['label'] = element.sn + ' ' + element.pblmDesc
- element['value'] = element.id
- })
- })
- }
- }
- }
- </script>
- <style>
- .cascader_option_width {
- max-width: 1000px;
- }
- </style>
|