|
|
@@ -39,6 +39,15 @@
|
|
|
class="!w-240px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="工程名称" prop="projectName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.projectName"
|
|
|
+ placeholder="请输入工程名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="getList"
|
|
|
+ class="!w-240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
|
|
|
<el-form-item label="部门" prop="relateDepartment">
|
|
|
<DeptSelect
|
|
|
@@ -48,10 +57,10 @@
|
|
|
class="!w-240px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </div>
|
|
|
+<!-- </div>
|
|
|
|
|
|
- <!-- 区域和时间查询部分 -->
|
|
|
- <div class="flex flex-wrap items-start gap-x-2">
|
|
|
+ <!– 区域和时间查询部分 –>
|
|
|
+ <div class="flex flex-wrap items-start gap-x-2">-->
|
|
|
<el-form-item label="区域" prop="equipDistrict">
|
|
|
<AreaSelect
|
|
|
v-model="queryParams.equipDistrict"
|
|
|
@@ -151,18 +160,25 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 操作按钮 -->
|
|
|
- <div class="flex justify-center mt-3">
|
|
|
+ <div class="flex justify-between mt-3">
|
|
|
<el-form-item class="mb-0">
|
|
|
- <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
+ <el-button type="primary" @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item class="mb-0">
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
+ plain
|
|
|
v-if="source === 'pressure'"
|
|
|
@click="handleBatchSchedule"
|
|
|
- :disabled="selectedRows.length === 0"
|
|
|
+ :disabled="selectedDetailRows.length === 0"
|
|
|
>
|
|
|
<Icon icon="ep:calendar" class="mr-5px" /> 批量排期
|
|
|
</el-button>
|
|
|
+ <el-button type="success" @click="handleExport">
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
@@ -170,7 +186,7 @@
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
<ContentWrap>
|
|
|
- <el-table
|
|
|
+<!-- <el-table
|
|
|
v-loading="loading"
|
|
|
:data="list"
|
|
|
stripe
|
|
|
@@ -185,7 +201,7 @@
|
|
|
<PipelineDetailList :row="props.row" @selection-change="handleChildSelectionChange"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-<!-- <el-table-column v-if="source === 'pressure'" type="selection" width="30" />-->
|
|
|
+<!– <el-table-column v-if="source === 'pressure'" type="selection" width="30" />–>
|
|
|
<el-table-column
|
|
|
label="区域"
|
|
|
align="center"
|
|
|
@@ -202,7 +218,7 @@
|
|
|
/>
|
|
|
<el-table-column label="使用单位名称 " align="center" prop="unitName" min-width="150" />
|
|
|
<el-table-column label="使用单位地址" align="center" prop="pipeAddress" min-width="150" />
|
|
|
- <!-- 法定检验 -->
|
|
|
+ <!– 法定检验 –>
|
|
|
<el-table-column
|
|
|
label="定期检验"
|
|
|
align="center"
|
|
|
@@ -217,7 +233,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- 年度检查 -->
|
|
|
+ <!– 年度检查 –>
|
|
|
<el-table-column
|
|
|
label="年度检查"
|
|
|
align="center"
|
|
|
@@ -235,19 +251,19 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- 使用单位联系人 -->
|
|
|
+ <!– 使用单位联系人 –>
|
|
|
<el-table-column label="约检联系人" align="center" prop="contactPerson" min-width="140">
|
|
|
<template #default="{ row }">
|
|
|
<div>{{ row.contact || '无' }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- 使用单位联系电话 -->
|
|
|
+ <!– 使用单位联系电话 –>
|
|
|
<el-table-column label="约检联系电话" align="center" prop="contactPhone" min-width="140">
|
|
|
<template #default="{ row }">
|
|
|
<div>{{ row.contactPhone || '无' }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- 操作 -->
|
|
|
+ <!– 操作 –>
|
|
|
<el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" size="small" @click="handleSchedule(scope.row)">
|
|
|
@@ -258,6 +274,101 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ </el-table>-->
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ ref="mainTableRef"
|
|
|
+ :data="list"
|
|
|
+ border
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
+ :row-key="(row) => row.id"
|
|
|
+ :row-class-name="getMainRowClassName"
|
|
|
+ @row-click="handleMainRowClick"
|
|
|
+ @expand-change="handleExpandChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="40"/>
|
|
|
+ <el-table-column type="expand">
|
|
|
+ <template #default="props">
|
|
|
+ <el-table
|
|
|
+ :data="props.row.pipes" border
|
|
|
+ :header-cell-style="{background: '#f5f7fa', color: '#606266'}"
|
|
|
+ :ref="(el) => setDetailTableRef(el, props.row.id)"
|
|
|
+ @selection-change="(selection) => handleDetailSelectionChange(selection, props.row)"
|
|
|
+ :row-class-name="getRowClassName"
|
|
|
+ class="inner-table"
|
|
|
+ @row-click="handleRowClick"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="40"/>
|
|
|
+ <el-table-column type="index" label="序号" width="60" align="center"/>
|
|
|
+ <el-table-column label="工程号" prop="projectNo" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="管道编号" prop="pipeNo" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="注册代码" prop="pipeRegCode" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="管道名称" prop="pipeName" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="最近定期检查" prop="nextLegalCheckDateDetail" align="center" min-width="150" sortable>
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.nextLegalCheckDate !== null && row.nextLegalCheckDateDetail > 0" class="text-xs text-gray-500">
|
|
|
+ {{ formatDate(row.nextLegalCheckDateDetail, 'YYYY-MM-DD') }}
|
|
|
+ <div v-if="row.planLegalCheckDate" class="text-xs text-[#2D5FBD]">
|
|
|
+ (排期时间:{{ formatDate(row.planLegalCheckDate, 'YYYY-MM-DD') }})
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 最近年度检查-->
|
|
|
+ <el-table-column label="最近年度检查" prop="nextYearCheckDateDetail" align="center" min-width="150" sortable>
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.nextYearCheckDateDetail !== null && row.nextYearCheckDateDetail > 0" class="text-xs text-gray-500">
|
|
|
+ {{ formatDate(row.nextYearCheckDateDetail, 'YYYY-MM-DD') }}
|
|
|
+ <div v-if="row.planYearCheckDate" class="text-xs text-[#2D5FBD]">
|
|
|
+ (排期时间:{{ formatDate(row.planYearCheckDate, 'YYYY-MM-DD') }})
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column type="index" label="序号" width="60" align="center"/>
|
|
|
+ <el-table-column
|
|
|
+ label="区域"
|
|
|
+ align="center"
|
|
|
+ prop="equipDistrictName"
|
|
|
+ min-width="80"
|
|
|
+ sortable="custom"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="街道"
|
|
|
+ align="center"
|
|
|
+ prop="equipStreetName"
|
|
|
+ min-width="100"
|
|
|
+ sortable="custom"
|
|
|
+ />
|
|
|
+ <el-table-column label="使用单位名称 " align="center" prop="unitName" min-width="150" />
|
|
|
+ <el-table-column label="管道使用地址" align="center" prop="pipeAddress" min-width="150" />
|
|
|
+ <el-table-column label="工程号" prop="projectNo" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="工程名称" prop="projectName" align="center" min-width="150"/>
|
|
|
+ <el-table-column label="定期检验" prop="nextLegalCheckDate" align="center" min-width="150" sortable="custom">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{formatDate(row.nextLegalCheckDate, 'YYYY-MM-DD')}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="年度检查" prop="nextYearCheckDate" align="center" min-width="150" sortable="custom">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{formatDate(row.nextYearCheckDate, 'YYYY-MM-DD')}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="管道数量" prop="pipeCount" align="center" min-width="100"/>
|
|
|
+ <el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" size="small" @click.stop="handleSchedule(scope.row)">
|
|
|
+ 计划排期
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" size="small" @click.stop="handleEdit(scope.row)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 分页 -->
|
|
|
<Pagination
|
|
|
@@ -272,7 +383,7 @@
|
|
|
<PipePlanScheduleDialog
|
|
|
ref="scheduleDialogRef"
|
|
|
:selected-rows="selectedRows"
|
|
|
- :selected-pipe-rows="selectedPipeRows"
|
|
|
+ :selected-pipe-rows="selectedDetailRows"
|
|
|
:selected-legal-list="selectedLegalList"
|
|
|
:selected-year-list="selectedYearList"
|
|
|
:source="source"
|
|
|
@@ -300,6 +411,11 @@ import dayjs from "dayjs";
|
|
|
import PipePlanScheduleDialog from "@/views/pressure2/pipescheduling/components/PipePlanScheduleDialog.vue";
|
|
|
import Detail from "@/views/pressure2/pipescheduling/detail.vue";
|
|
|
import PipelineDetailList from "@/views/pressure2/pipescheduling/components/PipelineDetailList.vue";
|
|
|
+import {formatDate} from "@/utils/formatTime";
|
|
|
+import {ref} from "vue";
|
|
|
+import {PipeEquipmentDetailVO, PipeEquipmentVO} from "@/api/pressure2/pipeequipment";
|
|
|
+import {EquipBoilerSchedulingVO} from "@/api/pressure2/equipboilerscheduling";
|
|
|
+import download from "@/utils/download";
|
|
|
|
|
|
/** 锅炉计划排期 列表 */
|
|
|
defineOptions({ name: 'EquipPipeScheduling' })
|
|
|
@@ -325,7 +441,9 @@ const queryParams = ref({
|
|
|
dayjs().add(1, 'month').endOf('month').endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
|
|
] as string[],
|
|
|
useStatus: ['100'],
|
|
|
- areaType: 'gz'
|
|
|
+ areaType: 'gz',
|
|
|
+ sort:undefined,
|
|
|
+ order:undefined,
|
|
|
})
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
const source = ref<string>('pressure') // 来源:计划约检、前台约检
|
|
|
@@ -343,18 +461,24 @@ const selectedTypeList = ref<StringDictDataType[]>([]) // 选中的锅炉归类
|
|
|
const selectedLegalList = ref([])
|
|
|
const selectedYearList = ref([])
|
|
|
const mainTableRef = ref() // 主表格引用
|
|
|
+const selectedDetailRows = ref<any[]>([]) // 选中的行
|
|
|
/** 查询列表 */
|
|
|
const getList = async () => {
|
|
|
loading.value = true
|
|
|
try {
|
|
|
- const data = await EquipPipeSchedulingApi.getEquipPipeSchedulingPage(queryParams.value)
|
|
|
+ const data = await EquipPipeSchedulingApi.getEquipPipeSchedulingPagePipe(queryParams.value)
|
|
|
list.value = data.list
|
|
|
total.value = data.total
|
|
|
//初始化
|
|
|
- list.value.forEach(item => {
|
|
|
- childSelectionsMap.value[item.id] = [];
|
|
|
+ // list.value.forEach(item => {
|
|
|
+ // childSelectionsMap.value[item.id] = [];
|
|
|
+ // })
|
|
|
+ expandRows.value.forEach(row => {
|
|
|
+ mainTableRef.value?.toggleRowExpansion(row, false)
|
|
|
})
|
|
|
- //清空选中数据
|
|
|
+ expandRowKeys.value = []
|
|
|
+ expandRows.value = []
|
|
|
+ selectedDetailRows.value = []
|
|
|
selectedRows.value = []
|
|
|
selectedLegalList.value = []
|
|
|
selectedYearList.value = []
|
|
|
@@ -384,6 +508,9 @@ const resetQuery = () => {
|
|
|
queryParams.value.equipStreet = undefined
|
|
|
areaStreetMap.value.clear()
|
|
|
|
|
|
+ queryParams.value.sort = undefined
|
|
|
+ queryParams.value.order = undefined
|
|
|
+
|
|
|
// 重置页码
|
|
|
queryParams.value.pageNo = 1
|
|
|
|
|
|
@@ -391,7 +518,7 @@ const resetQuery = () => {
|
|
|
selectedTypeList.value = []
|
|
|
|
|
|
// 清除表格排序
|
|
|
- tableRef.value?.clearSort()
|
|
|
+ mainTableRef.value?.clearSort()
|
|
|
|
|
|
handleQuery()
|
|
|
}
|
|
|
@@ -478,13 +605,14 @@ const handleStreetClear = () => {
|
|
|
const handleTypeListChange = (values: string[]) => {
|
|
|
selectedTypeList.value = containerTypeOptions.filter((dict) => values.includes(dict.value))
|
|
|
}
|
|
|
+/*
|
|
|
|
|
|
-/** 表格选择框变化 */
|
|
|
+/!** 表格选择框变化 *!/
|
|
|
const handleSelectionChange = (selection: EquipPipeSchedulingVO[]) => {
|
|
|
selectedRows.value = selection
|
|
|
}
|
|
|
|
|
|
-/** 处理表格排序 */
|
|
|
+/!** 处理表格排序 *!/
|
|
|
const handleSortChange = ({ prop, order }) => {
|
|
|
if (!prop || !order) {
|
|
|
list.value.sort(() => 0) // 重置排序
|
|
|
@@ -503,7 +631,7 @@ const handleSortChange = ({ prop, order }) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-/** 处理单条记录排期 */
|
|
|
+/!** 处理单条记录排期 *!/
|
|
|
const handleSchedule = async (row: EquipPipeSchedulingVO) => {
|
|
|
|
|
|
let rowSelections = selectedRows.value.filter(item => item.unitId === row.unitId);
|
|
|
@@ -533,7 +661,7 @@ const handleSchedule = async (row: EquipPipeSchedulingVO) => {
|
|
|
}
|
|
|
|
|
|
// 展开该主表行以显示子表
|
|
|
- if (mainTableRef && mainTableRef.value) {
|
|
|
+ if (mainTableRef.value) {
|
|
|
mainTableRef.value.toggleRowExpansion(row, true);
|
|
|
}
|
|
|
|
|
|
@@ -569,7 +697,7 @@ const handleSchedule = async (row: EquipPipeSchedulingVO) => {
|
|
|
//console.log(selectedPipeRows.value)
|
|
|
}
|
|
|
|
|
|
-/** 处理编辑操作 */
|
|
|
+/!** 处理编辑操作 *!/
|
|
|
const handleEdit = (row: EquipPipeSchedulingVO) => {
|
|
|
// 传递当前的查询条件,处理 relateDepartment 类型
|
|
|
const currentQueryParams = {
|
|
|
@@ -583,10 +711,11 @@ const handleEdit = (row: EquipPipeSchedulingVO) => {
|
|
|
//console.log(currentQueryParams)
|
|
|
detailDialogRef.value?.open(row, currentQueryParams)
|
|
|
}
|
|
|
+*/
|
|
|
|
|
|
/** 处理批量排期 */
|
|
|
const handleBatchSchedule = () => {
|
|
|
- if (selectedRows.value.length === 0) {
|
|
|
+ if (selectedDetailRows.value.length === 0) {
|
|
|
message.warning('请至少选择一条记录')
|
|
|
return
|
|
|
}
|
|
|
@@ -603,7 +732,7 @@ const handleBatchSchedule = () => {
|
|
|
//按定检和年检分组
|
|
|
selectedLegalList.value = []
|
|
|
selectedYearList.value = []
|
|
|
- selectedRows.value.forEach(item => {
|
|
|
+ selectedDetailRows.value.forEach(item => {
|
|
|
|
|
|
if (!item.hasLegalScheduling && item.planLegalCheckDate == null){
|
|
|
selectedLegalList.value.push(item)
|
|
|
@@ -618,6 +747,7 @@ const handleBatchSchedule = () => {
|
|
|
//console.log(selectedLegalList.value,selectedYearList.value)
|
|
|
//scheduleDialogRef.value?.open(selectedPipeRows.value,selectedRows.value)
|
|
|
//selectedPipeRows.value = [row];
|
|
|
+ console.log('selectedLegalList.value',selectedLegalList.value,selectedYearList.value)
|
|
|
scheduleDialogRef.value?.open(selectedLegalList.value,selectedYearList.value)
|
|
|
}
|
|
|
|
|
|
@@ -628,7 +758,7 @@ const handleScheduleSuccess = () => {
|
|
|
}
|
|
|
|
|
|
/** 处理子组件选择变化 */
|
|
|
-const childSelectionsMap = ref<Record<string | number, PipePlanSchedulingDetailVO[]>>({}); // 新增: 存储子组件的选中项
|
|
|
+/*const childSelectionsMap = ref<Record<string | number, PipePlanSchedulingDetailVO[]>>({}); // 新增: 存储子组件的选中项
|
|
|
const handleChildSelectionChange = (selection: EquipPipeSchedulingDetailVO[], parentId: string | number) => {
|
|
|
if (!parentId) {
|
|
|
// 如果父ID无效,则不处理,或者记录一个警告
|
|
|
@@ -734,6 +864,189 @@ const loadQueryParamsFromCache = () => {
|
|
|
console.error('解析缓存数据失败:', error)
|
|
|
}
|
|
|
}
|
|
|
+}*/
|
|
|
+
|
|
|
+const detailTableRefs = ref<Record<string, any>>({})
|
|
|
+const setDetailTableRef = (el: any, parentId: string) => {
|
|
|
+ if (el) {
|
|
|
+ detailTableRefs.value[parentId] = el;
|
|
|
+ }
|
|
|
+}
|
|
|
+const getDetailTableRef = (parentId: string) => {
|
|
|
+ return detailTableRefs.value[parentId];
|
|
|
+}
|
|
|
+
|
|
|
+/** 处理表格排序 */
|
|
|
+const handleSortChange = ({ prop, order }) => {
|
|
|
+ queryParams.value.sort = prop
|
|
|
+ queryParams.value.order = order
|
|
|
+ handleQuery()
|
|
|
+}
|
|
|
+
|
|
|
+const getMainRowClassName = ({ row }) => {
|
|
|
+ const isSelected = mainTableRef.value?.getSelectionRows().some((item) =>
|
|
|
+ item.id === row.id
|
|
|
+ )
|
|
|
+ return isSelected ? 'selected-row' : ''
|
|
|
+}
|
|
|
+const getRowClassName = ({row}) => {
|
|
|
+ // 找到当前行所在的分组,从 Map 中获取对应的表格实例
|
|
|
+ const tableRef = getDetailTableRef(row.equipPipeId)
|
|
|
+ if (tableRef) {
|
|
|
+ const isSelected = tableRef.getSelectionRows().some((item) =>
|
|
|
+ item.id === row.id
|
|
|
+ )
|
|
|
+ return isSelected ? 'selected-row' : ''
|
|
|
+ }
|
|
|
+
|
|
|
+ return ''
|
|
|
+}
|
|
|
+const handleExpandChange = (row, expandedRows: any[]) => {
|
|
|
+ if (!expandedRows.includes(row)){
|
|
|
+ toggleExpand(row)
|
|
|
+ }else {
|
|
|
+ expandRowKeys.value.push(row.id)
|
|
|
+ expandRows.value.push(row)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 处理行点击勾选 */
|
|
|
+const handleMainRowClick = (row, _event,_column) => {
|
|
|
+ mainTableRef.value?.toggleRowSelection(row)
|
|
|
+}
|
|
|
+
|
|
|
+const handleRowClick = (row, _event, column) => {
|
|
|
+ // 如果点击的是选择列,不处理
|
|
|
+ if (column.type === 'selection') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 找到当前行所在的分组,从 Map 中获取对应的表格实例
|
|
|
+ const tableRef = getDetailTableRef(row.equipPipeId)
|
|
|
+ if (tableRef && tableRef.toggleRowSelection) {
|
|
|
+ tableRef.toggleRowSelection(row)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 已展开行
|
|
|
+const expandRowKeys = ref<string[]>([])
|
|
|
+const expandRows = ref<any[]>([])
|
|
|
+const toggleExpand = async (row: any) => {
|
|
|
+ const key = row.id
|
|
|
+ // 第一次点击展开,第二次点击同一行收起
|
|
|
+ if (expandRowKeys.value.includes(key)) {
|
|
|
+ expandRowKeys.value = expandRowKeys.value.filter((key) => key !== key)
|
|
|
+ expandRows.value = expandRows.value.filter((row) => row.id !== key)
|
|
|
+ selectedDetailRows.value = selectedDetailRows.value.filter((row) => row.equipPipeId !== key)
|
|
|
+ mainTableRef.value.toggleRowExpansion(row, false)
|
|
|
+ mainTableRef.value.toggleRowSelection(row, false)
|
|
|
+ } else {
|
|
|
+ expandRowKeys.value.push(key)
|
|
|
+ expandRows.value.push(row)
|
|
|
+ mainTableRef.value.toggleRowExpansion(row, true)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/** 表格选择框变化 */
|
|
|
+const handleSelectionChange = async (selection: any[]) => {
|
|
|
+ // 计算取消选择的行
|
|
|
+ const deselectedRows = selectedRows.value.filter(
|
|
|
+ item => !selection.includes(item)
|
|
|
+ );
|
|
|
+ selectedRows.value = selection
|
|
|
+ // 每一个勾选了主表的要找到对应的子表
|
|
|
+ for (const item of selection) {
|
|
|
+ // 如果没有子表,展开当前子表
|
|
|
+ if (!expandRowKeys.value.includes(item.id)) {
|
|
|
+ await toggleExpand(item)
|
|
|
+ }
|
|
|
+ // 如果没有勾选,勾选子表
|
|
|
+ if (selectedDetailRows.value.findIndex(selectedDetailRow => selectedDetailRow.equipPipeId === item.id) === -1){
|
|
|
+ getDetailTableRef(item.id)?.toggleAllSelection(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ deselectedRows.forEach(item => {
|
|
|
+ getDetailTableRef(item.id)?.clearSelection()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/** 处理子表选择变化 */
|
|
|
+const handleDetailSelectionChange = (selection: any[], mainRow: any) => {
|
|
|
+ selectedDetailRows.value = selectedDetailRows.value.filter((item) => item.equipPipeId !== mainRow.id)
|
|
|
+ selectedDetailRows.value = [...selectedDetailRows.value.filter(row => !selection.some(sel => sel.id === row.id)), ...selection]
|
|
|
+ // tableRef.value.toggleRowSelection(mainRow, true)
|
|
|
+ // 如果子表有选中项,则自动选中主表行;否则取消选中主表行
|
|
|
+ nextTick(() => {
|
|
|
+ if (selection.length > 0) {
|
|
|
+ // 子表有选中项,选中主表行
|
|
|
+ mainTableRef.value.toggleRowSelection(mainRow, true);
|
|
|
+ }else if (!selectedDetailRows.value.map(row => row.equipPipeId).includes(mainRow.id)){
|
|
|
+ const currentlySelected = selectedRows.value.some(row => row.id === mainRow.id);
|
|
|
+ if (currentlySelected && selection.length === 0) {
|
|
|
+ // 只有当主行当前是选中状态且子表没有任何选中项时才取消主行选择
|
|
|
+ mainTableRef.value.toggleRowSelection(mainRow,false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 处理编辑操作 */
|
|
|
+const handleEdit = (row: any) => {
|
|
|
+ // 传递当前的查询条件,处理 relateDepartment 类型
|
|
|
+ const currentQueryParams = {
|
|
|
+ ...queryParams.value,
|
|
|
+ relateDepartment: queryParams.value.relateDepartment?.toString(),
|
|
|
+ datePickerType: datePickerType.value,
|
|
|
+ month: month.value,
|
|
|
+ nextDate: queryParams.value.nextDate
|
|
|
+ }
|
|
|
+
|
|
|
+ //console.log(currentQueryParams)
|
|
|
+ detailDialogRef.value?.open(row, currentQueryParams)
|
|
|
+}
|
|
|
+
|
|
|
+const handleSchedule = async (row: any) => {
|
|
|
+
|
|
|
+ //按定检和年检分组
|
|
|
+ selectedLegalList.value = []
|
|
|
+ selectedYearList.value = []
|
|
|
+ row.pipes.forEach(item => {
|
|
|
+ if (selectedDetailRows.value.includes(item)) {
|
|
|
+ if (!item.hasLegalScheduling && item.planLegalCheckDate == null) {
|
|
|
+ selectedLegalList.value.push(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!item.hasYearScheduling && item.planYearCheckDate == null) {
|
|
|
+ selectedYearList.value.push(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (selectedLegalList.value.length == 0 && selectedYearList.value.length == 0) {
|
|
|
+ // 默认带出全部
|
|
|
+ row.pipes.forEach(item => {
|
|
|
+
|
|
|
+ if (!item.hasLegalScheduling && item.planLegalCheckDate == null) {
|
|
|
+ selectedLegalList.value.push(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!item.hasYearScheduling && item.planYearCheckDate == null) {
|
|
|
+ selectedYearList.value.push(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ scheduleDialogRef.value?.open(selectedLegalList.value, selectedYearList.value)
|
|
|
+}
|
|
|
+
|
|
|
+const handleExport = async () => {
|
|
|
+ try {
|
|
|
+ const data = await EquipPipeSchedulingApi.exportEquipPipeScheduling(queryParams.value)
|
|
|
+ download.excel(data, '管道计划排期表单.xls')
|
|
|
+ message.success('导出成功')
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error)
|
|
|
+ message.error('导出失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** 初始化 **/
|
|
|
@@ -780,4 +1093,44 @@ onUnmounted(()=>{
|
|
|
::v-deep .containerView .el-select__wrapper {
|
|
|
min-width: 200px;
|
|
|
}
|
|
|
+
|
|
|
+// 外层表格复选框样式
|
|
|
+::v-deep .outer-table .el-checkbox__input.is-checked .el-checkbox__inner,
|
|
|
+::v-deep .outer-table .el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .outer-table .el-checkbox__input.is-checked .el-checkbox__inner::after {
|
|
|
+ border-color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+// 内层表格复选框样式
|
|
|
+::v-deep .inner-table .el-checkbox__input.is-checked .el-checkbox__inner,
|
|
|
+::v-deep .inner-table .el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
|
|
+ background-color: #67c23a; // 绿色
|
|
|
+ border-color: #67c23a;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .inner-table .el-checkbox__input.is-checked .el-checkbox__inner::after {
|
|
|
+ border-color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+// 外层表格选中行背景色
|
|
|
+::v-deep .outer-table .el-table__body tr.current-row > td {
|
|
|
+ background-color: #ecf5ff;
|
|
|
+}
|
|
|
+
|
|
|
+// 内层表格选中行背景色
|
|
|
+::v-deep .inner-table .el-table__body tr.current-row > td {
|
|
|
+ background-color: #f0f9eb;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.selected-row){
|
|
|
+ background-color: #ecf5ff !important;
|
|
|
+}
|
|
|
+
|
|
|
+// 子表选中行特殊背景色(浅绿色)
|
|
|
+:deep(.inner-table .selected-row) {
|
|
|
+ background-color: #e8f5e9 !important;
|
|
|
+}
|
|
|
</style>
|