diff --git a/.env b/.env index 8e41f01..9599f6b 100644 --- a/.env +++ b/.env @@ -1,11 +1,11 @@ -VITE_BASE_URL=http://192.168.1.194:8899 +# VITE_BASE_URL=http://192.168.1.194:8899 VITE_WEBSOCKET_JAVA_URL=ws://192.168.1.194:8899/websocket/nuclear VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear VITE_WEBSOCKET_CAMERA_URL=ws://192.168.1.194:8081/ws/cmd VITE_HOST_URL=http://192.168.1.194:8081/ -# VITE_BASE_URL=http://127.0.0.1:8899 +VITE_BASE_URL=http://127.0.0.1:8899 # VITE_WEBSOCKET_JAVA_URL=ws://127.0.0.1:8899/websocket/nuclear # # VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8899/websocket/nuclear # VITE_WEBSOCKET_CAMERA_URL=ws://127.0.0.1:8081/ws/cmd diff --git a/src/api/task.js b/src/api/task.js index a9c3843..f101599 100644 --- a/src/api/task.js +++ b/src/api/task.js @@ -12,6 +12,14 @@ export const createTaskApi = data => { }) } +export const stopTaskApi = data => { + return request({ + url: '/task/stop', + method: 'POST', + data, + }) +} + export const taskListApi = () => { return request({ url: '/task/list', diff --git a/src/components/Task.vue b/src/components/Task.vue index 82b2754..0d1e5a6 100644 --- a/src/components/Task.vue +++ b/src/components/Task.vue @@ -128,6 +128,18 @@ + + +

+ 结束任务后将不能再继续对该任务进行核查! +

+
@@ -135,6 +147,7 @@ import { taskListApi, delExcelByTaskIdApi, + stopTaskApi, delTaskApi, updateOperByTaskIdApi, } from '@/api/task' @@ -159,6 +172,8 @@ const cameraStore = useCameraStore() export default { data() { return { + stopTaskInfo: {}, + stopTaskVisible: false, publishVisible: false, excelData: [], pathVisible: false, @@ -420,6 +435,22 @@ export default { 开始任务 ) : null} +
+ {[0, 1, 2].includes(row.status) && + this.role == 'ROLE_USER' ? ( +
this.changeTaskStatusTo3(row)} + class={ + row.canUpload + ? 'start_table_btn disable_table_btn' + : 'start_table_btn' + } + > + 结束任务 +
+ ) : null} +
this.viewDetail( @@ -459,6 +490,19 @@ export default { Publish, }, computed: { + testArrLength() { + const testArr = taskStore.excelData.filter( + item => item.firstSign && item.secondSign, + ) + return testArr.length + }, + hasTestedLength() { + const testArr = taskStore.excelData.filter( + item => item.firstSign && item.secondSign, + ) + const hasTested = testArr.filter(item => item.result != 0) + return hasTested.length + }, actionAddress() { return `${import.meta.env.VITE_BASE_URL}/upload/${this.currentTaskId}` }, @@ -474,6 +518,17 @@ export default { }, }, methods: { + async handleStopTask() { + const res = await stopTaskApi({ ...this.stopTaskInfo, status: 3 }) + if (res?.code == 200) { + this.getTaskList() + this.stopTaskVisible = false + } + }, + changeTaskStatusTo3(row) { + this.stopTaskVisible = true + this.stopTaskInfo = row + }, handleCancel() { this.publishVisible = false }, diff --git a/src/pages/index.vue b/src/pages/index.vue index f363af6..51ce08b 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -395,6 +395,8 @@ const loading = ref(false) const hasTestedLength = ref(0) const testArrLength = ref(121) +const changeTaskStatusThree = () => {} + // websocket const websocket = ref(null) @@ -674,9 +676,6 @@ const catCurrentTaskDetail = () => { onUnmounted(() => { websock.value.close() accountStore?.clearLoginInfo() - Cookies.remove('u') - Cookies.remove('t') - Cookies.remove('r') Cookie.clearAllCookie() }) @@ -797,9 +796,6 @@ const websocketsend = data => { } const websocketclose = () => { - Cookies.remove('u') - Cookies.remove('t') - Cookies.remove('r') reconnect() }