refactor: 统一代码风格并迁移至 ESLint 新配置
style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
This commit is contained in:
@@ -12,7 +12,13 @@ import {
|
||||
InputNumber,
|
||||
Switch,
|
||||
} from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
PlusCircleOutlined,
|
||||
MinusCircleOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import axios from 'axios';
|
||||
import CloseButton from '../components/CloseButton';
|
||||
|
||||
@@ -37,44 +43,46 @@ const OptionsEditor = ({ value, onChange }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
border: '1px solid #e8e8e8',
|
||||
borderRadius: '12px',
|
||||
padding: '20px',
|
||||
background: 'linear-gradient(135deg, #fafbfc 0%, #f5f7fa 100%)',
|
||||
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.04)',
|
||||
}}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
marginBottom: '16px',
|
||||
gap: '8px',
|
||||
}}>
|
||||
<div style={{
|
||||
width: '4px',
|
||||
height: '16px',
|
||||
background: 'linear-gradient(180deg, #667eea 0%, #764ba2 100%)',
|
||||
borderRadius: '2px',
|
||||
}}/>
|
||||
<span style={{ color: '#333', fontSize: '14px', fontWeight: '600' }}>
|
||||
选项配置
|
||||
</span>
|
||||
<span style={{ color: '#999', fontSize: '12px' }}>
|
||||
(值用于提交,标签用于显示)
|
||||
</span>
|
||||
<div
|
||||
style={{
|
||||
border: '1px solid #e8e8e8',
|
||||
borderRadius: '12px',
|
||||
padding: '20px',
|
||||
background: 'linear-gradient(135deg, #fafbfc 0%, #f5f7fa 100%)',
|
||||
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.04)',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
marginBottom: '16px',
|
||||
gap: '8px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '4px',
|
||||
height: '16px',
|
||||
background: 'linear-gradient(180deg, #667eea 0%, #764ba2 100%)',
|
||||
borderRadius: '2px',
|
||||
}}
|
||||
/>
|
||||
<span style={{ color: '#333', fontSize: '14px', fontWeight: '600' }}>选项配置</span>
|
||||
<span style={{ color: '#999', fontSize: '12px' }}>(值用于提交,标签用于显示)</span>
|
||||
</div>
|
||||
|
||||
{options.length === 0 ? (
|
||||
<div style={{
|
||||
textAlign: 'center',
|
||||
padding: '24px',
|
||||
background: '#fff',
|
||||
borderRadius: '8px',
|
||||
border: '1px dashed #d9d9d9',
|
||||
}}>
|
||||
<div style={{ color: '#bbb', fontSize: '14px', marginBottom: '12px' }}>
|
||||
暂无选项
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
padding: '24px',
|
||||
background: '#fff',
|
||||
borderRadius: '8px',
|
||||
border: '1px dashed #d9d9d9',
|
||||
}}
|
||||
>
|
||||
<div style={{ color: '#bbb', fontSize: '14px', marginBottom: '12px' }}>暂无选项</div>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<PlusCircleOutlined />}
|
||||
@@ -90,15 +98,23 @@ const OptionsEditor = ({ value, onChange }) => {
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px', marginBottom: '16px' }}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: '12px',
|
||||
padding: '0 4px',
|
||||
marginBottom: '4px',
|
||||
}}>
|
||||
<span style={{ width: '160px', color: '#666', fontSize: '12px', fontWeight: '500' }}>值(value)</span>
|
||||
<span style={{ width: '160px', color: '#666', fontSize: '12px', fontWeight: '500' }}>标签(label)</span>
|
||||
<div
|
||||
style={{ display: 'flex', flexDirection: 'column', gap: '10px', marginBottom: '16px' }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
gap: '12px',
|
||||
padding: '0 4px',
|
||||
marginBottom: '4px',
|
||||
}}
|
||||
>
|
||||
<span style={{ width: '160px', color: '#666', fontSize: '12px', fontWeight: '500' }}>
|
||||
值(value)
|
||||
</span>
|
||||
<span style={{ width: '160px', color: '#666', fontSize: '12px', fontWeight: '500' }}>
|
||||
标签(label)
|
||||
</span>
|
||||
</div>
|
||||
{value.map((opt, index) => (
|
||||
<div
|
||||
@@ -114,19 +130,21 @@ const OptionsEditor = ({ value, onChange }) => {
|
||||
transition: 'all 0.2s ease',
|
||||
}}
|
||||
>
|
||||
<div style={{
|
||||
width: '24px',
|
||||
height: '24px',
|
||||
borderRadius: '50%',
|
||||
background: 'linear-gradient(135deg, #667eea20 0%, #764ba220 100%)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
color: '#667eea',
|
||||
fontSize: '12px',
|
||||
fontWeight: '600',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
width: '24px',
|
||||
height: '24px',
|
||||
borderRadius: '50%',
|
||||
background: 'linear-gradient(135deg, #667eea20 0%, #764ba220 100%)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
color: '#667eea',
|
||||
fontSize: '12px',
|
||||
fontWeight: '600',
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
{index + 1}
|
||||
</div>
|
||||
<Input
|
||||
@@ -432,11 +450,7 @@ function TicketFieldManagement() {
|
||||
<OptionsEditor />
|
||||
</Form.Item>
|
||||
) : (
|
||||
<Form.Item
|
||||
name="options"
|
||||
label="选项配置"
|
||||
tooltip="仅下拉选择类型需要配置选项"
|
||||
>
|
||||
<Form.Item name="options" label="选项配置" tooltip="仅下拉选择类型需要配置选项">
|
||||
<Input.TextArea
|
||||
rows={2}
|
||||
placeholder="仅下拉选择类型需要配置,此处不可编辑"
|
||||
|
||||
Reference in New Issue
Block a user