|
@@ -1,21 +1,77 @@
|
|
|
-import { default } from '../../../../CABaggageData2.0/src/components/BackButton/index.vue';
|
|
|
+import { default } from
|
|
|
+'../../../../CABaggageData2.0/src/components/BackButton/index.vue';
|
|
|
<template>
|
|
|
<el-table
|
|
|
v-el-table-infinite-scroll="load"
|
|
|
- :row-key="props.tableProperty.rowKey ? props.tableProperty.rowKey : tablePropertyDefault.rowKey"
|
|
|
+ :row-key="
|
|
|
+ props.tableProperty.rowKey
|
|
|
+ ? props.tableProperty.rowKey
|
|
|
+ : tablePropertyDefault.rowKey
|
|
|
+ "
|
|
|
:row-style="rowStyle"
|
|
|
:data="props.tableData"
|
|
|
- :height=" props.tableProperty.height ? props.tableProperty.height : tablePropertyDefault.height"
|
|
|
- :max-height=" props.tableProperty.maxHeight ? props.tableProperty.maxHeight : tablePropertyDefault.maxHeight"
|
|
|
- :stripe="props.tableProperty.stripe ? props.tableProperty.stripe : tablePropertyDefault.stripe"
|
|
|
- :border="props.tableProperty.border ? props.tableProperty.border : tablePropertyDefault.border"
|
|
|
- :highlight-current-row="props.tableProperty.highlightCurrentRow ? props.tableProperty.highlightCurrentRow : tablePropertyDefault.highlightCurrentRow"
|
|
|
- :header-cell-class-name=" props.tableProperty.headerRowClassName ? props.tableProperty.headerRowClassName : tablePropertyDefault.headerRowClassName"
|
|
|
- :tooltip-effect="props.tableProperty.tooltipEffect ? props.tableProperty.tooltipEffect : tablePropertyDefault.tooltipEffect"
|
|
|
- :show-summary="props.tableProperty.showSummary ? props.tableProperty.showSummary : tablePropertyDefault.showSummary"
|
|
|
+ :height="
|
|
|
+ props.tableProperty.height
|
|
|
+ ? props.tableProperty.height
|
|
|
+ : tablePropertyDefault.height
|
|
|
+ "
|
|
|
+ :max-height="
|
|
|
+ props.tableProperty.maxHeight
|
|
|
+ ? props.tableProperty.maxHeight
|
|
|
+ : tablePropertyDefault.maxHeight
|
|
|
+ "
|
|
|
+ :stripe="
|
|
|
+ props.tableProperty.stripe
|
|
|
+ ? props.tableProperty.stripe
|
|
|
+ : tablePropertyDefault.stripe
|
|
|
+ "
|
|
|
+ :border="
|
|
|
+ props.tableProperty.border
|
|
|
+ ? props.tableProperty.border
|
|
|
+ : tablePropertyDefault.border
|
|
|
+ "
|
|
|
+ :highlight-current-row="
|
|
|
+ props.tableProperty.highlightCurrentRow
|
|
|
+ ? props.tableProperty.highlightCurrentRow
|
|
|
+ : tablePropertyDefault.highlightCurrentRow
|
|
|
+ "
|
|
|
+ :header-cell-class-name="
|
|
|
+ props.tableProperty.headerRowClassName
|
|
|
+ ? props.tableProperty.headerRowClassName
|
|
|
+ : tablePropertyDefault.headerRowClassName
|
|
|
+ "
|
|
|
+ :tooltip-effect="
|
|
|
+ props.tableProperty.tooltipEffect
|
|
|
+ ? props.tableProperty.tooltipEffect
|
|
|
+ : tablePropertyDefault.tooltipEffect
|
|
|
+ "
|
|
|
+ :show-summary="
|
|
|
+ props.tableProperty.showSummary
|
|
|
+ ? props.tableProperty.showSummary
|
|
|
+ : tablePropertyDefault.showSummary
|
|
|
+ "
|
|
|
:row-class-name="tableRowClassName"
|
|
|
:cell-class-name="cellClassName"
|
|
|
>
|
|
|
+ <el-table-column v-if="isStatus" width="55">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="tableStatus">
|
|
|
+ <div
|
|
|
+ v-if="props.tableData[scope.$index].nodeState == '运行'"
|
|
|
+ class="status0"
|
|
|
+ >
|
|
|
+ <span class="icon"></span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-else-if="props.tableData[scope.$index].nodeState == '停止'"
|
|
|
+ class="status1"
|
|
|
+ >
|
|
|
+ <span class="icon"></span>
|
|
|
+ </div>
|
|
|
+ <div v-else class="status2"><span class="icon"></span></div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<!-- label-class-name 可通过 tableHeader中传入class来修改某一个或某一类表头的样式-->
|
|
|
<el-table-column
|
|
|
class="infinite-list-item"
|
|
@@ -24,15 +80,25 @@ import { default } from '../../../../CABaggageData2.0/src/components/BackButton/
|
|
|
:label="items.label"
|
|
|
:prop="items.key"
|
|
|
:width="props.tableColumnProperty.width"
|
|
|
- :sortable="items.sortable ? items.sortable : props.tableColumnProperty.sortable"
|
|
|
+ :sortable="
|
|
|
+ items.sortable ? items.sortable : props.tableColumnProperty.sortable
|
|
|
+ "
|
|
|
:show-overflow-tooltip="props.tableColumnProperty.showOverflowTooltip"
|
|
|
:align="items.align ? items.align : props.tableColumnProperty.align"
|
|
|
- :header-align="items.headerAlign ? items.headerAlign : props.tableColumnProperty.headerAlign"
|
|
|
+ :header-align="
|
|
|
+ items.headerAlign
|
|
|
+ ? items.headerAlign
|
|
|
+ : props.tableColumnProperty.headerAlign
|
|
|
+ "
|
|
|
:label-class-name="items.lableClass ? items.lableClass : ''"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
<!-- 枚举值则为 items.key+'-enum' -->
|
|
|
- {{ scope.row[items.key+'-enum'] ? scope.row[items.key+'-enum']:scope.row[items.key]}}
|
|
|
+ {{
|
|
|
+ scope.row[items.key + "-enum"]
|
|
|
+ ? scope.row[items.key + "-enum"]
|
|
|
+ : scope.row[items.key]
|
|
|
+ }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -123,14 +189,19 @@ const props = defineProps({
|
|
|
default: [],
|
|
|
},
|
|
|
//操作栏宽度
|
|
|
- BtnGroupWidth:{
|
|
|
- type:String,
|
|
|
- default:""
|
|
|
- }
|
|
|
+ BtnGroupWidth: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+ //自定义表头
|
|
|
+ isStatus: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
//向父组件传参 btnClick:点击按钮后 load 触发下拉加载 cellClass 修改某一行class的触发条件
|
|
|
-const emit = defineEmits(["btnClick", "load","cellClass"]);
|
|
|
+const emit = defineEmits(["btnClick", "load", "cellClass"]);
|
|
|
|
|
|
//按钮点击index为当前行序号 row 为当前行 param按钮类型判断参数由父组件传过来
|
|
|
const handleClick = (index: number, row: Object, param: number) => {
|
|
@@ -156,9 +227,9 @@ const tableRowClassName = (row: Object, rowIndex: number) => {
|
|
|
};
|
|
|
|
|
|
//给某一格加class
|
|
|
-const cellClass=ref("")
|
|
|
+const cellClass = ref("");
|
|
|
const cellClassName = (row: Object) => {
|
|
|
- emit("cellClass",row)
|
|
|
+ emit("cellClass", row);
|
|
|
return cellClass.value;
|
|
|
};
|
|
|
//滚动分页加载
|
|
@@ -167,9 +238,8 @@ const load = () => {
|
|
|
};
|
|
|
|
|
|
defineExpose({
|
|
|
- cellClass
|
|
|
-})
|
|
|
-
|
|
|
+ cellClass,
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
@@ -222,7 +292,41 @@ defineExpose({
|
|
|
color: #ffffff;
|
|
|
border: none;
|
|
|
}
|
|
|
-::v-deep.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{
|
|
|
- background-color: #F0F3F7;;
|
|
|
+::v-deep.el-table--striped
|
|
|
+ .el-table__body
|
|
|
+ tr.el-table__row--striped
|
|
|
+ td.el-table__cell {
|
|
|
+ background-color: #f0f3f7;
|
|
|
+}
|
|
|
+.tableStatus {
|
|
|
+ font-size: 14px;
|
|
|
+ .icon {
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ background: #2d67e3;
|
|
|
+ border-radius: 2px;
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: middle;
|
|
|
+ position: relative;
|
|
|
+ top: -2px;
|
|
|
+ }
|
|
|
+ .status0 {
|
|
|
+ position: relative;
|
|
|
+ top: 5px;
|
|
|
+ }
|
|
|
+ .status1 {
|
|
|
+ position: relative;
|
|
|
+ top: 5px;
|
|
|
+ .icon {
|
|
|
+ background-color: #afb4bf;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .status2 {
|
|
|
+ position: relative;
|
|
|
+ top: 5px;
|
|
|
+ .icon {
|
|
|
+ background-color: #eb2f3b;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|