|
@@ -143,7 +143,9 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <HcTable :column="sortingTableColumn" :datas="item.list" :loading="sortingTableLoading" isCheck @selection-change="rows => sortingTableSelection(rows,item.list)" ref="sorTableRef">
|
|
|
+ <HcTable :column="sortingTableColumn" :datas="item.list" :loading="sortingTableLoading" isCheck @selection-change="rows => sortingTableSelection(rows,item.list,index)" ref="sorTableRef"
|
|
|
+ @single-select="singleCheck"
|
|
|
+ >
|
|
|
<template #name="{row}">
|
|
|
<span class="text-link">{{row?.fileName}}</span>
|
|
|
</template>
|
|
@@ -377,6 +379,7 @@ import {getArrValue, deepClone, getObjVal, arrToId} from "js-fast-way"
|
|
|
import tasksApi from '~api/tasks/data';
|
|
|
import ossApi from "~api/oss";
|
|
|
|
|
|
+
|
|
|
//变量
|
|
|
const useAppState = useAppStore()
|
|
|
const projectId = ref(useAppState.getProjectId);
|
|
@@ -652,25 +655,11 @@ const tableIsInput = (val, row, key) => {
|
|
|
// sortingActiveKey.value = `item-${index}`;
|
|
|
// }
|
|
|
// }
|
|
|
-const checkList=ref([])
|
|
|
-const getcheckList=()=>{
|
|
|
- console.log( sortingItemData.value,' sortingItemData.value.');
|
|
|
- let arrList=[]
|
|
|
- sortingItemData.value.forEach((item)=>{
|
|
|
- if(item&&item?.list){
|
|
|
- item?.list.forEach((item1)=>{
|
|
|
- if(item1?.checked){
|
|
|
- arrList.push(item1)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- checkList.value=arrList
|
|
|
-}
|
|
|
+
|
|
|
const sortingActiveKey = ref([])
|
|
|
+const tableIndex=ref('')
|
|
|
const sortingSelectFile = (row, index) => {
|
|
|
+ tableIndex.value=index
|
|
|
const key = `item-${index}`;
|
|
|
const indexNum = sortingActiveKey.value.indexOf(key);
|
|
|
if(indexNum > -1){
|
|
@@ -693,6 +682,7 @@ const sortingTableData = ref([])
|
|
|
const sortingTableLoading = ref(false)
|
|
|
const getSortingTableData = async(row, index) => {
|
|
|
sortingTableLoading.value = true
|
|
|
+ tableindex.value=index
|
|
|
const { error, code, data } = await archiveFileApi.pageByBoxName({
|
|
|
size: 99999,
|
|
|
current: 1,
|
|
@@ -704,7 +694,9 @@ const getSortingTableData = async(row, index) => {
|
|
|
sortingTableLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
|
row.list = getArrValue(data['records'])
|
|
|
+
|
|
|
setTableCheck(row, index)
|
|
|
+
|
|
|
|
|
|
|
|
|
} else {
|
|
@@ -714,6 +706,7 @@ const getSortingTableData = async(row, index) => {
|
|
|
|
|
|
//表格ref
|
|
|
const sorTableRef = ref([]);
|
|
|
+const tableindex=ref('')
|
|
|
//回显勾选
|
|
|
const setTableCheck = async(row, index) => {
|
|
|
//console.log(row)
|
|
@@ -724,6 +717,8 @@ const setTableCheck = async(row, index) => {
|
|
|
item.checked = true;
|
|
|
await nextTick();
|
|
|
sorTableRef.value[index].toggleRowSelection(item,true);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -731,11 +726,59 @@ const setTableCheck = async(row, index) => {
|
|
|
|
|
|
//多选
|
|
|
const sortingTableKeys = ref([]);
|
|
|
-const sortingTableSelection = (rows,list,event) => {
|
|
|
-
|
|
|
+const checkList=ref([])
|
|
|
+const arrfliter=ref([])
|
|
|
+const singleCheck=async({row})=>{
|
|
|
+ let isCheck=false
|
|
|
+ let checkrow=JSON.parse(JSON.stringify(row))
|
|
|
+ if(checkrow.checked===false||checkrow.checked===undefined){
|
|
|
+ if( checkList.value.length>0){
|
|
|
+ let arr=checkList.value.filter(e => e.id === checkrow.id)
|
|
|
+ if(arr.length>0){
|
|
|
+ window.$message.warning('多个盒子不能选择同一份文件')
|
|
|
+ await nextTick();
|
|
|
+ sorTableRef.value[tableindex.value].toggleRowSelection(row,false);
|
|
|
+ isCheck=true
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ isCheck=false
|
|
|
+ checkList.value.push(row)
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ checkList.value.push(row)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ let arr=checkList.value.filter(e => e.id === checkrow.id)
|
|
|
+ if(isCheck===false&&arr[0]?.checked===true||isCheck){
|
|
|
+ arrfliter.value=checkList.value.filter(e => e.id !== checkrow.id)
|
|
|
+
|
|
|
+ }else{
|
|
|
+ arrfliter.value=checkList.value
|
|
|
+ }
|
|
|
+ let newarr=[]
|
|
|
+ arrfliter.value.forEach((item)=>{
|
|
|
+ newarr.push(JSON.parse(JSON.stringify(item)))
|
|
|
+
|
|
|
+ })
|
|
|
+ checkList.value=newarr
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+const sortingTableSelection = (rows,list,index) => {
|
|
|
+ tableindex.value=index
|
|
|
+if(list){
|
|
|
list.forEach(element => {
|
|
|
element.checked = false;
|
|
|
});
|
|
|
+}
|
|
|
+
|
|
|
rows.forEach((element)=>{
|
|
|
element.checked = true;
|
|
|
})
|