|
@@ -17,7 +17,7 @@
|
|
<el-button type="primary" @click="handleUpdate()"> 编辑 </el-button>
|
|
<el-button type="primary" @click="handleUpdate()"> 编辑 </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="primary" @click="handleWork()"> 完成任务 </el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="handlefinal()"> 完成任务 </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button type="danger" @click="handleDelete"> 删除预案 </el-button>
|
|
<el-button type="danger" @click="handleDelete"> 删除预案 </el-button>
|
|
@@ -42,13 +42,13 @@
|
|
<h3>子任务记录</h3>
|
|
<h3>子任务记录</h3>
|
|
<el-card style="margin-top: 10px" shadow="hover">
|
|
<el-card style="margin-top: 10px" shadow="hover">
|
|
<el-table ref="multipleTable" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
|
|
<el-table ref="multipleTable" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
|
|
- <el-table-column label="巡查业务" align="center" prop="business" />
|
|
|
|
|
|
+ <el-table-column label="巡查业务" align="center" :formatter="(row) => businessMap[row.business]" />
|
|
<el-table-column label="要求巡查时间" align="center" prop="task_time" />
|
|
<el-table-column label="要求巡查时间" align="center" prop="task_time" />
|
|
- <el-table-column label="巡查周期" align="center" prop="cycle" />
|
|
|
|
- <el-table-column label="巡查范围" walign="center" prop="inspection_range" />
|
|
|
|
- <el-table-column label="执行日期" align="center" prop="run_time" />
|
|
|
|
- <el-table-column label="已完成" align="center" prop="finished" />
|
|
|
|
- <el-table-column label="未完成" align="center" prop="unfinished" />
|
|
|
|
|
|
+ <el-table-column label="巡查周期" align="center" :formatter="(row) => cycleMap[row.cycle]" />
|
|
|
|
+ <el-table-column label="巡查范围" align="center" :formatter="(row) => inspectionRangeMap[row.inspection_range]" />
|
|
|
|
+ <el-table-column label="执行日期" align="center" prop="create_time" />
|
|
|
|
+ <el-table-column label="已完成" align="center" prop="completed_num" />
|
|
|
|
+ <el-table-column label="未完成" align="center" prop="incomplete_num" />
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-text class="common-btn-text-primary" @click="handleView(scope.row)">巡查结果</el-text>
|
|
<el-text class="common-btn-text-primary" @click="handleView(scope.row)">巡查结果</el-text>
|
|
@@ -60,7 +60,7 @@
|
|
v-model:page="queryParams.page"
|
|
v-model:page="queryParams.page"
|
|
v-model:limit="queryParams.pageSize"
|
|
v-model:limit="queryParams.pageSize"
|
|
:total="total"
|
|
:total="total"
|
|
- @pagination="tableData"
|
|
|
|
|
|
+ @pagination="fetchSubTasks"
|
|
/>
|
|
/>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -68,11 +68,15 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { workDetail } from '@/api/inspectionWork/inspector';
|
|
|
|
|
|
+import { workDetail, workSubList, updatetask } from '@/api/inspectionWork/inspector';
|
|
import { reactive, ref } from 'vue';
|
|
import { reactive, ref } from 'vue';
|
|
|
|
+import { ElMessageBox } from 'element-plus';
|
|
const props = defineProps<{ eventId: string }>();
|
|
const props = defineProps<{ eventId: string }>();
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
const tableData = ref([]);
|
|
const tableData = ref([]);
|
|
|
|
+const multiple = ref(true);
|
|
|
|
+const ids = ref<Array<number | string>>([]);
|
|
|
|
+const single = ref(true);
|
|
const emits = defineEmits(['close']);
|
|
const emits = defineEmits(['close']);
|
|
const detailData = ref({
|
|
const detailData = ref({
|
|
task_number: '',
|
|
task_number: '',
|
|
@@ -157,10 +161,53 @@ const fetchWorkDetail = () => {
|
|
loading.value = false;
|
|
loading.value = false;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+const fetchSubTasks = () => {
|
|
|
|
+ return workSubList(props.eventId, queryParams.value)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ tableData.value = res.data;
|
|
|
|
+ total.value = res.total;
|
|
|
|
+ console.log('Fetched subtasks data:', tableData.value);
|
|
|
|
+ } else {
|
|
|
|
+ console.error(res.msg);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.error('Error fetching sub tasks:', error);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const handleSelectionChange = (selection) => {
|
|
|
|
+ ids.value = selection.map((item) => item.id);
|
|
|
|
+ single.value = selection.length != 1;
|
|
|
|
+ multiple.value = !selection.length;
|
|
|
|
+};
|
|
|
|
+const handlefinal = async () => {
|
|
|
|
+ try {
|
|
|
|
+ const confirmed = await ElMessageBox.confirm('确定要完结任务吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
+ if (confirmed) {
|
|
|
|
+ try {
|
|
|
|
+ await updatetask({ id: props.eventId, task_status: '3' });
|
|
|
|
+ console.log(`任务 ${props.eventId} 已完结`);
|
|
|
|
+ fetchWorkDetail();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error(`任务 ${props.eventId} 完结失败:`, error);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ console.log(`任务 ${props.eventId} 未完结`);
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('确认对话框处理失败:', error);
|
|
|
|
+ }
|
|
|
|
+};
|
|
const goBack = () => {
|
|
const goBack = () => {
|
|
emits('close');
|
|
emits('close');
|
|
};
|
|
};
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
fetchWorkDetail(); // 在组件挂载后调用此函数以获取数据
|
|
fetchWorkDetail(); // 在组件挂载后调用此函数以获取数据
|
|
|
|
+ fetchSubTasks();
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|