|
@@ -1,20 +1,163 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="car_series">
|
|
|
|
|
- 平台模块
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div class="car_series" v-if="queryTag">
|
|
|
|
|
+ <div class="count">
|
|
|
|
|
+ <button @click="showModal">新增平台</button>
|
|
|
|
|
+ <Count :sum="sum"></Count>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="table">
|
|
|
|
|
+ <Table
|
|
|
|
|
+ :tableData="tableData"
|
|
|
|
|
+ @edit="edit"
|
|
|
|
|
+ @delet_data="deleteData"
|
|
|
|
|
+ @jump_router="jumpRouter"
|
|
|
|
|
+ :pageSize='sum'
|
|
|
|
|
+ ></Table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="page">
|
|
|
|
|
+ <Tablepage
|
|
|
|
|
+ :totalPage="totalPage"
|
|
|
|
|
+ :currentPage="currentPage"
|
|
|
|
|
+ @change_page="changePage"
|
|
|
|
|
+ @jump_page="jumpPage"
|
|
|
|
|
+ ></Tablepage>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="modal" v-if="modalFlag">
|
|
|
|
|
+ <Modal :modalFlag="modalFlag" @hide_modal="showModal" @submit='submit'></Modal>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ <PlatePage />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import Count from "../../components/Count";
|
|
|
|
|
+import Tablepage from "../../components/TablePage";
|
|
|
|
|
+import Table from "./components/PlatformTable";
|
|
|
|
|
+import Modal from "./components/PlatFormModal";
|
|
|
|
|
+import PlatePage from "./components/PlatPage";
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ Count,
|
|
|
|
|
+ Table,
|
|
|
|
|
+ Tablepage,
|
|
|
|
|
+ Modal,
|
|
|
|
|
+ PlatePage,
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ sum: 100, // 一共有多少条数据
|
|
|
|
|
+ pageSize: 20, // 每页展示的数据
|
|
|
|
|
+ currentPage: 1,
|
|
|
|
|
+ // 表格配置
|
|
|
|
|
+ tableData: [],
|
|
|
|
|
+ getDate: [
|
|
|
|
|
+ { platform: "汽车之家", str: "123" },
|
|
|
|
|
+ { platform: "其他", str: "124" },
|
|
|
|
|
+ ],
|
|
|
|
|
+ functionData: [],
|
|
|
|
|
+ modalFlag: false, // 控制模态框展示
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ // 表格总页数
|
|
|
|
|
+ totalPage() {
|
|
|
|
|
+ return Math.ceil(this.sum / this.pageSize);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取路由参数
|
|
|
|
|
+ queryTag() {
|
|
|
|
|
+ return this.$route.query && this.$route.query.tag ? 0 : 1;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ // 获取某一页面的数据,展示在表格
|
|
|
|
|
+ changePage: function (page) {
|
|
|
|
|
+ this.currentPage = page;
|
|
|
|
|
+ console.log(page);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击上一页,下一页,首页,尾页
|
|
|
|
|
+ jumpPage: function (item) {
|
|
|
|
|
+ switch (item) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ this.currentPage = this.currentPage - 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ this.currentPage = this.currentPage + 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ this.currentPage = this.totalPage;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(this.currentPage);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取数据
|
|
|
|
|
+ getData: function () {
|
|
|
|
|
+ this.tableData = [];
|
|
|
|
|
+ this.functionData = [];
|
|
|
|
|
+ this.getDate.forEach((element) => {
|
|
|
|
|
+ this.tableData.push({
|
|
|
|
|
+ platform: element.platform,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.functionData.push({
|
|
|
|
|
+ str: element.str,
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 展示、隐藏模态框
|
|
|
|
|
+ showModal: function () {
|
|
|
|
|
+ this.modalFlag = !this.modalFlag;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 模态框保存
|
|
|
|
|
+ submit: function(plateName) {
|
|
|
|
|
+ console.log('plateName保存', plateName);
|
|
|
|
|
+ this.modalFlag = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击编辑
|
|
|
|
|
+ edit(index, newName) {
|
|
|
|
|
+ console.log(this.functionData[index].str, newName);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击删除
|
|
|
|
|
+ deleteData: function(index) {
|
|
|
|
|
+ console.log("删除", this.functionData[index].str);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击系列车型
|
|
|
|
|
+ jumpRouter: function(index) {
|
|
|
|
|
+ // 页面变化
|
|
|
|
|
+ this.$router.push({ query: { tag: "detail" } });
|
|
|
|
|
+ console.log("点击平台模块", this.functionData[index].str);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 删除数据
|
|
|
|
|
+ detletData: function() {
|
|
|
|
|
+ console.log('删除数据');
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|
|
|
-
|
|
|
|
|
|
|
+.car_series {
|
|
|
|
|
+ .count {
|
|
|
|
|
+ height: 40px;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ button {
|
|
|
|
|
+ width: 86px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ bottom: -5px;
|
|
|
|
|
+ margin: 0;
|
|
|
|
|
+ border-radius: 2px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|