|
|
@@ -8,7 +8,7 @@
|
|
|
<option
|
|
|
v-for="(item, index) in optionList"
|
|
|
:key="index"
|
|
|
- :data-index='index'
|
|
|
+ :data-index="index"
|
|
|
>
|
|
|
{{ item.platformName }}
|
|
|
</option>
|
|
|
@@ -24,12 +24,13 @@
|
|
|
:pageSize="sum"
|
|
|
></Table>
|
|
|
</div>
|
|
|
- <div class="page">
|
|
|
+ <div class="page" v-if="sum !==0">
|
|
|
<Tablepage
|
|
|
:totalPage="totalPage"
|
|
|
:currentPage="currentPage"
|
|
|
@change_page="changePage"
|
|
|
@jump_page="jumpPage"
|
|
|
+ :sum='sum'
|
|
|
></Tablepage>
|
|
|
<Count :sum="sum"></Count>
|
|
|
</div>
|
|
|
@@ -38,7 +39,7 @@
|
|
|
:modalFlag="modalFlag"
|
|
|
@submit="submit"
|
|
|
@hide_modal="showModal"
|
|
|
- :selectedplateForm='selectedplateForm'
|
|
|
+ :selectedplateForm="selectedplateForm"
|
|
|
></Modal>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -60,20 +61,14 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- sum: 86, // 一共有多少条数据
|
|
|
+ sum: 0, // 一共有多少条数据
|
|
|
pageSize: 20, // 每页展示的数据
|
|
|
currentPage: 1,
|
|
|
tableData: [],
|
|
|
- getDate: [
|
|
|
- { time: "2021/03", plate: "汽车之家", num: 5, str: "222" },
|
|
|
- { time: "2021/03", plate: "汽车之家", num: 5, str: "111" },
|
|
|
- { time: "2021/03", plate: "汽车之家", num: 5, str: "333" },
|
|
|
- ],
|
|
|
- functionData: [],
|
|
|
modalFlag: false, // 控制模态框展示
|
|
|
optionList: [],
|
|
|
- selectedForm: '',
|
|
|
- selectedplateForm: {}
|
|
|
+ selectedForm: "",
|
|
|
+ selectedplateForm: {},
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -111,47 +106,40 @@ export default {
|
|
|
}
|
|
|
console.log(this.currentPage);
|
|
|
},
|
|
|
- // 获取数据
|
|
|
- getData: function () {
|
|
|
- this.tableData = [];
|
|
|
- this.functionData = [];
|
|
|
- this.getDate.forEach((element) => {
|
|
|
- this.tableData.push({
|
|
|
- time: element.time,
|
|
|
- plate: element.plate,
|
|
|
- num: element.num,
|
|
|
- });
|
|
|
- this.functionData.push({
|
|
|
- str: element.str,
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
// 展示、隐藏模态框
|
|
|
showModal: function () {
|
|
|
this.modalFlag = !this.modalFlag;
|
|
|
},
|
|
|
// 点击编辑
|
|
|
edit(index, newName) {
|
|
|
- console.log(this.functionData[index].str, newName);
|
|
|
+ console.log(index, newName);
|
|
|
},
|
|
|
// 点击删除
|
|
|
deleteData(index) {
|
|
|
- console.log("删除", this.functionData[index].str);
|
|
|
+ console.log("删除", index);
|
|
|
},
|
|
|
// 模态框保存
|
|
|
submit: function (time, num, obj) {
|
|
|
- let addTime = time.replace('-','/');
|
|
|
+ let addTime = time.replace("-", "/");
|
|
|
this.addMediaPublishInfo(+num, addTime, obj.platformName, obj.id);
|
|
|
this.modalFlag = false;
|
|
|
},
|
|
|
// slectPlatForm
|
|
|
slectPlatForm: function (e) {
|
|
|
// console.log(1111, this.selectedForm);
|
|
|
- let index = e.target.options.selectedIndex
|
|
|
+ let index = e.target.options.selectedIndex;
|
|
|
this.selectedplateForm = this.optionList[index];
|
|
|
+ let id = this.optionList[0]['id'];
|
|
|
+ let req = { id };
|
|
|
+ this.selectMediaPublishList(req);
|
|
|
},
|
|
|
// 新增 接口
|
|
|
- addMediaPublishInfo: function (publishCount, publishMonth, publishPlatformName, publishPlatformId) {
|
|
|
+ addMediaPublishInfo: function (
|
|
|
+ publishCount,
|
|
|
+ publishMonth,
|
|
|
+ publishPlatformName,
|
|
|
+ publishPlatformId
|
|
|
+ ) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
@@ -160,7 +148,7 @@ export default {
|
|
|
publishCount,
|
|
|
publishMonth,
|
|
|
publishPlatformName,
|
|
|
- publishPlatformId
|
|
|
+ publishPlatformId,
|
|
|
},
|
|
|
})
|
|
|
.then((res) => {
|
|
|
@@ -179,17 +167,19 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 获取列表 接口
|
|
|
- selectMediaPublishList: function () {
|
|
|
+ selectMediaPublishList: function (data) {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
url: "/base/mediaPublishManager/selectMediaPublishList",
|
|
|
- data: {},
|
|
|
+ data,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ this.tableData = [];
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
- console.log(res);
|
|
|
- // this.tableData = res.data.data;
|
|
|
+ console.log(res, 2222);
|
|
|
this.sum = res.data.count;
|
|
|
+ this.tableData.push(res.data.data[0]); // 有八条是null,会报错,暂时取第一条
|
|
|
+ console.log(this.tableData);
|
|
|
} else {
|
|
|
console.log(res);
|
|
|
}
|
|
|
@@ -254,32 +244,41 @@ export default {
|
|
|
},
|
|
|
// 获取平台列表 接口
|
|
|
selectPublishPlatformPage: function () {
|
|
|
- this.$http({
|
|
|
- method: "post",
|
|
|
- url: "/base/publishPlatformManager/selectPublishPlatformPage",
|
|
|
- data: {},
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data && res.data.code === 200) {
|
|
|
- console.log(res);
|
|
|
- this.optionList = res.data.data;
|
|
|
- this.selectedForm = this.optionList[0]['platformName'];
|
|
|
- this.selectedplateForm = this.optionList[0];
|
|
|
- } else {
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$http({
|
|
|
+ method: "post",
|
|
|
+ url: "/base/publishPlatformManager/selectPublishPlatformPage",
|
|
|
+ data: {},
|
|
|
})
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data.code === 200) {
|
|
|
+ console.log(res, 111);
|
|
|
+ this.optionList = res.data.data;
|
|
|
+ this.selectedForm = this.optionList[0]["platformName"];
|
|
|
+ this.selectedplateForm = this.optionList[0];
|
|
|
+ resolve();
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ reject();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ reject();
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getData();
|
|
|
},
|
|
|
created() {
|
|
|
- this.selectMediaPublishList();
|
|
|
- this.selectPublishPlatformPage();
|
|
|
+ this.selectPublishPlatformPage().then(() => {
|
|
|
+ let id = this.optionList[0]['id'];
|
|
|
+ let req = { id };
|
|
|
+ this.selectMediaPublishList(req);
|
|
|
+ }).catch((err) =>{
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
},
|
|
|
};
|
|
|
</script>
|