|
|
@@ -119,7 +119,12 @@
|
|
|
投放配置
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
-
|
|
|
+ <el-tooltip content="复制配置" placement="top">
|
|
|
+ <el-button link type="success" size="small" @click="handleCopyUpdate(scope.row, 'edit')" v-hasPermi="['business:config:edit']">
|
|
|
+ <el-icon><Setting /></el-icon>
|
|
|
+ 复制配置
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
<!-- 停止按钮 -->
|
|
|
<!-- 动态:停止 或 开始 按钮 -->
|
|
|
<template v-if="scope.row.enabled">
|
|
|
@@ -386,7 +391,24 @@ const handleUpdate = async (row, action = 'edit') => {
|
|
|
|
|
|
dialog.visible = true;
|
|
|
};
|
|
|
-
|
|
|
+const handleCopyUpdate = async (row, action = 'edit') => {
|
|
|
+ reset();
|
|
|
+ resetFormPrize();
|
|
|
+ mode.value = action; // 设置模式
|
|
|
+ dialog.title = action === 'view' ? '复制投放设置' : '复制投放设置';
|
|
|
+ const _id = row?.id || ids.value[0];
|
|
|
+ const res = await getConfig(_id);
|
|
|
+ res.data.id = null;
|
|
|
+ // 1. 赋值 form
|
|
|
+ Object.assign(form.value, res.data);
|
|
|
+ // 2. 处理 execTimes -> formPrize.rewards
|
|
|
+ if (res.data.execTimes && Array.isArray(res.data.execTimes)) {
|
|
|
+ formPrize.rewards = res.data.execTimes.filter((time) => time).map((time) => ({ execDates: time }));
|
|
|
+ } else {
|
|
|
+ formPrize.rewards = [{ execDates: '' }]; // 默认一个空行
|
|
|
+ }
|
|
|
+ dialog.visible = true;
|
|
|
+};
|
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
|
configFormRef.value?.validate(async (valid: boolean) => {
|