wenhongquan 11 months ago
parent
commit
d6ee65db92
3 changed files with 25 additions and 5 deletions
  1. 8 0
      src/api/system/oss/index.ts
  2. 15 3
      src/views/project/list/index.vue
  3. 2 2
      vite.config.ts

+ 8 - 0
src/api/system/oss/index.ts

@@ -19,6 +19,14 @@ export function listByIds(ossId: string | number, type = 1): AxiosPromise<OssVO[
   });
 }
 
+export function updateById(ossId: string | number, sortindex = 1): AxiosPromise<OssVO[]> {
+  return request({
+    url: '/resource/oss/update',
+    method: 'put',
+    params: { ossId: ossId, sortindex: sortindex }
+  });
+}
+
 // 删除OSS对象存储
 export function delOss(ossId: string | number | Array<string | number>) {
   return request({

+ 15 - 3
src/views/project/list/index.vue

@@ -382,6 +382,14 @@
               {{ scope.row.size >1024 ? scope.row.size>1024*1024?(scope.row.size / 1024/1024).toFixed(2) + ' MB' :(scope.row.size / 1024).toFixed(2) + ' KB' : scope.row.size + ' B' }}
            </template>
         </el-table-column>
+      <el-table-column prop="sortindex" label="排序" width="120">
+        <template  #default="scope">
+          <div>
+            <el-input-number style="width: 100px" v-model="scope.row.sortindex" :min="0" :max="100" label="排序" @change="updatefileindex(scope.row)"></el-input-number>
+          </div>
+        </template>
+
+      </el-table-column>
          <el-table-column prop="createTime" label="上传时间" width="180">
         </el-table-column>
         <el-table-column prop="date" label="操作" fixed="right" width="200">
@@ -432,7 +440,7 @@ import mp4icon from '@/assets/icons/svg/mp4.svg'
 import cadicon from '@/assets/icons/svg/cad.svg'
 import unknownicon from '@/assets/icons/svg/unknown.svg'
 import { ref, onMounted } from "vue";
-import { listByIds,delOss } from "@/api/system/oss";
+import { listByIds,delOss,updateById } from "@/api/system/oss";
 import {
   listArchives,
   addArchives,
@@ -501,7 +509,11 @@ const totalnum = ref(0);
 
 const status = ref("0");
 
-
+const updatefileindex = (row:any)=>{
+  updateById(row.ossId,row.sortindex).then(()=>{
+    getfilelist();
+  })
+}
 
 const getnextdata = (page: number) => {
   currentpage.value = page;
@@ -720,7 +732,7 @@ const getfilelist =()=>{
     getArchive_files(currentitem.value.id).then((res1) => {
       var resultArray = res1.data.sort(
         function compareFunction(param1, param2) {
-          return param1.originalName.localeCompare(param2.originalName,"zh");
+          return param1.sortindex-param2.sortindex;
         }
       );
       res1.data = resultArray;

+ 2 - 2
vite.config.ts

@@ -26,8 +26,8 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
       open: true,
       proxy: {
         [env.VITE_APP_BASE_API]: {
-          // target: 'http://localhost:8080',
-          target: 'https://filesystem.njdnyjs.com/api',
+          target: 'http://localhost:8080',
+          // target: 'https://filesystem.njdnyjs.com/api',
           changeOrigin: true,
           ws: true,
           rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')