feat: cert download

This commit is contained in:
xiaojunnuo
2023-06-27 22:45:27 +08:00
parent 27a4c81c6d
commit 5a51c14de5
27 changed files with 207 additions and 75 deletions
+6 -6
View File
@@ -11,9 +11,9 @@ import { provide, ref, nextTick } from "vue";
import { usePageStore } from "/src/store/modules/page";
import { useResourceStore } from "/src/store/modules/resource";
import { useSettingStore } from "/@/store/modules/settings";
import 'dayjs/locale/zh-cn';
import 'dayjs/locale/en';
import dayjs from 'dayjs'
import "dayjs/locale/zh-cn";
import "dayjs/locale/en";
import dayjs from "dayjs";
export default {
name: "App",
setup() {
@@ -29,13 +29,13 @@ export default {
console.log("locale changed:", value);
if (value === "zh-cn") {
locale.value = zhCN;
dayjs.locale('zh-cn');
dayjs.locale("zh-cn");
} else if (value === "en") {
locale.value = enUS;
dayjs.locale('en');
dayjs.locale("en");
}
}
localeChanged('zh-cn')
localeChanged("zh-cn");
provide("fn:router.reload", reload);
provide("fn:locale.changed", localeChanged);
+2 -1
View File
@@ -53,7 +53,7 @@ export function errorLog(error: any) {
error.message = error?.response?.data?.message;
}
// 打印到控制台
console.error(error);
console.error("errorLog", error);
// 显示提示
uiContext.get().notification.error({ message: error.message });
}
@@ -64,6 +64,7 @@ export function errorLog(error: any) {
*/
export function errorCreate(msg: string) {
const err = new Error(msg);
console.error("errorCreate", err);
uiContext.get().notification.error({ message: err.message });
throw err;
}
@@ -1,4 +1,4 @@
<template xmlns:w="http://www.w3.org/1999/xhtml">
<template>
<a-layout class="fs-framework">
<a-layout-sider v-model:collapsed="asideCollapsed" :trigger="null" collapsible>
<div class="header-logo">
@@ -95,7 +95,7 @@ export default {
}
onErrorCaptured((e) => {
console.error("ErrorCaptured:", e);
notification.error({ message: e.message });
// notification.error({ message: e.message });
//阻止错误向上传递
return false;
});
-2
View File
@@ -2,8 +2,6 @@ import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.less";
// import "virtual:windi.css";
import "./style/common.less";
import "./mock";
import i18n from "./i18n";
+3 -28
View File
@@ -1,3 +1,5 @@
@import './tailwind.less';
@import "ant-design-vue/dist/antd.less";
@import './theme/index.less';
@import './theme/default.less';
@import './scroll.less';
@@ -49,9 +51,7 @@ h1, h2, h3, h4, h5, h6 {
text-align: center;
}
.red{
color:red
}
.font12{
font-size: 12px;
@@ -88,27 +88,6 @@ h1, h2, h3, h4, h5, h6 {
}
}
.mt-10{
margin-top:10px;
}
.ml-5{
margin-left:5px;
}
.ml-10{
margin-left: 10px;
}
.mtb-5{
margin: 5px 0 5px 0;
}
.mb-10{
margin-bottom: 10px;
}
.mlr-5{
margin: 0 5px 0 5px;
}
.gray{
color:gray;
}
@@ -125,10 +104,6 @@ h1, h2, h3, h4, h5, h6 {
color:yellow;
}
.ml-2{
margin-left: 2px;
}
.font-20{
font-size:20px
}
@@ -1,3 +1,4 @@
img.ant-image-preview-img{
display: initial;
}
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@@ -1,7 +1,9 @@
import { request } from "/src/api/service";
const apiPrefix = "/pi/pipeline";
export function GetList(query) {
const apiPrefix = "/pi/pipeline";
const historyApiPrefix = "/pi/history";
export function GetList(query: any) {
return request({
url: apiPrefix + "/page",
method: "post",
@@ -9,7 +11,7 @@ export function GetList(query) {
});
}
export function AddObj(obj) {
export function AddObj(obj: any) {
return request({
url: apiPrefix + "/add",
method: "post",
@@ -17,7 +19,7 @@ export function AddObj(obj) {
});
}
export function UpdateObj(obj) {
export function UpdateObj(obj: any) {
return request({
url: apiPrefix + "/update",
method: "post",
@@ -25,7 +27,7 @@ export function UpdateObj(obj) {
});
}
export function DelObj(id) {
export function DelObj(id: any) {
return request({
url: apiPrefix + "/delete",
method: "post",
@@ -33,7 +35,7 @@ export function DelObj(id) {
});
}
export function GetObj(id) {
export function GetObj(id: any) {
return request({
url: apiPrefix + "/info",
method: "post",
@@ -41,7 +43,7 @@ export function GetObj(id) {
});
}
export function GetDetail(id) {
export function GetDetail(id: any) {
return request({
url: apiPrefix + "/detail",
method: "post",
@@ -49,7 +51,7 @@ export function GetDetail(id) {
});
}
export function Save(pipelineEntity) {
export function Save(pipelineEntity: any) {
return request({
url: apiPrefix + "/save",
method: "post",
@@ -57,10 +59,18 @@ export function Save(pipelineEntity) {
});
}
export function Trigger(id) {
export function Trigger(id: any) {
return request({
url: apiPrefix + "/trigger",
method: "post",
params: { id }
});
}
export async function GetFiles(pipelineId: number) {
return request({
url: historyApiPrefix + "/files",
method: "post",
params: { pipelineId }
});
}
@@ -5,7 +5,9 @@ import { useRouter } from "vue-router";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
import { nanoid } from "nanoid";
import { message } from "ant-design-vue";
import { message, Modal } from "ant-design-vue";
import { env } from "/@/utils/util.env";
import { useUserStore } from "/@/store/modules/user";
export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
@@ -73,6 +75,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
router.push({ path: "/certd/pipeline/detail", query: { id, editMode: "true" } });
});
}
const userStore = useUserStore();
return {
crudOptions: {
request: {
@@ -124,6 +127,33 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
order: 2,
icon: "ant-design:setting-outlined"
},
download: {
order: 3,
title: null,
type: "link",
icon: "ant-design:download-outlined",
async click({ row }) {
const files = await api.GetFiles(row.id);
Modal.success({
title: "文件下载",
content: () => {
const children = [];
for (const file of files) {
const downloadUrl = `${env.API}/pi/history/download?pipelineId=${row.id}&fileId=${file.id}`;
children.push(
<p>
<a href={downloadUrl} target={"_blank"}>
{file.filename}
</a>
</p>
);
}
return <div class={"mt-3"}>{children}</div>;
}
});
}
},
remove: {
order: 5
}
@@ -5,7 +5,7 @@
</template>
<p>
<fs-date-format :model-value="runnable.status?.startTime"></fs-date-format>
<a-tag class="ml-10" :color="status.color">{{ status.label }}</a-tag>
<a-tag class="ml-1" :color="status.color">{{ status.label }}</a-tag>
<a-tag v-if="isCurrent" class="pointer" color="green" :closable="true" @close="cancel">当前</a-tag>
<a-tag v-else-if="!editMode" class="pointer" color="blue" @click="view">查看</a-tag>
@@ -38,6 +38,7 @@
options: [
{ value: 'start', label: '开始时' },
{ value: 'success', label: '成功时' },
{ value: 'turnToSuccess', label: '错误转成功时' },
{ value: 'error', label: '错误时' }
]
},
@@ -7,7 +7,7 @@
<div style="margin-top: 10px">
<a-button @click="formSubmit">提交表单</a-button>
<a-button @click="formReset">重置表单</a-button>
<a-button class="ml-10" @click="setFormDataTest">setFormData</a-button>
<a-button class="ml-1" @click="setFormDataTest">setFormData</a-button>
</div>
</a-card>
</a-col>