Browse Source

Merge branch 'web-v2' of http://192.168.1.43:3000/git/sass-lab-web into web-v2

dedsudiyu 2 years ago
parent
commit
18cee10d09

+ 9 - 0
src/api/laboratory/apkfile.js

@@ -101,3 +101,12 @@ export function apkUploadDelete(query) {
     method: 'delete'
   })
 }
+
+//编辑apk
+export function editApkList(query) {
+  return request({
+    url: '/laboratory/apkfile/editApk',
+    method: 'post',
+    params: query
+  })
+}

+ 19 - 13
src/views/system/algorithm/index.vue

@@ -27,8 +27,8 @@
                 </el-option>
               </el-select>
       </el-form-item>
-      <el-form-item label="是否报警" prop="inOutType">
-        <el-select v-model="queryParams.isAlarm" placeholder="请选择是否报警">
+      <el-form-item label="是否通过" prop="inOutType">
+        <el-select v-model="queryParams.isAlarm" placeholder="请选择是否通过">
           <el-option
             v-for="item in alarmList"
             :key="item.value"
@@ -54,20 +54,20 @@
       <el-table-column label="算法名称" align="center" prop="algorithmName" />
       <el-table-column label="原始图" width="150">
         <template scope="scope">
-          <img :src="scope.row.originalImg" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row)"/>
+          <img :src="scope.row.originalImg" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'original')"/>
         </template>
       </el-table-column>
       <el-table-column label="请求时间" align="center" prop="createTime" />
       <el-table-column label="识别结果" width="150">
         <template scope="scope">
-          <img :src="scope.row.algorithmResult" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row)"/>
+          <img :src="scope.row.algorithmResult" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'result')"/>
         </template>
       </el-table-column>
-      <el-table-column label="响应时间" align="center" prop="updateTime" />
-      <el-table-column label="是否报警" align="center" prop="isAlarm">
+      <el-table-column label="响应时间" align="center" prop="outTime" />
+      <el-table-column label="是否通过" align="center" prop="isAlarm">
         <template scope="scope">
-          <p v-if="scope.row.isAlarm=='0'">否</p>
-          <p v-if="scope.row.isAlarm=='1'">是</p>
+          <p v-if="scope.row.isAlarm=='1'">不通过</p>
+          <p v-if="scope.row.isAlarm=='0'">通过</p>
         </template>
       </el-table-column>
 
@@ -174,11 +174,11 @@ export default {
           },
           {
               value: '0',
-              label: ''
+              label: '通过'
           },
           {
               value: '1',
-              label: ''
+              label: '不通过'
           }
       ],
       // 查询参数
@@ -211,9 +211,15 @@ export default {
   },
   methods: {
     //点击放大图片
-    imgBigBox(row){
-      this.imgTitle = '算法名称:'+row.algorithmName;
-      this.imgUrl = row.algorithmResult;
+    imgBigBox(row,doType){
+      if(doType=='original'){
+        this.imgTitle = '算法名称:'+row.algorithmName;
+        this.imgUrl = row.originalImg;
+      }else if(doType=='result'){
+        this.imgTitle = '算法名称:'+row.algorithmName;
+        this.imgUrl = row.algorithmResult;
+      }
+
       this.imgOpen = true;
     },
     /** 查询算法回调结果列表 */

+ 2 - 2
src/views/system/apkfile/index.vue

@@ -136,8 +136,8 @@
             <el-option v-for="dict in onepcTypeList" :key="dict.id" :label="dict.name" :value="dict.id" ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="安装包" prop="apkId">
-          <el-select v-model="form.apkId" placeholder="请选择安装包">
+        <el-form-item label="版本名称" prop="apkId">
+          <el-select v-model="form.apkId" placeholder="请选择版本">
             <el-option
               v-for="item in apkIdOptions"
               :key="item.apkId"

+ 87 - 22
src/views/system/apkfileList/index.vue

@@ -39,12 +39,18 @@
         </template>
       </el-table-column>
       <el-table-column label="说明信息" align="left" prop="apkInfo" :show-overflow-tooltip="true"/>
+      <el-table-column label="APK大小" align="left" prop="fileData" >
+        <template slot-scope="scope" v-if="scope.row.fileData">
+          <p>{{scope.row.fileData.size}}</p>
+        </template>
+      </el-table-column>
       <el-table-column label="创建人" align="left" prop="createBy" />
       <el-table-column label="创建时间" align="left" prop="createTime" />
       <el-table-column label="操作" align="left" width="160">
         <template slot-scope="scope">
           <div style="display: flex;justify-content: flex-start;">
             <p style="color: #0183fa;cursor: pointer" @click="handleClick('',scope.row,'download')">下载</p>
+            <p style="color: #0183fa;cursor: pointer;margin-left: 20px"  @click="handleClick('',scope.row,'edit')">编辑</p>
             <p style="color: #0183fa;cursor: pointer;margin-left: 20px"  @click="handleClick('',scope.row,'delete')">删除</p>
           </div>
 
@@ -132,7 +138,14 @@
 </template>
 
 <script>
-  import { listLog, apkUploadList, getApkUploadList,addApkUpload,apkUploadDelete} from "@/api/laboratory/apkfile";
+import {
+  listLog,
+  apkUploadList,
+  getApkUploadList,
+  addApkUpload,
+  apkUploadDelete,
+  editApkList
+} from '@/api/laboratory/apkfile'
   import { getToken } from "@/utils/auth";
   import axios from 'axios'
   import SparkMD5 from 'spark-md5'
@@ -192,7 +205,15 @@
           },
         },
         //上传数据
-        upForm:{},
+        upForm:{
+          id:'',
+          versionName:null,
+          version:null,
+          apkInfo:null,
+          onepcType:null,
+          apkFileUpload:null,
+
+        },
         // apk上传表单校验
         apkRules: {
           versionName: [
@@ -293,6 +314,18 @@
       handleClick(index,row,doType){
         if(doType=='download'){
           window.open(window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API + row.apkFileUpload)
+        }else if(doType=='edit'){
+          this.upForm.id=row.id
+          this.upForm.versionName=row.versionName
+          this.upForm.version=row.version
+          this.upForm.apkInfo=row.apkInfo
+          this.upForm.onepcType=row.onepcType.toString()
+          this.upForm.apkFileUpload=row.apkFileUpload
+          if(row.fileData){
+            this.upForm.fileData=row.fileData
+            this.fileData=row.fileData
+          }
+          this.openUp=true
         }else if(doType=='delete'){
           this.$confirm('确认要删除?', "警告", {
             confirmButtonText: "确定",
@@ -313,9 +346,14 @@
       getList() {
         this.loading = true;
         apkUploadList(this.queryParams).then( response => {
-          this.logList =  response.rows;
           this.total =  response.total;
           this.loading = false;
+          this.logList =  response.rows;
+          this.logList.forEach(function(item) {
+            if(item.fileData){
+              item.fileData=JSON.parse(item.fileData)
+            }
+          })
         });
       },
       /** 搜索按钮操作 */
@@ -458,25 +496,52 @@
         if(this.loading){
           return
         }
-        this.$refs["upForm"].validate(valid => {
-          if (valid) {
-            let obj = {
-              versionName:this.upForm.versionName,
-              version:this.upForm.version,
-              apkInfo:this.upForm.apkInfo,
-              onepcType:this.upForm.onepcType,
-              apkFileUpload:this.upForm.apkFileUpload,
-            };
-            addApkUpload(obj).then( response => {
-              this.msgSuccess("新增成功");
-              this.getList()
-              this.openUp = false;
-              this.upForm = {};
-              this.fileList=[];
-              this.fileData = {};
-            });
-          }
-        });
+        if(this.upForm.id){//编辑
+          this.$refs["upForm"].validate(valid => {
+            if (valid) {
+              let obj = {
+                id:this.upForm.id,
+                versionName:this.upForm.versionName,
+                version:this.upForm.version,
+                apkInfo:this.upForm.apkInfo,
+                onepcType:this.upForm.onepcType,
+                apkFileUpload:this.upForm.apkFileUpload,
+                fileData:JSON.stringify(this.fileData),
+              };
+              editApkList(obj).then( response => {
+                this.msgSuccess("编辑成功");
+                this.getList()
+                this.openUp = false;
+                this.upForm = {};
+                this.fileList=[];
+                this.fileData = {};
+              });
+            }
+          });
+
+        }else{//添加
+          this.$refs["upForm"].validate(valid => {
+            if (valid) {
+              let obj = {
+                versionName:this.upForm.versionName,
+                version:this.upForm.version,
+                apkInfo:this.upForm.apkInfo,
+                onepcType:this.upForm.onepcType,
+                apkFileUpload:this.upForm.apkFileUpload,
+                fileData:JSON.stringify(this.fileData),
+              };
+              addApkUpload(obj).then( response => {
+                this.msgSuccess("新增成功");
+                this.getList()
+                this.openUp = false;
+                this.upForm = {};
+                this.fileList=[];
+                this.fileData = {};
+              });
+            }
+          });
+        }
+
       },
     }
   };