|
|
<template> <div class="interaction-diagram-select"> <el-form :inline="true" :model="formData" class="demo-form-inline"> <el-form-item label=""> <el-input v-model="formData.keyword" maxlength="20" placeholder="互动图名称"></el-input> </el-form-item> <el-form-item> <el-button type="primary" @click="onSubmit">{{ $t('common.query') }}</el-button> </el-form-item> </el-form> <el-table ref="multipleTable" :data="tableData" max-height="500" border row-key="interactionDiagramId" @selection-change="handleSelectionChange" style="width: 100%"> <el-table-column v-if="isMultiple" width="40" type="selection" :reserve-selection="true" fixed="left" > </el-table-column> <el-table-column label="" width="40" align="center" v-else> <template slot-scope="scope"> <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio> </template> </el-table-column> <el-table-column prop="interactionDiagramName" label="互动图名称"> </el-table-column> </el-table> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :hide-on-single-page="true" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination> </div> </template>
<script> import api from '@@/components/canvasShow/config/api' import {sendReqMixin} from '@@/components/canvasShow/config/mixin' import {checkEmptyChild} from '@@/config/common' // import {getShopId} from "@@/utils/auth.js"
export default { name: 'interactiondiagram-select', mixins: [sendReqMixin], data () { return { tableRadio: '', formData: { keyword: '' }, currentPage: 1, total: 0, pageSize: 10, tableData: [], multipleSelection: [] } }, props: { selectedRows: { type: Array, default: () => [] }, isMultiple: { type: Boolean, default: false } }, mounted () { this.getTableData() }, methods: { // 获取类别
getCategory () { var _this = this let params = { url: api.getClassify, method: 'GET' } this.sendReq(params, (res) => { _this.categoryList = res.data checkEmptyChild(_this.categoryList) }) }, // 获取产品信息
getTableData () { var _this = this var paramsUrl = `${api.getInteractionDiagrams}?page=${this.currentPage}&pageSize=${this.pageSize}` if (this.formData.keyword) { paramsUrl += `&interactionDiagramName=${this.formData.keyword}` } // let shopId = parseInt(getShopId())
// if (shopId && this.typeId===3) {
// paramsUrl += `&shopId=${shopId}`
// }
let params = { url: paramsUrl, method: 'GET' } this.sendReq(params, (res) => { _this.tableData = res.data.list _this.total = res.data.total // 表格斌值
// if(_this.selectedRows.length > 0){
// _this.selectedRows.forEach(row => {
// this.$refs.multipleTable.toggleRowSelection(row,true);
// });
// }
}) }, // 搜索
onSubmit () { this.getTableData() }, // 每页条数改变
handleSizeChange (val) { this.pageSize = val this.getTableData() }, // 当前页改变
handleCurrentChange (val) { this.currentPage = val this.getTableData() }, // 多选改变
handleSelectionChange(val) { this.multipleSelection = val } } } </script>
<style lang="scss" scoped> .interaction-diagram-select{ .el-pagination{ padding: 0px; margin-top: 30px; } .el-table{ .img{ width: 80px; height: 80px; } } } </style>
|