|
@@ -164,7 +164,15 @@ export default {
|
|
|
cellSpanOption: {
|
|
|
bodyCellSpan: this.bodyCellSpan,
|
|
|
},
|
|
|
- checkboxOption:{
|
|
|
+ showEmpty: false,
|
|
|
+ showTableHead: true,
|
|
|
+ disableSelectedRowKeys: [],
|
|
|
+ selectedRowKeys: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ checkboxOption () {
|
|
|
+ return {
|
|
|
disableSelectedRowKeys: this.disableSelectedRowKeys,
|
|
|
selectedRowKeys: this.selectedRowKeys,
|
|
|
// 行选择改变事件
|
|
@@ -175,14 +183,8 @@ export default {
|
|
|
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
this.selectedAllChange({ isSelected, selectedRowKeys })
|
|
|
},
|
|
|
- },
|
|
|
- showEmpty: false,
|
|
|
- showTableHead: true,
|
|
|
- disableSelectedRowKeys: [],
|
|
|
- selectedRowKeys: []
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
+ }
|
|
|
+ },
|
|
|
columns () {
|
|
|
const _this = this
|
|
|
const priceFormat = function(data){
|
|
@@ -241,7 +243,7 @@ export default {
|
|
|
size="small"
|
|
|
type="link"
|
|
|
class="button-info"
|
|
|
- onClick="handleAdd(record)"
|
|
|
+ onClick={_this.handleAdd(record)}
|
|
|
>添加</a-button>
|
|
|
</div>
|
|
|
)
|
|
@@ -257,7 +259,7 @@ export default {
|
|
|
{record.promo?(
|
|
|
<div>
|
|
|
<strong style="margin-right:10px;font-size:14px;">{record.promo.promotion.title} ({record.promo.promotionRule.description})</strong>
|
|
|
- <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick="(event) => {showDesc(event, item)}">
|
|
|
+ <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={this.showDesc(record)}>
|
|
|
<a-icon title="查看活动详情" type="eye"/> 活动详情
|
|
|
</span>
|
|
|
</div>
|
|
@@ -321,13 +323,13 @@ export default {
|
|
|
},
|
|
|
// 选择单元格
|
|
|
selectedRowChange({ row, isSelected, selectedRowKeys }){
|
|
|
- console.log(row, isSelected, selectedRowKeys);
|
|
|
+ // console.log(row, isSelected, selectedRowKeys);
|
|
|
this.selectedRowKeys = selectedRowKeys;
|
|
|
},
|
|
|
// 全选行
|
|
|
selectedAllChange({ isSelected, selectedRowKeys }){
|
|
|
- console.log(isSelected, selectedRowKeys);
|
|
|
- this.selectedRowKeys = this.dataSource.map((x) => x.rowKey);
|
|
|
+ // console.log(isSelected, selectedRowKeys);
|
|
|
+ this.selectedRowKeys = selectedRowKeys;
|
|
|
},
|
|
|
// 获取销售单参与的活动列表
|
|
|
getActiveList(){
|
|
@@ -341,6 +343,8 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
async searchTable(){
|
|
|
+ this.selectedRowKeys = []
|
|
|
+ this.disableSelectedRowKeys = []
|
|
|
this.dataSource = []
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
@@ -390,6 +394,9 @@ export default {
|
|
|
item.productName = productName || '--'
|
|
|
item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
|
|
|
item.productOrigUnit = productOrigUnit || '--'
|
|
|
+ if(item.stockQty<0 || !item.stockQty){
|
|
|
+ this.disableSelectedRowKeys.push(item.id)
|
|
|
+ }
|
|
|
})
|
|
|
this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
|
|
|
this.spinning = false
|
|
@@ -416,12 +423,9 @@ export default {
|
|
|
// 获取活动列表
|
|
|
this.getActiveList()
|
|
|
},
|
|
|
- clearTable () {
|
|
|
-
|
|
|
- },
|
|
|
- // 刷新当前页面
|
|
|
- resetCurForm () {
|
|
|
-
|
|
|
+ // 清空选项
|
|
|
+ clearSelectTable () {
|
|
|
+ this.selectedRowKeys = []
|
|
|
},
|
|
|
// 添加
|
|
|
handleAdd (row) {
|
|
@@ -434,20 +438,19 @@ export default {
|
|
|
// 批量添加
|
|
|
handlePlAdd () {
|
|
|
const _this = this
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
+ const chooseList = this.selectedRowKeys
|
|
|
+ if (chooseList.length == 0) {
|
|
|
_this.$message.warning('请先选择产品!')
|
|
|
return
|
|
|
}
|
|
|
+ const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
|
|
|
const obj = []
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
+ chooseRow && chooseRow.map(item => {
|
|
|
if (item.stockQty > 0) {
|
|
|
obj.push(item.salesBillDetailSn)
|
|
|
}
|
|
|
})
|
|
|
- if (obj.length < 1) {
|
|
|
- this.$message.warning('所选产品库存为0,不可添加!')
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '确认要批量添加到待下推列表吗?',
|
|
@@ -461,12 +464,14 @@ export default {
|
|
|
// 批量取消
|
|
|
handlePlCancel () {
|
|
|
const _this = this
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
+ const chooseList = this.selectedRowKeys
|
|
|
+ if (chooseList.length == 0) {
|
|
|
_this.$message.warning('请先选择产品!')
|
|
|
return
|
|
|
}
|
|
|
+ const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
|
|
|
const obj = []
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
+ chooseRow && chooseRow.map(item => {
|
|
|
obj.push({
|
|
|
'cancelQty': item.cancelNums,
|
|
|
'salesBillDetailSn': item.salesBillDetailSn,
|