|
|
@ -7,22 +7,31 @@
|
|
|
|
:data="list"
|
|
|
|
:data="list"
|
|
|
|
:operation="['create', 'search', 'remove']"
|
|
|
|
:operation="['create', 'search', 'remove']"
|
|
|
|
:reset="handleReset"
|
|
|
|
:reset="handleReset"
|
|
|
|
|
|
|
|
:sortable="!!(state.condition.platform && state.condition.location)"
|
|
|
|
title="广告"
|
|
|
|
title="广告"
|
|
|
|
:total="total"
|
|
|
|
:total="total"
|
|
|
|
@create="handleCreate"
|
|
|
|
@create="handleCreate"
|
|
|
|
@remove="handleRemove"
|
|
|
|
@remove="handleRemove"
|
|
|
|
|
|
|
|
@row-sort="handleSort"
|
|
|
|
@search="handleSearch"
|
|
|
|
@search="handleSearch"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
<template #operation>
|
|
|
|
|
|
|
|
<el-tag style="margin-left: 20px">选择广告平台和广告位置后可以对广告进行拖动排序</el-tag>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<template #search>
|
|
|
|
<template #search>
|
|
|
|
<el-form inline>
|
|
|
|
<el-form inline>
|
|
|
|
<el-form-item label="广告名称" prop="name">
|
|
|
|
<el-form-item label="广告平台" prop="platform">
|
|
|
|
<el-input v-model="state.condition.name" />
|
|
|
|
<el-select v-model="state.condition.platform" :opts="opts.platform" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="广告位置" prop="location">
|
|
|
|
<el-form-item label="广告位置" prop="location">
|
|
|
|
<el-select v-model="state.condition.location" :opts="opts.location" />
|
|
|
|
<el-select
|
|
|
|
|
|
|
|
v-model="state.condition.location"
|
|
|
|
|
|
|
|
:config="{ disabled: (item, index) => state.condition.platform === 2 && index !== 0 }"
|
|
|
|
|
|
|
|
:opts="opts.location"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="广告平台" prop="platform">
|
|
|
|
<el-form-item label="广告名称" prop="name">
|
|
|
|
<el-select v-model="state.condition.platform" :opts="opts.platform" />
|
|
|
|
<el-input v-model="state.condition.name" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="是否启用" prop="isEnable">
|
|
|
|
<el-form-item label="是否启用" prop="isEnable">
|
|
|
|
<el-select v-model="state.condition.isEnable" :opts="opts.status" />
|
|
|
|
<el-select v-model="state.condition.isEnable" :opts="opts.status" />
|
|
|
@ -87,6 +96,19 @@
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
onActivated(handleSearch);
|
|
|
|
onActivated(handleSearch);
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
[() => state.condition.platform, () => state.condition.location],
|
|
|
|
|
|
|
|
(value) => {
|
|
|
|
|
|
|
|
if (value[0] && value[1]) {
|
|
|
|
|
|
|
|
if (value[0] === 2) {
|
|
|
|
|
|
|
|
state.condition.location = 1;
|
|
|
|
|
|
|
|
store.commit('advertise/setCondition', _.cloneDeep(state.condition));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
handleSearch();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
|
|
|
);
|
|
|
|
const handleCreate = () => {
|
|
|
|
const handleCreate = () => {
|
|
|
|
router.push({ name: 'CreateAdvertise' });
|
|
|
|
router.push({ name: 'CreateAdvertise' });
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -104,6 +126,17 @@
|
|
|
|
await store.dispatch('advertise/enable', row);
|
|
|
|
await store.dispatch('advertise/enable', row);
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleSort = async (newIndex, oldIndex) => {
|
|
|
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
await store.dispatch('advertise/sort', {
|
|
|
|
|
|
|
|
id: unref(list)[newIndex].id,
|
|
|
|
|
|
|
|
platform: state.condition.platform,
|
|
|
|
|
|
|
|
location: state.condition.location,
|
|
|
|
|
|
|
|
oldSort: unref(list)[newIndex].sort,
|
|
|
|
|
|
|
|
newSort: unref(list)[oldIndex].sort,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
const config = reactive({
|
|
|
|
const config = reactive({
|
|
|
|
// 表格列配置
|
|
|
|
// 表格列配置
|
|
|
|
columns: [
|
|
|
|
columns: [
|
|
|
@ -188,11 +221,4 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
<style lang="less" scoped></style>
|
|
|
|
.col {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|