浏览代码

算法库联调

zhangliang2 3 年之前
父节点
当前提交
33421da075
共有 33 个文件被更改,包括 1102 次插入1854 次删除
  1. 22 0
      src/api/algorithmsLibrary.js
  2. 5 2
      src/api/common.js
  3. 3 1
      src/api/index.js
  4. 10 3
      src/api/sceneLibrary.js
  5. 24 0
      src/assets/common/css/theme.less
  6. 二进制
      src/assets/common/image/sensor/001.png
  7. 二进制
      src/assets/common/image/sensor/002.png
  8. 二进制
      src/assets/common/image/sensor/003.png
  9. 二进制
      src/assets/common/image/sensor/004.png
  10. 二进制
      src/assets/common/image/sensor/005.png
  11. 5 2
      src/components/grid/TableList.vue
  12. 120 1028
      src/components/upload/upload.vue
  13. 0 0
      src/lib/spark-md5.min.js
  14. 40 158
      src/lib/util.js
  15. 12 4
      src/router/algorithmsLibrary.js
  16. 1 1
      src/router/filter.js
  17. 0 220
      src/views/algorithmsLibrary/addAlgorithms.vue
  18. 167 86
      src/views/algorithmsLibrary/algorithmsLibraryList.vue
  19. 190 0
      src/views/algorithmsLibrary/exportAlgorithms.vue
  20. 177 0
      src/views/algorithmsLibrary/gitAlgorithms.vue
  21. 8 3
      src/views/modelLibrary/components/handleConfigList.vue
  22. 11 11
      src/views/modelLibrary/vehicleConfigurationDetail.vue
  23. 1 1
      src/views/page/pageMenu.vue
  24. 16 4
      src/views/sceneLibrary/common/util.less
  25. 141 0
      src/views/sceneLibrary/components/fileDialog.vue
  26. 0 210
      src/views/sceneLibrary/components/upload.vue
  27. 4 4
      src/views/sceneLibrary/gradingRulesList.vue
  28. 62 15
      src/views/sceneLibrary/naturalDrivingScenarioList.vue
  29. 12 12
      src/views/sceneLibrary/scenarioTestPackageManagementList.vue
  30. 5 19
      src/views/sceneLibrary/scenePacketList.vue
  31. 34 67
      src/views/sceneLibrary/standardRegulationSimulationScenarioList.vue
  32. 29 1
      src/views/sceneLibrary/trafficAccidentSimulationScenarioList.vue
  33. 3 2
      vue.config.js

+ 22 - 0
src/api/algorithmsLibrary.js

@@ -0,0 +1,22 @@
+const basePart = '/simulation/resource/server';
+
+const selectSharedAlgorithmList = basePart + '/algorithm/selectSharedAlgorithmList'; // 算法库查询公有列表
+const selectAlgorithmList = basePart + '/algorithm/selectAlgorithmList'; // 算法库查询私有列表
+const deleteByid = basePart + '/algorithm/deleteByid'; // 确定删除算法
+const isAlgorithmRunning = basePart + '/algorithm/isAlgorithmRunning'; // 删除算法时判断绑定算法的项目是否正在运行
+const shareAlgorithm = basePart + '/algorithm/shareAlgorithm'; // 分享算法
+
+const addOrUpdate = basePart + '/algorithm/addOrUpdate'; // 私有算法新增
+const selectDetailsById = basePart + '/algorithm/selectDetailsById'; // 查询算法详情
+
+
+export default {
+    selectSharedAlgorithmList,
+    selectAlgorithmList,
+    deleteByid,
+    isAlgorithmRunning,
+    shareAlgorithm,
+
+    addOrUpdate,
+    selectDetailsById
+}

+ 5 - 2
src/api/common.js

@@ -4,13 +4,16 @@ const single = '/simulation/oauth/client/sign/single';
 const getDictListsByTypes = '/simulation/resource/server/dict/getDictListsByTypes'; // 字典 单级下拉
 const getDictTreesByTypes = '/simulation/resource/server/dict/getDictTreesByTypes'; // 字典 多级下拉
 
-const uploadNew = '/simulation/resource/server/file/uploadNew'; // 上传
+const uploadWj = basePart + '/simulation/resource/server/file/uploadWj'; // 上传
+const download = basePart + '/simulation/resource/server/file/download'; // 下载方法
 
 export default {
     single,
     getDictListsByTypes,
     getDictTreesByTypes,
-    uploadNew
+    
+    uploadWj,
+    download
 }
 
 //10.15.12.74:7001/simulation/oauth/client/sign/single?code=1001&ticket=1001

+ 3 - 1
src/api/index.js

@@ -4,12 +4,14 @@ import common from './common.js'
 import sceneLibrary from './sceneLibrary.js'
 import workManagement from './workManagement.js'
 import modelLibrary from './modelLibrary.js'
+import algorithmsLibrary from './algorithmsLibrary.js'
 
 const api = {
     common,
     sceneLibrary,
     workManagement,
-    modelLibrary
+    modelLibrary,
+    algorithmsLibrary
 }
 
 export default api;

+ 10 - 3
src/api/sceneLibrary.js

@@ -9,15 +9,19 @@ const fxScoringRules = basePart + '/ScoringRules/fxScoringRules'; // 分享打
 const deleteScoringRules = basePart + '/ScoringRules/deleteScoringRules'; // 删除打分规则
 
 const queryStandardsRegulationsList = basePart + '/StandardsRegulations/queryStandardsRegulationsList'; // 标准法规仿真场景列表
-const download = basePart + '/StandardsRegulations/download'; // 
+const saveStandardsRegulations = basePart + '/StandardsRegulations/saveStandardsRegulations'; // 新增标准法规仿场景
 
 const querySceneAccidentList = basePart + '/SceneAccident/querySceneAccidentList'; // 交通事故仿真场景列表
+const saveSceneAccident = basePart + '/SceneAccident/saveSceneAccident'; // 新增交通事故仿真场景
 
 const querySceneNaturalList = basePart + '/SceneNatural/querySceneNaturalList'; // 自然驾驶场景列表
+const saveSceneNatural = basePart + '/SceneNatural/saveSceneNatural'; // 新增自然驾驶场景
 
 const queryScenePackageList = basePart + '/ScenePackage/queryScenePackageList'; // 场景测试包管理列表
 const queryScenePackageSublistList = basePart + '/ScenePackage/queryScenePackageSublistList'; // 场景数据包列表
 
+
+
 export default {
     // queryScenePackageSublistList,
     queryScoringRulesList,
@@ -27,14 +31,17 @@ export default {
     deleteScoringRules,
 
     queryStandardsRegulationsList,
-    download,
+    saveStandardsRegulations,
 
     querySceneAccidentList,
+    saveSceneAccident,
 
     querySceneNaturalList,
+    saveSceneNatural,
 
     queryScenePackageList,
-    queryScenePackageSublistList
+    queryScenePackageSublistList,
+
 }
 
 

+ 24 - 0
src/assets/common/css/theme.less

@@ -182,6 +182,30 @@
             }
         }
     }
+
+    &.myTabsBoxThreeTabs {
+        .el-tabs {
+            width: 385px;
+        }
+
+        .el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2) {
+            padding-left: 0;
+        }
+
+        .el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item.is-active ~ .el-tabs__item {
+            border-left-color: transparent;
+        }
+
+        // .el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2).is-active {
+        //     &.el-tabs__item:nth-child(3) {
+        //         border-left-color: transparent;
+        //     }
+        // }
+
+        .el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child {
+            padding-left: 20px;
+        }
+    } 
 }
 
 .el-tabs--card>.el-tabs__header {

二进制
src/assets/common/image/sensor/001.png


二进制
src/assets/common/image/sensor/002.png


二进制
src/assets/common/image/sensor/003.png


二进制
src/assets/common/image/sensor/004.png


二进制
src/assets/common/image/sensor/005.png


+ 5 - 2
src/components/grid/TableList.vue

@@ -69,7 +69,7 @@
                             :empty-text="emptyText"
                             :height="propHeight"
                             :header-cell-class-name='propHeaderCellClassName'
-                            :row-key="propRowkey"
+                            row-key="id"
                             @expand-change='propExpandChange'
                             :lazy='propLazy'
                             :load='propLoad'
@@ -265,7 +265,10 @@
                 default:true,
                 type:Boolean
             },
-            propRowkey:String,
+            propRowkey:{
+                default: 'sublistId',
+                type: String
+            },
             propExpandChange:{
                 default:function () {
 

+ 120 - 1028
src/components/upload/upload.vue

@@ -1,1079 +1,171 @@
-/**
-*  附件上传组件
-*  @params
-***
-*  autoUp 是否开启自动上传
-*  downAll 是否可以批量下载
-*  accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf" 指定可上传的文件类型
-*  show-file-list 是否采用elementUi默认展示方式?
-*  defaultFileList 初始化list数据 展示时使用  不可编辑
-*  draftFileList 初始化list数据  草稿状态使用  仍然可以进行编辑
-*  down-and-preview  show-file-list为true情况下是否可以预览和下载
-*  show-table 和 show-file-list 只能一个为true 或者都为false 自定义 success 回调的展示
-*  show-table  采用表格展示方式 false
-*  columns 采用表格展示,需要配置表头
-**/
 <template>
-    <div class="myupload">
+    <div>
         <el-upload
-            v-if="ie10Control"
-            class="upload-demo"
             ref="upload"
-            action="#"
-            :disabled="disabled"
-            :accept="acceptType"
-            :before-upload="beforeUploadFile"
+            action=""
             :on-change="handleChange"
-            :http-request="toUpload"
-            :on-progress="toUploadProgress"
-            :on-success="toUploadSuccess"
-            :on-error="toUploadError"
-            :on-preview="handlePreview"
-            :before-remove="beforeRemove"
             :on-remove="handleRemove"
-            :on-exceed="handleExceed"
+            :on-preview="preview"
+            :on-success="success"
+            :on-error="error"
+            :http-request="toUpload"
             :file-list="fileList"
-            :auto-upload="autoUp"
-            :show-file-list="showFileList"
-            :limit="fileNum"
-            :multiple="multipleCtrl"
+            :limit="limit"
+            :on-exceed="handleExceed"
+            multiple
         >
-            <span
-                style="
-                    color: red;
-                    margin-left: calc(100% - 485px);
-                    float: left;
-                    display: inline-block;
-                    height: 30px;
-                    line-height: 30px;
-                "
-                v-if="fjShowMsg"
-            >
-                请不要上传、处理、存储、传输涉密信息!</span
-            >
-            <el-button
-                :disabled="disabled"
-                v-if="defaultFileList.length == 0"
-                slot="trigger"
-                size="small"
-                type="primary"
-                icon="el-icon-circle-plus"
-                >选取文件
-            </el-button>
-            <el-button
-                v-if="!autoUp"
-                style="margin-left: 10px"
-                size="small"
-                type="success"
-                @click="submitUpload"
-                icon="el-icon-upload"
-            >
-                上传文件
-            </el-button>
-            <el-button
-                v-if="downAll"
-                style="margin-left: 10px"
-                size="small"
-                type="success"
-                @click.stop="downloadAll"
-                icon="el-icon-download"
-            >
-                批量下载
-            </el-button>
-            <span style="color: red; margin-left: 5px" v-if="isShowUploadMsg"
-                >请不要上传、处理、存储、传输涉密信息!</span
-            >
-            <div slot="tip" class="mytip">
-                <slot name="mytip"></slot>
-                <el-progress
-                    v-if="isMultipartUpload && showProgress"
-                    :key="refresh"
-                    status="success"
-                    :percentage="multipartPercentage"
-                    :text-inside="true"
-                    :stroke-width="13"
-                >
-                </el-progress>
-            </div>
+            <el-button size="small" type="primary">点击上传</el-button>
         </el-upload>
-        <table-list
-            ref="table"
-            v-if="defaultFileList.length > 0"
-            index
-            :getDataWay="getDataWay"
-            :columns="columns"
-        >
-            <el-table-column label="操作" slot="opts" width="200">
-                <template slot-scope="scope">
-                    <el-link
-                        :underline="false"
-                        @click="showPreview(scope.row)"
-                        class="a-link optItem"
-                    >
-                        预览
-                    </el-link>
-                    <el-link
-                        :underline="false"
-                        @click="showDownload(scope.row)"
-                        class="a-link optItem"
-                    >
-                        下载
-                    </el-link>
-                </template>
-            </el-table-column>
-        </table-list>
-        <div v-if="downAndPreview">
-            <el-dialog
-                title="提示"
-                :visible.sync="dialogVisible"
-                width="500px"
-                :close="dialogClose"
-                :close-on-click-modal="false"
-                :close-on-press-escape="false"
-                :modal-append-to-body="true"
-                :append-to-body="true"
-                v-dialogDrag="true"
-            >
-                <span
-                    ><i class="el-icon-warning el-dialog__body-myi"></i
-                    >对该文件进行预览或者下载?</span
-                >
-                <span slot="footer" class="dialog-footer">
-                    <el-button size="small" type="primary" @click="preViewFile"
-                        >文件预览</el-button
-                    >
-                    <el-button size="small" type="primary" @click="downloadFile"
-                        >文件下载</el-button
-                    >
-                    <el-button size="small" @click="dialogVisible = false"
-                        >取 消</el-button
-                    >
-                </span>
-            </el-dialog>
-        </div>
-        <!-- <preview ref="preview"></preview> -->
+        <!--        <el-button @click="download">下载</el-button>-->
     </div>
 </template>
-<script>
-let ifrm;
-
-function ssoVerify(domain) {
-    try {
-        ifrm = document.createElement('<iframe name="ssoIframe"></iframe>');
-    } catch (e) {
-        ifrm = document.createElement("iframe");
-        ifrm.name = "ssoIframe";
-    }
-    ifrm.src =
-        domain +
-        "/ssoCheck.action?toUrl=" +
-        encodeURIComponent(store.state.fileServiceUrl);
-    ifrm.style = "display:none";
-    document.body.appendChild(ifrm);
-}
-
-function noop() {}
 
-function defaultUpload(file) {
-    const is30M = file.size / 1024 / 1024 < 30;
-    if (!is30M) {
-        this.$message.error("上传文件大小不能超过 30MB!");
-    }
-    return is30M;
-}
-// import "@/lib/spark-md5.min.js";
-import TableList from "@/components/grid/TableList";
-// import preview from "@/components/upload/preview";
+<script>
 export default {
     name: "upload",
     props: {
-        //是否显示非mi提示
-        isShowUploadMsg: {
-            type: Boolean,
-            default: false,
-        },
-        //附件页签 显示提示 在选取文件左侧
-        fjShowMsg: {
-            type: Boolean,
-            default: false,
+        // 限制上传的个数
+        limit: {
+            type: Number,
+            default: 100,
         },
-        //上传文件新加参数,默认1,只有部门共享文件上传2
-        uploadFileType: {
+        // 一组文件传相同的值,保证其为一组
+        objectPath: {
             type: String,
             default: "1",
         },
-        isMultipartUpload: {
-            type: Boolean,
-            default: false,
-        },
-        disabled: {
-            type: Boolean,
-            default: false,
-        },
-        getDataWay: {
-            //初始化list数据
-            type: Object,
-            default: () => ({
-                dataType: "data",
-                data: [{ name: "测试.pdf", size: "1024" }],
-            }),
-        },
-        columns: {
-            //初始化list数据
-            type: Array,
-            default: () => [
-                {
-                    label: "文件名称",
-                    prop: "name",
-                },
-                {
-                    label: "文件大小",
-                    prop: "size",
-                    columnWidth: "100",
-                },
-                {
-                    label: "操作",
-                    prop: "opts",
-                    columnWidth: "200",
-                    template: true,
-                },
-            ],
-        },
-        acceptType: {
-            //接受的上传类型
+        type: {
             type: String,
-            default: "",
-        },
-        autoUp: {
-            //自动上传
-            type: Boolean,
-            default: false,
-        },
-        downAll: {
-            //下载全部
-            type: Boolean,
-            default: false,
-        },
-        showFileList: {
-            //是否使用elementUi自带的展示方式
-            type: Boolean,
-            default: true,
-        },
-        showTable: {
-            //是否使用elementUi自带的展示方式
-            type: Boolean,
-            default: true,
-        },
-        downAndPreview: {
-            //elementUi展示是否可以预览
-            type: Boolean,
-            default: true,
-        },
-        fileNum: {
-            type: Number,
-            default: 10000,
-        },
-        listType: {
-            type: String,
-            default: "text",
-        },
-        defaultFileList: {
-            //初始化list数据
-            type: Array,
-            default: () => [],
-        },
-        draftFileList: {
-            //草稿初始化list数据
-            type: Array,
-            default: () => [],
-        },
-        md5CheckParams: {
-            type: Object,
-            default: () => ({
-                //md5校验需要的参数
-                userId: "222222",
-                moduleName: "CheckForFrontEnd",
-            }),
-        },
-        upLoadParams: {
-            type: Object,
-            default: () => ({
-                //上传需要的其他参数
-                userId: "222222",
-                moduleName: "CheckForFrontEnd",
-            }),
-        },
-        downLoadOneParams: {
-            type: Object,
-            default: () => ({
-                //下载需要的参数
-                isPreview: 1,
-                forceDocx: 1,
-                webOffice: 1,
-                wordWaterMark: 1,
-                isWpsSecure: 1,
-                caToken: 1,
-                waterMark: 1,
-            }),
-        },
-        downLoadAllParams: {
-            type: Object,
-            default: () => ({
-                //下载需要的参数
-                zipName: "zipDownload.zip",
-            }),
-        },
-        getPdfPathParams: {
-            type: Object,
-            default: () => ({
-                isPreview: 1,
-                forceRefresh: 1,
-                xdocPdf: 1,
-            }),
-        },
-        onUpSuccess: {
-            type: Function,
-            default: noop,
-        },
-        onUpError: {
-            type: Function,
-            default: noop,
-        },
-        onUpProgress: {
-            type: Function,
-            default: noop,
-        },
-        onUpChange: {
-            type: Function,
-            default: noop,
-        },
-        onUpRemove: {
-            type: Function,
-            default: noop,
-        },
-        onUpDownloadOne: {
-            type: Function,
-            default: noop,
-        },
-        onUpDownloadMany: {
-            type: Function,
-            default: noop,
-        },
-        //用于传输上传和删除数据的props
-        transferUploadRes: {
-            type: Function,
-            default: noop,
-        },
-        transferDelete: {
-            type: Function,
-            default: noop,
-        },
-        /*beforeUpload: {
-                    type: Function,
-                    default: defaultUpload
-                },*/
-        multipleCtrl: {
-            //控制是否多选
-            type: Boolean,
-            default: true,
+            default: "1",
         },
     },
-    components: { TableList },
     data() {
         return {
-            refresh: 0, //再次上传视频时更新组件
-            showProgress: false, //显示进度条
-            multipartPercentage: 0,
-            dialogVisible: false,
             fileList: [],
-            currentFileData: {},
-            ie10Control: true,
-            fileIndex: 0,
+            attachmentList: [],
+            defaultParam: {},
         };
     },
-    computed: {
-        // 控制是否多选
-        // 发文、签报、收文 单选
-        /* multipleCtrl() {
-				
-				// 发文拟稿状态 => 单选
-				if ( this.$route &&
-				     this.$route.name &&
-				     this.$route.name == 'SendProcessForm') {
-					return false;
-				} 
-				// 发文流转状态 => 单选
-				else if ( this.$route &&  
-					 this.$route.query && 
-					 this.$route.query.formData &&
-					 this.$route.query.formData.bizType &&
-					 this.$route.query.formData.bizType == "FW_TYLX" ) {
-					return false;
-				}
-				// 签报拟稿状态 => 单选
-				else if ( this.$route &&
-				     this.$route.name &&
-				     this.$route.name == 'ReportProcessForm') {
-					return false;
-				} 
-				// 签报流转状态 => 单选
-				else if ( this.$route &&  
-					 this.$route.query && 
-					 this.$route.query.formData &&
-					 this.$route.query.formData.bizType &&
-					 this.$route.query.formData.bizType == "QB_TYLX" ) {
-					return false;
-				}
-				// 收文拟稿状态 => 单选
-				if ( this.$route &&
-				     this.$route.name &&
-				     this.$route.name == 'AcceptProcessForm') {
-					return false;
-				} 
-				// 收文流转状态 => 单选
-				else if ( this.$route &&  
-					 this.$route.query && 
-					 this.$route.query.formData &&
-					 this.$route.query.formData.bizType &&
-					 this.$route.query.formData.bizType == "SW_TYLX" ) {
-					return false;
-				}
-				// 其他情况 => 多选
-				else{
-					return true;
-				}
-
-			}, */
-    },
-
-    created() {
-        if (this.defaultFileList && this.defaultFileList.length > 0) {
-            this.getDataWay.data = this.defaultFileList;
-        }
-
-        if (this.draftFileList && this.draftFileList.length > 0) {
-            this.fileList = this.draftFileList;
-        }
-    },
-    watch: {
-        draftFileList: {
-            handler: function () {
-                this.fileList = this.draftFileList;
-            },
-            immediate: true,
-        },
-        defaultFileList: {
-            handler: function () {
-                this.getDataWay.data = this.defaultFileList;
-            },
-            immediate: true,
-        },
-    },
     methods: {
-        beforeUploadFile(file) {
-            let testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
-            let acceptType = this.acceptType;
-            if (acceptType && acceptType.indexOf(testmsg) == -1) {
-                this.$message({
-                    message: "上传文件只能是" + acceptType + "格式!",
-                    type: "warning",
-                });
-                return false;
-            }
-
-            //上传前判断
-            // 如果是视频文件或者文件大小超过200M,走分片上传逻辑
-            this.isMultipartUpload =
-                ["mp4", "MP4"].indexOf(testmsg) !== -1 ||
-                file.size > 2.1 * Math.pow(10, 8);
-
-            // let name = file.name;
-            // for (let i = 0; i < this.fileList.length; i++) {
-            //     let listName = this.fileList[i].name;
-            //     if (listName == name) {
-            //         this.$message({
-            //             type: 'warning',
-            //             message: '您已经上传过' + name + ',请勿重复上传!'
-            //         })
-            //         return false;
-            //     }
-            // }
-            return true;
-        },
-        showPreview(row) {
-            this.currentFileData = row;
-            this.preViewFile();
-        },
-        showDownload(row) {
-            this.currentFileData = row;
-            this.downloadFile();
-        },
-        submitUpload() {
-            this.$refs.upload.submit();
-        },
-        toUpload(params) {
-            let that = this;
-            params.file.index = ++that.fileIndex;
-            that.$$md5ByFile(params).then((res) => {
-                let defaultParam = {
-                    file: params.file,
-                    md5: res.md5,
-                };
-                that.$$md5CheckByFile(
-                    Object.assign(defaultParam, that.md5CheckParams)
-                )
-                    .then(async (checkRes) => {
-                        if (checkRes && checkRes.message === "正常上传") {
-                            if (that.isMultipartUpload) {
-                                this.multipartPercentage = 0;
-                                this.refresh++;
-                                that.showProgress = true;
-                                let fileResult = await that.sliceChunkFile(
-                                    params
-                                );
-                                let checkResult = await that.checkChunkFile(
-                                    fileResult.filechunks[0].md5,
-                                    fileResult.filechunks[0].fileSize
-                                );
-                                fileResult.wholeFile = params.file;
-                                await that.uploadChunkFile(
-                                    res.md5,
-                                    fileResult,
-                                    checkResult.info.index + 1
-                                );
-                                this.finishChunkFile(
-                                    res.md5,
-                                    fileResult.chunks,
-                                    params
-                                );
-                            } else {
-                                that.toUploadDfs(params, defaultParam);
-                            }
-                        } else if (checkRes && checkRes.message === "0") {
-                            this.transferUploadRes({
-                                file: defaultParam.file,
-                                md5: defaultParam.md5,
-                                url: checkRes.url,
-                            });
-                            that.$$updateAnyoneDownload(checkRes.url)
-                                .then(function (res) {
-                                    params.onSuccess(checkRes);
-                                })
-                                .catch((error) => {
-                                    that.$message({
-                                        type: "error",
-                                        message: "更新预览状态失败!",
-                                    });
-                                    params.onError(error);
-                                });
-                        } else if (checkRes && checkRes == "ssoNotLogin") {
-                            //that.toNotLogin(params, defaultParam);
-                        } else {
-                            that.$message({
-                                type: "error",
-                                message: "上传失败",
-                            });
-                        }
-                    })
-                    .catch((error) => {
-                        //that.toNotLogin(params, defaultParam);
-                    });
-            });
-        },
-        toUploadDfs(params, defaultParam) {
-            let that = this;
-            that.$$uploadFile(
-                Object.assign(defaultParam, {
-                    progress: params.onProgress,
-                    uploadFileType: this.uploadFileType,
-                })
-            )
-                .then(function (response) {
-                    that.transferUploadRes({
-                        file: response.fileSrcName,
-                        md5: response.md5,
-                        url: response.url,
-                    });
-                    let resObj = {
-                        fileExt: response.fileExt,
-                        secretKey: response.secretKey,
-                        fileSize: response.fileSize,
-                        name: response.fileSrcName,
-                        url: response.url,
-                        md5: response.md5,
-                    };
-                    that.$$updateAnyoneDownload(response.url)
-                        .then(function (res) {
-                            params.onSuccess(Object.assign(resObj, response));
-                        })
-                        .catch((error) => {
-                            that.$message({
-                                type: "error",
-                                message: "更新预览状态失败!",
-                            });
-                            params.onError(error);
-                        });
-                })
-                .catch((error) => {
-                    that.$message({
-                        type: "error",
-                        message: "上传失败",
-                    });
-                    params.onError(error);
-                });
-        },
-        toNotLogin(params, defaultParam) {
-            let that = this;
-            ssoVerify(store.state.ssoServiceUrl);
-            if (ifrm.attachEvent) {
-                //ie
-                ifrm.attachEvent("onload", function () {
-                    that.toUploadDfs(params, defaultParam);
-                });
-            } else {
-                //  chrome
-                ifrm.onload = function () {
-                    that.toUploadDfs(params, defaultParam);
-                };
-            }
-        },
-        sortFileList(fileList) {
-            if (
-                fileList.length > 0 &&
-                fileList[0].raw &&
-                fileList[0].raw.index
-            ) {
-                fileList.sort((a, b) => {
-                    return a.raw.index - b.raw.index;
-                });
-            }
-        },
-        toUploadSuccess(response, file, fileList) {
-            if (this.$IEVersion() <= 10) {
-                this.ie10Control = false;
-                this.$nextTick(() => {
-                    this.ie10Control = true;
-                });
-            }
-            this.sortFileList(fileList);
-            this.onUpSuccess(response, file, fileList);
-            this.fileList = fileList;
-        },
-        toUploadError(err, file, fileList) {
-            this.sortFileList(fileList);
-            this.onUpError(err, file, fileList);
-        },
-        toUploadProgress(event, file, fileList) {
-            this.sortFileList(fileList);
-            this.onUpProgress(event, file, fileList);
-        },
-        handleExceed() {
-            this.$message({
-                type: "warning",
-                message: "文件个数不能超过" + this.fileNum + "个",
-            });
-        },
         handleChange(file, fileList) {
-            if (file.response) {
-                this.sortFileList(fileList);
-                this.onUpChange(file, fileList);
-            }
-        },
-        async beforeRemove(file, fileList) {
-            this.sortFileList(fileList);
-            this.onUpRemove(file, fileList);
-            this.transferDelete(file.name);
-        },
-        handleRemove(file, fileList) {
-            this.sortFileList(fileList);
             this.fileList = fileList;
-            this.onUpChange(file, fileList);
         },
-        handleRemoveSelf(filePath) {
-            for (let i = 0; i < this.fileList.length; i++) {
-                if (this.fileList[i].response.url === filePath) {
-                    this.fileList.splice(i, 1);
-                }
-            }
+        handleExceed(files, fileList) {
+            this.$message.warning(
+                `当前限制选择 ${this.limit} 个文件,本次选择了 ${
+                    files.length
+                } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+            );
         },
-
-        handlePreview(file) {
-            if (file.hasOwnProperty("status") && file.status === "success") {
-                this.currentFileData = Object.assign(file.response, file);
-                this.dialogVisible = true;
-            } else {
-                this.$message({
-                    type: "warning",
-                    message: "请先上传,再对文件进行预览或下载",
-                });
-            }
-        },
-        /* preViewFile() {
-            //文件预览
-            if (this.currentFileData.url) {
-                var suffixArr = this.currentFileData.name.split(".");
-                var suffix = suffixArr[suffixArr.length - 1];
-                this.$refs.preview.preViewFile({
-                    name: this.currentFileData.name,
-                    suffix: "." + suffix,
-                    url: this.currentFileData.url,
-                });
-            } else {
-                this.$message({
-                    type: "warning",
-                    message: "预览失败,请检查文件路径!",
-                });
-            }
-        }, */
-
-        /*单文件下载*/
-        downloadFile() {
-            let that = this;
-            this.$$download(this.currentFileData)
-                .then(() => {
-                    that.$message({
-                        type: "success",
-                        message: "下载成功!",
-                    });
-                })
-                .catch((err) => {
-                    that.$message({
-                        type: "info",
-                        message: "下载失败!",
-                    });
+        handleRemove(file, fileList) {
+            let md5 = "";
+            if (file.raw) {
+                this.$md5(file.raw).then((res) => {
+                    md5 = res;
                 });
-            this.dialogVisible = false;
-        },
-
-        dialogClose() {
-            this.currentFileData = {};
-        },
-
-        //批量下载
-        downloadAll() {
-            let that = this;
-            let md5Path = [];
-            let list = [];
-            if (this.defaultFileList && this.defaultFileList.length > 0) {
-                list = this.defaultFileList;
             } else {
-                list = this.fileList;
+                md5 = file.md5;
             }
-
-            list.forEach((item, index) => {
-                if (!!item.response.url) {
-                    md5Path.push({
-                        md5Path: item.response.url,
-                        fileName: item.name,
-                    });
+            let removeIndex = "";
+            this.attachmentList.forEach((item, index) => {
+                if (md5 === item.md5) {
+                    removeIndex = index;
                 }
             });
-            if (Array.isArray(this.downLoadAllParams.downloadFiles)) {
-                this.downLoadAllParams.downloadFiles.forEach((item) => {
-                    for (var i = 0; i < md5Path.length; i++) {
-                        if (
-                            item.md5Path == md5Path[i].md5Path &&
-                            item.fileName == md5Path[i].fileName
-                        ) {
-                            return;
-                        }
-                    }
-                    if (!!item.md5Path) {
-                        md5Path.push({
-                            md5Path: item.md5Path,
-                            fileName: item.fileName,
-                        });
-                    }
-                });
-            }
-
-            // let Params = Object.assign({//拼接参数
-            //     downloadFiles: md5Path,
-            // }, this.downLoadAllParams);
-            let Params = {
-                downloadFiles: md5Path,
-                zipName: this.downLoadAllParams.zipName,
-            };
-            // let arr=[];
-            // Params.md5Paths.forEach((item)=>{
-            //     if(!!item){
-            //         arr.push(item)
-            //     }
-            // });
-            // Params.md5Paths = arr;
-            // Params.md5Path=[...arr];
-            if (!md5Path.length) {
-                this.$message.warning("请先上传文件!");
-                return;
-            }
-
-            this.$$downloadPackage(Params)
-                .then(() => {
-                    // that.$message({
-                    //     type: 'success',
-                    //     message: '下载成功!'
-                    // })
-                })
-                .catch((err) => {
-                    that.$message({
-                        type: "info",
-                        message: "下载失败!",
-                    });
-                });
-        },
-
-        /*
-         * 分片-切片
-         */
-        sliceChunkFile(param) {
-            return new Promise((resolve, reject) => {
-                let blobSlice =
-                    File.prototype.slice ||
-                    File.prototype.mozSlice ||
-                    File.prototype.webkitSlice;
-                let chunkSize = 1024 * 1024 * 2;
-                let filechunks = new Array(
-                    Math.ceil(param.file.size / chunkSize)
-                );
-                let currrentChunk = 0;
-                let reader = new FileReader();
-                let start, end;
-                reader.onload = function (e) {
-                    var chunkfile = e.target.result;
-                    filechunks[currrentChunk] = {
-                        chunk: currrentChunk,
-                        fileSize: chunkfile.byteLength,
-                        chunkSize: chunkSize,
-                        chunkStart: start,
-                        chunkEnd: end,
-                    };
-                    console.log(
-                        `分片计算情况: 分片数:${filechunks.length} -- 当前片:${currrentChunk}`
-                    ); // --片大小:${chunkfile.byteLength}
-                    //spark.append(file);
-                    currrentChunk++;
-                    if (currrentChunk < filechunks.length) {
-                        loadNext();
-                    } else {
-                        console.log("完成分片解析");
-                        resolve({
-                            filechunks: filechunks,
-                            chunks: filechunks.length,
-                            fileName: param.file.name,
-                            //wholeFile: param.file     //完整的文件的传递
-                        });
-                    }
-                };
-                reader.onerror = function () {
-                    reject({ msg: "file too large" });
-                };
-                let loadNext = function () {
-                    start = currrentChunk * chunkSize;
-                    end =
-                        start + chunkSize >= param.file.size
-                            ? param.file.size
-                            : start + chunkSize;
-                    reader.readAsArrayBuffer(
-                        blobSlice.call(param.file, start, end)
-                    );
-                };
-                loadNext();
-            });
-        },
-        /*
-         * 分片-查片
-         */
-        checkChunkFile(md5, fileSize) {
-            return new Promise((resolve, reject) => {
-                this.$asyncAjaxCommon(this.$api.upload.md5Check4Chunk, {
-                    md5: md5,
-                    fileSize: fileSize,
-                })
-                    .then((res) => {
-                        resolve(res);
-                    })
-                    .catch((res) => {
-                        reject(res);
-                    });
-            });
+            this.attachmentList.splice(removeIndex, 1);
+            this.$emit("attachmentChange", this.attachmentList);
         },
-        /*
-         * 分片-上传
-         */
-        uploadSingleFile(md5, fileInfo, chunk, chunks, fileName) {
+        async toUpload(file) {
             let _this = this;
-            return new Promise((resolve, reject) => {
-                let chunkfile = null; //片文件(实际文件)
-                //用于获取文件指定片的参数
-                let blobSlice =
-                    File.prototype.slice ||
-                    File.prototype.mozSlice ||
-                    File.prototype.webkitSlice;
-                let reader = new FileReader();
-                reader.onload = function (e) {
-                    chunkfile = e.target.result;
-                    console.log(`进入了上传(第${chunk}/${chunks}片文件)`);
-                    var formData = new FormData();
-                    formData.append("md5", md5);
-                    let blobFile = new Blob([chunkfile]);
-                    formData.append("file", blobFile);
-                    formData.append("chunk", chunk);
-                    formData.append("chunks", chunks);
-                    formData.append("fileName", fileName);
-                    formData.append("uploadFileType", _this.uploadFileType);
-                    _this
-                        .$axios({
-                            method: "post",
-                            url: _this.$api.upload.upload4Chunk,
-                            data: formData,
-                            withCredentials: true,
-                            headers: {
-                                "Content-type": "multipart/form-data",
-                            },
-                            onUploadProgress: (progressEvent) => {
-                                var precent =
-                                    ((progressEvent.loaded /
-                                        progressEvent.total) *
-                                        100) |
-                                    0;
-                                _this.multipartPercentage =
-                                    (((chunk * 100 + precent) /
-                                        (chunks * 100)) *
-                                        100) >>
-                                    0;
-                            },
-                        })
-                        .then(function (res) {
-                            resolve(res);
-                        })
-                        .catch(function (error) {
-                            reject(error);
-                        });
-                };
-                reader.onerror = function () {
-                    alert("上传出错请联系管理员!");
-                };
-                reader.readAsArrayBuffer(
-                    blobSlice.call(
-                        fileInfo.wholeFile,
-                        fileInfo.chunkStart,
-                        fileInfo.chunkEnd
-                    )
-                );
-            });
-        },
-        uploadChunkFile(allMd5, obj, indexDefualt) {
-            let index = indexDefualt;
-            let chunksNum = obj.chunks; //分片总数
-            let fileName = obj.fileName; //上传的文件名
-            let errorNum = 0;
-            return new Promise((resolve, reject) => {
-                let loop = async (resolve, reject) => {
-                    let chunkFileInfo; //分片的详细信息{chunk:当前片的位数}
-                    if (index >= chunksNum) {
-                        index = null;
-                        chunksNum = null;
-                        resolve(true);
-                        return;
-                    }
-                    chunkFileInfo = obj.filechunks[index];
-                    chunkFileInfo.wholeFile = obj.wholeFile;
-                    //获取单独的一片准备上传
-                    var chunkReuslt = await this.uploadSingleFile(
-                        allMd5,
-                        chunkFileInfo,
-                        chunkFileInfo.chunk,
-                        chunksNum,
-                        fileName
-                    );
-                    if (chunkReuslt.code == "200") {
-                        index++;
-                        loop(resolve, reject);
-                    } else {
-                        errorNum++;
-                        if (errorNum > 10) {
-                            reject(new Error("分片文件上传失败"));
-                            return;
-                        } else {
-                            // 再传一遍
-                            loop(resolve, reject);
-                        }
-                    }
+            // 获取MD5值
+            /* await this.$md5(file.file).then((res) => {
+                _this.defaultParam = {
+                    file: file.file,
+                    md5: res,
                 };
-                loop(resolve, reject);
-            });
-        },
-        /*
-         * 分片-合并
-         */
-        finishChunkFile(md5, chunks, params) {
-            return new Promise((resolve, reject) => {
-                this.$asyncAjaxCommon(this.$api.upload.finishUpload, {
-                    md5: md5,
-                    businessSysCode: "OA_GT_001",
-                    chunks: chunks,
+            }); */
+            return new Promise(async (resolve, reject) => {
+                let formData = new FormData();
+                await formData.append("name", file.file.name);
+                // await formData.append('type', _this.defaultParam.md5)
+                await formData.append("type", this.type);
+                await formData.append("objectPath", this.objectPath);
+                // await formData.append("md5", _this.defaultParam.md5);
+                await formData.append("file", file.file);
+                await this.$axios({
+                    method: "post",
+                    url: this.$api.common.uploadWj,
+                    data: formData,
+                    withCredentials: true,
+                    headers: {
+                        "Content-type": "multipart/form-data",
+                    },
                 })
                     .then((res) => {
-                        this.transferUploadRes({
-                            file: res.fileName,
-                            md5: res.md5Path,
-                            url: res.md5Path,
-                        });
-                        let resObj = {
-                            fileExt: res.fileExt,
-                            secretKey: res.secretKey,
-                            fileSize: res.fileSize,
-                            name: res.fileName,
-                            url: res.md5Path,
-                            md5: res.md5Path,
-                        };
-                        this.$$updateAnyoneDownload(res.url)
-                            .then(function (res2) {
-                                params.onSuccess(Object.assign(resObj, res));
-                            })
-                            .catch((error) => {
-                                this.$message({
-                                    type: "error",
-                                    message: "更新预览状态失败!",
-                                });
-                                params.onError(error);
+                        if (res.code == 200 && res.info) {
+                            this.attachmentList.push({
+                                // attachmentName: file.file.name,
+                                // attachmentAddress: res.params,
+                                // md5: _this.defaultParam.md5,
+                                // uid: file.file.uid,
+                                fileType: file.file.type,
+                                fileName: res.info.fileName,
+                                videoPreview: res.info.videoPreview,
                             });
-                        resolve(res);
+                            resolve("成功");
+                            this.$emit("attachmentChange", this.attachmentList);
+                        }
                     })
-                    .catch((res) => {
-                        this.$ajaxError({
-                            mag: "分片合并失败",
-                        });
-                        reject(res);
+                    .catch((err) => {
+                        reject(err);
                     });
             });
         },
+        success(response, file, fileList) {
+            this.$message.success("上传成功 ");
+        },
+        error(response, file, fileList) {
+            this.$message.warning("上传失败");
+        },
+        preview(file) {
+            return false;
+            console.log(file);
+            console.log(this.attachmentList);
+            let item = this.attachmentList.find((item) => item.fileName.endsWith(file.name));
+            this.download(item.fileName, item.attachmentName);
+        },
+        download(downPath, downName) {
+            this.$axios({
+                method: "post",
+                url: this.$api.common.download,
+                responseType: "blob",
+                data: {
+                    objectName: downPath,
+                },
+            }).then((res) => {
+                const blob = new Blob([res]); //构造一个blob对象来处理数据
+                const fileName = downName;
+                //对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
+                //IE10以上支持blob但是依然不支持download
+                if ("download" in document.createElement("a")) {
+                    //支持a标签download的浏览器
+                    const link = document.createElement("a"); //创建a标签
+                    link.download = fileName; //a标签添加属性
+                    link.style.display = "none";
+                    link.href = URL.createObjectURL(blob);
+                    document.body.appendChild(link);
+                    link.click(); //执行下载
+                    URL.revokeObjectURL(link.href); //释放url
+                    document.body.removeChild(link); //释放标签
+                } else {
+                    //其他浏览器
+                    navigator.msSaveBlob(blob, fileName);
+                }
+            });
+        },
     },
 };
 </script>
 
-<style lang="less" scoped>
-.myupload .el-dialog__body {
-    padding: 10px 20px;
-    font-size: 16px;
-}
-
-.myupload .el-dialog__body-myi {
-    color: #eed46f;
-    margin-right: 20px;
-}
-
-.mytip {
-    font-size: 12px;
-    color: #909399;
-    margin: 3px;
-}
-
-.optItem {
-    margin-left: 15px;
-}
-
-/deep/ .el-upload-list {
-    width: fit-content;
-}
+<style scoped>
 </style>

文件差异内容过多而无法显示
+ 0 - 0
src/lib/spark-md5.min.js


+ 40 - 158
src/lib/util.js

@@ -1,9 +1,6 @@
 import Vue from "vue";
 // import "@/lib/spark-md5.min.js";
 const SparkMD5 = require('spark-md5')
-// import a form "@/lib/aa.js";
-// console.log(aa);
-
 
 
 // 缓存
@@ -112,166 +109,51 @@ Vue.prototype.$dicsTreesInit = function (selectList) {
 }
 
 
-//上传 param:{md5:"",file,progress:func(percent){},success:func(){},error:func(){}}
-Vue.prototype.$$uploadFileFastDfs = function (param) {
-    const _that = this;
-    const promise = new Promise((resolve, reject) => {
-        let formData = new FormData();
-        formData.append("userId", upLoadParams.userId);
-        formData.append("moduleName", upLoadParams.moduleName);
-        formData.append("md5", param.md5);
-        formData.append("file", param.file);
-        formData.append("isToPdf", true);
-        _that
-            .$axios({
-                method: "post",
-                url: uploadUrl.uploadDfs,
-                data: formData,
-                headers: {
-                    "Content-type": "multipart/form-data"
-                },
-                onUploadProgress: progressEvent => {
-                    let percent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
-                    param.progress && param.progress(percent);
-                }
-            })
-            .then(function (res) {
-                resolve(res);
-            })
-            .catch(function (error) {
-                reject(error);
-            });
-    });
-    return promise;
-};
-
-Vue.prototype.$$updateAnyoneDownload = function (url) {
-    const that = this;
-    const promise = new Promise((resolve, reject) => {
-        let that = this;
-        this.$axios({
-                url: this.$api.upload.updateAnyoneDownload,
-                method: "post",
-                data: {
-                    md5Path: url
-                }
-            })
-            .then(function (res) {
-                resolve(res);
-            })
-            .catch(err => {
-                reject(err);
-            });
-    });
-    return promise;
-};
+/**
+ * 计算文件的MD5
+ * @param file 文件
+ * @param chunkSize 分片大小
+ * @returns Promise
+ */
+ function md5(file, chunkSize) {
+    // element 中组件对 file 进行加工,这里使用未加工的对象,只有未加工的对象才能在 blobSlice.call() 中正常操作
+    let fileRaw = file
 
+    // console.log('fileRaw',fileRaw);
 
-// 获取md5
-Vue.prototype.$$md5ByFile = async function (param) {
-    const promise = new Promise((resolve, reject) => {
-        let reader = new FileReader();
-        console.log(SparkMD5);
-        let spark = new SparkMD5.ArrayBuffer();
-        reader.onload = function (e) {
-            spark.append(e.target.result);
-            let md5 = spark.end();
-            resolve({
-                md5: md5
-            });
+    return new Promise((resolve, reject) => {
+        let blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice
+        let fileReader = new FileReader()
+        let chunkSize = 2097152;
+        let chunks = Math.ceil(file.size / chunkSize)
+        let currentChunk = 0
+        let spark = new SparkMD5()
+
+        fileReader.onload = function (e) {
+            spark.appendBinary(e.target.result);
+            currentChunk++;
+            if (currentChunk < chunks) {
+                loadNext();
+            } else {
+                let md5 = spark.end();
+                // console.log('computed hash', md5)
+                resolve(md5);
+            }
         };
-        reader.onerror = function () {
-            reject({
-                msg: "file too large"
-            });
+
+        fileReader.onerror = function (e) {
+            console.warn('FileReader error.')
+            reject(e);
         };
-        let file = param.file.size > 1024 * 1024 * 15 ? param.file.slice(0, 1024 * 1024 * 15) : param.file;
-        reader.readAsArrayBuffer(file);
-    });
-    return promise;
-};
 
+        function loadNext() {
+            let start = currentChunk * chunkSize
+            let end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize
+            fileReader.readAsBinaryString(blobSlice.call(file, start, end));
+        }
 
-//md5校验 param:{file,upLoadParams:{userId,moduleName}}
-Vue.prototype.$$md5CheckByFile = function (param) {
-    //uploadUrl.md5Check = store.state.fileServiceUrl + $api.upload.md5CheckUpload;
-    const promise = new Promise((resolve, reject) => {
-        this.$axios({
-                // method: "get",
-                method: "post",
-                url: $api.upload.md5CheckForFrontEnd,
-                withCredentials: true,
-                data: {
-                    md5: param.md5,
-                    fileSize: param.file.size,
-                    fileSrcName: param.file.name,
-                }
-                // method: "get",
-                // url: $api.upload.md5CheckForFrontEnd,
-                // withCredentials: true,
-                // params: {
-                //     md5: param.md5,
-                //     fileSize: param.file.size
-                //     userId: upLoadParams.userId,
-                //     moduleName: upLoadParams.moduleName,
-                //     fileSrcName: param.file.name,
-                //     srcSystem: "OA_GT_001",
-                //     isTemp: "0",
-                //     isPublic: "1",
-                //     noSsoUpload: "1",
-                //     anyoneDownload: "1"
-                // }
-            })
-            .then(function (res) {
-                resolve(res);
-            })
-            .catch(function (error) {
-                reject(error);
-            });
+        loadNext();
     });
-    return promise;
-};
-
+}
 
-//上传 param:{md5:"",file,progress:func(percent){},success:func(){},error:func(){}}
-Vue.prototype.$$uploadFile = function (param) {
-    uploadUrl.uploadDfs = this.$api.common.uploadNew;
-    // uploadUrl.uploadDfs = this.$api.upload.uploadDfs;
-    const _that = this;
-    const promise = new Promise((resolve, reject) => {
-        let formData = new FormData();
-        formData.append("userId", upLoadParams.userId);
-        formData.append("moduleName", upLoadParams.moduleName);
-        formData.append("md5", param.md5);
-        formData.append("file", param.file);
-        formData.append("fileSize", param.file.size);
-        formData.append("isTemp", "0");
-        formData.append("isPublic", "1");
-        formData.append("srcSystem", "OA_GT_001"); //自己服务对应的src
-        formData.append("noSsoUpload", "1"); //不需要校验sso
-        formData.append("anyoneDownload", "1"); //任何人都可以下载
-        formData.append("uploadFileType", param.uploadFileType ? param.uploadFileType : '1');
-        //部门共享文件上传时传2,其他默认1或不传
-        _that
-            .$axios({
-                method: "post",
-                url: uploadUrl.uploadDfs,
-                data: formData,
-                withCredentials: true,
-                headers: {
-                    "Content-type": "multipart/form-data"
-                },
-                onUploadProgress: progressEvent => {
-                    let percent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
-                    param.progress && param.progress(percent);
-                }
-            })
-            .then(function (res) {
-                resolve(res);
-            })
-            .catch(function (error) {
-                reject(error);
-            });
-    });
-    return promise;
-};
+Vue.prototype.$md5 = md5

+ 12 - 4
src/router/algorithmsLibrary.js

@@ -7,11 +7,19 @@ export default [{
         component: () => import("@/views/algorithmsLibrary/algorithmsLibraryList")
     },
     {
-        path: "/addAlgorithms",
-        name: "addAlgorithms",
+        path: "/gitAlgorithms",
+        name: "gitAlgorithms",
         meta: {
-            tabname: "新增算法"
+            tabname: "仓库算法"
         },
-        component: () => import("@/views/algorithmsLibrary/addAlgorithms")
+        component: () => import("@/views/algorithmsLibrary/gitAlgorithms")
+    },
+    {
+        path: "/exportAlgorithms",
+        name: "exportAlgorithms",
+        meta: {
+            tabname: "导入算法"
+        },
+        component: () => import("@/views/algorithmsLibrary/exportAlgorithms")
     },
 ]

+ 1 - 1
src/router/filter.js

@@ -10,7 +10,7 @@ Router.prototype.push = function push(location) {
 
 
 router.beforeEach((to, from, next) => {
-    console.log(to);
+    // console.log(to);
     if (to.fullPath === '/' || to.name === '*') {
         next({
             path: "/mainPage",

+ 0 - 220
src/views/algorithmsLibrary/addAlgorithms.vue

@@ -1,220 +0,0 @@
-<template>
-    <div class="addAlgorithmsPanel">
-        <el-row>
-            <el-col :span="16" :offset="4">
-                <el-form
-                    ref="form"
-                    :model="form"
-                    :rules="rules"
-                    label-width="160px"
-                >
-                    
-                        <el-form-item label="算法名称:" prop="name">
-                            <el-input
-                                placeholder="请输入"
-                                maxlength="30"
-                                v-autoTrim="{ obj: form, key: 'name' }"
-                                v-model="form.name"
-                            >
-                            </el-input>
-                        </el-form-item>
-                        <el-form-item label="算法描述:" prop="name">
-                            <el-input
-                                placeholder="请输入"
-                                maxlength="30"
-                                v-autoTrim="{ obj: form, key: 'name' }"
-                                v-model="form.name"
-                            >
-                            </el-input>
-                        </el-form-item>
-                
-
-                    <el-form-item label="上传方式:" prop="type">
-                        <el-radio
-                            v-model="form.type"
-                            label="1"
-                            @change="typeChange"
-                            >文件上传</el-radio
-                        >
-                        <el-radio
-                            v-model="form.type"
-                            label="2"
-                            @change="typeChange"
-                            >仓库地址</el-radio
-                        >
-                    </el-form-item>
-
-                    <el-form-item
-                        label="导入算法:"
-                        prop="sf"
-                        v-show="type === '1'"
-                    >
-                        <el-input
-                            placeholder="请输入"
-                            maxlength="30"
-                            v-autoTrim="{ obj: form, key: 'sf' }"
-                            v-model="form.sf"
-                        >
-                        </el-input>
-                    </el-form-item>
-
-                    <div v-show="type === '2'">
-                        <el-form-item label="地址:" prop="add">
-                            <el-input
-                                placeholder="请输入"
-                                maxlength="30"
-                                v-autoTrim="{ obj: form, key: 'add' }"
-                                v-model="form.add"
-                            >
-                            </el-input>
-                        </el-form-item>
-                        <el-form-item label="用户名:" prop="add1">
-                            <el-input
-                                placeholder="请输入"
-                                maxlength="30"
-                                v-autoTrim="{ obj: form, key: 'add1' }"
-                                v-model="form.add1"
-                            >
-                            </el-input>
-                        </el-form-item>
-                        <el-form-item label="密码:" prop="add2">
-                            <el-input
-                                placeholder="请输入"
-                                maxlength="30"
-                                type="password"
-                                v-autoTrim="{ obj: form, key: 'add2' }"
-                                v-model="form.add2"
-                            >
-                            </el-input>
-                        </el-form-item>
-                        <div class="testLinkPanel">
-                            <el-button type="primary">测试链接</el-button>
-                        </div>
-                    </div>
-                </el-form>
-
-                <div class="btns">
-                    <el-button type="primary">保存</el-button>
-                    <el-button type="primary">取消</el-button>
-                </div>
-            </el-col>
-        </el-row>
-    </div>
-</template>
-
-<script>
-//import  from '';
-
-export default {
-    name: "addAlgorithms", // 新增算法
-    components: {},
-    data() {
-        return {
-            form: {
-                name: "",
-                add: "",
-                add1: "",
-                add2: "",
-                type: "1",
-                sf: "",
-            },
-            type: "1",
-            rules: {
-                sf: [{ required: true, message: "请选择", trigger: "change" }],
-                type: [
-                    { required: true, message: "请选择", trigger: "change" },
-                ],
-                name: [{ required: true, message: "请输入", trigger: "blur" }],
-                add: [{ required: true, message: "请输入", trigger: "blur" }],
-                add1: [{ required: true, message: "请输入", trigger: "blur" }],
-                add2: [{ required: true, message: "请输入", trigger: "blur" }],
-            },
-        };
-    },
-
-    computed: {
-        // type(){
-        // },
-        // rules() {
-        // }
-    },
-
-    methods: {
-        typeChange(val) {
-            if (val === "1") {
-                this.rules = {
-                    name: [
-                        { required: true, message: "请输入", trigger: "blur" },
-                    ],
-                    sf: [
-                        {
-                            required: true,
-                            message: "请选择",
-                            trigger: "change",
-                        },
-                    ],
-                    type: [
-                        {
-                            required: true,
-                            message: "请选择",
-                            trigger: "change",
-                        },
-                    ],
-                };
-            } else {
-                this.rules = {
-                    name: [
-                        { required: true, message: "请输入", trigger: "blur" },
-                    ],
-                    type: [
-                        {
-                            required: true,
-                            message: "请选择",
-                            trigger: "change",
-                        },
-                    ],
-                    add: [
-                        { required: true, message: "请输入", trigger: "blur" },
-                    ],
-                    add1: [
-                        { required: true, message: "请输入", trigger: "blur" },
-                    ],
-                    add2: [
-                        { required: true, message: "请输入", trigger: "blur" },
-                    ],
-                };
-            }
-            this.$nextTick(() => {
-                this.$refs["form"].clearValidate();
-            });
-            this.type = val;
-        },
-    },
-
-    // mounted: {},
-};
-</script>
-
-<style lang='less' scoped>
-.addAlgorithmsPanel {
-    padding: 45px 30px 0;
-
-    .el-form {
-        // padding: 45px 30px;
-
-        /deep/ .el-input,
-        .el-select {
-            width: 100%;
-        }
-    }
-
-    .testLinkPanel {
-        margin-left: 160px;
-    }
-
-    .btns {
-        padding-top: 90px;
-        text-align: center;
-    }
-}
-</style>

+ 167 - 86
src/views/algorithmsLibrary/algorithmsLibraryList.vue

@@ -8,34 +8,37 @@
                     size="small"
                     clearable
                     placeholder="请输入"
+                    maxlength="60"
                 >
                 </el-input>
             </template>
             <template slot="searchItem2">
                 <span class="label">算法名称</span>
                 <el-input
-                    v-model="searchParams.clientOrgName"
+                    v-model="searchParams.algorithmName"
                     size="small"
                     clearable
                     placeholder="请输入"
+                    maxlength="60"
                 >
                 </el-input>
             </template>
             <template slot="searchItem3">
                 <span class="label">算法描述</span>
                 <el-input
-                    v-model="searchParams.clientOrgName"
+                    v-model="searchParams.description"
                     size="small"
                     clearable
                     placeholder="请输入"
+                    maxlength="60"
                 >
                 </el-input>
             </template>
             <template slot="searchItem4">
                 <span class="label">校验状态</span>
-                <el-select v-model="searchParams.status">
+                <el-select v-model="searchParams.validationStatus">
                     <el-option
-                        v-for="item in list"
+                        v-for="item in validationStatusList"
                         :label="item.caption"
                         :value="item.code"
                         :key="item.code"
@@ -43,35 +46,32 @@
                 </el-select>
             </template>
             <template slot="searchBtn1">
-                <el-button type="primary">查询</el-button>
+                <el-button type="primary" @click="doSearch">查询</el-button>
             </template>
             <template slot="searchBtn2">
-                <el-button type="primary">重置</el-button>
+                <el-button type="primary" @click="doReset">重置</el-button>
             </template>
         </search-layout>
 
-        <div class="tabsBox">
-            <toolbarTab
-                :isConnect="true"
-                position="top"
-                :subPageActiveName="subPageActiveName"
-                :toolbarItem="pageBtnList"
-                @toolbarClick="pageControl"
-                class="toolbarTab"
-            >
-            </toolbarTab>
+        <div class="myTabsBox myTabsBoxThreeTabs">
+            <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
+                <el-tab-pane label="公有" name="1"></el-tab-pane>
+                <el-tab-pane label="私有导入" name="2"></el-tab-pane>
+                <el-tab-pane label="私有仓库" name="3" disabled></el-tab-pane>
+            </el-tabs>
             <el-button
+                class="addBtn"
                 icon="el-icon-circle-plus-outline"
-                @click="addConfig"
+                @click="addOne"
                 type="primary"
-                plain
+                :disabled="activeName === '1'"
                 >新增</el-button
             >
         </div>
 
         <tableList
             ref="table"
-            style="border-top: none; margin: 0 30px"
+            style="margin: 0 30px"
             :columns="columns"
             :getDataWay="getDataWay"
             :pagination="pagination"
@@ -79,16 +79,21 @@
             <el-table-column label="操作" slot="cgInfos" align="center">
                 <template v-slot="scope">
                     <i
-                        @click="addMarkDia(scope.row)"
+                        v-if="activeName === '2' || activeName === '3'"
+                        @click="shareRow(scope.row)"
                         class="el-icon-share elIcon"
+                        title="分享"
                     ></i>
                     <i
-                        @click="addMarkDia(scope.row)"
+                        @click="editRow(scope.row)"
                         class="el-icon-edit-outline elIcon"
+                        title="编辑"
                     ></i>
                     <i
-                        @click="addMarkDia(scope.row)"
+                        v-if="activeName === '2' || activeName === '3'"
+                        @click="delOne(scope.row)"
                         class="el-icon-delete elIcon"
+                        title="删除"
                     ></i>
                 </template>
             </el-table-column>
@@ -106,46 +111,16 @@ export default {
     components: { searchLayout, tableList, toolbarTab },
     data() {
         return {
+            activeName: "1",
             searchParams: {
                 //搜索参数
-                id: "", //ID
-                clientOrgName: "", //车辆名称
-                clientOrgName1: "", //配置名称
-                clientOrgName2: "", //配置描述
-                status: "",
+                id: "", // ID
+                algorithmName: "", // 算法名称
+                description: "", // 算法描述
+                validationStatus: "", // 校验状态
+                uploadMode: "", // 私有类型
             },
-            list: [],
-            activitedPageNum: 1,
-            subPageActiveName: 1,
-            pageBtnList: [
-                {
-                    type: "primary",
-                    title: "公有",
-                    key: "all",
-                    fromId: 1,
-                    method: "showAll",
-                    plain: true,
-                    disabled: false,
-                },
-                {
-                    type: "primary",
-                    title: "私有导入",
-                    key: "notRead",
-                    fromId: 2,
-                    method: "showNotRead",
-                    plain: true,
-                    disabled: false,
-                },
-                {
-                    type: "primary",
-                    title: "私有仓库",
-                    key: "notRead1",
-                    fromId: 3,
-                    method: "showNotRead1",
-                    plain: true,
-                    disabled: false,
-                },
-            ],
+            validationStatusList: [],
             columns: [
                 //表格列
                 {
@@ -154,15 +129,15 @@ export default {
                 },
                 {
                     label: "算法名称",
-                    prop: "aid",
+                    prop: "algorithmName",
                 },
                 {
                     label: "算法描述",
-                    prop: "ktName",
+                    prop: "description",
                 },
                 {
                     label: "校验状态",
-                    prop: "jbSource",
+                    prop: "validationStatus",
                 },
                 {
                     label: "操作",
@@ -178,36 +153,142 @@ export default {
                 pageSizes: [10, 30, 50, 100, 200],
                 layout: "sizes, total, prev, pager, next, jumper",
             },
-            getDataWay: {
-                //加载表格数据
-                dataType: "data",
-                type: "post",
-                firstRequest: false,
-                data: [
-                    {
-                        id: 1,
-                        ktName: "kjdhfkjsdhfkjsjhdfksdjhfkhwoieyrhfisdhfksjhdf",
-                        jbSource: "收到就好付款时间的回复可见收到货覅无痕",
-                    },
-                    { id: 2 },
-                    { id: 3 },
-                    { id: 4 },
-                    { id: 15 },
-                    { id: 6 },
-                ],
-                // data: this.$api.scientificStatistics.typeProjectStatistics,
-                param: {},
-            },
         };
     },
+    computed: {
+        getDataWay() {
+            if (this.activeName === "2" || this.activeName === "3") {
+                // 私有
+                return {
+                    //加载表格数据
+                    dataType: "url",
+                    type: "post",
+                    // firstRequest: false,
+                    data: this.$api.algorithmsLibrary.selectAlgorithmList,
+                    param: {},
+                };
+            } else {
+                // 公有
+                return {
+                    //加载表格数据
+                    dataType: "url",
+                    type: "post",
+                    // firstRequest: false,
+                    data: this.$api.algorithmsLibrary.selectSharedAlgorithmList,
+                    param: {},
+                };
+            }
+        },
+    },
     methods: {
+        doSearch() {
+            if (this.activeName === "2") {
+                // 私有导入
+                this.searchParams.uploadMode = "1";
+            } else if (this.activeName === "3") {
+                // 私有仓库
+                this.searchParams.uploadMode = "2";
+            } else {
+                // 公有
+                this.searchParams.uploadMode = "";
+            }
+            this.$nextTick(() => {
+                this.refreshList(this.searchParams);
+            });
+        },
+        //刷新table
+        refreshList(param) {
+            param
+                ? this.$refs["table"].loadData(param)
+                : this.$refs["table"].loadData();
+        },
+        doReset() {
+            this.searchParams = {
+                id: "",
+                algorithmName: "",
+                description: "",
+                validationStatus: "",
+                uploadMode: "",
+            };
+            this.doSearch();
+        },
         pageControl(data) {
-            this.activitedPageNum = data.fromId;
+            this.activeName = data.name;
+            this.doSearch();
+        },
+        addOne() {
+            if (this.activeName === "2") {
+                // 私有导入
+                this.$router.push({ path: "/exportAlgorithms" });
+            } else {
+                // 私有仓库
+                this.$router.push({ path: "/gitAlgorithms" });
+            }
         },
-        addConfig() {
-            this.$router.push({ path: "/addAlgorithms" });
+        editRow(row) {
+            if (row.uploadMode === "1") {
+                // 私有导入
+                this.$router.push({
+                    path: "/exportAlgorithms",
+                    query: { id: row.id, share: row.share },
+                });
+            } else {
+                // 私有仓库
+                this.$router.push({
+                    path: "/gitAlgorithms",
+                    query: { id: row.id, share: row.share },
+                });
+            }
         },
-        addMarkDia() {},
+        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();
+                });
+            });
+        },
+    },
+    async mounted() {
+        await this.$dicsListsInit({
+            validationStatusList: "validationStatus",
+        });
     },
 };
 </script>

+ 190 - 0
src/views/algorithmsLibrary/exportAlgorithms.vue

@@ -0,0 +1,190 @@
+<template>
+    <div class="exportAlgorithmsPanel">
+        <el-row>
+            <el-col :span="16" :offset="4">
+                <el-form
+                    ref="form"
+                    :model="form"
+                    :rules="rules"
+                    label-width="160px"
+                >
+                    <el-form-item label="算法名称:" prop="algorithmName">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="60"
+                            v-autoTrim="{ obj: form, key: 'algorithmName' }"
+                            v-model="form.algorithmName"
+                        >
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="算法描述:" prop="description">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="200"
+                            v-autoTrim="{ obj: form, key: 'description' }"
+                            v-model="form.description"
+                        >
+                        </el-input>
+                    </el-form-item>
+
+                    <el-form-item label="导入算法:" prop="minioPath">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="200"
+                            disabled
+                            v-autoTrim="{ obj: form, key: 'minioPath' }"
+                            v-model="form.minioPath"
+                        >
+                        </el-input>
+                        <upload
+                            class="upload"
+                            ref="upload"
+                            :limit="1"
+                            type="algorithmFile"
+                            @attachmentChange="attachmentChange"
+                        ></upload>
+                    </el-form-item>
+                </el-form>
+
+                <div class="btns">
+                    <el-button
+                        v-if="form.share === '0' || form.share === ''"
+                        type="primary"
+                        @click="save(false)"
+                        >保存</el-button
+                    >
+                    <el-button
+                        v-if="form.share === '0' || form.share === '1'"
+                        type="primary"
+                        @click="save(true)"
+                        >另存为</el-button
+                    >
+                    <el-button type="primary" plain @click="cancel"
+                        >取消</el-button
+                    >
+                </div>
+            </el-col>
+        </el-row>
+    </div>
+</template>
+
+<script>
+import upload from "@/components/upload/upload";
+
+export default {
+    name: "exportAlgorithms", // 导入算法详情
+    components: { upload },
+    data() {
+        return {
+            form: {
+                id: "",
+                algorithmName: "", // 算法名称
+                description: "", // 算法描述
+                uploadMode: "1", // 方式
+                minioPath: "", // 上传文件地址
+                share: "",
+            },
+            rules: {
+                algorithmName: [
+                    { required: true, message: "请输入", trigger: "blur" },
+                ],
+                description: [
+                    { required: true, message: "请输入", trigger: "blur" },
+                ],
+                minioPath: [
+                    { required: true, message: "请上传", trigger: "change" },
+                ],
+            },
+            // attachmentList: [],
+        };
+    },
+
+    methods: {
+        attachmentChange(obj) {
+            // this.attachmentList = obj;
+            console.log(obj);
+            if (obj.length > 0) {
+                this.form.minioPath = obj[0].fileName;
+                this.$refs.form.clearValidate("minioPath");
+            } else {
+                this.form.minioPath = "";
+            }
+        },
+        save(isAdd) {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    if (isAdd) {
+                        this.form.id = "";
+                    }
+
+                    this.$axios({
+                        method: "post",
+                        url: this.$api.algorithmsLibrary.addOrUpdate,
+                        data: {
+                            ...this.form,
+                        },
+                    }).then((res) => {
+                        if (res.code == 200) {
+                            this.$message.success("保存成功");
+                            this.cancel();
+                        } else {
+                            this.$message.error(res.message || "保存失败");
+                        }
+                    });
+                }
+            });
+        },
+        cancel() {
+            this.$router.replace({ path: "/algorithmsLibraryList" });
+        },
+    },
+
+    mounted() {
+        let id = this.$route.query.id;
+        if (id) {
+            this.form.id = id;
+            this.form.share = this.$route.query.share;
+
+            this.$axios({
+                method: "post",
+                url: this.$api.algorithmsLibrary.selectDetailsById,
+                data: {
+                    id,
+                },
+            }).then((res) => {
+                if (res.code == 200 && res.info) {
+                    this.form = res.info;
+                } else {
+                    this.$message.error(res.message || "获取信息失败");
+                }
+            });
+        }
+    },
+};
+</script>
+
+<style lang='less' scoped>
+.exportAlgorithmsPanel {
+    padding: 45px 30px 0;
+
+    .el-form {
+        /deep/ .el-input,
+        .el-select {
+            width: 100%;
+        }
+    }
+
+    .testLinkPanel {
+        margin-left: 160px;
+    }
+
+    .btns {
+        padding-top: 90px;
+        text-align: center;
+    }
+
+    .upload {
+        margin-top: 15px;
+    }
+}
+</style>

+ 177 - 0
src/views/algorithmsLibrary/gitAlgorithms.vue

@@ -0,0 +1,177 @@
+<template>
+    <div class="gitAlgorithmsPanel">
+        <el-row>
+            <el-col :span="16" :offset="4">
+                <el-form
+                    ref="form"
+                    :model="form"
+                    :rules="rules"
+                    label-width="160px"
+                >
+                    <el-form-item label="算法名称:" prop="algorithmName">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="60"
+                            v-autoTrim="{ obj: form, key: 'algorithmName' }"
+                            v-model="form.algorithmName"
+                        >
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="算法描述:" prop="description">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="200"
+                            v-autoTrim="{ obj: form, key: 'description' }"
+                            v-model="form.description"
+                        >
+                        </el-input>
+                    </el-form-item>
+
+                    <el-form-item label="地址:" prop="gitUrl">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="100"
+                            v-autoTrim="{ obj: form, key: 'gitUrl' }"
+                            v-model="form.gitUrl"
+                        >
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="用户名:" prop="add1">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="30"
+                            v-autoTrim="{ obj: form, key: 'add1' }"
+                            v-model="form.add1"
+                        >
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="密码:" prop="add2">
+                        <el-input
+                            placeholder="请输入"
+                            maxlength="30"
+                            type="password"
+                            v-autoTrim="{ obj: form, key: 'add2' }"
+                            v-model="form.add2"
+                        >
+                        </el-input>
+                    </el-form-item>
+                    <div class="testLinkPanel">
+                        <el-button type="primary">测试链接</el-button>
+                    </div>
+                </el-form>
+
+                <div class="btns">
+                    <el-button type="primary">保存</el-button>
+                    <el-button type="primary">取消</el-button>
+                </div>
+            </el-col>
+        </el-row>
+    </div>
+</template>
+
+<script>
+//import  from '';
+
+export default {
+    name: "gitAlgorithms", // 仓库算法详情
+    components: {},
+    data() {
+        return {
+            form: {
+                id: "",
+                algorithmName: "", // 算法名称
+                description: "", // 算法描述
+                gitUrl: "", // 地址
+                gitToken: "", // 算法名称
+                sf: "", // 算法名称
+                uploadMode: "2", // 方式
+            },
+            type: "1",
+            rules: {
+                algorithmName: [{ required: true, message: "请输入", trigger: "blur" }],
+                description: [{ required: true, message: "请输入", trigger: "blur" }],
+                gitUrl: [{ required: true, message: "请输入", trigger: "blur" }],
+                name: [{ required: true, message: "请输入", trigger: "blur" }],
+                name: [{ required: true, message: "请输入", trigger: "blur" }],
+            },
+        };
+    },
+
+    methods: {
+        /* typeChange(val) {
+            if (val === "1") {
+                this.rules = {
+                    name: [
+                        { required: true, message: "请输入", trigger: "blur" },
+                    ],
+                    sf: [
+                        {
+                            required: true,
+                            message: "请选择",
+                            trigger: "change",
+                        },
+                    ],
+                    type: [
+                        {
+                            required: true,
+                            message: "请选择",
+                            trigger: "change",
+                        },
+                    ],
+                };
+            } else {
+                this.rules = {
+                    name: [
+                        { required: true, message: "请输入", trigger: "blur" },
+                    ],
+                    type: [
+                        {
+                            required: true,
+                            message: "请选择",
+                            trigger: "change",
+                        },
+                    ],
+                    add: [
+                        { required: true, message: "请输入", trigger: "blur" },
+                    ],
+                    add1: [
+                        { required: true, message: "请输入", trigger: "blur" },
+                    ],
+                    add2: [
+                        { required: true, message: "请输入", trigger: "blur" },
+                    ],
+                };
+            }
+            this.$nextTick(() => {
+                this.$refs["form"].clearValidate();
+            });
+            this.type = val;
+        }, */
+    },
+
+    // mounted: {},
+};
+</script>
+
+<style lang='less' scoped>
+.gitAlgorithmsPanel {
+    padding: 45px 30px 0;
+
+    .el-form {
+
+        /deep/ .el-input,
+        .el-select {
+            width: 100%;
+        }
+    }
+
+    .testLinkPanel {
+        margin-left: 160px;
+    }
+
+    .btns {
+        padding-top: 90px;
+        text-align: center;
+    }
+}
+</style>

+ 8 - 3
src/views/modelLibrary/components/handleConfigList.vue

@@ -167,7 +167,7 @@
         </div>
 
         <el-dialog
-            v-if="showBtns"
+            v-show="showBtns"
             :title="dialogTitle"
             :visible.sync="dialogVisible"
             width="690px"
@@ -228,13 +228,14 @@ export default {
             isActiveE: false,
             currentType: "", // 当前操作传感器的类型
             dialogTitle: "",
-            sensorNameList: [],
+            sensorNameList: [], // 选择添加传感器的列表
             // titleTexts: ['摄像头','完美传感器','激光雷达','毫米波雷达','GPS'],
             dialogVisible: false,
             form: {
                 sensorName: "",
                 sensorDescription: "",
                 sensorId: "",
+                sensorType: ""
             },
             rules: {
                 sensorId: [
@@ -304,7 +305,11 @@ export default {
                 if (res.code == 200 && res.info) {
                     this.sensorNameList = res.info;
                     this.dialogVisible = true;
-                    this.$refs.form.resetFields();
+                    this.$nextTick(()=>{
+                        this.$refs.form.resetFields();
+                        this.form.sensorName = "";
+                        this.form.sensorType = type;
+                    });
                 } else {
                     this.$message.error(res.message || "获取信息失败");
                 }

+ 11 - 11
src/views/modelLibrary/vehicleConfigurationDetail.vue

@@ -158,12 +158,17 @@
         </div>
         <div class="btns">
             <el-button
+                v-if="form.share === '0' || form.share === ''"
                 type="primary"
                 @click="save(false)"
-                v-if="form.share === '0' || form.share === ''"
                 >保存</el-button
             >
-            <el-button type="primary" @click="save(true)">另存为</el-button>
+            <el-button
+                v-if="form.share === '0' || form.share === '1'"
+                type="primary"
+                @click="save(true)"
+                >另存为</el-button
+            >
             <el-button type="primary" plain @click="cancel">取消</el-button>
         </div>
     </div>
@@ -311,13 +316,12 @@ export default {
             ).description;
         },
         // 验证各传感器数组的每一项表单数据是否齐全
-        validateSensorsList(){
+        validateSensorsList() {
             // console.log(Object.keys(this.configList));
             // console.log(Object.values(this.configList));
             // console.log(Object.entries(this.configList));
 
             let lists = Object.values(this.configList);
-
         },
         save(isAdd) {
             this.$refs.form.validate((valid) => {
@@ -355,14 +359,10 @@ export default {
             if (!this.configList[type]) {
                 this.configList[type] = [];
             }
-            console.log(info);
-            console.log(type);
-            info.sensorType = type;
-            this.configList[type].push(info);
-            console.log(this.configList);
+            //若直接传info即this.form,可能是由于传入了响应式,造成数据会变动
+            this.configList[type].push({ ...info });
         },
         delOne(type, index) {
-            console.log(type, index);
             this.configList[type].splice(index, 1);
         },
         curItem(item) {
@@ -408,7 +408,7 @@ export default {
                     if (res.code == 200 && res.info) {
                         this.form = res.info;
                         this.configList = res.info.configSensors;
-                        this.validateSensorsList()
+                        this.validateSensorsList();
                     } else {
                         this.$message.error(res.message || "获取信息失败");
                     }

+ 1 - 1
src/views/page/pageMenu.vue

@@ -159,7 +159,7 @@ export default {
     created() {
         localStorage.setItem(
             "Authorization",
-            "Bearer 99d5150c-72d0-423d-9245-37d1c5ed410d"
+            "Bearer 4104c3ac-1756-4da4-aa80-d7bfcf8bc035"
         );
         // document.cookie = 'Authorization=Bearer 52de2c22-c2f9-4307-b49d-5b5593792352'
         // console.log(this.$route);

+ 16 - 4
src/views/sceneLibrary/common/util.less

@@ -30,7 +30,9 @@
 }
 
 .labelA {
-    /deep/ .el-checkbox-button__inner, &.labelBox {
+
+    /deep/ .el-checkbox-button__inner,
+    &.labelBox {
         border: 1px solid @greenA;
         color: @greenA;
         border-radius: 4px;
@@ -47,7 +49,9 @@
 }
 
 .labelB {
-    /deep/ .el-checkbox-button__inner, &.labelBox {
+
+    /deep/ .el-checkbox-button__inner,
+    &.labelBox {
         border: 1px solid @orangeA;
         color: @orangeA;
         border-radius: 4px;
@@ -64,7 +68,9 @@
 }
 
 .labelC {
-    /deep/ .el-checkbox-button__inner, &.labelBox {
+
+    /deep/ .el-checkbox-button__inner,
+    &.labelBox {
         border: 1px solid @lightBlueA;
         color: @lightBlueA;
         border-radius: 4px;
@@ -81,7 +87,9 @@
 }
 
 .labelD {
-    /deep/ .el-checkbox-button__inner, &.labelBox {
+
+    /deep/ .el-checkbox-button__inner,
+    &.labelBox {
         border: 1px solid @purpleA;
         color: @purpleA;
         border-radius: 4px;
@@ -104,4 +112,8 @@
     video {
         width: 100%;
     }
+}
+
+.btnsPanel {
+    margin: 45px 40px 15px;
 }

+ 141 - 0
src/views/sceneLibrary/components/fileDialog.vue

@@ -0,0 +1,141 @@
+<template>
+    <div>
+        <el-dialog
+            title="上传文件"
+            :visible.sync="fileVisible"
+            width="540px"
+            :close-on-click-modal="false"
+            :close-on-press-escape="false"
+            :before-close="cancel"
+        >
+            <div>
+                <upload
+                    ref="upload"
+                    :limit="limit"
+                    :type="type"
+                    :objectPath="objectPath"
+                    @attachmentChange="attachmentChange"
+                ></upload>
+            </div>
+            <span slot="footer">
+                <el-button type="primary" @click="upConfirm">确 定</el-button>
+                <el-button @click="cancel">取 消</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import upload from "@/components/upload/upload";
+
+export default {
+    name: "fileDialog", // 文件上传弹窗
+    components: { upload },
+    data() {
+        return {
+            fileVisible: false,
+            attachmentList: [], // 上传文件信息
+        };
+    },
+
+    props: {
+        // 限制上传的个数
+        limit: {
+            type: Number,
+            default: 5,
+        },
+        type: {
+            type: String,
+            default: "1",
+        },
+        api: {
+            type: String,
+            default: "",
+        },
+        // 控制上传文件时,一组数据传的值相同
+        objectPath: {
+            type: String,
+            default: "6",
+        },
+    },
+
+    computed: {},
+
+    methods: {
+        attachmentChange(obj) {
+            this.attachmentList = obj;
+        },
+        dataHandel(data, type) {
+            if (type === "video") {
+                let video = this.attachmentList.find((i) =>
+                    i.fileType.includes("video")
+                );
+                if (!video) {
+                    video = {};
+                }
+                data.videoPreview = video.videoPreview || "";
+                data.videoAddress = video.fileName || "";
+            } else {
+                let item = this.attachmentList.find(
+                    (i) =>
+                        i.fileName.slice(i.fileName.lastIndexOf(".") + 1) ===
+                        type
+                );
+                if (!item) {
+                    item = {};
+                }
+                data[type + "Address"] = item.fileName || "";
+            }
+        },
+        upConfirm() {
+            if (this.attachmentList && this.attachmentList.length != 5) {
+                this.$message.warning("请上传5个对应的文件");
+                return;
+            }
+
+            let data = {};
+
+            this.dataHandel(data, "video");
+            this.dataHandel(data, "json");
+            this.dataHandel(data, "osgb");
+            this.dataHandel(data, "xodr");
+
+            if (this.type === "1") {
+                this.dataHandel(data, "xosc");
+            } else if (this.type === "2" || this.type === "3") {
+                this.dataHandel(data, "xml");
+            }
+
+            this.$axios({
+                method: "post",
+                url: this.api,
+                data,
+            }).then((res) => {
+                if (res.code == 200) {
+                    this.$message.success("保存成功");
+                    this.cancel();
+                } else {
+                    this.$message.error(res.message || "保存失败");
+                }
+            });
+        },
+        cancel() {
+            // 手动清除上传列表及相关存储数据
+            this.$refs.upload.$refs.upload.clearFiles();
+
+            let len = this.attachmentList.length;
+            this.$refs.upload.attachmentList.splice(0, len);
+
+            this.attachmentList = [];
+
+            this.fileVisible = false;
+            this.$emit("fileClose");
+        },
+    },
+
+    // mounted() {},
+};
+</script>
+
+<style lang='less' scoped>
+</style>

+ 0 - 210
src/views/sceneLibrary/components/upload.vue

@@ -1,210 +0,0 @@
-<template>
-    <div class="assign-upload">
-        <upload
-            ref="referUpload"
-            v-show="fileList.length === 0"
-            :downLoadAllParams="{}"
-            :on-up-success="uploadSuccess"
-            :on-up-error="uploadError"
-            :auto-up="true"
-            :down-and-preview="false"
-            :show-file-list="false"
-            :on-up-progress="onProgress"
-            :disabled="!canEdit"
-        >
-        </upload>
-        <div class="assign-upload-show" v-show="fileList.length > 0">
-            <div
-                v-for="(item, index) in fileList"
-                :key="item.attachment"
-                @mouseenter="$set(item, 'onMouse', true)"
-                @mouseleave="$set(item, 'onMouse', false)"
-            >
-                <span
-                    :class="{ 'on-mouse': item.onMouse }"
-                    @click="handleDownload(item)"
-                    class="text-wrap"
-                    >{{ item.fileName }}</span
-                >
-                <el-button
-                    class="del-item"
-                    @click.stop="deleteFile(index)"
-                    v-if="isDeleteShow(fileList, index)"
-                    >×</el-button
-                >
-                <!-- :disabled="isFromApproval" -->
-            </div>
-        </div>
-    </div>
-</template>
-
-<script>
-import upload from "@/components/upload/upload";
-
-export default {
-    name: "assignUpload",
-    components: { upload },
-    props: {
-        //附件
-        fileList: {
-            type: Array,
-            default() {
-                return [];
-            },
-        },
-        rankId: {
-            type: String,
-            default: "",
-        },
-        canEdit: {
-            type: Boolean,
-            default: false,
-        },
-    },
-    data() {
-        return {};
-    },
-    created() {},
-    model: {
-        //自定义v-model
-        prop: "fileList",
-        event: "updateAttachment",
-    },
-    methods: {
-        async uploadSuccess(res, file, fileList) {
-            this.fileList.push({
-                attachment: res.url,
-                fileName: file.name,
-            });
-
-            /* let id = this.rankId;
-
-            if (!id) {
-                //没有的话获取id
-                let result = await this.$asyncAjaxCommon(
-                    this.$api.projectInfoApi.wpsGetBusinessId
-                );
-                if (result.code != "200") {
-                    this.$ajaxError(result.msg);
-                    this.$message.error("文件保存报错");
-                    return;
-                }
-                if (result.info) {
-                    id = result.info;
-                    this.$emit("getBusinessId", id);
-                } else {
-                    this.$message.error("文件保存网络异常");
-                    return;
-                }
-            } */
-
-            this.$axios({
-                method: "post",
-                url: this.$api.scientificStatistics.saveAttachment,
-                data: {
-                    businessId: id,
-                    fileName: file.name,
-                    attachment: res.url,
-                },
-            }).then((res) => {
-                if (res.code === "200") {
-                    this.$message.success(res.msg || "文件保存成功!");
-                    this.$emit("updateAttachment", this.fileList);
-                }
-            });
-        },
-        uploadError(err, file, fileList) {
-            this.$message.error(err);
-        },
-        onProgress() {},
-        /*下载*/
-        handleDownload(item) {
-            let obj = {
-                url: item.attachment ? item.attachment : item.fileMd5,
-                name: item.fileName,
-            };
-            this.$$download(obj)
-                .then(() => {
-                    this.$message({
-                        type: "success",
-                        message: "下载成功!",
-                    });
-                })
-                .catch((err) => {
-                    this.$message({
-                        type: "error",
-                        message: "下载失败!",
-                    });
-                });
-        },
-        /*删除一个文件*/
-        deleteFile(index) {
-            this.$refs.referUpload.handleRemoveSelf(
-                this.fileList[index].attachment
-            );
-            this.$axios({
-                method: "post",
-                url: this.$api.scientificStatistics.deleteAttachment,
-                data: {
-                    id: this.fileList[index].id,
-                },
-            }).then((res) => {
-                if (res.code === "200") {
-                    this.$message.success(res.msg || "删除成功");
-                    this.$delete(this.fileList, index);
-                    this.$emit("updateAttachment", this.fileList);
-                } else {
-                    if (res.msg != "业务异常,请联系管理员") {
-                        this.$message.error(res.msg || "删除失败");
-                    } else {
-                        this.$message.error("删除失败");
-                    }
-                }
-            });
-        },
-        //变更时删除按钮(X)是否显示
-        isDeleteShow(fileList, index) {
-            if (this.canEdit) {
-                return true;
-            } else {
-                return false;
-            }
-        },
-    },
-};
-</script>
-
-<style scoped lang="less">
-// @import "~@/views/assign/styles/assign";
-.assign-upload-show {
-    > div {
-        display: block;
-        > span {
-            color: @themeColor;
-            cursor: pointer;
-            padding: 0 10px;
-            &.on-mouse {
-                & ~ .del-item {
-                    display: inline-block;
-                }
-            }
-            & ~ .del-item {
-                border: none;
-                color: @themeColor;
-                margin-left: 4px;
-                display: none;
-                width: 16px;
-                height: 16px;
-                border-radius: 16px;
-                text-align: center;
-                padding: 0;
-                background: @gray;
-            }
-        }
-    }
-}
-.text-wrap {
-    white-space: normal;
-    word-break: break-all;
-}
-</style>

+ 4 - 4
src/views/sceneLibrary/gradingRulesList.vue

@@ -4,7 +4,7 @@
             <template slot="searchItem1">
                 <span class="label">规则ID</span>
                 <el-input
-                    v-model="searchParams.rulesId"
+                    v-model="searchParams.rulesCode"
                     size="small"
                     clearable
                     placeholder="请输入"
@@ -130,7 +130,7 @@ export default {
             activeName: "1",
             searchParams: {
                 //搜索参数
-                rulesId: "", //规则Id
+                rulesCode: "", //规则Id
                 ruleName: "", //规则名称
                 ruleDescription: "", //规则描述
                 yearMin: "", // 开始时间
@@ -195,7 +195,7 @@ export default {
             }
 
             let pageMap = {
-                rulesId: this.searchParams.rulesId,
+                rulesCode: this.searchParams.rulesCode,
                 ruleName: this.searchParams.ruleName,
                 ruleDescription: this.searchParams.ruleDescription,
                 yearMin: this.searchParams.yearMin,
@@ -212,7 +212,7 @@ export default {
         },
         doReset() {
             this.searchParams = {
-                rulesId: "",
+                rulesCode: "",
                 ruleName: "",
                 ruleDescription: "",
                 yearMin: "",

+ 62 - 15
src/views/sceneLibrary/naturalDrivingScenarioList.vue

@@ -2,6 +2,17 @@
     <div>
         <search-layout :needBox="true">
             <template slot="searchItem1">
+                <span class="label">场景编号</span>
+                <el-input
+                    v-model="searchParams.naturalName"
+                    size="small"
+                    clearable
+                    placeholder="请输入"
+                    maxlength="60"
+                >
+                </el-input>
+            </template>
+            <template slot="searchItem2">
                 <span class="label">道路</span>
                 <el-cascader
                     v-model="searchParams.road"
@@ -10,7 +21,7 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem2">
+            <template slot="searchItem3">
                 <span class="label">基础设施</span>
                 <el-cascader
                     v-model="searchParams.infrastructure"
@@ -19,7 +30,7 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem3">
+            <template slot="searchItem4">
                 <span class="label">交通情况</span>
                 <el-cascader
                     v-model="searchParams.trafficCondition"
@@ -28,7 +39,7 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem4">
+            <template slot="searchItem5">
                 <span class="label">自车行为</span>
                 <el-cascader
                     v-model="searchParams.selfBehavior"
@@ -37,7 +48,7 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem5">
+            <template slot="searchItem6">
                 <span class="label">目标行为</span>
                 <el-cascader
                     v-model="searchParams.targetBehavior"
@@ -46,7 +57,7 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem6">
+            <template slot="searchItem7">
                 <span class="label">自然环境</span>
                 <el-cascader
                     v-model="searchParams.naturalEnvironment"
@@ -55,7 +66,16 @@
                     clearable=""
                 ></el-cascader>
             </template>
-            <template slot="searchItem7">
+            <template slot="searchItem8">
+                <span class="label">临时性操纵</span>
+                <el-cascader
+                    v-model="searchParams.temporaryOperation"
+                    :options="temporaryOperationList"
+                    :props="props"
+                    clearable=""
+                ></el-cascader>
+            </template>
+            <template slot="searchItem9">
                 <el-checkbox-group v-model="searchParams.c">
                     <el-checkbox-button :label="1" :key="1" class="labelA"
                         >绿灯</el-checkbox-button
@@ -86,12 +106,23 @@
         </search-layout>
 
         <div class="btnsPanel">
-            <el-button type="primary" plain icon="el-icon-upload"
+            <el-button
+                type="primary"
+                plain
+                icon="el-icon-upload"
+                @click="openFileDia"
                 >上传文件</el-button
             >
-            <upload :canEdit="true"></upload>
         </div>
 
+        <file-dialog
+            ref="fileDialog"
+            type="1"
+            :objectPath="objectPath"
+            :api="$api.sceneLibrary.saveSceneNatural"
+            @fileClose="fileClose"
+        ></file-dialog>
+
         <tableList
             ref="table"
             style="margin: 0 30px"
@@ -145,15 +176,16 @@
 <script>
 import searchLayout from "@/components/grid/searchLayout";
 import tableList from "@/components/grid/TableList";
-import upload from "./components/upload";
+import fileDialog from "./components/fileDialog";
 
 export default {
     name: "naturalDrivingScenarioList", // 自然驾驶场景
-    components: { searchLayout, tableList, upload },
+    components: { searchLayout, tableList, fileDialog },
     data() {
         return {
             searchParams: {
                 //搜索参数
+                naturalName: "", // 场景编号
                 road: [], // 道路
                 infrastructure: [], // 基础设施
                 trafficCondition: [], // 交通情况
@@ -169,6 +201,7 @@ export default {
             selfBehaviorList: [],
             targetBehaviorList: [],
             naturalEnvironmentList: [],
+            temporaryOperationList: [],
             props: {
                 multiple: true,
                 label: "dictName",
@@ -177,7 +210,7 @@ export default {
             columns: [
                 //表格列
                 {
-                    label: "场景名称",
+                    label: "场景编号",
                     prop: "naturalName",
                 },
                 {
@@ -222,6 +255,7 @@ export default {
             dialogVisible: false,
             autoplay: false,
             videoSrc: "",
+            objectPath: "",
         };
     },
     methods: {
@@ -236,12 +270,14 @@ export default {
         },
         doReset() {
             this.searchParams = {
+                naturalName: "",
                 road: [],
                 infrastructure: [],
                 trafficCondition: [],
                 selfBehavior: [],
                 targetBehavior: [],
                 naturalEnvironment: [],
+                temporaryOperation: [],
             };
             this.doSearch();
         },
@@ -250,11 +286,19 @@ export default {
             this.videoSrc = row.videoPreview;
             this.autoplay = true;
         },
-        diaClose(done){
+        diaClose(done) {
             this.autoplay = false;
             this.videoSrc = "";
             done();
-        }
+        },
+        openFileDia() {
+            this.objectPath = Math.random().toString();
+            this.$refs.fileDialog.fileVisible = true;
+        },
+        fileClose() {
+            this.objectPath = "";
+            this.doSearch();
+        },
     },
 
     async mounted() {
@@ -265,6 +309,7 @@ export default {
             selfBehaviorList: "selfBehavior",
             targetBehaviorList: "targetBehavior",
             naturalEnvironmentList: "naturalEnvironment",
+            temporaryOperationList: "temporaryOperation",
         });
     },
 };
@@ -272,7 +317,9 @@ export default {
 
 <style lang='less' scoped>
 @import "./common/util.less";
-.btnsPanel {
-    margin: 45px 40px 15px;
+.inputBox {
+    .label {
+        min-width: 75px;
+    }
 }
 </style>

+ 12 - 12
src/views/sceneLibrary/scenarioTestPackageManagementList.vue

@@ -4,9 +4,10 @@
             <template slot="searchItem1">
                 <span class="label">指标ID</span>
                 <el-input
-                    v-model="searchParams.packageId"
+                    v-model="searchParams.packageCode"
                     size="small"
                     clearable
+                    maxlength="60"
                     placeholder="请输入"
                 >
                 </el-input>
@@ -17,6 +18,7 @@
                     v-model="searchParams.packageName"
                     size="small"
                     clearable
+                    maxlength="60"
                     placeholder="请输入"
                 >
                 </el-input>
@@ -103,7 +105,7 @@ export default {
         return {
             searchParams: {
                 //搜索参数
-                packageId: "", //指标ID
+                packageCode: "", //指标ID
                 packageName: "", //指标名称
                 yearMin: "", // 开始时间
                 yearMax: "", // 结束时间
@@ -113,7 +115,7 @@ export default {
             columns: [
                 {
                     label: "指标ID",
-                    prop: "packageId",
+                    prop: "packageCode",
                 },
                 {
                     label: "指标名称",
@@ -121,12 +123,14 @@ export default {
                 },
                 {
                     label: "场景数量",
-                    prop: "jbSource",
+                    prop: "sceneNum",
                 },
                 {
                     label: "创建时间",
                     prop: "startDateStr",
-                    width: 120,
+                    formatter(row) {
+                        return row.createTime.slice(0, 10);
+                    },
                 },
                 {
                     label: "操作",
@@ -165,7 +169,7 @@ export default {
             }
 
             let pageMap = {
-                packageId: this.searchParams.packageId,
+                packageCode: this.searchParams.packageCode,
                 packageName: this.searchParams.packageName,
                 yearMin: this.searchParams.yearMin,
                 yearMax: this.searchParams.yearMax,
@@ -181,7 +185,7 @@ export default {
         },
         doReset() {
             this.searchParams = {
-                packageId: "",
+                packageCode: "",
                 packageName: "",
                 yearMin: "",
                 yearMax: "",
@@ -243,11 +247,7 @@ export default {
         editRow(row) {
             this.$router.push({
                 path: "/scenePacketList",
-                query: {
-                    formData: {
-                        packageId: row.packageId,
-                    },
-                },
+                query: { packageId: row.packageId },
             });
         },
     },

+ 5 - 19
src/views/sceneLibrary/scenePacketList.vue

@@ -6,14 +6,7 @@
             >
         </div>
 
-        <tableList
-            ref="table"
-            :columns="columns"
-            :getDataWay="getDataWay"
-            :pagination="pagination"
-            row-key="sublistId"
-            :tree-props="{ children: 'list', hasChildren: 'hasChildren' }"
-        >
+        <tableList ref="table" :columns="columns" :getDataWay="getDataWay">
             <el-table-column label="操作" slot="cgInfos" align="center">
                 <template v-slot="scope">
                     <i
@@ -203,14 +196,6 @@ export default {
                     prop: "remarks",
                 },
             ],
-            pagination: {
-                //分页使用
-                currentPage: 1,
-                pageSize: 10,
-                position: "right",
-                pageSizes: [10, 30, 50, 100, 200],
-                layout: "sizes, total, prev, pager, next, jumper",
-            },
             getDataWay: {
                 //加载表格数据
                 dataType: "data",
@@ -302,12 +287,11 @@ export default {
         scenarioListsConfirm() {
             this.scenarioListsVisible = false;
         },
-        
     },
 
     mounted() {
-        if (this.$route.query.formData) {
-            let packageId = this.$route.query.formData.packageId;
+        if (this.$route.query.packageId) {
+            let packageId = this.$route.query.packageId;
 
             if (packageId) {
                 this.$axios({
@@ -319,6 +303,8 @@ export default {
                 }).then((res) => {
                     if (res.code == 200 && res.info) {
                         this.getDataWay.data = res.info.list;
+                    } else {
+                        this.$message.error(res.message || "获取信息失败");
                     }
                 });
             }

+ 34 - 67
src/views/sceneLibrary/standardRegulationSimulationScenarioList.vue

@@ -64,6 +64,24 @@
             </template>
         </search-layout>
 
+        <div class="btnsPanel">
+            <el-button
+                type="primary"
+                plain
+                icon="el-icon-upload"
+                @click="openFileDia"
+                >上传文件</el-button
+            >
+        </div>
+
+        <file-dialog
+            ref="fileDialog"
+            type="2"
+            :objectPath="objectPath"
+            :api="$api.sceneLibrary.saveStandardsRegulations"
+            @fileClose="fileClose"
+        ></file-dialog>
+
         <tableList
             ref="table"
             style="margin: 30px"
@@ -117,49 +135,11 @@
 <script>
 import searchLayout from "@/components/grid/searchLayout";
 import tableList from "@/components/grid/TableList";
-
-function isObject(obj) {
-    return Object.prototype.toString.call(obj) === "[object Object]";
-}
-
-function getUrlParams(url, param, fileName) {
-    fileName = encodeURIComponent(fileName);
-    const map = [
-        "currentPage",
-        "pageSizes",
-        "pageSize",
-        "position",
-        "layout",
-        "pageNum",
-        "total",
-    ];
-    if (Array.isArray(param)) {
-        return `${url}?ids=${param.toString()}&fileName=${fileName}`;
-    } else {
-        let flag = false;
-        let obj = Object.assign({}, param);
-        obj.fileName = fileName;
-        for (const key in obj) {
-            if (obj[key] && !isObject(obj[key]) && !map.includes(key)) {
-                if (!flag) {
-                    url += "?";
-                    flag = true;
-                }
-                if (Array.isArray(obj[key])) {
-                    obj[key] = obj[key].toString();
-                }
-                url += `${key}=${obj[key]}&`;
-            }
-        }
-        url = url.slice(0, -1);
-        console.log(url);
-        return url;
-    }
-}
+import fileDialog from "./components/fileDialog";
 
 export default {
     name: "standardRegulationSimulationScenarioList", // 标准法规仿真场景
-    components: { searchLayout, tableList },
+    components: { searchLayout, tableList, fileDialog },
     data() {
         return {
             searchParams: {
@@ -214,7 +194,8 @@ export default {
             },
             dialogVisible: false,
             autoplay: false,
-            videoSrc: ""
+            videoSrc: "",
+            objectPath: "",
         };
     },
     methods: {
@@ -231,47 +212,33 @@ export default {
             this.searchParams = {
                 sceneName: "",
                 regulationType: [],
-                standardType: ""
+                standardType: "",
             };
             this.doSearch();
         },
         viewRow(row) {
-            // this.dialogVisible = true;
-
-            /* this.$axios({
-                method: "post",
-                url: '/simulation/resource/common/minio/download',
-                data: {
-                    objectName: "simulation.mp4"
-                },
-            }).then((res) => {
-                console.log(res);
-            }); */
-
-            /* window.open(
-                getUrlParams(
-                    this.$api.sceneLibrary.download,
-                    // {objectName:row.videoAddress },
-                    { objectName: "simulation.mp4" },
-                    // row.videoAddress
-                    "simulation.mp4"
-                ),
-                "_self"
-            ); */
             this.dialogVisible = true;
             this.videoSrc = row.videoPreview;
             this.autoplay = true;
         },
-        diaClose(done){
+        diaClose(done) {
             this.autoplay = false;
             this.videoSrc = "";
             done();
-        }
+        },
+        openFileDia() {
+            this.objectPath = Math.random().toString();
+            this.$refs.fileDialog.fileVisible = true;
+        },
+        fileClose() {
+            this.objectPath = "";
+            this.doSearch();
+        },
     },
 
     async mounted() {
         await this.$dicsListsInit({
-            regulationTypeList: 'regulationType',
+            regulationTypeList: "regulationType",
         });
     },
 };

+ 29 - 1
src/views/sceneLibrary/trafficAccidentSimulationScenarioList.vue

@@ -97,6 +97,24 @@
             </template>
         </search-layout>
 
+        <div class="btnsPanel">
+            <el-button
+                type="primary"
+                plain
+                icon="el-icon-upload"
+                @click="openFileDia"
+                >上传文件</el-button
+            >
+        </div>
+
+        <file-dialog
+            ref="fileDialog"
+            type="3"
+            :objectPath="objectPath"
+            :api="$api.sceneLibrary.saveSceneAccident"
+            @fileClose="fileClose"
+        ></file-dialog>
+
         <tableList
             ref="table"
             style="border-top: none; margin: 30px"
@@ -150,10 +168,11 @@
 <script>
 import searchLayout from "@/components/grid/searchLayout";
 import tableList from "@/components/grid/TableList";
+import fileDialog from "./components/fileDialog";
 
 export default {
     name: "trafficAccidentSimulationScenarioList", // 交通事故仿真场景
-    components: { searchLayout, tableList },
+    components: { searchLayout, tableList, fileDialog },
     data() {
         return {
             searchParams: {
@@ -227,6 +246,7 @@ export default {
             dialogVisible: false,
             autoplay: false,
             videoSrc: "",
+            objectPath: "",
         };
     },
     methods: {
@@ -260,6 +280,14 @@ export default {
             this.videoSrc = "";
             done();
         },
+        openFileDia() {
+            this.objectPath = Math.random().toString();
+            this.$refs.fileDialog.fileVisible = true;
+        },
+        fileClose() {
+            this.objectPath = "";
+            this.doSearch();
+        },
     },
 
     async mounted() {

+ 3 - 2
vue.config.js

@@ -89,9 +89,10 @@ module.exports = {
                 }
             },
             '/simulation/resource/server': {
-                // target: 'http://10.15.12.73:7003',  // 王志强
+                target: 'http://10.15.12.73:7003',  // 王志强
                 // target: 'http://10.15.12.88:7003',  // 王耀栋
-                target: 'http://10.15.12.72:7003',  // 王晓峰
+                // target: 'http://10.15.12.72:7003',  // 王晓峰
+                // target: 'http://10.15.12.87:7003',  // 赵艳
                 changeOrigin: true,
                 secure: false, // 如果是https接口,需要配置这个参数
                 pathRewrite: {

部分文件因为文件数量过多而无法显示