Explorar el Código

Table组件叶子节点修复bool值判断bug

Yue hace 2 años
padre
commit
a1e2a24403

+ 1 - 1
UI/VA.Vue_V1.0/src/components/table/table-partials/table-content/table-body/TableBodyTd.vue

@@ -27,7 +27,7 @@ const props = withDefaults(
 )
 
 const isLeaf = computed(() => {
-  return props.isLazy ? !!props.row[props.leafField] : false
+  return props.isLazy ? toBoolean(props.row[props.leafField]) : false
 })
 
 const tooltip = (col: Header) => {

+ 8 - 0
UI/VA.Vue_V1.0/src/core/utils/index.ts

@@ -47,6 +47,14 @@ export function parseTime(time: Date | string | number, pattern: string) {
   return time_str
 }
 
+export function toBoolean(val: any) {
+  val = val.toString()
+  if (val == "1" || val.toUpperCase() == "Y" || val.toUpperCase() == "TRUE") {
+    return true
+  }
+  return false
+}
+
 // 表单重置
 export function resetForm(this: any, refName: string) {
   if (this.$refs[refName]) {