From 87e3d52c62233ad44bd7bac3f43e5348a2de4e94 Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期一, 25 十一月 2024 10:36:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/components/tidingsTable.vue | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 283 insertions(+), 0 deletions(-) diff --git a/src/views/components/tidingsTable.vue b/src/views/components/tidingsTable.vue new file mode 100644 index 0000000..8009d8e --- /dev/null +++ b/src/views/components/tidingsTable.vue @@ -0,0 +1,283 @@ +<template> + <div> + <div class="flex justify-between mb-[15px]"> + <div class="block mb-3 font-semibold fonts">娑堟伅涓績</div> + <div class="flex text-[12px]"> + <div + v-for="tab in tabs" + :key="tab.id" + :class="{ active: currentTabId === tab.id }" + class="tab relative" + @click="switchTab(tab.id)" + > + {{ tab.label }} + <div v-if="tab.num" class="w-[15px] h-[15px] num"> + {{ tab.num }} + </div> + </div> + </div> + </div> + <el-table + :data="tableData" + :header-cell-style="{ + background: '#F5F7FC', + color: '#454B5E', + fontSize: '12px' + }" + height="280" + max-height="280" + > + <el-table-column + v-for="column in currentTableHeaders" + :key="column.prop" + :align="column.align" + :label="column.label" + :min-width="column.minWidth" + :prop="column.prop" + > + <template v-if="column.slot === 'sort'" #default="scope"> + <div + :class=" + getSortClass( + (queryParams.pageNum - 1) * + queryParams.pageSize + + scope.$index + + 1 + ) + " + class="sort" + > + <span>{{ + (queryParams.pageNum - 1) * queryParams.pageSize + + scope.$index + + 1 + }}</span> + </div> + </template> + </el-table-column> + + <el-table-column + align="center" + class="relative" + fixed="right" + label="鎿嶄綔" + min-width="72" + > + <template #default="scope"> + <el-button + plain + size="small" + type="primary" + @click="handleDetail(scope.row)" + > + 鏌ョ湅</el-button + > + <div v-if="scope.row.isRead === '0'" class="viewRead"></div> + </template> + </el-table-column> + </el-table> + <pagination + v-show="total >= 0" + :limit="queryParams.pageSize" + :page="queryParams.pageNum" + :total="total" + @pagination="getList" + /> + </div> +</template> +<script> +import { getMessage, getMessageCount, getRead } from '@/api/message'; + +export default { + name: "Index", + data() { + return { + total: 0, + queryParams: { + pageNum: 1, + pageSize: 10 + }, + tableData: [], + tabs: [ + // { id: 'process', label: '閫氱煡鍏憡', num: '2' }, + { id: 'review', label: '瀹℃牳娑堟伅', num: '6' } + // { id: 'supervision', label: '鐫e姙娑堟伅', num: '9' }, + // { id: 'progress', label: '杩涘害娑堟伅', num: '7' } + ], + currentTabId: 0, + //閰嶇疆琛ㄦ牸琛ㄥご鏁版嵁 + currentTableHeaders: [ + { label: '鎺掑簭', prop: 'index', minWidth: 50, align: 'center', slot: 'sort' }, + { label: '鍙戝竷鍗曚綅', prop: 'commitDept', minWidth: 150, align: 'left' }, + { label: '鍐呭', prop: 'content', minWidth: 300, align: 'left' }, + { label: '鏃堕棿', prop: 'createTime', minWidth: 143, align: 'left' } + ] + } + }, + props: { + calculation: Array, + countExceptionProjectData:Object, + }, + created() { + this.currentTabId = this.tabs[0].id; // 榛樿閫変腑鐨則ab鐨刬d + this.getList(); + this.getMessageCountFun(); + }, + methods: { + + + async getList() { + const resp = await getMessage(this.queryParams); + if (resp.code === 200) { + this.total = resp.total; + this.tableData = resp.rows; + } + }, + + async getMessageCountFun() { + const resp = await getMessageCount(); + if (resp.code === 200) { + this.tabs = this.tabs.map((tab) => { + if (tab.label === '瀹℃牳娑堟伅') { + tab.num = resp.data.auditCount; + } + return tab; + }); + } + }, + + + switchTab(tabId) { + currentTabId = tabId; + }, + + getSortClass(index) { + if (index === 1) { + return 'actives'; + } else if (index === 2) { + return 'two'; + } else if (index === 3) { + return 'three'; + } else { + return ''; + } + }, + + async getReadFun(id) { + const resp = await this.getRead(id); + if (resp.code === 200) { + await this.getMessageCountFun(); + } + }, + handleDetail(row) { + this.getReadFun(row.id); + if (row.auditType === '2') { + this.$router.push({ + path: '/projectManage/nodeDetails', + query: { taskId: row.taskId, id: row.businessKey, auditType: row.auditType, disabled: 'true' } + }); + } else { + this.$router.push({ + path: '/projectManage/nodeDetails', + query: { taskId: row.taskId, id: row.businessKey, disabled: 'true' } + }); + } + } + + } +} +</script> + +<style lang="scss" scoped> +.tab { + padding: 8px; + border: 1px solid #dbdeea; + cursor: pointer; + width: 72px; +} + +.active { + border: 1px solid #3369ff; + color: #3369ff; +} + +.fonts { + font-size: 16px; + color: #212a40; + display: flex; + align-items: center; +} + +.num { + position: absolute; + z-index: 999; + top: -5px; + right: -5px; + border-radius: 50%; + background: #f63f41; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; +} + +::v-deep .el-table__row { + font-size: 12px; +} + +.sort { + width: 20px; + height: 20px; + border-radius: 50%; + background-color: #eaf0ff; + text-align: center; + color: #3369ff; +} + +.actives { + background-color: #3369ff; + color: #fff; +} + +.two { + background-color: #5c87ff; + color: #fff; +} + +.three { + background-color: #85a5ff; + color: #fff; +} + +::v-deep .el-pagination { + margin: -15px; + text-align: end; +} +::v-deep .el-pagination .btn-prev .el-icon, + ::v-deep .el-pagination .btn-next .el-icon +{ + display: inline; +} +.viewRead { + width: 4px; + height: 4px; + position: absolute; + z-index: 999; + top: 10px; + right: 20px; + border-radius: 50%; + background: #f63f41; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; +} + +.flex { + display: flex; + justify-content: space-between; + font-size: 12px; +} +</style> -- Gitblit v1.8.0