|
|
@@ -11,17 +11,17 @@
|
|
|
@edit="edit"
|
|
|
@delet_data="deleteData"
|
|
|
@car_type="carType"
|
|
|
- :pageSize="sum"
|
|
|
+ :pageSize="pageSize"
|
|
|
></Table>
|
|
|
</div>
|
|
|
- <!-- <div class="page">
|
|
|
+ <div class="page">
|
|
|
<Tablepage
|
|
|
:totalPage="totalPage"
|
|
|
:currentPage="currentPage"
|
|
|
@change_page="changePage"
|
|
|
@jump_page="jumpPage"
|
|
|
></Tablepage>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
<div class="modal" v-if="modalFlag">
|
|
|
<Modal
|
|
|
:modalFlag="modalFlag"
|
|
|
@@ -38,7 +38,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Count from "../../components/Count";
|
|
|
-// import Tablepage from "../../components/TablePage";
|
|
|
+import Tablepage from "../../components/TablePage";
|
|
|
import Table from "./components/Carseries/CarSeriesTable";
|
|
|
import Modal from "./components/Carseries/CarSeriesModal";
|
|
|
import CarType from "./components/Carseries/CarType";
|
|
|
@@ -46,25 +46,24 @@ export default {
|
|
|
components: {
|
|
|
Count,
|
|
|
Table,
|
|
|
- // Tablepage,
|
|
|
+ Tablepage,
|
|
|
Modal,
|
|
|
CarType,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
sum: 0, // 一共有多少条数据
|
|
|
- // pageSize: 20, // 每页展示的数据
|
|
|
- // currentPage: 1,
|
|
|
- // 表格配置
|
|
|
+ pageSize: 20, // 每页展示的数据
|
|
|
+ currentPage: 1,
|
|
|
tableData: [],
|
|
|
modalFlag: false, // 控制模态框展示
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
// 表格总页数
|
|
|
- // totalPage() {
|
|
|
- // return Math.ceil(this.sum / this.pageSize);
|
|
|
- // },
|
|
|
+ totalPage() {
|
|
|
+ return Math.ceil(this.sum / this.pageSize);
|
|
|
+ },
|
|
|
// 获取路由参数
|
|
|
queryTag() {
|
|
|
return this.$route.query && this.$route.query.tag ? 0 : 1;
|
|
|
@@ -72,28 +71,28 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取某一页面的数据,展示在表格
|
|
|
- // changePage: function (page) {
|
|
|
- // this.currentPage = page;
|
|
|
- // console.log(page);
|
|
|
- // },
|
|
|
+ changePage: function (page) {
|
|
|
+ this.currentPage = page;
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
+ },
|
|
|
// 点击上一页,下一页,首页,尾页
|
|
|
- // 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);
|
|
|
- // },
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
+ },
|
|
|
// 展示、隐藏模态框
|
|
|
showModal: function () {
|
|
|
this.modalFlag = !this.modalFlag;
|
|
|
@@ -101,35 +100,36 @@ export default {
|
|
|
// 模态框保存
|
|
|
submit: function (car) {
|
|
|
this.addCarSeries(car).then(() => {
|
|
|
- this.getDateList();
|
|
|
+ this.currentPage = Math.ceil((this.sum + 1) / this.pageSize);
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
});
|
|
|
this.modalFlag = false;
|
|
|
},
|
|
|
// 点击编辑
|
|
|
edit(index, newName) {
|
|
|
let id = this.tableData[index]["id"];
|
|
|
- console.log(id, newName);
|
|
|
let req = {
|
|
|
id,
|
|
|
typeName: newName,
|
|
|
};
|
|
|
this.updataCarTypeInfo(req).then(() => {
|
|
|
- this.getDateList();
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
});
|
|
|
},
|
|
|
// 点击删除
|
|
|
deleteData: function (index) {
|
|
|
let id = this.tableData[index]["id"];
|
|
|
- console.log(id);
|
|
|
this.deleteCarTypeInfo(id).then(() => {
|
|
|
- this.getDateList();
|
|
|
+ this.currentPage = Math.ceil((this.sum - 1) / this.pageSize);
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
});
|
|
|
- console.log("删除", index);
|
|
|
},
|
|
|
// 点击系列车型
|
|
|
carType: function (index) {
|
|
|
// 页面变化
|
|
|
- this.$router.push({ query: { tag: "vehicle_type", id: this.tableData[index]['id'] } });
|
|
|
+ this.$router.push({
|
|
|
+ query: { tag: "vehicle_type", id: this.tableData[index]["id"] },
|
|
|
+ });
|
|
|
},
|
|
|
// 新增车系 接口
|
|
|
addCarSeries: function (typeName) {
|
|
|
@@ -154,11 +154,14 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 获取列表数据 接口
|
|
|
- getDateList: function () {
|
|
|
+ getDateList: function (page, rows) {
|
|
|
this.$http({
|
|
|
method: "post",
|
|
|
url: "/base/carTypeManager/selectCarTypePage",
|
|
|
- data: {},
|
|
|
+ data: {
|
|
|
+ page,
|
|
|
+ rows,
|
|
|
+ },
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.data && res.data.code === 200) {
|
|
|
@@ -203,7 +206,7 @@ export default {
|
|
|
method: "post",
|
|
|
data: {
|
|
|
id,
|
|
|
- parentId:id
|
|
|
+ parentId: id,
|
|
|
},
|
|
|
})
|
|
|
.then((res) => {
|
|
|
@@ -223,7 +226,7 @@ export default {
|
|
|
},
|
|
|
mounted() {},
|
|
|
created() {
|
|
|
- this.getDateList();
|
|
|
+ this.getDateList(this.currentPage, this.pageSize);
|
|
|
},
|
|
|
};
|
|
|
</script>
|