|
|
@@ -1,20 +1,187 @@
|
|
|
<template>
|
|
|
- <div class="car_series">
|
|
|
- 链接上传
|
|
|
+ <div>
|
|
|
+ <div class="link_upload">
|
|
|
+ <div class="count">
|
|
|
+ <div class="select">
|
|
|
+ <p>上传平台</p>
|
|
|
+ <select @change="slectPlatForm()" v-model="selectedForm">
|
|
|
+ <option
|
|
|
+ v-for="(item, index) in optionList" :key="index"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ {{item}}
|
|
|
+ </option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div @click="showModal" class="current_button">新增</div>
|
|
|
+ </div>
|
|
|
+ <div class="table">
|
|
|
+ <Table
|
|
|
+ :tableData='tableData'
|
|
|
+ @edit='edit'
|
|
|
+ @delet_data='deleteData'
|
|
|
+ :pageSize='sum'
|
|
|
+ ></Table>
|
|
|
+ </div>
|
|
|
+ <div class="page">
|
|
|
+ <Tablepage
|
|
|
+ :totalPage='totalPage'
|
|
|
+ :currentPage='currentPage'
|
|
|
+ @change_page='changePage'
|
|
|
+ @jump_page='jumpPage'
|
|
|
+ ></Tablepage>
|
|
|
+ <Count :sum='sum'></Count>
|
|
|
+ </div>
|
|
|
+ <div class="modal" v-if="modalFlag">
|
|
|
+ <Modal
|
|
|
+ :modalFlag='modalFlag'
|
|
|
+ :selectedForm='selectedForm'
|
|
|
+ @submit='submit'
|
|
|
+ @hide_modal='showModal'
|
|
|
+ ></Modal>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import Count from '../../components/Count';
|
|
|
+import Tablepage from '../../components/TablePage';
|
|
|
+import Table from './components/LinkUpload/Table';
|
|
|
+import Modal from "./components/LinkUpload/Modal";
|
|
|
+
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ Count,
|
|
|
+ Table,
|
|
|
+ Tablepage,
|
|
|
+ Modal
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ sum: 86, // 一共有多少条数据
|
|
|
+ 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: ['汽车之家', 'aa', 'bb', 'ss'],
|
|
|
+ selectedForm: '汽车之家'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ // 表格总页数
|
|
|
+ totalPage() {
|
|
|
+ return Math.ceil(this.sum/this.pageSize);
|
|
|
+ },
|
|
|
+ // 获取路由参数
|
|
|
+ queryTag() {
|
|
|
+ console.log (111, this.$route.query);
|
|
|
+ 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(
|
|
|
+ {
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ // 点击删除
|
|
|
+ deleteData (index) {
|
|
|
+ console.log('删除', this.functionData[index].str)
|
|
|
+ },
|
|
|
+ // 模态框保存
|
|
|
+ submit: function(time, num) {
|
|
|
+ console.log('保存', time, num);
|
|
|
+ this.modalFlag = false;
|
|
|
+ },
|
|
|
+ // slectPlatForm
|
|
|
+ slectPlatForm: function() {
|
|
|
+ console.log(this.selectedForm);
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.getData();
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
-
|
|
|
+.link_upload{
|
|
|
+ .count{
|
|
|
+ margin-top: 10px;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ .select{
|
|
|
+ display: flex;
|
|
|
+ padding-left: 20px;
|
|
|
+ p{
|
|
|
+ height: 28px;
|
|
|
+ line-height: 28px;
|
|
|
+ width: 70px;
|
|
|
+ }
|
|
|
+ select{
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ height: 28px;
|
|
|
+ width: 144px;
|
|
|
+ color: #555;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .page{
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|