| // } | // } | ||||
| // ] | // ] | ||||
| // } | // } | ||||
| ] | |||||
| ] |
| </head> | </head> | ||||
| <body> | <body> | ||||
| <div id="root"></div> | <div id="root"></div> | ||||
| <script src="/umi.8cdc18ca.js"></script> | |||||
| <script src="/umi.847c9816.js"></script> | |||||
| </body> | </body> | ||||
| </html> | </html> |
| company_photos ?: Object[], | company_photos ?: Object[], | ||||
| longitude?: Number, | longitude?: Number, | ||||
| latitude?: Number, | latitude?: Number, | ||||
| status?: Number, | |||||
| // 其他参数 | // 其他参数 | ||||
| location_arr ?: number[] | location_arr ?: number[] | ||||
| famous ?: Number, | famous ?: Number, | ||||
| member_type ?: Number, | member_type ?: Number, | ||||
| member_status ?: Number, | member_status ?: Number, | ||||
| start_date ?: Date, | |||||
| end_date ?: Date, | |||||
| start_date ?: Date | String, | |||||
| end_date ?: Date | String, | |||||
| sale ?: String, | sale ?: String, | ||||
| // 其他参数 | // 其他参数 |
| import { useState } from "react"; | |||||
| import { useEffect, useState } from "react"; | |||||
| import { request } from '@umijs/max'; | import { request } from '@umijs/max'; | ||||
| import { baseUrl } from '@/constants/index' | import { baseUrl } from '@/constants/index' | ||||
| import { message } from 'antd'; | |||||
| import { message, Space, Image } from 'antd'; | |||||
| import { ProFormUploadButton } from '@ant-design/pro-components'; | import { ProFormUploadButton } from '@ant-design/pro-components'; | ||||
| import { Imageprefix } from '@/constants'; | |||||
| type UploadModelProps = { | type UploadModelProps = { | ||||
| form_name: string; | form_name: string; | ||||
| uploadTxt: string; | uploadTxt: string; | ||||
| image_type: number | 1; | image_type: number | 1; | ||||
| image_length: number | 1; | image_length: number | 1; | ||||
| onUploadComplete: (filename: string) => void; | onUploadComplete: (filename: string) => void; | ||||
| multiple: boolean | false | |||||
| multiple: boolean | false, | |||||
| imageUrl?: String | undefined; | |||||
| }; | }; | ||||
| const UploadModel: React.FC<UploadModelProps> = (props) => { | const UploadModel: React.FC<UploadModelProps> = (props) => { | ||||
| const { onUploadComplete, uploadTxt, image_type, form_name, image_length , multiple} = props; | |||||
| const { onUploadComplete, uploadTxt, image_type, form_name, image_length, multiple, imageUrl } = props; | |||||
| const handleUploadComplete = (filename: string) => { | const handleUploadComplete = (filename: string) => { | ||||
| if (onUploadComplete) { | |||||
| if (filename) { | |||||
| onUploadComplete(filename); | onUploadComplete(filename); | ||||
| } | } | ||||
| }; | }; | ||||
| const [image_url, setImageUrl] = useState<string>(imageUrl) | |||||
| useEffect(() => { | |||||
| setImageUrl(imageUrl) | |||||
| }, [imageUrl]) | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ProFormUploadButton | |||||
| label={uploadTxt} | |||||
| name={form_name} | |||||
| icon={null} | |||||
| title={uploadTxt} | |||||
| fieldProps={{ | |||||
| maxCount: image_length, | |||||
| multiple: multiple, | |||||
| fileList: [], | |||||
| listType: 'picture-card', | |||||
| showUploadList: false, | |||||
| customRequest: (e) => { | |||||
| let formdata = new FormData(); | |||||
| formdata.append('image', e.file); | |||||
| console.log(formdata) | |||||
| request(baseUrl + '/common/image/upload?imgtype=' + image_type, { | |||||
| method: 'post', | |||||
| data: formdata, | |||||
| Headers: { | |||||
| Authorization: sessionStorage.getItem('token'), | |||||
| 'X-Requested-With': null | |||||
| } | |||||
| }).then(res => { | |||||
| handleUploadComplete(res.data.filename) | |||||
| }).catch(err => { | |||||
| console.log(err) | |||||
| message.error('上传失败') | |||||
| }) | |||||
| } | |||||
| }} | |||||
| > | |||||
| </ProFormUploadButton> | |||||
| <Space> | |||||
| <ProFormUploadButton | |||||
| label={uploadTxt} | |||||
| name={form_name} | |||||
| icon={null} | |||||
| title={uploadTxt} | |||||
| fieldProps={{ | |||||
| maxCount: image_length, | |||||
| multiple: multiple, | |||||
| fileList: [], | |||||
| listType: 'picture-card', | |||||
| showUploadList: false, | |||||
| customRequest: (e) => { | |||||
| let formdata = new FormData(); | |||||
| formdata.append('image', e.file); | |||||
| console.log(formdata) | |||||
| request(baseUrl + '/common/image/upload?imgtype=' + image_type, { | |||||
| method: 'post', | |||||
| data: formdata, | |||||
| Headers: { | |||||
| Authorization: sessionStorage.getItem('token'), | |||||
| 'X-Requested-With': null | |||||
| } | |||||
| }).then(res => { | |||||
| setImageUrl(res.data.filename) | |||||
| handleUploadComplete(res.data.filename) | |||||
| }).catch(err => { | |||||
| console.log(err) | |||||
| message.error('上传失败') | |||||
| }) | |||||
| } | |||||
| }} | |||||
| > | |||||
| </ProFormUploadButton> | |||||
| { | |||||
| image_url && <Image src={`${Imageprefix}${image_url}`} width={102} height={102} style={{ borderRadius: 8 }} /> | |||||
| } | |||||
| </Space> | |||||
| </> | </> | ||||
| ) | ) | ||||
| } | } |
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[{ | columns={[{ | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '地址', | title: '地址', | ||||
| dataIndex: 'address', | dataIndex: 'address', | ||||
| width: 240, | |||||
| width: 200, | |||||
| search: false | search: false | ||||
| }, | }, | ||||
| { | { | ||||
| title: '地址分类', | title: '地址分类', | ||||
| dataIndex: 'cate', | dataIndex: 'cate', | ||||
| valueType: 'select', | valueType: 'select', | ||||
| width: 100, | |||||
| width: 200, | |||||
| valueEnum: { | valueEnum: { | ||||
| '菊城人才': { | '菊城人才': { | ||||
| text: '菊城人才', | text: '菊城人才', | ||||
| title: '审核账号', | title: '审核账号', | ||||
| dataIndex: 'audit_mobile', | dataIndex: 'audit_mobile', | ||||
| ellipsis: true, | ellipsis: true, | ||||
| width: 120, | |||||
| width: 200, | |||||
| search: false | search: false | ||||
| }, | }, | ||||
| { | { | ||||
| title: '审核人', | title: '审核人', | ||||
| dataIndex: 'contact_person', | dataIndex: 'contact_person', | ||||
| width: 120, | |||||
| width: 200, | |||||
| search: false | search: false | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 100, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) |
| ProFormText, | ProFormText, | ||||
| ProFormSegmented, | ProFormSegmented, | ||||
| ProFormDigit, | ProFormDigit, | ||||
| ProFormRadio, | |||||
| ProForm | ProForm | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message, Row, Col } from 'antd'; | import { ConfigProvider, Flex, Space, Modal, message, Row, Col } from 'antd'; | ||||
| }} | }} | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <ProFormText | <ProFormText | ||||
| label="广告位置,按照该格式:来源页面广告位名" | label="广告位置,按照该格式:来源页面广告位名" | ||||
| name="name" | name="name" | ||||
| rules={[{ required: true, message: '请输入广告位置,如:小程序首页轮播图;小程序首页企业LOGO图' }]} | rules={[{ required: true, message: '请输入广告位置,如:小程序首页轮播图;小程序首页企业LOGO图' }]} | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <ProFormText | <ProFormText | ||||
| label="广告位置代码,使用拼音缩写,不要超过十个字母,按照该格式:xcx(小程序)/gw(官网)-ym(页面)-ggwm(广告位名), 如:minisylbt(小程序首页轮播图)" | |||||
| label="广告位置代码,使用拼音缩写,不要超过十个字母" | |||||
| name="code" | name="code" | ||||
| placeholder="请输入广告位置代码,如:如:minisylbt(小程序首页轮播图)" | |||||
| rules={[{ required: true, message: '请输入广告位置代码,如:如:minisylbt(小程序首页轮播图)' }]} | |||||
| placeholder="请输入广告位置代码,使用拼音缩写,不要超过十个字母" | |||||
| rules={[{ required: true, message: '请输入广告位置代码,使用拼音缩写,不要超过十个字母s' }]} | |||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={12}> | <Col span={12}> | ||||
| </Col> | </Col> | ||||
| <Col span={12}> | <Col span={12}> | ||||
| <ProFormDigit label="行间距" name="row_padding" min={1} rules={[{ required: true, message: '请输入行间距' }]} /> | <ProFormDigit label="行间距" name="row_padding" min={1} rules={[{ required: true, message: '请输入行间距' }]} /> | ||||
| </Col> | </Col> | ||||
| <Col span={12}> | <Col span={12}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="random_show" | name="random_show" | ||||
| label="随机显示" | label="随机显示" | ||||
| request={async () => [ | request={async () => [ | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={12}> | <Col span={12}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="disabled_status" | name="disabled_status" | ||||
| label="禁用状态" | label="禁用状态" | ||||
| request={async () => [ | request={async () => [ |
| import { | import { | ||||
| ProTable, TableDropdown | ProTable, TableDropdown | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Select } from 'antd'; | |||||
| import { GetAdvertareaList} from '@/apis/api'; | |||||
| import { Button, Image, ConfigProvider, Space, Descriptions } from 'antd'; | |||||
| import { GetAdvertareaList } from '@/apis/api'; | |||||
| const PagesMainAdvertisementListTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesMainAdvertisementListTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| const actionRef = useRef<ActionType>(); | const actionRef = useRef<ActionType>(); | ||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| const expandedRowRender = (record) => { | |||||
| return ( | |||||
| <> | |||||
| <Space direction='vertical' style={{ width: '100%' }}> | |||||
| <Descriptions title="基本信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="限制显示广告数">{record.ad_num}</Descriptions.Item> | |||||
| <Descriptions.Item label="显示列数">{record.cols}</Descriptions.Item> | |||||
| <Descriptions.Item label="广告显示宽度">{record.width}</Descriptions.Item> | |||||
| <Descriptions.Item label="广告显示高度">{record.height}</Descriptions.Item> | |||||
| <Descriptions.Item label="列间距">{record.col_padding}</Descriptions.Item> | |||||
| <Descriptions.Item label="行间距">{record.row_padding}</Descriptions.Item> | |||||
| </Descriptions> | |||||
| </Space > | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| columns={[ { | |||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| expandable={{ | |||||
| expandedRowRender | |||||
| }} | |||||
| columns={[{ | |||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | |||||
| title: '广告位置', | |||||
| dataIndex: 'name', | |||||
| width: 240 | |||||
| }, | |||||
| { | |||||
| title: '广告位置代码', | |||||
| dataIndex: 'code', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '限制显示广告数', | |||||
| dataIndex: 'ad_num', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '显示列数', | |||||
| dataIndex: 'cols', | |||||
| search: false | |||||
| },{ | |||||
| title: '广告显示宽度', | |||||
| dataIndex: 'width', | |||||
| search: false | |||||
| },{ | |||||
| title: '广告显示高度', | |||||
| dataIndex: 'height', | |||||
| search: false | |||||
| },{ | |||||
| title: '列间距', | |||||
| dataIndex: 'col_padding', | |||||
| search: false | |||||
| },{ | |||||
| title: '行间距', | |||||
| dataIndex: 'row_padding', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| width: 300, | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Button key='2' type='link' onClick={() => { | |||||
| { | |||||
| title: '广告位置', | |||||
| dataIndex: 'name', | |||||
| }, | |||||
| { | |||||
| title: '广告位置代码', | |||||
| dataIndex: 'code', | |||||
| }}>删除</Button> | |||||
| ], | |||||
| }, | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Button key='2' type='link' onClick={() => { | |||||
| }}>删除</Button> | |||||
| ], | |||||
| }, | |||||
| ]} | ]} | ||||
| rowKey="id" | rowKey="id" | ||||
| pagination={{ | pagination={{ | ||||
| sort: 'id', | sort: 'id', | ||||
| sortby: 'desc', | sortby: 'desc', | ||||
| keyword: params.name, | keyword: params.name, | ||||
| }).then(res => { | }).then(res => { | ||||
| setList(res.data.advertareas) | setList(res.data.advertareas) | ||||
| setTotal(res.data.total) | setTotal(res.data.total) | ||||
| } | } | ||||
| headerTitle="广告位置列表" | headerTitle="广告位置列表" | ||||
| toolBarRender={() => [ | toolBarRender={() => [ | ||||
| <Button type="primary" onClick={() => { | |||||
| }}> | |||||
| 批量删除 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | <Button type="primary" onClick={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}> | }}> |
| ProFormSegmented, | ProFormSegmented, | ||||
| ProFormSelect, | ProFormSelect, | ||||
| ProForm, | ProForm, | ||||
| FormControlRender, | |||||
| ProFormRadio, | |||||
| ProFormDatePicker, | ProFormDatePicker, | ||||
| ProFormDigit | ProFormDigit | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| theme={{ | theme={{ | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| } , components: { | |||||
| }, components: { | |||||
| Segmented: { | Segmented: { | ||||
| itemSelectedBg: '#19be6e', | itemSelectedBg: '#19be6e', | ||||
| itemSelectedColor: '#ffffff' | itemSelectedColor: '#ffffff' | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| label="广告标题" | |||||
| name="title" | |||||
| placeholder="请输入广告标题" | |||||
| rules={[{ required: true, message: '请输入广告标题' }]} | |||||
| /> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="area_id" | |||||
| label="投放位置" | |||||
| placeholder="请选择投放位置" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames | |||||
| }} | |||||
| request={(keyword) => | |||||
| GetAdvertareaList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.advertareas; | |||||
| }) | |||||
| } | |||||
| rules={[{ required: true, message: '请选择投放位置' }]} | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="image_url" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.image_url}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="image_url" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| <Col span={24}> | |||||
| <UploadModel multiple={false} form_name="image_url" image_length={1} uploadTxt="上传封面图" image_type={3} imageUrl={detail?.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="广告标题" | |||||
| name="title" | |||||
| placeholder="请输入广告标题" | |||||
| rules={[{ required: true, message: '请输入广告标题' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="area_id" | |||||
| label="投放位置" | |||||
| placeholder="请选择投放位置" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames | |||||
| }} | |||||
| request={(keyword) => | |||||
| GetAdvertareaList({ page: 1, pagesize: 100, keyword: keyword.keyWords, sortby: 'desc', }).then(res => { | |||||
| return res.data.advertareas; | |||||
| }) | |||||
| } | |||||
| rules={[{ required: true, message: '请选择投放位置' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="说明" | |||||
| name="ad_description" | |||||
| placeholder="请输入说明" | |||||
| rules={[{ required: true, message: '请输入说明' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| label="跳转网址,小程序内部路径,以/pages/开头,如/pages/index/index, 外部网址需以http://或https://开头, 没有链接就填 //" | |||||
| name="target_url" | |||||
| placeholder="请输入跳转网址" | |||||
| rules={[{ required: true, message: '请输入跳转网址' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormDigit | |||||
| label="此广告展示顺序" | |||||
| placeholder="请输入此广告展示顺序,请输入优先级的数字" | |||||
| name="show_order" | |||||
| min={1} | |||||
| rules={[{ required: true, message: '请输入此广告展示顺序,请输入优先级的数字' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormDatePicker | |||||
| width={'lg'} | |||||
| name="valid_date" | |||||
| label="有效时间" | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD' | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择有效时间' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="hide_ad" | |||||
| label="是否隐藏广告" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否隐藏广告' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="company_id" | |||||
| label="选择企业,没有企业选人才市场" | |||||
| placeholder="请选择企业" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldCompanyNames | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择企业' }]} | |||||
| request={(keyword) => | |||||
| getCompanyList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.list; | |||||
| }) | |||||
| } | |||||
| /> | |||||
| </Col> | |||||
| </Row> | </Row> | ||||
| <ProFormText | |||||
| label="说明" | |||||
| name="ad_description" | |||||
| placeholder="请输入说明" | |||||
| rules={[{ required: true, message: '请输入说明' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="跳转网址,小程序内部路径,以/pages/开头,如/pages/index/index, 外部网址需以http://或https://开头, 没有链接就填 //" | |||||
| name="target_url" | |||||
| placeholder="请输入跳转网址" | |||||
| rules={[{ required: true, message: '请输入跳转网址' }]} | |||||
| /> | |||||
| <ProFormDigit | |||||
| label="此广告展示顺序" | |||||
| placeholder="请输入此广告展示顺序,请输入优先级的数字" | |||||
| name="show_order" | |||||
| min={1} | |||||
| rules={[{ required: true, message: '请输入此广告展示顺序,请输入优先级的数字' }]} | |||||
| /> | |||||
| <ProFormDatePicker | |||||
| name="valid_date" | |||||
| label="有效时间" | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD' | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择有效时间' }]} | |||||
| /> | |||||
| <ProFormSegmented | |||||
| name="hide_ad" | |||||
| label="是否隐藏广告" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否隐藏广告' }]} | |||||
| /> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="company_id" | |||||
| label="选择企业,没有企业选人才市场" | |||||
| placeholder="请选择企业" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldCompanyNames | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择企业' }]} | |||||
| request={(keyword) => | |||||
| getCompanyList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.list; | |||||
| }) | |||||
| } | |||||
| /> | |||||
| </ProForm> | </ProForm> | ||||
| </Modal> | </Modal> | ||||
| </ConfigProvider> | |||||
| </ConfigProvider > | |||||
| </> | </> | ||||
| ); | ); | ||||
| }; | }; |
| import { | import { | ||||
| ProTable, ProFormSelect | ProTable, ProFormSelect | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Popconfirm, ConfigProvider, Tag,message } from 'antd'; | |||||
| import { GetAdvertscheduleList, getCompanyList, GetAdvertareaList, PostAdvertscheduleDel} from '@/apis/api'; | |||||
| import { Button, Popconfirm, ConfigProvider, Tag, message } from 'antd'; | |||||
| import { GetAdvertscheduleList, getCompanyList, GetAdvertareaList, PostAdvertscheduleDel } from '@/apis/api'; | |||||
| const selectfieldNames = { label: 'full_name', value: 'id' }; | const selectfieldNames = { label: 'full_name', value: 'id' }; | ||||
| const selectfieldAreaNames = { label: 'name', value: 'id' }; | const selectfieldAreaNames = { label: 'name', value: 'id' }; | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| columns={[ { | |||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[{ | |||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | |||||
| title: '投放标题', | |||||
| dataIndex: 'title', | |||||
| width: 240 | |||||
| }, | |||||
| { | |||||
| title: '投放位置', | |||||
| dataIndex: 'area_name', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '投放位置', | |||||
| dataIndex: 'area_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| width='lg' | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldAreaNames, | |||||
| }} | |||||
| request={async (keyword) => | |||||
| GetAdvertareaList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.advertareas; | |||||
| }) | |||||
| } | |||||
| placeholder="请选择投放位置" | |||||
| /> | |||||
| ) | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '投放描述', | |||||
| dataIndex: 'ad_description', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '企业', | |||||
| dataIndex: 'company_name', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '企业', | |||||
| dataIndex: 'company_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| }} | |||||
| request={async (keyword) => | |||||
| getCompanyList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.list; | |||||
| }) | |||||
| } | |||||
| placeholder="请选择企业" | |||||
| /> | |||||
| ) | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '投放状态', | |||||
| dataIndex: 'hide_ad', | |||||
| render: (_, record) => (<> | |||||
| { | |||||
| <> | |||||
| {record.hide_ad === 0 && <Tag>未设置</Tag> } | |||||
| {record.hide_ad === 1 && <Tag>隐藏</Tag>} | |||||
| {record.hide_ad === 2 && <Tag color="green">显示</Tag> } | |||||
| </> | |||||
| } | |||||
| { | |||||
| title: '投放标题', | |||||
| dataIndex: 'title', | |||||
| width: 200 | |||||
| }, | |||||
| { | |||||
| title: '投放位置', | |||||
| dataIndex: 'area_name', | |||||
| width: 200, | |||||
| </>), | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '隐藏广告', | |||||
| }, | |||||
| 2: { | |||||
| text: '显示广告', | |||||
| } | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| width: 300, | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Popconfirm | |||||
| title="是否删除" | |||||
| onConfirm={(e) => { | |||||
| PostAdvertscheduleDel({ id: record.id }).then(res => { | |||||
| message.success('删除成功') | |||||
| actionRef.current.reload(); | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '投放位置', | |||||
| dataIndex: 'area_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| width='lg' | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldAreaNames, | |||||
| }} | |||||
| request={async (keyword) => | |||||
| GetAdvertareaList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.advertareas; | |||||
| }) | }) | ||||
| } | |||||
| placeholder="请选择投放位置" | |||||
| /> | |||||
| ) | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '投放描述', | |||||
| dataIndex: 'ad_description', | |||||
| width: 200, | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '企业', | |||||
| dataIndex: 'company_name', | |||||
| width: 200, | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '企业', | |||||
| dataIndex: 'company_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| }} | }} | ||||
| okText="删除" | |||||
| cancelText="取消" | |||||
| > | |||||
| <a | |||||
| key="delete" | |||||
| > | |||||
| 删除 | |||||
| </a> | |||||
| </Popconfirm> | |||||
| ], | |||||
| request={async (keyword) => | |||||
| getCompanyList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.list; | |||||
| }) | |||||
| } | |||||
| placeholder="请选择企业" | |||||
| /> | |||||
| ) | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '投放状态', | |||||
| dataIndex: 'hide_ad', | |||||
| width: 200, | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: { text: '全部' , | |||||
| status: 'Errorr'}, | |||||
| 1: { | |||||
| text: '隐藏', | |||||
| status: 'Errorr' | |||||
| }, | |||||
| 2: { | |||||
| text: '显示', | |||||
| status: 'Processing' | |||||
| } | |||||
| }, | }, | ||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Popconfirm | |||||
| title="是否删除" | |||||
| onConfirm={(e) => { | |||||
| PostAdvertscheduleDel({ id: record.id }).then(res => { | |||||
| message.success('删除成功') | |||||
| actionRef.current.reload(); | |||||
| }) | |||||
| }} | |||||
| okText="删除" | |||||
| cancelText="取消" | |||||
| > | |||||
| <a | |||||
| key="delete" | |||||
| > | |||||
| 删除 | |||||
| </a> | |||||
| </Popconfirm> | |||||
| ], | |||||
| }, | |||||
| ]} | ]} | ||||
| rowKey="id" | rowKey="id" | ||||
| pagination={{ | pagination={{ | ||||
| sort: 'id', | sort: 'id', | ||||
| sortby: 'desc', | sortby: 'desc', | ||||
| keyword: params.title, | keyword: params.title, | ||||
| hide_ad: params.hide_ad ? params.hide_ad : 0, | |||||
| hide_ad: params.hide_ad ? params.hide_ad : 0, | |||||
| company_id: params.company_id, | company_id: params.company_id, | ||||
| area_id: params.area_id | area_id: params.area_id | ||||
| }).then(res => { | }).then(res => { |
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={600} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormSelect | <ProFormSelect | ||||
| showSearch | showSearch | ||||
| name="company_id" | name="company_id" |
| import { | import { | ||||
| ProTable, ProFormSelect | ProTable, ProFormSelect | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, ConfigProvider, } from 'antd'; | |||||
| import { Button, ConfigProvider, Modal } from 'antd'; | |||||
| import { GetCompanyDepartmentList, getCompanyList, GetCompanyInfo } from '@/apis/api'; | import { GetCompanyDepartmentList, getCompanyList, GetCompanyInfo } from '@/apis/api'; | ||||
| const selectfieldNames = { label: 'full_name', value: 'id' }; | const selectfieldNames = { label: 'full_name', value: 'id' }; | ||||
| const PagesMainCompanyDepartmentTable: React.FC = ({ dispatch, getId, openModel }: any) => { | const PagesMainCompanyDepartmentTable: React.FC = ({ dispatch, getId, openModel }: any) => { | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| scroll={{ x: 1300 }} | |||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '部门名称', | title: '部门名称', | ||||
| dataIndex: 'name', | dataIndex: 'name', | ||||
| width: 300 | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '所属企业', | title: '所属企业', | ||||
| dataIndex: 'company_name', | dataIndex: 'company_name', | ||||
| width: 300, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '所属企业', | title: '所属企业', | ||||
| dataIndex: 'company_id', | dataIndex: 'company_id', | ||||
| width: 300, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| renderFormItem: () => { | renderFormItem: () => { | ||||
| { | { | ||||
| title: '联系人', | title: '联系人', | ||||
| search: false, | search: false, | ||||
| width: 200, | |||||
| dataIndex: 'contact' | dataIndex: 'contact' | ||||
| }, | }, | ||||
| { | { | ||||
| title: '联系电话', | title: '联系电话', | ||||
| search: false, | search: false, | ||||
| width: 200, | |||||
| dataIndex: 'phone' | dataIndex: 'phone' | ||||
| }, | }, | ||||
| { | { | ||||
| title: '手机', | title: '手机', | ||||
| search: false, | search: false, | ||||
| width: 200, | |||||
| dataIndex: 'mobile' | dataIndex: 'mobile' | ||||
| }, | }, | ||||
| { | { | ||||
| title: '邮箱', | title: '邮箱', | ||||
| search: false, | search: false, | ||||
| width: 200, | |||||
| dataIndex: 'email' | dataIndex: 'email' | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}>编辑</Button> | |||||
| }}>编辑</Button>, | |||||
| <Button key='2' type='link' danger onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>删除</Button> | |||||
| ], | ], | ||||
| }, | }, | ||||
| ]} | ]} | ||||
| sessionStorage.removeItem('company_info') | sessionStorage.removeItem('company_info') | ||||
| } | } | ||||
| setCompanyId(0) | setCompanyId(0) | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| }} | }} | ||||
| headerTitle="部门列表" | headerTitle="部门列表" | ||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加部门 | |||||
| </Button> | |||||
| toolBarRender={() => [<Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '批量删除', | |||||
| content: '确定要删除所选的数据吗,参数:id', | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '确定', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量删除 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加部门 | |||||
| </Button>, | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| import { useRef, useState, useEffect } from 'react'; | import { useRef, useState, useEffect } from 'react'; | ||||
| import { connect } from '@umijs/max'; | import { connect } from '@umijs/max'; | ||||
| import type { ProFormInstance } from '@ant-design/pro-components'; | import type { ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | |||||
| StepsForm, ProCard, | |||||
| ProFormDatePicker, | |||||
| ProFormDependency, | |||||
| ProFormText, | |||||
| ProFormCascader, | |||||
| ProFormRadio, | |||||
| FormControlRender, | |||||
| ProFormSelect | |||||
| } from '@ant-design/pro-components'; | |||||
| import { Row, Col, Image, ConfigProvider, Modal, Switch, Form, message, Button } from 'antd'; | |||||
| import { addCompany, PostCompanyEdit, GetCompanyInfo } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | |||||
| import { StepsForm, ProCard, ProFormDatePicker, ProFormDependency, ProFormText, ProFormCascader, ProFormRadio, FormControlRender, ProFormSelect } from '@ant-design/pro-components'; | |||||
| import { Row, Col, Image, ConfigProvider, Modal, Space, Form, message, Button } from 'antd'; | |||||
| import { selectfieldNames, cascaderfieldNames, Imageprefix } from '@/constants' | |||||
| import { findAncestors } from '@/utils/dataHelper' | import { findAncestors } from '@/utils/dataHelper' | ||||
| import { disAfterData } from '@/utils/format' | import { disAfterData } from '@/utils/format' | ||||
| import MapComponent from '@/components/Common/map'; | import MapComponent from '@/components/Common/map'; | ||||
| import RichComponent from '@/components/Common/rich'; | import RichComponent from '@/components/Common/rich'; | ||||
| import UploadModel from '@/components/Common/upload'; | import UploadModel from '@/components/Common/upload'; | ||||
| const selectfieldNames = { label: 'name', value: 'id', children: 'children' }; | |||||
| const cascaderfieldNames = { label: 'name', value: 'id', children: 'children' }; | |||||
| import { addCompany, PostCompanyEdit, GetCompanyInfo } from '@/apis/api'; | |||||
| const PagesMainCompanyListCreate: React.FC = ({ dispatch, dictModel, openModel, id }: any) => { | |||||
| interface PagesMainCompanyListCreateProps { | |||||
| id: any | |||||
| } | |||||
| const PagesMainCompanyListCreate: React.FC<PagesMainCompanyListCreateProps> = ({ dispatch, dictModel, openModel, id }: any) => { | |||||
| const formRef = useRef<ProFormInstance>(); | const formRef = useRef<ProFormInstance>(); | ||||
| const formMapRef = useRef< | const formMapRef = useRef< | ||||
| React.MutableRefObject<ProFormInstance<any> | undefined>[] | React.MutableRefObject<ProFormInstance<any> | undefined>[] | ||||
| }; | }; | ||||
| const [uploadedFilelicenseName, setUploadedFilelicenseName] = useState<string>(''); | const [uploadedFilelicenseName, setUploadedFilelicenseName] = useState<string>(''); | ||||
| const handleFileUploadedlicense = (filename: string) => { | |||||
| const handleFileUploadedlicense = (filename: string) => { | |||||
| setUploadedFilelicenseName(filename); | setUploadedFilelicenseName(filename); | ||||
| }; | }; | ||||
| const [uploadedFilephotosName, setUploadedFilephotosName] = useState<object[]>([]); | const [uploadedFilephotosName, setUploadedFilephotosName] = useState<object[]>([]); | ||||
| const handleFileUploadedphotos = (filename: string) => { | |||||
| const handleFileUploadedphotos = (filename: string) => { | |||||
| setUploadedFilephotosName([...uploadedFilephotosName, { photo: filename }]); | setUploadedFilephotosName([...uploadedFilephotosName, { photo: filename }]); | ||||
| }; | }; | ||||
| formInstanceRef?.current?.setFieldsValue(res.data); | formInstanceRef?.current?.setFieldsValue(res.data); | ||||
| }); | }); | ||||
| setDetail(res.data) | setDetail(res.data) | ||||
| }); | }); | ||||
| } else { | } else { | ||||
| setDetail(null) | setDetail(null) | ||||
| message.success('提交成功') | message.success('提交成功') | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| } else { | } else { | ||||
| let res = await addCompany(values) | let res = await addCompany(values) | ||||
| message.success('提交成功') | message.success('提交成功') | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传企业照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> : <> | |||||
| <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传企业照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="photo_status" | |||||
| label="企业照片审核状态" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <Col span={12}> | |||||
| <Space direction='vertical'> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传企业照片" image_type={3} imageUrl={detail?.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| <ProFormRadio.Group | |||||
| name="photo_status" | |||||
| label="企业照片审核状态" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| </Col> | </Col> | ||||
| { | |||||
| detail ? | |||||
| <Col span={8}> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.photo}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </> | |||||
| } | |||||
| </Row> | |||||
| <Row gutter={[16, 16]}> | |||||
| { | |||||
| detail ? | |||||
| <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传营业执照" image_type={4} onUploadComplete={handleFileUploadedlicense}></UploadModel> | |||||
| </Col> : <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="license_path" image_length={1} uploadTxt="上传营业执照" image_type={4} onUploadComplete={handleFileUploadedlicense}></UploadModel> | |||||
| </Col> | |||||
| } | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="license_status" | |||||
| label="营业执照审核状态" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <Col span={12}> | |||||
| <Space direction='vertical'> | |||||
| <UploadModel multiple={false} form_name="license_path" image_length={1} uploadTxt="上传营业执照" imageUrl={detail?.license_path} image_type={4} onUploadComplete={handleFileUploadedlicense}></UploadModel> | |||||
| <ProFormRadio.Group | |||||
| name="license_status" | |||||
| label="营业执照审核状态" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| </Col> | </Col> | ||||
| { | |||||
| detail ? | |||||
| <Col span={8}> | |||||
| {uploadedFilelicenseName ? <Image src={`${Imageprefix}${uploadedFilelicenseName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.license_path}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| {uploadedFilelicenseName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilelicenseName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </> | |||||
| } | |||||
| </Row> | |||||
| <Row gutter={[16, 16]}> | |||||
| { | { | ||||
| detail ? | detail ? | ||||
| <Col span={24} style={{ display: 'flex' }}> | <Col span={24} style={{ display: 'flex' }}> |
| import { useRef, useState, useEffect } from 'react'; | import { useRef, useState, useEffect } from 'react'; | ||||
| import { connect, history } from '@umijs/max'; | |||||
| import { connect, history, Link } from '@umijs/max'; | |||||
| import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | import { | ||||
| ProTable, TableDropdown, PageContainer | |||||
| ProTable, TableDropdown, ProForm | |||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Select, message, DatePicker } from 'antd'; | |||||
| import { getCompanyList, GetCompanyInfo, updateCompany, PostCompanyExport, getRoleGetpermissionids } from '@/apis/api'; | |||||
| import { Button, Image, ConfigProvider, Select, message, Descriptions, Space, Radio, Modal, Row, Col, Badge } from 'antd'; | |||||
| import { getCompanyList, GetCompanyInfo, updateCompany, PostCompanyExport, PostCompanyEdit } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| import { findId } from '@/utils/dataHelper'; | import { findId } from '@/utils/dataHelper'; | ||||
| import { Header } from 'antd/es/layout/layout'; | |||||
| import UploadModel from '@/components/Common/upload'; | |||||
| const PagesMainCompanyListTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesMainCompanyListTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| const [total, setTotal] = useState<number>(0) | const [total, setTotal] = useState<number>(0) | ||||
| const [page, setPage] = useState<number>(1) | const [page, setPage] = useState<number>(1) | ||||
| const [pageSize, setPageSize] = useState<number>(10) | const [pageSize, setPageSize] = useState<number>(10) | ||||
| const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]) | |||||
| const setId = (id: number) => { | const setId = (id: number) => { | ||||
| getId(id) | getId(id) | ||||
| const [addButton, setAddButton] = useState<boolean>(true) | const [addButton, setAddButton] = useState<boolean>(true) | ||||
| const [editButton, setEditButton] = useState<boolean>(true) | const [editButton, setEditButton] = useState<boolean>(true) | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| const [uploadedFilephotoName, setUploadedFilephotoName] = useState<string>(''); | |||||
| const uploadedFilephotoNameRef = useRef<string>(''); | |||||
| const handleFileUploadedphoto = (filename: string) => { | |||||
| setUploadedFilephotoName(filename); | |||||
| }; | |||||
| useEffect(() => { | |||||
| uploadedFilephotoNameRef.current = uploadedFilephotoName; | |||||
| }, [uploadedFilephotoName]) | |||||
| const [uploadedFilelicenseName, setUploadedFilelicenseName] = useState<string>(''); | |||||
| const uploadedFilelicenseNameRef = useRef<string>(''); | |||||
| const handleFileUploadedlicense = (filename: string) => { | |||||
| setUploadedFilelicenseName(filename); | |||||
| }; | |||||
| useEffect(() => { | |||||
| uploadedFilelicenseNameRef.current = uploadedFilelicenseName; | |||||
| }, [uploadedFilelicenseName]) | |||||
| const expandedRowRender = (record) => { | |||||
| return ( | |||||
| <> | |||||
| <Space direction='vertical' style={{ width: '100%' }}> | |||||
| <Descriptions title="基本信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="成立日期">{record.establishment_date}</Descriptions.Item> | |||||
| <Descriptions.Item label="来源">{record.origin_text}</Descriptions.Item> | |||||
| <Descriptions.Item label="登录次数">{record.login_count}</Descriptions.Item> | |||||
| <Descriptions.Item label="点击次数">{record.click_count}</Descriptions.Item> | |||||
| <Descriptions.Item label="企业照片"> | |||||
| <Space align='center'> | |||||
| <Image src={`${Imageprefix}${record.photo}`} width={60} height={60} /> | |||||
| <Button size='small' type='primary' onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '更换企业照片', | |||||
| content: (<> | |||||
| <ProForm submitter={{ render: false }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="更换企业照片" image_type={3} imageUrl={record.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </ProForm> | |||||
| </>), | |||||
| async onOk() { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, photo: uploadedFilephotoNameRef.current }); | |||||
| setUploadedFilephotoName(''); | |||||
| actionRef.current?.reload(); | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true, | |||||
| }); | |||||
| }}>更换企业照片</Button> | |||||
| </Space> | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="照片审核"> | |||||
| <Radio.Group value={record.photo_status} size='small' onChange={async (e) => { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, photo_status: e.target.value }); | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>待审</Radio> | |||||
| <Radio value={2}>通过</Radio> | |||||
| <Radio value={3}>不通过</Radio> | |||||
| </Radio.Group> | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="登录账号">{record.login_name}</Descriptions.Item> | |||||
| <Descriptions.Item label="营业执照"> | |||||
| <Space align='center'> | |||||
| <Image src={`${Imageprefix}${record.license_path}`} width={60} height={60} /> | |||||
| <Button size='small' type='primary' onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '更换营业执照', | |||||
| content: (<> | |||||
| <ProForm submitter={{ render: false }}> | |||||
| <UploadModel multiple={false} form_name="license_path" image_length={1} uploadTxt="更换营业执照" image_type={3} imageUrl={record.license_path} onUploadComplete={handleFileUploadedlicense}></UploadModel> | |||||
| </ProForm> | |||||
| </>), | |||||
| async onOk() { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, license_path: uploadedFilelicenseNameRef.current }); | |||||
| setUploadedFilelicenseName(''); | |||||
| actionRef.current?.reload(); | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true, | |||||
| }); | |||||
| }}>更换营业执照</Button> | |||||
| </Space> | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="营业执照审核"> | |||||
| <Radio.Group value={record.photo_status} size='small' onChange={async (e) => { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, license_status: e.target.value }); | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>待审</Radio> | |||||
| <Radio value={2}>通过</Radio> | |||||
| <Radio value={3}>不通过</Radio> | |||||
| </Radio.Group> | |||||
| </Descriptions.Item> | |||||
| </Descriptions> | |||||
| <Descriptions title="会员信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="会员类型"> | |||||
| { | |||||
| record.member_type_text && <Button type="primary" size='small' onClick={() => { | |||||
| sessionStorage.setItem('vip_company_info', JSON.stringify(record)) | |||||
| history.push({ | |||||
| pathname: '/company/vip' | |||||
| }) | |||||
| }}> | |||||
| {record.member_type_text} | |||||
| </Button> | |||||
| } | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="开始时间"> | |||||
| {record.start_date} | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="到期时间"> | |||||
| {record.end_date} | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="剩余点数"> | |||||
| {record.code} | |||||
| </Descriptions.Item> | |||||
| <Descriptions.Item label="会员状态"> | |||||
| { | |||||
| record.member_status === 2 ? <Badge status="processing" text={record.member_status_text} /> : <Badge status="error" text={record.member_status_text} /> | |||||
| } | |||||
| </Descriptions.Item> | |||||
| </Descriptions> | |||||
| </Space > | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| colorLink: '#4FBE70', | colorLink: '#4FBE70', | ||||
| }, | |||||
| components: { | |||||
| Descriptions: { | |||||
| labelBg: '#ffffff', | |||||
| contentColor: '#000' | |||||
| }, | |||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | size='small' | ||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| expandable={{ | |||||
| expandedRowRender | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '筛选日期', | title: '筛选日期', | ||||
| dataIndex: 'date_range', | dataIndex: 'date_range', | ||||
| hidden: true, | hidden: true, | ||||
| width: 120, | |||||
| valueType: 'dateRange', | valueType: 'dateRange', | ||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| fixed: 'left', | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '企业名称', | title: '企业名称', | ||||
| dataIndex: 'full_name', | dataIndex: 'full_name', | ||||
| width: 240, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '来源', | |||||
| dataIndex: 'origin_text', | |||||
| search: false, | |||||
| width: 100, | |||||
| title: '社会统一信用代码', | |||||
| dataIndex: 'registration_number', | |||||
| width: 200, | |||||
| search: false | |||||
| }, | }, | ||||
| { | { | ||||
| title: '登录次数', | |||||
| dataIndex: 'login_count', | |||||
| search: false, | |||||
| width: 100 | |||||
| title: '性质', | |||||
| dataIndex: 'nature_text', | |||||
| width: 200, | |||||
| search: false | |||||
| }, | }, | ||||
| { | { | ||||
| title: '点击次数', | |||||
| dataIndex: 'click_count', | |||||
| search: false, | |||||
| width: 100 | |||||
| title: '规模', | |||||
| dataIndex: 'scale_text', | |||||
| width: 200, | |||||
| search: false | |||||
| }, | }, | ||||
| { | { | ||||
| title: '会员类型', | |||||
| dataIndex: 'member_type', | |||||
| width: 100, | |||||
| hidden: true, | |||||
| title: '账号状态', | |||||
| dataIndex: 'status', | |||||
| width: 200, | |||||
| render: (_, record) => (<> | |||||
| <Radio.Group size='small' value={record.status} onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>开通</Radio> | |||||
| <Radio value={2}>关闭</Radio> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| valueType: 'select', | valueType: 'select', | ||||
| valueEnum: { | valueEnum: { | ||||
| 0: { text: '全部' }, | 0: { text: '全部' }, | ||||
| 1: { | 1: { | ||||
| text: '试用申请中', | |||||
| text: '开通', | |||||
| status: 'Processing' | |||||
| }, | }, | ||||
| 2: { | 2: { | ||||
| text: '试用正式', | |||||
| }, | |||||
| 3: { | |||||
| text: '普通申请中', | |||||
| }, | |||||
| 4: { | |||||
| text: '普通正式', | |||||
| }, | |||||
| 5: { | |||||
| text: 'VIP申请中', | |||||
| }, | |||||
| 6: { | |||||
| text: 'VIP正式', | |||||
| text: '关闭', | |||||
| status: 'Error' | |||||
| }, | }, | ||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '会员类型', | title: '会员类型', | ||||
| dataIndex: 'member_type_text', | |||||
| dataIndex: 'member_type', | |||||
| width: 100, | width: 100, | ||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| { | |||||
| record.member_type_text && <Button type="primary" size='small' onClick={() => { | |||||
| sessionStorage.setItem('vip_company_info', JSON.stringify(record)) | |||||
| history.push({ | |||||
| pathname: '/company/vip' | |||||
| }) | |||||
| }}> | |||||
| {record.member_type_text} | |||||
| </Button> | |||||
| } | |||||
| </>), | |||||
| hidden: true, | |||||
| valueType: 'select', | valueType: 'select', | ||||
| valueEnum: { | valueEnum: { | ||||
| 0: { text: '全部' }, | 0: { text: '全部' }, | ||||
| }, | }, | ||||
| }, | }, | ||||
| }, | }, | ||||
| { | |||||
| title: '开始时间', | |||||
| dataIndex: 'start_date', | |||||
| width: 140 | |||||
| }, | |||||
| { | |||||
| title: '到期时间', | |||||
| dataIndex: 'end_date', | |||||
| search: false, | |||||
| width: 140 | |||||
| }, { | |||||
| title: '剩余点数', | |||||
| dataIndex: 'code', | |||||
| search: false, | |||||
| width: 100 | |||||
| }, | |||||
| { | |||||
| title: '会员状态', | |||||
| dataIndex: 'member_status', | |||||
| width: 100, | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '待审', | |||||
| }, | |||||
| 2: { | |||||
| text: '正常', | |||||
| }, | |||||
| 3: { | |||||
| text: '到期', | |||||
| }, | |||||
| 4: { | |||||
| text: '推荐', | |||||
| } | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '状态', | |||||
| dataIndex: 'status', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '开通', | |||||
| }, | |||||
| 2: { | |||||
| text: '关闭', | |||||
| }, | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '会员状态', | |||||
| dataIndex: 'member_status_text', | |||||
| width: 120, | |||||
| search: false, | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '待审', | |||||
| }, | |||||
| 2: { | |||||
| text: '正常', | |||||
| }, | |||||
| 3: { | |||||
| text: '到期', | |||||
| }, | |||||
| 4: { | |||||
| text: '推荐', | |||||
| } | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '企业照片', | |||||
| dataIndex: 'photo', | |||||
| search: false, | |||||
| width: 100, | |||||
| render: (_, record) => (<> | |||||
| <Image src={`${Imageprefix + record.photo}`} width={40} height={40} /> | |||||
| </> | |||||
| ) | |||||
| }, { | |||||
| title: '照片审核', | |||||
| dataIndex: 'photo_status_text', | |||||
| search: false, | |||||
| width: 120, | |||||
| render: (_, record) => (<> | |||||
| <Select | |||||
| size="small" | |||||
| style={{ width: 100 }} | |||||
| value={record.photo_status_text} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| }, | |||||
| ]} | |||||
| onChange={async (value) => { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, photo_status: value }); | |||||
| actionRef.current.reload(); | |||||
| }} | |||||
| ></Select> | |||||
| </>) | |||||
| }, | |||||
| { | |||||
| title: '营业执照', | |||||
| dataIndex: 'license_path', | |||||
| search: false, | |||||
| width: 120, | |||||
| render: (_, record) => (<> | |||||
| <Image src={`${Imageprefix}${record.license_path}`} width={40} height={40} /> | |||||
| </> | |||||
| ) | |||||
| }, | |||||
| { | |||||
| title: '营业执照审核', | |||||
| dataIndex: 'license_status_text', | |||||
| search: false, | |||||
| width: 120, | |||||
| render: (_, record) => (<> | |||||
| <Select | |||||
| size="small" | |||||
| style={{ width: 100 }} | |||||
| value={record.license_status_text} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| }, | |||||
| ]} | |||||
| onChange={async (value) => { | |||||
| let info = await GetCompanyInfo({ id: record.id }); | |||||
| let res = await updateCompany({ ...info.data, license_status: value }); | |||||
| actionRef.current.reload(); | |||||
| }} | |||||
| ></Select> | |||||
| </>) | |||||
| }, | |||||
| { | |||||
| title: '登录账号', | |||||
| dataIndex: 'login_name', | |||||
| width: 200 | |||||
| }, | |||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <> | <> | ||||
| { | { | ||||
| pathname: '/company/department' | pathname: '/company/department' | ||||
| }) | }) | ||||
| }) | }) | ||||
| }}>查看部门</Button>, | |||||
| <TableDropdown | |||||
| key="actionGroup" | |||||
| menus={[ | |||||
| { | |||||
| name: '查看职位', | |||||
| key: '3', | |||||
| onClick: () => { | |||||
| GetCompanyInfo({ id: record.id }).then(res => { | |||||
| sessionStorage.setItem('post_company_info', JSON.stringify(res.data)) | |||||
| history.push({ | |||||
| pathname: '/company/post' | |||||
| }) | |||||
| }) | |||||
| }, | |||||
| }, | |||||
| { | |||||
| name: '子账号解绑', | |||||
| key: '4', | |||||
| onClick: () => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenBindModal', payload: true }) | |||||
| }, | |||||
| }, | |||||
| ]} | |||||
| />, | |||||
| }}>企业部门</Button>, | |||||
| <Button key='3' type='link' onClick={() => { | |||||
| GetCompanyInfo({ id: record.id }).then(res => { | |||||
| sessionStorage.setItem('post_company_info', JSON.stringify(res.data)) | |||||
| history.push({ | |||||
| pathname: '/company/post' | |||||
| }) | |||||
| }) | |||||
| }}>企业职位</Button>, | |||||
| <Link to={`/company/vip?full_name=${record.full_name}`}>会员信息</Link>, | |||||
| <Button key='5' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenBindModal', payload: true }) | |||||
| }}>子账号解绑</Button>, | |||||
| ], | ], | ||||
| }, | }, | ||||
| ]} | ]} | ||||
| } | } | ||||
| headerTitle="企业列表" | headerTitle="企业列表" | ||||
| toolBarRender={() => [ | toolBarRender={() => [ | ||||
| <Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据进行何种操作', | |||||
| content: (<> | |||||
| <div>参数: id, status</div> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>开通账号</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>禁用1天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>禁用3天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>禁用7天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>禁用15天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>禁用30天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>永久禁用</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={2}>关闭账号</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '确定', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量管理账号 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | <Button type="primary" onClick={() => { | ||||
| message.info('数据导出需要时间,请耐心等待') | message.info('数据导出需要时间,请耐心等待') | ||||
| PostCompanyExport().then(res => { | PostCompanyExport().then(res => { |
| ProFormTreeSelect, | ProFormTreeSelect, | ||||
| ProFormDigitRange | ProFormDigitRange | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Row, Col, Image, ConfigProvider, Modal, Switch, Form, message, } from 'antd'; | |||||
| import { Row, Col, Image, ConfigProvider, Modal, Space, Form, message, } from 'antd'; | |||||
| import { getCompanyList, GetCompanyDepartmentList, PostCompanyJobAdd, PostCompanyJobEdit, PostCompanyJobInfo, GetCompanyInfo, GetCompanyDepartmentInfo } from '@/apis/api'; | import { getCompanyList, GetCompanyDepartmentList, PostCompanyJobAdd, PostCompanyJobEdit, PostCompanyJobInfo, GetCompanyInfo, GetCompanyDepartmentInfo } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| import { verifyPhone } from '@/utils/VerifyHelper'; | import { verifyPhone } from '@/utils/VerifyHelper'; | ||||
| afterOpenChange={async (open) => { | afterOpenChange={async (open) => { | ||||
| if (open && id) { | if (open && id) { | ||||
| let res = await PostCompanyJobInfo({ id: id }) | let res = await PostCompanyJobInfo({ id: id }) | ||||
| let res1 = await GetCompanyInfo({ id: res.data.company_id }) | |||||
| let res1 = await GetCompanyInfo({ id: res.data.company_id }) | |||||
| sessionStorage.setItem('post_company_info', JSON.stringify(res1.data)) | sessionStorage.setItem('post_company_info', JSON.stringify(res1.data)) | ||||
| formMapRef?.current?.forEach((formInstanceRef) => { | formMapRef?.current?.forEach((formInstanceRef) => { | ||||
| res.data.age_arr = [res.data.age_min, res.data.age_max]; | res.data.age_arr = [res.data.age_min, res.data.age_max]; | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| <Col span={24}> | <Col span={24}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="urgent" | name="urgent" | ||||
| label="是否紧急" | label="是否紧急" | ||||
| request={async () => [ | |||||
| options={[ | |||||
| { label: '是', value: 1 }, | { label: '是', value: 1 }, | ||||
| { label: '否', value: 2 } | { label: '否', value: 2 } | ||||
| ]} | ]} | ||||
| /> | /> | ||||
| </Col> | |||||
| </Col> | |||||
| <Col span={8}> | <Col span={8}> | ||||
| <ProFormSelect | <ProFormSelect | ||||
| showSearch | showSearch | ||||
| }} | }} | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <Form.Item | <Form.Item | ||||
| name='gangweizhize' | name='gangweizhize' | ||||
| label="岗位职责" | label="岗位职责" | ||||
| </FormControlRender> | </FormControlRender> | ||||
| </Form.Item> | </Form.Item> | ||||
| </Col> | </Col> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <Form.Item | <Form.Item | ||||
| name='renzhiyaoqiu' | name='renzhiyaoqiu' | ||||
| label="任职要求" | label="任职要求" | ||||
| </Form.Item> | </Form.Item> | ||||
| </Col> | </Col> | ||||
| <Col span={5}> | <Col span={5}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="fulltime" | name="fulltime" | ||||
| label="是否全职" | label="是否全职" | ||||
| request={async () => [ | |||||
| options={[ | |||||
| { label: '是', value: 1 }, | { label: '是', value: 1 }, | ||||
| { label: '否', value: 2 } | { label: '否', value: 2 } | ||||
| ]} | ]} | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={5}> | <Col span={5}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="parttime" | name="parttime" | ||||
| label="是否兼职" | label="是否兼职" | ||||
| request={async () => [ | request={async () => [ | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={5}> | <Col span={5}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="casual" | name="casual" | ||||
| label="是否临时" | label="是否临时" | ||||
| request={async () => [ | request={async () => [ | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={5}> | <Col span={5}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="practical" | name="practical" | ||||
| label="是否实习" | label="是否实习" | ||||
| request={async () => [ | request={async () => [ | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={4}> | <Col span={4}> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="campus" | name="campus" | ||||
| label="校园招聘" | label="校园招聘" | ||||
| request={async () => [ | request={async () => [ | ||||
| <ProFormRadio.Group | <ProFormRadio.Group | ||||
| name="degree_better" | name="degree_better" | ||||
| label="是否是最高学历" | label="是否是最高学历" | ||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | options={[ | ||||
| { | { | ||||
| label: '是', | label: '是', | ||||
| <ProFormRadio.Group | <ProFormRadio.Group | ||||
| name="sex" | name="sex" | ||||
| label="性别要求" | label="性别要求" | ||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | options={[ | ||||
| { | { | ||||
| label: '男', | label: '男', | ||||
| <ProFormRadio.Group | <ProFormRadio.Group | ||||
| name="marital_status" | name="marital_status" | ||||
| label="婚姻状况" | label="婚姻状况" | ||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | options={[ | ||||
| { | { | ||||
| label: '已婚', | label: '已婚', | ||||
| }} | }} | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <ProFormText | <ProFormText | ||||
| label="联系人" | label="联系人" | ||||
| name="contact" | name="contact" | ||||
| rules={[{ required: true, message: '请输入联系人' }]} | rules={[{ required: true, message: '请输入联系人' }]} | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={24}> | |||||
| <Col span={12}> | |||||
| <ProFormText | <ProFormText | ||||
| label="担任职位" | label="担任职位" | ||||
| name="possession" | name="possession" | ||||
| /> | /> | ||||
| </Col> | </Col> | ||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="联系电话" | |||||
| name="phone" | |||||
| placeholder="请输入联系电话" | |||||
| rules={[{ required: true, message: '请输入联系电话' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={16}> | |||||
| <ProFormRadio.Group | |||||
| name="phone_public" | |||||
| label="是否公开联系电话" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="手机" | |||||
| name="mobile" | |||||
| placeholder="请输入手机" | |||||
| rules={[{ required: true, message: '请输入手机' }]} | |||||
| /> | |||||
| <Col span={12}> | |||||
| <Space> | |||||
| <ProFormText | |||||
| width={'md'} | |||||
| label="联系电话" | |||||
| name="phone" | |||||
| placeholder="请输入联系电话" | |||||
| rules={[{ required: true, message: '请输入联系电话' }]} | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="phone_public" | |||||
| label="是否公开联系电话" | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| </Col> | </Col> | ||||
| <Col span={16}> | |||||
| <ProFormRadio.Group | |||||
| name="mobile_public" | |||||
| label="是否公开手机" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| <Col span={12}> | |||||
| <Space > | |||||
| <ProFormText | |||||
| width={'md'} | |||||
| label="手机" | |||||
| name="mobile" | |||||
| placeholder="请输入手机" | |||||
| rules={[{ required: true, message: '请输入手机' }]} | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="mobile_public" | |||||
| label="是否公开手机" | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| /> | |||||
| </Col> | </Col> | ||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="邮箱" | |||||
| name="email" | |||||
| placeholder="请输入邮箱" | |||||
| /> | |||||
| <Col span={12}> | |||||
| <Space > | |||||
| <ProFormText | |||||
| width={'md'} | |||||
| label="邮箱" | |||||
| name="email" | |||||
| placeholder="请输入邮箱" | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="email_public" | |||||
| label="是否公开邮箱" | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| </Col> | </Col> | ||||
| <Col span={16}> | |||||
| <ProFormRadio.Group | |||||
| name="email_public" | |||||
| label="是否公开邮箱" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="传真" | |||||
| name="fax" | |||||
| placeholder="请输入传真" | |||||
| <Col span={12}> | |||||
| <Space> | |||||
| <ProFormText | |||||
| width={'md'} | |||||
| label="传真" | |||||
| name="fax" | |||||
| placeholder="请输入传真" | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="fax_public" | |||||
| label="是否公开传真" | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Space> | |||||
| /> | |||||
| </Col> | </Col> | ||||
| <Col span={16}> | <Col span={16}> | ||||
| <ProFormRadio.Group | <ProFormRadio.Group | ||||
| name="fax_public" | |||||
| label="是否公开传真" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormSegmented | |||||
| name="status" | name="status" | ||||
| label="职位状态" | label="职位状态" | ||||
| request={async () => [ | request={async () => [ |
| import { | import { | ||||
| ProTable, ProFormSelect | ProTable, ProFormSelect | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, ConfigProvider,message } from 'antd'; | |||||
| import { Button, ConfigProvider, message, Space, Descriptions, Radio, Row, Col, Modal } from 'antd'; | |||||
| import { GetCompanyJobList, getCompanyList, GetCompanyInfo, PostJobExport } from '@/apis/api'; | import { GetCompanyJobList, getCompanyList, GetCompanyInfo, PostJobExport } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| const selectfieldNames = { label: 'full_name', value: 'id' }; | const selectfieldNames = { label: 'full_name', value: 'id' }; | ||||
| const [page, setPage] = useState<number>(1) | const [page, setPage] = useState<number>(1) | ||||
| const [pageSize, setPageSize] = useState<number>(10) | const [pageSize, setPageSize] = useState<number>(10) | ||||
| const [companyId, setCompanyId] = useState<number>(0); | const [companyId, setCompanyId] = useState<number>(0); | ||||
| const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]) | |||||
| const setId = (id: number) => { | const setId = (id: number) => { | ||||
| getId(id) | getId(id) | ||||
| } | } | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| scroll={{ x: 1300 }} | |||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '筛选日期', | title: '筛选日期', | ||||
| dataIndex: 'date_range', | dataIndex: 'date_range', | ||||
| hidden: true, | hidden: true, | ||||
| width: 120, | |||||
| valueType: 'dateRange', | valueType: 'dateRange', | ||||
| }, | }, | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| fixed: 'left', | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '所属企业', | title: '所属企业', | ||||
| dataIndex: 'full_name', | dataIndex: 'full_name', | ||||
| width: 300, | |||||
| width: 200, | |||||
| valueType: 'select', | valueType: 'select', | ||||
| renderFormItem: () => { | renderFormItem: () => { | ||||
| return ( | return ( | ||||
| { | { | ||||
| title: '职位名称', | title: '职位名称', | ||||
| dataIndex: 'name', | dataIndex: 'name', | ||||
| width: 200, | |||||
| fixed: 'left' | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '点击次数', | title: '点击次数', | ||||
| dataIndex: 'click_count', | dataIndex: 'click_count', | ||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 100 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '职位状态', | title: '职位状态', | ||||
| dataIndex: 'status', | dataIndex: 'status', | ||||
| width: 100, | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| width: 200, | |||||
| colSize: 16, | |||||
| valueType: 'radio', | |||||
| initialValue: '0', | |||||
| valueEnum: { | valueEnum: { | ||||
| 0: { text: '全部' }, | 0: { text: '全部' }, | ||||
| 1: { | 1: { | ||||
| text: '发布中', | text: '发布中', | ||||
| status: 'Processing' | |||||
| }, | }, | ||||
| 2: { | 2: { | ||||
| text: '未发布', | text: '未发布', | ||||
| status: 'Error' | |||||
| }, | }, | ||||
| 3: { | 3: { | ||||
| text: '暂停', | text: '暂停', | ||||
| status: 'Error' | |||||
| }, | }, | ||||
| 4: { | 4: { | ||||
| text: '已锁定', | text: '已锁定', | ||||
| status: 'Error' | |||||
| }, | }, | ||||
| 5: { | 5: { | ||||
| text: '回收站', | text: '回收站', | ||||
| status: 'Error' | |||||
| }, | }, | ||||
| 6: { | 6: { | ||||
| text: '已过期', | text: '已过期', | ||||
| status: 'Error' | |||||
| } | } | ||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '状态', | |||||
| dataIndex: 'status_text', | |||||
| title: '有效期(天)', | |||||
| dataIndex: 'useful_life', | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 100 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '有效期(天)', | |||||
| dataIndex: 'useful_life', | |||||
| title: '发布时间', | |||||
| dataIndex: 'publish_date', | |||||
| width: 200, | |||||
| search: false, | |||||
| }, | |||||
| { | |||||
| title: '到期时间', | |||||
| dataIndex: 'disabled_date', | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 150 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) | ||||
| sortby: 'desc', | sortby: 'desc', | ||||
| keyword: params.name, | keyword: params.name, | ||||
| expired: params.expired, | expired: params.expired, | ||||
| status: params.status, | |||||
| status: params.status ? params.status : 0, | |||||
| company_id: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).id : companyId, | company_id: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).id : companyId, | ||||
| start_date: params.date_range ? params.date_range[0] : '', | start_date: params.date_range ? params.date_range[0] : '', | ||||
| end_date: params.date_range ? params.date_range[1] : '', | end_date: params.date_range ? params.date_range[1] : '', | ||||
| sessionStorage.removeItem('post_company_info') | sessionStorage.removeItem('post_company_info') | ||||
| } | } | ||||
| setCompanyId(0) | setCompanyId(0) | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| }} | }} | ||||
| headerTitle="部门列表" | |||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| message.info('数据导出需要时间,请耐心等待') | |||||
| PostJobExport().then(res => { | |||||
| let url = Imageprefix + res.data.excel_url; | |||||
| window.open(url); | |||||
| message.info('数据导出完毕') | |||||
| }) | |||||
| }}> | |||||
| 导出数据 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加职位 | |||||
| </Button> | |||||
| headerTitle="职位列表" | |||||
| toolBarRender={() => [<Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '批量发布', | |||||
| content: (<> | |||||
| <h4 style={{ fontWeight: 'bold' }}>有效期:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>1天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>3天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>7天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>15天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>30天</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '确定', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量发布 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '批量更改状态', | |||||
| content: (<> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>发布中</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>未发布</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>暂停</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>已锁定</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>回收站</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>已过期</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '确定', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量更改状态 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| message.info('数据导出需要时间,请耐心等待') | |||||
| PostJobExport().then(res => { | |||||
| let url = Imageprefix + res.data.excel_url; | |||||
| window.open(url); | |||||
| message.info('数据导出完毕') | |||||
| }) | |||||
| }}> | |||||
| 导出数据 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加职位 | |||||
| </Button> | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| ProForm, | ProForm, | ||||
| ProFormDateRangePicker | ProFormDateRangePicker | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message } from 'antd'; | |||||
| import { ConfigProvider, Flex, Space, Modal, message, Row, Col } from 'antd'; | |||||
| import { PostCompanyVipmanage, GetCompanyVipInfo } from '@/apis/api'; | import { PostCompanyVipmanage, GetCompanyVipInfo } from '@/apis/api'; | ||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={680} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| request={async () => { | request={async () => { | ||||
| if (id) { | if (id) { | ||||
| let res = await GetCompanyVipInfo({ id: id }) | let res = await GetCompanyVipInfo({ id: id }) | ||||
| res.data.dateRange = [res.data.start_date ? res.data.start_date : null, res.data.end_date ? res.data.end_date : null] | |||||
| return res.data; | return res.data; | ||||
| } | } | ||||
| }} | }} | ||||
| }} | }} | ||||
| onFinish={async (values) => { | onFinish={async (values) => { | ||||
| values.id = id; | values.id = id; | ||||
| values.start_date = values.dateRange[0]; | |||||
| values.end_date = values.dateRange[1]; | |||||
| values.start_date = values.dateRange && values.dateRange.length > 0 ? values.dateRange[0] : ''; | |||||
| values.end_date = values.dateRange && values.dateRange.length > 0 ? values.dateRange[1] : ''; | |||||
| delete values.dateRange; | delete values.dateRange; | ||||
| let res = await PostCompanyVipmanage(values) | let res = await PostCompanyVipmanage(values) | ||||
| message.success('提交成功') | message.success('提交成功') | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormRadio.Group | |||||
| name="probation" | |||||
| label="见习基地" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="famous" | |||||
| label="知名企业" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="member_type" | |||||
| label="会员类型" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '试用申请中', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '试用正式', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '普通申请中', | |||||
| value: 3, | |||||
| }, | |||||
| { | |||||
| label: '普通正式', | |||||
| value: 4, | |||||
| }, | |||||
| { | |||||
| label: 'VIP申请中', | |||||
| value: 5, | |||||
| }, | |||||
| { | |||||
| label: 'VIP正式', | |||||
| value: 6, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <ProFormRadio.Group | |||||
| name="member_status" | |||||
| label="会员状态" | |||||
| radioType="button" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '正常', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '到期', | |||||
| value: 3, | |||||
| }, | |||||
| { | |||||
| label: '推荐', | |||||
| value: 4, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| <ProFormDateRangePicker | |||||
| name="dateRange" | |||||
| label="会员生效时间" | |||||
| placeholder={['会员生效时间', '会员失效时间']} | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD' | |||||
| }} | |||||
| /> | |||||
| <ProFormText | |||||
| name="sale" | |||||
| label="业务员" | |||||
| placeholder="请输入业务员" | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | |||||
| <Col span={6}> | |||||
| <ProFormRadio.Group | |||||
| name="probation" | |||||
| label="见习基地" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={6}> | |||||
| <ProFormRadio.Group | |||||
| name="famous" | |||||
| label="知名企业" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '是', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '否', | |||||
| value: 2, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormRadio.Group | |||||
| name="member_type" | |||||
| label="会员类型" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '试用申请中', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '试用正式', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '普通申请中', | |||||
| value: 3, | |||||
| }, | |||||
| { | |||||
| label: '普通正式', | |||||
| value: 4, | |||||
| }, | |||||
| { | |||||
| label: 'VIP申请中', | |||||
| value: 5, | |||||
| }, | |||||
| { | |||||
| label: 'VIP正式', | |||||
| value: 6, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormRadio.Group | |||||
| name="member_status" | |||||
| label="会员状态" | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '正常', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '到期', | |||||
| value: 3, | |||||
| }, | |||||
| { | |||||
| label: '推荐', | |||||
| value: 4, | |||||
| } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormDateRangePicker | |||||
| name="dateRange" | |||||
| label="会员生效时间" | |||||
| placeholder={['会员生效时间', '会员失效时间']} | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD' | |||||
| }} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText | |||||
| name="sale" | |||||
| label="业务员" | |||||
| placeholder="请输入业务员" | |||||
| /> | |||||
| </Col> | |||||
| </Row> | |||||
| </ProForm> | </ProForm> | ||||
| import { | import { | ||||
| ProFormText, | ProFormText, | ||||
| ProForm, | ProForm, | ||||
| ProFormSegmented, | |||||
| ProFormRadio, | |||||
| ProFormDigit | ProFormDigit | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message } from 'antd'; | |||||
| import { ConfigProvider, Flex, Space, Modal, message, } from 'antd'; | |||||
| import { PostCompanyFeechange } from '@/apis/api'; | import { PostCompanyFeechange } from '@/apis/api'; | ||||
| import { PostCompanyVipmanage, GetCompanyVipInfo } from '@/apis/api'; | |||||
| const selectfieldNames = { label: 'full_name', value: 'id' }; | const selectfieldNames = { label: 'full_name', value: 'id' }; | ||||
| theme={{ | theme={{ | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| } , components: { | |||||
| }, components: { | |||||
| Segmented: { | Segmented: { | ||||
| itemSelectedBg: '#19be6e', | itemSelectedBg: '#19be6e', | ||||
| itemSelectedColor: '#ffffff' | itemSelectedColor: '#ffffff' | ||||
| <Modal | <Modal | ||||
| open={openPreview} | open={openPreview} | ||||
| title='编辑VIP' | |||||
| title='变更点数' | |||||
| centered | centered | ||||
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={480} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenFeeModal', payload: false }) | dispatch({ type: 'openModel/getOpenFeeModal', payload: false }) | ||||
| }} | }} | ||||
| > | > | ||||
| <ProForm<CompanyType.fee> | <ProForm<CompanyType.fee> | ||||
| request={async () => { | |||||
| if (id) { | |||||
| let res = await GetCompanyVipInfo({ id: id }) | |||||
| res.data.fee = res.data.balance_fee | |||||
| return res.data; | |||||
| } | |||||
| }} | |||||
| formRef={formRef} | formRef={formRef} | ||||
| submitter={{ | submitter={{ | ||||
| searchConfig: { | searchConfig: { | ||||
| }, | }, | ||||
| render: (_, dom) => { return <Flex justify='flex-end'> <Space>{dom}</Space></Flex> }, | render: (_, dom) => { return <Flex justify='flex-end'> <Space>{dom}</Space></Flex> }, | ||||
| onReset: () => { | onReset: () => { | ||||
| setOpenPreview(false) | setOpenPreview(false) | ||||
| } | } | ||||
| }} | }} | ||||
| min={0} | min={0} | ||||
| rules={[{ required: true, message: '请输入点数值' }]} | rules={[{ required: true, message: '请输入点数值' }]} | ||||
| /> | /> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="change_type" | name="change_type" | ||||
| label="变更类型" | label="变更类型" | ||||
| request={async () => [ | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { | { | ||||
| label: '增加', | label: '增加', | ||||
| value: 1, | value: 1, | ||||
| } | } | ||||
| ]} | ]} | ||||
| rules={[{ required: true, message: '请选择变更类型' }]} | rules={[{ required: true, message: '请选择变更类型' }]} | ||||
| /> | /> | ||||
| <ProFormText | <ProFormText | ||||
| label="备注说明" | label="备注说明" | ||||
| placeholder="备注说明" | placeholder="备注说明" | ||||
| rules={[{ required: true, message: '请输入备注说明' }]} | rules={[{ required: true, message: '请输入备注说明' }]} | ||||
| /> | /> | ||||
| </ProForm> | </ProForm> |
| import { useRef, useState, useEffect } from 'react'; | import { useRef, useState, useEffect } from 'react'; | ||||
| import { connect } from '@umijs/max'; | |||||
| import { useSearchParams, connect } from '@umijs/max'; | |||||
| import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | import { | ||||
| ProTable | ProTable | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Input } from 'antd'; | |||||
| import { PostCompanyViplist ,PostCompanyFeechange} from '@/apis/api'; | |||||
| import { Button, Image, ConfigProvider, Input, Descriptions, Space, Modal, Radio, Row, Col } from 'antd'; | |||||
| import { PostCompanyViplist, PostCompanyFeechange } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { | const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { | ||||
| const actionRef = useRef<ActionType>(); | const actionRef = useRef<ActionType>(); | ||||
| const [searchParams, setSearchParams] = useSearchParams(); | |||||
| const [list, setList] = useState<object[]>([]) | const [list, setList] = useState<object[]>([]) | ||||
| const [total, setTotal] = useState<number>(0) | const [total, setTotal] = useState<number>(0) | ||||
| const [page, setPage] = useState<number>(1) | const [page, setPage] = useState<number>(1) | ||||
| const [pageSize, setPageSize] = useState<number>(10) | const [pageSize, setPageSize] = useState<number>(10) | ||||
| const [fullname, setFullname] = useState<any>(sessionStorage.getItem('vip_company_info') ? JSON.parse(sessionStorage.getItem('vip_company_info')).full_name : '') | |||||
| const setId = (id: number) => { | const setId = (id: number) => { | ||||
| getId(id) | getId(id) | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openFeeModal) { | if (!openModel.openFeeModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openFeeModal]) | }, [openModel.openFeeModal]) | ||||
| const expandedRowRender = (record) => { | |||||
| return ( | |||||
| <> | |||||
| <Space direction='vertical' style={{ width: '100%' }}> | |||||
| <Descriptions title="基本信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="见习基地">{record.probation_text}</Descriptions.Item> | |||||
| <Descriptions.Item label="知名企业">{record.famous_text}</Descriptions.Item> | |||||
| <Descriptions.Item label="业务员">{record.sales}</Descriptions.Item> | |||||
| </Descriptions> | |||||
| </Space > | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| scroll={{ x: 1300 }} | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ | |||||
| span: 8, labelWidth: 'auto', | |||||
| }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| expandable={{ | |||||
| expandedRowRender | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '筛选日期', | title: '筛选日期', | ||||
| dataIndex: 'date_range', | dataIndex: 'date_range', | ||||
| hidden: true, | hidden: true, | ||||
| width: 120, | |||||
| valueType: 'dateRange', | valueType: 'dateRange', | ||||
| search: { | |||||
| transform: (value) => { | |||||
| return { | |||||
| start_date: value[0], | |||||
| end_date: value[1], | |||||
| }; | |||||
| }, | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 80, | |||||
| fixed: 'left', | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '企业名称', | title: '企业名称', | ||||
| dataIndex: 'full_name', | dataIndex: 'full_name', | ||||
| width: 300, | |||||
| fixed: 'left', | |||||
| valueType: 'input', | |||||
| renderFormItem: () => { | |||||
| width: 200, | |||||
| renderFormItem: (_, { type, defaultRender }) => { | |||||
| return ( | return ( | ||||
| <><Input placeholder="请输入企业名称" value={fullname} onChange={(e) => { | |||||
| setFullname(e.target.value) | |||||
| }} /></> | |||||
| <Input | |||||
| placeholder="请输入企业名称" | |||||
| defaultValue={searchParams.get('full_name')} | |||||
| onChange={(e) => { | |||||
| console.log(e.target.value); | |||||
| }} | |||||
| /> | |||||
| ) | ) | ||||
| } | |||||
| }, | |||||
| { | |||||
| title: '见习基地', | |||||
| dataIndex: 'probation_text', | |||||
| search: false, | |||||
| width: 100, | |||||
| }, | |||||
| { | |||||
| title: '知名企业', | |||||
| dataIndex: 'famous_text', | |||||
| search: false, | |||||
| width: 100 | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '会员类型', | title: '会员类型', | ||||
| dataIndex: 'member_type_text', | dataIndex: 'member_type_text', | ||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 100 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '会员状态', | title: '会员状态', | ||||
| dataIndex: 'member_status_text', | |||||
| width: 100, | |||||
| dataIndex: 'member_status', | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '待审', | |||||
| status: 'Error' | |||||
| }, | |||||
| 2: { | |||||
| text: '正常', | |||||
| status: 'Processing' | |||||
| }, | |||||
| 3: { | |||||
| text: '到期', | |||||
| status: 'Error' | |||||
| }, | |||||
| 4: { | |||||
| text: '推荐', | |||||
| status: 'Error' | |||||
| }, | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '开始时间', | title: '开始时间', | ||||
| dataIndex: 'start_date', | dataIndex: 'start_date', | ||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '到期时间', | title: '到期时间', | ||||
| dataIndex: 'end_date', | dataIndex: 'end_date', | ||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 200 | |||||
| }, { | }, { | ||||
| title: '剩余点数', | title: '剩余点数', | ||||
| dataIndex: 'balance_fee', | dataIndex: 'balance_fee', | ||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| width: 100, | |||||
| }, | |||||
| { | |||||
| title: '业务员', | |||||
| dataIndex: 'sales', | |||||
| search: false, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}>编辑</Button>, | }}>编辑</Button>, | ||||
| <Button key='1' type='link' onClick={() => { | |||||
| <Button key='2' type='link' onClick={() => { | |||||
| setId(record.id) | setId(record.id) | ||||
| dispatch({ type: 'openModel/getOpenFeeModal', payload: true }) | dispatch({ type: 'openModel/getOpenFeeModal', payload: true }) | ||||
| }}>变更点数</Button> | }}>变更点数</Button> | ||||
| pagesize: pageSize, | pagesize: pageSize, | ||||
| sort: 'id', | sort: 'id', | ||||
| sortby: 'desc', | sortby: 'desc', | ||||
| keyword: fullname, | |||||
| start_date: params.date_range ? params.date_range[0] : '', | |||||
| end_date: params.date_range ? params.date_range[1] : '', | |||||
| keyword: searchParams.get('full_name') ? searchParams.get('full_name') : params.full_name, | |||||
| id: params.id, | |||||
| start_date: params.start_date, | |||||
| end_date: params.end_date, | |||||
| }).then(res => { | }).then(res => { | ||||
| setList(res.data.list) | setList(res.data.list) | ||||
| setTotal(res.data.total) | setTotal(res.data.total) | ||||
| }) | }) | ||||
| } | } | ||||
| onReset={() => { | |||||
| if (sessionStorage.getItem('vip_company_info')) { | |||||
| sessionStorage.removeItem('vip_company_info') | |||||
| } | |||||
| setFullname('') | |||||
| actionRef.current.reload(); | |||||
| }} | |||||
| headerTitle="企业列表" | |||||
| headerTitle="VIP企业列表" | |||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据开通哪种会员类型', | |||||
| content: (<> | |||||
| <div>参数: id, member_type,start_date,end_date </div> | |||||
| <h4 style={{ fontWeight: 'bold' }}>类型:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>试用申请中</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>试用正式</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>普通申请中</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>普通正式</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>VIP申请中</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>VIP正式</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| <h4 style={{ fontWeight: 'bold' }}>时长:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>1天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>3天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>7天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>15天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>30天</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量开通会员 | |||||
| </Button>, | |||||
| ]} | |||||
| /> | /> | ||||
| </ConfigProvider> | </ConfigProvider> | ||||
| </> | </> | ||||
| export default connect(({ dictModel, openModel }: any) => ({ | export default connect(({ dictModel, openModel }: any) => ({ | ||||
| dictModel, | dictModel, | ||||
| openModel | openModel | ||||
| }))(CompanyListPage); | |||||
| }))(CompanyListPage); | |||||
| ProFormDependency, | ProFormDependency, | ||||
| FormControlRender, | FormControlRender, | ||||
| ProForm, | ProForm, | ||||
| ProFormSegmented | |||||
| ProFormRadio | |||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message, Form, Row, Col, Image } from 'antd'; | import { ConfigProvider, Flex, Space, Modal, message, Form, Row, Col, Image } from 'antd'; | ||||
| import { PostRecruitmentUpdate, PostRecruitmentAdd, GetCompanyInfo, GetRecruitmentDetail } from '@/apis/api'; | import { PostRecruitmentUpdate, PostRecruitmentAdd, GetCompanyInfo, GetRecruitmentDetail } from '@/apis/api'; | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| name="title" | |||||
| label="招聘会主题" | |||||
| placeholder="请输入招聘会主题" | |||||
| rules={[{ required: true, message: '请输入招聘会主题' } | |||||
| ]} | |||||
| /> | |||||
| <Form.Item | |||||
| name='content' | |||||
| label="招聘会内容" | |||||
| rules={[{ required: true }]} | |||||
| > | |||||
| <FormControlRender> | |||||
| {() => { | |||||
| return ( | |||||
| <ProFormDependency name={['content']} > | |||||
| {({ content }, form) => { | |||||
| return ( | |||||
| <RichComponent placeholder="请输入招聘会内容" defaultValue={content} | |||||
| onChange={(value) => { | |||||
| setRichTxt(value) | |||||
| form.formRef.current.setFieldsValue({ | |||||
| content: value | |||||
| }) | |||||
| }}></RichComponent> | |||||
| ); | |||||
| }} | |||||
| </ProFormDependency> | |||||
| ); | |||||
| }} | |||||
| </FormControlRender> | |||||
| </Form.Item> | |||||
| <ProFormDateTimeRangePicker | |||||
| name="dateRange" | |||||
| label="选择有效的日期时间范围" | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD HH:mm:ss' | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择有效的时间范围' }]} | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传招聘会照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> : <> | |||||
| <Col span={6}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传招聘会照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| { | |||||
| detail ? | |||||
| <Col span={6}> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.photo}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| {uploadedFilephotoName ? <Col span={6}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </> | |||||
| } | |||||
| <Col span={24}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="上传招聘会照片" image_type={3} imageUrl={detail?.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText | |||||
| name="title" | |||||
| label="招聘会主题" | |||||
| placeholder="请输入招聘会主题" | |||||
| rules={[{ required: true, message: '请输入招聘会主题' } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormDateTimeRangePicker | |||||
| name="dateRange" | |||||
| label="选择有效的日期时间范围" | |||||
| fieldProps={{ | |||||
| format: 'YYYY-MM-DD HH:mm:ss' | |||||
| }} | |||||
| rules={[{ required: true, message: '请选择有效的时间范围' }]} | |||||
| /> | |||||
| </Col> | |||||
| {/* <Col span={24}> | {/* <Col span={24}> | ||||
| <Switch checked={mapSwitch} checkedChildren='地图已显示' unCheckedChildren="地图已关闭" onChange={(val) => { | <Switch checked={mapSwitch} checkedChildren='地图已显示' unCheckedChildren="地图已关闭" onChange={(val) => { | ||||
| setMapSwitch(val) | setMapSwitch(val) | ||||
| }} /> | }} /> | ||||
| </Col> */} | </Col> */} | ||||
| <Col span={24}> | |||||
| <Col span={8}> | |||||
| <ProFormText | <ProFormText | ||||
| label="详细地址" | label="详细地址" | ||||
| name="address" | name="address" | ||||
| }}></MapComponent> | }}></MapComponent> | ||||
| </Col> | </Col> | ||||
| } */} | } */} | ||||
| <Col span={24}> | |||||
| <ProFormSegmented | |||||
| <Col span={6}> | |||||
| <ProFormRadio.Group | |||||
| name="status" | name="status" | ||||
| label="招聘会状态" | label="招聘会状态" | ||||
| request={async () => [ | |||||
| fieldProps={{ | |||||
| buttonStyle: 'solid' | |||||
| }} | |||||
| options={[ | |||||
| { label: '开启', value: 1 }, | { label: '开启', value: 1 }, | ||||
| { label: '结束', value: 2 } | { label: '结束', value: 2 } | ||||
| ]} | ]} | ||||
| /> | /> | ||||
| </Col> | |||||
| <Col span={24}> | |||||
| <Form.Item | |||||
| name='content' | |||||
| label="招聘会内容" | |||||
| rules={[{ required: true }]} | |||||
| > | |||||
| <FormControlRender> | |||||
| {() => { | |||||
| return ( | |||||
| <ProFormDependency name={['content']} > | |||||
| {({ content }, form) => { | |||||
| return ( | |||||
| <RichComponent placeholder="请输入招聘会内容" defaultValue={content} | |||||
| onChange={(value) => { | |||||
| setRichTxt(value) | |||||
| form.formRef.current.setFieldsValue({ | |||||
| content: value | |||||
| }) | |||||
| }}></RichComponent> | |||||
| ); | |||||
| }} | |||||
| </ProFormDependency> | |||||
| ); | |||||
| }} | |||||
| </FormControlRender> | |||||
| </Form.Item> | |||||
| </Col> | </Col> | ||||
| </Row> | </Row> | ||||
| </ProForm> | </ProForm> |
| import { connect, history } from '@umijs/max'; | import { connect, history } from '@umijs/max'; | ||||
| import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | import { | ||||
| ProTable | |||||
| ProTable, ProForm | |||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, ConfigProvider, Tag } from 'antd'; | |||||
| import { Button, ConfigProvider, Tag, Modal, Radio, Row, Col, Descriptions, Space, Image } from 'antd'; | |||||
| import { Imageprefix } from '@/constants'; | |||||
| import { listRecruitment, GetRecruitmentDetail } from '@/apis/api'; | import { listRecruitment, GetRecruitmentDetail } from '@/apis/api'; | ||||
| import UploadModel from '@/components/Common/upload'; | |||||
| const MainFairListPage: React.FC = ({ dispatch, getId, openModel }: any) => { | const MainFairListPage: React.FC = ({ dispatch, getId, openModel }: any) => { | ||||
| const actionRef = useRef<ActionType>(); | const actionRef = useRef<ActionType>(); | ||||
| const [list, setList] = useState<object[]>([]) | const [list, setList] = useState<object[]>([]) | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| const [uploadedFilephotoName, setUploadedFilephotoName] = useState<string>(''); | |||||
| const uploadedFilephotoNameRef = useRef<string>(''); | |||||
| const handleFileUploadedphoto = (filename: string) => { | |||||
| setUploadedFilephotoName(filename); | |||||
| }; | |||||
| useEffect(() => { | |||||
| uploadedFilephotoNameRef.current = uploadedFilephotoName; | |||||
| }, [uploadedFilephotoName]) | |||||
| const expandedRowRender = (record) => { | |||||
| return ( | |||||
| <> | |||||
| <Space direction='vertical' style={{ width: '100%' }}> | |||||
| <Descriptions title="参会信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="参与的企业总数">{record.join_count}</Descriptions.Item> | |||||
| <Descriptions.Item label="已审核企业总数">{record.job_count}</Descriptions.Item> | |||||
| <Descriptions.Item label="参与职位数">{record.job_count}</Descriptions.Item> | |||||
| <Descriptions.Item label="需求人数">{record.recruiting_num}</Descriptions.Item> | |||||
| </Descriptions> | |||||
| </Space > | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| expandable={{ | |||||
| expandedRowRender | |||||
| }} | |||||
| columns={[{ | columns={[{ | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 80, | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '招聘会名称', | title: '招聘会名称', | ||||
| width: 200, | width: 200, | ||||
| search: false | search: false | ||||
| }, { | }, { | ||||
| title: '开通状态', | |||||
| title: '开启状态', | |||||
| dataIndex: 'status', | dataIndex: 'status', | ||||
| width: 100, | |||||
| width: 300, | |||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| { | |||||
| <> | |||||
| {record.status === 1 ? <Tag color="green">进行中</Tag> : <Tag color="red">已结束</Tag>} | |||||
| </> | |||||
| } | |||||
| <Radio.Group size='small' value={record.status} onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>已开启</Radio> | |||||
| <Radio value={2}>已关闭</Radio> | |||||
| </Radio.Group> | |||||
| </>), | </>), | ||||
| valueType: 'select', | valueType: 'select', | ||||
| valueEnum: { | valueEnum: { | ||||
| 0: { text: '全部' }, | 0: { text: '全部' }, | ||||
| 1: { | 1: { | ||||
| text: '进行中', | |||||
| text: '已开启', | |||||
| }, | }, | ||||
| 2: { | 2: { | ||||
| text: '已结束', | |||||
| text: '已关闭', | |||||
| } | } | ||||
| }, | }, | ||||
| }, { | }, { | ||||
| title: '参与的企业总数', | |||||
| dataIndex: 'join_count', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '已审核企业总数', | |||||
| dataIndex: 'audit_count', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '参与职位数', | |||||
| dataIndex: 'job_count', | |||||
| width: 100, | |||||
| search: false | |||||
| }, { | |||||
| title: '需求人数', | |||||
| dataIndex: 'recruiting_num', | |||||
| width: 100, | |||||
| search: false | |||||
| title: '封面图', | |||||
| dataIndex: 'photo', | |||||
| width: 200, | |||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| <Image src={`${Imageprefix}${record.photo}`} width={60} height={60} /> | |||||
| </> | |||||
| ) | |||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 120, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| setId(record) | setId(record) | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}>编辑</Button>, | }}>编辑</Button>, | ||||
| <Button size='small' type='link' onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '更换图片', | |||||
| content: (<> | |||||
| <ProForm submitter={{ render: false }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="更换图片" image_type={3} imageUrl={record.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </ProForm> | |||||
| </>), | |||||
| async onOk() { | |||||
| // let info = await GetCompanyInfo({ id: record.id }); | |||||
| // let res = await updateCompany({ ...info.data, license_path: uploadedFilelicenseNameRef.current }); | |||||
| // setUploadedFilelicenseName(''); | |||||
| actionRef.current?.reload(); | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true, | |||||
| }); | |||||
| }}>更换图片</Button>, | |||||
| <Button key='2' type='link' onClick={() => { | <Button key='2' type='link' onClick={() => { | ||||
| setId(record) | setId(record) | ||||
| dispatch({ type: 'openModel/getOpenFairDetailModal', payload: true }) | dispatch({ type: 'openModel/getOpenFairDetailModal', payload: true }) | ||||
| }}>详情</Button> | |||||
| }}>详情</Button>, | |||||
| <Button key='3' type='link' onClick={() => { | |||||
| setId(record) | |||||
| dispatch({ type: 'openModel/getOpenFairDetailModal', payload: true }) | |||||
| }}>参与企业</Button> | |||||
| ], | ], | ||||
| }, | }, | ||||
| ]} | ]} | ||||
| setTotal(res.data.total) | setTotal(res.data.total) | ||||
| }) | }) | ||||
| } | } | ||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加招聘会 | |||||
| </Button> | |||||
| toolBarRender={() => [<Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据进行何种操作', | |||||
| content: (<> | |||||
| <h4 style={{ fontWeight: 'bold' }}>状态:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>开启</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>关闭</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| <h4 style={{ fontWeight: 'bold' }}>时长:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>1天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>3天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>7天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>15天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>30天</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量管理招聘会 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加招聘会 | |||||
| </Button> | |||||
| ]} | ]} | ||||
| headerTitle="招聘会列表" | headerTitle="招聘会列表" | ||||
| /> | /> |
| <ProTable | <ProTable | ||||
| size='small' | size='small' | ||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '用户', | title: '用户', | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) |
| ProFormText, | ProFormText, | ||||
| ProFormSegmented, | ProFormSegmented, | ||||
| ProFormSelect, | ProFormSelect, | ||||
| ProFormRadio, | |||||
| ProForm, | ProForm, | ||||
| FormControlRender, | FormControlRender, | ||||
| ProFormDependency, | ProFormDependency, | ||||
| let res = await GetArticleDetail({ id: id }) | let res = await GetArticleDetail({ id: id }) | ||||
| setUploadedFilephotoName(res.data.cover_img) | setUploadedFilephotoName(res.data.cover_img) | ||||
| res.data.section_arr = [res.data.section_name] | res.data.section_arr = [res.data.section_name] | ||||
| setDetail(res.data) | setDetail(res.data) | ||||
| return res.data; | return res.data; | ||||
| } else { | } else { | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| label="文章标题" | |||||
| name="title" | |||||
| placeholder="请输入文章标题" | |||||
| rules={[{ required: true, message: '请输入文章标题' }]} | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.cover_img}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| </Row> | |||||
| <ProFormSwitch fieldProps={{ | |||||
| checked: showUplaod, | |||||
| checkedChildren: '关闭上传文件', | |||||
| unCheckedChildren: '开启上传文件', | |||||
| onChange: (val) => { | |||||
| setShowUplaod(val) | |||||
| } | |||||
| }} /> | |||||
| { | |||||
| showUplaod && <> | |||||
| <DragUpload form_name="doc_url" uploadTxt="上传文件" onUploadComplete={handleFileUploadedDoc}></DragUpload> | |||||
| <Typography.Paragraph copyable>链接:{`${Imageprefix}${uploadedFileDocName}`}</Typography.Paragraph> | |||||
| </> | |||||
| } | |||||
| <Col span={8}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} imageUrl={detail?.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="stick_top" | |||||
| label="是否置顶" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否置顶' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="hot" | |||||
| label="成为热门" | |||||
| request={async () => [ | |||||
| { label: '普通', value: 1 }, | |||||
| { label: '热门推荐', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否成为热门' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="文章标题" | |||||
| name="title" | |||||
| placeholder="请输入文章标题" | |||||
| rules={[{ required: true, message: '请输入文章标题' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormCascader | |||||
| label="栏目/频道" | |||||
| name="section_arr" | |||||
| fieldProps={{ | |||||
| fieldNames: cascaderfieldNames, | |||||
| changeOnSelect: true | |||||
| }} | |||||
| placeholder="请选择栏目/频道" | |||||
| request={(keyword) => | |||||
| listSection({ page: 1, pagesize: 100, keyword: keyword.keyWords, sortby: 'desc', }).then(res => { | |||||
| return res.data.sections; | |||||
| }) | |||||
| } | |||||
| /> | |||||
| </Col> | |||||
| <ProFormCascader | |||||
| label="栏目/频道" | |||||
| name="section_arr" | |||||
| fieldProps={{ | |||||
| fieldNames: cascaderfieldNames, | |||||
| changeOnSelect: true | |||||
| }} | |||||
| placeholder="请选择栏目/频道" | |||||
| request={(keyword) => | |||||
| listSection({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.sections; | |||||
| }) | |||||
| } | |||||
| /> | |||||
| {/* <ProFormSelect | |||||
| showSearch | |||||
| name="section_id" | |||||
| label="栏目/频道" | |||||
| placeholder="请选择栏目/频道" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames | |||||
| }} | |||||
| request={(keyword) => | |||||
| listSection({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.sections; | |||||
| }) | |||||
| } | |||||
| /> */} | |||||
| <Row gutter={[16, 16]}> | |||||
| <Col span={24}> | <Col span={24}> | ||||
| <Form.Item | <Form.Item | ||||
| name='content' | name='content' | ||||
| </FormControlRender> | </FormControlRender> | ||||
| </Form.Item> | </Form.Item> | ||||
| </Col> | </Col> | ||||
| <Col span={24}> | |||||
| <ProFormSwitch fieldProps={{ | |||||
| checked: showUplaod, | |||||
| checkedChildren: '关闭上传文件', | |||||
| unCheckedChildren: '开启上传文件', | |||||
| onChange: (val) => { | |||||
| setShowUplaod(val) | |||||
| } | |||||
| }} /> | |||||
| { | |||||
| showUplaod && <> | |||||
| <DragUpload form_name="doc_url" uploadTxt="上传文件" onUploadComplete={handleFileUploadedDoc}></DragUpload> | |||||
| <Typography.Paragraph copyable>链接:{`${Imageprefix}${uploadedFileDocName}`}</Typography.Paragraph> | |||||
| </> | |||||
| } | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| name="author" | |||||
| label="作者" | |||||
| placeholder="请输入作者" | |||||
| /> | |||||
| </Col> | |||||
| </Row> | </Row> | ||||
| <ProFormSegmented | |||||
| name="stick_top" | |||||
| label="是否置顶" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否置顶' }]} | |||||
| /> | |||||
| <ProFormSegmented | |||||
| name="hot" | |||||
| label="成为热门" | |||||
| request={async () => [ | |||||
| { label: '普通', value: 1 }, | |||||
| { label: '热门推荐', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否成为热门' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| name="author" | |||||
| label="作者" | |||||
| placeholder="请输入作者" | |||||
| /> | |||||
| </ProForm> | </ProForm> | ||||
| </Modal> | </Modal> |
| import { connect, history } from '@umijs/max'; | import { connect, history } from '@umijs/max'; | ||||
| import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | import { | ||||
| ProTable, TableDropdown,ProFormSelect | |||||
| ProTable, TableDropdown, ProFormSelect | |||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Popconfirm, message , Tag} from 'antd'; | |||||
| import { listArticle, listSection, delArticle} from '@/apis/api'; | |||||
| import { Button, Image, ConfigProvider, Popconfirm, message, Modal } from 'antd'; | |||||
| import { listArticle, listSection, delArticle } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| const selectfieldNames = { label: 'name', value: 'id', children: 'childs' }; | const selectfieldNames = { label: 'name', value: 'id', children: 'childs' }; | ||||
| import UploadModel from '@/components/Common/upload'; | |||||
| const PagesMainInformationArticleTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesMainInformationArticleTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| const actionRef = useRef<ActionType>(); | const actionRef = useRef<ActionType>(); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| const [uploadedFilephotoName, setUploadedFilephotoName] = useState<string>(''); | |||||
| const uploadedFilephotoNameRef = useRef<string>(''); | |||||
| const handleFileUploadedphoto = (filename: string) => { | |||||
| setUploadedFilephotoName(filename); | |||||
| }; | |||||
| useEffect(() => { | |||||
| uploadedFilephotoNameRef.current = uploadedFilephotoName; | |||||
| }, [uploadedFilephotoName]) | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| columns={[ { | |||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[{ | |||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | |||||
| title: '文章名', | |||||
| dataIndex: 'title', | |||||
| width: 400, | |||||
| }, | |||||
| { | |||||
| title: '所属栏目', | |||||
| dataIndex: 'section_name', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '所属栏目', | |||||
| dataIndex: 'section_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| width='lg' | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| }} | |||||
| request={async (keyword) => | |||||
| listSection({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.sections; | |||||
| }) | |||||
| } | |||||
| placeholder="请选择所属栏目" | |||||
| /> | |||||
| ) | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '封面图', | |||||
| dataIndex: 'cover_img', | |||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| <Image src={`${Imageprefix}${record.cover_img}`} width={40} height={40}/> | |||||
| </> | |||||
| { | |||||
| title: '文章名', | |||||
| dataIndex: 'title', | |||||
| width: 200, | |||||
| }, | |||||
| { | |||||
| title: '所属栏目', | |||||
| dataIndex: 'section_name', | |||||
| search: false, | |||||
| width: 200, | |||||
| }, | |||||
| { | |||||
| title: '所属栏目', | |||||
| dataIndex: 'section_id', | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| renderFormItem: () => { | |||||
| return ( | |||||
| <ProFormSelect | |||||
| width='lg' | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| }} | |||||
| request={async (keyword) => | |||||
| listSection({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.sections; | |||||
| }) | |||||
| } | |||||
| placeholder="请选择所属栏目" | |||||
| /> | |||||
| ) | ) | ||||
| } | |||||
| }, | |||||
| { | |||||
| title: '封面图', | |||||
| dataIndex: 'cover_img', | |||||
| search: false, | |||||
| width: 200, | |||||
| render: (_, record) => (<> | |||||
| <Image src={`${Imageprefix}${record.cover_img}`} width={60} height={60} /> | |||||
| </> | |||||
| ) | |||||
| }, | |||||
| { | |||||
| title: '置顶', | |||||
| dataIndex: 'stick_top', | |||||
| width: 200, | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '置顶', | |||||
| status: 'Processing' | |||||
| }, | |||||
| 2: { | |||||
| text: '未置顶', | |||||
| status: 'Error' | |||||
| }, | |||||
| }, | }, | ||||
| { | |||||
| title: '置顶', | |||||
| dataIndex: 'stick_top', | |||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| { | |||||
| <> | |||||
| {record.stick_top === 1 ? <Tag color="green">置顶</Tag> : <Tag>未置顶</Tag>} | |||||
| </> | |||||
| } | |||||
| </>), | |||||
| }, | |||||
| { | |||||
| title: '热门', | |||||
| dataIndex: 'hot', | |||||
| search: false, | |||||
| width: 200, | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '热门推荐', | |||||
| status: 'Processing' | |||||
| }, | |||||
| 2: { | |||||
| text: '普通', | |||||
| status: 'Error' | |||||
| }, | |||||
| }, | }, | ||||
| { | |||||
| title: '热门', | |||||
| dataIndex: 'hot', | |||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| { | |||||
| <> | |||||
| {record.hot === 1 ? <Tag >普通</Tag> : <Tag color="red">热门推荐</Tag>} | |||||
| </> | |||||
| } | |||||
| }, | |||||
| </>), | |||||
| }, | |||||
| { | |||||
| title: '作者', | |||||
| dataIndex: 'author', | |||||
| search: false | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| width: 300, | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Popconfirm | |||||
| { | |||||
| title: '作者', | |||||
| dataIndex: 'author', | |||||
| search: false, | |||||
| width: 200, | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| key: 'option', | |||||
| valueType: 'option', | |||||
| render: (_, record, action) => [ | |||||
| <Button key='1' type='link' onClick={() => { | |||||
| setId(record.id) | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}>编辑</Button>, | |||||
| <Button size='small' type='link' onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '更换图片', | |||||
| content: (<> | |||||
| <ProForm submitter={{ render: false }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="更换图片" image_type={3} imageUrl={record.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </ProForm> | |||||
| </>), | |||||
| async onOk() { | |||||
| // let info = await GetCompanyInfo({ id: record.id }); | |||||
| // let res = await updateCompany({ ...info.data, license_path: uploadedFilelicenseNameRef.current }); | |||||
| // setUploadedFilelicenseName(''); | |||||
| actionRef.current?.reload(); | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true, | |||||
| }); | |||||
| }}>更换图片</Button>, | |||||
| <Popconfirm | |||||
| title="是否删除" | title="是否删除" | ||||
| onConfirm={(e) => { | onConfirm={(e) => { | ||||
| delArticle({ id: record.id }).then(res => { | delArticle({ id: record.id }).then(res => { | ||||
| okText="删除" | okText="删除" | ||||
| cancelText="取消" | cancelText="取消" | ||||
| > | > | ||||
| <a | |||||
| <Button | |||||
| type='link' | |||||
| key="delete" | key="delete" | ||||
| > | > | ||||
| 删除 | 删除 | ||||
| </a> | |||||
| </Button> | |||||
| </Popconfirm> | </Popconfirm> | ||||
| ], | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| ]} | ]} | ||||
| rowKey="id" | rowKey="id" | ||||
| pagination={{ | pagination={{ |
| import { | import { | ||||
| ProFormText, | ProFormText, | ||||
| ProFormSegmented, | ProFormSegmented, | ||||
| ProFormSelect, | |||||
| ProFormRadio, | |||||
| ProForm | ProForm | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch } from 'antd'; | import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch } from 'antd'; | ||||
| cover_img: '', | cover_img: '', | ||||
| parent_id: -1, | parent_id: -1, | ||||
| description: '', | description: '', | ||||
| display: 1 | |||||
| display: 1, | |||||
| park: 2 | |||||
| } | } | ||||
| } | } | ||||
| }} | }} | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| label="栏目名称" | |||||
| name="name" | |||||
| placeholder="请输入栏目名称" | |||||
| rules={[{ required: true, message: '请输入栏目名称' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="栏目编码,用英文字母表示,编码不能与其他栏目编码重复" | |||||
| name="code" | |||||
| placeholder="请输入栏目编码,用英文字母表示,编码不能与其他栏目编码重复" | |||||
| rules={[{ required: true, message: '请输入栏目编码,用英文字母表示,编码不能与其他栏目编码重复' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| name="description" | |||||
| label="描述" | |||||
| placeholder="请输入描述" | |||||
| rules={[{ required: true, message: '请输入描述' } | |||||
| ]} | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.cover_img}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| <Col span={24}> | |||||
| <UploadModel multiple={false} form_name="cover_img" image_length={1} uploadTxt="上传封面图" image_type={3} imageUrl={detail?.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| label="栏目名称" | |||||
| name="name" | |||||
| placeholder="请输入栏目名称" | |||||
| rules={[{ required: true, message: '请输入栏目名称' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={16}> | |||||
| <ProFormText | |||||
| label="栏目编码,用英文字母表示,不可重复" | |||||
| name="code" | |||||
| placeholder="栏目编码,用英文字母表示,不可重复" | |||||
| rules={[{ required: true, message: '请输入栏目编码,用英文字母表示,不可重' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormText | |||||
| name="description" | |||||
| label="描述" | |||||
| placeholder="请输入描述" | |||||
| rules={[{ required: true, message: '请输入描述' } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="display" | |||||
| label="是否显示" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={8}> | |||||
| <ProFormRadio.Group | |||||
| name="park" | |||||
| label="是否是科创园栏目" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| /> | |||||
| </Col> | |||||
| </Row> | </Row> | ||||
| <ProFormSegmented | |||||
| name="display" | |||||
| label="是否显示" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| /> | |||||
| <ProFormSegmented | |||||
| name="park" | |||||
| label="是否是科创园栏目" | |||||
| request={async () => [ | |||||
| { label: '是', value: 1 }, | |||||
| { label: '否', value: 2 } | |||||
| ]} | |||||
| /> | |||||
| </ProForm> | </ProForm> | ||||
| </Modal> | </Modal> | ||||
| </ConfigProvider> | </ConfigProvider> |
| import { connect, history } from '@umijs/max'; | import { connect, history } from '@umijs/max'; | ||||
| import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; | ||||
| import { | import { | ||||
| ProTable, TableDropdown | |||||
| ProTable, ProForm | |||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Popconfirm, message,Tag } from 'antd'; | |||||
| import { Button, Image, ConfigProvider, Popconfirm, message, Modal } from 'antd'; | |||||
| import { listSection, delSection } from '@/apis/api'; | import { listSection, delSection } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| import UploadModel from '@/components/Common/upload'; | |||||
| const PagesMainInformationSectionTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesMainInformationSectionTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| const actionRef = useRef<ActionType>(); | const actionRef = useRef<ActionType>(); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openModal) { | if (!openModel.openModal) { | ||||
| actionRef.current.reload(); | |||||
| actionRef.current?.reload(); | |||||
| } | } | ||||
| }, [openModel.openModal]) | }, [openModel.openModal]) | ||||
| const [uploadedFilephotoName, setUploadedFilephotoName] = useState<string>(''); | |||||
| const uploadedFilephotoNameRef = useRef<string>(''); | |||||
| const handleFileUploadedphoto = (filename: string) => { | |||||
| setUploadedFilephotoName(filename); | |||||
| }; | |||||
| useEffect(() => { | |||||
| uploadedFilephotoNameRef.current = uploadedFilephotoName; | |||||
| }, [uploadedFilephotoName]) | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '栏目名称', | title: '栏目名称', | ||||
| dataIndex: 'name' | |||||
| dataIndex: 'name', | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '栏目编码', | title: '栏目编码', | ||||
| dataIndex: 'code' | |||||
| dataIndex: 'code', | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '可见', | title: '可见', | ||||
| dataIndex: 'display', | dataIndex: 'display', | ||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| { | |||||
| <> | |||||
| {record.display === 1 ? <Tag color="green">可见</Tag> : <Tag>不可见</Tag>} | |||||
| </> | |||||
| } | |||||
| </>), | |||||
| width: 200, | |||||
| valueEnum: { | |||||
| 0: { text: '全部' }, | |||||
| 1: { | |||||
| text: '可见', | |||||
| status: 'Processing' | |||||
| }, | |||||
| 2: { | |||||
| text: '不可见', | |||||
| status: 'Error' | |||||
| }, | |||||
| }, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '封面图', | title: '封面图', | ||||
| dataIndex: 'cover_img', | dataIndex: 'cover_img', | ||||
| search: false, | search: false, | ||||
| width: 200, | |||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| <Image src={`${Imageprefix}${record.cover_img}`} width={40} height={40} /> | <Image src={`${Imageprefix}${record.cover_img}`} width={40} height={40} /> | ||||
| </> | </> | ||||
| { | { | ||||
| title: '描述', | title: '描述', | ||||
| dataIndex: 'description', | dataIndex: 'description', | ||||
| width: 200, | |||||
| search: false | search: false | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record) | setId(record) | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}>编辑</Button>, | }}>编辑</Button>, | ||||
| <Button size='small' type='link' onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '更换图片', | |||||
| content: (<> | |||||
| <ProForm submitter={{ render: false }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="更换图片" image_type={3} imageUrl={record.photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </ProForm> | |||||
| </>), | |||||
| async onOk() { | |||||
| // let info = await GetCompanyInfo({ id: record.id }); | |||||
| // let res = await updateCompany({ ...info.data, license_path: uploadedFilelicenseNameRef.current }); | |||||
| // setUploadedFilelicenseName(''); | |||||
| actionRef.current?.reload(); | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true, | |||||
| }); | |||||
| }}>更换图片</Button>, | |||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| record.nextlevel = record.id // 添加下级栏目,把id赋值给nextlevel | record.nextlevel = record.id // 添加下级栏目,把id赋值给nextlevel | ||||
| setId(record) | setId(record) | ||||
| okText="删除" | okText="删除" | ||||
| cancelText="取消" | cancelText="取消" | ||||
| > | > | ||||
| <a | |||||
| <Button | |||||
| danger | |||||
| type='link' | |||||
| key="delete" | key="delete" | ||||
| > | > | ||||
| 删除 | 删除 | ||||
| </a> | |||||
| </Button> | |||||
| </Popconfirm> | </Popconfirm> | ||||
| ], | ], | ||||
| }, | }, | ||||
| }) | }) | ||||
| } | } | ||||
| headerTitle="栏目/频道" | headerTitle="栏目/频道" | ||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加栏目/频道 | |||||
| </Button> | |||||
| toolBarRender={() => [<Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据进行何种操作', | |||||
| content: (<> | |||||
| <h4 style={{ fontWeight: 'bold' }}>状态:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>开启</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>关闭</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| <h4 style={{ fontWeight: 'bold' }}>时长:</h4> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Row gutter={[20, 20]} style={{ padding: 20 }}> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>1天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>3天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>7天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>15天</Radio> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <Radio value={1}>30天</Radio> | |||||
| </Col> | |||||
| </Row> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量管理可见状态 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | |||||
| }}> | |||||
| 添加栏目/频道 | |||||
| </Button> | |||||
| ]} | ]} | ||||
| expandable={{ | expandable={{ | ||||
| childrenColumnName: 'childs', // 指定子节点数据的字段名 | childrenColumnName: 'childs', // 指定子节点数据的字段名 |
| import { | import { | ||||
| ProTable | ProTable | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, ConfigProvider, Select } from 'antd'; | |||||
| import { | |||||
| Button, ConfigProvider, Modal, | |||||
| Radio | |||||
| } from 'antd'; | |||||
| import { GetCustomerList, GetCustomerDetail, PostCustomerUpdate, PostCustomerDel } from '@/apis/api'; | import { GetCustomerList, GetCustomerDetail, PostCustomerUpdate, PostCustomerDel } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| scroll={{ x: 1300 }} | |||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '用户', | title: '用户', | ||||
| }, { | }, { | ||||
| title: '邮箱', | title: '邮箱', | ||||
| dataIndex: 'email', | dataIndex: 'email', | ||||
| search: false | |||||
| search: false, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '联系方式', | title: '联系方式', | ||||
| dataIndex: 'mobile', | dataIndex: 'mobile', | ||||
| search: false | |||||
| search: false, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '登录次数', | title: '登录次数', | ||||
| dataIndex: 'login_count', | dataIndex: 'login_count', | ||||
| search: false | |||||
| search: false, | |||||
| width: 200 | |||||
| }, | }, | ||||
| { | { | ||||
| title: '账号状态', | title: '账号状态', | ||||
| dataIndex: 'status', | dataIndex: 'status', | ||||
| width: 200, | |||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| { | |||||
| <> | |||||
| <Select style={{ width: '100%' }} | |||||
| value={record.status === 1 ? '使用' : '禁用'} | |||||
| options={[{ name: '正常', id: 1 }, { name: '禁用', id: 2 }]} | |||||
| fieldNames={selectfieldNames} | |||||
| onChange={(value) => { | |||||
| PostCustomerUpdate({ | |||||
| id: record.id, | |||||
| status: value | |||||
| }).then(res => { | |||||
| actionRef.current.reload() | |||||
| }) | |||||
| }}> | |||||
| </Select> | |||||
| </> | |||||
| } | |||||
| <Radio.Group size='small' value={record.status} onChange={async (e) => { | |||||
| PostCustomerUpdate({ | |||||
| id: record.id, | |||||
| status: e.target.value | |||||
| }).then(res => { | |||||
| actionRef.current?.reload() | |||||
| }) | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>使用中</Radio> | |||||
| <Radio value={2}>已禁用</Radio> | |||||
| </Radio.Group> | |||||
| </>), | </>), | ||||
| valueType: 'select', | valueType: 'select', | ||||
| valueEnum: { | valueEnum: { | ||||
| { | { | ||||
| title: '注册日期', | title: '注册日期', | ||||
| dataIndex: 'created_at', | dataIndex: 'created_at', | ||||
| search: false | |||||
| search: false, | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 100, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record) | setId(record) | ||||
| }) | }) | ||||
| } | } | ||||
| headerTitle="简历列表" | headerTitle="简历列表" | ||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据进行何种操作', | |||||
| content: (<> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>开通</Radio> | |||||
| <Radio value={2}>禁用</Radio> | |||||
| </Radio.Group> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量管理账号 | |||||
| </Button>, | |||||
| ]} | |||||
| /> | /> | ||||
| </ConfigProvider> | </ConfigProvider> | ||||
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={'80%'} | |||||
| width={1200} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} |
| theme={{ | theme={{ | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| } , components: { | |||||
| }, components: { | |||||
| Segmented: { | Segmented: { | ||||
| itemSelectedBg: '#19be6e', | itemSelectedBg: '#19be6e', | ||||
| itemSelectedColor: '#ffffff' | itemSelectedColor: '#ffffff' | ||||
| let res = await GetJobapplicantDetail({ customer_id: id.customer_id }) | let res = await GetJobapplicantDetail({ customer_id: id.customer_id }) | ||||
| res.data.reg_arr = [ | res.data.reg_arr = [ | ||||
| res.data.reg_level1 ? res.data.reg_level1 : 0, | res.data.reg_level1 ? res.data.reg_level1 : 0, | ||||
| res.data.reg_level2? res.data.reg_level2 : 0, | |||||
| res.data.reg_level2 ? res.data.reg_level2 : 0, | |||||
| res.data.reg_level3 ? res.data.reg_level3 : 0, | res.data.reg_level3 ? res.data.reg_level3 : 0, | ||||
| res.data.reg_level4 ? res.data.reg_level4 : 0 | res.data.reg_level4 ? res.data.reg_level4 : 0 | ||||
| ] | ] | ||||
| }} | }} | ||||
| > | > | ||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | |||||
| detail ? | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="个人照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${detail?.photo}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> : <> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="个人照片" image_type={3} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginTop: '32px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </Col> | |||||
| </> | |||||
| } | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="photo" image_length={1} uploadTxt="个人照片" image_type={3} imageUrl={uploadedFilephotoName} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </Col> | |||||
| <Col span={8}> | <Col span={8}> | ||||
| <ProFormText | <ProFormText | ||||
| label="姓名" | label="姓名" | ||||
| }, () => ({ | }, () => ({ | ||||
| validator: (rule, value) => { | validator: (rule, value) => { | ||||
| let info = verifyIdCard(value); | let info = verifyIdCard(value); | ||||
| if (typeof (info) == 'boolean') { | if (typeof (info) == 'boolean') { | ||||
| return Promise.resolve(); | return Promise.resolve(); | ||||
| } | } |
| } | } | ||||
| }} | }} | ||||
| columns={[ { | |||||
| columns={[{ | |||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| editable: false, | editable: false, | ||||
| width: 100 | width: 100 | ||||
| }, | }, | ||||
| { | |||||
| title: '证书名称', | |||||
| dataIndex: 'name', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请输入证书名称', | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '证书描述', | |||||
| dataIndex: 'description', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请输入证书描述', | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| { | |||||
| title: '证书名称', | |||||
| dataIndex: 'name', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请输入证书名称', | |||||
| }, | |||||
| ], | |||||
| }, | }, | ||||
| { | |||||
| title: '证书', | |||||
| dataIndex: 'certificate_photo', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请上传证书', | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| render: (text, record) => ( | |||||
| <> | |||||
| <Image src={`${Imageprefix + record.certificate_photo}`} width={40} height={40} preview={false} /> | |||||
| </> | |||||
| ), | |||||
| renderFormItem: (_, record, { isEditable }) => { | |||||
| return isEditable ? <> | |||||
| { | |||||
| <Row> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="certificate_photo" image_length={1} uploadTxt="证书" image_type={2} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{ marginLeft: '16px', width: '100px', height: '100px' }}></Image> : <Image src={`${Imageprefix}${record?.certificate_photo}`} style={{ marginLeft: '16px', marginTop: '32px', width: '100px', height: '100px' }}></Image>} | |||||
| </Col> | |||||
| </Row> | |||||
| } | |||||
| </> : | |||||
| <> | |||||
| { | |||||
| <Row> | |||||
| <Col span={24} style={{ display: 'flex' }}> | |||||
| <UploadModel multiple={false} form_name="certificate_photo" image_length={1} uploadTxt="证书" image_type={2} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| {uploadedFilephotoName ? <Col span={8}> <Image src={`${Imageprefix}${uploadedFilephotoName}`} style={{marginLeft: '16px', width: '100px', height: '100px' }}></Image> </Col> : ''} | |||||
| </Col> | |||||
| </Row> | |||||
| } | |||||
| </>; | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '证书描述', | |||||
| dataIndex: 'description', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请输入证书描述', | |||||
| }, | |||||
| ], | |||||
| }, | }, | ||||
| { | |||||
| title: '操作', | |||||
| valueType: 'option', | |||||
| width: 200, | |||||
| render: (text, record, _, action) => [ | |||||
| <a | |||||
| key="editable" | |||||
| onClick={() => { | |||||
| action?.startEditable?.(record.id); | |||||
| }} | |||||
| > | |||||
| 编辑 | |||||
| </a>, | |||||
| <a | |||||
| key="delete" | |||||
| onClick={() => { | |||||
| }} | |||||
| > | |||||
| 删除 | |||||
| </a>, | |||||
| }, | |||||
| { | |||||
| title: '证书', | |||||
| dataIndex: 'certificate_photo', | |||||
| formItemProps: { | |||||
| rules: [ | |||||
| { | |||||
| required: true, | |||||
| message: '请上传证书', | |||||
| }, | |||||
| ], | ], | ||||
| }, | }, | ||||
| render: (text, record) => ( | |||||
| <> | |||||
| <Image src={`${Imageprefix + record.certificate_photo}`} width={40} height={40} preview={false} /> | |||||
| </> | |||||
| ), | |||||
| renderFormItem: (_, record, { isEditable }) => { | |||||
| return isEditable ? <> | |||||
| <UploadModel multiple={false} form_name="certificate_photo" image_length={1} uploadTxt="证书" image_type={2} imageUrl={record.certificate_photo} onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </> : | |||||
| <> | |||||
| <UploadModel multiple={false} form_name="certificate_photo" image_length={1} uploadTxt="证书" image_type={2} imageUrl='' onUploadComplete={handleFileUploadedphoto}></UploadModel> | |||||
| </>; | |||||
| }, | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| valueType: 'option', | |||||
| width: 200, | |||||
| render: (text, record, _, action) => [ | |||||
| <a | |||||
| key="editable" | |||||
| onClick={() => { | |||||
| action?.startEditable?.(record.id); | |||||
| }} | |||||
| > | |||||
| 编辑 | |||||
| </a>, | |||||
| <a | |||||
| key="delete" | |||||
| onClick={() => { | |||||
| }} | |||||
| > | |||||
| 删除 | |||||
| </a>, | |||||
| ], | |||||
| }, | |||||
| ]} | ]} | ||||
| editable={{ | editable={{ | ||||
| type: 'single', | type: 'single', |
| import { | import { | ||||
| ProTable, ProForm, ProFormSelect, ProFormText, ProFormDependency | ProTable, ProForm, ProFormSelect, ProFormText, ProFormDependency | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, ConfigProvider, Image, message, Select, Input, Row, Col, Space, Flex } from 'antd'; | |||||
| import { Button, ConfigProvider, Image, message, Modal, Input, Row, Col, Space, Radio, Descriptions } from 'antd'; | |||||
| import { PostJobseekerList, PostJobseekerExport, PostJobapplicantUpdate } from '@/apis/api'; | import { PostJobseekerList, PostJobseekerExport, PostJobapplicantUpdate } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| dispatch({ type: 'dictModel/getList', payload: { code: 2027, type: 'setIndustryPostList' } }) | dispatch({ type: 'dictModel/getList', payload: { code: 2027, type: 'setIndustryPostList' } }) | ||||
| dispatch({ type: 'dictModel/getList', payload: { code: 2010, type: 'setPoliticalList' } }) | dispatch({ type: 'dictModel/getList', payload: { code: 2010, type: 'setPoliticalList' } }) | ||||
| }, []) | }, []) | ||||
| const expandedRowRender = (record) => { | |||||
| return ( | |||||
| <> | |||||
| <Space direction='vertical' style={{ width: '100%' }}> | |||||
| <Descriptions title="基本信息" bordered column={3} contentStyle={{ fontWeight: 'bold' }} labelStyle={{ width: 180 }}> | |||||
| <Descriptions.Item label="英语">{record.english_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="国语">{record.mandarin_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="粤语">{record.cantonese_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="职称">{record.title_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="政治面貌">{record.political_status_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="月薪要求范围">{record.salary_range_txt}</Descriptions.Item> | |||||
| <Descriptions.Item label="审核状态"> | |||||
| <Radio.Group size='small' defaultValue={record.status} onChange={async (e) => { | |||||
| let res = await PostJobapplicantUpdate({ customer_id: record.customer_id, id: record.id, status: e.target.value }); | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={1}>待审</Radio> | |||||
| <Radio value={2}>通过</Radio> | |||||
| <Radio value={3}>不通过</Radio> | |||||
| </Radio.Group> | |||||
| </Descriptions.Item> | |||||
| { | |||||
| record.status == 3 ? <> | |||||
| <Descriptions.Item label="不通过原因"> | |||||
| <Input size='small' placeholder='输入原因,按回车键保存' defaultValue={record.status_txt} onPressEnter={async (e) => { | |||||
| let res = await PostJobapplicantUpdate({ customer_id: record.customer_id, id: record.id, status: 3, audit_memo: e.target.value }); | |||||
| actionRef.current?.reload(); | |||||
| }}></Input> | |||||
| </Descriptions.Item> | |||||
| </> : record.status_txt | |||||
| } | |||||
| </Descriptions> | |||||
| </Space > | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ConfigProvider | <ConfigProvider | ||||
| <ProTable | <ProTable | ||||
| size='small' | size='small' | ||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| rowSelection={{ | |||||
| type: 'checkbox' | |||||
| }} | |||||
| expandable={{ | |||||
| expandedRowRender | |||||
| }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '筛选日期', | title: '筛选日期', | ||||
| dataIndex: 'date_range', | dataIndex: 'date_range', | ||||
| hidden: true, | hidden: true, | ||||
| width: 120, | |||||
| width: 200, | |||||
| valueType: 'dateRange', | valueType: 'dateRange', | ||||
| }, | }, | ||||
| { | { | ||||
| }, { | }, { | ||||
| title: '性别', | title: '性别', | ||||
| dataIndex: 'gender', | dataIndex: 'gender', | ||||
| width: 80, | |||||
| width: 200, | |||||
| valueType: 'select', | valueType: 'select', | ||||
| valueEnum: { | valueEnum: { | ||||
| '男': '男', | '男': '男', | ||||
| }, { | }, { | ||||
| title: '教育程度', | title: '教育程度', | ||||
| dataIndex: 'education_txt', | dataIndex: 'education_txt', | ||||
| width: 120, | |||||
| width: 200, | |||||
| search: false | search: false | ||||
| }, { | }, { | ||||
| title: '教育程度', | title: '教育程度', | ||||
| dataIndex: 'education', | dataIndex: 'education', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| title: '英语', | |||||
| dataIndex: 'english_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '英语', | title: '英语', | ||||
| dataIndex: 'english', | dataIndex: 'english', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| title: '国语', | |||||
| dataIndex: 'mandarin_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '国语', | title: '国语', | ||||
| dataIndex: 'mandarin', | dataIndex: 'mandarin', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| fieldNames: selectfieldNames, | fieldNames: selectfieldNames, | ||||
| options: dictModel.degreeList | options: dictModel.degreeList | ||||
| } | } | ||||
| }, { | |||||
| title: '粤语', | |||||
| dataIndex: 'cantonese_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | }, { | ||||
| title: '粤语', | title: '粤语', | ||||
| dataIndex: 'cantonese', | dataIndex: 'cantonese', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| title: '职称', | |||||
| dataIndex: 'title_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '职称', | title: '职称', | ||||
| dataIndex: 'title', | dataIndex: 'title', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| title: '政治面貌', | |||||
| dataIndex: 'political_status_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | |||||
| title: '政治面貌', | title: '政治面貌', | ||||
| dataIndex: 'political_status', | dataIndex: 'political_status', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| fieldNames: selectfieldNames, | fieldNames: selectfieldNames, | ||||
| options: dictModel.politicalList | options: dictModel.politicalList | ||||
| } | } | ||||
| }, { | |||||
| title: '月薪要求范围', | |||||
| dataIndex: 'salary_range_txt', | |||||
| width: 120, | |||||
| search: false | |||||
| }, { | }, { | ||||
| title: '月薪要求', | title: '月薪要求', | ||||
| dataIndex: 'salary_range_desire', | dataIndex: 'salary_range_desire', | ||||
| width: 120, | |||||
| width: 200, | |||||
| hidden: true, | hidden: true, | ||||
| valueType: 'select', | valueType: 'select', | ||||
| fieldProps: { | fieldProps: { | ||||
| }, | }, | ||||
| { | { | ||||
| title: '审核状态', | title: '审核状态', | ||||
| dataIndex: 'status_txt', | |||||
| width: 120, | |||||
| search: false, | |||||
| render: (_, record) => (<> | |||||
| <Select style={{ width: 100 }} size='small' defaultValue={record.status_txt} options={[ | |||||
| { | |||||
| label: '待审', | |||||
| value: 1, | |||||
| }, | |||||
| { | |||||
| label: '通过', | |||||
| value: 2, | |||||
| }, | |||||
| { | |||||
| label: '不通过', | |||||
| value: 3, | |||||
| }, | |||||
| ]} onChange={async (value) => { | |||||
| let res = await PostJobapplicantUpdate({ customer_id: record.customer_id, id: record.id, status: value }); | |||||
| actionRef.current.reload(); | |||||
| }} /> | |||||
| </>) | |||||
| }, | |||||
| { | |||||
| title: '审核原因', | |||||
| dataIndex: 'audit_memo', | |||||
| dataIndex: 'status', | |||||
| width: 200, | width: 200, | ||||
| search: false, | |||||
| render: (_, record) => ( | |||||
| <> | |||||
| { | |||||
| record.status == 3 ? <> | |||||
| <Input size='small' placeholder='输入原因,按回车键保存' onPressEnter={async (e) => { | |||||
| let res = await PostJobapplicantUpdate({ customer_id: record.customer_id, id: record.id, status: 3, audit_memo: e.target.value }); | |||||
| actionRef.current.reload(); | |||||
| }}></Input></> : record.status_txt | |||||
| } | |||||
| </> | |||||
| ) | |||||
| hidden: true, | |||||
| valueType: 'select', | |||||
| valueEnum: { | |||||
| 0: '全部', | |||||
| 1: '待审核', | |||||
| 2: '审核通过', | |||||
| 3: '审核不通过' | |||||
| } | |||||
| }, | }, | ||||
| // { | |||||
| // title: '审核状态', | |||||
| // dataIndex: 'status', | |||||
| // width: 120, | |||||
| // hidden: true, | |||||
| // valueType: 'select', | |||||
| // valueEnum: { | |||||
| // 0: '全部', | |||||
| // 1: '待审核', | |||||
| // 2: '审核通过', | |||||
| // 3: '审核不通过' | |||||
| // } | |||||
| // }, | |||||
| { | { | ||||
| title: '简历是否可见', | title: '简历是否可见', | ||||
| dataIndex: 'hide_resume', | dataIndex: 'hide_resume', | ||||
| width: 120, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| { | { | ||||
| { | { | ||||
| title: '简历是否在家政模块可见', | title: '简历是否在家政模块可见', | ||||
| dataIndex: 'house_keeping_status', | dataIndex: 'house_keeping_status', | ||||
| width: 120, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| { | { | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 400, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record) | setId(record) | ||||
| setTotal(res.data.total) | setTotal(res.data.total) | ||||
| }) | }) | ||||
| } | } | ||||
| toolBarRender={() => [ | |||||
| <Button type="primary" onClick={() => { | |||||
| message.info('数据导出需要时间,请耐心等待') | |||||
| PostJobseekerExport().then(res => { | |||||
| let url = Imageprefix + res.data.excel_url; | |||||
| window.open(url); | |||||
| message.info('数据导出完毕') | |||||
| }) | |||||
| }}> | |||||
| 导出数据 | |||||
| </Button> | |||||
| toolBarRender={() => [<Button type="primary" onClick={(record) => { | |||||
| Modal.confirm({ | |||||
| title: '请选择对批量数据审核', | |||||
| content: (<> | |||||
| <Space direction='vertical' style={{ width: '100%', padding: 20 }}> | |||||
| <Radio.Group size='small' onChange={async (e) => { | |||||
| actionRef.current?.reload(); | |||||
| }}> | |||||
| <Radio value={2}>通过</Radio> | |||||
| <Radio value={3}>不通过</Radio> | |||||
| </Radio.Group> | |||||
| <h4>如不通过请输入原因,按回车键保存,也可不填</h4> | |||||
| <Input style={{ width: '100%' }} placeholder='此处不通过原因' defaultValue={record.status_txt} onPressEnter={async (e) => { | |||||
| let res = await PostJobapplicantUpdate({ customer_id: record.customer_id, id: record.id, status: 3, audit_memo: e.target.value }); | |||||
| actionRef.current?.reload(); | |||||
| }}></Input> | |||||
| </Space> | |||||
| </>), | |||||
| onOk() { | |||||
| }, | |||||
| onCancel() { | |||||
| console.log('Cancel'); | |||||
| }, | |||||
| okText: '保存', | |||||
| cancelText: '取消', | |||||
| centered: true | |||||
| }); | |||||
| }}> | |||||
| 批量审核 | |||||
| </Button>, | |||||
| <Button type="primary" onClick={() => { | |||||
| message.info('数据导出需要时间,请耐心等待') | |||||
| PostJobseekerExport().then(res => { | |||||
| let url = Imageprefix + res.data.excel_url; | |||||
| window.open(url); | |||||
| message.info('数据导出完毕') | |||||
| }) | |||||
| }}> | |||||
| 导出数据 | |||||
| </Button> | |||||
| ]} | ]} | ||||
| headerTitle="简历列表" | headerTitle="简历列表" | ||||
| /> | /> |
| }} | }} | ||||
| onFinish={async (values) => { | onFinish={async (values) => { | ||||
| values.province = values.location_arr && values.location_arr.length > 0 && values.location_arr[0] ? values.location_arr[0] : 0; | values.province = values.location_arr && values.location_arr.length > 0 && values.location_arr[0] ? values.location_arr[0] : 0; | ||||
| values.city = values.location_arr && values.location_arr.length > 0 && values.location_arr[1] ? values.location_arr[1] : 0; | |||||
| values.district = values.location_arr && values.location_arr.length > 0 && values.location_arr[2] ? values.location_arr[2] : 0; | |||||
| values.street = values.location_arr && values.location_arr.length > 0 && values.location_arr[3] ? values.location_arr[3] : 0; | |||||
| values.city = values.location_arr && values.location_arr.length > 0 && values.location_arr[1] ? values.location_arr[1] : 0; | |||||
| values.district = values.location_arr && values.location_arr.length > 0 && values.location_arr[2] ? values.location_arr[2] : 0; | |||||
| values.street = values.location_arr && values.location_arr.length > 0 && values.location_arr[3] ? values.location_arr[3] : 0; | |||||
| delete values.location_arr; | delete values.location_arr; | ||||
| values.roleids = values.roleids.join(',') | values.roleids = values.roleids.join(',') | ||||
| console.log(values.roleids) | console.log(values.roleids) | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| label="手机号" | |||||
| name="mobile" | |||||
| placeholder="请输入手机号" | |||||
| rules={[{ required: true, message: '请输入手机号' }]} | |||||
| /> | |||||
| <ProFormText.Password | |||||
| label="密码" | |||||
| name="password" | |||||
| placeholder="请输入密码" | |||||
| rules={[{ required: true, message: '请输入密码' }]} | |||||
| /> | |||||
| <ProFormText.Password | |||||
| label="确认密码" | |||||
| name="repassword" | |||||
| placeholder="请输入确认密码" | |||||
| rules={[{ required: true, message: '请输入确认密码' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="昵称" | |||||
| name="nickname" | |||||
| placeholder="请输入昵称" | |||||
| /> | |||||
| <Row gutter={[16, 16]}> | <Row gutter={[16, 16]}> | ||||
| { | { | ||||
| detail ? | detail ? | ||||
| </Col> | </Col> | ||||
| </> | </> | ||||
| } | } | ||||
| <Col span={12}> | |||||
| <ProFormText | |||||
| label="手机号" | |||||
| name="mobile" | |||||
| placeholder="请输入手机号" | |||||
| rules={[{ required: true, message: '请输入手机号' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText.Password | |||||
| label="密码" | |||||
| name="password" | |||||
| placeholder="请输入密码" | |||||
| rules={[{ required: true, message: '请输入密码' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText.Password | |||||
| label="确认密码" | |||||
| name="repassword" | |||||
| placeholder="请输入确认密码" | |||||
| rules={[{ required: true, message: '请输入确认密码' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText | |||||
| label="昵称" | |||||
| name="nickname" | |||||
| placeholder="请输入昵称" | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormText | |||||
| label="邮箱" | |||||
| name="email" | |||||
| placeholder="请输入邮箱" | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="roleids" | |||||
| label="选择角色" | |||||
| placeholder="请选择角色" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| mode: 'multiple' | |||||
| }} | |||||
| request={(keyword) => | |||||
| GetRoleList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.roles.filter(item => item.id !== 3); | |||||
| }) | |||||
| } | |||||
| rules={[{ required: true, message: '请输入确认密码' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={12}> | |||||
| <ProFormCascader | |||||
| label="选择社区" | |||||
| name="location_arr" | |||||
| fieldProps={{ | |||||
| fieldNames: cascaderfieldNames, | |||||
| options: dictModel.areaList, | |||||
| changeOnSelect: true | |||||
| }} | |||||
| placeholder="企业所在地区" | |||||
| /> | |||||
| </Col> | |||||
| </Row> | </Row> | ||||
| <ProFormText | |||||
| label="邮箱" | |||||
| name="email" | |||||
| placeholder="请输入邮箱" | |||||
| /> | |||||
| <ProFormSelect | |||||
| showSearch | |||||
| name="roleids" | |||||
| label="选择角色" | |||||
| placeholder="请选择角色" | |||||
| fieldProps={{ | |||||
| fieldNames: selectfieldNames, | |||||
| mode: 'multiple' | |||||
| }} | |||||
| request={(keyword) => | |||||
| GetRoleList({ page: 1, pagesize: 100, keyword: keyword.keyWords }).then(res => { | |||||
| return res.data.roles.filter(item => item.id !== 3 ); | |||||
| }) | |||||
| } | |||||
| rules={[{ required: true, message: '请输入确认密码' }]} | |||||
| /> | |||||
| <ProFormCascader | |||||
| label="选择社区" | |||||
| name="location_arr" | |||||
| fieldProps={{ | |||||
| fieldNames: cascaderfieldNames, | |||||
| options: dictModel.areaList, | |||||
| changeOnSelect: true | |||||
| }} | |||||
| placeholder="企业所在地区" | |||||
| /> | |||||
| </ProForm> | </ProForm> | ||||
| </Modal> | </Modal> |
| ProTable, TableDropdown | ProTable, TableDropdown | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Tag } from 'antd'; | import { Button, Image, ConfigProvider, Tag } from 'antd'; | ||||
| import { getAccount} from '@/apis/api'; | |||||
| import { getAccount } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| const PagesPermissionAccountTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesPermissionAccountTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: '手机号码', | title: '手机号码', | ||||
| title: '角色ID', | title: '角色ID', | ||||
| dataIndex: 'roleids', | dataIndex: 'roleids', | ||||
| search: false, | search: false, | ||||
| }, | |||||
| }, | |||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) | ||||
| sort: 'id', | sort: 'id', | ||||
| sortby: 'desc', | sortby: 'desc', | ||||
| keyword: params.mobile, | keyword: params.mobile, | ||||
| }).then(res => { | }).then(res => { | ||||
| setList(res.data.users) | setList(res.data.users) | ||||
| setTotal(res.data.total) | setTotal(res.data.total) |
| ProFormSelect, | ProFormSelect, | ||||
| ProForm, | ProForm, | ||||
| FormControlRender, | FormControlRender, | ||||
| ProFormDependency, | |||||
| ProFormRadio, | |||||
| ProFormSwitch | ProFormSwitch | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch, Form, Typography } from 'antd'; | import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch, Form, Typography } from 'antd'; | ||||
| import { addPermission, updatePermission, getPermissionListWithchilds, GetDetailPermission} from '@/apis/api'; | |||||
| import { addPermission, updatePermission, getPermissionListWithchilds, GetDetailPermission } from '@/apis/api'; | |||||
| const selectfieldNames = { label: 'name', value: 'id' }; | const selectfieldNames = { label: 'name', value: 'id' }; | ||||
| theme={{ | theme={{ | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| } , components: { | |||||
| }, components: { | |||||
| Segmented: { | Segmented: { | ||||
| itemSelectedBg: '#19be6e', | itemSelectedBg: '#19be6e', | ||||
| itemSelectedColor: '#ffffff' | itemSelectedColor: '#ffffff' | ||||
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={600} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| path: '', | path: '', | ||||
| action: '', | action: '', | ||||
| module: '', | module: '', | ||||
| p_type: '', | |||||
| p_type: 2, | |||||
| parent_id: id.nextlevel, | parent_id: id.nextlevel, | ||||
| description: '' | description: '' | ||||
| }; | }; | ||||
| path: '', | path: '', | ||||
| action: '', | action: '', | ||||
| module: '', | module: '', | ||||
| p_type: '', | |||||
| p_type: 2, | |||||
| parent_id: 0, | parent_id: 0, | ||||
| description: '', | description: '', | ||||
| } | } | ||||
| } | } | ||||
| }} | }} | ||||
| submitter={{ | submitter={{ | ||||
| searchConfig: { | searchConfig: { | ||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <ProFormText | |||||
| label="权限/菜单名称" | |||||
| name="name" | |||||
| placeholder="请输入权限/菜单名称" | |||||
| rules={[{ required: true, message: '请输入权限/菜单名称' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="路径" | |||||
| name="path" | |||||
| placeholder="请输入路径" | |||||
| rules={[{ required: true, message: '请输入路径' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="标识名称" | |||||
| name="action" | |||||
| placeholder="请输入标识名称" | |||||
| rules={[{ required: true, message: '请输入标识名称' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| label="指向页面" | |||||
| name="module" | |||||
| placeholder="请输入指向页面" | |||||
| rules={[{ required: true, message: '请输入指向页面' }]} | |||||
| /> | |||||
| <ProFormSegmented | |||||
| name="p_type" | |||||
| label="权限类型" | |||||
| request={async () => [ | |||||
| { label: '权限', value: 1 }, | |||||
| { label: '菜单', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择是否置顶' }]} | |||||
| /> | |||||
| <ProFormText | |||||
| name="description" | |||||
| label="描述" | |||||
| placeholder="请输入描述" | |||||
| /> | |||||
| <Row gutter={16}> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| label="权限/菜单名称" | |||||
| name="name" | |||||
| placeholder="请输入权限/菜单名称" | |||||
| rules={[{ required: true, message: '请输入权限/菜单名称' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| label="路径" | |||||
| name="path" | |||||
| placeholder="请输入路径" | |||||
| rules={[{ required: true, message: '请输入路径' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| label="标识名称" | |||||
| name="action" | |||||
| placeholder="请输入标识名称" | |||||
| rules={[{ required: true, message: '请输入标识名称' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| label="指向页面" | |||||
| name="module" | |||||
| placeholder="请输入指向页面" | |||||
| rules={[{ required: true, message: '请输入指向页面' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormRadio.Group | |||||
| name="p_type" | |||||
| label="权限类型" | |||||
| request={async () => [ | |||||
| { label: '权限', value: 1 }, | |||||
| { label: '菜单', value: 2 } | |||||
| ]} | |||||
| rules={[{ required: true, message: '请选择权限类型' }]} | |||||
| /> | |||||
| </Col> | |||||
| <Col span={24}> | |||||
| <ProFormText | |||||
| name="description" | |||||
| label="描述" | |||||
| placeholder="请输入描述" | |||||
| /> | |||||
| </Col> | |||||
| </Row> | |||||
| </ProForm> | </ProForm> | ||||
| </Modal> | </Modal> | ||||
| </ConfigProvider> | </ConfigProvider> |
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={600} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenParentModal', payload: false }) | dispatch({ type: 'openModel/getOpenParentModal', payload: false }) | ||||
| }} | }} |
| import { | import { | ||||
| ProTable, TableDropdown | ProTable, TableDropdown | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Tag, Modal } from 'antd'; | |||||
| import { Button, Image, ConfigProvider, Tag, Badge } from 'antd'; | |||||
| import { getPermissionListWithchilds } from '@/apis/api'; | import { getPermissionListWithchilds } from '@/apis/api'; | ||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| getId(id) | getId(id) | ||||
| } | } | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (!openModel.openParentModal) { | if (!openModel.openParentModal) { | ||||
| actionRef.current.reload(); | actionRef.current.reload(); | ||||
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| search={false} | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={false} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '权限/菜单', | title: '权限/菜单', | ||||
| dataIndex: 'name', | dataIndex: 'name', | ||||
| width: 300, | |||||
| width: 200, | |||||
| search: false, | search: false, | ||||
| render: (_, record) => (<> | |||||
| {record.p_type == 1 ? <>{record.name} <Tag>权限</Tag></> : <>{record.name} <Tag color='green'>菜单</Tag></>} | |||||
| </> | |||||
| ) | |||||
| }, { | }, { | ||||
| title: '权限/菜单', | |||||
| title: '类型', | |||||
| dataIndex: 'p_type', | dataIndex: 'p_type', | ||||
| search: false, | search: false, | ||||
| width: 100, | |||||
| render: (_, record) => (<> | |||||
| {record.p_type == 1 ? <><Tag>权限</Tag></> : <> <Tag color='green'>菜单</Tag></>} | |||||
| </> | |||||
| ) | |||||
| width: 200, | |||||
| valueEnum: { | |||||
| 1: { | |||||
| text: '权限', | |||||
| status: 'Error' | |||||
| }, | |||||
| 2: { | |||||
| text: '菜单', | |||||
| status: 'Processing' | |||||
| }, | |||||
| }, | |||||
| }, { | }, { | ||||
| title: '路径', | title: '路径', | ||||
| dataIndex: 'path', | dataIndex: 'path', | ||||
| search: false, | search: false, | ||||
| width: 180, | |||||
| width: 200, | |||||
| }, { | }, { | ||||
| title: '标识名称', | title: '标识名称', | ||||
| dataIndex: 'action', | dataIndex: 'action', | ||||
| search: false, | search: false, | ||||
| width: 180, | |||||
| width: 200, | |||||
| }, { | }, { | ||||
| title: '指向页面', | title: '指向页面', | ||||
| dataIndex: 'module', | dataIndex: 'module', | ||||
| search: false, | search: false, | ||||
| width: 180, | |||||
| }, { | |||||
| width: 200, | |||||
| }, | |||||
| { | |||||
| title: '上级菜单id', | title: '上级菜单id', | ||||
| dataIndex: 'parent_id', | dataIndex: 'parent_id', | ||||
| search: false, | search: false, | ||||
| width: 180, | |||||
| width: 200, | |||||
| render: (_, record) => (<> | render: (_, record) => (<> | ||||
| {record.parent_id == -1 ? '当前已是顶级菜单' : record.parent_id} | |||||
| {record.parent_id == -1 ? <Badge status="processing" text='顶级菜单' /> : <Badge status="error" text={record.parent_id}/> } | |||||
| </> | </> | ||||
| ) | ) | ||||
| }, { | }, { | ||||
| title: '描述', | title: '描述', | ||||
| dataIndex: 'description', | dataIndex: 'description', | ||||
| search: false, | search: false, | ||||
| width: 180, | |||||
| width: 200, | |||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 400, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record) | setId(record) |
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={600} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} |
| }} | }} | ||||
| > | > | ||||
| <ProTable | <ProTable | ||||
| size='small' | |||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| search={{ span: 8, labelWidth: 'auto' }} | |||||
| columns={[ | columns={[ | ||||
| { | { | ||||
| title: 'ID', | title: 'ID', | ||||
| dataIndex: 'id', | dataIndex: 'id', | ||||
| width: 100, | |||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | { | ||||
| title: '角色名', | title: '角色名', | ||||
| dataIndex: 'name' | |||||
| dataIndex: 'name', | |||||
| }, | }, | ||||
| { | { | ||||
| title: '别名', | title: '别名', | ||||
| dataIndex: 'code', | dataIndex: 'code', | ||||
| search: false, | search: false, | ||||
| }, | }, | ||||
| { | { | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record.id) | setId(record.id) |
| import { | import { | ||||
| ProFormText, | ProFormText, | ||||
| ProFormSegmented, | ProFormSegmented, | ||||
| ProFormSelect, | |||||
| ProFormRadio, | |||||
| ProForm | ProForm | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch } from 'antd'; | import { ConfigProvider, Flex, Space, Modal, message, Image, Row, Col, Switch } from 'antd'; | ||||
| import {PostDictAdd, PostDictUpdate , GetDictDetail } from '@/apis/api'; | |||||
| import { PostDictAdd, PostDictUpdate, GetDictDetail } from '@/apis/api'; | |||||
| theme={{ | theme={{ | ||||
| token: { | token: { | ||||
| colorPrimary: '#4FBE70', | colorPrimary: '#4FBE70', | ||||
| } , components: { | |||||
| }, components: { | |||||
| Segmented: { | Segmented: { | ||||
| itemSelectedBg: '#19be6e', | itemSelectedBg: '#19be6e', | ||||
| itemSelectedColor: '#ffffff' | itemSelectedColor: '#ffffff' | ||||
| maskClosable={false} | maskClosable={false} | ||||
| footer={null} | footer={null} | ||||
| destroyOnClose | destroyOnClose | ||||
| width={1000} | |||||
| width={600} | |||||
| onCancel={() => { | onCancel={() => { | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: false }) | dispatch({ type: 'openModel/getOpenModal', payload: false }) | ||||
| }} | }} | ||||
| parent_id: id.nextlevel, | parent_id: id.nextlevel, | ||||
| name: '', | name: '', | ||||
| value: '', | value: '', | ||||
| display: '', | |||||
| display: 'S', | |||||
| childs: null, | childs: null, | ||||
| }; | }; | ||||
| } else { | } else { | ||||
| parent_id: -1, | parent_id: -1, | ||||
| name: '', | name: '', | ||||
| value: '', | value: '', | ||||
| display: '', | |||||
| display: 'S', | |||||
| childs: null, | childs: null, | ||||
| } | } | ||||
| } | } | ||||
| name="value" | name="value" | ||||
| placeholder="请输入字典代码值" | placeholder="请输入字典代码值" | ||||
| /> | /> | ||||
| <ProFormSegmented | |||||
| <ProFormRadio.Group | |||||
| name="display" | name="display" | ||||
| label="是否显示" | label="是否显示" | ||||
| request={async () => [ | request={async () => [ |
| ProTable, TableDropdown | ProTable, TableDropdown | ||||
| } from '@ant-design/pro-components'; | } from '@ant-design/pro-components'; | ||||
| import { Button, Image, ConfigProvider, Tag } from 'antd'; | import { Button, Image, ConfigProvider, Tag } from 'antd'; | ||||
| import { GetDictList} from '@/apis/api'; | |||||
| import { GetDictList } from '@/apis/api'; | |||||
| import { Imageprefix } from '@/constants'; | import { Imageprefix } from '@/constants'; | ||||
| const PagesSettingDictionaryTable: React.FC = ({ dispatch, openModel, getId }: any) => { | const PagesSettingDictionaryTable: React.FC = ({ dispatch, openModel, getId }: any) => { | ||||
| <ProTable | <ProTable | ||||
| size='small' | size='small' | ||||
| search={false} | search={false} | ||||
| scroll={{ y: 480, x: 'auto' }} | |||||
| bordered={true} | bordered={true} | ||||
| scroll={{ x: 1300 }} | |||||
| actionRef={actionRef} | actionRef={actionRef} | ||||
| dataSource={list} | dataSource={list} | ||||
| columns={[ | columns={[ | ||||
| }, | }, | ||||
| { | { | ||||
| title: '操作', | title: '操作', | ||||
| width: 300, | |||||
| key: 'option', | key: 'option', | ||||
| valueType: 'option', | valueType: 'option', | ||||
| fixed: 'right', | |||||
| render: (_, record, action) => [ | render: (_, record, action) => [ | ||||
| <Button key='1' type='link' onClick={() => { | <Button key='1' type='link' onClick={() => { | ||||
| setId(record) | setId(record) | ||||
| dispatch({ type: 'openModel/getOpenModal', payload: true }) | dispatch({ type: 'openModel/getOpenModal', payload: true }) | ||||
| }}>添加下级字典</Button>, | }}>添加下级字典</Button>, | ||||
| <Button key='2' type='link' onClick={() => { | <Button key='2' type='link' onClick={() => { | ||||
| }}>删除</Button>, | }}>删除</Button>, | ||||
| ], | ], | ||||
| }, | }, |