|
@@ -6,7 +6,7 @@ import moment from 'moment';
|
|
|
import '../content.less';
|
|
|
import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,TimePicker } from 'antd';
|
|
|
import {categoryState} from '../../../dataDic.js';
|
|
|
-
|
|
|
+import {getCategoryState} from '../../../tools.js';
|
|
|
const BusinessCategory=Form.create()(React.createClass({
|
|
|
loadData(pageNo, apiUrl) {
|
|
|
this.state.data = [];
|
|
@@ -14,13 +14,17 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
loading: true
|
|
|
});
|
|
|
$.ajax({
|
|
|
- method: "get",
|
|
|
+ method: "post",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + (apiUrl || this.props['data-listApiUrl']),
|
|
|
+ url: globalConfig.context + '/open/api/admin/Varieties/vtList',
|
|
|
data: {
|
|
|
pageNo: pageNo || 1,
|
|
|
pageSize: this.state.pagination.pageSize,
|
|
|
+ cname: this.state.cname, //品类名称
|
|
|
+ superName:this.state.superName,//上级品类编号
|
|
|
+ layer:this.state.layer,//组织层级
|
|
|
+ status:this.state.depNo,//品类状态
|
|
|
},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
@@ -30,11 +34,15 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
};
|
|
|
} else {
|
|
|
for (let i = 0; i < data.data.list.length; i++) {
|
|
|
- let thisdata = data.data.list[i];
|
|
|
+ let thisdata = data.data.list[i];
|
|
|
theArr.push({
|
|
|
key: i,
|
|
|
- id: thisdata.id,
|
|
|
- serialNumber: thisdata.serialNumber,
|
|
|
+ id: thisdata.id,//品类ID
|
|
|
+ cid: thisdata.cid,//品类编号
|
|
|
+ cname: thisdata.cname,//品类名称
|
|
|
+ layer: thisdata.layer,//品类层级
|
|
|
+ superName: thisdata.superName,//上级品类
|
|
|
+ status: thisdata.status,//上级品类状态
|
|
|
});
|
|
|
};
|
|
|
this.state.pagination.current = data.data.pageNo;
|
|
@@ -72,42 +80,132 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
columns: [
|
|
|
{
|
|
|
title: '品类编号',
|
|
|
- dataIndex: 'serialNumber',
|
|
|
- key: 'serialNumber',
|
|
|
+ dataIndex: 'cid',
|
|
|
+ key: 'cid',
|
|
|
}, {
|
|
|
title: '品类名称',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
+ dataIndex: 'cname',
|
|
|
+ key: 'cname',
|
|
|
}, {
|
|
|
title: '品类层级',
|
|
|
- dataIndex: 'category',
|
|
|
- key: 'category',
|
|
|
- render: text => { return getAchievementCategory(text); }
|
|
|
+ dataIndex: 'layer',
|
|
|
+ key: 'layer',
|
|
|
+ //render: text => { return getAchievementCategory(text); }
|
|
|
}, {
|
|
|
title: '上级品类',
|
|
|
- dataIndex: 'keyword',
|
|
|
- key: 'keyword',
|
|
|
+ dataIndex: 'superName',
|
|
|
+ key: 'superName',
|
|
|
},{
|
|
|
title: '品类状态',
|
|
|
- dataIndex: 'auditStatus',
|
|
|
- key: 'auditStatus',
|
|
|
- render: text => { return getTechAuditStatus(text) }
|
|
|
+ dataIndex: 'status',
|
|
|
+ key: 'status',
|
|
|
+ render: text => { return getCategoryState(text) }
|
|
|
}
|
|
|
],
|
|
|
dataSource: [],
|
|
|
};
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
-
|
|
|
- this.loadData();
|
|
|
+ this.selectSuperId();
|
|
|
},
|
|
|
-
|
|
|
+ //获取上级品类
|
|
|
+ selectSuperId() {
|
|
|
+ this.state.data = []
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/open/api/admin/Varieties/getSuperList",
|
|
|
+ data:{
|
|
|
+
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ console.log(data);
|
|
|
+ let theArr = [];
|
|
|
+ let thedata=data.data;
|
|
|
+ if (!thedata) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ thedata = {};
|
|
|
+ };
|
|
|
+ var contactIds=[];
|
|
|
+ //for (let item in data.data) {
|
|
|
+ for(var i=0;i<data.data.length;i++){
|
|
|
+ let theData = data.data[i];
|
|
|
+ theArr.push(
|
|
|
+ <Select.Option value={i.toString()} key={theData.name}>{theData.name}</Select.Option>
|
|
|
+ );
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ SuperArr:thedata,
|
|
|
+ contactsOption: theArr,
|
|
|
+ orderStatusOptions:data.data,
|
|
|
+ });
|
|
|
+
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.loadData();
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ //整行点击
|
|
|
tableRowClick(record, index) {
|
|
|
this.state.RowData = record;
|
|
|
this.setState({
|
|
|
showDesc: true
|
|
|
});
|
|
|
},
|
|
|
+ //新增一个品类,保存
|
|
|
+ addhandleSubmit(e){
|
|
|
+ e.preventDefault();
|
|
|
+// if(!this.state.theTypes){
|
|
|
+// message.warning('请输入负责人姓名');
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// if(!this.state.typeOrganization){
|
|
|
+// message.warning('请选择组织类型');
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// if(!this.state.upOrganization){
|
|
|
+// message.warning('请选择上级组织');
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+ this.props.form.validateFields((err, values) => {
|
|
|
+ if (!err) {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ //上级组织字典
|
|
|
+// let nameText=this.state.SuperArr
|
|
|
+// let superText=nameText[parseInt(this.state.upOrganization)].name
|
|
|
+ $.ajax({
|
|
|
+ method: "post",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url:globalConfig.context + '/open/api/admin/Varieties/addVarieties',
|
|
|
+ data:{
|
|
|
+ cname:this.state.nameOrganization,//组织名称
|
|
|
+ superId:superText,//上级组织
|
|
|
+ remarks:this.state.remarksOrganization,//组织职能说明
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('保存成功!');
|
|
|
+ this.handleCancel();
|
|
|
+ this.loadData();
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
delectRow() {
|
|
|
let deletedIds = [];
|
|
|
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
|
|
@@ -206,10 +304,12 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
<Input placeholder="业务品类名称" style={{width:'150px',marginRight:'10px',marginBottom:'10px'}}
|
|
|
value={this.state.serialNumber}
|
|
|
onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
|
|
|
- <Input placeholder="上级业务品类" style={{width:'150px',marginRight:'10px',marginBottom:'10px'}}
|
|
|
- value={this.state.serialNumber}
|
|
|
- onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
|
|
|
-
|
|
|
+ <Select placeholder="上级品类"
|
|
|
+ style={{ width:'200px',marginRight:'10px' }}
|
|
|
+ value={this.state.superId}
|
|
|
+ onChange={(e) => { this.setState({ superId: e }) }} notFoundContent="未获取到上级品类列表">
|
|
|
+ {this.state.contactsOption}
|
|
|
+ </Select>
|
|
|
<Button type="primary" onClick={this.search} style={{marginRight:'10px'}}>搜索</Button>
|
|
|
<Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
|
|
|
<Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
|
|
@@ -234,12 +334,12 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
style={{ width:'150px',marginRight:'10px' }}
|
|
|
value={this.state.shareTypeSearch}
|
|
|
onChange={(e) => { this.setState({ shareTypeSearch: e }) }}>
|
|
|
- <Select.Option value="0" >一级</Select.Option>
|
|
|
- <Select.Option value="1" >二级</Select.Option>
|
|
|
- <Select.Option value="2" >三级</Select.Option>
|
|
|
- <Select.Option value="3" >四级</Select.Option>
|
|
|
- <Select.Option value="4" >五级</Select.Option>
|
|
|
- <Select.Option value="5" >六级</Select.Option>
|
|
|
+ <Select.Option value="1" >一级</Select.Option>
|
|
|
+ <Select.Option value="2" >二级</Select.Option>
|
|
|
+ <Select.Option value="3" >三级</Select.Option>
|
|
|
+ <Select.Option value="4" >四级</Select.Option>
|
|
|
+ <Select.Option value="5" >五级</Select.Option>
|
|
|
+ <Select.Option value="6" >六级</Select.Option>
|
|
|
</Select>
|
|
|
<Select placeholder="品类状态"
|
|
|
style={{width:'150px',marginRight:'50px'}}
|
|
@@ -269,32 +369,16 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
title='新增品类'
|
|
|
footer=''
|
|
|
className="admin-desc-content">
|
|
|
- <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
|
|
|
+ <Form horizontal onSubmit={this.addhandleSubmit} id="demand-form">
|
|
|
<Spin spinning={this.state.loading}>
|
|
|
<div className="clearfix">
|
|
|
<FormItem className="half-item"
|
|
|
labelCol={{ span: 7 }}
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类名称" >
|
|
|
- {getFieldDecorator('name', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: this.state.name
|
|
|
- })(
|
|
|
- <Input placeholder="品类名称" />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
- <div className="clearfix">
|
|
|
- <FormItem className="half-item"
|
|
|
- labelCol={{ span: 7 }}
|
|
|
- wrapperCol={{ span: 12}}
|
|
|
- label="上级品类" >
|
|
|
- {getFieldDecorator('content', {
|
|
|
-// rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: this.state.content
|
|
|
- })(
|
|
|
- <Input placeholder="上级品类" />
|
|
|
- )}
|
|
|
+ <Input placeholder="品类名称" value={this.state.nameCategory} style={{width:'95%'}}
|
|
|
+ onChange={(e)=>{this.setState({nameCategory:e.target.value})}} required="required"/>
|
|
|
+ <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -303,16 +387,11 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="上级品类"
|
|
|
>
|
|
|
- {getFieldDecorator('societyTagt', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: this.state.societyTagt
|
|
|
- })(
|
|
|
- <Select placeholder="上级品类"
|
|
|
- value={this.state.lastName}
|
|
|
- onChange={this.hundleName}>
|
|
|
- {this.state.orderStatusOption}
|
|
|
- </Select>
|
|
|
- )}
|
|
|
+ <Select placeholder="请选择上级品类" value={this.state.upCategory} onChange={(e)=>{this.setState({upCategory:e})}}
|
|
|
+ notFoundContent="未获取到上级品类列表" style={{width:'95%'}} required="required">
|
|
|
+ {this.state.contactsOption}
|
|
|
+ </Select>
|
|
|
+ <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<FormItem wrapperCol={{ span: 12, offset: 7 }}>
|
|
@@ -333,7 +412,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
title='编辑品类'
|
|
|
footer=''
|
|
|
className="admin-desc-content">
|
|
|
- <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
|
|
|
+ <Form horizontal onSubmit={this.edithandleSubmit} id="demand-form">
|
|
|
<Spin spinning={this.state.loading}>
|
|
|
<div className="clearfix">
|
|
|
<FormItem className="half-item"
|