提交 4a4bc7d6 编写于 作者: Neuromancer255's avatar Neuromancer255

动态代码表多数据回填

上级 b8a719cc
...@@ -175,13 +175,22 @@ export default class AppSpan extends Vue { ...@@ -175,13 +175,22 @@ export default class AppSpan extends Vue {
* @memberof AppSpan * @memberof AppSpan
*/ */
public setText(){ public setText(){
if(this.items.length>0){ if(this.items.length > 0){ // 判断代码表存在
this.currentItem= this.items.find((item:any)=>{ this.currentItem= this.items.find((item:any)=>{
return item.value == this.value; return item.value == this.value;
}); });
if(this.currentItem){ let valueArr = this.value.split(",");
if (this.currentItem) {
this.text = this.currentItem.text; this.text = this.currentItem.text;
}else{ } else if (valueArr.length > 1){ // 如果是多数据回显
valueArr.forEach((val: string) => {
this.items.forEach((item: any) => {
if (val === item.id) {
this.text = this.text + `${item.text},`;
}
});
});
} else {
// 不匹配显示原值,不存在显示空值 // 不匹配显示原值,不存在显示空值
if(this.value){ if(this.value){
this.text = this.value; this.text = this.value;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册