123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <div id="list-frame">
- <el-card style="background:rgb(231, 224, 235);border-radius: 60px;" shadow="hover">
- <el-row>
- <el-col :span="24" class="title">
- <span v-if="returns">
- <el-button
- size="mini"
- plan
- circle
- @click="$router.push({ path: returns })"
- style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)"
- >
- <span class="el-icon-arrow-left" style="zoom:1.5;font-weight:700"></span>
- </el-button>
- </span>
- <slot name="title">
- {{ title }}
- </slot>
- </el-col>
- </el-row>
- <slot name="filter">
- <el-form :inline="true">
- <el-form-item v-for="(item, index) in filter" :key="index" :label="item.label" label-width="auto">
- <template v-if="item.type === `select`">
- <el-select v-model="searchInfo[`${item.model}`]" size="mini">
- <el-option v-for="(select, sIndex) in item.list" :key="sIndex" :label="select.label" :value="select.value"></el-option>
- </el-select>
- </template>
- <template v-else>
- <el-input v-model="searchInfo[`${item.model}`]" size="mini"></el-input>
- </template>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" size="mini">查询</el-button>
- </el-form-item>
- </el-form>
- </slot>
- <div style="padding:1.875rem;">
- <slot> </slot>
- </div>
- <el-row type="flex" align="middle" justify="end" v-if="needPag">
- <el-col :span="24" style="text-align:right;">
- <el-pagination
- background
- layout="total, prev, pager, next"
- :total="totalRow"
- :page-size="limit"
- :current-page.sync="currentPage"
- @current-change="changePage"
- >
- </el-pagination>
- </el-col>
- </el-row>
- </el-card>
- </div>
- </template>
- <script>
- import _ from 'lodash';
- export default {
- name: 'list-frame',
- props: {
- title: { type: String },
- filter: { type: Array, default: () => [] },
- totalRow: { type: Number, default: 0 },
- needPag: { type: Boolean, default: true },
- returns: { type: null, default: null },
- },
- components: {},
- data: () => ({
- limit: _.get(this, `$limit`, undefined) !== undefined ? this.$limit : 15,
- currentPage: 1,
- searchInfo: {},
- }),
- created() {},
- computed: {},
- methods: {
- changePage(page) {
- this.$emit('query', { skip: (page - 1) * this.limit, limit: this.limit, ...this.searchInfo });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .title {
- font-size: 1rem;
- font-weight: 700;
- padding: 1rem;
- }
- </style>
|