Browse Source

Merge pull request 'denglei' (#96) from openioctopus/octopus:denglei into master

Reviewed-on: #96
release-v4.0.1
liwei03 1 month ago
parent
commit
16892cccf4
31 changed files with 1119 additions and 987 deletions
  1. +25
    -11
      admin-portal/.eslintrc.js
  2. +4
    -1
      admin-portal/src/api/imageManager.js
  3. +126
    -50
      admin-portal/src/components/upload/index.vue
  4. +1
    -1
      admin-portal/src/store/getters.js
  5. +3
    -6
      admin-portal/src/store/modules/user.js
  6. +4
    -1
      admin-portal/src/utils/minIO.js
  7. +1
    -9
      admin-portal/src/utils/requestMinIO.js
  8. +158
    -169
      admin-portal/src/views/dataManager/components/versionList.vue
  9. +2
    -1
      admin-portal/src/views/devManager/components/algorithm/preAlgorithmVersionCreation.vue
  10. +4
    -4
      admin-portal/src/views/devManager/components/algorithm/reuploadAlgorithm.vue
  11. +219
    -232
      admin-portal/src/views/devManager/components/algorithm/versionList.vue
  12. +20
    -3
      admin-portal/src/views/imageManager/Image.vue
  13. +5
    -9
      admin-portal/src/views/modelManager/components/previewDialog.vue
  14. +42
    -38
      admin-portal/src/views/modelManager/components/versionList.vue
  15. +19
    -1
      openai-portal/.eslintrc.js
  16. +4
    -2
      openai-portal/src/api/imageManager.js
  17. +118
    -58
      openai-portal/src/components/upload/index.vue
  18. +0
    -3
      openai-portal/src/store/modules/user.js
  19. +4
    -1
      openai-portal/src/utils/minIO.js
  20. +2
    -5
      openai-portal/src/utils/requestMinIO.js
  21. +226
    -247
      openai-portal/src/views/dataManager/components/versionList.vue
  22. +1
    -1
      openai-portal/src/views/dataManager/index.vue
  23. +34
    -21
      openai-portal/src/views/imageManager/Image.vue
  24. +1
    -1
      openai-portal/src/views/imageManager/index.vue
  25. +1
    -1
      openai-portal/src/views/modelDev/algorithmManager.vue
  26. +4
    -4
      openai-portal/src/views/modelDev/components/algorithm/reuploadAlgorithm.vue
  27. +87
    -103
      openai-portal/src/views/modelDev/components/algorithm/versionList.vue
  28. +1
    -1
      openai-portal/src/views/modelDev/components/notebook/notebookList.vue
  29. +1
    -1
      openai-portal/src/views/modelDev/notebook.vue
  30. +1
    -1
      openai-portal/src/views/modelManager/index.vue
  31. +1
    -1
      openai-portal/src/views/trainingManager/index.vue

+ 25
- 11
admin-portal/.eslintrc.js View File

@@ -24,6 +24,22 @@ module.exports = {
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/html-self-closing": ["error", {
"html": {
"void": "never",
"normal": "any",
"component": "always"
},
"svg": "always",
"math": "always"
}],
// "vue/name-property-casing": ["off", "PascalCase"],
// 'vue/attribute-hyphenation': 0,
// "vue/require-default-prop": 0,
// "vue/prop-name-casing": 0,
// "vue/this-in-template": 0,
// "vue/require-prop-type-constructor": 0,
// "vue/no-dupe-keys":0,
"vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
@@ -46,16 +62,16 @@ module.exports = {
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
// 'eqeqeq': ["error", "always", {"null": "ignore"}],
'eqeqeq': ["off", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
// "indent": [1, 4],
"vue/html-indent":['off',4],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
@@ -80,7 +96,8 @@ module.exports = {
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
// 'no-dupe-keys': 2,
'no-dupe-keys': 0,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
@@ -162,11 +179,8 @@ module.exports = {
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],

'semi-spacing': [2, {
'before': false,
'after': true


+ 4
- 1
admin-portal/src/api/imageManager.js View File

@@ -47,7 +47,10 @@ export function uploadMiniIO(params) {
return requestMinIO({
url: params.uploadUrl,
method: 'put',
data: params.file
data: params.file,
onUploadProgress: function(progress) {
sessionStorage.setItem(JSON.stringify(params.id), JSON.stringify(parseInt(((progress.loaded / progress.total) * 100))));
}
})
}
// 完成镜像上传


+ 126
- 50
admin-portal/src/components/upload/index.vue View File

@@ -1,24 +1,18 @@
<template>
<div>
<el-upload
v-if="showUpload"
class="upload-demo"
action="#"
:on-change="upload"
:file-list="fileList"
:http-request="httpRequest"
multiple
:accept="accept"
>
<el-button size="small" type="primary" :disabled="loadingShow" :loading="loadingShow">点击上传</el-button>
<el-upload v-if="showUpload" class="upload-demo" action="#" :on-change="upload" :file-list="fileList"
:http-request="httpRequest" multiple :accept="accept" :disabled="show||progress>0&&progress<100">
<el-button size="small" type="primary" :disabled="show||progress>0&&progress<100">点击上传
</el-button>
<div class="tipText">{{ tipText }}</div>
</el-upload>
<el-button v-if="!showUpload" :loading="loadingShow" size="small" type="primary">上传中</el-button>
<el-progress v-if="(progress!='0'||!showUpload)&&(progress!='100'||!showUpload)" :text-inside="true" :stroke-width="18" :percentage="progress" class="progress" />
<div v-if="show" slot="footer" class="dialog-footer">
<el-progress :text-inside="true" :stroke-width="18" :percentage="progress" class="progress"
v-if="progress>0&&progress<100" />
<!-- <div v-if="show" slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
</div>
</div> -->
</div>
</template>
<script>
@@ -46,32 +40,56 @@
loadingShow: false,
showUpload: true,
accept: "application/zip",
tipText: '上传文件格式为 zip'
tipText: '上传文件格式为 zip',
progress: undefined,
timer: undefined
}
},
computed: {
...mapGetters([
'progress'
'progressId',
])
},
watch: {
showUpload() {
store.commit('user/CLEAR_PROGRESS')
}
},
created() {
this.timer = setInterval(() => {
if (this.showProgress()) {
if (parseInt(sessionStorage.getItem(JSON.stringify(store.state.user.progressId)))) {
this.progress = parseInt(sessionStorage.getItem(JSON.stringify(store.state.user.progressId)))
}
}
}, 100)
if (this.uploadData.type === "imageManager") {
this.accept = "application/zip,.tar"
this.tipText = '上传文件格式为 zip 或 tar'
}
},
destory() {
clearInterval(this.timer)
},
watch: {
progress(a, b) {
if (a == 100) {
this.show = true
this.loadingShow = false
}
if (0 < a < 100) {
this.loadingShow = true
}
}
},
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
},
beforeUpload() {
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0);
},
upload(file, fileList) {
// if (this.uploadData.type = "镜像模块") {
if (file) { this.fileList = [file] }
if (file) {
this.fileList = [file]
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0);
}
// }
},
httpRequest() {
@@ -80,18 +98,22 @@
if (this.uploadData.type === "imageManager") {
this.loadingShow = true
this.showUpload = false
this.show = false
if (fileForm === 'zip' || fileForm === 'tar') {
uploadPreImage({ id: this.uploadData.data.id, fileName: this.fileList[0].name, domain: this.GLOBAL.DOMAIN }).then(response => {
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.data.id
}
uploadMiniIO(param).then(response => {
if (response.success) {
this.$nextTick(() => {
this.loadingShow = false
this.show = true
this.showUpload = true
}
this.show = true
this.showUpload = true
this.confirm()
})

})
})
} else {
@@ -109,17 +131,32 @@
this.showUpload = false
if (fileForm === 'zip') {
uploadModel({ modelId: this.uploadData.data.modelId, version: this.uploadData.data.version, fileName: this.fileList[0].name, domain: this.GLOBAL.DOMAIN }).then(response => {
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
}
uploadMiniIO(param).then(response => {
if (response.success) {
this.show = true
this.loadingShow = false
this.showUpload = true
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.data.modelId + this.uploadData.data.version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw,
id: this.uploadData.data.modelId + this.uploadData.data.version
}
})
uploadMiniIO(param).then(response => {
if (response.success) {
this.show = true
this.loadingShow = false
this.showUpload = true
this.confirm()
}
})
}
else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
this.loadingShow = false
this.showUpload = true
this.fileList = []
}

})
} else {
this.loadingShow = false
@@ -143,14 +180,17 @@
uploadPreDataset(param).then(response => {
if (response.success) {
// let uploadUrl = response.data.uploadUrl.replace("octopus-dev-minio:9000","192.168.202.73")
store.commit('user/SET_PROGRESSID', this.uploadData.id + this.uploadData.version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.id + this.uploadData.version
}
minIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.confirm()
})
} else {
this.$message({
@@ -184,14 +224,17 @@
if (fileForm === 'zip') {
uploadNewVersion(param).then(response => {
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.id + this.uploadData.version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.datasetId + this.uploadData.version
}
minIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.confirm()
})
} else {
this.$message({
@@ -224,9 +267,11 @@
if (fileForm === 'zip') {
uploadPreAlgorithm(param).then(response => {
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.algorithmId + this.uploadData.version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.algorithmId + this.uploadData.version
}
minIO(param).then(response => {
this.loadingShow = false
@@ -263,10 +308,12 @@
}
if (fileForm === 'zip') {
uploadPreAlgorithm(param).then(response => {
store.commit('user/SET_PROGRESSID', this.uploadData.algorithmId + this.uploadData.version)
if (response.success) {
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.algorithmId + this.uploadData.version
}
minIO(param).then(response => {
this.loadingShow = false
@@ -284,8 +331,8 @@
this.fileList = []
}
})
} else {
this.loadingShow = false
} else {
this.loadingShow = false
this.showUpload = true
this.fileList = []
this.$message({
@@ -300,10 +347,11 @@
finishUpload({ id: this.uploadData.data.id }).then(response => {
if (response.success) {
this.$message({
message: '创建成功',
message: '上传成功',
type: 'success'
});
this.$emit('confirm', false)
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0),
this.$emit('confirm', false)
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
@@ -408,8 +456,29 @@
message: '已中断取消操作'
});
})
},
// 显示进度条
showProgress() {
if (store.state.user.progressId) {
if (store.state.user.progressId == this.uploadData.data.id) {
return true
}
if (store.state.user.progressId == this.uploadData.id + this.uploadData.version) {
return true
}
if (store.state.user.progressId == this.uploadData.algorithmId + this.uploadData.version) {
return true
}
if (store.state.user.progressId == this.uploadData.data.modelId + this.uploadData.data.version) {
return true
}
else { return false }
}
else { return false }

}


}
}
</script>
@@ -417,11 +486,18 @@
.dialog-footer {
text-align: right;
}

.tipText {
float:right;
margin-left:10px;
font-size:12px
float: right;
margin-left: 10px;
font-size: 12px
}

.progress {
margin: 5px 0px 10px 0px;
}

.dialog-footer {
margin-top: 10px;
}
.progress{margin: 5px 0px 10px 0px;}
.dialog-footer{margin-top: 10px;}
</style>

+ 1
- 1
admin-portal/src/store/getters.js View File

@@ -4,6 +4,6 @@ const getters = {
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
progress: state => state.user.progress
progressId: state => state.user.progressId
}
export default getters

+ 3
- 6
admin-portal/src/store/modules/user.js View File

@@ -6,7 +6,7 @@ const getDefaultState = () => {
token: getToken(),
name: '',
avatar: '',
progress: 0
progressId: undefined
}
}

@@ -19,11 +19,8 @@ const mutations = {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_PROGRESS: (state, progress) => {
state.progress = progress
},
CLEAR_PROGRESS: (state, progress) => {
state.progress = 0
SET_PROGRESSID: (state, progressId) => {
state.progressId = progressId
}
// SET_NAME: (state, name) => {
// state.name = name


+ 4
- 1
admin-portal/src/utils/minIO.js View File

@@ -3,7 +3,10 @@ export async function minIO(payload) {
const res = await requestMinIO({
url: payload.uploadUrl,
method: "put",
data: payload.file
data: payload.file,
onUploadProgress: function(progress) {
sessionStorage.setItem(JSON.stringify(payload.id), JSON.stringify(parseInt(((progress.loaded / progress.total) * 100))));
}
})
if (res && res.success) {
return res


+ 1
- 9
admin-portal/src/utils/requestMinIO.js View File

@@ -3,13 +3,7 @@ import { Message } from 'element-ui'
import store from '@/store'
// create an axios instance
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
// timeout: 5000 // request timeout
onUploadProgress: function(progress) {
// 处理上传进度事件
store.commit('user/SET_PROGRESS', parseInt(((progress.loaded / progress.total) * 100).toFixed(0)))
}
baseURL: process.env.VUE_APP_BASE_API
})

// request interceptor
@@ -27,7 +21,6 @@ service.interceptors.request.use(
return config
},
error => {
store.commit('user/CLEAR_PROGRESS')
// do something with request error
console.log(error) // for debug
return Promise.reject(error)
@@ -86,7 +79,6 @@ service.interceptors.response.use(
// }
},
error => {
store.commit('user/CLEAR_PROGRESS')
console.log('err' + error) // for debug
Message({
message: error.message,


+ 158
- 169
admin-portal/src/views/dataManager/components/versionList.vue View File

@@ -1,19 +1,9 @@
<template>
<div>
<el-dialog
:title="title"
width="70%"
:visible.sync="versionListVisible"
:before-close="handleDialogClose"
:close-on-click-modal="false"
>
<el-table
v-loading.fullscreen.lock="loading"
label-width="100px"
:data="versionList"
style="width: 100%"
height="350"
>
<el-dialog :title="title" width="70%" :visible.sync="versionListVisible" :before-close="handleDialogClose"
:close-on-click-modal="false">
<el-table v-loading.fullscreen.lock="loading" label-width="100px" :data="versionList" style="width: 100%"
height="350">
<el-table-column label="版本号" props="version">
<template slot-scope="scope">
<span>{{ scope.row.version }}</span>
@@ -29,161 +19,160 @@
<span>{{ parseTime(scope.row.createdAt) }}</span>
</template>
</el-table-column>
<el-table-column label="数据集状态" props="status">
<el-table-column label="数据集状态" props="status">
<template slot-scope="scope">
<span>{{ getDatasetStatus(scope.row.status) }}</span>
</template>
</el-table-column>
<el-table-column label="上传进度" v-if="versionListType===2">
<template slot-scope="scope">
<span v-if="scope.row.progress&&scope.row.progress!=0" style="color:#409EFF">{{
scope.row.progress+'%' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" props="action">
<template slot-scope="scope">
<el-button
v-if="(scope.row.status === 1 ) || (scope.row.status === 4 ) ? true : false"
v-show="versionListType === 1 ? false : true"
type="text"
@click="reupload(scope.row)"
>
<el-button v-if="(scope.row.status === 1 ) || (scope.row.status === 4 ) ? true : false"
v-show="versionListType === 1 ? false : true" type="text" @click="reupload(scope.row)">
重新上传
</el-button>
<el-button
type="text"
style="padding-right:10px"
:disabled="scope.row.status === 3 ? false : true"
@click="handlePreview(scope.row)"
>
<el-button type="text" style="padding-right:10px" :disabled="scope.row.status === 3 ? false : true"
@click="handlePreview(scope.row)">
预览
</el-button>
<el-button
v-if="versionListType === 1 ? false : true"
slot="reference"
type="text"
@click="confirmDelete(scope.row)"
>
<el-button v-if="versionListType === 1 ? false : true" slot="reference" type="text"
@click="confirmDelete(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 80]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
<div slot="footer">
</div>
<el-pagination :current-page="pageIndex" :page-sizes="[10, 20, 50, 80]" :page-size="pageSize" :total="total"
layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
</div>
<div slot="footer">
</div>
</el-dialog>
<preview v-if="preVisible" :row="versionData" @close="close" />
<reuploadDataset
v-if="myDatasetVisible"
:data="data"
:version-data="versionData"
@close="close"
@cancel="cancel"
@confirm="confirm"
/>
<reuploadDataset v-if="myDatasetVisible" :data="data" :version-data="versionData" @close="close" @cancel="cancel"
@confirm="confirm" />
</div>
</template>

<script>
import { getVersionList, deleteDatasetVersion } from "@/api/dataManager"
import { parseTime } from '@/utils/index'
import preview from './preview.vue'
import reuploadDataset from "./reuploadDataset.vue"
import { getErrorMsg } from '@/error/index'
export default {
name: "VersionList",
components: {
preview,
reuploadDataset
},
props: {
versionListType: { type: Number, default: undefined },
data: {
type: Object,
default: () => {}
}
},
data() {
return {
title: '版本列表/' + this.data.name,
versionListVisible: true,
myDatasetVisible: false,
preVisible: false,
versionData: undefined,
loading: false,
pageIndex: 1,
pageSize: 20,
total: undefined,
versionList: []
}
},
created() {
this.getVersionList();
},
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
import { getVersionList, deleteDatasetVersion } from "@/api/dataManager"
import { parseTime } from '@/utils/index'
import preview from './preview.vue'
import reuploadDataset from "./reuploadDataset.vue"
import { getErrorMsg } from '@/error/index'
import store from '@/store'
export default {
name: "VersionList",
components: {
preview,
reuploadDataset
},
reupload(row) {
this.myDatasetVisible = true
this.versionData = row
props: {
versionListType: { type: Number, default: undefined },
data: {
type: Object,
default: () => { }
}
},
handlePreview(row) {
this.preVisible = true
this.versionData = row
data() {
return {
title: '版本列表/' + this.data.name,
versionListVisible: true,
myDatasetVisible: false,
preVisible: false,
versionData: undefined,
loading: false,
pageIndex: 1,
pageSize: 20,
total: undefined,
versionList: [],
timer: null
}
},
handleSizeChange(val) {
this.pageSize = val
this.getVersionList()
created() {
this.timer = setInterval(() => { this.getVersionList() }, 1000)

},
handleCurrentChange(val) {
this.pageIndex = val
this.getVersionList()
destroyed() {
clearInterval(this.timer)
this.timer = null
},
getVersionList(param) {
if (!param) {
param = { pageIndex: this.pageIndex, pageSize: this.pageSize }
}
param.id = this.data.id
getVersionList(param).then(response => {
if (response.success) {
this.versionList = response.data.versions;
this.total = response.data.totalSize
} else {
destroyed() {
clearInterval(this.timer)
},
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
},
reupload(row) {
this.myDatasetVisible = true
this.versionData = row,
store.commit('user/SET_PROGRESSID', row.datasetId + row.version)
},
handlePreview(row) {
this.preVisible = true
this.versionData = row
},
handleSizeChange(val) {
this.pageSize = val
this.getVersionList()
},
handleCurrentChange(val) {
this.pageIndex = val
this.getVersionList()
},
getVersionList(param) {
if (!param) {
param = { pageIndex: this.pageIndex, pageSize: this.pageSize }
}
param.id = this.data.id
getVersionList(param).then(response => {
if (response.success) {
this.versionList = response.data.versions;
this.versionList.forEach(item => {
if (sessionStorage.getItem(JSON.stringify(item.datasetId + item.version))) {
item.progress = sessionStorage.getItem(JSON.stringify(item.datasetId + item.version))
}

})
this.total = response.data.totalSize
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
});
},
confirmDelete(row) {
this.$confirm('是否删除此版本数据集?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.handleDelete(row)
}).catch(() => {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
type: 'info',
message: '已取消'
});
}
});
},
confirmDelete(row) {
this.$confirm('是否删除此版本数据集?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.handleDelete(row)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
handleDelete(row) {
this.loading = true
deleteDatasetVersion(row).then(response => {
if (response.success) {
this.$message.success("删除成功");
this.loading = false
this.getVersionList()
},
handleDelete(row) {
this.loading = true
deleteDatasetVersion(row).then(response => {
if (response.success) {
this.$message.success("删除成功");
this.loading = false
this.getVersionList()
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
@@ -191,37 +180,37 @@ export default {
});
this.loading = false
}
})
},
getDatasetStatus(value) {
switch (value) {
case 1:
return "等待解压中"
case 2:
return "解压中"
case 3:
return "解压完成"
case 4:
return "解压失败"
})
},
getDatasetStatus(value) {
switch (value) {
case 1:
return "等待解压中"
case 2:
return "解压中"
case 3:
return "解压完成"
case 4:
return "解压失败"
}
},
handleDialogClose() {
this.$emit("close", false);
},
close(val) {
this.preVisible = val
this.myDatasetVisible = val
},
cancel(val) {
this.myDatasetVisible = val
},
confirm(val) {
this.myDatasetVisible = val
},
// 时间戳转换日期
parseTime(val) {
return parseTime(val)
}
},
handleDialogClose() {
this.$emit("close", false);
},
close(val) {
this.preVisible = val
this.myDatasetVisible = val
},
cancel(val) {
this.myDatasetVisible = val
},
confirm(val) {
this.myDatasetVisible = val
},
// 时间戳转换日期
parseTime(val) {
return parseTime(val)
}
}
}
</script>

+ 2
- 1
admin-portal/src/views/devManager/components/algorithm/preAlgorithmVersionCreation.vue View File

@@ -50,7 +50,7 @@ export default {
default: () => {}
},
dialogType: {
type: String,
type: Boolean,
default: ""
}
},
@@ -80,6 +80,7 @@ export default {
},
created() {
this.ruleForm.name = this.row.algorithmName
},
methods: {
getErrorMsg(code) {


+ 4
- 4
admin-portal/src/views/devManager/components/algorithm/reuploadAlgorithm.vue View File

@@ -38,7 +38,7 @@ export default {
upload
},
props: {
data: {
reuploadData: {
type: Object,
default: () => {}
}
@@ -64,10 +64,10 @@ export default {
};
},
created() {
const { algorithmName, algorithmDescript, modelName } = this.data
const { algorithmName, algorithmDescript, modelName } = this.reuploadData
this.ruleForm = { algorithmName, algorithmDescript, modelName }
this.uploadData.algorithmId = this.data.algorithmId
this.uploadData.version = this.data.algorithmVersion
this.uploadData.algorithmId = this.reuploadData.algorithmId
this.uploadData.version = this.reuploadData.algorithmVersion
this.uploadData.type = "newPreAlgorithm"
},
methods: {


+ 219
- 232
admin-portal/src/views/devManager/components/algorithm/versionList.vue View File

@@ -1,18 +1,8 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
:title="title"
width="70%"
:visible.sync="versionListVisible"
:before-close="handleDialogClose"
>
<el-table
v-loading="loading"
:data="versionList"
style="width: 100%"
height="350"
>
<el-dialog :close-on-click-modal="false" :title="title" width="70%" :visible.sync="versionListVisible"
:before-close="handleDialogClose">
<el-table v-loading="loading" :data="versionList" style="width: 100%" height="350">
<el-table-column label="算法名称">
<template slot-scope="scope">
<span>{{ scope.row.algorithmName }}</span>
@@ -38,263 +28,260 @@
<span>{{ getAlgorithmStatus(scope.row.fileStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="上传进度" v-if="algorithmType === 2">
<template slot-scope="scope">
<span v-if="scope.row.progress&&scope.row.progress!=0" style="color:#409EFF">{{
scope.row.progress+'%' }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<!-- <el-button type="text" style="padding-right:10px">预览</el-button> -->
<el-button
v-if="(scope.row.fileStatus === 1 ) || (scope.row.fileStatus === 4 ) ? true : false"
v-show="algorithmType === 2 ? true : false"
type="text"
@click="reupload(scope.row)"
>
<el-button v-if="(scope.row.fileStatus === 1 ) || (scope.row.fileStatus === 4 ) ? true : false"
v-show="algorithmType === 2 ? true : false" type="text" @click="reupload(scope.row)">
重新上传
</el-button>
<el-button
slot="reference"
type="text"
:disabled="scope.row.fileStatus === 3 ? false : true"
@click="confirmDownload(scope.row)"
>
<el-button slot="reference" type="text" :disabled="scope.row.fileStatus === 3 ? false : true"
@click="confirmDownload(scope.row)">
下载
</el-button>
<el-button
v-if="algorithmType === 2 ? true : false"
slot="reference"
type="text"
@click="confirmDelete(scope.row)"
>
<el-button v-if="algorithmType === 2 ? true : false" slot="reference" type="text"
@click="confirmDelete(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 80]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
<div slot="footer">
</div>
<el-pagination :current-page="pageIndex" :page-sizes="[10, 20, 50, 80]" :page-size="pageSize" :total="total"
layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
</div>
<div slot="footer">
</div>
</el-dialog>
<reuploadAlgorithm
v-if="myAlgorithmVisible"
:data="row"
@close="close"
@cancel="cancel"
@confirm="confirm"
/>
<reuploadAlgorithm v-if="myAlgorithmVisible" :reupload-data="reuploadData" @close="close" @cancel="cancel" @confirm="confirm" />
</div>
</template>

<script>
import { getAlgorithmVersionList, queryAlgorithmVersion, compressAlgorithm, downloadAlgorithmVersion, deletePreAlgorithmVersion } from "@/api/modelDev";
import { parseTime } from '@/utils/index'
import reuploadAlgorithm from "./reuploadAlgorithm.vue"
import { getErrorMsg } from '@/error/index'
export default {
name: "VersionList",
components: {
reuploadAlgorithm
},
props: {
payload: { type: Object, default: () => {} },
algorithmType: { type: Number, default: undefined },
row: {
type: Object,
default: () => {}
}
},
data() {
return {
title: '版本列表/' + this.row.algorithmName,
versionListVisible: true,
myAlgorithmVisible: false,
loading: false,
pageIndex: 1,
pageSize: 20,
total: undefined,
versionList: []
}
},
created() {
this.getVersionList();
},
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
},
reupload(row) {
this.myAlgorithmVisible = true
import { getAlgorithmVersionList, queryAlgorithmVersion, compressAlgorithm, downloadAlgorithmVersion, deletePreAlgorithmVersion } from "@/api/modelDev";
import { parseTime } from '@/utils/index'
import reuploadAlgorithm from "./reuploadAlgorithm.vue"
import { getErrorMsg } from '@/error/index'
import store from '@/store'
export default {
name: "VersionList",
components: {
reuploadAlgorithm
},
handleSizeChange(val) {
this.pageSize = val
this.getVersionList()
},
handleCurrentChange(val) {
this.pageIndex = val
this.getVersionList()
props: {
payload: { type: Object, default: () => { } },
algorithmType: { type: Number, default: undefined },
row: {
type: Object,
default: () => { }
}
},
getVersionList(param) {
this.typeChange = this.algorithmType
if (!param) {
param = { pageIndex: this.pageIndex, pageSize: this.pageSize }
data() {
return {
title: '版本列表/' + this.row.algorithmName,
versionListVisible: true,
myAlgorithmVisible: false,
loading: false,
pageIndex: 1,
pageSize: 20,
total: undefined,
versionList: [],
reuploadData: {}
}
param.algorithmId = this.row.algorithmId
getAlgorithmVersionList(param).then(response => {
if (response.success) {
this.versionList = response.data.algorithms
this.total = response.data.totalSize
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
},
handleDialogClose() {
this.$emit("close", false);
created() {
this.timer = setInterval(() => { this.getVersionList() }, 1000)

},
// 接受到url下载
URLdownload(fileName, url) {
const link = document.createElement('a')
link.style = 'display: none'; // 创建一个隐藏的a标签
link.setAttribute('download', fileName)
link.setAttribute('href', url)
link.setAttribute('target', "_blank")
document.body.appendChild(link);
link.click(); // 触发a标签的click事件
document.body.removeChild(link);
destroyed() {
clearInterval(this.timer)
this.timer = null
},
confirmDownload(row) {
this.$confirm('是否下载此版本算法?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.downloadAlgorithm(row)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
},
reupload(row) {
store.commit('user/SET_PROGRESSID', row.algorithmId+row.algorithmVersion)
this.myAlgorithmVisible = true
this.reuploadData = row
},
handleSizeChange(val) {
this.pageSize = val
this.getVersionList()
},
handleCurrentChange(val) {
this.pageIndex = val
this.getVersionList()
},
getVersionList(param) {
this.typeChange = this.algorithmType
if (!param) {
param = { pageIndex: this.pageIndex, pageSize: this.pageSize }
}
param.algorithmId = this.row.algorithmId
getAlgorithmVersionList(param).then(response => {
if (response.success) {
this.versionList = response.data.algorithms,
this.versionList.forEach(item => {
if (sessionStorage.getItem(JSON.stringify(item.algorithmId + item.algorithmVersion))) {
item.progress = sessionStorage.getItem(JSON.stringify(item.algorithmId + item.algorithmVersion))
}

})
this.total = response.data.totalSize
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
},
handleDialogClose() {
this.$emit("close", false);
},
// 接受到url下载
URLdownload(fileName, url) {
const link = document.createElement('a')
link.style = 'display: none'; // 创建一个隐藏的a标签
link.setAttribute('download', fileName)
link.setAttribute('href', url)
link.setAttribute('target', "_blank")
document.body.appendChild(link);
link.click(); // 触发a标签的click事件
document.body.removeChild(link);
},
confirmDownload(row) {
this.$confirm('是否下载此版本算法?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.downloadAlgorithm(row)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
});
},
downloadAlgorithm(row) {
const that = this
this.loading = true
const param = {
algorithmId: row.algorithmId,
version: row.algorithmVersion
}
let latestCompressed = row.latestCompressed
compressAlgorithm(param).then(response => {
if (response.success) {
param.compressAt = response.data.compressAt
param.domain = this.GLOBAL.DOMAIN
const interval = setInterval(function() {
queryAlgorithmVersion(param).then(response => {
if (response.success) {
latestCompressed = response.data.algorithm.latestCompressed
} else {
that.loading = false
clearInterval(interval)
that.$message({
message: that.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
if (param.compressAt <= latestCompressed) {
that.loading = false
clearInterval(interval)
downloadAlgorithmVersion(param).then(response => {
},
downloadAlgorithm(row) {
const that = this
this.loading = true
const param = {
algorithmId: row.algorithmId,
version: row.algorithmVersion
}
let latestCompressed = row.latestCompressed
compressAlgorithm(param).then(response => {
if (response.success) {
param.compressAt = response.data.compressAt
param.domain = this.GLOBAL.DOMAIN
const interval = setInterval(function () {
queryAlgorithmVersion(param).then(response => {
if (response.success) {
that.URLdownload(row.algorithmName, response.data.downloadUrl)
that.$message.success("下载成功");
latestCompressed = response.data.algorithm.latestCompressed
} else {
that.loading = false
clearInterval(interval)
that.$message({
message: that.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
}
}, 3000)
} else {
that.loading = false
if (param.compressAt <= latestCompressed) {
that.loading = false
clearInterval(interval)
downloadAlgorithmVersion(param).then(response => {
if (response.success) {
that.URLdownload(row.algorithmName, response.data.downloadUrl)
that.$message.success("下载成功");
} else {
that.$message({
message: that.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
}
}, 3000)
} else {
that.loading = false
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
},
confirmDelete(row) {
this.$confirm('是否删除此版本算法', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.handleDelete(row)
}).catch(() => {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
type: 'info',
message: '已取消'
});
}
})
},
confirmDelete(row) {
this.$confirm('是否删除此版本算法', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
this.handleDelete(row)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
handleDelete(row) {
const param = {
algorithmId: row.algorithmId,
version: row.algorithmVersion
}
deletePreAlgorithmVersion(param).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getVersionList();
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
},
handleDelete(row) {
const param = {
algorithmId: row.algorithmId,
version: row.algorithmVersion
}
})
},
getAlgorithmStatus(value) {
switch (value) {
case 1:
return "等待上传中"
case 2:
return "上传中"
case 3:
return "上传完成"
case 4:
return "上传失败"
deletePreAlgorithmVersion(param).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getVersionList();
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})
},
getAlgorithmStatus(value) {
switch (value) {
case 1:
return "等待上传中"
case 2:
return "上传中"
case 3:
return "上传完成"
case 4:
return "上传失败"
}
},
cancel(val) {
this.myAlgorithmVisible = val
},
close(val) {
this.myAlgorithmVisible = val
},
confirm(val) {
this.myAlgorithmVisible = val
},
// 时间戳转换日期
parseTime(val) {
return parseTime(val)
}
},
cancel(val) {
this.myAlgorithmVisible = val
},
close(val) {
this.myAlgorithmVisible = val
},
confirm(val) {
this.myAlgorithmVisible = val
},
// 时间戳转换日期
parseTime(val) {
return parseTime(val)
}
}

}
}
</script>

+ 20
- 3
admin-portal/src/views/imageManager/Image.vue View File

@@ -58,9 +58,15 @@
<span>{{ parseTime(scope.row.createdAt) }}</span>
</template>
</el-table-column>
<el-table-column label="上传进度" align="center" v-if="!flag">
<template slot-scope="scope">
<span v-if="scope.row.progress&&scope.row.progress!=0" style="color:#409EFF">{{
scope.row.progress+'%' }}</span>
</template>
</el-table-column>
<el-table-column v-if="!flag" label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button v-if="scope.row.imageStatus!==3" type="text" @click="handleEdit(scope.row)">重新上传
<el-button v-if="scope.row.imageStatus==1||scope.row.imageStatus==4" type="text" @click="handleEdit(scope.row)">重新上传
</el-button>
<el-button type="text" @click="open2(scope.row)">删除</el-button>
<el-button type="text" @click="open(scope.row)">修改描述</el-button>
@@ -96,6 +102,7 @@
import searchForm from '@/components/search/index.vue'
import { parseTime } from '@/utils/index'
import { getErrorMsg } from '@/error/index'
import store from '@/store'
export default {
name: "PreImage",
components: {
@@ -136,7 +143,7 @@
}
},
created() {
this.getImage(this.searchData)
this.timer = setInterval(() => { this.getImage(this.searchData) }, 1000)
if (this.imageTabType !== 1) {
this.flag = false
} else {
@@ -146,6 +153,9 @@
)
}
},
destroyed() {
clearInterval(this.timer)
},
methods: {
// 错误码
getErrorMsg(code) {
@@ -171,7 +181,13 @@
if (response.success) {
if (response.data !== null) {
this.total = parseInt(response.data.totalSize)
this.tableData = response.data.images
this.tableData = response.data.images,
this.tableData.forEach(item => {
if (sessionStorage.getItem(JSON.stringify(item.id))) {
item.progress = sessionStorage.getItem(JSON.stringify(item.id))
}

})
}
} else {
this.$message({
@@ -186,6 +202,7 @@
this.row = row
this.FormVisible = true
this.Logo = false
store.commit('user/SET_PROGRESSID', row.id)
},
handleDelete(row) {
deletePreImage(row.id).then(response => {


+ 5
- 9
admin-portal/src/views/modelManager/components/previewDialog.vue View File

@@ -1,11 +1,7 @@
<template>
<div>
<el-dialog
title="预览"
:visible.sync="dialogTableVisible"
:before-close="handleDialogClose"
:close-on-click-modal="false"
>
<el-dialog title="预览" :visible.sync="dialogTableVisible" :before-close="handleDialogClose"
:close-on-click-modal="false">
<el-table :data="tableData" height="300">
<el-table-column property="name" label="模型名称" />
<el-table-column property="contentType" label="内容类型" />
@@ -27,7 +23,7 @@
export default {
name: "PreviewDialog",
props: {
row: { type: Object, default: () => {} }
row: { type: Object, default: () => { } }
},
data() {
return {
@@ -55,8 +51,8 @@
this.tableData = response.data.modelInfoList
} else {
this.$message({
message: '目前暂无数据',
type: 'success'
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
})


+ 42
- 38
admin-portal/src/views/modelManager/components/versionList.vue View File

@@ -1,30 +1,35 @@
<template>
<div>
<el-dialog
:title="'版本列表/' + modelName"
width="70%"
:visible.sync="CreateFormVisible"
:before-close="handleDialogClose"
:close-on-click-modal="false"
>
<el-table
:data="tableData"
style="width: 100%"
height="500"
>
<el-table-column prop="version" label="算法版本" align="center" />
<el-table-column prop="descript" label="模型描述" align="center" />
<el-table-column label="状态" align="center">
<el-dialog :title="'版本列表/' + modelName" width="70%" :visible.sync="CreateFormVisible"
:before-close="handleDialogClose" :close-on-click-modal="false">
<el-table :data="tableData" style="width: 100%" height="350">
<el-table-column label="算法版本">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ fileStatus(scope.row.fileStatus) }}</span>
<span>{{ scope.row.version }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<el-table-column label="模型描述" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ parseTime(scope.row.createdAt) }}</span>
<span>{{ scope.row.descript }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="350px">
<el-table-column label="状态">
<template slot-scope="scope">
{{ fileStatus(scope.row.fileStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
{{ parseTime(scope.row.createdAt) }}</span>
</template>
</el-table-column>
<el-table-column label="上传进度" v-if="modelType == 3">
<template slot-scope="scope">
<span v-if="scope.row.progress&&scope.row.progress!=0" style="color:#409EFF">{{
scope.row.progress+'%' }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" :disabled="scope.row.fileStatus!==2" @click="handlePreview(scope.row)">
预览
@@ -37,15 +42,9 @@
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 80]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<el-pagination :current-page="pageIndex" :page-sizes="[10, 20, 50, 80]" :page-size="pageSize"
:total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
</div>
<div slot="footer">
</div>
@@ -82,16 +81,20 @@
pageSize: 10,
tableData: [],
row: { flag: undefined, data: undefined },
data: { modelId: undefined, version: undefined }
data: { modelId: undefined, version: undefined },
timer: null

}
},
created() {
this.getList()
},
beforeDestroy() {
this.timer = setInterval(() => { this.getList() }, 1000)

},
destroyed() {
clearInterval(this.timer)
this.timer = null
},

methods: {
// 错误码
getErrorMsg(code) {
@@ -184,15 +187,16 @@
this.dialogVisible = val
},
getList() {
this.tableData = []
getModelList({ pageIndex: this.pageIndex, pageSize: this.pageSize, modelId: this.modelId }).then(response => {
if (response.success) {
this.total = response.data.totalSize
this.tableData = response.data.modelVersions
this.$message({
message: "获取列表成功",
type: 'success'
});
this.tableData.forEach(item => {
if (sessionStorage.getItem(JSON.stringify(item.modelId + item.version))) {
item.progress = sessionStorage.getItem(JSON.stringify(item.modelId + item.version))
}

})
this.total = response.data.totalSize
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),


+ 19
- 1
openai-portal/.eslintrc.js View File

@@ -24,7 +24,23 @@ module.exports = {
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
"vue/html-self-closing": ["error", {
"html": {
"void": "never",
"normal": "any",
"component": "always"
},
"svg": "always",
"math": "always"
}],
// "vue/name-property-casing": ["off", "PascalCase"],
// 'vue/attribute-hyphenation': 0,
// "vue/require-default-prop": 0,
// "vue/prop-name-casing": 0,
// "vue/this-in-template": 0,
// "vue/require-prop-type-constructor": 0,
// "vue/no-dupe-keys":0,
// "vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
@@ -48,6 +64,7 @@ module.exports = {
'dot-location': [2, 'property'],
'eqeqeq': ["error", "always", {"null": "ignore"}],
// 'eqeqeq': ["off", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
@@ -80,6 +97,7 @@ module.exports = {
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
// 'no-dupe-keys': 0,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,


+ 4
- 2
openai-portal/src/api/imageManager.js View File

@@ -1,6 +1,5 @@
import request from '@/utils/request'
import requestMinIO from '@/utils/requestMinIO'

export function judgeParam(params) {
const conditions = []
params.imageType ? conditions.push(`imageType=` + params.imageType) : null;
@@ -87,7 +86,10 @@ export function uploadMiniIO(params) {
return requestMinIO({
url: params.uploadUrl,
method: 'put',
data: params.file
data: params.file,
onUploadProgress: function(progress) {
sessionStorage.setItem(JSON.stringify(params.id), JSON.stringify(parseInt(((progress.loaded / progress.total) * 100))));
}
})
}



+ 118
- 58
openai-portal/src/components/upload/index.vue View File

@@ -1,30 +1,19 @@
<template>
<div>
<el-upload
v-if="showUpload"
class="upload-demo"
action="#"
:on-change="upload"
:file-list="fileList"
:http-request="httpRequest"
multiple
:accept="accept"
>
<el-button size="small" type="primary" :disabled="loadingShow" :loading="loadingShow">点击上传</el-button>
<el-upload v-if="showUpload" class="upload-demo" action="#" :on-change="upload" :file-list="fileList"
:http-request="httpRequest" multiple :accept="accept" :before-upload="beforeUpload"
:disabled="show||progress>0&&progress<100">
<el-button size="small" type="primary" :disabled="show||progress>0&&progress<100">点击上传
</el-button>
<div class="tipText">{{ tipText }}</div>
</el-upload>
<el-button v-if="!showUpload" :loading="loadingShow" size="small" type="primary">上传中</el-button>
<el-progress
v-if="!showUpload"
:text-inside="true"
:stroke-width="18"
:percentage="progress"
class="progress"
/>
<div v-if="show" slot="footer" class="dialog-footer">
<el-progress :text-inside="true" :stroke-width="18" :percentage="progress" class="progress"
v-if="progress>0&&progress<100" />
<!-- <div v-if="show" slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
</div>
</div> -->
</div>
</template>
<script>
@@ -53,7 +42,7 @@
accept: "application/zip",
tipText: '上传文件格式为 zip',
progress: undefined,
timer:undefined
timer: undefined
}
},
computed: {
@@ -61,34 +50,47 @@
'progressId',
])
},
watch: {
progress(newValue, oldValue) {
if (newValue == 100) {
clearInterval(this.timer)
}
}
},
created() {
created() {
this.timer = setInterval(() => {
if (store.state.user.progressId) {
if (this.showProgress()) {
if (parseInt(sessionStorage.getItem(JSON.stringify(store.state.user.progressId)))) {
this.progress = parseInt(sessionStorage.getItem(JSON.stringify(store.state.user.progressId)))
}
}
}, 1000)
}, 100)

if (this.uploadData.type === "imageManager") {
this.accept = "application/zip,.tar"
this.tipText = '上传文件格式为 zip 或 tar'
}
},
destory() {
clearInterval(this.timer)
},
watch: {
progress(a, b) {
if (a == 100) {
this.show = true
this.loadingShow = false
}
if (0 < a < 100) {
this.loadingShow = true
}
}
},
methods: {
getErrorMsg(code) {
return getErrorMsg(code)
},
beforeUpload() {
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0);
},
upload(file, fileList) {
// if (this.uploadData.type = "镜像模块") {
if (file) { this.fileList = [file] }
if (file) {
this.fileList = [file]
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0);
}
// }
},
httpRequest() {
@@ -97,18 +99,34 @@
if (this.uploadData.type === "imageManager") {
this.loadingShow = true
this.showUpload = false
this.show = false
if (fileForm === 'zip' || fileForm === 'tar') {
uploadImage({ id: this.uploadData.data.id, fileName: this.fileList[0].name, domain: this.GLOBAL.DOMAIN }).then(response => {
store.commit('user/SET_PROGRESSID', this.uploadData.data.id)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.data.id)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw,
id: this.uploadData.data.id
}
uploadMiniIO(param).then(response => {
this.$nextTick(() => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.confirm()
})

})
}
uploadMiniIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
})
else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}


})
} else {
this.loadingShow = false
@@ -131,14 +149,17 @@
if (fileForm === 'zip') {
uploadMyDataset(param).then(response => {
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.id+this.uploadData.version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.id+this.uploadData.version,
}
minIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.confirm()
})
} else {
this.$message({
@@ -172,24 +193,27 @@
if (fileForm === 'zip') {
uploadMyAlgorithm(param).then(response => {
if (response.success) {
store.commit('user/SET_PROGRESSID', this.uploadData.AlgorithmId + this.uploadData.Version)
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.AlgorithmId + this.uploadData.Version,
}
minIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.showUpload = true,
this.confirm()
})
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
this.loadingShow = false
this.show = true
this.showUpload = true
this.fileList = []
// this.loadingShow = false
// this.show = true
// this.showUpload = true
// this.fileList = []
}
})
} else {
@@ -212,15 +236,18 @@
}
if (fileForm === 'zip') {
uploadNewVersion(param).then(response => {
store.commit('user/SET_PROGRESSID', this.uploadData.id+this.uploadData.version)
if (response.success) {
const param = {
uploadUrl: response.data.uploadUrl,
file: this.fileList[0].raw
file: this.fileList[0].raw,
id: this.uploadData.id+this.uploadData.version,
}
minIO(param).then(response => {
this.loadingShow = false
this.show = true
this.showUpload = true
this.showUpload = true,
this.confirm()
})
} else {
this.$message({
@@ -248,12 +275,23 @@
if (this.uploadData.type === "imageManager") {
finishUpload(this.uploadData.data.id).then(
response => {
this.$message({
message: '创建成功',
type: 'success'
});
if (response.success) {
this.$message({
message: '上传成功',
type: 'success'
});
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0),
this.$emit('confirm', false)
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}

},
this.$emit('confirm', false)


)
} else if (this.uploadData.type === "myDatasetCreation") {
const payload = {
@@ -263,14 +301,17 @@
}
myDatasetFinishUpload(payload).then(response => {
if (response.success) {
this.$message.success("上传我的数据集成功");
store.commit('user/SET_PROGRESSID', this.uploadData.id)
this.$message.success("上传数据集成功");
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0),
this.$emit('confirm', false)
} else {
this.$message({
message: this.getErrorMsg(response.error.subcode),
type: 'warning'
});
}
}, this.$emit('confirm', false))
})
} else if (this.uploadData.type === 'myAlgorithmCreation') {
const payload = {
algorithmId: this.uploadData.AlgorithmId,
@@ -296,13 +337,15 @@
newVersionFinishUpload(payload).then(response => {
if (response.success) {
this.$message.success("上传数据集新版本成功");
sessionStorage.setItem(JSON.stringify(store.state.user.progressId), 0),
this.$emit('confirm', false)