| | |
| | | } |
| | | |
| | | .product_table .el-table { |
| | | height: 100%; |
| | | height: calc(100% - 35px) !important; |
| | | } |
| | | |
| | | .sort { |
| | |
| | | </el-table> |
| | | </el-row> |
| | | <el-row class="product_table" v-loading="tableLoad2"> |
| | | <el-table :data="productList" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe |
| | | :fit="true" border @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" |
| | | <el-table :data="pagedData" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe |
| | | :fit="true" border |
| | | @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" |
| | | @select="upProductSelect" @select-all="handleAll"> |
| | | <el-table-column type="selection" width="65"> |
| | | </el-table-column> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | style="position: absolute;right: 16px;bottom: 1px;" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-size="pageSize" |
| | | layout="total, prev, pager, next, jumper" |
| | | :total="total"> |
| | | </el-pagination> |
| | | </el-row> |
| | | </div> |
| | | <el-dialog title="分类添加" :visible.sync="addDia" width="400px"> |
| | |
| | | sectionLoad: false, |
| | | sectionRow: null, |
| | | sectionList: [], |
| | | templateList: [] |
| | | templateList: [], |
| | | total:0, |
| | | pageSize:100, |
| | | currentPage:1, |
| | | } |
| | | }, |
| | | computed: { |
| | | pagedData() { |
| | | const start = (this.currentPage - 1) * this.pageSize; |
| | | const end = start + this.pageSize; |
| | | return this.productList.slice(start, end); |
| | | }, |
| | | }, |
| | | watch:{ |
| | | pagedData:{ |
| | | deep:true, |
| | | handler(val){ |
| | | setTimeout(() => { |
| | | val.forEach(a => { |
| | | if (a.state == 1) this.toggleSelection(a) |
| | | }) |
| | | }, 300) |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | tree: this.selectTree |
| | | }).then(res => { |
| | | this.productList = res.data |
| | | setTimeout(() => { |
| | | this.productList.forEach(a => { |
| | | if (a.state == 1) this.toggleSelection(a) |
| | | }) |
| | | }, 300) |
| | | this.total = this.productList.length; |
| | | // setTimeout(() => { |
| | | // this.productList.forEach(a => { |
| | | // if (a.state == 1) this.toggleSelection(a) |
| | | // }) |
| | | // }, 300) |
| | | this.tableLoad2 = false |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | handleAll(e) { |
| | | if (e.length > 0) { |
| | | this.productList.map(m => { |
| | | this.productList = this.productList.map(m => { |
| | | m.state = 0 |
| | | this.upProductSelect(null, m) |
| | | return m |
| | | }) |
| | | } else { |
| | | this.productList.map(m => { |
| | | this.productList = this.productList.map(m => { |
| | | m.state = 1 |
| | | this.upProductSelect(null, m) |
| | | return m |
| | |
| | | this.templateList = res.data |
| | | }) |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.currentPage = val; |
| | | }, |
| | | } |
| | | } |
| | | </script> |