提交 dbc12279 编写于 作者: KK's avatar KK

修复树多选值异常

上级 077014a6
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="tree-partition" v-if="valueNodes.length > 0" ></div> <div class="tree-partition" v-if="valueNodes.length > 0" ></div>
<ion-list> <ion-list>
<template v-for="item in rootNodes"> <template v-for="item in rootNodes">
<ion-item :key="item.id" @click="click_node(item)"> <ion-item :key="item.srfkey" @click="click_node(item)">
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
<ion-icon class="tree-icon" slot="end" name="chevron-forward-outline"></ion-icon> <ion-icon class="tree-icon" slot="end" name="chevron-forward-outline"></ion-icon>
</ion-item> </ion-item>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<!-- 树视图 --> <!-- 树视图 -->
<ion-list v-if="viewType == 'DEMOBTREEVIEW'"> <ion-list v-if="viewType == 'DEMOBTREEVIEW'">
<template v-for="item in valueNodes"> <template v-for="item in valueNodes">
<ion-item :key="item.id"> <ion-item :key="item.srfkey">
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
</ion-item> </ion-item>
</template> </template>
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
<!-- 树多选 --> <!-- 树多选 -->
<ion-list v-else-if="viewType == 'DEMOBPICKUPTREEVIEW' && !isSingleSelect"> <ion-list v-else-if="viewType == 'DEMOBPICKUPTREEVIEW' && !isSingleSelect">
<template v-for="item in valueNodes"> <template v-for="item in valueNodes">
<ion-item :key="item.id"> <ion-item :key="item.srfkey">
<ion-checkbox color="secondary" v-if="viewType == 'DEMOBPICKUPTREEVIEW' && !isSingleSelect" :checked="item.selected" :value="item.id" slot="end" @ionChange="onChecked"></ion-checkbox> <ion-checkbox color="secondary" v-if="viewType == 'DEMOBPICKUPTREEVIEW' && !isSingleSelect" :checked="item.selected" :value="item.srfkey" slot="end" @ionChange="onChecked"></ion-checkbox>
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
</ion-item> </ion-item>
</template> </template>
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
<!-- 树单选 --> <!-- 树单选 -->
<ion-radio-group v-else-if="viewType == 'DEMOBPICKUPTREEVIEW' && isSingleSelect" :value="selectedValue" > <ion-radio-group v-else-if="viewType == 'DEMOBPICKUPTREEVIEW' && isSingleSelect" :value="selectedValue" >
<template v-for="item in valueNodes"> <template v-for="item in valueNodes">
<ion-item :key="item.id" @click="onSimpleSelChange(item)"> <ion-item :key="item.srfkey" @click="onSimpleSelChange(item)">
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
<ion-radio slot="end" :checked="item.selected" :value="item.id"></ion-radio> <ion-radio slot="end" :checked="item.selected" :value="item.srfkey"></ion-radio>
</ion-item> </ion-item>
</template> </template>
</ion-radio-group> </ion-radio-group>
......
...@@ -786,11 +786,11 @@ ${P.getCtrlCode(childCtrl, 'CONTROL.html').code} ...@@ -786,11 +786,11 @@ ${P.getCtrlCode(childCtrl, 'CONTROL.html').code}
} }
let { value } = detail; let { value } = detail;
this.valueNodes.forEach((item: any, index: number) => { this.valueNodes.forEach((item: any, index: number) => {
if (Object.is(item.id, value)) { if (Object.is(item.srfkey, value)) {
if (detail.checked) { if (detail.checked) {
this.selectedNodes.push(this.valueNodes[index]); this.selectedNodes.push(this.valueNodes[index]);
} else { } else {
this.selectedNodes.splice(this.selectedNodes.findIndex((i: any) => i.value === item.value), 1) this.selectedNodes.splice(this.selectedNodes.findIndex((i: any) => i.srfkey === item.srfkey), 1)
} }
} }
}); });
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册