123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <el-dialog
- :visible="dialogVisible"
- width="900px"
- :title="$t('Key288')"
- :close-on-click-modal="false"
- @close="dialogClose"
- >
- <!-- 查询条件 -->
- <div class="query-criteria">
- <el-form :inline="true" :model="searchForm" size="mini">
- <el-form-item :label="$t('Key339')">
- <el-input v-model.trim="searchForm.name" @keyup.enter.native="queryCourseList" />
- </el-form-item>
- <el-form-item class="search-button">
- <el-button type="primary" @click="queryCourseList">
- <i class="el-icon-search" /> {{ $t('Key131') }}
- </el-button>
- </el-form-item>
- </el-form>
- </div>
- <el-table
- ref="templateTable"
- :data="courseList"
- height="40vh"
- highlight-current-row
- @current-change="handleCurrentChange"
- >
- <el-table-column prop="name" :label="$t('Key191')" width="320" />
- <el-table-column :label="$t('Key250')">
- <template slot-scope="{ row }">
- <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- background
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="page_capacity"
- layout="prev, pager, next, total, sizes, jumper"
- :total="total_count"
- :current-page="cur_page"
- @prev-click="changePage"
- @next-click="changePage"
- @current-change="changePage"
- @size-change="changePageSize"
- />
- <div slot="footer">
- <el-button size="mini" @click="dialogClose">
- {{ $t('Key83') }}
- </el-button>
- <el-button type="primary" size="mini" @click="confirmTemplate">
- {{ $t('Key94') }}
- </el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import { PageQueryCourseList } from '@/api/table';
- export default {
- props: {
- dialogVisible: {
- default: false,
- type: Boolean
- }
- },
- data() {
- return {
- cur_page: 1,
- total_count: 0,
- page_capacity: 10,
- searchForm: {
- name: ''
- },
- courseList: [],
- currentRow: null
- };
- },
- created() {
- this.queryCourseList();
- this.updateWordPack({
- word_key_list: ['Key288', 'Key339', 'Key131', 'Key191', 'Key250', 'Key83', 'Key94', 'Key340']
- });
- },
- methods: {
- queryCourseList() {
- const queryCriteria = {
- is_template: true,
- name: this.searchForm.name,
- page_capacity: this.page_capacity,
- cur_page: this.cur_page,
- release_status: 1
- };
- PageQueryCourseList(queryCriteria).then(({ course_list, total_count }) => {
- this.courseList = course_list;
- this.total_count = total_count;
- });
- },
- changePage(newPage) {
- this.cur_page = newPage;
- this.queryCourseList();
- },
- changePageSize(pageSize) {
- this.page_capacity = pageSize;
- this.queryCourseList();
- },
- handleCurrentChange(val) {
- this.currentRow = val;
- },
- dialogClose() {
- this.$emit('dialogClose');
- this.$refs.templateTable.clearSelection();
- },
- confirmTemplate() {
- if (!this.currentRow) {
- return this.$message.warning(this.$i18n.t('Key340'));
- }
- this.$emit('confirmTemplate', this.currentRow.id);
- }
- }
- };
- </script>
- <style lang="scss">
- @import '~@/styles/mixin';
- @include dialog;
- @include pagination;
- .query-criteria .el-form {
- display: flex;
- justify-content: space-between;
- }
- </style>
|