Browse Source

finish

master
maochaoying 2 years ago
parent
commit
5a4c346a08
  1. 4
      .env
  2. 8
      src/api/task.js
  3. 55
      src/components/Task.vue
  4. 8
      src/pages/index.vue

4
.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

8
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',

55
src/components/Task.vue

@ -128,6 +128,18 @@
<Publish :handleCancel="handleCancel" :getTaskList="getTaskList" />
</template>
</t-dialog>
<t-dialog
theme="danger"
header="删除"
:visible="stopTaskVisible"
:onClose="() => (stopTaskVisible = false)"
:onConfirm="handleStopTask"
>
<p style="font-size: 16px; margin: 20px 0">
结束任务后将不能再继续对该任务进行核查
</p>
</t-dialog>
</div>
</template>
@ -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 {
开始任务
</div>
) : null}
<div>
{[0, 1, 2].includes(row.status) &&
this.role == 'ROLE_USER' ? (
<div
style={{ marginRight: '10px' }}
onClick={() => this.changeTaskStatusTo3(row)}
class={
row.canUpload
? 'start_table_btn disable_table_btn'
: 'start_table_btn'
}
>
结束任务
</div>
) : null}
</div>
<div
onClick={() =>
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
},

8
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()
}

Loading…
Cancel
Save