lct
Your Name
2022-08-12 965f7a2479a2cf7c1c56fb298e7fbb855c89e212
src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
@@ -85,7 +85,7 @@
                            <template #default="scope">
                                <el-button link type="primary" size="small" :icon="View" @click="openInspectTaskDialog('查看', scope.row)">查看</el-button>
                                <el-button link type="primary" size="small" :icon="Edit" @click="openInspectTaskDialog('修改', scope.row)">修改</el-button>
                                <el-button link type="danger" size="small" :icon="Delete" @click="deleteInspectTask(scope.$index)">删除</el-button>
                                <el-button link type="danger" size="small" :icon="Delete" v-if="scope.row.taskUnitStatus === 2" @click="deleteInspectTask(scope.row)">删除</el-button>
                                <div @click="changeStatus(scope.row)">
                                    <el-switch v-model="scope.row.taskUnitStatus" inline-prompt active-text="开" inactive-text="关" :active-value="1" :inactive-value="2" style="margin: 0 10px" />
                                </div>
@@ -295,6 +295,7 @@
                    .then(async () => {
                        let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 2 });
                        if (res.data.code === '200') {
                            await getInspectionTask();
                            ElMessage({
                                type: 'success',
                                duration: 2000,
@@ -307,9 +308,7 @@
                            });
                        }
                    })
                    .catch((error) => {
                        debugger;
                    });
                    .catch((error) => {});
            } else {
                ElMessageBox.confirm(`此操作将开启该巡检任务”,是否继续?`, '提示', {
                    confirmButtonText: '确认',
@@ -319,6 +318,7 @@
                    .then(async () => {
                        let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 1 });
                        if (res.data.code === '200') {
                            await getInspectionTask();
                            ElMessage({
                                type: 'success',
                                duration: 2000,
@@ -334,6 +334,32 @@
                    .catch((error) => {});
            }
            await getInspectionTask();
        };
        // 删除
        const deleteInspectTask = (row: any) => {
            ElMessageBox.confirm(`此操作将永久删除该任务:“${row.unitName}”,是否继续?`, '提示', {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(async () => {
                    let res = await inspectTaskApi().deleteInspectTask({ id: row.id });
                    if (res.data.code === '200') {
                        ElMessage({
                            type: 'success',
                            duration: 2000,
                            message: '删除成功'
                        });
                        await getInspectionTask();
                    } else {
                        ElMessage({
                            type: 'warning',
                            message: res.data.msg
                        });
                    }
                })
                .catch(() => {});
        };
        const openInspectTaskDialog = (type: string, value: {}) => {
@@ -394,6 +420,7 @@
            reset,
            changeStatus,
            parseNumber,
            deleteInspectTask,
            getInspectionTask,
            onHandleSizeChange,
            onHandleCurrentChange,