|
@@ -139,7 +139,7 @@
|
|
|
@change="handleTableChange"
|
|
|
:pagination="pagination"
|
|
|
:scroll="{ x: 3500, y: 420 }"
|
|
|
- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
+ :rowSelection="{onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
>
|
|
|
</a-table>
|
|
|
</a-card>
|
|
@@ -228,6 +228,7 @@
|
|
|
dataIndex: 'englishName',
|
|
|
align:"center",
|
|
|
width:250,
|
|
|
+ ellipsis: true,
|
|
|
},
|
|
|
{
|
|
|
title: '产品中文名(chinese name)',
|
|
@@ -289,7 +290,7 @@
|
|
|
});
|
|
|
const dataSource =ref([]);
|
|
|
let selectedRowKeys = ref([]);
|
|
|
- let selectedRows = ref([]);
|
|
|
+ let selectionRows = ref([]);
|
|
|
const toggleSearchStatus = ref(false);
|
|
|
const queryParams = ref({
|
|
|
warehouse:'',
|
|
@@ -364,6 +365,8 @@
|
|
|
};
|
|
|
function searchQuery(){
|
|
|
pagination.value.current =1;
|
|
|
+ selectedRowKeys.value = []
|
|
|
+ selectionRows.value=[]
|
|
|
loadData();
|
|
|
}
|
|
|
function searchReset(){
|
|
@@ -385,20 +388,59 @@
|
|
|
}
|
|
|
pagination.value.current =1;
|
|
|
pagination.value.pageSize = 10;
|
|
|
+ selectedRowKeys.value = []
|
|
|
+ selectionRows.value=[]
|
|
|
loadData();
|
|
|
}
|
|
|
function handleToggleSearch(){
|
|
|
toggleSearchStatus.value = !toggleSearchStatus.value;
|
|
|
}
|
|
|
- function onSelectChange(keys,rows){
|
|
|
- selectedRowKeys.value = keys
|
|
|
- selectedRows.value = rows
|
|
|
+ function onSelectChange(selectedRowKeys1, selectionRows1) {
|
|
|
+ var arr = []
|
|
|
+ selectionRows.value.map(item=>{
|
|
|
+ arr.push(item.id)
|
|
|
+ })
|
|
|
+ selectedRowKeys.value = arr
|
|
|
+ }
|
|
|
+ function onSelect(record, selected, selectionRows1, nativeEvent) {
|
|
|
+ if (selected) {
|
|
|
+ selectionRows.value.push(record)
|
|
|
+ console.log( selectionRows.value);
|
|
|
+ }else{
|
|
|
+ const delIndex = selectionRows.value.findIndex((val) => {
|
|
|
+ return val.id === record.id
|
|
|
+ })
|
|
|
+ selectionRows.value.splice(delIndex, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function onSelectAll(selected, selectionRows1, changeRows) {
|
|
|
+ if (selected) {
|
|
|
+ selectionRows.value = selectionRows.value.concat(changeRows)
|
|
|
+ }
|
|
|
+ if (!selected) {
|
|
|
+ let selectionRows2 = JSON.parse(JSON.stringify(selectionRows.value))
|
|
|
+ const delIndex = []
|
|
|
+ selectionRows2.forEach((item, index) => {
|
|
|
+ changeRows.forEach((val, itemIndex) => {
|
|
|
+ if (item.id === val.id) {
|
|
|
+ delIndex.push(index)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ delIndex.forEach((item) => {
|
|
|
+ delete selectionRows2[item]
|
|
|
+ })
|
|
|
+ selectionRows2 = selectionRows2.filter((item) => {
|
|
|
+ return item !== undefined
|
|
|
+ })
|
|
|
+ selectionRows.value = selectionRows2
|
|
|
+ }
|
|
|
}
|
|
|
function handleOk(){
|
|
|
var arrProject = [],
|
|
|
arrWareHouse=[],
|
|
|
arrGoodsAllocation=[]
|
|
|
- selectedRows.value.map(item=>{
|
|
|
+ selectionRows.value.map(item=>{
|
|
|
arrProject.push(item.project)
|
|
|
arrWareHouse.push(item.warehouse)
|
|
|
arrGoodsAllocation.push(item.goodsAllocation)
|
|
@@ -408,14 +450,14 @@
|
|
|
}else if(new Set(arrProject).size!==1||new Set(arrWareHouse).size!==1||new Set(arrGoodsAllocation).size!==1){
|
|
|
message.error('请勾选项目、仓库、货位都相同的数据');
|
|
|
}else{
|
|
|
- emit('SelectStaningStock', selectedRows.value)
|
|
|
+ emit('SelectStaningStock', selectionRows.value)
|
|
|
handleCancel()
|
|
|
}
|
|
|
}
|
|
|
function handleCancel(){
|
|
|
visible.value = false
|
|
|
selectedRowKeys.value = []
|
|
|
- selectedRows.value=[]
|
|
|
+ selectionRows.value=[]
|
|
|
queryParams.value = {
|
|
|
warehouse:'',
|
|
|
goodsAllocation:"",
|