update
This commit is contained in:
@@ -3,18 +3,52 @@ import FormTitle from "../../../../../components/FormTitle/index.vue";
|
||||
import Backfill from "./Backfill.vue";
|
||||
import {v4} from "uuid";
|
||||
import XTimePicker from "../../../../../components/XTimePicker/XTimePicker.vue";
|
||||
import {useTemplateRef} from "vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
import Api from "../../../../../api/index.js";
|
||||
|
||||
const INDEX = ['一', '二', '三'];
|
||||
const emits = defineEmits(['success', 'prev']);
|
||||
const form = defineModel('form');
|
||||
const formRef = useTemplateRef('formRef');
|
||||
const rules = {
|
||||
start_time: [{
|
||||
required: true,
|
||||
message: '任务可接时段不完整',
|
||||
}],
|
||||
end_time: [{
|
||||
required: true,
|
||||
message: '任务可接时段不完整',
|
||||
}],
|
||||
is_other: [],
|
||||
backfill: [{
|
||||
required: true,
|
||||
validator: (value, callback) => {
|
||||
for (const v of value) {
|
||||
if (!v.end_time || !v.start_time || !v.content_id) {
|
||||
callback('回填内容不完整');
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
}
|
||||
|
||||
form.value.backfill.push({
|
||||
if (form.value.backfill.length === 0) form.value.backfill.push({
|
||||
id: v4(),
|
||||
start_time: null,
|
||||
end_time: null,
|
||||
content_id: null
|
||||
});
|
||||
|
||||
if (form.value.is_comment === 1) {
|
||||
Api.merchant.getChooseContent({
|
||||
id: form.value.platform_id,
|
||||
}).then(({data}) => {
|
||||
const k = data.find(v => v.is_comment === 1);
|
||||
form.value.backfill[0].content_id = k.id;
|
||||
})
|
||||
}
|
||||
|
||||
const addHT = () => {
|
||||
form.value.backfill.push({
|
||||
id: v4(),
|
||||
@@ -24,8 +58,15 @@ const addHT = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const success = () => {
|
||||
emits('success', form.value);
|
||||
const success = async () => {
|
||||
formRef.value.validate().then((res) => {
|
||||
if (res) {
|
||||
const firstKey = Object.keys(res)[0];
|
||||
Message.warning(res[firstKey].message);
|
||||
} else {
|
||||
emits('success', form.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -35,11 +76,13 @@ const success = () => {
|
||||
|
||||
<a-form
|
||||
class="mt-[30px]"
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-align="right"
|
||||
:label-col-props="{span: 4}"
|
||||
:wrapper-col-props="{span: 12, offset: 1}">
|
||||
<a-form-item label="任务可接时间段" extra="达人可在此时段内接受任务,超出将无法领取任务">
|
||||
<a-form-item field="start_time" label="任务可接时间段" extra="达人可在此时段内接受任务,超出将无法领取任务">
|
||||
<x-time-picker v-model:start="form.start_time" v-model:end="form.end_time"></x-time-picker>
|
||||
</a-form-item>
|
||||
|
||||
@@ -59,10 +102,11 @@ const success = () => {
|
||||
|
||||
<a-form-item
|
||||
v-for="(item, index) in form.backfill"
|
||||
field="backfill"
|
||||
:key="item.id"
|
||||
:label="`第${INDEX[index]}次回填`">
|
||||
<div class="flex flex-col gap-[20px]">
|
||||
<Backfill :form="form" v-model:po="form.backfill[index]"></Backfill>
|
||||
<Backfill :form="form" :index="index" v-model:po="form.backfill[index]"></Backfill>
|
||||
|
||||
<div class="flex gap-[8px]">
|
||||
<a-button type="outline">
|
||||
|
||||
Reference in New Issue
Block a user