|
@@ -1,6 +1,6 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, provide, reactive, ref, Ref } from 'vue';
|
|
|
-import { Search } from '@element-plus/icons-vue';
|
|
|
+import { Search, WarningFilled } from '@element-plus/icons-vue';
|
|
|
import { TemplateType } from '../utils/enum';
|
|
|
import { DelObj, GetList } from '/@/views/efTools/automation/api';
|
|
|
import SelectBotton from '/@/components/select-button/index.vue';
|
|
@@ -18,8 +18,9 @@ import AutomatedRuleTips from '/@/views/efTools/automation/components/automatedR
|
|
|
const autoInfo = ref(false);
|
|
|
//关联广告活动弹窗
|
|
|
const isDialogVisible = ref(false);
|
|
|
-const templateId = ref('');
|
|
|
-const activeModel = ref('');
|
|
|
+// const templateId = ref('');
|
|
|
+// const activeModel = ref('');
|
|
|
+const rowData = ref({});
|
|
|
provide('isDialogVisible', isDialogVisible);
|
|
|
|
|
|
//查询
|
|
@@ -53,60 +54,6 @@ const dyComponents = {
|
|
|
6: NegKeywordTmpl,
|
|
|
};
|
|
|
|
|
|
-function refreshTable() {
|
|
|
- showDrawer.value = false;
|
|
|
- getList();
|
|
|
-}
|
|
|
-
|
|
|
-const showDialog = (row: any) => {
|
|
|
- templateId.value = row.id;
|
|
|
- activeModel.value = row.rule.activeModel;
|
|
|
- isDialogVisible.value = true;
|
|
|
-};
|
|
|
-
|
|
|
-function handleClick() {
|
|
|
- autoInfo.value = true;
|
|
|
-}
|
|
|
-
|
|
|
-function createTmpl(val: number) {
|
|
|
- mode.value = 'add';
|
|
|
- delete formData.value.id;
|
|
|
- formData.value.name = '';
|
|
|
- formData.value.rule = {
|
|
|
- type: val,
|
|
|
- campaignType: '',
|
|
|
- campaignAd: [],
|
|
|
- action: {},
|
|
|
- activeModel: '',
|
|
|
- setTime: '',
|
|
|
- weekdays: [],
|
|
|
- conditions: [],
|
|
|
- };
|
|
|
- showDrawer.value = true;
|
|
|
-}
|
|
|
-
|
|
|
-function editTmpl(row: any) {
|
|
|
- mode.value = 'edit';
|
|
|
- formData.value.id = row.id;
|
|
|
- formData.value.name = row.name;
|
|
|
- formData.value.rule = row.rule;
|
|
|
- showDrawer.value = true;
|
|
|
-}
|
|
|
-
|
|
|
-async function deleteTmpl(row: any) {
|
|
|
- await DelObj(row.id);
|
|
|
- await getList();
|
|
|
-}
|
|
|
-
|
|
|
-async function submitFormData() {
|
|
|
- if (mode.value === 'add') {
|
|
|
- await AddObj(formData.value);
|
|
|
- } else if (mode.value === 'edit') {
|
|
|
- await UpdateObj(formData.value);
|
|
|
- }
|
|
|
- refreshTable();
|
|
|
-}
|
|
|
-
|
|
|
//表格配置
|
|
|
const gridOptions = reactive({
|
|
|
//border: 'inner',
|
|
@@ -161,6 +108,61 @@ const gridEvents = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+function refreshTable() {
|
|
|
+ showDrawer.value = false;
|
|
|
+ getList();
|
|
|
+}
|
|
|
+
|
|
|
+const showDialog = (row: any) => {
|
|
|
+ // templateId.value = row.id;
|
|
|
+ // activeModel.value = row.rule.activeModel;
|
|
|
+ rowData.value = row;
|
|
|
+ isDialogVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+function handleClick() {
|
|
|
+ autoInfo.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+function createTmpl(val: number) {
|
|
|
+ mode.value = 'add';
|
|
|
+ delete formData.value.id;
|
|
|
+ formData.value.name = '';
|
|
|
+ formData.value.rule = {
|
|
|
+ type: val,
|
|
|
+ campaignType: '',
|
|
|
+ campaignAd: [],
|
|
|
+ action: {},
|
|
|
+ activeModel: '',
|
|
|
+ setTime: '',
|
|
|
+ weekdays: [],
|
|
|
+ conditions: [],
|
|
|
+ };
|
|
|
+ showDrawer.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+function editTmpl(row: any) {
|
|
|
+ mode.value = 'edit';
|
|
|
+ formData.value.id = row.id;
|
|
|
+ formData.value.name = row.name;
|
|
|
+ formData.value.rule = row.rule;
|
|
|
+ showDrawer.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+async function deleteTmpl(row: any) {
|
|
|
+ await DelObj(row.id);
|
|
|
+ await getList();
|
|
|
+}
|
|
|
+
|
|
|
+async function submitFormData() {
|
|
|
+ if (mode.value === 'add') {
|
|
|
+ await AddObj(formData.value);
|
|
|
+ } else if (mode.value === 'edit') {
|
|
|
+ await UpdateObj(formData.value);
|
|
|
+ }
|
|
|
+ refreshTable();
|
|
|
+}
|
|
|
+
|
|
|
function handleTypeChange() {
|
|
|
localStorage.setItem('templateType', JSON.stringify(templateType.value));
|
|
|
getList();
|
|
@@ -269,7 +271,27 @@ onMounted(() => {
|
|
|
<template #operate="{ row }">
|
|
|
<el-button icon="Edit" style="color: #0b52a7" type="text" @click="editTmpl(row)"></el-button>
|
|
|
<el-button icon="SetUp" style="color: #0b52a7" type="text" @click="showDialog(row)"></el-button>
|
|
|
- <el-button icon="Delete" style="color: #0b52a7" type="text" @click="deleteTmpl(row)"></el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ width="300"
|
|
|
+ :icon="WarningFilled"
|
|
|
+ icon-color="#ff8d2b"
|
|
|
+ title="删除模板后,所有使用该模板的广告活动将暂停相关自动化规则"
|
|
|
+ @confirm="deleteTmpl(row)"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <el-button icon="Delete" style="color: #0b52a7" type="text"></el-button>
|
|
|
+ </template>
|
|
|
+ <template #actions="{ confirm, cancel }">
|
|
|
+ <el-button size="small" @click="cancel">No!</el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="confirm"
|
|
|
+ >
|
|
|
+ Yes?
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
</template>
|
|
|
<template #type="{row}">
|
|
|
<!--<el-tag :type="getTagType(row.rule.typeLabelWithColor.type)">-->
|
|
@@ -290,7 +312,7 @@ onMounted(() => {
|
|
|
@refresh="refreshTable"></component>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
- <AdActivityDialog v-if="isDialogVisible" v-model="isDialogVisible" :activeModel="activeModel" :templateId="templateId" @confirmSuccess="getList"/>
|
|
|
+ <AdActivityDialog v-if="isDialogVisible" v-model="isDialogVisible" :rowData @confirmSuccess="getList"/>
|
|
|
<AutomatedRuleTips v-model="autoInfo"></AutomatedRuleTips>
|
|
|
</template>
|
|
|
|