Parcourir la source

招聘省份支持多选

dev01 il y a 1 an
Parent
commit
57cea2e5ca
2 fichiers modifiés avec 154 ajouts et 147 suppressions
  1. 153 146
      js/component/administration/business/talentsList.jsx
  2. 1 1
      package.json

+ 153 - 146
js/component/administration/business/talentsList.jsx

@@ -205,9 +205,12 @@ const TalentsList = Form.create()(
             key: "province",
             render: e => {
               let str = "";
+              let p = e.split(',');
               provinceStatus.forEach(item => {
-                if (item.value == e) {
-                  str = item.key;
+                for (var i = 0; i < p.length; i++) {
+                  if (item.value == p[i]) {
+                    str += item.key + (i > 0 ? "," : "");
+                  }
                 }
               });
               return str;
@@ -469,7 +472,7 @@ const TalentsList = Form.create()(
             id: thisdata.id,
             name: thisdata.name,
             releaseStatus: thisdata.releaseStatus,
-            province: thisdata.province + "",
+            province: !!thisdata.province ? thisdata.province.split(',') : [],
             region: thisdata.region,
             regionStr: str,
             editorcontext: thisdata.content,
@@ -500,7 +503,7 @@ const TalentsList = Form.create()(
           data: {
             id: this.state.id,
             name: this.state.name,
-            province: this.state.province,
+            province: this.state.province.toString(), // 省份多选
             sort: this.state.sort,
             content: this.state.editorcontext,
             region: this.state.region,
@@ -652,173 +655,177 @@ const TalentsList = Form.create()(
             </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"
+            {
+              this.state.editvisible &&
+              <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=""
               >
-                <SpinContainer 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>
+                <Form
+                  layout="horizontal"
+                  onSubmit={this.edithandleSubmit}
+                  id="demand-form"
+                >
+                  <SpinContainer spinning={this.state.loading}>
                     <div className="clearfix">
                       <FormItem
                         className="half-item"
                         labelCol={{ span: 8 }}
                         wrapperCol={{ span: 12 }}
-                        label="发布时间"
+                        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 });
+                        <Input
+                          placeholder="请输入职位名称"
+                          value={this.state.name}
+                          onChange={e => {
+                            this.setState({ name: e.target.value });
                           }}
                           style={{ width: "240px" }}
                         />
                       </FormItem>
-                    </div>
-                    <div className="clearfix">
+                      <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
+                            mode="multiple"
+                            style={{ width: 240 }}
+                            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="招聘省份"
+                        label="排序"
                       >
-                        <Select
-                          style={{ width: 120 }}
-                          placeholder="请选择省份"
-                          value={this.state.province}
+                        <Input
+                          placeholder="请输入数字"
+                          value={this.state.sort}
                           onChange={e => {
                             this.setState({
-                              province: e
-                            });
-                            let str = "";
-                            provinceStatus.forEach(item => {
-                              if (item.value == e) {
-                                str = item.key;
-                              }
+                              sort: e.target.value
                             });
-                            placeList.forEach(item => {
-                              item.children.forEach(key => {
-                                if (key == str) {
-                                  this.setState({
-                                    regionStr: item.place,
-                                    region: item.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
                             });
                           }}
-                        >
-                          {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
-                          });
+                    <div className="clearfix">
+                      <Button
+                        type="primary"
+                        size="large"
+                        onClick={e => {
+                          this.addNew(0);
                         }}
-                        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
-                          });
+                        style={{
+                          float: "right",
+                          marginRight: "80px",
+                          marginTop: "20px"
                         }}
-                      />
-                    </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>
-                </SpinContainer>
-              </Form>
-            </Modal>
+                      >
+                        保存
+                      </Button>
+                      <Button
+                        type="primary"
+                        size="large"
+                        onClick={e => {
+                          this.addNew(1);
+                        }}
+                        style={{
+                          float: "right",
+                          marginRight: "20px",
+                          marginTop: "20px"
+                        }}
+                      >
+                        保存并发布
+                      </Button>
+                    </div>
+                  </SpinContainer>
+                </Form>
+              </Modal>
+            }
           </div>
           <Modal
             visible={this.state.imgeditvisible}

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.11",
+  "version": "1.0.12",
   "description": "",
   "main": "index.js",
   "scripts": {