|
@@ -8,11 +8,14 @@ import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message,
|
|
|
import {categoryState} from '../../../dataDic.js';
|
|
|
import {getCategoryState} from '../../../tools.js';
|
|
|
const BusinessCategory=Form.create()(React.createClass({
|
|
|
+ //搜索功能和初始列表加载
|
|
|
loadData(pageNo, apiUrl) {
|
|
|
this.state.data = [];
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
+ let nameText=this.state.SuperArr;
|
|
|
+ let superText=(this.state.superId)?nameText[parseInt(this.state.superId)].id:"";
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
@@ -21,10 +24,10 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
data: {
|
|
|
pageNo: pageNo || 1,
|
|
|
pageSize: this.state.pagination.pageSize,
|
|
|
- cname: this.state.cname, //品类名称
|
|
|
- superName:this.state.superName,//上级品类编号
|
|
|
+ cname:this.state.cname, //品类名称
|
|
|
+ superId:superText,//上级品类编号
|
|
|
layer:this.state.layer,//组织层级
|
|
|
- status:this.state.depNo,//品类状态
|
|
|
+ status:this.state.status,//品类状态
|
|
|
},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
@@ -153,50 +156,97 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
},
|
|
|
//整行点击
|
|
|
tableRowClick(record, index) {
|
|
|
+ this.selectSuperId();
|
|
|
this.state.RowData = record;
|
|
|
this.setState({
|
|
|
- showDesc: true
|
|
|
+ editvisible: true,
|
|
|
+ selectedRowKeys:[],
|
|
|
+ rowId:record.businessId,
|
|
|
});
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context +"/open/api/admin/Varieties/detailVarieties" ,
|
|
|
+ data: {
|
|
|
+ id: record.id
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ let thisdata = data;
|
|
|
+ if (!data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ theArr.push({
|
|
|
+ editId: thisdata.id,//每一条记录的ID
|
|
|
+ editName:thisdata.name,//组织名称
|
|
|
+ editManagerId:thisdata.managerId,//负责人
|
|
|
+ editType:thisdata.type,//组织类型
|
|
|
+ editStatus:thisdata.status,//组织状态
|
|
|
+ editSuperId:thisdata.superId,//上级组织
|
|
|
+ editDepNo: thisdata.depNo,//组织编号
|
|
|
+ editCreateId:thisdata.createId,//创建人
|
|
|
+ editTime:thisdata.createTime,//创建时间
|
|
|
+ editRemarks:thisdata.remarks,//组织职能说明
|
|
|
+ });
|
|
|
+
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ editId: thisdata.id,//每一条记录的ID
|
|
|
+ editName:thisdata.name,//组织名称
|
|
|
+ editManagerId:thisdata.managerId,//负责人
|
|
|
+ editType:thisdata.type,//组织类型
|
|
|
+ editStatus:thisdata.status,//组织状态
|
|
|
+ editSuperId:thisdata.superId,//上级组织
|
|
|
+ editDepNo: thisdata.depNo,//组织编号
|
|
|
+ editCreateId:thisdata.createId,//创建人
|
|
|
+ editTime:thisdata.createTime,//创建时间
|
|
|
+ editRemarks: thisdata.remarks,//组织职能说明
|
|
|
+ editDataSource: theArr,
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
},
|
|
|
//新增一个品类,保存
|
|
|
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;
|
|
|
-// }
|
|
|
+ if(!this.state.categoryName){
|
|
|
+ message.warning('请输入品类名称');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(!this.state.upCategory){
|
|
|
+ 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
|
|
|
+ let nameText=this.state.SuperArr;
|
|
|
+ let superText=nameText[parseInt(this.state.upCategory)].id;
|
|
|
$.ajax({
|
|
|
- method: "post",
|
|
|
+ method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
url:globalConfig.context + '/open/api/admin/Varieties/addVarieties',
|
|
|
data:{
|
|
|
- cname:this.state.nameOrganization,//组织名称
|
|
|
+ cname:this.state.categoryName,//组织名称
|
|
|
superId:superText,//上级组织
|
|
|
- remarks:this.state.remarksOrganization,//组织职能说明
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
this.setState({
|
|
|
loading: false
|
|
|
});
|
|
|
if (!data.error.length) {
|
|
|
- message.success('保存成功!');
|
|
|
+ message.success('新增品类成功!');
|
|
|
this.handleCancel();
|
|
|
this.loadData();
|
|
|
} else {
|
|
@@ -206,12 +256,13 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //整行删除
|
|
|
delectRow() {
|
|
|
- let deletedIds = [];
|
|
|
+ let deletedIds = '';
|
|
|
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
|
|
|
let rowItem = this.state.selectedRows[idx];
|
|
|
if (rowItem.id) {
|
|
|
- deletedIds.push(rowItem.id)
|
|
|
+ deletedIds=rowItem.id;
|
|
|
};
|
|
|
};
|
|
|
this.setState({
|
|
@@ -219,12 +270,12 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
loading: deletedIds.length > 0
|
|
|
});
|
|
|
$.ajax({
|
|
|
- method: "POST",
|
|
|
+ method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + "/open/api/admin/Varieties/deleteState",
|
|
|
data: {
|
|
|
- ids: deletedIds
|
|
|
+ id: deletedIds
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
if (!data.error.length) {
|
|
@@ -238,6 +289,39 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
this.loadData();
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ //整行停用
|
|
|
+ blockRow() {
|
|
|
+ let deletedIds = '';
|
|
|
+ for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
|
|
|
+ let rowItem = this.state.selectedRows[idx];
|
|
|
+ if (rowItem.id) {
|
|
|
+ deletedIds=rowItem.id;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ selectedRowKeys: [],
|
|
|
+ loading: deletedIds.length > 0
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/open/api/admin/Varieties/updateStatus",
|
|
|
+ data: {
|
|
|
+ id: deletedIds
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('该品类已成功停用!');
|
|
|
+ this.setState({
|
|
|
+ loading: false,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ this.loadData();
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
addClick() {
|
|
|
this.state.RowData = {};
|
|
|
this.setState({
|
|
@@ -260,17 +344,10 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
this.loadData();
|
|
|
},
|
|
|
reset() {
|
|
|
- this.state.serialNumber = undefined;
|
|
|
- this.state.name = undefined;
|
|
|
- this.state.keyword = undefined;
|
|
|
- this.state.category = undefined;
|
|
|
- this.state.ownerType = undefined;
|
|
|
- this.state.releaseStatus = undefined;
|
|
|
- this.state.auditStatus = undefined;
|
|
|
- this.state.searchName = undefined;
|
|
|
- this.state.releaseDate = [];
|
|
|
- this.state.boutique = '';
|
|
|
- this.state.hot='' ;
|
|
|
+ this.state.cname = '';//品类名称清零
|
|
|
+ this.state.layer = undefined;//品类层级清零
|
|
|
+ this.state.status = undefined;//品类状态清零
|
|
|
+ this.state.superId = undefined;//上级品类清零
|
|
|
this.loadData();
|
|
|
},
|
|
|
searchSwitch() {
|
|
@@ -302,8 +379,8 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
<div className="content-title">
|
|
|
<div className="user-search">
|
|
|
<Input placeholder="业务品类名称" style={{width:'150px',marginRight:'10px',marginBottom:'10px'}}
|
|
|
- value={this.state.serialNumber}
|
|
|
- onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
|
|
|
+ value={this.state.cname}
|
|
|
+ onChange={(e) => { this.setState({ cname: e.target.value }); }} />
|
|
|
<Select placeholder="上级品类"
|
|
|
style={{ width:'200px',marginRight:'10px' }}
|
|
|
value={this.state.superId}
|
|
@@ -328,8 +405,8 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
<div className="search-more" style={this.state.searchMore ? { display: 'none' } : {display: 'inline-block'}}>
|
|
|
<Select placeholder="品类层级"
|
|
|
style={{ width:'150px',marginRight:'10px' }}
|
|
|
- value={this.state.shareTypeSearch}
|
|
|
- onChange={(e) => { this.setState({ shareTypeSearch: e }) }}>
|
|
|
+ value={this.state.layer}
|
|
|
+ onChange={(e) => { this.setState({ layer: e }) }}>
|
|
|
<Select.Option value="1" >一级</Select.Option>
|
|
|
<Select.Option value="2" >二级</Select.Option>
|
|
|
<Select.Option value="3" >三级</Select.Option>
|
|
@@ -339,14 +416,14 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
</Select>
|
|
|
<Select placeholder="品类状态"
|
|
|
style={{width:'150px',marginRight:'50px'}}
|
|
|
- value={this.state.shareTypeSearch}
|
|
|
- onChange={(e) => { this.setState({ shareTypeSearch: e }) }}>
|
|
|
+ value={this.state.status}
|
|
|
+ onChange={(e) => { this.setState({ status: e }) }}>
|
|
|
<Select.Option value="0" >正常</Select.Option>
|
|
|
<Select.Option value="1" >停用</Select.Option>
|
|
|
</Select>
|
|
|
</div>
|
|
|
- <Button type="primary" className="addButton" onClick={this.addClick} style={{float:'right',marginRight:'200px'}}>新增客户<Icon type="plus" /></Button>
|
|
|
- <Button type="primary" className="addButton" onClick={this.editClick}>编辑客户<Icon type="plus" /></Button>
|
|
|
+ <Button type="primary" className="addButton" onClick={this.addClick} style={{float:'right',marginRight:'200px'}}>新增品类<Icon type="plus" /></Button>
|
|
|
+ <Button type="primary" className="addButton" onClick={this.editClick}>编辑品类<Icon type="plus" /></Button>
|
|
|
</div>
|
|
|
<div className="patent-table">
|
|
|
<Spin spinning={this.state.loading}>
|
|
@@ -372,8 +449,8 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
labelCol={{ span: 7 }}
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类名称" >
|
|
|
- <Input placeholder="品类名称" value={this.state.nameCategory} style={{width:'95%'}}
|
|
|
- onChange={(e)=>{this.setState({nameCategory:e.target.value})}} required="required"/>
|
|
|
+ <Input placeholder="品类名称" value={this.state.categoryName} style={{width:'94%'}}
|
|
|
+ onChange={(e)=>{this.setState({categoryName:e.target.value})}} required="required"/>
|
|
|
<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
@@ -384,7 +461,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
label="上级品类"
|
|
|
>
|
|
|
<Select placeholder="请选择上级品类" value={this.state.upCategory} onChange={(e)=>{this.setState({upCategory:e})}}
|
|
|
- notFoundContent="未获取到上级品类列表" style={{width:'95%'}} required="required">
|
|
|
+ notFoundContent="未获取到上级品类列表" style={{width:'94%'}} required="required">
|
|
|
{this.state.contactsOption}
|
|
|
</Select>
|
|
|
<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
|
|
@@ -415,12 +492,9 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
labelCol={{ span: 7 }}
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类名称" >
|
|
|
- {getFieldDecorator('name', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: this.state.name
|
|
|
- })(
|
|
|
+
|
|
|
<Input placeholder="品类名称" />
|
|
|
- )}
|
|
|
+
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -429,10 +503,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类状态"
|
|
|
>
|
|
|
- {getFieldDecorator('societyTagt', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: this.state.societyTagt
|
|
|
- })(
|
|
|
+
|
|
|
<Select placeholder="品类状态">
|
|
|
{
|
|
|
categoryState.map(function (item) {
|
|
@@ -440,7 +511,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
})
|
|
|
}
|
|
|
</Select>
|
|
|
- )}
|
|
|
+
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -449,16 +520,13 @@ 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>
|
|
|
- )}
|
|
|
+
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|