bill 7 月之前
父節點
當前提交
92af11422e
共有 3 個文件被更改,包括 28 次插入2 次删除
  1. 3 0
      src/api/material.ts
  2. 17 1
      src/components/materials/index.vue
  3. 8 1
      src/layout/edit/scene-select.vue

+ 3 - 0
src/api/material.ts

@@ -17,6 +17,7 @@ type ServiceMaterialGroup = {
 type ServiceMaterial = {
   createTime: string;
   dictId: number;
+  status: number,
   dictName: string;
   fileFormat: string;
   fileName: string;
@@ -42,6 +43,7 @@ export type Material = {
   url: string;
   size: number;
   groupId: number;
+  status: number;
   group: string;
   uploadId?: number;
   modelId?: number;
@@ -68,6 +70,7 @@ export const fetchMaterialPage = async (params: MaterialPageProps) => {
       url: item.fileUrl,
       size: Number(item.fileSize),
       groupId: item.dictId,
+      status: item.status,
       group: item.dictName,
       uploadId: item.uploadId
     }))

+ 17 - 1
src/components/materials/index.vue

@@ -63,6 +63,15 @@
             <template v-if="column.key === 'size'">
               {{ getSizeStr(record.size) }}
             </template>
+            <template v-if="column.key === 'status'">
+              {{
+                record.status === 1
+                  ? "上传成功"
+                  : record.status === -1
+                  ? "上传失败"
+                  : "上传中"
+              }}
+            </template>
             <template v-if="column.key === 'group'">
               <span class="group-str">{{ record.group }}</span>
             </template>
@@ -156,7 +165,8 @@ const rowSelection: any = ref({
     return {
       disabled:
         (props.format && !props.format.includes(record.format)) ||
-        (props.maxSize && record.size > props.maxSize),
+        (props.maxSize && record.size > props.maxSize) ||
+        record.status !== 1,
     };
   },
 });
@@ -180,6 +190,12 @@ const cloumns = computed(() => [
   },
   {
     width: "100px",
+    title: "状态",
+    dataIndex: "status",
+    key: "status",
+  },
+  {
+    width: "100px",
     title: "分组",
     dataIndex: "group",
     key: "group",

+ 8 - 1
src/layout/edit/scene-select.vue

@@ -132,12 +132,19 @@ const types = computed(() => [
   ...new Set(origin.value.map((item) => item.type)).values(),
 ]);
 const type = ref(types.value[0]);
+const cache = {} as any
 
 const selects = ref<Key[]>(selectIds.value);
 const rowSelection: any = ref({
   selectedRowKeys: selects,
   onChange: (ids: number[]) => {
-    selects.value = Array.from(new Set(ids.concat(selectIds.value)));
+    ids = ids.filter(id => !selectIds.value.includes(id))
+    cache[type.value] = ids
+    const curIds = [...selectIds.value]
+    for (const key in cache) {
+      curIds.push(...cache[key])
+    }
+    selects.value = curIds
   },
   getCheckboxProps: (record: Scene) => ({
     disabled: selectIds.value.includes(record.modelId),