|
|
@@ -71,14 +71,20 @@
|
|
|
<!-- 列表 -->
|
|
|
<ContentWrap ref="tableContainerRef">
|
|
|
<el-table ref="tableRef" v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column label="施工状态" align="center" prop="rdStatus" :width="columnWidths.rdStatus">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :type="DICT_TYPE.PMS_PROJECT_RD_STATUS" :value="scope.row.rdStatus" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="施工周期(D)" align="center" prop="period" :width="columnWidths.projectDeptName"/>
|
|
|
<el-table-column label="项目部" align="center" prop="projectDeptName" :width="columnWidths.projectDeptName"/>
|
|
|
<el-table-column label="队伍" align="center" prop="deptName" :width="columnWidths.deptName"/>
|
|
|
- <el-table-column label="甲方" align="center" prop="manufactureName" :width="columnWidths.manufactureName"/>
|
|
|
+
|
|
|
<el-table-column label="井号" align="center" prop="wellName" :width="columnWidths.wellName">
|
|
|
<template #default="scope">
|
|
|
<el-link
|
|
|
type="primary"
|
|
|
- @click="handleWellNameClick(scope.row.wellName)"
|
|
|
+ @click="handleWellNameClick(scope.row.taskId)"
|
|
|
:underline="false"
|
|
|
>
|
|
|
{{ scope.row.wellName }}
|
|
|
@@ -103,7 +109,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
+ <el-table-column label="甲方" align="center" prop="manufactureName" :width="columnWidths.manufactureName"/>
|
|
|
<!--
|
|
|
<el-table-column label="操作" align="center" min-width="120px" fixed="right">
|
|
|
<template #default="scope">
|
|
|
@@ -132,7 +138,7 @@
|
|
|
:total="total"
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
+ @pagination="handlePagination"
|
|
|
/>
|
|
|
</ContentWrap>
|
|
|
|
|
|
@@ -148,7 +154,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
|
|
import download from '@/utils/download'
|
|
|
import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
|
|
|
import IotRdDailyReportForm from './IotRdDailyReportForm.vue'
|
|
|
-import {DICT_TYPE} from "@/utils/dict";
|
|
|
+import {DICT_TYPE, getDictLabel} from "@/utils/dict";
|
|
|
import { ref, reactive, onMounted, computed } from 'vue'
|
|
|
import DeptTree2 from "@/views/pms/iotrhdailyreport/DeptTree2.vue";
|
|
|
|
|
|
@@ -159,7 +165,6 @@ const message = useMessage() // 消息弹窗
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const { push } = useRouter() // 路由跳转
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
-const list = ref<IotRdDailyReportVO[]>([]) // 列表的数据
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
@@ -211,6 +216,10 @@ const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
|
const rootDeptId = ref(163)
|
|
|
|
|
|
+// 响应式数据
|
|
|
+const allList = ref<IotRdDailyReportVO[]>([]) // 存储所有数据
|
|
|
+const list = ref<IotRdDailyReportVO[]>([]) // 存储当前页数据
|
|
|
+
|
|
|
// 表格引用
|
|
|
const tableRef = ref()
|
|
|
// 表格容器引用
|
|
|
@@ -239,6 +248,7 @@ const getWorkloadByUnit = (items, unit) => {
|
|
|
// 列宽度配置
|
|
|
const columnWidths = ref({
|
|
|
id: '80px',
|
|
|
+ rdStatus: '120px', // 施工状态列默认宽度
|
|
|
projectDeptName: '120px',
|
|
|
contractName: '120px',
|
|
|
deptName: '120px',
|
|
|
@@ -303,6 +313,12 @@ const calculateColumnWidths = () => {
|
|
|
newWidths[key] = `${finalWidth}px`;
|
|
|
};
|
|
|
|
|
|
+ // 计算施工状态列宽度(使用字典标签文本计算)
|
|
|
+ calculateColumnWidth('rdStatus', '施工状态', (row: any) => {
|
|
|
+ // 用字典标签(如"完工")而非原始编码(如"wg")计算宽度
|
|
|
+ return getDictLabel(DICT_TYPE.PMS_PROJECT_RD_STATUS, row.rdStatus) || row.rdStatus;
|
|
|
+ });
|
|
|
+
|
|
|
// 计算各列宽度
|
|
|
calculateColumnWidth('projectDeptName', '项目部', (row: any) => row.projectDeptName);
|
|
|
calculateColumnWidth('deptName', '队伍', (row: any) => row.deptName);
|
|
|
@@ -330,8 +346,12 @@ const getList = async () => {
|
|
|
loading.value = true
|
|
|
try {
|
|
|
const data = await IotRdDailyReportApi.statistics(queryParams)
|
|
|
- list.value = data
|
|
|
- // total.value = data.total
|
|
|
+ // 存储所有数据
|
|
|
+ allList.value = data
|
|
|
+ // 计算总条数
|
|
|
+ total.value = data.length
|
|
|
+ // 执行前端分页
|
|
|
+ handleFrontendPagination()
|
|
|
// 获取数据后计算列宽
|
|
|
nextTick(() => {
|
|
|
calculateColumnWidths();
|
|
|
@@ -342,14 +362,15 @@ const getList = async () => {
|
|
|
}
|
|
|
|
|
|
/** 井号点击操作 */
|
|
|
-const handleWellNameClick = (wellName: string) => {
|
|
|
- if (!wellName) return
|
|
|
+const handleWellNameClick = (taskId: number) => {
|
|
|
+ if (!taskId) return
|
|
|
|
|
|
// 跳转到日报列表页面,传递井号参数
|
|
|
push({
|
|
|
name: 'IotRdDailyReport',
|
|
|
query: {
|
|
|
- wellName: wellName
|
|
|
+ // wellName: wellName
|
|
|
+ taskId: taskId
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -364,6 +385,16 @@ const handleDeptNodeClick = async (row) => {
|
|
|
await getList()
|
|
|
}
|
|
|
|
|
|
+/** 前端分页处理 */
|
|
|
+const handleFrontendPagination = () => {
|
|
|
+ const { pageNo, pageSize } = queryParams
|
|
|
+ const startIndex = (pageNo - 1) * pageSize
|
|
|
+ const endIndex = startIndex + pageSize
|
|
|
+
|
|
|
+ // 对全部数据进行分页切片
|
|
|
+ list.value = allList.value.slice(startIndex, endIndex)
|
|
|
+}
|
|
|
+
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
queryParams.pageNo = 1
|
|
|
@@ -376,6 +407,14 @@ const resetQuery = () => {
|
|
|
handleQuery()
|
|
|
}
|
|
|
|
|
|
+/** 分页事件处理 */
|
|
|
+const handlePagination = (pagination: any) => {
|
|
|
+ queryParams.pageNo = pagination.page
|
|
|
+ queryParams.pageSize = pagination.limit
|
|
|
+ // 使用前端分页,不重新调用接口
|
|
|
+ handleFrontendPagination()
|
|
|
+}
|
|
|
+
|
|
|
/** 添加/修改操作 */
|
|
|
const formRef = ref()
|
|
|
const openForm = (type: string, id?: number) => {
|
|
|
@@ -458,6 +497,14 @@ onUnmounted(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 监听查询参数变化,实现前端分页
|
|
|
+watch(
|
|
|
+ [() => queryParams.pageNo, () => queryParams.pageSize],
|
|
|
+ () => {
|
|
|
+ handleFrontendPagination()
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
// 监听列表数据变化重新计算列宽
|
|
|
watch(list, () => {
|
|
|
nextTick(calculateColumnWidths)
|