| | |
| | | name: undefined, |
| | | }, |
| | | { |
| | | //立即开始 |
| | | tooltip: '立即开始', |
| | | icon: 'start|svg', |
| | | //开始计划 |
| | | tooltip: '开始计划', |
| | | icon: 'startplan|svg', |
| | | onClick: handleStart.bind(null, record), |
| | | name: undefined, |
| | | }, |
| | | { |
| | | //立即运行 |
| | | tooltip: '立即运行', |
| | | icon: 'start|svg', |
| | | onClick: RunImmediately.bind(null, record), |
| | | name: undefined, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import { columns, searchFormSchema } from './job.data'; |
| | | import jobDrawer from './jobDrawer.vue'; |
| | | import { FluentJobParam } from '/@/api/tigerapi/model/tskModel'; |
| | | import { getListByPage } from '/@/api/tigerapi/system'; |
| | | import { DeleteTsk_Job, StartTsk_Job, StopTsk_Job } from '/@/api/tigerapi/tsk/tsk_job'; |
| | | import { AddTskJob, DeleteTsk_Job, ImmediateRun, StopTsk_Job } from '/@/api/tigerapi/tsk/tsk_job'; |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import { BasicTable, TableAction, useTable } from '/@/components/Table'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useGo } from '/@/hooks/web/usePage'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const go = useGo(); |
| | | const { t } = useI18n(); |
| | | const { createErrorModal } = useMessage(); |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | | |
| | | const [registerTable, { reload }] = useTable({ |
| | |
| | | // }, |
| | | NeedInclude: true, |
| | | }, |
| | | // afterFetch: afterFetch, |
| | | afterFetch: afterFetch, |
| | | columns, |
| | | formConfig: { |
| | | labelWidth: 120, |
| | |
| | | fixed: undefined, |
| | | }, |
| | | }); |
| | | |
| | | /** |
| | | * @description: 请求之后对返回值进行处理 |
| | | * @param {*} t |
| | | * @return {*} |
| | | */ |
| | | function afterFetch(t) { |
| | | console.log(t); |
| | | t.forEach((item) => { |
| | | item.NextRunTime = item.Triggers[0].NextRunTime; |
| | | }); |
| | | return t; |
| | | } |
| | | |
| | | /** |
| | | * 添加任务 |
| | | */ |
| | |
| | | go('/job_detail/' + record.ID + ',' + record.JobName + ''); |
| | | } |
| | | /** |
| | | * @description: |
| | | * @description: 开始计划 |
| | | * @param {*} record |
| | | * @return {*} |
| | | */ |
| | | function handleStart(record: Recordable) { |
| | | const apiAction = StartTsk_Job(record); |
| | | apiAction.then((action) => { |
| | | const param: FluentJobParam = { |
| | | AssemblyName: record.AssemblyName, |
| | | Args: JSON.parse(record.Triggers[0].Args), |
| | | DataType: record.JobType, |
| | | JobName: record.JobName, |
| | | Remark: record.Remark, |
| | | }; |
| | | AddTskJob(param).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | reload(); |
| | | } else { |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: action.Message, |
| | | getContainer: () => document.body, |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * @description: 立即运行 |
| | | * @param {*} record |
| | | * @return {*} |
| | | */ |
| | | function RunImmediately(record: Recordable) { |
| | | const param: FluentJobParam = { |
| | | AssemblyName: record.AssemblyName, |
| | | Args: JSON.parse(record.Triggers[0].Args), |
| | | DataType: record.JobType, |
| | | JobName: record.JobName, |
| | | Remark: record.Remark, |
| | | }; |
| | | ImmediateRun(param).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | reload(); |
| | | } else { |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: action.Message, |
| | | getContainer: () => document.body, |
| | | }); |
| | | } |
| | | }); |
| | | } |