@@ -5,75 +5,75 @@ import KeyOutlined from '@ant-design/icons/lib/icons/KeyOutlined';
55import { PageHeaderWrapper } from '@ant-design/pro-layout' ;
66import ProTable from 'mtianyan-pro-table' ;
77import CreateForm from './components/CreateForm' ;
8- import { add > > MODEL_NAME < < , query > > MODEL_NAME < < , remove > > MODEL_NAME < < , update > > MODEL_NAME < < , query > > MODEL_NAME < < VerboseName , query > > MODEL_NAME < < ListDisplay , query > > MODEL_NAME < < DisplayOrder } from './service' ;
8+ import { add > > MODEL_NAME < < , query > > MODEL_NAME < < , remove > > MODEL_NAME < < , update > > MODEL_NAME < < , query > > MODEL_NAME < < VerboseName , query > > MODEL_NAME < < ListDisplay , query > > MODEL_NAME < < DisplayOrder } from './service' ;
99import UpdateForm from './components/UpdateForm' ;
1010import UploadAvatar from '@/components/UploadAvatar' ;
1111>> IMPORT_PLACE <<
1212>> PASSWORD_FORM <<
1313import moment from 'moment' ;
14- const { Option} = Select ;
15- import { BooleanFormItem , dealManyToManyFieldTags , fileUpload , twoColumns , richForm , richCol , dealPureSelectField , orderForm , exportExcelCurrent , exportExcelAll , getUpdateColumns , dealRemoveError , dealError , BooleanDisplay , dealDateTimeDisplay , dealManyToManyField , dealTime , deepCopy , fieldErrorHandle , getTableColumns , renderManyToMany , richTrans , dealForeignKeyField , renderForeignKey , fieldsLevelErrorHandle } from '@/utils/utils' ;
14+ const { Option } = Select ;
15+ import { BooleanFormItem , dealManyToManyFieldTags , fileUpload , twoColumns , richForm , richCol , dealPureSelectField , orderForm , exportExcelCurrent , exportExcelAll , getUpdateColumns , dealRemoveError , dealError , BooleanDisplay , dealDateTimeDisplay , dealManyToManyField , dealTime , deepCopy , fieldErrorHandle , getTableColumns , renderManyToMany , richTrans , dealForeignKeyField , renderForeignKey , fieldsLevelErrorHandle } from '@/utils/utils' ;
1616import 'braft-editor/dist/index.css'
1717const FormItem = Form . Item ;
1818const TableList = ( ) => {
1919 const [ createModalVisible , handleModalVisible ] = useState ( false ) ;
2020 const [ updateModalVisible , handleUpdateModalVisible ] = useState ( false ) ;
21- >> PASSWORD_PLACE <<
21+ >> PASSWORD_PLACE <<
2222 const [ updateFormValues , setUpdateFormValues ] = useState ( { } ) ;
2323 const actionRef = useRef ( ) ;
2424 const addFormRef = useRef ( ) ;
2525 const updateFormRef = useRef ( ) ;
2626
2727 const handleAdd = async fields => {
28- const hide = message . loading ( '正在添加' ) ;
29-
30- try {
31- await add >> MODEL_NAME << ( { ...fields } ) ;
32- hide ( ) ;
33- message . success ( '添加成功' ) ;
34- return true ;
35- } catch ( error ) {
36- return dealError ( error , addFormRef , hide , "添加" ) ;
37- }
38- } ;
28+ const hide = message . loading ( '正在添加' ) ;
29+
30+ try {
31+ await add >> MODEL_NAME << ( { ...fields } ) ;
32+ hide ( ) ;
33+ message . success ( '添加成功' ) ;
34+ return true ;
35+ } catch ( error ) {
36+ return dealError ( error , addFormRef , hide , "添加" ) ;
37+ }
38+ } ;
3939
4040 const handleUpdate = async ( value , current_id ) => {
41- const hide = message . loading ( '正在修改' ) ;
42-
43- try {
44- await update >> MODEL_NAME << ( value , current_id ) ;
45- hide ( ) ;
46- message . success ( '修改成功' ) ;
47- return true ;
48- } catch ( error ) {
41+ const hide = message . loading ( '正在修改' ) ;
42+
43+ try {
44+ await update >> MODEL_NAME << ( value , current_id ) ;
45+ hide ( ) ;
46+ message . success ( '修改成功' ) ;
47+ return true ;
48+ } catch ( error ) {
4949 return dealError ( error , updateFormRef , hide , "修改" ) ;
5050 }
5151 } ;
5252
5353 const handleRemove = async selectedRows => {
54- const hide = message . loading ( '正在删除' ) ;
55- if ( ! selectedRows ) return true ;
56-
57- try {
58- const ids = selectedRows . map ( row => row . id ) . join ( ',' ) ;
59- await remove >> MODEL_NAME << ( ids ) ;
60- hide ( ) ;
61- message . success ( '删除成功' ) ;
62- return true ;
63- } catch ( error ) {
54+ const hide = message . loading ( '正在删除' ) ;
55+ if ( ! selectedRows ) return true ;
56+
57+ try {
58+ const ids = selectedRows . map ( row => row . id ) . join ( ',' ) ;
59+ await remove >> MODEL_NAME << ( ids ) ;
60+ hide ( ) ;
61+ message . success ( '删除成功' ) ;
62+ return true ;
63+ } catch ( error ) {
6464 hide ( )
6565 return dealRemoveError ( error , "删除" ) ;
66- }
67- } ;
68- >> UPDATE_PASSWORD_METHOD <<
66+ }
67+ } ;
68+ >> UPDATE_PASSWORD_METHOD <<
6969 const dateFieldList = [ >> TIME_PLACE << ]
7070 const base_columns = [ >> COLUMNS_LIST << ] ;
7171
7272 let cp = deepCopy ( base_columns ) ;
7373
7474 const [ formOrder , setFormOrder ] = useState ( [ ] ) ;
7575
76- useEffect ( ( ) => {
76+ useEffect ( ( ) => {
7777 query >> MODEL_NAME << DisplayOrder ( ) . then ( r => {
7878 setFormOrder ( r . form_order )
7979 } )
@@ -91,18 +91,17 @@ const TableList = () => {
9191
9292 const [ paramState , setParamState ] = useState ( { } ) ;
9393
94- useEffect ( ( ) => {
94+ useEffect ( ( ) => {
9595 query >> MODEL_NAME << ListDisplay ( ) . then ( value => {
9696 setColumnsStateMap ( value )
9797 } )
98- } , [ ] )
98+ } , [ ] )
9999
100100
101- >> FOREIGNKEY_PLACE <<
101+ >> FOREIGNKEY_PLACE <<
102102
103- $外键占位$
104103
105- >> MANY_TO_MANY_PLACE <<
104+ >> MANY_TO_MANY_PLACE <<
106105 return (
107106 < PageHeaderWrapper >
108107 < ProTable
@@ -121,10 +120,10 @@ $外键占位$
121120 < Button type = "primary" onClick = { ( ) => handleModalVisible ( true ) } >
122121 < PlusOutlined /> 新建
123122 </ Button > ,
124- < Button type = "primary" onClick = { ( ) => exportExcelAll ( paramState , query >> MODEL_NAME << , table_columns , '>>MODEL_VERBOSE_NAME<<-All' ) } >
123+ < Button type = "primary" onClick = { ( ) => exportExcelAll ( paramState , query >> MODEL_NAME << , table_columns , '>>MODEL_VERBOSE_NAME<<-All' ) } >
125124 < ExportOutlined /> 导出全部
126125 </ Button > ,
127- < Input . Search style = { { marginRight : 20 } } placeholder = "搜索>>MODEL_VERBOSE_NAME<< " onSearch = { value => {
126+ < Input . Search style = { { marginRight : 20 } } placeholder = "搜索>>MODEL_VERBOSE_NAME<<" onSearch = { value => {
128127 setParamState ( {
129128 search : value ,
130129 } ) ;
@@ -139,8 +138,8 @@ $外键占位$
139138 await handleRemove ( selectedRows ) ;
140139 actionRef . current . reloadAndRest ( ) ;
141140 }
142- else if ( e . key === 'export_current' ) {
143- exportExcelCurrent ( selectedRows , table_columns , '>>MODEL_VERBOSE_NAME<<-select' )
141+ else if ( e . key === 'export_current' ) {
142+ exportExcelCurrent ( selectedRows , table_columns , '>>MODEL_VERBOSE_NAME<<-select' )
144143 }
145144 } }
146145 selectedKeys = { [ ] }
@@ -170,7 +169,7 @@ $外键占位$
170169 </ div > : false
171170
172171 ) }
173- request = { ( params , sorter , filter ) => query >> MODEL_NAME << ( { ...params , sorter, filter} ) }
172+ request = { ( params , sorter , filter ) => query >> MODEL_NAME << ( { ...params , sorter, filter } ) }
174173 columns = { table_columns }
175174 rowSelection = { { } }
176175 />
@@ -227,7 +226,7 @@ $外键占位$
227226 rowSelection = { { } }
228227 />
229228 </ UpdateForm >
230- >> PASSWORD_UPDATE_FORM <<
229+ >> PASSWORD_UPDATE_FORM <<
231230 </ PageHeaderWrapper >
232231 ) ;
233232} ;
0 commit comments