Kaynağa Gözat

虚拟列表优化

John 1 yıl önce
ebeveyn
işleme
6ce4e29224

+ 1 - 1
src/pages/DuplicateFile/CalculateDuplicateFiles.tsx

@@ -255,7 +255,7 @@ export default function CalculateDuplicateFiles() {
             // console.log(223, window.location.href, location.pathname, fileinfo);
             // console.log(223, window.location.href.indexOf(location.pathname), location.pathname);
             fileIndex++;
-            await waittime();
+            // await waittime();
             const [newProgressRes] = await get_progress_by_sourceId(`${fileId}`);
             setPercent(Math.floor((fileIndex / newProgressRes.hash_null_count) * 100));
             setDuplicateFilesStep(`: ${fileIndex} / ${newProgressRes.hash_null_count}`);

+ 30 - 5
src/pages/DuplicateFile/CalculateListPage.tsx

@@ -59,7 +59,23 @@ export default function CalculateListPage() {
           type: "error",
         }));
     }
-
+    /*count
+        :
+        2
+    hash
+        :
+        "fdd8051fcf884d8cc9a095cd77a58694e13b066aea68dc1fc353767ab0ebfe01"
+    ids
+        :
+        "25494,26393"
+    sourceId
+        :
+        6*/
+    setTip('');
+    setLoading(false);
+    setData(searchDuplicateFileRes as any);
+    console.log(63, searchDuplicateFileRes);
+    return
     if (Array.isArray(searchDuplicateFileRes)) {
       let index = -1
       const newData: any[] = [];
@@ -258,7 +274,7 @@ export default function CalculateListPage() {
             value={removeList}
           >
             <div style={{ width: "100%" }}>
-              {data.map((item: FileItem) => (
+              {data.map((item: any) => (
                 <div
                   key={item.hash}
                   style={{
@@ -267,8 +283,9 @@ export default function CalculateListPage() {
                   }}
                 >
                   <div className={styles.CheckboxGroup}>
-                    <Checkbox value={item.firstItem.path}>
-                      {CheckboxContent(item.firstItem)}
+                    <Checkbox value={item.path}>
+                      {/*{CheckboxContent(item as any)}*/}
+                      {item.path}
                     </Checkbox>
                   </div>
                   <div
@@ -278,12 +295,20 @@ export default function CalculateListPage() {
                     }}
                     className={styles.CheckboxGroup}
                   >
-                    {item.otherItems.map((otherItem) => (
+                    {/*{item.otherItems.map((otherItem) => (
                       <div key={otherItem.path}>
                         <Checkbox value={otherItem.path}>
                           {CheckboxContent(otherItem)}
                         </Checkbox>
                       </div>
+                    ))}*/}
+                    {item.ids.split(',').map((id_name: string) => (
+                      <div key={id_name}>
+                        <Checkbox value={id_name}>
+                          {/*{CheckboxContent(id_name as any)}*/}
+                          {id_name}
+                        </Checkbox>
+                      </div>
                     ))}
                   </div>
                 </div>

+ 7 - 0
src/services/file-service.ts

@@ -347,6 +347,13 @@ export async function searchDuplicateFile({
     const res: DuplicateFileInfo[] = await DB.select(
       `SELECT hash,
        sourceId,
+       id,
+       creation_time,
+       modified_time,
+       file_size,
+       type,
+       name,
+       path,
        GROUP_CONCAT(id)    AS ids,
        COUNT(*)           AS count
 FROM search_files