123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import {
  2. PageContainer,
  3. ProForm,
  4. ProFormSelect,
  5. ProFormText,
  6. ProFormFieldSet,
  7. ProFormDateRangePicker,
  8. ProFormUploadButton,
  9. } from "@ant-design/pro-components";
  10. import { useNavigate, useSearchParams } from "react-router-dom";
  11. import { Card, Col, Row, Space } from "antd";
  12. import { useEffect, useRef } from "react";
  13. export default (props) => {
  14. const [searchParams] = useSearchParams();
  15. const id = searchParams.get("id");
  16. const navigate = useNavigate();
  17. const formRef = useRef();
  18. // useEffect(() => {
  19. // if (id) {
  20. // getPostsDetail(id).then((res) => {
  21. // formRef.current.setFieldsValue({
  22. // ...res,
  23. // filesList: res.filesList?.map((x) => x.fileAddr)[0] || null,
  24. // });
  25. // });
  26. // }
  27. // }, [id]);
  28. // const onFinish = async (values) => {
  29. // console.log(values);
  30. // savePosts({
  31. // ...values,
  32. // type: 'regulation',
  33. // filesList: values.filesList
  34. // ? [
  35. // {
  36. // fileAddr: values.filesList,
  37. // fileName: values.filesList?.substring(
  38. // values.filesList?.lastIndexOf("/") + 1
  39. // ),
  40. // },
  41. // ]
  42. // : null,
  43. // status: Number(values.status),
  44. // ...(id ? { id } : {}),
  45. // }).then((res) => {
  46. // navigate(-1);
  47. // });
  48. // return false;
  49. // };
  50. return (
  51. <PageContainer>
  52. <Card>
  53. <ProForm
  54. formRef={formRef}
  55. layout={"horizontal"}
  56. labelCol={{ span: 8 }}
  57. wrapperCol={{ span: 12 }}
  58. // onFinish={onFinish}
  59. initialValues={{ status: 0 }}
  60. submitter={{
  61. searchConfig: {
  62. resetText: "返回",
  63. },
  64. onReset: () => navigate(-1),
  65. render: (props, doms) => {
  66. return (
  67. <Row>
  68. <Col span={8} offset={8}>
  69. <Space>{doms}</Space>
  70. </Col>
  71. </Row>
  72. );
  73. },
  74. }}
  75. >
  76. <ProFormFieldSet
  77. name="addr"
  78. label="登记年份"
  79. >
  80. <ProFormSelect
  81. width={460}
  82. valueEnum={{
  83. taiyuan: '2019',
  84. hangzho: '2020',
  85. hangzh: '2021',
  86. hangz: '2022',
  87. }}
  88. />
  89. </ProFormFieldSet>
  90. <ProFormText
  91. name="createPerson"
  92. label="机构名称"
  93. width={460}
  94. />
  95. <ProFormText
  96. name="createPerson"
  97. label="工商注册证号"
  98. width={460}
  99. />
  100. <ProFormText
  101. name="createPerson"
  102. label="卫生许可证号"
  103. width={460}
  104. />
  105. <ProFormText
  106. name="createPerson"
  107. label="机构名称"
  108. width={460}
  109. />
  110. <ProFormText
  111. name="createPerson"
  112. label="供应商联系人"
  113. width={460}
  114. />
  115. <ProFormText
  116. name="createPerson"
  117. label="联系电话"
  118. width={460}
  119. />
  120. <ProFormDateRangePicker
  121. name="timeRange"
  122. label="签约时间"
  123. width={460}
  124. />
  125. <ProFormSelect
  126. width={460}
  127. name="select-multiple"
  128. label="机构类别"
  129. valueEnum={{
  130. red: '生鲜蔬菜类',
  131. green: '米面粮油类',
  132. blue: '饮食类',
  133. reds: '饮水类',
  134. greens: '住宿类',
  135. blues: '物资代储类',
  136. redss: '医疗救助类',
  137. greenss: '油料类',
  138. bluess: '道路施救类',
  139. bluesss: '其他',
  140. }}
  141. fieldProps={{
  142. mode: 'multiple',
  143. }}
  144. rules={[
  145. { type: 'array' },
  146. ]}
  147. />
  148. <ProFormText
  149. name="createPerson"
  150. label="单日机构内膳食供应能力(人次):"
  151. width={460}
  152. />
  153. <ProFormText
  154. name="createPerson"
  155. label="单次机构内膳食供应能力(人):"
  156. width={460}
  157. />
  158. <ProFormText
  159. name="createPerson"
  160. label="单日远程膳食供应能力(人次):"
  161. width={460}
  162. />
  163. <ProFormText
  164. name="createPerson"
  165. label="单次远程膳食供应能力(人):"
  166. width={460}
  167. />
  168. <ProFormText
  169. name="timeRange"
  170. label="机构内住宿供应能力(人):"
  171. width={460}
  172. />
  173. <ProFormUploadButton label="机构图片" name="upload" action="upload.do" />
  174. </ProForm>
  175. </Card>
  176. </PageContainer>
  177. );
  178. };