he wei
2021-11-05 1a136c4df1ddee2fedb119a264e73147b79bfb1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
  <flex-layout class="main">
    <!-- 搜索 -->
    <div slot="header" class="contain-search">
      <flex-layout direction="row">
        <el-row :gutter="20">
          <el-col :span="12">
            <label>
              <span class="label">标题内容:</span>
              <el-input v-model="title" size="small" placeholder="请输入关键词"></el-input>
            </label>
          </el-col>
          <el-col :span="12">
            <label>
              <span class="label">选择时间:</span>
              <el-date-picker
                v-model="datetime"
                type="daterange"
                size="small"
                range-separator=" ~ "
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
            </label>
          </el-col>
        </el-row>
        <div class="" slot="footer">
          <el-button type="primary" icon="el-icon-search">查询</el-button>
        </div>
      </flex-layout>
    </div>
    <!-- 列表 -->
    <flex-layout class="list-contain">
      <div class="scroll">
        <list-card
          class="list-item"
          v-for="(item, idx) in list"
          :key="'list_' + idx"
          @itemclick="details"
          :data="item"
        ></list-card>
      </div>
      <!-- 分页 -->
      <div class="pagination" slot="footer">
        <el-button type="primary" size="mini" icon="el-icon-arrow-left">上一页</el-button>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page.currentPage"
          :page-sizes="page.pageSizes"
          :page-size="page.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="page.total">
        </el-pagination>
        <el-button type="primary" size="mini" icon="el-icon-arrow-right">下一页</el-button>
      </div>
    </flex-layout>
  </flex-layout>
</template>
 
<script>
import FlexLayout from "@/components/FlexLayout.vue";
import ListCard from "./components/listCard.vue";
 
import {
  getList
} from './js/api';
 
export default {
    data() {
        return {
            unitType: 1,
      title: "",
      desc: "",
      datetime: "",
      level: 0,
      fileList: [],
      operate: 0,
      list: [],
      page: {
        currentPage: 1,
        pageSizes: [1, 5, 10, 20],
        pageSize: 5,
        total: 0
      }
        }
    },
  components: {
    FlexLayout
    ,ListCard
  },
    watch: {
        '$route'() {
            // 监听路由变化,获取unitType
            this.unitType = this.$route.meta.unitType
        },
    },
  methods: {
    details (data) {
      console.log(data);
    },
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`);
    },
    // 查列表
    getList () {
      let param = {
        pageNum: 1,
        pageSize: 1,
        type: 1
      };
      let data = {
 
      };
      getList(param, data).then((res) => {
        res = res.data;
        console.log(res, '=====');
        let list = [];
        if (res.code) {
          list = res.data;
        }
        console.log(list);
        this.list = list;
      }).catch((err) => {
        console.error(err);
      });
    }
    
  },
    mounted() {
    this.unitType = this.$route.meta.unitType;
 
    this.getList();
    }
 
}
</script>
 
<style scoped>
.contain-search {
  background: #fff;
  border-bottom: 1px solid #c4c4c4;
  margin-bottom: 16px;
  padding: 14px 30px;
}
.contain-search span.label {
  font-size: 18px;
  font-weight: bold;
  color: #666;
  padding-right: 1em;
}
.list-contain {
  background: #fff;
  height: 100%;
  margin-left: 16px;
  border-top: 1px #c4c4c4 solid;
  border-left: 1px #c4c4c4 solid;
  padding: 30px 0 10px 30px;
}
.scroll {
  overflow-y: auto;
  padding-right: 30px;
}
.title {
  color: #04409a;
  font-size: 24px;
}
.list-item {
  margin-bottom: 18px;
}
.pagination {
  display: flex;
  padding-top: 10px;
  justify-content: center;
}
>>> .el-pagination {
  display: flex;
  padding: 0 1em;
}
>>> .el-pagination .el-input__inner {
  background: #343345;
  color: #fff;
}
>>> .el-input {
  width: 30em;
}
>>> .el-textarea {
  width: 40em;
}
>>> .el-select .el-input {
  width: 16em;
}
>>> .el-pagination .el-input {
  width: auto;
}
</style>