fix 80572

This commit is contained in:
赵霄
2024-01-11 15:20:09 +08:00
parent 9c657e26d7
commit b4862cfa01
2 changed files with 35 additions and 2 deletions
+33 -2
View File
@@ -1,5 +1,5 @@
<template>
<a-table v-bind="$attrs" v-on="$listeners">
<a-table v-bind="$attrs" v-on="$listeners" :row-class-name="lineCanExpand">
<!-- 如果插槽是作用域插槽将作用域插槽的props包装成对象传递给slot -->
<template v-for="(_, slotName) in $scopedSlots" :slot="slotName" slot-scope="text, record, index">
<slot :name="slotName" v-bind="{text, record, index}" />
@@ -183,6 +183,18 @@ export default {
type: Boolean,
required: false,
default: false
},
// 控制该行是否可展开的字段
lineCanExpandField: {
type: String,
required: false,
default: null
},
// 控制该行是否可以展开的字段值
lineCanExpandValue: {
type: [String, Number],
required: false,
default: null
}
},
data () {
@@ -232,6 +244,9 @@ export default {
} else {
arr[i] = true
}
} else if (this.lineCanExpandField && this.dataSource[i][this.lineCanExpandField] !== this.lineCanExpandValue) {
// 如果这行数据本身不需要填写
arr[i] = true
} else {
// 依赖的字段都没有填
arr[i] = false
@@ -266,6 +281,16 @@ export default {
} else {
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;
}
}
</style>
/deep/ .cannot-expend {
.ant-table-row-expand-icon {
display: none;
}
}
</style>
@@ -71,6 +71,8 @@
form-is-depend="evaluationFeedback"
:extra-form="extraForm"
:all-disabled="true"
line-can-expand-field="canAssignFlag"
:line-can-expand-value="1"
@change="handleTableChange">
<!--序号-->