Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
bd865d19
Commit
bd865d19
authored
Jul 14, 2023
by
guang.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加ProTable示例
parent
6bd5a22d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
199 additions
and
0 deletions
+199
-0
groupMealRoute.js
config/groupMealRoute.js
+6
-0
index.jsx
src/example/proTable/index.jsx
+72
-0
service.js
src/example/proTable/service.js
+15
-0
staticData.js
src/example/proTable/staticData.js
+106
-0
No files found.
config/groupMealRoute.js
View file @
bd865d19
...
...
@@ -41,4 +41,10 @@ export default [
name
:
'
EmployeeManagement
'
,
component
:
'
./EmployeeManagement
'
,
},
{
title
:
'
商户管理后台-企业团餐-外卖商品(示例)
'
,
path
:
'
/takeawayGoodsExample
'
,
name
:
'
TakeawayGoodsExample
'
,
component
:
'
../example/proTable
'
,
},
];
src/example/proTable/index.jsx
0 → 100644
View file @
bd865d19
import
React
,
{
useState
,
useRef
}
from
'
react
'
;
import
{
ProTable
}
from
'
@ant-design/pro-components
'
;
import
{
Button
}
from
'
antd
'
;
import
{
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
{
customerColumn
}
from
'
./staticData
'
;
import
CustomerInfo
from
'
@/example/proForm/ModalForm/index
'
;
import
utilStyle
from
'
@/utils/utils.less
'
;
import
{
stringOrObjectTrim
}
from
'
@/utils/utils
'
;
import
{
apiEnterpriseList
}
from
'
./service
'
;
const
BusinessCustomer
=
()
=>
{
const
refTable
=
useRef
();
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
id
,
setId
]
=
useState
(
''
);
const
query
=
async
params
=>
{
const
data
=
{
page
:
params
.
current
,
size
:
params
.
pageSize
,
data
:
stringOrObjectTrim
(
params
),
};
const
res
=
await
apiEnterpriseList
(
data
);
return
{
data
:
res
.
data
.
records
,
total
:
res
.
data
.
total
,
};
};
const
onEdit
=
v
=>
{
setId
(
v
);
setVisible
(
true
);
};
const
onClose
=
refresh
=>
{
console
.
log
(
3
);
setVisible
(
false
);
refresh
&&
refTable
.
current
.
reload
();
};
return
(
<
div
className=
{
utilStyle
.
formPageBox
}
>
<
ProTable
actionRef=
{
refTable
}
search=
{
{
span
:
8
,
className
:
utilStyle
.
formSearch
,
collapsed
:
false
,
collapseRender
:
()
=>
null
,
}
}
columns=
{
customerColumn
({
onEdit
})
}
request=
{
params
=>
query
({
...
params
})
}
rowKey=
{
r
=>
r
.
id
}
bordered
options=
{
false
}
toolBarRender=
{
()
=>
[
<
Button
key=
"add"
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
onClick=
{
()
=>
{
setId
(
''
);
setVisible
(
!
0
);
}
}
>
添加企业客户
</
Button
>,
]
}
/>
{
visible
&&
<
CustomerInfo
visible=
{
visible
}
id=
{
id
}
onClose=
{
onClose
}
/>
}
</
div
>
);
};
export
default
BusinessCustomer
;
src/example/proTable/service.js
0 → 100644
View file @
bd865d19
import
request
from
'
@/utils/request
'
;
import
config
from
'
@/../config/env.config
'
;
const
{
roleApi
,
apiPrefix
}
=
config
;
/**
* 获取企业客户列表
* http://yapi.quantgroups.com/project/389/interface/api/65324
*/
export
async
function
apiEnterpriseList
(
data
)
{
return
request
.
post
(
`
${
apiPrefix
}
/enterprise/pageList`
,
{
data
,
prefix
:
roleApi
,
});
}
src/example/proTable/staticData.js
0 → 100644
View file @
bd865d19
import
React
from
'
react
'
;
import
{
Button
}
from
'
antd
'
;
export
const
layout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
};
// 餐品类型:(1外卖 2 自助餐 4到店)
export
const
mealType
=
{
1
:
'
外卖
'
,
2
:
'
自助餐
'
,
4
:
'
到店
'
,
};
export
const
infoOptions
=
[
{
label
:
'
商品价格及图片
'
,
value
:
1
},
{
label
:
'
仅商品价格
'
,
value
:
2
},
{
label
:
'
仅商品图片
'
,
value
:
3
},
{
label
:
'
均不展示
'
,
value
:
4
},
];
export
const
boolOptions
=
[{
label
:
'
是
'
,
value
:
1
},
{
label
:
'
否
'
,
value
:
0
}];
export
const
hideOptions
=
[
{
label
:
'
隐藏商品价格
'
,
value
:
'
hidePrice
'
},
{
label
:
'
隐藏商品图片
'
,
value
:
'
hideImage
'
},
];
export
const
mealSections
=
{
1
:
'
早餐
'
,
2
:
'
午餐
'
,
4
:
'
晚餐
'
,
};
// 企业列表字段
export
const
customerColumn
=
options
=>
{
const
{
onEdit
}
=
options
;
return
[
{
title
:
'
ID
'
,
dataIndex
:
'
enterpriseId
'
,
hideInTable
:
true
,
},
{
title
:
'
ID
'
,
dataIndex
:
'
id
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
{
title
:
'
公司名称
'
,
dataIndex
:
'
name
'
,
width
:
120
,
align
:
'
center
'
,
},
{
title
:
'
截单时间(分钟)
'
,
dataIndex
:
'
endOrderTime
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
{
title
:
'
餐品类型
'
,
dataIndex
:
'
mealType
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
render
(
types
)
{
if
(
types
&&
types
.
length
&&
typeof
types
===
'
object
'
)
{
const
arr
=
types
.
map
(
meal
=>
mealType
[
meal
]);
return
arr
.
join
(
'
/
'
);
}
return
'
-
'
;
},
},
{
title
:
'
创建人
'
,
dataIndex
:
'
createdBy
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
{
title
:
'
创建时间
'
,
dataIndex
:
'
createdAt
'
,
width
:
120
,
align
:
'
center
'
,
hideInSearch
:
true
,
},
{
title
:
'
操作
'
,
hideInSearch
:
true
,
dataIndex
:
'
action
'
,
width
:
200
,
align
:
'
center
'
,
fixed
:
'
right
'
,
render
:
(
val
,
r
)
=>
(
<
Button
key
=
"
edit
"
onClick
=
{()
=>
onEdit
(
r
.
id
)}
>
编辑
<
/Button
>
),
},
];
};
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