Commit ac7b0e9f authored by 水落(YangLei)'s avatar 水落(YangLei)

feat: 任务管理完成

parent c351dac8
import { request, METHOD } from '@/utils';
export * from './menu';
export * from './system';
export * from './task';
export function getUserDetailInfoApi() {
return request('/api/v1/detail', METHOD.GET);
......
import { postReq, putReq } from '@/utils';
export function addTaskApi(data) {
return postReq('/api/v1/schedules', data);
}
export function updateTaskApi(data) {
return putReq('/api/v1/schedules', data);
}
<template>
<div class="components-input-demo-presuffix">
<a-input :placeholder="placeholder" :value="cron" @input="handleinput">
<a-icon slot="prefix" type="schedule" title="corn控件" @click="openModal" />
<a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空" />
</a-input>
<AntCron ref="innerVueCron" :data="afterCron" @ok="handleOK"></AntCron>
</div>
<div class="components-input-demo-presuffix">
<a-input :placeholder="placeholder" :value="cron" @input="handleinput" :disabled="disabled">
<a-icon slot="prefix" type="schedule" title="corn控件" @click="openModal" />
<a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空" />
</a-input>
<AntCron ref="innerVueCron" :data="afterCron" @ok="handleOK"></AntCron>
</div>
</template>
<script>
import AntCron from "./AntCron";
import { replaceWeekName } from "./validator";
import AntCron from './AntCron';
import { replaceWeekName } from './validator';
export default {
name: "ACron",
components: {
AntCron
},
props: {
value: {
required: false,
type: String,
default: ""
name: 'ACron',
components: {
AntCron,
},
placeholder: {
required: false,
type: String,
default: ""
}
},
data() {
return {
cron: this.value,
afterCron: ""
};
},
watch: {
value(val) {
this.cron = val;
props: {
value: {
required: false,
type: String,
default: '',
},
placeholder: {
required: false,
type: String,
default: '',
},
disabled: Boolean,
},
cron(val) {
console.log(replaceWeekName(val));
this.afterCron = replaceWeekName(val);
console.log(val);
this.$emit("input", val);
}
},
methods: {
openModal() {
this.$refs.innerVueCron.show();
data() {
return {
cron: this.value,
afterCron: '',
};
},
handleOK(val) {
this.cron = val;
this.$emit("change", this.cron);
watch: {
value(val) {
this.cron = val;
},
cron(val) {
console.log(replaceWeekName(val));
this.afterCron = replaceWeekName(val);
console.log(val);
this.$emit('input', val);
},
},
handleinput(evt) {
this.cron = evt.target.value;
if (this.cron !== "") {
this.$emit("change", this.cron);
} else {
this.$emit("change", undefined);
}
methods: {
openModal() {
if (this.disabled) return;
this.$refs.innerVueCron.show();
},
handleOK(val) {
this.cron = val;
this.$emit('change', this.cron);
},
handleinput(evt) {
this.cron = evt.target.value;
if (this.cron !== '') {
this.$emit('change', this.cron);
} else {
this.$emit('change', undefined);
}
},
handleEmpty() {
if (this.disabled) return;
this.handleOK('');
},
},
model: {
prop: 'value',
event: 'change',
},
handleEmpty() {
this.handleOK("");
}
},
model: {
prop: "value",
event: "change"
}
};
</script>
<style scoped>
.components-input-demo-presuffix .anticon-close-circle {
cursor: pointer;
color: #ccc;
transition: color 0.3s;
font-size: 12px;
cursor: pointer;
color: #ccc;
transition: color 0.3s;
font-size: 12px;
}
.components-input-demo-presuffix .anticon-close-circle:hover {
color: #f5222d;
color: #f5222d;
}
.components-input-demo-presuffix .anticon-close-circle:active {
color: #666;
color: #666;
}
</style>
\ No newline at end of file
</style>
This diff is collapsed.
......@@ -20,15 +20,16 @@ export default {
async submit() {
await this.$refs.DrawerForm.validate();
if (this.isAdd) {
return this?.add();
return this.add();
}
if (this.isEdit) {
return this?.edit();
return this.edit();
}
},
setData(data, type) {
this.form = { ...data };
this.type = type;
console.log(data, type);
},
},
};
......@@ -62,7 +62,6 @@ export default {
},
created() {
this.init();
console.log(this.buttonsArr);
},
computed: {
basicBtns() {
......
......@@ -180,6 +180,7 @@ export default {
this.addVisible = true;
this.type = 0;
this.noFooter = false;
this.title = '新增';
},
addDrawerClose() {
this.addVisible = false;
......
......@@ -37,7 +37,6 @@ export default {
addBtn: {
text: '新建',
onOk() {
console.log(vm.addCom);
return vm.addCom ? vm.$refs['addCom']?.submit() : vm.$refs['addForm']?.submit();
},
onCancel() {
......@@ -50,7 +49,7 @@ export default {
{
label: '新增组件',
option: {
type: 'danger',
style: 'color: #ff4d4f',
},
click(row) {
vm.show();
......
<template>
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-form-model-item label="任务名称" prop="jobName">
<a-input v-model="form.jobName" :disabled="isView" />
<a-form-model-item label="任务名称" prop="taskName">
<a-input v-model="form.taskName" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="调度规则" prop="jobDescription">
<a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" />
<a-form-model-item label="调度规则" prop="taskRule">
<ACron v-model="form.taskRule" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="实现类" prop="jobDescription">
<a-input v-model="form.jobDescription" :disabled="isView" />
<a-form-model-item label="实现类" prop="implementClass">
<a-input v-model="form.implementClass" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="说明" prop="jobDescription">
<a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" />
<a-form-model-item label="说明" prop="remark">
<a-textarea v-model="form.remark" :disabled="isView" :rows="4" />
</a-form-model-item>
</a-form-model>
</template>
<script>
import JobsApi from '@/api/organization';
import { addTaskApi, updateTaskApi } from '@/api';
import FormMixin from '@/components/FormMixin';
import ACron from '@/components/Acron/ACron.vue';
export default {
components: { ACron },
props: ['row'],
mixins: [FormMixin],
data() {
return {
rules: {
jobName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
jobDescription: [
{ required: true, message: 'Please select Activity zone', trigger: 'change' },
],
taskName: [{ required: true }],
taskRule: [{ required: true }],
},
};
},
methods: {
add() {
return JobsApi.add({ ...this.form });
return addTaskApi({ ...this.form });
},
edit() {
return JobsApi.update({ ...this.form });
return updateTaskApi({ ...this.form });
},
},
};
......
<template>
<my-table url="/api/v1/schedules" rowKey="taskId" :addBtn="addBtn" ref="table">
<template #drawer>
<Form ref="form" />
<Form ref="form" :row="currentClickRow" />
</template>
<a-table-column title="任务名称" data-index="taskName" />
<a-table-column title="调度规则" data-index="taskRule" />
......@@ -23,7 +23,12 @@ export default {
components: { ActionButton, Form },
data() {
return {
addBtn: {},
addBtn: {
onOk: () => {
return this.$refs.form.submit();
},
},
currentClickRow: null,
buttons: [
{
label: '查看',
......@@ -47,8 +52,9 @@ export default {
type: 'confirm',
label: '失效',
title: '确认是否失效?',
url: row => `/api/v1/schedules/${row.taskId}`,
url: row => ({ url: `/api/v1/schedules/${row.taskId}/pause`, method: 'del' }),
after: () => this.refreshTable(),
isHidden: row => row.isPaused === 1,
},
{
type: 'confirm',
......
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