| | |
| | | <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> |
| | |
| | | .then(async () => { |
| | | let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 2 }); |
| | | if (res.data.code === '200') { |
| | | await getInspectionTask(); |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | |
| | | }); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | debugger; |
| | | }); |
| | | .catch((error) => {}); |
| | | } else { |
| | | ElMessageBox.confirm(`此操作将开启该巡检任务”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | |
| | | .then(async () => { |
| | | let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 1 }); |
| | | if (res.data.code === '200') { |
| | | await getInspectionTask(); |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | |
| | | .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: {}) => { |
| | |
| | | reset, |
| | | changeStatus, |
| | | parseNumber, |
| | | deleteInspectTask, |
| | | getInspectionTask, |
| | | onHandleSizeChange, |
| | | onHandleCurrentChange, |