|
@@ -77,14 +77,15 @@
|
|
<el-table :data="contentVipPlatformList" border style="width: min-content">
|
|
<el-table :data="contentVipPlatformList" border style="width: min-content">
|
|
<el-table-column prop="platformId" label="资源平台" width="180">
|
|
<el-table-column prop="platformId" label="资源平台" width="180">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-select v-model="scope.row.platformId" placeholder="请选择流量平台" clearable>
|
|
|
|
|
|
+ <el-select v-model="scope.row.platformId" placeholder="请选择流量平台" clearable
|
|
|
|
+ @change="handlePlatformChange(scope.row, scope.$index)">
|
|
<el-option v-for="item in platformOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
<el-option v-for="item in platformOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="contentVip" label="设备会员收费时间" width="180">
|
|
<el-table-column prop="contentVip" label="设备会员收费时间" width="180">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-select v-model="scope.row.contentVip" placeholder="请设备会员收费时间" clearable>
|
|
|
|
|
|
+ <el-select v-model="scope.row.contentVip" placeholder="默认关闭" clearable>
|
|
<el-option v-for="item in contentVipOptions" :key="item.value" :label="item.label"
|
|
<el-option v-for="item in contentVipOptions" :key="item.value" :label="item.label"
|
|
:value="item.value" />
|
|
:value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
@@ -362,6 +363,21 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ handlePlatformChange(row, index) {
|
|
|
|
+ // 检查是否有重复的platformId
|
|
|
|
+ const value = row.platformId;
|
|
|
|
+ if (!value) return;
|
|
|
|
+
|
|
|
|
+ const exists = this.contentVipPlatformList.some(
|
|
|
|
+ (item, idx) => item.platformId === value && idx !== index
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if (exists) {
|
|
|
|
+ // 如果存在重复,清空当前选择并提示
|
|
|
|
+ this.$set(row, 'platformId', null);
|
|
|
|
+ this.$message.warning('该资源平台已存在,请选择其他平台');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 详情
|
|
// 详情
|
|
getList() {
|
|
getList() {
|
|
if (this.$route.query.id) {
|
|
if (this.$route.query.id) {
|
|
@@ -370,8 +386,15 @@ export default {
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
this.form = res.data;
|
|
this.form = res.data;
|
|
- this.contentVipPlatformList = this.form.contentVipPlatformList;
|
|
|
|
- this.isShowPlatform = this.form.contentVipPlatformList.length > 0;
|
|
|
|
|
|
+ this.form.contentVipPlatformList.forEach((item) => {
|
|
|
|
+ if (item.platformId > 0) {
|
|
|
|
+ this.contentVipPlatformList.push({
|
|
|
|
+ platformId: item.platformId,
|
|
|
|
+ contentVip: item.contentVip,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.isShowPlatform = this.contentVipPlatformList.length > 0;
|
|
this.form.typeList.map((i) => {
|
|
this.form.typeList.map((i) => {
|
|
this.devModeOptions[i.type - 1].disabled = true;
|
|
this.devModeOptions[i.type - 1].disabled = true;
|
|
});
|
|
});
|
|
@@ -547,7 +570,8 @@ export default {
|
|
},
|
|
},
|
|
clickAddPlatform() {
|
|
clickAddPlatform() {
|
|
this.isShowPlatform = true;
|
|
this.isShowPlatform = true;
|
|
- if (this.platformOptions.length != 0 && this.contentVipPlatformList.length <= this.platformOptions.length) {
|
|
|
|
|
|
+ if (this.platformOptions.length != 0 && this.contentVipPlatformList.length < this.platformOptions.length) {
|
|
|
|
+
|
|
this.contentVipPlatformList.push({ "contentVip": null, "platformId": null, });
|
|
this.contentVipPlatformList.push({ "contentVip": null, "platformId": null, });
|
|
} else {
|
|
} else {
|
|
let tips = `最多只能添加${this.platformOptions.length}个平台`;
|
|
let tips = `最多只能添加${this.platformOptions.length}个平台`;
|