Browse Source

巴管理

dev01 2 years ago
parent
commit
08b1a2c5d1

+ 573 - 0
js/component/manageCenter/set/amoeba/barList.jsx

@@ -0,0 +1,573 @@
+import React, { Component } from "react";
+import { Button, Modal, Form, AutoComplete, TreeSelect, Input, message, Spin, Select, Tabs, Table, } from "antd";
+import $ from "jquery/src/ajax";
+import { ShowModal, getBarLevel } from "@/tools";
+import moment from "moment";
+import './index.less'
+import ShowModalDiv from "@/showModal.jsx";
+import { ChooseList } from "../../order/orderNew/chooseList";
+import Operation from "./operation"
+
+const { TabPane } = Tabs;
+const FormItem = Form.Item;
+const confirm = Modal.confirm;
+
+class Source extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      visible: '', // 弹窗控制
+      level1Data: [], // 体系数据
+      searchValues: {}, // 列表筛选条件
+      pagination: {
+        defaultCurrent: 1,
+        defaultPageSize: 10,
+        showQuickJumper: true,
+        pageSize: 10,
+        onChange: function (page) {
+          this.loadData(page);
+        }.bind(this),
+        showTotal: function (total) {
+          return "共" + total + "条数据";
+        },
+      },
+      loading: false,
+      changeList: undefined,
+      dataSource: [], // 列表数据
+      selectedRowKeys: [], // 选中列表数据
+      selectedRows: [], // 选中列表数据
+      info: {}, //单条详情数据
+      columns: [
+        {
+          title: "巴名称",
+          dataIndex: "name",
+          key: "name",
+        },
+        {
+          title: "巴主",
+          dataIndex: "leaderName",
+          key: "leaderName",
+        },
+        {
+          title: "所属战区",
+          dataIndex: "name5",
+          key: "name5",
+          render: (text, record) =>
+            <span >
+              {getBarLevel(record.ancestorsNames)[4]}
+            </span>
+        },
+        {
+          title: "所属事业部",
+          dataIndex: "name4",
+          key: "name4",
+          render: (text, record) =>
+            <span >
+              {getBarLevel(record.ancestorsNames)[3]}
+            </span>
+        },
+        {
+          title: "所属区",
+          dataIndex: "name3",
+          key: "name3",
+          render: (text, record) =>
+            <span >
+              {getBarLevel(record.ancestorsNames)[2]}
+            </span>
+        },
+        {
+          title: "所属大区",
+          dataIndex: "name2",
+          key: "name2",
+          render: (text, record) =>
+            <span >
+              {getBarLevel(record.ancestorsNames)[1]}
+            </span>
+        },
+        {
+          title: "所属体系",
+          dataIndex: "name1",
+          key: "name1",
+          render: (text, record) =>
+            <span >
+              {getBarLevel(record.ancestorsNames)[0]}
+            </span>
+        },
+        {
+          title: "财务",
+          dataIndex: "financeName",
+          key: "financeName",
+        },
+        {
+          title: "会计",
+          dataIndex: "accountantName",
+          key: "accountantName",
+        },
+        {
+          title: "状态",
+          dataIndex: "status",
+          key: "status",
+          render: (text) =>
+            <span style={{ color: ["green", "red"][text] }}>
+              {text == 0
+                ? "正常" : text == 1
+                  ? "停用" : "-"}
+            </span>
+        },
+        {
+          title: "创建时间",
+          dataIndex: "createTimes",
+          key: "createTimes",
+        },
+      ],
+    };
+    this.supervisor = this.supervisor.bind(this);
+    this.httpChange = this.httpChange.bind(this);
+    this.blurChange = this.blurChange.bind(this);
+    this.selectAuto = this.selectAuto.bind(this);
+    this.handleCancel = this.handleCancel.bind(this);
+    this.handleCancel = this.handleCancel.bind(this);
+  }
+
+  // 根据id获取子集
+  getSubset(id, list, key = "id", valus = "list") {
+    let newList = [];
+    if (!list) {
+      return newList
+    }
+    list.forEach((item) => {
+      if (item[key] == id) {
+        newList = item[valus]
+      }
+    })
+    return newList
+  }
+  // 筛选数据
+  getList() {
+    this.setState({
+      loading: true,
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/selectAll",
+      success: function (data) {
+        this.setState({
+          loading: false,
+        });
+        if (data.error && data.error.length === 0) {
+          let menuList = data.data
+          this.setState({
+            level1Data: menuList ? this.handleTreeData(menuList) : []
+          });
+        } else {
+          message.warning(data.error[0].message);
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  // 树状默认数据处理
+  handleTreeData(treeData) {
+    let nodeDta = [];
+    treeData.map(item => {
+      let treeObj = {};
+      treeObj.id = item.id
+      treeObj.label = item.name
+      treeObj.value = item.id
+      treeObj.key = item.id
+      treeObj.lvl = item.lvl
+      treeObj.parentId = item.parentId
+      item.list ? treeObj.children = this.handleTreeData(item.list) : null;
+      nodeDta.push(treeObj)
+    })
+    return nodeDta
+  }
+  // 更改表格显示数据
+  changeList(arr) {
+    const newArr = [];
+    this.state.columns.forEach((item) => {
+      arr.forEach((val) => {
+        if (val === item.title) {
+          newArr.push(item);
+        }
+      });
+    });
+    this.setState({
+      changeList: newArr,
+    });
+  }
+  // 重置
+  resetAll() {
+    this.setState(
+      {
+        auto: "",
+        searchValues: JSON.parse(JSON.stringify({})),
+        selectedRowKeys: [],
+        selectedRows: [],
+      },
+      () => {
+        this.loadData();
+      }
+    );
+  }
+  // 搜索
+  submit() {
+    this.setState({
+      params: this.state.searchValues
+    })
+    this.loadData()
+  }
+  // 列表接口
+  loadData(pageNo) {
+    const { searchValues, pagination } = this.state;
+    this.setState({
+      loading: true,
+    });
+    let datas = Object.assign(searchValues, {
+      pageNo: pageNo || 1,
+      pageSize: pagination.pageSize,
+      lvl: 6,
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/select",
+      data: datas,
+      success: function (data) {
+        ShowModal(this);
+        this.setState({
+          loading: false,
+        });
+        if (data.error && data.error.length === 0) {
+          if (data.data.list) {
+            pagination.current = data.data.pageNo;
+            pagination.total = data.data.totalCount;
+            if (data.data && data.data.list && !data.data.list.length) {
+              pagination.current = 0;
+              pagination.total = 0;
+            }
+            this.setState({
+              dataSource: data.data.list,
+              pagination: this.state.pagination,
+              pageNo: data.data.pageNo,
+            });
+          } else {
+            this.setState({
+              dataSource: data.data,
+              pagination: false,
+            });
+          }
+        } else {
+          message.warning(data.error[0].message);
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  // 查询用户
+  supervisor(e) {
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/customer/listAdminByName",
+      data: {
+        adminName: e,
+      },
+      success: function (data) {
+        let thedata = data.data;
+        if (!thedata) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          }
+          thedata = {};
+        }
+        this.setState({
+          customerArr: thedata,
+        });
+      }.bind(this),
+    }).always(
+      function () {
+
+      }.bind(this)
+    );
+  }
+  // 输入触发
+  httpChange(e) {
+    if (e.length >= 1) {
+      this.supervisor(e);
+    }
+    this.setState({
+      auto: e,
+    });
+  }
+  // 选中
+  selectAuto(value, options) {
+    const { searchValues } = this.state
+    let contactLists = this.state.customerArr || [];
+    if (value) {
+      contactLists.map(function (item) {
+        if (item.name == value.toString()) {
+          searchValues["leader"] = item.id;
+        }
+      });
+    }
+    this.setState({
+      auto: value,
+      searchValues: searchValues,
+    });
+  }
+  // 失去焦点
+  blurChange(e) {
+    const { searchValues } = this.state
+    let contactLists = this.state.customerArr || [];
+    if (e) {
+      contactLists.map(function (item) {
+        if (item.name == e.toString()) {
+          searchValues["leader"] = item.id;
+        }
+      });
+    }
+    this.setState({
+      searchValues: searchValues,
+    });
+  }
+  // 选择行
+  onSelectChange(selectedRowKeys, selectedRows) {
+    this.setState({ selectedRowKeys, selectedRows });
+  }
+  // 删除巴
+  delete() {
+    const { selectedRows } = this.state
+    this.setState({
+      loading: true,
+    })
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/delete",
+      data: {
+        id: selectedRows[0].id
+      },
+      success: function (data) {
+        if (data.error.length) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message)
+          }
+        } else {
+          message.success('删除成功');
+          this.getList();
+          this.loadData();
+          this.setState({
+            selectedRowKeys: [],
+            selectedRows: [],
+          });
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        })
+      }.bind(this)
+    );
+  }
+  // 关闭弹窗
+  handleCancel() {
+    this.setState({
+      visible: "",
+      info: {},
+    }, () => {
+      this.getList();
+      this.loadData();
+    })
+  }
+
+  componentWillMount() {
+    this.getList();
+    this.loadData();
+  }
+
+  render() {
+    const { searchValues, columns, selectedRowKeys, selectedRows, changeList, level1Data } = this.state;
+    const rowSelection = {
+      selectedRowKeys,
+      onChange: this.onSelectChange.bind(this),
+      hideDefaultSelections: true,
+      type: "radio",
+    };
+    const dataSources = this.state.customerArr || [];
+    const options = dataSources.map((group) => (
+      <Select.Option key={group.id} value={group.name}>
+        {group.name}
+      </Select.Option>
+    ));
+    return (
+      <div className="user-content">
+        <ShowModalDiv ShowModal={this.state.showModal} />
+        <div className="content-title" style={{ marginBottom: 10 }}>
+          <span style={{ fontWeight: 900, fontSize: 16, }}>巴列表数据</span>
+        </div>
+        <Tabs defaultActiveKey="1" onChange={() => { }}>
+          <TabPane tab="搜索" key="1">
+            <div style={{ padding: "0 10px" }}>
+              <Form layout="inline">
+                <FormItem>
+                  <Input
+                    placeholder="输入巴名称"
+                    value={searchValues["name"]
+                      ? searchValues["name"]
+                      : ""}
+                    onChange={(e) => {
+                      searchValues["name"] = e.target.value;
+                      this.setState({
+                        searchValues: searchValues,
+                      });
+                    }}
+                  />
+                </FormItem>
+                <FormItem>
+                  <AutoComplete
+                    className="certain-category-search"
+                    dropdownClassName="certain-category-search-dropdown"
+                    dropdownMatchSelectWidth={false}
+                    style={{ width: "120px" }}
+                    dataSource={options}
+                    placeholder='输入巴主名称'
+                    value={this.state.auto}
+                    onChange={this.httpChange}
+                    filterOption={true}
+                    onBlur={this.blurChange}
+                    onSelect={this.selectAuto}
+                  >
+                    <Input />
+                  </AutoComplete>
+                </FormItem>
+                <FormItem>
+                  <TreeSelect
+                    style={{ width: 300 }}
+                    value={searchValues["ancestors"]
+                      ? searchValues["ancestors"]
+                      : undefined}
+                    dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
+                    treeData={level1Data}
+                    placeholder="请选择"
+                    onChange={(e) => {
+                      searchValues["ancestors"] = e;
+                      this.setState({
+                        searchValues: searchValues,
+                      });
+                    }}
+                  />
+                </FormItem>
+                <Button
+                  type="primary"
+                  onClick={() => { this.submit() }}
+                  style={{ marginRight: "10px" }}
+                >
+                  搜索
+                </Button>
+                <Button
+                  onClick={() => { this.resetAll() }}
+                  style={{ marginRight: "10px" }}
+                >
+                  重置
+                </Button>
+              </Form>
+            </div>
+          </TabPane>
+          <TabPane tab="操作" key="2">
+            <div style={{ marginLeft: 10 }}>
+              <Button
+                type="primary"
+                onClick={() => { this.setState({ visible: "add" }) }}
+                style={{ margin: "0 10px 10px 0" }}
+              >
+                新增阿米巴架构
+              </Button>
+              <Button
+                type="primary"
+                disabled={selectedRowKeys.length == 0}
+                style={{ marginRight: "10px" }}
+                onClick={() => {
+                  this.setState({
+                    visible: "edit",
+                    info: selectedRows[0]
+                  })
+                }}
+              >
+                编辑
+              </Button>
+              <Button
+                type="danger"
+                disabled={selectedRowKeys.length == 0}
+                style={{ marginRight: "10px" }}
+                onClick={() => {
+                  let _this = this
+                  confirm({
+                    title: '提醒',
+                    content: '确定要删除吗?',
+                    onOk() {
+                      _this.delete()
+                    }
+                  })
+                }}
+              >
+                删除
+              </Button>
+            </div>
+          </TabPane>
+          <TabPane tab="更改表格显示数据" key="3">
+            <div style={{ marginLeft: 10 }}>
+              <ChooseList
+                columns={columns}
+                changeFn={this.changeList.bind(this)}
+                changeList={changeList}
+                top={55}
+              />
+            </div>
+          </TabPane>
+        </Tabs>
+        <div className="patent-table">
+          <Spin spinning={this.state.loading}>
+            <Table
+              bordered
+              size="middle"
+              columns={changeList ? changeList : columns}
+              dataSource={this.state.dataSource}
+              pagination={this.state.pagination}
+              rowSelection={rowSelection}
+            />
+          </Spin>
+        </div>
+        {
+          // 新建编辑巴
+          this.state.visible != "" &&
+          <Operation
+            visible={this.state.visible}
+            handleCancel={this.handleCancel}
+            levelData={this.state.level1Data}
+            info={this.state.info}
+            lev={5}
+          />
+        }
+      </div>
+    );
+  }
+}
+
+export default Source;

+ 4 - 0
js/component/manageCenter/set/amoeba/index.less

@@ -0,0 +1,4 @@
+.user-content>.ant-tabs.ant-tabs-top.ant-tabs-line {
+  background-color: #F5F5F5;
+  margin-bottom: 10px;
+}

+ 526 - 0
js/component/manageCenter/set/amoeba/operation.jsx

@@ -0,0 +1,526 @@
+import React, { Component } from "react";
+import { Modal, Spin, TreeSelect, Form, Button, Input, Select, message, AutoComplete } from "antd";
+import $ from "jquery/src/ajax";
+import { newTreeData } from "@/tools";
+
+const Operation = React.createClass({
+  getInitialState() {
+    return {
+      confirmLoading: false,
+      levelData: [],
+    };
+  },
+
+  componentDidMount() {
+    const { levelData, lev, info } = this.props
+    !!info.id && this.getDetails(info.id)
+    this.setState({
+      levelData: newTreeData(levelData, lev),
+    })
+  },
+
+  // 巴详情接口
+  getDetails(id) {
+    this.setState({
+      confirmLoading: true
+    })
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/details",
+      data: { id },
+      success: function (data) {
+        this.setState({
+          confirmLoading: false,
+        });
+        let thedata = data.data;
+        if (data.error.length === 0) {
+          this.setState({
+            parentId: thedata.parentId,
+            name: thedata.name,
+            leader: thedata.leader,
+            financeId: thedata.financeId,
+            accountant: thedata.accountant,
+            remarks: thedata.remarks,
+            auto1: thedata.leaderName,
+            auto2: thedata.financeName,
+            auto3: thedata.accountantName,
+          })
+        } else {
+          message.warning(data.error[0].message);
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          confirmLoading: false
+        })
+      }.bind(this)
+    );
+  },
+  // 巴主查询
+  supervisor(e, role) {
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/customer/listAdminByName",
+      data: {
+        adminName: e,
+      },
+      success: function (data) {
+        let thedata = data.data;
+        if (!thedata) {
+          if (data.error && data.error.length) {
+            message.warning(data.error[0].message);
+          }
+          thedata = {};
+        }
+        if (role == "bz") {
+          this.setState({
+            customerArr1: thedata,
+          });
+        } else if (role == "cw") {
+          this.setState({
+            customerArr2: thedata,
+          });
+        } else if (role == "kj") {
+          this.setState({
+            customerArr3: thedata,
+          });
+        }
+      }.bind(this),
+    }).always(
+      function () {
+
+      }.bind(this)
+    );
+  },
+  // 巴主输入触发
+  httpChange1(e) {
+    if (e.length >= 1) {
+      this.supervisor(e, "bz");
+    }
+    this.setState({
+      auto1: e,
+    });
+  },
+  // 巴主选中
+  selectAuto1(value, options) {
+    let leaderid = "";
+    let contactLists = this.state.customerArr1 || [];
+    if (value) {
+      contactLists.map(function (item) {
+        if (item.name == value.toString()) {
+          leaderid = item.id
+        }
+      });
+    }
+    this.setState({
+      auto1: value,
+      leader: leaderid,
+    });
+  },
+  // 巴主失去焦点时间
+  blurChange1(e) {
+    let leaderid = "";
+    let contactLists = this.state.customerArr1 || [];
+    if (e) {
+      contactLists.map(function (item) {
+        if (item.name == e.toString()) {
+          leaderid = item.id
+        }
+      });
+    }
+    this.setState({
+      leader: leaderid,
+    });
+  },
+  // 财务输入触发
+  httpChange2(e) {
+    if (e.length >= 1) {
+      this.supervisor(e, "cw");
+    }
+    this.setState({
+      auto2: e,
+    });
+  },
+  // 财务选中
+  selectAuto2(value, options) {
+    let financeid = "";
+    let contactLists = this.state.customerArr2 || [];
+    if (value) {
+      contactLists.map(function (item) {
+        if (item.name == value.toString()) {
+          financeid = item.id
+        }
+      });
+    }
+    this.setState({
+      auto2: value,
+      financeId: financeid,
+    });
+  },
+  // 财务失去焦点时间
+  blurChange2(e) {
+    let financeid = "";
+    let contactLists = this.state.customerArr2 || [];
+    if (e) {
+      contactLists.map(function (item) {
+        if (item.name == e.toString()) {
+          financeid = item.id
+        }
+      });
+    }
+    this.setState({
+      financeId: financeid,
+    });
+  },
+  // 财务输入触发
+  httpChange3(e) {
+    if (e.length >= 1) {
+      this.supervisor(e, "kj");
+    }
+    this.setState({
+      auto3: e,
+    });
+  },
+  // 会计选中
+  selectAuto3(value, options) {
+    let accountant = "";
+    let contactLists = this.state.customerArr3 || [];
+    if (value) {
+      contactLists.map(function (item) {
+        if (item.name == value.toString()) {
+          accountant = item.id
+        }
+      });
+    }
+    this.setState({
+      auto3: value,
+      accountant: accountant,
+    });
+  },
+  // 会计失去焦点时间
+  blurChange3(e) {
+    let accountant = "";
+    let contactLists = this.state.customerArr3 || [];
+    if (e) {
+      contactLists.map(function (item) {
+        if (item.name == e.toString()) {
+          accountant = item.id
+        }
+      });
+    }
+    this.setState({
+      accountant: accountant,
+    });
+  },
+  // 新建巴
+  addSubmit() {
+    if (this.state.parentId === undefined || !this.state.parentId) {
+      message.warning("请选择上级部门!");
+      return
+    }
+    if (!this.state.name) {
+      message.warning("请填写巴名称!");
+      return
+    }
+    if (this.state.leader === undefined || !this.state.leader) {
+      message.warning("请设置巴主!");
+      return
+    }
+    if (this.state.financeId === undefined || !this.state.financeId) {
+      message.warning("请选择财务负责人!");
+      return
+    }
+    if (this.state.accountant === undefined || !this.state.accountant) {
+      message.warning("请选择会计负责人!");
+      return
+    }
+    this.setState({
+      confirmLoading: true
+    })
+    let data = {
+      parentId: this.state.parentId,
+      name: this.state.name,
+      leader: this.state.leader,
+      financeId: this.state.financeId,
+      accountant: this.state.accountant,
+      remarks: this.state.remarks,
+    }
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/add",
+      data,
+      success: function (data) {
+        if (data.error.length === 0) {
+          message.success("保存成功!");
+          this.props.handleCancel();
+        } else {
+          message.warning(data.error[0].message);
+        }
+        this.setState({
+          confirmLoading: false,
+        });
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          confirmLoading: false,
+        });
+      }.bind(this)
+    );
+  },
+  // 编辑巴
+  editSubmit() {
+    if (this.state.parentId === undefined || !this.state.parentId) {
+      message.warning("请选择上级部门!");
+      return
+    }
+    if (!this.state.name) {
+      message.warning("请填写巴名称!");
+      return
+    }
+    if (this.state.leader === undefined || !this.state.leader) {
+      message.warning("请设置巴主!");
+      return
+    }
+    if (this.state.financeId === undefined || !this.state.financeId) {
+      message.warning("请选择财务负责人!");
+      return
+    }
+    if (this.state.accountant === undefined || !this.state.accountant) {
+      message.warning("请选择会计负责人!");
+      return
+    }
+    this.setState({
+      confirmLoading: true
+    })
+    let data = {
+      id: this.props.info.id,
+      parentId: this.state.parentId,
+      name: this.state.name,
+      leader: this.state.leader,
+      financeId: this.state.financeId,
+      accountant: this.state.accountant,
+      remarks: this.state.remarks,
+    }
+    $.ajax({
+      method: "POST",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/amb/update",
+      data,
+      success: function (data) {
+        if (data.error.length === 0) {
+          message.success("保存成功!");
+          this.props.handleCancel();
+        } else {
+          message.warning(data.error[0].message);
+        }
+        this.setState({
+          confirmLoading: false,
+        });
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          confirmLoading: false,
+        });
+      }.bind(this)
+    );
+  },
+
+
+  render() {
+    const { confirmLoading, levelData } = this.state
+    const { visible, } = this.props;
+    const FormItem = Form.Item;
+    const formItemLayout = {
+      labelCol: { span: 8 },
+      wrapperCol: { span: 14 },
+    };
+    const dataSources1 = this.state.customerArr1 || [];
+    const options1 = dataSources1.map((group) => (
+      <Select.Option key={group.id} value={group.name}>
+        {group.name}
+      </Select.Option>
+    ));
+    const dataSources2 = this.state.customerArr2 || [];
+    const options2 = dataSources2.map((group) => (
+      <Select.Option key={group.id} value={group.name}>
+        {group.name}
+      </Select.Option>
+    ));
+    const dataSources3 = this.state.customerArr3 || [];
+    const options3 = dataSources3.map((group) => (
+      <Select.Option key={group.id} value={group.name}>
+        {group.name}
+      </Select.Option>
+    ));
+    return (
+      <Modal
+        maskClosable={false}
+        width="600px"
+        title={visible == "add"
+          ? "新增巴" : visible == "edit"
+            ? "编辑巴" : ""}
+        visible={visible != ""}
+        footer=""
+        onCancel={this.props.handleCancel}
+      >
+        <Spin spinning={confirmLoading}>
+          <div>
+            <Form
+              layout="horizontal"
+            >
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span><span className="mandatory">*</span>上级部门</span>}
+                >
+                  <TreeSelect
+                    style={{ width: 250 }}
+                    value={this.state.parentId}
+                    dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
+                    treeData={levelData}
+                    placeholder="请选择上级部门"
+                    onChange={(e) => {
+                      this.setState({
+                        parentId: e,
+                      });
+                    }}
+                  />
+                </FormItem>
+              </div>
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span><span className="mandatory">*</span>巴名称</span>}
+                >
+                  <Input
+                    placeholder="请填写巴名称"
+                    style={{ width: "250px" }}
+                    value={this.state.name}
+                    onChange={(e) => {
+                      this.setState({ name: e.target.value });
+                    }}
+                  />
+                </FormItem>
+              </div>
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span><span className="mandatory">*</span>巴主</span>}
+                >
+                  <AutoComplete
+                    className="certain-category-search"
+                    dropdownClassName="certain-category-search-dropdown"
+                    dropdownMatchSelectWidth={false}
+                    style={{ width: "250px" }}
+                    dataSource={options1}
+                    placeholder='输入巴主名称'
+                    value={this.state.auto1}
+                    onChange={this.httpChange1}
+                    filterOption={true}
+                    onBlur={this.blurChange1}
+                    onSelect={this.selectAuto1}
+                  >
+                    <Input />
+                  </AutoComplete>
+                </FormItem>
+              </div>
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span><span className="mandatory">*</span>财务负责人</span>}
+                >
+                  <AutoComplete
+                    className="certain-category-search"
+                    dropdownClassName="certain-category-search-dropdown"
+                    dropdownMatchSelectWidth={false}
+                    style={{ width: "250px" }}
+                    dataSource={options2}
+                    placeholder='输入财务负责人名称'
+                    value={this.state.auto2}
+                    onChange={this.httpChange2}
+                    filterOption={true}
+                    onBlur={this.blurChange2}
+                    onSelect={this.selectAuto2}
+                  >
+                    <Input />
+                  </AutoComplete>
+                </FormItem>
+              </div>
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span><span className="mandatory">*</span>会计负责人</span>}
+                >
+                  <AutoComplete
+                    className="certain-category-search"
+                    dropdownClassName="certain-category-search-dropdown"
+                    dropdownMatchSelectWidth={false}
+                    style={{ width: "250px" }}
+                    dataSource={options3}
+                    placeholder='输入会计负责人名称'
+                    value={this.state.auto3}
+                    onChange={this.httpChange3}
+                    filterOption={true}
+                    onBlur={this.blurChange3}
+                    onSelect={this.selectAuto3}
+                  >
+                    <Input />
+                  </AutoComplete>
+                </FormItem>
+              </div>
+              <div className="clearfix">
+                <FormItem
+                  className="mid-item"
+                  {...formItemLayout}
+                  label={<span>备注巴说明</span>}
+                >
+                  <Input
+                    type="textarea"
+                    placeholder=""
+                    style={{ width: "250px" }}
+                    autosize={{ minRows: 3 }}
+                    value={this.state.remarks}
+                    onChange={(e) => {
+                      this.setState({ remarks: e.target.value });
+                    }}
+                  />
+                </FormItem>
+              </div>
+              <FormItem wrapperCol={{ span: 12, offset: 8 }}>
+                <Button
+                  type="primary"
+                  onClick={!!this.props.info.id ? this.editSubmit : this.addSubmit}
+                  style={{ marginRight: "50px" }}
+                >
+                  保存
+                </Button>
+                <Button
+                  type="ghost"
+                  onClick={this.props.handleCancel}>
+                  取消
+                </Button>
+              </FormItem>
+            </Form>
+          </div>
+        </Spin>
+      </Modal >
+    );
+  },
+});
+
+export default Operation;

+ 59 - 51
js/component/manageCenter/set/content.jsx

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
 import '../content.less';
 import './content.less';
 import LeftTab from '../leftTab';
-import {getMenu} from '../publicMenu.js'
+import { getMenu } from '../publicMenu.js'
 
 class Content extends Component {
     constructor() {
@@ -13,20 +13,20 @@ class Content extends Component {
         };
     }
     componentWillMount() {
-        var ids=window.location.href.indexOf('rid=');
-        var idk=window.location.href.substr(ids+4);
-        var rid=idk.split('#');
-        let menu=getMenu(rid);
+        var ids = window.location.href.indexOf('rid=');
+        var idk = window.location.href.substr(ids + 4);
+        var rid = idk.split('#');
+        let menu = getMenu(rid);
         let curry;
-        if(menu[0].subMenus.length>0){
-        	curry=menu[0].subMenus[0].url.split('#');
-        }else{
-        	curry=menu[0].url.split('#');
+        if (menu[0].subMenus.length > 0) {
+            curry = menu[0].subMenus[0].url.split('#');
+        } else {
+            curry = menu[0].url.split('#');
         };
         if (window.location.hash) {
             this.getKey(window.location.hash.substr(1));
         } else {
-         this.getKey(curry[1]);
+            this.getKey(curry[1]);
         };
     }
     getKey(key) {
@@ -35,7 +35,7 @@ class Content extends Component {
                 require.ensure([], () => {
                     const SoftwareConfigure = require('./projectConfigure/softwareConfigure').default;
                     this.setState({
-                        component:<SoftwareConfigure />,
+                        component: <SoftwareConfigure />,
                     });
                 });
                 break;
@@ -43,7 +43,7 @@ class Content extends Component {
                 require.ensure([], () => {
                     const OfficialFees = require('./projectConfigure/officialFees').default;
                     this.setState({
-                        component:<OfficialFees />,
+                        component: <OfficialFees />,
                     });
                 });
                 break;
@@ -51,50 +51,50 @@ class Content extends Component {
                 require.ensure([], () => {
                     const PatentFees = require('./projectConfigure/patentFees').default;
                     this.setState({
-                        component:<PatentFees />,
+                        component: <PatentFees />,
                     });
                 });
                 break;
-      	    case 'organization':
-            require.ensure([], () => {
-                const Organization = require('./organization/organization').default;
-                this.setState({
-                    component:<Organization />,
+            case 'organization':
+                require.ensure([], () => {
+                    const Organization = require('./organization/organization').default;
+                    this.setState({
+                        component: <Organization />,
+                    });
                 });
-      	    });
-      	    break;
+                break;
             case 'workeTimes':
                 require.ensure([], () => {
                     const WorkeTimes = require('./workeTimes/index').default;
                     this.setState({
-                        component:<WorkeTimes />,
+                        component: <WorkeTimes />,
                     });
                 });
                 break;
-      	    case 'businessCategory':
-            require.ensure([], () => {
-                const BusinessCategory = require('./business/businessCategory').default;
-                this.setState({
-                    component:<BusinessCategory />
-                	});
+            case 'businessCategory':
+                require.ensure([], () => {
+                    const BusinessCategory = require('./business/businessCategory').default;
+                    this.setState({
+                        component: <BusinessCategory />
+                    });
                 });
                 break;
             case 'businessProject':
-            require.ensure([], () => {
-                const BusinessProject = require('./business/businessProject').default;
-                this.setState({
-                    component:<BusinessProject />
-                	});
+                require.ensure([], () => {
+                    const BusinessProject = require('./business/businessProject').default;
+                    this.setState({
+                        component: <BusinessProject />
+                    });
                 });
-            break;
+                break;
             case 'businessQuery':
-            require.ensure([], () => {
-                const BusinessQuery = require('./business/businessQuery').default;
-                this.setState({
-                    component:<BusinessQuery />
-                	});
+                require.ensure([], () => {
+                    const BusinessQuery = require('./business/businessQuery').default;
+                    this.setState({
+                        component: <BusinessQuery />
+                    });
                 });
-            break;
+                break;
             case 'user':
                 require.ensure([], () => {
                     const User = require('./userManagementS/user').default;
@@ -106,13 +106,13 @@ class Content extends Component {
 
             case 'roles':
                 require.ensure([], () => {
-	                const Roles = require('./userManagementS/roles').default;
-	                this.setState({
-	                    component:<Roles />,
-	                });
-          	    });
-          	    break;
-          	case 'permission':
+                    const Roles = require('./userManagementS/roles').default;
+                    this.setState({
+                        component: <Roles />,
+                    });
+                });
+                break;
+            case 'permission':
                 require.ensure([], () => {
                     const Jurisdiction = require('./userManagementS/jurisdiction').default;
                     this.setState({
@@ -120,12 +120,20 @@ class Content extends Component {
                     });
                 });
                 break;
+            case 'bar':
+                require.ensure([], () => {
+                    const Bar = require('./amoeba/barList').default;
+                    this.setState({
+                        component: <Bar />
+                    });
+                });
+                break;
             default:
-            require.ensure([], () => {
-                const Module = require('../module').default;
-                this.setState({
-                    component:<Module />
-                	});
+                require.ensure([], () => {
+                    const Module = require('../module').default;
+                    this.setState({
+                        component: <Module />
+                    });
                 });
         };
         window.location.hash = key;

+ 31 - 6
js/component/tools.js

@@ -115,7 +115,7 @@ import {
 import { provinceList } from './NewDicProvinceList.js';
 import ShowModal from './showModal.jsx';
 
-module.exports = {
+const obj = {
   // deepClone: function (data) {
   //   let type = typeof data;
   //   let tempValue;
@@ -880,7 +880,6 @@ module.exports = {
       return theType;
     }
   },
-
   //客户类型
   getcustomerTyp: function (e) {
     if (e) {
@@ -941,7 +940,6 @@ module.exports = {
       return theType;
     }
   },
-
   //意向服务
   getCompanyIntention: function (e) {
     if (e) {
@@ -978,7 +976,6 @@ module.exports = {
       return theType;
     }
   },
-
   //性别
   getsex: function (e) {
     if (e) {
@@ -1003,7 +1000,6 @@ module.exports = {
       return theType;
     }
   },
-
   //是否文字与数字转换
   getWhether: function (e) {
     if (e) {
@@ -2181,5 +2177,34 @@ module.exports = {
     } else {
       return {};
     }
-  }
+  },
+  // 处理级别层数
+  getBarLevel: function (val) {
+    let arr = []
+    if (!val) {
+      arr = ["", "", "", "", ""]
+    } else {
+      arr = val.split(',')
+    }
+    let leg = 5 - arr.length
+    if (arr.length < 5) {
+      for (var i = 0; i < leg; i++) {
+        arr.push(" ")
+      }
+    }
+    return arr
+  },
+  // 树状数据处理  num需要显示的最低lvl从0开始  默认全部显示
+  newTreeData(treeData, num = 6) {
+    let newData = [];
+    treeData.map(item => {
+      let treeObj = item;
+      treeObj.children = (item.children && item.lvl < num) ? obj.newTreeData(item.children, num) : [];
+      newData.push(treeObj)
+    })
+    return newData
+  },
 };
+
+
+module.exports = obj