fix 80572
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-table v-bind="$attrs" v-on="$listeners">
|
<a-table v-bind="$attrs" v-on="$listeners" :row-class-name="lineCanExpand">
|
||||||
<!-- 如果插槽是作用域插槽,将作用域插槽的props包装成对象传递给slot -->
|
<!-- 如果插槽是作用域插槽,将作用域插槽的props包装成对象传递给slot -->
|
||||||
<template v-for="(_, slotName) in $scopedSlots" :slot="slotName" slot-scope="text, record, index">
|
<template v-for="(_, slotName) in $scopedSlots" :slot="slotName" slot-scope="text, record, index">
|
||||||
<slot :name="slotName" v-bind="{text, record, index}" />
|
<slot :name="slotName" v-bind="{text, record, index}" />
|
||||||
@@ -183,6 +183,18 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
// 控制该行是否可展开的字段
|
||||||
|
lineCanExpandField: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
// 控制该行是否可以展开的字段值
|
||||||
|
lineCanExpandValue: {
|
||||||
|
type: [String, Number],
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -232,6 +244,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
arr[i] = true
|
arr[i] = true
|
||||||
}
|
}
|
||||||
|
} else if (this.lineCanExpandField && this.dataSource[i][this.lineCanExpandField] !== this.lineCanExpandValue) {
|
||||||
|
// 如果这行数据本身不需要填写
|
||||||
|
arr[i] = true
|
||||||
} else {
|
} else {
|
||||||
// 依赖的字段都没有填
|
// 依赖的字段都没有填
|
||||||
arr[i] = false
|
arr[i] = false
|
||||||
@@ -266,6 +281,16 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
lineCanExpand (record) {
|
||||||
|
console.log(this.lineCanExpandField, typeof this.lineCanExpandValue, record[this.lineCanExpandField] === this.lineCanExpandValue)
|
||||||
|
if (!this.lineCanExpandField || (!this.lineCanExpandValue && this.lineCanExpandValue !== 0 && this.lineCanExpandValue !== false)) {
|
||||||
|
return 'can-expend'
|
||||||
|
}
|
||||||
|
if (record[this.lineCanExpandField] === this.lineCanExpandValue) {
|
||||||
|
return 'can-expend'
|
||||||
|
}
|
||||||
|
return 'cannot-expend'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,4 +313,10 @@ export default {
|
|||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/deep/ .cannot-expend {
|
||||||
|
.ant-table-row-expand-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
+2
@@ -71,6 +71,8 @@
|
|||||||
form-is-depend="evaluationFeedback"
|
form-is-depend="evaluationFeedback"
|
||||||
:extra-form="extraForm"
|
:extra-form="extraForm"
|
||||||
:all-disabled="true"
|
:all-disabled="true"
|
||||||
|
line-can-expand-field="canAssignFlag"
|
||||||
|
:line-can-expand-value="1"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
|
|
||||||
<!--序号-->
|
<!--序号-->
|
||||||
|
|||||||
Reference in New Issue
Block a user