wenlele
2 years ago
23 changed files with 419 additions and 106 deletions
@ -0,0 +1,4 @@ |
|||
alter table t_resource_consumption |
|||
add resource_id int; |
|||
|
|||
comment on column t_resource_consumption.resource_id is '元数据id'; |
@ -0,0 +1,9 @@ |
|||
create type enum_datasource_type as enum ('原数据库', '备份数据库'); |
|||
|
|||
alter table t_data_source |
|||
alter column mount_path drop not null; |
|||
|
|||
alter table t_data_source |
|||
add type enum_datasource_type; |
|||
|
|||
comment on column t_data_source.type is '数据源类型'; |
@ -0,0 +1,46 @@ |
|||
import React from 'react' |
|||
import { |
|||
ModalForm, |
|||
ProFormText, |
|||
} from '@ant-design/pro-form'; |
|||
import { Form, message } from 'antd'; |
|||
|
|||
export default (props) => { |
|||
const { resourceId, onFinish, approveList, } = props; |
|||
const [form] = Form.useForm(); |
|||
|
|||
return ( |
|||
<ModalForm |
|||
title="输入令牌" |
|||
trigger={ |
|||
<a></a> |
|||
} |
|||
visible={true} |
|||
form={form} |
|||
layout='horizontal' |
|||
autoFocusFirstInput |
|||
modalProps={{ |
|||
destroyOnClose: true, |
|||
onCancel: () => { props.onCancel() } |
|||
}} |
|||
onFinish={async (values) => { |
|||
console.log(values.name); |
|||
const token = approveList?.rows?.find(s => s.resourceId == resourceId)?.token |
|||
if (token == values.name) { |
|||
onFinish() |
|||
return true; |
|||
} else { |
|||
message.error('令牌错误') |
|||
} |
|||
}} |
|||
width={500} |
|||
> |
|||
<ProFormText |
|||
name="name" |
|||
label="访问令牌" |
|||
placeholder="请输入访问令牌" |
|||
rules={[{ required: true, message: '访问令牌不可空' }]} |
|||
/> |
|||
</ModalForm> |
|||
); |
|||
}; |
@ -0,0 +1,37 @@ |
|||
const imageToBase64 = (img) => { |
|||
var canvas = document.createElement("canvas"); |
|||
canvas.width = img.width; |
|||
canvas.height = img.height; |
|||
var ctx = canvas.getContext("2d"); |
|||
console.log(img, canvas) |
|||
ctx.drawImage(img, 0, 0, img.width, img.height); |
|||
var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase(); |
|||
var dataURL = canvas.toDataURL("image/" + ext); |
|||
return dataURL; |
|||
} |
|||
|
|||
export const downloadImg = (fileName) => { |
|||
const url = '/assets/files/common/' + fileName |
|||
var image = new Image(); |
|||
image.crossOrigin = ''; |
|||
image.src = url; |
|||
image.onload = function () { |
|||
let base64 = imageToBase64(image); //图片转base64
|
|||
const link = document.createElement('a') |
|||
link.style.display = 'none' |
|||
//设置下载的图片名称
|
|||
link.download = fileName |
|||
link.href = base64 |
|||
document.body.appendChild(link) |
|||
link.click() |
|||
document.body.removeChild(link) |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
export const markRedKeywords = (str, key) => { |
|||
var reg = new RegExp((`(${key})`), "gi"); |
|||
var replace = '<span style="color:#FD463E;font-weight:bold;margin-right:0px;">$1</span>'; |
|||
return str.replace(reg, replace); |
|||
} |
Loading…
Reference in new issue