Sfoglia il codice sorgente

算法平台字段展示优化

ronaldo9Zhang 1 anno fa
parent
commit
2d6f3cc484
2 ha cambiato i file con 152 aggiunte e 96 eliminazioni
  1. 7 1
      src/api/common.js
  2. 145 95
      src/views/algorithmsLibrary/algorithmsPlatformList.vue

+ 7 - 1
src/api/common.js

@@ -1,4 +1,5 @@
 const basePart = '';
+
 const single = '/simulation/oauth/client/sign/single'; // 获取url参数-登录
 const username = '/simulation/oauth/client/sign/username'; // 登录页面-登录
 const refreshToken = '/simulation/oauth/client/sign/refreshToken'; // 获取referrtoken
@@ -20,6 +21,9 @@ const getCurrentUserInfo = '/simulation/resource/server/userInfo/getCurrentUserI
 
 const parse = basePart + '/simulation/resource/common/excel/parse'; // excel解析
 
+const isAdmin = basePart + '/simulation/resource/server/role/isAdmin'; // 判断是否是管理员
+
+
 export default {
     single,
     username,
@@ -39,7 +43,9 @@ export default {
     getMyMenuTree,
     getCurrentUserInfo,
 
-    parse
+    parse,
+
+    isAdmin
 }
 
 //10.15.12.74:7001/simulation/oauth/client/sign/single?code=1001&ticket=1001

+ 145 - 95
src/views/algorithmsLibrary/algorithmsPlatformList.vue

@@ -1,6 +1,25 @@
 <template>
     <div>
-        <search-layout :needBox="true">
+        <search-layout :needBox="true" v-if="!isAdmin">
+            <template slot="searchItem1">
+                <span class="label">算法名称</span>
+                <el-input v-model="searchParams.algorithmName" size="small" clearable placeholder="请输入" maxlength="60">
+                </el-input>
+            </template>
+            <template slot="searchItem2">
+                <span class="label">算法描述</span>
+                <el-input v-model="searchParams.description" size="small" clearable placeholder="请输入" maxlength="60">
+                </el-input>
+            </template>
+            <template slot="searchBtn1">
+                <el-button type="primary" @click="doSearch">查询</el-button>
+            </template>
+            <template slot="searchBtn2">
+                <el-button type="primary" @click="doReset">重置</el-button>
+            </template>
+        </search-layout>
+
+        <search-layout :needBox="true" v-else>
             <!--<template slot="searchItem1">
                 <span class="label">ID</span>
                 <el-input
@@ -12,26 +31,36 @@
                 >
                 </el-input>
             </template>-->
+            <template slot="searchItem1">
+                <span class="label">比赛-赛题</span>
+                <el-input v-model="searchParams.topic" size="small" clearable placeholder="请输入" maxlength="60">
+                </el-input>
+            </template>
             <template slot="searchItem2">
-                <span class="label">算法名称</span>
-                <el-input
-                    v-model="searchParams.algorithmName"
-                    size="small"
-                    clearable
-                    placeholder="请输入"
-                    maxlength="60"
-                >
+                <span class="label">参赛队伍</span>
+                <el-input v-model="searchParams.team" size="small" clearable placeholder="请输入" maxlength="60">
                 </el-input>
             </template>
             <template slot="searchItem3">
+                <span class="label">算法名称</span>
+                <el-input v-model="searchParams.algorithmName" size="small" clearable placeholder="请输入" maxlength="60">
+                </el-input>
+            </template>
+            <template slot="searchItem4">
+                <span class="label">版本号</span>
+                <el-input v-model="searchParams.algorithmVersion" size="small" clearable placeholder="请输入" maxlength="60">
+                </el-input>
+            </template>
+            <template slot="searchItem5">
+                <span class="label">进度</span>
+                <el-select v-model="searchParams.status">
+                    <el-option v-for="item in algorithmStatusList" :label="item.caption" :value="item.code"
+                        :key="item.code"></el-option>
+                </el-select>
+            </template>
+            <template slot="searchItem6">
                 <span class="label">算法描述</span>
-                <el-input
-                    v-model="searchParams.description"
-                    size="small"
-                    clearable
-                    placeholder="请输入"
-                    maxlength="60"
-                >
+                <el-input v-model="searchParams.description" size="small" clearable placeholder="请输入" maxlength="60">
                 </el-input>
             </template>
             <!--<template slot="searchItem4">
@@ -63,16 +92,9 @@
             >-->
         </div>
 
-        <tableList
-            ref="table"
-            style="margin: 0 30px"
-            :columns="columns"
-            :getDataWay="getDataWay"
-            :pagination="pagination"
-            tooltip-effect="light"
-            index
-        >
-        
+        <tableList ref="table" style="margin: 0 30px" :columns="isAdmin ? columns1 : columns" :getDataWay="getDataWay"
+            :pagination="pagination" tooltip-effect="light" index>
+
         </tableList>
     </div>
 </template>
@@ -89,26 +111,31 @@ export default {
             searchParams: {
                 //搜索参数
                 //algorithmCode: "", // ID
+                topic: "", // 比赛-赛题
+                team: "", // 参赛队伍
                 algorithmName: "", // 算法名称
+                algorithmVersion: "", // 版本号
+                status: "", // 进度
                 description: "", // 算法描述
                 //uploadMode: "", // 私有类型
             },
-            getDataWay:{
-                    //加载表格数据
-                    dataType: "url",
-                    //dataType: "data",
-                    type: "post",
-                    // firstRequest: false,
-                    data: this.$api.algorithmsLibrary.selectAlgoPlatformList,
-                    /*data:[
-                        {
-                            algorithmCode:'111',
-                            algorithmName:'111',
-                            description:
-                            '打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲'
-                        }
-                    ],*/
-                    param: {},
+            algorithmStatusList: [],
+            getDataWay: {
+                //加载表格数据
+                dataType: "url",
+                //dataType: "data",
+                type: "post",
+                // firstRequest: false,
+                data: this.$api.algorithmsLibrary.selectAlgoPlatformList,
+                /*data:[
+                    {
+                        algorithmCode:'111',
+                        algorithmName:'111',
+                        description:
+                        '打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲哈维打款哈对我来讲'
+                    }
+                ],*/
+                param: {},
             },
             columns: [
                 //表格列
@@ -126,6 +153,50 @@ export default {
                     showOverflowTooltip: true
                 },
             ],
+            columns1: [
+                //表格列
+                {
+                    label: "ID",
+                    prop: "algorithmCode",
+                },
+                {
+                    label: "比赛-赛题",
+                    prop: "topic",
+                },
+                {
+                    label: "参赛队伍",
+                    prop: "team",
+                },
+                {
+                    label: "算法名称",
+                    prop: "algorithmName",
+                },
+                {
+                    label: "版本号",
+                    prop: "algorithmVersion",
+                },
+                {
+                    label: "进度",
+                    prop: "status",
+                    formatter(row) {
+                        switch (row.status) {
+                            case "1":
+                                return "未测试";
+                            case "2":
+                                return "测试中";
+                            case "3":
+                                return "已测试";
+                            default:
+                                return "";
+                        }
+                    },
+                },
+                {
+                    label: "算法描述",
+                    prop: "description",
+                    showOverflowTooltip: true
+                },
+            ],
             pagination: {
                 //分页使用
                 currentPage: 1,
@@ -134,11 +205,14 @@ export default {
                 pageSizes: [10, 30, 50, 100, 200],
                 layout: "sizes, total, prev, pager, next, jumper",
             },
+            isAdmin: false, // 判断是不是管理员
         };
     },
+
     computed: {
-    
+
     },
+
     methods: {
         doSearch() {
             this.$nextTick(() => {
@@ -154,67 +228,42 @@ export default {
         doReset() {
             this.searchParams = {
                 //algorithmCode: "",
+                topic: "",
+                team: "",
                 algorithmName: "",
+                algorithmVersion: "",
+                status: "",
                 description: "",
                 //uploadMode: "",
             };
             this.doSearch();
         },
-        addOne() {
-            
-        },
-        editRow(row) {
-            
-        },
-        delOne(row) {
-            this.$confirm("确认是否删除?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.algorithmsLibrary.deleteByid,
-                    data: {
-                        id: row.id,
-                    },
-                }).then((res) => {
-                    if (res.code == 200) {
-                        this.$message.success("删除成功");
-                    } else {
-                        this.$message.error(res.message || "删除失败");
-                    }
-                    this.doSearch();
-                });
-            });
-        },
-        shareRow(row) {
-            this.$confirm("确认是否分享?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                this.$axios({
-                    method: "post",
-                    url: this.$api.algorithmsLibrary.shareAlgorithm,
-                    data: {
-                        id: row.id,
-                    },
-                }).then((res) => {
-                    if (res.code == 200) {
-                        this.$message.success("分享成功");
-                    } else {
-                        this.$message.error(res.message || "分享失败");
-                    }
-                    this.doSearch();
-                });
-            });
-        },
+        addOne() { },
     },
     async mounted() {
         /*await this.$dicsListsInit({
             validationStatusList: "validationStatus",
         });*/
+
+        await this.$axios({
+            method: "post",
+            url: this.$api.common.isAdmin,
+            data: {},
+        }).then(async (res) => {
+            if (res.code == 200) {
+                this.isAdmin = res.info
+
+                if (res.info) {
+                    await this.$dicsListsInit({
+                        algorithmStatusList: "algorithmStatus",
+                    });
+                }
+            } else {
+                this.$message.error(res.message || "获取是否为管理员信息失败");
+            }
+        });
+
+
     },
 };
 </script>
@@ -230,7 +279,8 @@ export default {
         top: 45px;
     }
 }
-.myTabsBox{
-    min-height:29px;
+
+.myTabsBox {
+    min-height: 29px;
 }
 </style>