|
@@ -1,53 +1,18 @@
|
|
|
|
+import { default } from '../../../../CABaggageData2.0/src/components/BackButton/index.vue';
|
|
<template>
|
|
<template>
|
|
<el-table
|
|
<el-table
|
|
v-el-table-infinite-scroll="load"
|
|
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"
|
|
:row-style="rowStyle"
|
|
:data="props.tableData"
|
|
: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"
|
|
:row-class-name="tableRowClassName"
|
|
:cell-class-name="cellClassName"
|
|
:cell-class-name="cellClassName"
|
|
>
|
|
>
|
|
@@ -59,26 +24,22 @@
|
|
:label="items.label"
|
|
:label="items.label"
|
|
:prop="items.key"
|
|
:prop="items.key"
|
|
:width="props.tableColumnProperty.width"
|
|
: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"
|
|
:show-overflow-tooltip="props.tableColumnProperty.showOverflowTooltip"
|
|
:align="items.align ? items.align : props.tableColumnProperty.align"
|
|
: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 : ''"
|
|
:label-class-name="items.lableClass ? items.lableClass : ''"
|
|
>
|
|
>
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- {{ scope.row[items.key] }}
|
|
|
|
|
|
+ <!-- 枚举值则为 items.key+'-enum' -->
|
|
|
|
+ {{ scope.row[items.key+'-enum'] ? scope.row[items.key+'-enum']:scope.row[items.key]}}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
v-if="props.tableBtnGroup.length"
|
|
v-if="props.tableBtnGroup.length"
|
|
label="操作"
|
|
label="操作"
|
|
:align="props.tableColumnProperty.align"
|
|
:align="props.tableColumnProperty.align"
|
|
|
|
+ :width="BtnGroupWidth"
|
|
>
|
|
>
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-button
|
|
<el-button
|
|
@@ -145,6 +106,7 @@ const props = defineProps({
|
|
headerAlign: "",
|
|
headerAlign: "",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ //操作栏按钮组
|
|
tableBtnGroup: {
|
|
tableBtnGroup: {
|
|
type: Array,
|
|
type: Array,
|
|
default: [
|
|
default: [
|
|
@@ -160,14 +122,22 @@ const props = defineProps({
|
|
type: Array,
|
|
type: Array,
|
|
default: [],
|
|
default: [],
|
|
},
|
|
},
|
|
|
|
+ //操作栏宽度
|
|
|
|
+ BtnGroupWidth:{
|
|
|
|
+ type:String,
|
|
|
|
+ default:""
|
|
|
|
+ }
|
|
});
|
|
});
|
|
-//向父组件传参 btnClick:点击按钮后 load 触发下拉加载
|
|
|
|
-const emit = defineEmits(["btnClick", "load"]);
|
|
|
|
|
|
+
|
|
|
|
+//向父组件传参 btnClick:点击按钮后 load 触发下拉加载 cellClass 修改某一行class的触发条件
|
|
|
|
+const emit = defineEmits(["btnClick", "load","cellClass"]);
|
|
|
|
+
|
|
//按钮点击index为当前行序号 row 为当前行 param按钮类型判断参数由父组件传过来
|
|
//按钮点击index为当前行序号 row 为当前行 param按钮类型判断参数由父组件传过来
|
|
const handleClick = (index: number, row: Object, param: number) => {
|
|
const handleClick = (index: number, row: Object, param: number) => {
|
|
emit("btnClick", index, row, param);
|
|
emit("btnClick", index, row, param);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+//行公共样式
|
|
const rowStyle = (row: Object, rowIndex: number) => {
|
|
const rowStyle = (row: Object, rowIndex: number) => {
|
|
let styleJson: Object = {
|
|
let styleJson: Object = {
|
|
height: "50px",
|
|
height: "50px",
|
|
@@ -185,16 +155,21 @@ const tableRowClassName = (row: Object, rowIndex: number) => {
|
|
return "";
|
|
return "";
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+//给某一格加class
|
|
|
|
+const cellClass=ref("")
|
|
const cellClassName = (row: Object) => {
|
|
const cellClassName = (row: Object) => {
|
|
- // console.log(row.row)
|
|
|
|
- // console.log(row.column)
|
|
|
|
- // console.log(row.rowIndex)
|
|
|
|
- // console.log(row.columnIndex)
|
|
|
|
|
|
+ emit("cellClass",row)
|
|
|
|
+ return cellClass.value;
|
|
};
|
|
};
|
|
//滚动分页加载
|
|
//滚动分页加载
|
|
const load = () => {
|
|
const load = () => {
|
|
emit("load", true);
|
|
emit("load", true);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+defineExpose({
|
|
|
|
+ cellClass
|
|
|
|
+})
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|