feat: 登录相关问题修复
parent
a00eeb2ffd
commit
b4e53f8544
@ -0,0 +1,122 @@
|
||||
export type ComputePowerPoolItem = {
|
||||
name: string;
|
||||
type: number; // 类别
|
||||
color?: string; //
|
||||
proportion: number;
|
||||
pretreatmentEfficiency?: number;
|
||||
bgColor?: string;
|
||||
};
|
||||
|
||||
export const testGroupList: Record<string, any>[] = [
|
||||
{
|
||||
label: 'NVIDIA GeForce 4090',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
label: '瑞芯微 RK3566',
|
||||
type: 0,
|
||||
},
|
||||
{
|
||||
label: '瑞芯微 RK3566',
|
||||
type: 0,
|
||||
},
|
||||
{
|
||||
label: 'NVIDIA GeForce 4090',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
label: 'NVIDIA GeForce 4090',
|
||||
type: 1,
|
||||
},
|
||||
];
|
||||
|
||||
export const testPoolsData: ComputePowerPoolItem[] = [
|
||||
{
|
||||
name: '焊线颜色检测',
|
||||
type: 9,
|
||||
proportion: 7,
|
||||
pretreatmentEfficiency: 20,
|
||||
color: '#014BE6',
|
||||
bgColor: 'linear-gradient(180deg, #015DE6 0%, #4881F6 100%)',
|
||||
},
|
||||
{
|
||||
name: '螺纹缺陷检测',
|
||||
type: 8,
|
||||
proportion: 8,
|
||||
pretreatmentEfficiency: 20,
|
||||
color: '#FAA90B',
|
||||
bgColor: 'linear-gradient(180deg, #E64601 0%, #F6A648 100%)',
|
||||
},
|
||||
{
|
||||
name: 'PIN间距测量',
|
||||
type: 7,
|
||||
proportion: 4,
|
||||
pretreatmentEfficiency: 15,
|
||||
color: '#EA1281',
|
||||
bgColor: 'linear-gradient(180deg, #E60161 0%, #F648E5 100%)',
|
||||
},
|
||||
{
|
||||
name: '螺纹无牙缺陷检测',
|
||||
type: 6,
|
||||
proportion: 7,
|
||||
pretreatmentEfficiency: 20,
|
||||
color: '#FA8616',
|
||||
bgColor: 'linear-gradient(180deg, #FA8316 0%, #FAAD16 100%)',
|
||||
},
|
||||
{
|
||||
name: '压板缺陷检测',
|
||||
type: 5,
|
||||
proportion: 32,
|
||||
pretreatmentEfficiency: 38,
|
||||
color: '#F9DB18',
|
||||
bgColor: 'linear-gradient(180deg, #FFC56F 0%, #F9E006 100%)',
|
||||
},
|
||||
{
|
||||
name: '划伤缺陷检测',
|
||||
type: 4,
|
||||
proportion: 8,
|
||||
pretreatmentEfficiency: 38,
|
||||
color: '#1CCCFA',
|
||||
bgColor: 'linear-gradient(180deg, #6FFFFF 0%, #06BEF9 100%)',
|
||||
},
|
||||
{
|
||||
name: '披锋(毛刺)缺陷检测',
|
||||
type: 3,
|
||||
proportion: 12,
|
||||
pretreatmentEfficiency: 38,
|
||||
color: '#9E26EE',
|
||||
bgColor: 'linear-gradient(180deg, #FF2494 0%, #8D27FF 100%)',
|
||||
},
|
||||
{
|
||||
name: '工件尺寸测量',
|
||||
type: 2,
|
||||
proportion: 7,
|
||||
pretreatmentEfficiency: 38,
|
||||
color: '#6F50F6',
|
||||
bgColor: 'linear-gradient(180deg, #6B55F6 0%, #8C38F8 100%)',
|
||||
},
|
||||
{
|
||||
name: '打孔不良检测',
|
||||
type: 1,
|
||||
proportion: 5,
|
||||
pretreatmentEfficiency: 38,
|
||||
color: '#24ED75',
|
||||
bgColor: 'linear-gradient(180deg, #43EA80 0%, #38F8D4 100%)',
|
||||
},
|
||||
{
|
||||
name: '空闲算力',
|
||||
type: 0,
|
||||
proportion: 10,
|
||||
pretreatmentEfficiency: 0,
|
||||
color: '#DCDCDC',
|
||||
bgColor: 'linear-gradient(90deg, #7B7979 0%, #C1C1C1 100%)',
|
||||
},
|
||||
];
|
||||
|
||||
// export const powerGroupListData = {
|
||||
// data: groupList,
|
||||
// };
|
||||
|
||||
// export const powerPoolsListData = {
|
||||
// data: poolsData,
|
||||
// };
|
@ -1,350 +0,0 @@
|
||||
/*
|
||||
* @Author: donghao donghao@supervision.ltd
|
||||
* @Date: 2024-04-23 17:46:28
|
||||
* @LastEditors: donghao donghao@supervision.ltd
|
||||
* @LastEditTime: 2024-05-16 15:28:12
|
||||
* @FilePath: \general-ai-platform-web\src\pages\Project\BusinessInfo\components\updateForm.tsx
|
||||
* @Description: 修改企业信息
|
||||
*/
|
||||
import { useCity } from '@/hooks/useCity';
|
||||
import { beforeUploadImage } from '@/utils/common';
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
// ProFormDependency,
|
||||
ProFormUploadButton,
|
||||
} from '@ant-design/pro-components';
|
||||
import { FormattedMessage, useIntl } from '@umijs/max';
|
||||
import { Form } from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
proFormSmallItemStyleProps,
|
||||
proFormSmallModelWidth,
|
||||
} from '../../../../../config/defaultForm';
|
||||
// @ts-ignore
|
||||
import cookie from 'react-cookies';
|
||||
export type FormValueType = {
|
||||
target?: string;
|
||||
template?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
frequency?: string;
|
||||
} & Partial<API.ModelCategory>;
|
||||
export type UpdateFormProps = {
|
||||
updateModalOpen: boolean;
|
||||
handleModal: () => void;
|
||||
values: Partial<API.ModelCategory>;
|
||||
reload: any;
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
// const [isAuto, setIsAuto] = useState(true);
|
||||
const [form] = Form.useForm<API.ModelCategory>();
|
||||
const [cityOptions, setCityOptions] = useState<Record<string, any>[]>([]);
|
||||
const { formatProvinceByData, formatCityByProvinceData } = useCity();
|
||||
function changeCity(record1, record2) {
|
||||
// 汇总城市数据到表单
|
||||
console.log(record1, record2, 'changeProvince_record');
|
||||
}
|
||||
|
||||
return (
|
||||
<ModalForm<API.ModelCategory>
|
||||
className="gn_form gn_modal_form"
|
||||
width={proFormSmallModelWidth}
|
||||
title={intl.formatMessage({
|
||||
id: 'business.list.table.createForm.title',
|
||||
defaultMessage: '新建',
|
||||
})}
|
||||
open={props.updateModalOpen}
|
||||
form={form}
|
||||
autoFocusFirstInput
|
||||
modalProps={{
|
||||
destroyOnClose: true,
|
||||
onCancel: () => props.handleModal(),
|
||||
}}
|
||||
submitTimeout={2000}
|
||||
onFinish={async (values) => {
|
||||
console.log(values, 'add_finish_values');
|
||||
// TODO 对接更新接口
|
||||
// postModelCategoryCreateModelCategory(values)
|
||||
// .then(() => {
|
||||
// message.success(intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }));
|
||||
// props.reload();
|
||||
// })
|
||||
// .catch(() => {
|
||||
// message.error(intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }));
|
||||
// });
|
||||
props.handleModal();
|
||||
return true;
|
||||
}}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
name="name"
|
||||
label={<FormattedMessage id="business.list.table.form.name" defaultMessage="名称" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.name',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.name}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.name"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<ProFormSelect
|
||||
width={proFormSmallItemStyleProps.column2Width / 2 - 8}
|
||||
name="province"
|
||||
label={<FormattedMessage id="business.list.table.form.province" defaultMessage="省份" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_select',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.province',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.province}
|
||||
required={true}
|
||||
showSearch
|
||||
debounceTime={500}
|
||||
request={() => {
|
||||
const respDataList = formatProvinceByData();
|
||||
// 初始化有省份数据,默认加载当前省份的城市数据
|
||||
if (props.values.province) {
|
||||
respDataList.forEach((item) => {
|
||||
if (props.values.province === item.value) {
|
||||
setCityOptions(() => formatCityByProvinceData(item));
|
||||
}
|
||||
});
|
||||
}
|
||||
return respDataList;
|
||||
}}
|
||||
onChange={(_, record2) => {
|
||||
form.setFieldValue('city', null); // 先清空城市
|
||||
setCityOptions(() => formatCityByProvinceData(record2));
|
||||
}}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.province"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
width={proFormSmallItemStyleProps.column2Width / 2 - 8}
|
||||
name="city"
|
||||
label={<FormattedMessage id="business.list.table.form.city" defaultMessage="城市" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_select',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.city',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.city}
|
||||
required={true}
|
||||
showSearch
|
||||
debounceTime={500}
|
||||
options={cityOptions}
|
||||
onChange={changeCity}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.city"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
width={proFormSmallItemStyleProps.column2Width}
|
||||
name="address"
|
||||
label={<FormattedMessage id="business.list.table.form.address" defaultMessage="地址" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.address',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.address}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.address"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
name="industry"
|
||||
label={<FormattedMessage id="business.list.table.form.industry" defaultMessage="行业" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.industry',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.industry}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.industry"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
name="contacts"
|
||||
label={
|
||||
<FormattedMessage id="business.list.table.form.contacts" defaultMessage="联系人" />
|
||||
}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.contacts',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.contacts}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.contacts"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
name="contactWay"
|
||||
label={
|
||||
<FormattedMessage id="business.list.table.form.contactWay" defaultMessage="联系方式" />
|
||||
}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.contactWay',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.contactWay}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.contactWay"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormTextArea
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
name="remark"
|
||||
label={<FormattedMessage id="business.list.table.form.remark" defaultMessage="简介" />}
|
||||
placeholder={`${intl.formatMessage({
|
||||
id: 'common.please_input',
|
||||
defaultMessage: '$$$',
|
||||
})}${intl.formatMessage({
|
||||
id: 'business.list.table.form.remark',
|
||||
defaultMessage: '$$$',
|
||||
})}`}
|
||||
initialValue={props.values.remark}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.remark"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
disabled={false}
|
||||
/>
|
||||
{/* // TODO level3 按UI实际效果调整上传logo & 改用上传base64格式编码 换手动上传 */}
|
||||
<ProFormUploadButton
|
||||
width={proFormSmallItemStyleProps.width}
|
||||
max={1}
|
||||
action="/api/v1/file/uploadImage"
|
||||
name="logo"
|
||||
label={<FormattedMessage id="business.list.table.form.logo" defaultMessage="logo" />}
|
||||
fieldProps={{
|
||||
name: 'file',
|
||||
listType: 'picture-card',
|
||||
beforeUpload: beforeUploadImage,
|
||||
data: { path: 'user/avatar' },
|
||||
headers: {
|
||||
'X-CSRFToken': cookie.load('csrftoken'),
|
||||
'X-Token': `${localStorage.getItem('access') || ''}`,
|
||||
},
|
||||
}}
|
||||
initialValue={props.values.logo}
|
||||
required={true}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="business.list.table.form.rule.required.logo"
|
||||
defaultMessage="name is required"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default UpdateForm;
|
Loading…
Reference in New Issue