修改启动按钮
This commit is contained in:
@@ -100,3 +100,19 @@ export const deleteTimer = (data: any) => {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 关闭任务
|
||||
export const stop = (params: any) => {
|
||||
return request({
|
||||
url: '/system-boot/timer/stop',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 启动任务
|
||||
export const start = (params: any) => {
|
||||
return request({
|
||||
url: '/system-boot/timer/start',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
@@ -44,7 +44,7 @@ import TableHeader from '@/components/table/header/index.vue'
|
||||
import taskForm from '@/views/system/scheduledTasks/form.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer } from '@/api/system-boot/csDictData'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
defineOptions({
|
||||
name: 'Distributedphotovoltaic/templateConfiguration'
|
||||
})
|
||||
@@ -64,18 +64,43 @@ const tableStore: any = new TableStore({
|
||||
{ field: 'actionClass', title: '任务执行器' },
|
||||
{ field: 'cron', title: '定时任务表达式' },
|
||||
{ field: 'remark', title: '备注' },
|
||||
// {
|
||||
// field: 'jobStatus', title: '状态', width: '100',
|
||||
// render: 'tag',
|
||||
// custom: {
|
||||
// 0: 'danger',
|
||||
// 1: 'success',
|
||||
// 2: 'danger'
|
||||
// },
|
||||
// replaceValue: {
|
||||
// 0: '未启动',
|
||||
// 1: '运行中',
|
||||
// 2: '未启动',
|
||||
// }
|
||||
// },
|
||||
{
|
||||
field: 'jobStatus', title: '状态', width: '100',
|
||||
render: 'tag',
|
||||
custom: {
|
||||
0: 'danger',
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
},
|
||||
replaceValue: {
|
||||
0: '未启动',
|
||||
1: '运行中',
|
||||
2: '未启动',
|
||||
title: '状态',
|
||||
render: 'switch',
|
||||
width: 100,
|
||||
field: 'jobStatus',
|
||||
activeText: '启用',
|
||||
activeValue: '1',
|
||||
inactiveText: '停用',
|
||||
inactiveValue: '2',
|
||||
onChangeField: (row: any, value: any) => {
|
||||
if (row.jobStatus == 1) {
|
||||
stop({ id: row.id }).then(res => {
|
||||
ElMessage.success('停止成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}else{
|
||||
start({ id: row.id }).then(res => {
|
||||
ElMessage.success('启动成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{ field: 'sort', title: '排序', width: '80' },
|
||||
@@ -141,13 +166,13 @@ const tableStore: any = new TableStore({
|
||||
title: '确定删除?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTimer([row.id ]).then(res => {
|
||||
deleteTimer([row.id]).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user