|
|
@@ -1,27 +1,17 @@
|
|
|
<template>
|
|
|
<div class="ma-content-block lg:flex justify-between">
|
|
|
<!-- CRUD 组件 -->
|
|
|
- <sa-table
|
|
|
- ref="crudRef"
|
|
|
- :options="options"
|
|
|
- :columns="columns"
|
|
|
- :searchForm="searchForm"
|
|
|
- >
|
|
|
+ <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
|
|
|
<!-- 搜索区 tableSearch -->
|
|
|
<template #tableSearch>
|
|
|
- <a-col :sm="8" :xs="24">
|
|
|
+ <a-col :sm="6" :xs="24">
|
|
|
<a-form-item field="name" label="任务名称">
|
|
|
<a-input v-model="searchForm.name" placeholder="请输入任务名称" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :sm="8" :xs="24">
|
|
|
+ <a-col :sm="6" :xs="24">
|
|
|
<a-form-item field="type" label="任务类型">
|
|
|
- <a-select
|
|
|
- v-model="searchForm.type"
|
|
|
- :options="types"
|
|
|
- allow-clear
|
|
|
- placeholder="请选择任务类型"
|
|
|
- />
|
|
|
+ <a-select v-model="searchForm.type" :options="types" allow-clear placeholder="请选择任务类型" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</template>
|
|
|
@@ -33,22 +23,13 @@
|
|
|
</template>
|
|
|
<!-- 状态列 -->
|
|
|
<template #status="{ record }">
|
|
|
- <sa-switch
|
|
|
- v-model="record.status"
|
|
|
- @change="changeStatus($event, record.id)"
|
|
|
- ></sa-switch>
|
|
|
+ <sa-switch v-model="record.status" @change="changeStatus($event, record.id)"></sa-switch>
|
|
|
</template>
|
|
|
|
|
|
<!-- 操作前置扩展 -->
|
|
|
<template #operationBeforeExtend="{ record }">
|
|
|
- <a-popconfirm
|
|
|
- content="确定立刻执行一次?"
|
|
|
- position="bottom"
|
|
|
- @ok="run(record)"
|
|
|
- >
|
|
|
- <a-link v-auth="['/tool/crontab/run']"
|
|
|
- ><icon-caret-right /> 执行一次</a-link
|
|
|
- >
|
|
|
+ <a-popconfirm content="确定立刻执行一次?" position="bottom" @ok="run(record)">
|
|
|
+ <a-link v-auth="['/tool/crontab/run']"><icon-caret-right /> 执行一次</a-link>
|
|
|
</a-popconfirm>
|
|
|
<a-link @click="openLogModal(record)"><icon-history /> 日志 </a-link>
|
|
|
</template>
|
|
|
@@ -63,49 +44,49 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, onMounted } from "vue";
|
|
|
-import { Message } from "@arco-design/web-vue";
|
|
|
+import { ref, reactive, onMounted } from 'vue'
|
|
|
+import { Message } from '@arco-design/web-vue'
|
|
|
|
|
|
-import api from "@/api/tool/crontab";
|
|
|
-import LogList from "./logList.vue";
|
|
|
-import EditForm from "./edit.vue";
|
|
|
+import api from '@/api/tool/crontab'
|
|
|
+import LogList from './logList.vue'
|
|
|
+import EditForm from './edit.vue'
|
|
|
|
|
|
-const crudRef = ref();
|
|
|
-const editRef = ref();
|
|
|
-const logsRef = ref();
|
|
|
+const crudRef = ref()
|
|
|
+const editRef = ref()
|
|
|
+const logsRef = ref()
|
|
|
|
|
|
// 搜索表单
|
|
|
const searchForm = ref({
|
|
|
- name: "",
|
|
|
- type: "",
|
|
|
- status: "",
|
|
|
-});
|
|
|
+ name: '',
|
|
|
+ type: '',
|
|
|
+ status: '',
|
|
|
+})
|
|
|
|
|
|
// 类型字典
|
|
|
-const types = [{ label: "类任务", value: 3 }];
|
|
|
+const types = [{ label: '类任务', value: 3 }]
|
|
|
|
|
|
// 修改状态
|
|
|
const changeStatus = async (status, id) => {
|
|
|
- const response = await api.changeStatus({ id, status });
|
|
|
+ const response = await api.changeStatus({ id, status })
|
|
|
if (response.code === 200) {
|
|
|
- Message.success(response.message);
|
|
|
- crudRef.value.refresh();
|
|
|
+ Message.success(response.message)
|
|
|
+ crudRef.value.refresh()
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
// 执行
|
|
|
const run = async (row) => {
|
|
|
- const response = await api.run({ id: row.id });
|
|
|
+ const response = await api.run({ id: row.id })
|
|
|
if (response.code === 200) {
|
|
|
- Message.success(response.message);
|
|
|
- crudRef.value.refresh();
|
|
|
+ Message.success(response.message)
|
|
|
+ crudRef.value.refresh()
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
// 日志窗口
|
|
|
const openLogModal = (row) => {
|
|
|
- logsRef.value.open(row.id);
|
|
|
-};
|
|
|
+ logsRef.value.open(row.id)
|
|
|
+}
|
|
|
|
|
|
// SaTable 基础配置
|
|
|
const options = reactive({
|
|
|
@@ -114,59 +95,59 @@ const options = reactive({
|
|
|
operationColumnWidth: 280,
|
|
|
add: {
|
|
|
show: true,
|
|
|
- auth: ["/tool/crontab/save"],
|
|
|
+ auth: ['/tool/crontab/save'],
|
|
|
func: async () => {
|
|
|
- editRef.value?.open();
|
|
|
+ editRef.value?.open()
|
|
|
},
|
|
|
},
|
|
|
edit: {
|
|
|
show: true,
|
|
|
- auth: ["/tool/crontab/update"],
|
|
|
+ auth: ['/tool/crontab/update'],
|
|
|
func: async (record) => {
|
|
|
- editRef.value?.open("edit");
|
|
|
- editRef.value?.setFormData(record);
|
|
|
+ editRef.value?.open('edit')
|
|
|
+ editRef.value?.setFormData(record)
|
|
|
},
|
|
|
},
|
|
|
delete: {
|
|
|
show: true,
|
|
|
- auth: ["/tool/crontab/destroy"],
|
|
|
+ auth: ['/tool/crontab/destroy'],
|
|
|
func: async (params) => {
|
|
|
- const resp = await api.destroy(params);
|
|
|
+ const resp = await api.destroy(params)
|
|
|
if (resp.code === 200) {
|
|
|
- Message.success(`删除成功!`);
|
|
|
- crudRef.value?.refresh();
|
|
|
+ Message.success(`删除成功!`)
|
|
|
+ crudRef.value?.refresh()
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
-});
|
|
|
+})
|
|
|
|
|
|
// SaTable 列配置
|
|
|
const columns = reactive([
|
|
|
- { title: "任务名称", dataIndex: "name", width: 180 },
|
|
|
+ { title: '任务名称', dataIndex: 'name', width: 180 },
|
|
|
{
|
|
|
- title: "任务类型",
|
|
|
- dataIndex: "type",
|
|
|
- type: "dict",
|
|
|
+ title: '任务类型',
|
|
|
+ dataIndex: 'type',
|
|
|
+ type: 'dict',
|
|
|
options: types,
|
|
|
width: 140,
|
|
|
},
|
|
|
- { title: "任务传参", dataIndex: "parameter", width: 260 },
|
|
|
- { title: "调用目标", dataIndex: "target", width: 260 },
|
|
|
- { title: "状态", dataIndex: "status", dict: "data_status", width: 120 },
|
|
|
- { title: "创建时间", dataIndex: "create_time", width: 180 },
|
|
|
-]);
|
|
|
+ { title: '任务传参', dataIndex: 'parameter', width: 260 },
|
|
|
+ { title: '调用目标', dataIndex: 'target', width: 260 },
|
|
|
+ { title: '状态', dataIndex: 'status', dict: 'data_status', width: 120 },
|
|
|
+ { title: '创建时间', dataIndex: 'create_time', width: 180 },
|
|
|
+])
|
|
|
|
|
|
// 页面数据初始化
|
|
|
-const initPage = async () => {};
|
|
|
+const initPage = async () => {}
|
|
|
|
|
|
// SaTable 数据请求
|
|
|
const refresh = async () => {
|
|
|
- crudRef.value?.refresh();
|
|
|
-};
|
|
|
+ crudRef.value?.refresh()
|
|
|
+}
|
|
|
|
|
|
// 页面加载完成执行
|
|
|
onMounted(async () => {
|
|
|
- initPage();
|
|
|
- refresh();
|
|
|
-});
|
|
|
+ initPage()
|
|
|
+ refresh()
|
|
|
+})
|
|
|
</script>
|