Browse Source

库存预警页面颜色显示

master
songguoqiang 6 months ago
parent
commit
4547dbe689
  1. 3
      src/components/Table/src/Table.vue
  2. 46
      src/views/eam/report/itemWarning/index.vue
  3. 18
      src/views/eam/report/itemWarning/itemWarning.data.ts

3
src/components/Table/src/Table.vue

@ -53,6 +53,7 @@ export default defineComponent({
type: Array as PropType<Recordable[]>, type: Array as PropType<Recordable[]>,
default: () => [] default: () => []
}, },
stripe: propTypes.bool.def(true),
searchTableSelectionsList:[],// searchTableSelectionsList:[],//
}, },
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'], emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'],
@ -307,7 +308,7 @@ export default defineComponent({
onSelection-change={selectionChange} onSelection-change={selectionChange}
onSort-change={sortChange} onSort-change={sortChange}
{...unref(getBindValue)} {...unref(getBindValue)}
stripe stripe={unref(getProps).stripe}
> >
{{ {{
default: () => rnderTableColumn(), default: () => rnderTableColumn(),

46
src/views/eam/report/itemWarning/index.vue

@ -10,7 +10,7 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table :columns="tableColumns" :stripe="false" :row-style="tableRowClassName" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"> v-model:sort="tableObject.sort">
@ -254,6 +254,22 @@
templateTitle: '物料导入模版.xlsx' templateTitle: '物料导入模版.xlsx'
}) })
function tableRowClassName({row, rowIndex}) {
console.log(row.classification);
if (row.classification =='A') {
return {
background: 'red !important'
};
}
if (row.classification =='B') {
return {
background: 'yellow !important'
};
}
return '';
}
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
@ -274,9 +290,31 @@
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-table--enable-row-transition .el-table__body td.el-table__cell{ // ::v-deep .el-table--enable-row-transition .el-table__body td.el-table__cell{
transition: background-color .25s ease !important; // transition: background-color .25s ease !important;
// background: red !important;
// color: white !important;
// }
::v-deep .el-table .red-row {
background: red !important; background: red !important;
color: white !important;
} }
::v-deep .el-table .yellow-row {
background: yellow !important;
}
::v-deep .el-table tr > red-row{
background: red !important;
}
// ::v-deep .el-table .red-row {
// --el-table-tr-bg-color: var(--el-color-warning-light-9) !important;
// }
// ::v-deep .el-table .yellow-row {
// --el-table-tr-bg-color: var(--el-color-success-light-9) !important;
// }
// ::v-deep .el-table--enable-row-transition .el-table__body td.el-table__cell .yellow-row {
// background: yellow !important;
// }
</style> </style>

18
src/views/eam/report/itemWarning/itemWarning.data.ts

@ -27,7 +27,6 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
table: { table: {
width: 180, width: 180,
fixed: 'left'
}, },
}, },
{ {
@ -187,13 +186,12 @@ export const Item = useCrudSchemas(reactive<CrudSchema[]>([
width: 180 width: 180
}, },
}, },
{ // {
label: '操作', // label: '操作',
field: 'action', // field: 'action',
isForm: false, // isForm: false,
table: { // table: {
width: 150, // width: 150,
fixed: 'right' // }
} // }
}
])) ]))

Loading…
Cancel
Save