Commit f08f3e48 by yzh

feat:完成了暂停任务启动任务接口

parent 87d1de03
......@@ -55,8 +55,8 @@ export const scrapydServerApi = {
deleteScrapydServer: '/scrapydServer/deleteScrapydServer'
} as const
export const systemApi = {
// 系统相关
export const systemApi = {
systemInfo: '/system/systemInfo',
systemData: '/system/systemData',
systemConfig: '/system/systemConfig',
......@@ -64,16 +64,16 @@ export const systemApi = {
scrapydServerList: '/system/scrapydServerList' // 没用
} as const
export const statsApi = {
// 统计相关
export const statsApi = {
statsList: '/statsCollection/listItem',
statsDetail: '/statsCollection/detail',
removeStats: '/statsCollection/delete',
clearAllStats: '/statsCollection/clearAll' // TODO 未实现
} as const
export const userApi = {
// 系统用户相关接口
export const userApi = {
userList: '/user/list',
addUser: '/user/insert',
updateUser: '/user/update',
......@@ -81,13 +81,13 @@ export const userApi = {
batchDelete: '/user/batchDelete',
} as const
export const spiderApi = {
// 系统用户相关接口
export const spiderApi = {
spiderList: '/scrapyd/listSpiders',
} as const
export const spiderTaskApi = {
// 爬虫任务相关接口
export const spiderTaskApi = {
taskList: '/schedule/getJobs',
taskRecord: '/schedule/scheduleLogs',
addTask: '/schedule/addJob',
......@@ -95,4 +95,14 @@ export const spiderTaskApi = {
pauseJob: '/schedule/pauseJob',
resumeJob: '/schedule/resumeJob',
jobDetail: '/schedule/jobDetail',
} as const
// 爬虫数据相关接口
export const spiderDataApi = {
dsnList: '/dsn/list',
dsnDetail: '/dsn/detail',
dsnDataDelete: '/dsn/delete',
ituList: '/itu/list',
ituDetail: '/itu/detail',
ituDataDelete: '/itu/delete',
} as const
\ No newline at end of file
import { request, POST } from '@/utils/request'
import type { ApiResponse, QueryParams, UserQueryParams } from '@/utils/request'
import { spiderDataApi } from './apiPaths'
// 获取dsn数据列表
export function getDsnlist(data: UserQueryParams) {
return request({
url: spiderDataApi.dsnList,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
// 获取dsn数据详情
export function getDsnDetail(data: UserQueryParams) {
return request({
url: spiderDataApi.dsnDetail,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
// 删除dsn数据
export function deleteDsnData(data: UserQueryParams) {
return request({
url: spiderDataApi.dsnDataDelete,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
// 获取itu数据列表
export function getItulist(data: UserQueryParams) {
return request({
url: spiderDataApi.ituList,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
// 获取itu数据详情
export function getItuDetail(data: UserQueryParams) {
return request({
url: spiderDataApi.ituDetail,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
// 删除itu数据
export function deleteItuData(data: UserQueryParams) {
return request({
url: spiderDataApi.ituDataDelete,
method: POST,
data
}) as unknown as Promise<ApiResponse>
}
\ No newline at end of file
......@@ -200,9 +200,10 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import exportDialog from '@/components/Export/index.vue'
import { getDsnlist, getDsnDetail, deleteDsnData } from '@/api/spiderData'
const showDeleteDialog = ref(false)
const timeValue = ref('')
......@@ -243,51 +244,7 @@ const recordTime = ref('')
const isSuspended = ref('')
const tableData = ref([
{
number: '1',
targetName: 'maven',
distance: '2000',
roundTripTime: '12',
stationName: 'CANBERRA',
targetAzimuth: '11',
targetElevation: '24',
targetDistance: '2000',
windSpeed: '10',
upSignalSource: 'maven',
upSignalFrequencyBand: 'X',
upSignalLaunchPower: '123',
downSignalSignalSource: 'maven',
downSignalFrequencyBand: 'S',
downSignalReceptionPower: '23',
dataTime: '2025-06-21 12:00:00',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
])
const pageObj = ref({
total: 10,
......@@ -299,8 +256,11 @@ const handleDetails = (row: any) => {
detailVisibleValue.value = true
}
const getData = () => {
const getData = async () => {
console.log('getData');
const res = await getDsnlist({page:pageObj.value.pageNo,size:pageObj.value.pageSize})
tableData.value = res.data.list
pageObj.value.total = res.data.total
}
const handleClose = () => {
......@@ -312,6 +272,9 @@ const handleExportConfirm = () => {
const handleExport = () => {
showDeleteDialog.value = true
}
onMounted(() => {
getData()
})
</script>
<style scoped lang="scss">
......
......@@ -242,9 +242,10 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import Pagination from '@/components/pagination/index.vue'
import exportDialog from '@/components/Export/index.vue'
import { getItulist, getItuDetail, deleteItuData } from '@/api/spiderData'
const showDeleteDialog = ref(false)
const timeValue = ref('')
......@@ -295,55 +296,7 @@ const isRestoreUsed = ref('')
const validityPeriodSatelliteNetworkOldName = ref('')
// 最新相关 BR IFIC 发布日期
const BFIFICdate = ref('')
const tableData = ref([
{
number: '1',
SNSNoticeID: '86550007',
department: 'ARG',
targetName: 'ARGOS',
planType: '计划',
syncType: '否',
syncPosition: '-',
perigee: '2000',
apogee: '2500',
lowestAltitude: '165',
referenceSubject: '地球',
lowestFrequency: 'None',
highestFrequency: 'None',
status: 'None',
validityPeriod: '-',
earliestUsageDate: 'None',
isUsed: 'No',
isPauseUsed: 'No',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
{
name: '1',
},
])
const tableData = ref([])
const pageObj = ref({
total: 10,
pageSize: 10,
......@@ -353,8 +306,12 @@ const handleDetails = (row: any) => {
console.log(row);
detailVisibleValue.value = true
}
const getData = () => {
const getData = async () => {
console.log('getData');
const res = await getItulist({page:pageObj.value.pageNo,size:pageObj.value.pageSize})
tableData.value = res.data.list
pageObj.value.total = res.data.total
}
const handleClose = () => {
detailVisibleValue.value = false
......@@ -365,6 +322,10 @@ const handleExportConfirm = () => {
const handleExport = () => {
showDeleteDialog.value = true
}
onMounted(() => {
getData()
})
</script>
<style scoped lang="scss">
......
......@@ -38,7 +38,7 @@
<div>
<el-form-item>
<span class="titleStyle">{{ task.kwargs.options === '' ? '无名称' : JSON.parse(task.kwargs.options).jobName
}}</span>
}}</span>
</el-form-item>
</div>
<div>
......@@ -52,7 +52,8 @@
<el-form-item>
<el-space>
<span class="wordStyle">启用/停止: </span>
<el-switch v-model="task.status" :active-value="1" :inactive-value="0" @change="changeStatus(task)" />
<el-switch v-model="task.status" :active-value="'running'" :inactive-value="'paused'"
@change="(newStatus:any) => changeStatus(task, newStatus)" />
<span class="wordStyle">执行频率: {{ task.frequency }} </span>
</el-space>
</el-form-item>
......@@ -88,7 +89,7 @@
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import addTaskDialog from './addTaskDialog.vue'
import { getSpiderTaskList } from '@/api/spiderTask'
import { getSpiderTaskList, resumeSpiderTask, pauseSpiderTask } from '@/api/spiderTask'
import { DeleteMode } from '@/components/Delete/enum.ts'
import { AddMode } from './enum'
import deleteDialog from './deleteDialog.vue'
......@@ -136,17 +137,7 @@ const showTaskDialog = ref(false)
const taskSwitch = ref(false)
const taskOptions = ref('')
const jobId = ref('')
const taskList = ref([
{
taskId: 1,
name: '任务1',
status: 1,
frequency: '每天',
kwargs: {
options: ''
}
}
])
const taskList = ref<any[]>([])
const deleteTask = (task: any) => {
console.log(task);
......@@ -173,9 +164,14 @@ const goToTaskRecord = () => {
}
})
}
const changeStatus = (task: any) => {
}
const changeStatus = async (task: any, newStatus: string) => {
if (newStatus === "running") {
await resumeSpiderTask({ job_id: task.id });
} else if (newStatus === "paused") {
await pauseSpiderTask({ job_id: task.id });
}
await getData();
};
const handleEdit = () => {
}
......@@ -184,7 +180,7 @@ const openTaskDialog = () => {
showTaskDialog.value = true
}
const getData = async () => {
const res = await getSpiderTaskList({ spiders: searchCondition.value.spiders ? [searchCondition.value.spiders] : [] , options: JSON.stringify({ jobName: taskName.value }) })
const res = await getSpiderTaskList({ spiders: searchCondition.value.spiders ? [searchCondition.value.spiders] : [], options: JSON.stringify({ jobName: taskName.value }) })
taskList.value = res.data
}
......@@ -287,7 +283,7 @@ onMounted(() => {
border: none;
} */
.el-input {
.el-input {
color: #FFFFFF;
}
</style>
\ No newline at end of file
......@@ -6,7 +6,7 @@ import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vue(),
UnoCSS()
],
resolve: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment