|
@@ -1,7 +1,8 @@
|
|
|
<template>
|
|
|
<!-- 产品table -->
|
|
|
- <div class="productTable height_100">
|
|
|
+ <div class="productTable height_100" v-DivHeight="getDivHeight">
|
|
|
<el-table :data="tableData" header-row-class-name="custom-table-header"
|
|
|
+ v-if="showTable" :maxHeight="tableHeight"
|
|
|
v-el-table-infinite-scroll="getList"
|
|
|
:infinite-scroll-distance="10"
|
|
|
:infinite-scroll-disabled="disabled"
|
|
@@ -60,7 +61,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { getTableHeight } from '@/views/components/mixins'
|
|
|
+import product from '../mixins/product'
|
|
|
export default {
|
|
|
+ mixins:[getTableHeight,product],
|
|
|
props: {
|
|
|
tableData: {
|
|
|
type: Array,
|
|
@@ -73,7 +77,7 @@ export default {
|
|
|
default: () => {
|
|
|
return {
|
|
|
current:0,
|
|
|
- size:5
|
|
|
+ size:10
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -136,7 +140,8 @@ export default {
|
|
|
action:{
|
|
|
type:'',//1表示删除,2表示其他,3表示新增
|
|
|
id:''
|
|
|
- }
|
|
|
+ },
|
|
|
+ data:JSON.parse(JSON.stringify(this.tableData))
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -165,18 +170,23 @@ export default {
|
|
|
})
|
|
|
this.tableData.splice(startIndex,1)
|
|
|
var str = this.$commonJS.objectToString(this.searchOption)
|
|
|
- let params = {
|
|
|
- ...this.params,
|
|
|
- searchQuery:str?' AND ':'' + `category_id=${this.row.id}`,//检索条件
|
|
|
- orderDTOList: this.sort,//排序
|
|
|
- }
|
|
|
+ let params = {
|
|
|
+ ...this.queryParams,
|
|
|
+ searchQuery:str?' AND ':'' + `category_id=${this.row.id}`,//检索条件
|
|
|
+ orderDTOList: this.sort,//排序
|
|
|
+ }
|
|
|
this.getList2(params,1)
|
|
|
}else if(this.action.type == 2){
|
|
|
let params = {
|
|
|
- ...this.params,
|
|
|
+ ...this.queryParams,
|
|
|
searchQuery:`product_id=${this.action.id}`,//检索条件
|
|
|
}
|
|
|
this.getList2(params,2)
|
|
|
+ }else{
|
|
|
+ this.queryParams.current = 0
|
|
|
+ this.disabled = false
|
|
|
+ this.tableData.splice(0)
|
|
|
+ this.getList()
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -189,7 +199,7 @@ export default {
|
|
|
var endIndex = this.tableData.length
|
|
|
var len = endIndex - startIndex
|
|
|
this.tableData.splice(startIndex,len,...res.data.data)
|
|
|
- this.params.total = res.data.total
|
|
|
+ this.queryParams.total = res.data.total
|
|
|
}else if(type == 2){
|
|
|
var startIndex = this.tableData.findIndex(item=>{
|
|
|
return item.id == this.action.id
|
|
@@ -273,7 +283,7 @@ export default {
|
|
|
params.orderType = orderType[order]
|
|
|
this.sort.push(params)
|
|
|
}
|
|
|
- this.params.current = 0
|
|
|
+ this.queryParams.current = 0
|
|
|
this.disabled = false
|
|
|
this.tableData.splice(0)
|
|
|
this.getList()
|
|
@@ -282,4 +292,7 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped></style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.productTale{
|
|
|
+}
|
|
|
+</style>
|