|
@@ -123,7 +123,6 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
|
|
|
},
|
|
|
success: function (data) {
|
|
|
- console.log(data);
|
|
|
let theArr = [];
|
|
|
let thedata=data.data;
|
|
|
if (!thedata) {
|
|
@@ -154,6 +153,127 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
});
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ //编辑部门,保存
|
|
|
+ edithandleSubmit(e){
|
|
|
+ e.preventDefault();
|
|
|
+ //上级组织字典
|
|
|
+ let nameText=this.state.SuperArr
|
|
|
+ let superText=this.state.editSuperName;
|
|
|
+ //let superText=(this.state.editSuperId).length<=1?nameText[parseInt(this.state.editSuperId)].name:''
|
|
|
+ let superOne=this.state.editDataSource[0].editSuperId;
|
|
|
+ let isStatus=this.state.editStatus;
|
|
|
+ if(isStatus==1){
|
|
|
+ if(confirm('是否要停用该品类?')){
|
|
|
+ if(!(superOne==superText)){
|
|
|
+ let changeSuper=nameText[parseInt(this.state.editSuperId)].name;
|
|
|
+ if(confirm('上级品类已修改,是否保存?')){
|
|
|
+ $.ajax({
|
|
|
+ method: "post",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url:globalConfig.context + '/open/api/admin/Varieties/editVarieties',
|
|
|
+ data:{
|
|
|
+ id:this.state.editId,//品类ID
|
|
|
+ cname:this.state.editName,//品类名称
|
|
|
+ superId:changeSuper,//上级品类
|
|
|
+ status:this.state.editStatus,//品类状态
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('保存成功!');
|
|
|
+ this.edithandleCancel();
|
|
|
+ this.loadData();
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ $.ajax({
|
|
|
+ method: "post",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url:globalConfig.context + '/open/api/admin/Varieties/editVarieties',
|
|
|
+ data:{
|
|
|
+ id:this.state.editId,//品类ID
|
|
|
+ cname:this.state.editName,//品类名称
|
|
|
+ superId:superText,//上级品类
|
|
|
+ status:this.state.editStatus,//品类状态
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('保存成功!');
|
|
|
+ this.edithandleCancel();
|
|
|
+ this.loadData();
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(!(superOne==superText)){
|
|
|
+ let changeSuper=nameText[parseInt(this.state.editSuperId)].name;
|
|
|
+ if(confirm('上级组织已修改,是否保存?')){
|
|
|
+ $.ajax({
|
|
|
+ method: "post",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url:globalConfig.context + '/open/api/admin/Varieties/editVarieties',
|
|
|
+ data:{
|
|
|
+ id:this.state.editId,//品类ID
|
|
|
+ cname:this.state.editName,//品类名称
|
|
|
+ superId:changeSuper,//上级品类
|
|
|
+ status:this.state.editStatus,//品类状态
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('保存成功!');
|
|
|
+ this.edithandleCancel();
|
|
|
+ this.loadData();
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ $.ajax({
|
|
|
+ method: "post",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url:globalConfig.context + '/open/api/admin/Varieties/editVarieties',
|
|
|
+ data:{
|
|
|
+ id:this.state.editId,//品类ID
|
|
|
+ cname:this.state.editName,//品类名称
|
|
|
+ superId:superText,//上级品类
|
|
|
+ status:this.state.editStatus,//品类状态
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('保存成功!');
|
|
|
+ this.edithandleCancel();
|
|
|
+ this.loadData();
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
//整行点击
|
|
|
tableRowClick(record, index) {
|
|
|
this.selectSuperId();
|
|
@@ -173,7 +293,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
|
- let thisdata = data;
|
|
|
+ let thisdata = data.data;
|
|
|
if (!data) {
|
|
|
if (data.error && data.error.length) {
|
|
|
message.warning(data.error[0].message);
|
|
@@ -181,29 +301,24 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
} 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,//创建人
|
|
|
+ editName:thisdata.cname,//品类名称
|
|
|
+ editStatus:thisdata.status,//品类状态
|
|
|
+ editSuperName:thisdata.superName,//上级品类
|
|
|
+ editlayer:thisdata.layer,//品类层级
|
|
|
+ editCid: thisdata.cid,//品类编号
|
|
|
+ editCreateName:thisdata.createName,//创建人
|
|
|
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,//创建人
|
|
|
+ editName:thisdata.cname,//品类名称
|
|
|
+ editStatus:thisdata.status,//品类状态
|
|
|
+ editSuperName:thisdata.superName,//上级品类
|
|
|
+ editlayer:thisdata.layer,//品类层级
|
|
|
+ editCid: thisdata.cid,//品类编号
|
|
|
+ editCreateName:thisdata.createName,//创建人
|
|
|
editTime:thisdata.createTime,//创建时间
|
|
|
- editRemarks: thisdata.remarks,//组织职能说明
|
|
|
editDataSource: theArr,
|
|
|
});
|
|
|
}.bind(this),
|
|
@@ -477,7 +592,14 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
</div>
|
|
|
|
|
|
|
|
|
-
|
|
|
+ editId: thisdata.id,//每一条记录的ID
|
|
|
+ editName:thisdata.cname,//品类名称
|
|
|
+ editStatus:thisdata.status,//品类状态
|
|
|
+ editSuperName:thisdata.superName,//上级品类
|
|
|
+ editlayer:thisdata.layer,//品类层级
|
|
|
+ editCid: thisdata.cid,//品类编号
|
|
|
+ editCreateId:thisdata.createId,//创建人
|
|
|
+ editTime:thisdata.createTime,//创建时间
|
|
|
<div className="patent-desc">
|
|
|
<Modal maskClosable={false} visible={this.state.editvisible}
|
|
|
onOk={this.checkPatentProcess} onCancel={this.edithandleCancel}
|
|
@@ -492,9 +614,8 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
labelCol={{ span: 7 }}
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类名称" >
|
|
|
-
|
|
|
- <Input placeholder="品类名称" />
|
|
|
-
|
|
|
+ <Input placeholder="组织名称" value={this.state.editName}
|
|
|
+ onChange={(e)=>{this.setState({editName:e.target.value})}}/>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -503,15 +624,14 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类状态"
|
|
|
>
|
|
|
-
|
|
|
- <Select placeholder="品类状态">
|
|
|
+ <Select placeholder="品类状态" value={this.state.editStatus}
|
|
|
+ onChange={(e)=>{this.setState({editStatus:e})}}>
|
|
|
{
|
|
|
categoryState.map(function (item) {
|
|
|
return <Select.Option key={item.value} >{item.key}</Select.Option>
|
|
|
})
|
|
|
}
|
|
|
</Select>
|
|
|
-
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -520,13 +640,10 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="上级品类"
|
|
|
>
|
|
|
-
|
|
|
- <Select placeholder="上级品类"
|
|
|
- value={this.state.lastName}
|
|
|
- onChange={this.hundleName}>
|
|
|
- {this.state.orderStatusOption}
|
|
|
- </Select>
|
|
|
-
|
|
|
+ <Select placeholder="请选择上级组织" value={this.state.editSuperName} onChange={(e)=>{this.setState({editSuperName:e})}}
|
|
|
+ notFoundContent="未获取到上级组织列表">
|
|
|
+ {this.state.contactsOption}
|
|
|
+ </Select>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -535,7 +652,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类层级"
|
|
|
>
|
|
|
- <span>{}</span>
|
|
|
+ <span>{this.state.editlayer}</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -544,7 +661,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="品类编号"
|
|
|
>
|
|
|
- <span>{}</span>
|
|
|
+ <span>{this.state.editCid}</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix" >
|
|
@@ -553,7 +670,7 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="创建人"
|
|
|
>
|
|
|
- <span>{}</span>
|
|
|
+ <span>{this.state.editCreateName}</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
<div className="clearfix">
|
|
@@ -562,18 +679,9 @@ const BusinessCategory=Form.create()(React.createClass({
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
label="创建时间"
|
|
|
>
|
|
|
- <span>{}</span>
|
|
|
+ <span>{this.state.editTime}</span>
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
- <div className="clearfix">
|
|
|
- <FormItem className="half-item"
|
|
|
- labelCol={{ span: 7 }}
|
|
|
- wrapperCol={{ span: 12 }}
|
|
|
- label="更新时间" >
|
|
|
- <DatePicker placeholder="更新日期" value={moment(this.state.createYear,'YYYY-MM-DD')} onChange={(time) => {this.setState({createYear: time});}}/>
|
|
|
- <TimePicker placeholder="更新时间" value={moment(this.state.creatMent, 'HH:mm:ss')} onChange={(time) => { this.setState({creatMent: time}); }}/>
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
<FormItem wrapperCol={{ span: 12, offset: 7 }}>
|
|
|
<Button className="set-submit" type="primary" htmlType="submit">保存</Button>
|
|
|
<Button className="set-submit" type="ghost" onClick={this.edithandleCancel} style={{marginLeft:'100px'}}>取消</Button>
|