diff --git a/src/pages/workbench/app_build.vue b/src/pages/workbench/app_build.vue index 674066e71eb33bd5fd92b461cc604bb225673c62..9194a89df3b2e93dd3e3f5c0938311645f7716dd 100644 --- a/src/pages/workbench/app_build.vue +++ b/src/pages/workbench/app_build.vue @@ -31,7 +31,11 @@ placeholder="请输入版本号" > - + - +

@@ -119,7 +128,9 @@ :data="app_info" action="/apaas/hubApi/market/app" :on-change="deployUploadChange" + :on-remove="deployUploadRemove" :on-success="deployUploadSuccess" + :on-error="deployUploadError" name="file" drag > @@ -186,17 +197,16 @@ - - - - + @@ -257,12 +267,14 @@ import appBuildSteps from "@/components/app-build-steps/app-build-steps"; import appBuildStep from "@/components/app-build-steps/app-build-step"; import apassTable from "@/components/apass-table"; +import uploadFile from "@/components/upload_file"; export default { components: { appBuildSteps, appBuildStep, apassTable, + uploadFile, }, data: () => ({ step: 0, @@ -323,6 +335,7 @@ export default { ywlys: [], types: [], orgs: [], + logo: [], submitLoading: false, }), methods: { @@ -333,16 +346,17 @@ export default { this.step++; }, initImageList() { + this.image_loading = true; this.$http .get("/apaas/hubApi/image/imageUpList", { params: { page: this.image_page, - size: 5, + size: 10, }, }) - .then((response) => { - this.image_total = response.data.total; - this.image_datas.push(...response.data.data); + .then(({ data }) => { + this.image_total = data.total || 0; + this.image_datas.push(...(data.data || [])); this.image_loading = false; this.image_noMore = false; }) @@ -352,7 +366,6 @@ export default { }, loadImageList() { if (this.image_datas.length < this.image_total) { - this.image_loading = true; this.image_page++; this.initImageList(); } else { @@ -360,27 +373,32 @@ export default { } }, imageUploadChange(file) { - this.image_info.file = file; - - /* this.$refs["step1_form"].validate((valid) => { - if (valid) { - // - } else { - return false; - } - }); */ + if (file.raw.type !== "application/x-tar") { + this.$message.error("镜像文件只能是 TAR 格式!"); + this.image_info.file = ""; + this.$refs.step1_upload.clearFiles(); + } else { + this.image_info.file = file; + this.$refs.step1_upload_item.clearValidate(); + } }, imageUploadSuccess(response) { - // console.log("新增成功", response); - this.$refs.step1_upload.clearFiles(); + this.$message({ + message: `上传镜像成功`, + type: "success", + }); this.image_info.image_name = ""; this.image_info.tag = ""; this.image_info.file = ""; + this.$refs.step1_upload.clearFiles(); this.step1UplaodLoading = false; this.image_datas = []; this.image_page = 1; this.initImageList(); }, + imageUploadRemove() { + this.image_info.file = ""; + }, imageUploadError(response) { this.$message({ message: `上传失败`, @@ -411,9 +429,6 @@ export default { console.log(error); }); }, - deployUploadChange(file) { - this.deploy_info.file = file; - }, goToStep2(formName) { this.$refs[formName].validate((valid) => { if (valid) { @@ -423,20 +438,8 @@ export default { } }); }, - handleLogoSuccess(response) { - this.app_info.logo = response.data; - }, - beforeLogoUpload(file) { - const isPic = file.type === "image/jpeg" || file.type === "image/png"; - const isLt10M = file.size / 1024 / 1024 < 10; - - if (!isPic) { - this.$message.error("上传头像图片只能是 JPG 或 PNG 格式!"); - } - if (!isLt10M) { - this.$message.error("上传头像图片大小不能超过 10MB!"); - } - return isPic && isLt10M; + getNewList(file) { + this.app_info.logo = file.url; }, getYwlys() { this.$http @@ -468,10 +471,38 @@ export default { console.log(error); }); }, + deployUploadChange(file) { + const filtType = this.getFileType(file.name); + + if (filtType === "zip" || filtType === "gz" || filtType === "tgz") { + this.deploy_info.file = file; + this.$refs.step2_upload_item.clearValidate(); + } else { + this.$message.error("部署文件格式错误!"); + this.deploy_info.file = ""; + this.$refs.step2_upload.clearFiles(); + } + }, + deployUploadRemove() { + this.deploy_info.file = ""; + }, + deployUploadSuccess(response) { + this.$message({ + message: `提交成功`, + type: "success", + }); + this.submitLoading = false; + this.$router.push("/yygl/2/0"); + }, + deployUploadError() { + this.$message({ + message: `提交失败`, + type: "warning", + }); + }, sunbmitAction(formName) { this.$refs[formName].validate((valid) => { if (valid) { - console.log("submit action"); this.submitLoading = true; this.$refs.step2_upload.submit(); } else { @@ -479,10 +510,16 @@ export default { } }); }, - deployUploadSuccess(response) { - console.log("提交成功", response); - this.submitLoading = false; - this.$router.push("/yygl/2/0"); + getFileType(fileName) { + const startIndex = fileName.lastIndexOf("."); + + if (startIndex != -1) { + return fileName + .substring(startIndex + 1, fileName.length) + .toLowerCase(); + } else { + return ""; + } }, }, mounted() { diff --git a/src/pages/workbench/yygl/yyglList.vue b/src/pages/workbench/yygl/yyglList.vue index f046fc5558a8b5c66477046bff9091a79d8ce94e..e2a2f1e7646757488fe6d4de1238ecc7338dbe7c 100644 --- a/src/pages/workbench/yygl/yyglList.vue +++ b/src/pages/workbench/yygl/yyglList.vue @@ -278,11 +278,11 @@ export default { data: [ { name: "申请部署", - value: 1, + value: 0, }, { name: "申请开发", - value: 2, + value: 1, }, ], }, @@ -300,7 +300,7 @@ export default { }, { name: "审批未通过", - value: 2, + value: 0, }, ], }, @@ -611,11 +611,11 @@ export default { data: [ { name: "申请部署", - value: 1, + value: 0, }, { name: "申请开发", - value: 2, + value: 1, }, ], }, @@ -633,7 +633,7 @@ export default { }, { name: "审批未通过", - value: 2, + value: 0, }, ], }, @@ -721,7 +721,7 @@ export default { class: "warn", callback: _self.deleteItem, disabledRule(item) { - return item.online_state != 0; + return item.online_state != 2; }, }, ], @@ -929,11 +929,11 @@ export default { data: [ { name: "申请部署", - value: 1, + value: 0, }, { name: "申请开发", - value: 2, + value: 1, }, ], }, @@ -951,7 +951,7 @@ export default { }, { name: "审批未通过", - value: 2, + value: 0, }, ], }, @@ -1033,7 +1033,7 @@ export default { return item.value; }) .join(","); - } // 在线状态 + } // 在线状态 / 部署来源 / 在线区域 if (filter.appTypes) { params.appTypes = filter.appTypes .map((item) => { @@ -1062,6 +1062,20 @@ export default { }) .join(","); } // 应用来源 + if (filter.apply_type) { + params.apply_type = filter.apply_type + .map((item) => { + return item.value; + }) + .join(","); + } // 申请类型 + if (filter.apply_state) { + params.status = filter.apply_state + .map((item) => { + return item.value; + }) + .join(","); + } // 申请状态 this.tempFliter = filter; @@ -1087,7 +1101,7 @@ export default { }, // 唤醒弹窗 deleteAction(item) { if (this.cardType === 0) { - if (item.online_state == 0) { + if (item.online_state != 2) { this.dialogInfo.title = ""; this.dialogInfo.msg = "是否删除该条应用?"; this.dialogInfo.cancelText = "";