|
@@ -50,7 +50,8 @@
|
|
|
>
|
|
|
<template #default="{ row }">
|
|
|
<slot v-if="item.slot" :name='item.field' :row='row'></slot>
|
|
|
- <component v-else-if="item.component" :is="item.component" :propConfig="item.compConfig" :propValue="row" />
|
|
|
+ <component v-else-if="item.component" :is="item.component" :ref="item.prop+'Comp'" :propConfig="item.compConfig"
|
|
|
+ :propValue="row[item.field]" @onChange="onChange($event, row,item.field)" />
|
|
|
<template v-else>
|
|
|
<span v-if="item.isDetail" class="detail" @click="detail(row)">{{ row[item.field] }}</span>
|
|
|
<span v-else>{{ row[item.field] }}</span>
|
|
@@ -201,6 +202,26 @@ export default class ByTable extends VueViews {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //组件值的变化
|
|
|
+ onChange(val:any,row:any,code:string){
|
|
|
+ if(val && (val as any).constructor == Object){
|
|
|
+ for (const key in val) {
|
|
|
+ if (!row[key]) {
|
|
|
+ Vue.set(row, key, val[key])
|
|
|
+ } else {
|
|
|
+ row[key] = val[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(!row[code]){
|
|
|
+ Vue.set(row, code, val)
|
|
|
+ }else{
|
|
|
+ row[code] = val
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$emit('onChange',this.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
//获取表格选中的数据
|
|
|
getSelectData() {
|
|
|
let data: Array<any> = []
|
|
@@ -219,7 +240,10 @@ export default class ByTable extends VueViews {
|
|
|
}
|
|
|
|
|
|
setValue(data:Array<any>){
|
|
|
- this.value = data ? data : [];
|
|
|
+ // setTimeout(()=>{
|
|
|
+ this.value = data ? data : [];
|
|
|
+ // },100)
|
|
|
+ this.$forceUpdate()
|
|
|
}
|
|
|
|
|
|
getValue(){
|