Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
2663914e
Commit
2663914e
authored
Jun 08, 2020
by
满振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据
parent
ba12ccad
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
114 additions
and
3 deletions
+114
-3
setFormatter.tsx
...onents/apolloTable/component/base/_utils/setFormatter.tsx
+10
-0
config.tsx
components/apolloTable/component/base/config.tsx
+10
-0
index.tsx
components/apolloTable/component/base/detail/index.tsx
+2
-0
index.less
...nents/apolloTable/component/base/detail/region/index.less
+6
-0
index.tsx
...onents/apolloTable/component/base/detail/region/index.tsx
+14
-0
index.ts
components/apolloTable/component/base/edit/index.ts
+2
-0
_utils.ts
components/apolloTable/component/base/edit/region/_utils.ts
+24
-0
index.tsx
components/apolloTable/component/base/edit/region/index.tsx
+42
-0
index.tsx
components/apolloTable/editFormV3/index.tsx
+4
-3
No files found.
components/apolloTable/component/base/_utils/setFormatter.tsx
View file @
2663914e
...
@@ -185,4 +185,14 @@ export const SetFormatter = {
...
@@ -185,4 +185,14 @@ export const SetFormatter = {
}
}
return
val
;
return
val
;
},
},
REGION
:
(
val
)
=>
{
if
(
!
val
||
!
Array
.
isArray
(
val
))
return
val
;
const
textArr
:
any
=
[];
const
valueArr
:
any
=
[];
val
.
forEach
((
ls
:
any
)
=>
{
textArr
.
push
(
ls
.
label
);
valueArr
.
push
(
ls
.
value
);
});
return
[{
text
:
textArr
.
filter
((
ls
)
=>
{
return
ls
;
}).
join
(
'-'
),
value
:
valueArr
.
filter
((
ls
)
=>
{
return
ls
;
}).
join
(
'-'
)
}];
},
};
};
components/apolloTable/component/base/config.tsx
View file @
2663914e
...
@@ -20,6 +20,7 @@ import {
...
@@ -20,6 +20,7 @@ import {
ApolloUpload
,
ApolloUpload
,
ApolloTextArea
,
ApolloTextArea
,
ApolloDateRange
,
ApolloDateRange
,
ApolloRegion
,
}
from
'./edit'
;
}
from
'./edit'
;
import
{
import
{
ApolloInputDetail
,
ApolloInputDetail
,
...
@@ -40,6 +41,7 @@ import {
...
@@ -40,6 +41,7 @@ import {
ApolloUploadDetail
,
ApolloUploadDetail
,
ApolloDateRangeDetail
,
ApolloDateRangeDetail
,
ApolloTextLinkDetail
,
ApolloTextLinkDetail
,
ApolloRegionDetail
,
}
from
'./detail'
;
}
from
'./detail'
;
import
CellContainer
from
'./edit/container'
;
import
CellContainer
from
'./edit/container'
;
...
@@ -250,4 +252,12 @@ export const config: any = {
...
@@ -250,4 +252,12 @@ export const config: any = {
detailComp
:
ApolloDateRangeDetail
,
detailComp
:
ApolloDateRangeDetail
,
icon
:
'iconziduan-riqi'
,
icon
:
'iconziduan-riqi'
,
},
},
22
:
{
name
:
'地区选择控件'
,
editComp
:
ApolloRegion
,
detailComp
:
ApolloRegionDetail
,
setFormatter
:
SetFormatter
.
REGION
,
// getFormatter: GetFormatter.REGION,
icon
:
'iconziduan-lianxiangdanxuan'
,
},
};
};
components/apolloTable/component/base/detail/index.tsx
View file @
2663914e
...
@@ -16,6 +16,7 @@ import { ApolloTreeSelectDetail } from './tree-select';
...
@@ -16,6 +16,7 @@ import { ApolloTreeSelectDetail } from './tree-select';
import
{
ApolloUploadDetail
}
from
'./upload'
;
import
{
ApolloUploadDetail
}
from
'./upload'
;
import
{
ApolloDateRangeDetail
}
from
'./dateRange'
;
import
{
ApolloDateRangeDetail
}
from
'./dateRange'
;
import
{
ApolloTextLinkDetail
}
from
'./text-link'
;
import
{
ApolloTextLinkDetail
}
from
'./text-link'
;
import
{
ApolloRegionDetail
}
from
'./region'
;
export
{
export
{
ApolloInputDetail
,
ApolloInputDetail
,
...
@@ -36,4 +37,5 @@ export {
...
@@ -36,4 +37,5 @@ export {
ApolloUploadDetail
,
ApolloUploadDetail
,
ApolloDateRangeDetail
,
ApolloDateRangeDetail
,
ApolloTextLinkDetail
,
ApolloTextLinkDetail
,
ApolloRegionDetail
,
};
};
components/apolloTable/component/base/detail/region/index.less
0 → 100644
View file @
2663914e
.text {
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
components/apolloTable/component/base/detail/region/index.tsx
0 → 100644
View file @
2663914e
import
React
from
'react'
;
import
styles
from
'./index.less'
;
export
const
ApolloRegionDetail
=
(
props
)
=>
{
const
{
value
}
=
props
;
if
(
typeof
value
===
'object'
)
{
if
(
Array
.
isArray
(
value
))
{
const
text
=
value
[
0
]
&&
value
[
0
].
text
;
return
<
div
className=
{
styles
.
text
}
>
{
text
}
</
div
>;
}
}
return
'数据错误'
;
};
components/apolloTable/component/base/edit/index.ts
View file @
2663914e
...
@@ -15,6 +15,7 @@ import { ApolloTextArea } from './textarea';
...
@@ -15,6 +15,7 @@ import { ApolloTextArea } from './textarea';
import
{
ApolloTreeSelect
}
from
'./tree-select'
;
import
{
ApolloTreeSelect
}
from
'./tree-select'
;
import
{
ApolloUpload
}
from
'./upload'
;
import
{
ApolloUpload
}
from
'./upload'
;
import
{
ApolloDateRange
}
from
'./dateRange'
;
import
{
ApolloDateRange
}
from
'./dateRange'
;
import
ApolloRegion
from
'./region'
;
export
{
export
{
ApolloInput
,
ApolloInput
,
...
@@ -34,4 +35,5 @@ export {
...
@@ -34,4 +35,5 @@ export {
ApolloUpload
,
ApolloUpload
,
ApolloTextArea
,
ApolloTextArea
,
ApolloDateRange
,
ApolloDateRange
,
ApolloRegion
,
};
};
components/apolloTable/component/base/edit/region/_utils.ts
0 → 100644
View file @
2663914e
export
const
getCityOps
=
([
pId
,
cityId
,
countyId
]:
any
,
citys
)
=>
{
const
priviceObj
=
citys
.
find
((
ls
:
any
)
=>
{
return
ls
.
value
===
pId
;
})
||
{};
const
cityObj
=
(
priviceObj
.
children
||
[]).
find
((
ls
:
any
)
=>
{
return
ls
.
value
===
cityId
;
})
||
{};
const
countryObj
=
(
cityObj
.
children
||
[]).
find
((
ls
:
any
)
=>
{
return
ls
.
value
===
countyId
;
})
||
{};
return
[
priviceObj
,
cityObj
,
countryObj
].
filter
((
ls
:
any
)
=>
{
return
ls
&&
ls
.
value
;
}).
map
((
ls
)
=>
{
return
{
value
:
ls
.
code
,
label
:
ls
.
label
};
});
};
export
const
formateCity
=
(
arr
:
any
)
=>
{
if
(
!
arr
||
arr
.
length
===
0
)
return
[];
return
arr
.
map
((
ls
:
any
)
=>
{
if
(
ls
.
cityList
||
ls
.
areaList
)
{
return
{
...
ls
,
label
:
ls
.
name
,
value
:
ls
.
code
,
children
:
formateCity
(
ls
.
cityList
||
ls
.
areaList
),
};
}
return
{
...
ls
,
label
:
ls
.
name
,
value
:
ls
.
code
,
};
});
};
components/apolloTable/component/base/edit/region/index.tsx
0 → 100644
View file @
2663914e
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Cascader
}
from
'antd'
;
import
{
getCitys
}
from
'@/services/api'
;
import
{
formateCity
,
getCityOps
}
from
'./_utils'
;
const
formateVal
=
(
value
)
=>
{
if
(
!
Array
.
isArray
(
value
))
return
[];
return
value
.
map
((
ls
)
=>
{
return
ls
.
value
;
});
};
const
Picker
=
(
props
)
=>
{
const
[
citys
,
saveCitys
]
=
useState
([]);
const
[
val
,
saveVal
]
=
useState
(
formateVal
(
props
.
value
));
useEffect
(()
=>
{
saveVal
(
formateVal
(
props
.
value
));
},
[
props
.
value
]);
const
getAllCity
=
async
()
=>
{
if
(
citys
&&
citys
.
length
>
0
)
return
;
let
city
=
await
getCitys
();
city
=
Array
.
isArray
(
city
)
?
city
:
[];
city
=
formateCity
(
city
);
saveCitys
(
city
);
};
const
onChange
=
(
v
)
=>
{
const
val
=
getCityOps
(
v
,
citys
);
if
(
props
.
onChange
)
{
props
.
onChange
(
val
);
}
};
const
onFocus
=
()
=>
{
getAllCity
();
};
return
(
<
Cascader
placeholder=
"请选择"
{
...
props
}
value=
{
val
}
options=
{
citys
}
onChange=
{
onChange
}
onFocus=
{
onFocus
}
/>
);
};
export
default
Picker
;
components/apolloTable/editFormV3/index.tsx
View file @
2663914e
...
@@ -29,14 +29,15 @@ class FormWrap extends Component {
...
@@ -29,14 +29,15 @@ class FormWrap extends Component {
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
const
newValues
:
any
[]
=
[];
const
newValues
:
any
[]
=
[];
debugger
_
.
keys
(
values
).
map
((
key
)
=>
{
_
.
keys
(
values
).
map
((
key
)
=>
{
const
item
=
data
.
find
((
temp
:
any
)
=>
{
const
item
=
data
.
find
((
temp
:
any
)
=>
{
return
temp
.
columnName
===
key
;
return
temp
.
columnName
===
key
;
});
});
const
{
columnType
,
renderEditForm
,
readOnlyFlag
,
dynamicCellConfigDTO
}
=
item
;
const
{
columnType
,
renderEditForm
,
readOnlyFlag
,
dynamicCellConfigDTO
}
=
item
;
if
(
readOnlyFlag
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
))
{
//
if (readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) {
return
;
//
return;
}
//
}
let
detailConfig
:
any
;
let
detailConfig
:
any
;
if
(
typeof
renderEditForm
===
'function'
)
{
if
(
typeof
renderEditForm
===
'function'
)
{
detailConfig
=
renderEditForm
({
cellData
:
values
[
key
],
rowData
,
columnConfig
:
item
});
detailConfig
=
renderEditForm
({
cellData
:
values
[
key
],
rowData
,
columnConfig
:
item
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment