Commit aecb9f1f by Jaxon

feat: 如果 tag 的值为空, 则不显示

style: 格式化
1 parent 3e5b0c95
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
@sort-change="sortChange"> @sort-change="sortChange">
<el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName" <el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName"
align="center" align="center"
:selectable="selectableFn"
type="selection" type="selection"
width="55" /> width="55"
:selectable="selectableFn" />
<el-table-column v-if="tableParams.singleSelectUniqueKey" <el-table-column v-if="tableParams.singleSelectUniqueKey"
align="center" align="center"
width="55"> width="55">
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
</el-table-column> </el-table-column>
<el-table-column v-if="hasNum" <el-table-column v-if="hasNum"
align="center" align="center"
label="序号"
type="index"
width="60px"
:index=" :index="
(index) => (index) =>
index index
...@@ -39,10 +42,7 @@ ...@@ -39,10 +42,7 @@
- 1) - 1)
* (pagination.pageSize ? pagination.pageSize : page.pageSize) * (pagination.pageSize ? pagination.pageSize : page.pageSize)
+ 1 + 1
" " />
label="序号"
type="index"
width="60px" />
<template v-for="(item, index) in tableParams.tableColumns"> <template v-for="(item, index) in tableParams.tableColumns">
<el-table-column v-if="item.children && item.children.length" <el-table-column v-if="item.children && item.children.length"
:key="`group-${index}`" :key="`group-${index}`"
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
:search-form="headSearchForm" :search-form="headSearchForm"
@handleTableHeadChange="handleTableHeadChange" /> @handleTableHeadChange="handleTableHeadChange" />
<img v-if="item.headerImgObj" <img v-if="item.headerImgObj"
:src="require('@/assets/icon-edit2.png')"
style=" style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
...@@ -65,22 +64,23 @@ ...@@ -65,22 +64,23 @@
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
" "
:src="require('@/assets/icon-edit2.png')"
@click="handleHeaderBatch(item)" /> @click="handleHeaderBatch(item)" />
<el-popover v-if="item.isPopConfig" <el-popover v-if="item.isPopConfig"
:content="item.isPopConfig.text"
placement="top-start" placement="top-start"
trigger="hover" trigger="hover"
width="200"> width="200"
:content="item.isPopConfig.text">
<template #reference> <template #reference>
<img :src="require('@/assets/mark.png')" <img style="
style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
width: 13.33px; width: 13.33px;
height: 13.33px; height: 13.33px;
vertical-align: middle; vertical-align: middle;
" /> "
:src="require('@/assets/mark.png')" />
</template> </template>
</el-popover> </el-popover>
</template> </template>
...@@ -102,13 +102,13 @@ ...@@ -102,13 +102,13 @@
:search-form="headSearchForm" :search-form="headSearchForm"
@handleTableHeadChange="handleTableHeadChange" /> @handleTableHeadChange="handleTableHeadChange" />
<img v-if="sub.headerImgObj" <img v-if="sub.headerImgObj"
:src="require('@/assets/icon-edit2.png')"
style=" style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle;" vertical-align: middle;"
:src="require('@/assets/icon-edit2.png')"
@click="handleHeaderBatch(sub)" /> @click="handleHeaderBatch(sub)" />
</template> </template>
<template #default="scope"> <template #default="scope">
...@@ -137,9 +137,13 @@ ...@@ -137,9 +137,13 @@
</span> </span>
</template> </template>
<template v-else-if="sub.useTag"> <template v-else-if="sub.useTag">
<el-tag :type="getSchemaTagOptions(sub, scope.row).type"> <div>
<el-tag v-if="hasValue(sub, scope.row)" :type="getSchemaTagOptions(sub, scope.row).type">
{{ getSchemaTagOptions(sub, scope.row).label }} {{ getSchemaTagOptions(sub, scope.row).label }}
</el-tag> </el-tag>
<span v-else></span>
</div>
</template> </template>
<template v-else-if="sub.formatter"> <template v-else-if="sub.formatter">
<span v-if="sub.html" v-html="sub.formatter(scope.row)" /> <span v-if="sub.html" v-html="sub.formatter(scope.row)" />
...@@ -195,29 +199,29 @@ ...@@ -195,29 +199,29 @@
:search-form="headSearchForm" :search-form="headSearchForm"
@handleTableHeadChange="handleTableHeadChange" /> @handleTableHeadChange="handleTableHeadChange" />
<img v-if="item.headerImgObj" <img v-if="item.headerImgObj"
:src="require('@/assets/icon-edit2.png')"
style=" style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle;" vertical-align: middle;"
:src="require('@/assets/icon-edit2.png')"
@click="handleHeaderBatch(item)" /> @click="handleHeaderBatch(item)" />
<el-popover v-if="item.isPopConfig" <el-popover v-if="item.isPopConfig"
:content="item.isPopConfig.text"
placement="top-start" placement="top-start"
trigger="hover" trigger="hover"
width="200"> width="200"
:content="item.isPopConfig.text">
<template #reference> <template #reference>
<img :src="require('@/assets/mark.png')" <img style="
style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
width: 13.33px; width: 13.33px;
height: 13.33px; height: 13.33px;
vertical-align: middle; vertical-align: middle;
" /> "
:src="require('@/assets/mark.png')" />
</template> </template>
</el-popover> </el-popover>
</template> </template>
...@@ -247,9 +251,13 @@ ...@@ -247,9 +251,13 @@
</span> </span>
</template> </template>
<template v-else-if="item.useTag"> <template v-else-if="item.useTag">
<el-tag :type="getSchemaTagOptions(item, scope.row).type"> <div>
<el-tag v-if="hasValue(item, scope.row)" :type="getSchemaTagOptions(item, scope.row).type">
{{ getSchemaTagOptions(item, scope.row).label }} {{ getSchemaTagOptions(item, scope.row).label }}
</el-tag> </el-tag>
<span v-else></span>
</div>
</template> </template>
<template v-else-if="item.formatter"> <template v-else-if="item.formatter">
<span v-if="item.html" v-html="item.formatter(scope.row)" /> <span v-if="item.html" v-html="item.formatter(scope.row)" />
...@@ -287,16 +295,16 @@ ...@@ -287,16 +295,16 @@
</el-table-column> </el-table-column>
</template> </template>
<el-table-column v-if="tableParams.tableOption" <el-table-column v-if="tableParams.tableOption"
label="操作"
:align="tableParams.tableOption.align || 'center'" :align="tableParams.tableOption.align || 'center'"
:fixed="tableParams.tableOption.fixed || 'right'" :fixed="tableParams.tableOption.fixed || 'right'"
label="操作"
:width="tableParams.tableOption.width || 'auto'"> :width="tableParams.tableOption.width || 'auto'">
<template #default="scope"> <template #default="scope">
<slot :index="scope.$index" <slot name="auth-button"
name="auth-button" :index="scope.$index"
:scope="scope.row" /> :scope="scope.row" />
<slot :index="scope.$index" <slot name="auth-button-other"
name="auth-button-other" :index="scope.$index"
:scope="scope.row" /> :scope="scope.row" />
</template> </template>
</el-table-column> </el-table-column>
...@@ -594,6 +602,10 @@ export default { ...@@ -594,6 +602,10 @@ export default {
methods: { methods: {
get, get,
hasValue(schema, row) {
const value = get(row, schema.prop);
return value !== null && value !== undefined && value !== "";
},
getSchemaTagOptions(schema, row) { getSchemaTagOptions(schema, row) {
if (!schema.tagOptions) { if (!schema.tagOptions) {
return {}; return {};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!