|
@@ -26,26 +26,30 @@ interface StageSettingsType {
|
|
|
id: React.Key
|
|
|
name?: string
|
|
|
stage?: string
|
|
|
+ isDefault?: boolean
|
|
|
percentage?: number
|
|
|
}
|
|
|
|
|
|
const defaultData = [
|
|
|
{
|
|
|
- id: 1,
|
|
|
+ id: 624748504,
|
|
|
stage: '结束',
|
|
|
name: '赢单',
|
|
|
+ isDefault: true,
|
|
|
percentage: '100'
|
|
|
},
|
|
|
{
|
|
|
- id: 2,
|
|
|
+ id: 624691229,
|
|
|
stage: '结束',
|
|
|
- name: '赢单',
|
|
|
+ name: '输单',
|
|
|
+ isDefault: true,
|
|
|
percentage: '0'
|
|
|
},
|
|
|
{
|
|
|
- id: 3,
|
|
|
+ id: 624691258,
|
|
|
stage: '结束',
|
|
|
name: '无效',
|
|
|
+ isDefault: true,
|
|
|
percentage: '0'
|
|
|
}
|
|
|
]
|
|
@@ -67,17 +71,19 @@ const Contact: React.FC = () => {
|
|
|
{
|
|
|
title: '阶段',
|
|
|
dataIndex: 'stage',
|
|
|
- width: '15%'
|
|
|
+ width: '15%',
|
|
|
+ // 第二行不允许编辑
|
|
|
+ editable: false
|
|
|
},
|
|
|
{
|
|
|
title: '阶段名称',
|
|
|
dataIndex: 'name',
|
|
|
- width: '45%'
|
|
|
+ width: '28%'
|
|
|
},
|
|
|
{
|
|
|
title: '赢单率',
|
|
|
dataIndex: 'percentage',
|
|
|
- width: '30%',
|
|
|
+ width: '27%',
|
|
|
valueType: 'text',
|
|
|
fieldProps: {
|
|
|
addonAfter: '%'
|
|
@@ -86,7 +92,28 @@ const Contact: React.FC = () => {
|
|
|
{
|
|
|
title: '操作',
|
|
|
valueType: 'option',
|
|
|
- width: '10%'
|
|
|
+ width: '20%',
|
|
|
+ render: (text, record, index, action) => {
|
|
|
+ if (record.isDefault) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ <a
|
|
|
+ key="editable"
|
|
|
+ onClick={() => {
|
|
|
+ action?.startEditable?.(record.id)
|
|
|
+ }}>
|
|
|
+ 编辑
|
|
|
+ </a>,
|
|
|
+ <a
|
|
|
+ key="delete"
|
|
|
+ onClick={() => {
|
|
|
+ setDataSource(dataSource.filter(item => item.id !== record.id))
|
|
|
+ }}>
|
|
|
+ 删除
|
|
|
+ </a>
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
const { run: tryGetList } = useRequest(getBusinessgroupList, {
|
|
@@ -224,12 +251,12 @@ const Contact: React.FC = () => {
|
|
|
if (state.type === modalType.CREATE) {
|
|
|
await tryAddBusinessgroup({
|
|
|
...value,
|
|
|
- stageSettings: JSON.stringify(value.stageSettings)
|
|
|
+ stageSettings: JSON.stringify(value.stageSettings.filter(item => !item.isDefault))
|
|
|
})
|
|
|
} else {
|
|
|
await tryUpdateBusinessGroup({
|
|
|
...value,
|
|
|
- stageSettings: JSON.stringify(value.stageSettings)
|
|
|
+ stageSettings: JSON.stringify(value.stageSettings.filter(item => !item.isDefault))
|
|
|
})
|
|
|
}
|
|
|
return true
|
|
@@ -254,10 +281,9 @@ const Contact: React.FC = () => {
|
|
|
columns={columns}
|
|
|
recordCreatorProps={{
|
|
|
newRecordType: 'dataSource',
|
|
|
- position: 'top',
|
|
|
- record: index => ({
|
|
|
- id: Date.now(),
|
|
|
- stage: `阶段${index - 2}`
|
|
|
+ position: 'bottom',
|
|
|
+ record: () => ({
|
|
|
+ id: Date.now()
|
|
|
})
|
|
|
}}
|
|
|
editable={{
|