提交 750e02b1 authored 作者: lidongxu's avatar lidongxu

Merge branch 'zhijian_app' into dev

...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</div> </div>
</div> </div>
<!-- 展示模式 --> <!-- 展示模式 -->
<div v-else>{{ row[col.prop] || '-' }}</div> <div v-else>{{ formatter(row, col, row[col.prop] || '-') }}</div>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
...@@ -120,6 +120,11 @@ const props = defineProps({ ...@@ -120,6 +120,11 @@ const props = defineProps({
useFill: { useFill: {
type: Boolean, type: Boolean,
default: false default: false
},
// 格式化表格某列内容
formatter: {
type: Function,
default: (row, col, cellValue) => cellValue
} }
}) })
const emit = defineEmits(['updateColumns', 'getTableList', 'updateShowSearch']) const emit = defineEmits(['updateColumns', 'getTableList', 'updateShowSearch'])
......
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
:visibleProps="visibleProps" :visibleProps="visibleProps"
:params="params" :params="params"
:useFill="useFill" :useFill="useFill"
:formatter="formatterFn"
@updateColumns="updateColumns" @updateColumns="updateColumns"
@getTableList="getTableList" @getTableList="getTableList"
@updateShowSearch="updateShowSearch" /> @updateShowSearch="updateShowSearch"
/>
</template> </template>
<script setup <script setup
...@@ -352,7 +354,7 @@ ...@@ -352,7 +354,7 @@
fill: true, fill: true,
width: 170, width: 170,
render: (_, row, col) => { render: (_, row, col) => {
// options 根据参考属性值来决定 // options 根据参考属性值来决定(计划值)
let list = splitAndFilter(row[col.referenceKey]) let list = splitAndFilter(row[col.referenceKey])
let isFullFlavor = false let isFullFlavor = false
// 如果数组里有"全系列"/"全口味"则修改数组 // 如果数组里有"全系列"/"全口味"则修改数组
...@@ -1125,6 +1127,15 @@ ...@@ -1125,6 +1127,15 @@
isLoading.value = false isLoading.value = false
} }
// 表格格式化指定列的数据内容
const formatterFn = (row, col, cellValue) => {
if (col.prop === 'actualPromotionFlavor') {
// 对数组内容格式化,为空时,显示'-'
return cellValue.length ? cellValue.join(',') : '-'
}
return cellValue
}
onMounted(() => { onMounted(() => {
updateColumns() updateColumns()
getTableList() getTableList()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论