Browse Source

解决format放组件绑定行数据问题。

main
likunming 2 months ago
parent
commit
7c594a027c
  1. 2
      io.sc.platform.core.frontend/src/platform/components/grid/Td.vue
  2. 35
      io.sc.platform.core.frontend/src/platform/components/grid/TdContent.vue

2
io.sc.platform.core.frontend/src/platform/components/grid/Td.vue

@ -32,7 +32,7 @@
</template>
<!-- 普通单元格内容 -->
<TdContent v-else :value="props.col.value"></TdContent>
<TdContent v-else :value="props.col.value" :row="props.scope.row" :col="props.col"></TdContent>
</q-td>
</template>
</template>

35
io.sc.platform.core.frontend/src/platform/components/grid/TdContent.vue

@ -1,15 +1,24 @@
<template>
<template v-if="value && typeof value === 'object' && value.componentType">
<component :is="value.componentType" v-bind="value.attrs"></component>
</template>
<template v-else>
<span v-dompurify-html="!Tools.isEmpty(value) ? value : ''"></span>
</template>
<template v-if="!Tools.isEmpty(value) && typeof value === 'object' && value.componentType && value.bindModelValue">
<component
:is="value.componentType"
v-bind="value.attrs"
v-model="tools.dataFM.getRow(tools.table.rows, props.row[Constant.FIELD_NAMES.ROW_KEY], false)[col.name]"
></component>
</template>
<template v-else-if="!Tools.isEmpty(value) && typeof value === 'object' && value.componentType">
<component :is="value.componentType" v-bind="value.attrs"></component>
</template>
<template v-else>
<span v-dompurify-html="Tools.isUndefinedOrNull(value) ? '' : value"></span>
</template>
</template>
<script setup lang="ts">
import { Tools } from '@/platform';
import { Tools, inject } from '@/platform';
import { Constant, GridTools } from './ts/index';
const tools = <GridTools>inject('tools');
const props = defineProps({
value: {
type: [Object, String, Number],
@ -17,5 +26,17 @@ const props = defineProps({
return '';
},
},
col: {
type: Object,
default: () => {
return {};
},
},
row: {
type: Object,
default: () => {
return {};
},
},
});
</script>

Loading…
Cancel
Save