This commit is contained in:
2025-06-11 20:56:28 +08:00
parent 5bbd60032c
commit 148e78abf9
3 changed files with 89 additions and 6 deletions

View File

@@ -484,6 +484,20 @@ const merchant = {
data: data data: data
}); });
}, },
saveMode: async (data) => {
return request({
url: '/index/task/saveMode',
method: Method.POST,
data: data
});
},
getModeList: async (data) => {
return request({
url: '/index/task/getModeList',
method: Method.POST,
data: data
});
},
} }
export default merchant; export default merchant;

View File

@@ -0,0 +1,63 @@
<script setup>
import {reactive, ref, watch} from "vue";
import Api from "../../../../../api";
import {Message} from "@arco-design/web-vue";
const {id} = defineProps({
id: {
type: Number,
default: null
}
});
const modeList = reactive([]);
const visible = ref(false);
const form = reactive({
remark: null,
});
const success = async () => {
if (form.remark.length > 100) {
Message.warning('不允许大于100字');
return;
}
const {msg} = await Api.merchant.saveMode({
id: id,
...form,
});
Message.success(msg);
}
watch(
() => visible.value,
(val) => {
if (val) Api.merchant.getModeList().then(({data}) => {
modeList.length = 0;
modeList.push(...data);
})
},
{deep: true}
);
</script>
<template>
<div @click="visible=true">
<slot></slot>
</div>
<a-modal
@ok="success"
title="存为模板"
ok-text="确定存为模板"
title-align="start"
v-model:visible="visible">
<div class="text-[14px] text-[#4E5969] mb-[8px]">将该任务存为模板下次新建任务时可一键填写</div>
<a-input v-model:model-value="form.remark" placeholder="请输入模板备注,方便您快速找到该模板"></a-input>
<div class="mt-[20px] text-[14px] text-[#4E5969]">模板已创建</div>
<div class="mt-[8px] text-[14px] text-[#4E5969]"><span class="text-[#165DFF]">{{ modeList.length }}</span>/20
</div>
</a-modal>
</template>
<style scoped lang="scss">
</style>

View File

@@ -7,6 +7,7 @@ import Api from "../../../../api/index.js";
import {toPath} from "../../../../utils/index.js"; import {toPath} from "../../../../utils/index.js";
import {Message} from "@arco-design/web-vue"; import {Message} from "@arco-design/web-vue";
import {usePayTask} from "../../../../hooks/usePayTask.js"; import {usePayTask} from "../../../../hooks/usePayTask.js";
import SaveTemplate from "./components/SaveTemplate.vue";
const columns = [ const columns = [
{ {
@@ -183,7 +184,7 @@ const stopTask = async (id) => {
<template v-slot:start="{record}"> <template v-slot:start="{record}">
<a-switch <a-switch
@change="startTask($event, record)" @change="startTask($event, record)"
:disabled="record.status !== -2 && record.status !== 3 && record.status !== 4" :disabled="record.status !== -2 && record.status !== 3 && record.status !== 4 && record.status !== 2"
:model-value="record.status === 4"> :model-value="record.status === 4">
</a-switch> </a-switch>
</template> </template>
@@ -209,21 +210,26 @@ const stopTask = async (id) => {
</a-link> </a-link>
<a-popconfirm content="确认终止吗?" @ok="stopTask(record.id)"> <a-popconfirm content="确认终止吗?" @ok="stopTask(record.id)">
<a-link :disabled="!(record.status === 4 || record.status === -2)" :hoverable="false" <a-link :disabled="!(record.status === 4 || record.status === -2)" :hoverable="false"
status="danger">终止 status="danger">
终止
</a-link> </a-link>
</a-popconfirm> </a-popconfirm>
</div> </div>
</template> </template>
<template v-slot:exp> <template v-slot:exp="{record}">
<a-trigger trigger="click" :unmount-on-close="false"> <a-trigger trigger="click" :unmount-on-close="false">
<a-link :hoverable="false">更多 <a-link :hoverable="false">更多
<icon-down/> <icon-down/>
</a-link> </a-link>
<template #content> <template #content>
<div class="demo-basic"> <div class="demo-basic">
<a-button type="text"> <SaveTemplate :id="record.id">
存为模版 <a-button
</a-button> type="text"
:disabled="record.status===0 || record.status===1 || record.status===-1">
存为模板
</a-button>
</SaveTemplate>
</div> </div>
</template> </template>
</a-trigger> </a-trigger>