新增批量上下架删除按钮

This commit is contained in:
weipengfei 2024-04-20 15:36:15 +08:00
parent d3df8a1321
commit 7cc816a43a

View File

@ -83,7 +83,9 @@
@click="batchOff">批量下架</el-button>
<el-button size="small" :disabled="tableFrom.type != 2 || checkedIds.length == 0 && !allCheck"
@click="batchShelf">批量上架</el-button>
<el-button size="small" @click="joinCloud">加入云商品</el-button>
<el-button size="small" @click="batchRecycle" v-if="tableFrom.type==2" :disabled="checkedIds.length == 0 && !allCheck">批量加入回收站</el-button>
<el-button size="small" @click="batchRecover" v-if="tableFrom.type==5" :disabled="checkedIds.length == 0 && !allCheck">批量恢复</el-button>
<el-button size="small" @click="batchDelete" v-if="tableFrom.type==5" :disabled="checkedIds.length == 0 && !allCheck">批量删除</el-button>
</div>
<el-alert v-if="checkedIds.length > 0 || allCheck"
:title="allCheck ? `已选择 ${tableData.total} 项` : `已选择 ${checkedIds.length} 项`" type="info" show-icon
@ -975,6 +977,48 @@ export default {
this.$message.error(res.message)
})
},
//
batchRecycle() {
if (this.checkedIds.length === 0 && !this.allCheck) return this.$message.warning('请先选择商品')
let ids = []
if (this.allCheck) {
this.tableData.data.map((item) => {
ids.push(item.product_id)
})
} else {
ids = this.checkedIds
}
let data = { status: 1, ids: ids }
console.log(data);
},
//
batchRecover() {
if (this.checkedIds.length === 0 && !this.allCheck) return this.$message.warning('请先选择商品')
let ids = []
if (this.allCheck) {
this.tableData.data.map((item) => {
ids.push(item.product_id)
})
} else {
ids = this.checkedIds
}
let data = { status: 1, ids: ids }
console.log(data);
},
//
batchDelete() {
if (this.checkedIds.length === 0 && !this.allCheck) return this.$message.warning('请先选择商品')
let ids = []
if (this.allCheck) {
this.tableData.data.map((item) => {
ids.push(item.product_id)
})
} else {
ids = this.checkedIds
}
let data = { status: 1, ids: ids }
console.log(data);
},
//
batchLabel() {
this.labelForm = {