123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828 |
- import React from "react";
- import $ from "jquery/src/ajax";
- import "react-quill/dist/quill.bubble.css";
- import moment from "moment";
- import {
- Form,
- Icon,
- Button,
- Input,
- Select,
- Spin,
- Table,
- message,
- DatePicker,
- Modal,
- Upload,
- Popconfirm,
- Cascader,
- InputNumber,
- Radio,
- TimePicker,
- Tabs,
- Tag
- } from "antd";
- import { areaSelect, getProvince } from "@/NewDicProvinceList"; //省市区
- import {
- getGameState,
- splitUrl,
- getprovince,
- getStatuslist,
- getLvl,
- placeList,
- province,
- provinceStatus,
- beforeUploadFile,
- getPicPath
- } from "@/tools.js";
- const { Option } = Select;
- import Editors from "@/richTextEditors"; //富文本编辑器
- import ad01 from "./image/ad01.jpg";
- import ad02 from "./image/ad02.jpg";
- import ad03 from "./image/ad03.jpg";
- import ad04 from "./image/ad04.jpg";
- const PicturesWall = React.createClass({
- getInitialState() {
- return {
- previewVisible: false,
- previewImage: "",
- fileList: []
- };
- },
- getDefaultProps() {
- return {
- changeClick: this.modifyChange
- };
- },
- handleCancel() {
- this.setState({ previewVisible: false });
- },
- handlePreview(file) {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true
- });
- },
- handleChange(info) {
- let fileList = info.fileList;
- this.setState({ fileList });
- this.props.fileList(fileList);
- },
- componentWillReceiveProps(nextProps) {
- this.state.fileList = nextProps.pictureUrl;
- },
- render() {
- const { previewVisible, previewImage, fileList } = this.state;
- const uploadButton = (
- <div>
- <Icon type="plus" />
- <div className="ant-upload-text">点击上传</div>
- </div>
- );
- return (
- <div style={{ display: "inline-block" }}>
- <Upload
- beforeUpload={beforeUploadFile}
- // action={globalConfig.context + "/api/admin/purchase/uploadPicture"}
- // url: '//172.16.0.253:8080' + '/api/admin/banners/addBanners',
- action={globalConfig.context + "/api/admin/recruitment/uploadFile"}
- data={{ sign: "purchase_picture" }}
- listType="picture-card"
- fileList={fileList}
- onPreview={this.handlePreview}
- onChange={this.handleChange}
- >
- {fileList && fileList.length >= 1 ? null : uploadButton}
- </Upload>
- <Modal
- maskClosable={false}
- visible={previewVisible}
- footer={null}
- onCancel={this.handleCancel}
- >
- <img alt="" style={{ width: "100%" }} src={previewImage} />
- </Modal>
- </div>
- );
- }
- });
- //主体
- const TalentsList = Form.create()(
- React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- loading: true,
- page: pageNo
- });
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/api/admin/recruitment/listRecruitment",
- data: {
- pageNo: pageNo || this.state.pagination.current || 1,
- pageSize: this.state.pagination.pageSize,
- name: this.state.nameSearch
- },
- success: function(data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i + 1,
- id: thisdata.id,
- name: thisdata.name,
- releaseStatus: thisdata.releaseStatus,
- sort: thisdata.sort,
- province: thisdata.province,
- region: thisdata.region,
- content: thisdata.content,
- releaseTimeConvert: thisdata.releaseTimeConvert
- });
- }
- this.state.pagination.current = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- }
- this.setState({
- dataSource: theArr,
- pagination: this.state.pagination
- });
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- getInitialState() {
- return {
- loading: false,
- flag: true,
- imgeditvisible: false,
- activeKey: "1",
- purchaseImg: [],
- maximg: "",
- timesArr: [],
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function(page) {
- this.loadData(page);
- this.setState({
- selectedRowKeys: []
- });
- }.bind(this),
- showTotal: function(total) {
- return "共" + total + "条数据";
- }
- },
- //数据类型
- columns: [
- {
- title: "序号",
- dataIndex: "key",
- key: "key"
- },
- {
- title: "职位名称",
- dataIndex: "name",
- key: "name"
- },
- {
- title: "招聘省份",
- dataIndex: "province",
- key: "province",
- render: e => {
- let str = "";
- provinceStatus.forEach(item => {
- if (item.value == e) {
- str = item.key;
- }
- });
- return str;
- }
- },
- {
- title: "排序",
- dataIndex: "sort",
- key: "sort"
- },
- {
- title: "是否发布",
- dataIndex: "releaseStatus",
- key: "releaseStatus",
- render: s => {
- return s ? (
- <Tag color="#87d068">已发布</Tag>
- ) : (
- <Tag color="#f50">未发布</Tag>
- );
- }
- },
- {
- title: "操作",
- dataIndex: "c",
- render: (text, record, index) => {
- return (
- <div>
- {
- <Button
- type="primary"
- onClick={event => {
- this.stopPropagation(event);
- this.edit(record);
- }}
- >
- 编辑
- </Button>
- }
- {
- <Popconfirm
- okText="确定"
- cancelText="取消"
- title="您确定删除?删除后,招聘信息将不再显示"
- onConfirm={() => {
- this.delete(record.id);
- }}
- >
- <Button
- type="danger"
- style={{ marginLeft: "10px" }}
- onClick={event => {
- this.stopPropagation(event);
- }}
- >
- 删除
- </Button>
- </Popconfirm>
- }
- <Button
- type="primary"
- style={{ marginLeft: "10px" }}
- onClick={event => {
- this.stopPropagation(event);
- if (record.releaseStatus) {
- this.remove(record, 0);
- } else {
- this.remove(record, 1);
- }
- }}
- >
- {record.releaseStatus ? "撤销发布" : "发布"}
- </Button>
- </div>
- );
- }
- },
- {
- title: "发布时间",
- dataIndex: "releaseTimeConvert",
- key: "releaseTimeConvert"
- }
- ],
- //数据列表
- dataSource: []
- };
- },
- componentWillMount() {
- this.loadData();
- },
- detailes(record) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/banners/selectBanners",
- data: {
- id: record.id
- },
- success: function(data) {
- let thisdata = data.data;
- this.setState({
- id: thisdata.id,
- title: thisdata.title,
- bannerUrl: thisdata.bannerUrl
- ? splitUrl(thisdata.bannerUrl, ",", globalConfig.avatarUploadHost)
- : [],
- sortNumber: thisdata.sort,
- display: thisdata.display,
- position: thisdata.position
- });
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- //点击大图
- maximg(url) {
- this.setState({
- imgeditvisible: true,
- maximg: url
- });
- },
- //删除按钮
- delete(id) {
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/recruitment/deleteRecruitment",
- data: {
- id
- },
- success: function(data) {
- this.loadData();
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- //阻止默认冒泡
- stopPropagation(e) {
- e.stopPropagation();
- e.nativeEvent.stopImmediatePropagation();
- },
- imghandleCancel() {
- this.setState({
- imgeditvisible: false
- });
- },
- //项目列表整行点击
- tableRowClick(record, index) {
- this.setState({
- editvisible: true
- });
- this.edit(record);
- },
- edithandleCancel(e) {
- this.setState(
- {
- editvisible: false
- },
- () => {
- this.addReset();
- }
- );
- this.loadData();
- },
- search() {
- this.loadData();
- },
- add() {
- this.setState({
- editvisible: true,
- flag: false
- });
- this.addReset();
- },
- cancelAdd() {
- this.setState(
- {
- editvisible: false
- },
- () => {
- this.setState({
- flag: true
- });
- this.addReset();
- }
- );
- this.loadData();
- },
- //撤下
- remove(record,flag) {
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/recruitment/updateRecruitment",
- data: {
- id: record.id,
- releaseStatus: flag
- },
- success: function(data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- } else {
- this.loadData();
- }
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- //编辑按钮操作
- edit(record) {
- this.setState({
- flag: true,
- editvisible: true
- });
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/recruitment/selectRecruitment",
- data: {
- id: record.id
- },
- success: function(data) {
- let thisdata = data.data;
- let str = "";
- placeList.forEach(item => {
- if (item.value == thisdata.region) {
- str = item.place;
- }
- });
- this.setState({
- id: thisdata.id,
- name: thisdata.name,
- releaseStatus: thisdata.releaseStatus,
- province: thisdata.province + "",
- region: thisdata.region,
- regionStr: str,
- editorcontext: thisdata.content,
- sort: thisdata.sort,
- time: thisdata.releaseTimeConvert,
- createTimeConvert: thisdata.createTimeConvert
- });
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- addNew(flag) {
- if (this.state.flag) {
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url:
- globalConfig.context + "/api/admin/recruitment/updateRecruitment",
- data: {
- id: this.state.id,
- name: this.state.name,
- province: this.state.province,
- sort: this.state.sort,
- content: this.state.editorcontext,
- region: this.state.region,
- releaseStatus: flag,
- releaseTimes: this.state.time
- },
- success: function(data) {
- let theArr = [];
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- } else {
- this.cancelAdd();
- }
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- } else {
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/recruitment/addRecruitment",
- data: {
- name: this.state.name,
- province: this.state.province,
- sort: this.state.sort,
- content: this.state.editorcontext,
- region: this.state.region,
- releaseStatus: flag,
- releaseTimes: this.state.time
- },
- success: function(data) {
- let theArr = [];
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- } else {
- this.cancelAdd();
- }
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- }
- },
- //新增框的清零
- addReset() {
- this.setState({
- name: undefined,
- sort: undefined,
- display: 1,
- province: [],
- editorcontext: "",
- region: undefined,
- time: undefined
- });
- },
- //搜索部分的清零
- reset() {
- this.state.nameSearch = undefined;
- this.loadData();
- },
- imgOk() {
- this.setState({
- imgeditvisible: false
- });
- },
- getOrgCodeUrl(e) {
- this.setState({ bannerUrl: e });
- },
- render() {
- const FormItem = Form.Item;
- const rowSelection = {
- selectedRowKeys: this.state.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows.slice(-1),
- selectedRowKeys: selectedRowKeys.slice(-1)
- });
- }
- };
- const { TextArea } = Input; //文本域
- const { TabPane } = Tabs; //标签页
- const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
- const dateFormat = "YYYY/MM/DD"; //日期格式
- const theData = this.state.data || {};
- return (
- <div className="user-content">
- <div className="content-title">
- <span>招聘列表</span>
- <div className="user-search">
- <Input
- placeholder="请输入职位名称"
- value={this.state.nameSearch}
- onChange={e => {
- this.setState({ nameSearch: e.target.value });
- }}
- style={{
- width: "150px",
- marginRight: "10px",
- marginBottom: "10px"
- }}
- />
- <Button
- type="primary"
- onClick={this.search}
- style={{ marginRight: "10px" }}
- >
- 搜索
- </Button>
- <Button onClick={this.reset} style={{ marginRight: "10px" }}>
- 重置
- </Button>
- <Button
- type="primary"
- onClick={this.add}
- style={{ marginLeft: "100px" }}
- >
- 新增职位
- </Button>
- </div>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- columns={this.state.columns}
- dataSource={this.state.dataSource}
- onRowClick={this.tableRowClick}
- pagination={this.state.pagination}
- bordered
- size="small"
- />
- </Spin>
- </div>
- </div>
- <div className="patent-desc">
- <Modal
- className="customeDetails"
- title={this.state.flag ? "职位详情" : "新增职位"}
- visible={this.state.editvisible}
- onOk={this.edithandleCancel}
- width={"1000px"}
- onCancel={
- this.state.flag ? this.edithandleCancel : this.cancelAdd
- }
- footer=""
- >
- <Form
- layout="horizontal"
- onSubmit={this.edithandleSubmit}
- id="demand-form"
- >
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem
- className="half-item"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 12 }}
- label="职位名称"
- >
- <Input
- placeholder="请输入职位名称"
- value={this.state.name}
- onChange={e => {
- this.setState({ name: e.target.value });
- }}
- style={{ width: "240px" }}
- />
- </FormItem>
- <div className="clearfix">
- <FormItem
- className="half-item"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 12 }}
- label="发布时间"
- >
- <DatePicker
- placeholder="请输入发布时间"
- format="YYYY-MM-DD HH:mm:ss"
- showTime
- value={
- this.state.time ? moment(this.state.time) : null
- }
- onChange={(e, f) => {
- this.setState({ time: f });
- }}
- style={{ width: "240px" }}
- />
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem
- className="half-item"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 12 }}
- label="招聘省份"
- >
- <Select
- style={{ width: 120 }}
- placeholder="请选择省份"
- value={this.state.province}
- onChange={e => {
- this.setState({
- province: e
- });
- let str = "";
- provinceStatus.forEach(item => {
- if (item.value == e) {
- str = item.key;
- }
- });
- placeList.forEach(item => {
- item.children.forEach(key => {
- if (key == str) {
- this.setState({
- regionStr: item.place,
- region: item.value
- });
- }
- });
- });
- }}
- >
- {provinceStatus.map(item => {
- return (
- <Option value={item.value}>{item.key}</Option>
- );
- })}
- </Select>
- </FormItem>
- </div>
- <FormItem
- className="half-item"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 12 }}
- label="排序"
- >
- <Input
- placeholder="请输入数字"
- value={this.state.sort}
- onChange={e => {
- this.setState({
- sort: e.target.value
- });
- }}
- style={{ width: "140px" }}
- />
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem
- labelCol={{ span: 4 }}
- wrapperCol={{ span: 18 }}
- label="招聘内容"
- >
- <Editors
- textContent={this.state.editorcontext}
- uploadUrl={"/api/admin/recruitment/uploadFile"}
- globalConfig={globalConfig.uploadPath}
- placeholder="业务项目客户基本条件"
- handleRichText={value => {
- // this.setState({ editorcontext: value });
- this.setState({
- editorcontext: value
- });
- }}
- />
- </FormItem>
- </div>
- <div className="clearfix">
- <Button
- type="primary"
- size="large"
- onClick={e => {
- this.addNew(0);
- }}
- style={{
- float: "right",
- marginRight: "80px",
- marginTop: "20px"
- }}
- >
- 保存
- </Button>
- <Button
- type="primary"
- size="large"
- onClick={e => {
- this.addNew(1);
- }}
- style={{
- float: "right",
- marginRight: "20px",
- marginTop: "20px"
- }}
- >
- 保存并发布
- </Button>
- </div>
- </Spin>
- </Form>
- </Modal>
- </div>
- <Modal
- visible={this.state.imgeditvisible}
- onCancel={this.imghandleCancel}
- onOk={this.imgOk}
- >
- <img style={{ width: "100%" }} src={this.state.maximg} />
- </Modal>
- </div>
- );
- }
- })
- );
- export default TalentsList;
|