import React from 'react';
import $ from 'jquery/src/ajax';
import '../content.less';
import { citySelect,areaSelect,provinceSelect} from '../../../NewDicProvinceListAll';
import { Form,Radio, Icon, Button, Input,Tabs, Select, Spin, Table, Switch, message, DatePicker, Modal,Popconfirm,Cascader } from 'antd';
import {conditionOrganization,gameState} from '../../../dataDic.js';
import {getCategoryState,getGameState,splitUrl,getprovince} from '../../../tools.js';
import ImgList from "../../../common/imgList";
import {ChooseList} from "../../order/orderNew/chooseList";
const TabPane = Tabs.TabPane;
const RadioGroup = Radio.Group;
//图片组件
const PicturesWall = React.createClass({
getInitialState() {
return {
previewVisible: false,
previewImage: '',
fileList: [],
}
},
handleCancel() {
this.setState({ previewVisible: false })
},
handlePreview(file) {
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
});
},
handleChange(info) {
let fileList = info.fileList;
this.setState({ fileList });
this.props.fileList(fileList);
},
componentWillReceiveProps(nextProps) {
this.state.fileList = nextProps.pictureUrl;
},
render() {
const { previewVisible, previewImage, fileList } = this.state;
const uploadButton = (
);
return (
{
this.handleChange(infor)
}}
fileList={fileList}
/>
);
}
});
//主体
const BusinessProject=Form.create()(React.createClass({
//搜索功能和初始列表加载
loadData(pageNo, apiUrl) {
this.state.data = [];
this.setState({
loading: true,
ispage:pageNo,
});
let nameText=this.state.SuperArr;
let superText=(this.state.cid)?nameText[parseInt(this.state.cid)].id:"";
let isCountry='';
let pro='';
let city='';
let dis='';
if(this.state.ressSearch==undefined){
}else{
switch(parseInt(this.state.ressSearch.length)){
case 1:pro=this.state.ressSearch[0];break;
case 2:pro=this.state.ressSearch[0];city=this.state.ressSearch[1];break;
case 3:pro=this.state.ressSearch[0];city=this.state.ressSearch[1];dis=this.state.ressSearch[2];break;
}
}
if(pro===0){
isCountry=1;
pro='';
}
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/listProject",
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
bname: this.state.bname, //项目名称
cid: superText, //品类名称
country: isCountry, //是否全国
province: pro, //省
city: city, //市
district: dis, //区
activityFlag: this.state.activityFlag, //活动生效标识
status: this.state.status, //项目状态
type: this.state.type,
},
success: function (data) {
let theArr = [];
if (!data.data || !data.data.list) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
} else {
for (let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
let ProvinceCity = [];
let isCountry = "";
if (thisdata.country == 1) {
isCountry = "全国";
} else {
if (thisdata.city == null || thisdata.city == "") {
isCountry += getprovince(parseInt(thisdata.province));
} else if (
thisdata.district == null ||
thisdata.district == ""
) {
isCountry += getprovince(parseInt(thisdata.province)) + "-";
isCountry += getprovince(parseInt(thisdata.city));
} else {
isCountry += getprovince(parseInt(thisdata.province)) + "-";
isCountry += getprovince(parseInt(thisdata.city)) + "-";
isCountry += getprovince(parseInt(thisdata.district));
}
}
theArr.push({
key: i,
id: thisdata.id, //业务名称
bname: thisdata.bname, //业务名称
cname: thisdata.cname, //业务品类
area: isCountry ? isCountry : ProvinceCity,
price: thisdata.price, //市场价
offset: thisdata.offset, //最低折扣
memberPrice: thisdata.memberPrice, //会员价
activityPrice: thisdata.activityPrice, //活动价
activityFlag: thisdata.activityFlag, //活动生效标识
status: thisdata.status, //项目状态
type: thisdata.type,
arrProvinceCity: ProvinceCity,
});
}
this.state.pagination.current = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
}
this.setState({
dataSource: theArr,
pagination: this.state.pagination,
});
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
//项目规格列表
formatLoadData(pageNo, apiUrl){
this.state.data = [];
this.setState({
loading: true,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/ProjectSize/listProjectSize',
data: {
pageNo: pageNo || 1,
pageSize: this.state.formatPagination.pageSize,
pid:this.state.editId,
},
success: function (data) {
let theArr = [];
if (!data.data || !data.data.list) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for (let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
theArr.push({
key: i,
formatId:thisdata.id,//规格ID
formatPname: thisdata.pname,//规格名称
formatBname: thisdata.bname,//项目品类
formatPrice: thisdata.price,//市场价
formatOffset: thisdata.offset,//最低折扣
formatActivityPrice: thisdata.activityPrice,//活动价
formatActivityFlag:thisdata.activityFlag,//活动生效标识
formatMemberPrice:thisdata.memberPrice,//会员价
formatStatus:thisdata.status,//会员价
});
};
this.state.formatPagination.current = data.data.pageNo;
this.state.formatPagination.total = data.data.totalCount;
};
this.setState({
formatDataSource: theArr,
formatPagination: this.state.formatPagination
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
getInitialState() {
return {
searchMore: true,
selectedRowKeys: [],
selectedRows: [],
loading: false,
orgCodeUrl: [],
companyLogoUrl: [],
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return "共" + total + "条数据";
},
},
formatPagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return "共" + total + "条数据";
},
},
ContactsLists: [
{
title: "业务项目名称",
dataIndex: "formatBname",
key: "formatBname",
},
{
title: "规格名称",
dataIndex: "formatPname",
key: "formatPname",
},
{
title: "市场价",
dataIndex: "formatPrice",
key: "formatPrice",
},
{
title: "最低折扣",
dataIndex: "formatOffset",
key: "formatOffset",
},
{
title: "会员价",
dataIndex: "formatMemberPrice",
key: "formatMemberPrice",
},
{
title: "活动价",
dataIndex: "formatActivityPrice",
key: "formatActivityPrice",
},
{
title: "活动生效标识",
dataIndex: "formatActivityFlag",
key: "formatActivityFlag",
render: (text) => {
return getGameState(text);
},
},
{
title: "状态",
dataIndex: "formatStatus",
key: "formatStatus",
render: (text) => {
return getCategoryState(text.toString());
},
},
],
formatDataSource: [],
columns: [
{
title: "项目名称",
dataIndex: "bname",
key: "bname",
},
{
title: "业务品类",
dataIndex: "cname",
key: "cname",
},
{
title: "业务地区",
dataIndex: "area",
key: "area",
// render: text => { return getprovince(text); }
},
{
title: "市场价",
dataIndex: "price",
key: "price",
},
{
title: "最低折扣",
dataIndex: "offset",
key: "offset",
},
{
title: "会员价",
dataIndex: "memberPrice",
key: "memberPrice",
},
{
title: "活动价",
dataIndex: "activityPrice",
key: "activityPrice",
},
{
title: "活动生效标识",
dataIndex: "activityFlag",
key: "activityFlag",
render: (text) => {
return getGameState(text);
},
},
{
title: "业务状态",
dataIndex: "status",
key: "status",
render: (text) => {
return getCategoryState(text);
},
},
{
title: "项目分类",
dataIndex: "type",
key: "type",
render: (text, record) => {
if (record.type == 0) {
return "通用";
} else if (record.type == 1) {
return "专利";
} else if (record.type == 2) {
return "软著";
} else if (record.type == 3) {
return "审计";
}else if(record.type == 4) {
return "双软"
}else if(record.type == 5) {
return "高新"
}else if(record.type == 6) {
return "商标"
}
},
},
],
dataSource: [],
};
},
componentWillMount() {
this.selectSuperId();
},
//获取上级品类
selectSuperId() {
this.state.data = []
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
data:{
flag:0,
},
success: function (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(var i=0;i{theData.cname}
);
};
this.setState({
SuperArr:thedata,
contactsOption: theArr,
orderStatusOptions:data.data,
});
console.log(theArr);
}.bind(this),
}).always(function () {
this.loadData(this.state.ispage);
this.setState({
loading: false
});
}.bind(this));
},
//编辑部门,保存
edithandleSubmit(e){
e.preventDefault();
let offsetText;
if(this.state.editOffset){
if(this.state.editOffset>10||this.state.editOffset<0){
message.warning('最低折扣请输入0到10之间的数字');
return false;
}else{
offsetText=this.state.editOffset;
}
}
this.props.form.validateFields((err, values) => {
let theorgCodeUrl = [];
if(this.state.orgCodeUrl.length) {
let picArr = [];
this.state.orgCodeUrl.map(function(item) {
if ( item.response && item.response.data && item.response.data.length ){
picArr.push(item.response.data);
}
});
theorgCodeUrl = picArr.join(",");
};
let thecompanyLogoUrl = [];
if(this.state.companyLogoUrl.length) {
let picArr = [];
this.state.companyLogoUrl.map(function(item) {
if ( item.response && item.response.data && item.response.data.length ){
picArr.push(item.response.data);
}
});
thecompanyLogoUrl = picArr.join(",");
};
if(!err) {
this.setState({
loading: true
});
let nameText=this.state.SuperArr
// let num = 0
// nameText.forEach((item,index) => {
// if(item.cname == this.state.editCname) {
// num = index
// }
// })
// let superText=(this.state.editCname.length==1)?nameText[parseInt(this.state.editCname)].id:this.state.editCid;
// let superText=nameText[parseInt(this.state.editCname)].id
let arr = nameText.filter((v,k)=>v.cname === this.state.editCname || String(k) === this.state.editCname)
let superText=arr.length ? arr[0].id:"";
let isCountry=0;
let pro='';
let city='';
let dis='';
if(this.state.ProvinceCity==undefined||this.state.ProvinceCity.length==0){
message.warning('请选择项目有效范围');
this.setState({
loading: false
});
return false;
}else{
switch(parseInt(this.state.ProvinceCity.length)){
case 1:pro=this.state.ProvinceCity[0];break;
case 2:pro=this.state.ProvinceCity[0];city=this.state.ProvinceCity[1];break;
case 3:pro=this.state.ProvinceCity[0];city=this.state.ProvinceCity[1];dis=this.state.ProvinceCity[2];break;
}
}
if(pro==0){
isCountry=1;
pro='';
}
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/ProjectSize/updateProject',
data:{
id:this.state.editId,//项目ID
cid:superText,//项目业务品类
bname:this.state.editName,//业务项目名称
price:this.state.editPrice,//市场价
firstPayment:this.state.firstPayment,//首付金额
offset:offsetText,//最低折扣
activityPrice:this.state.editActivityPrice,//活动价
activityFlag:this.state.editActivityFlag,//活动生效标识
memberPrice:this.state.editMemberPrice,//项目ID
status:this.state.editStatus,//项目状态
patentTransfer: this.state.typeStatus == 1 ? this.state.patentTransfer : undefined,
type: this.state.typeStatus,//项目分类
country:isCountry,//是否全国
province:pro?pro:'',//省
city:city?city:'',//市
district:dis?dis:'',//区
minLogo:theorgCodeUrl,
maxLogo:thecompanyLogoUrl,
introduce:this.state.editIntroduce,//项目介绍
projectUrl:this.state.editProjectUrl,//项目地址
valueEffect:this.state.editValueEffect,//项目价值及作用
clientSize:this.state.editClientSize,//项目基本条件
boutique:this.state.editBoutique,
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.edithandleCancel();
this.selectSuperId();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
}
})
},
//规格列表整行点击
formatTableRowClick(record, index){
this.editformatClick();
this.state.RowData = record;
this.setState({
selectedRowKeys:[],
formatId:record.formatId,//规格名称
formatPname:record.formatPname,//规格名称
formatPrice:record.formatPrice,//市场价
formatOffset:record.formatOffset,//最低折扣
formatActivityPrice:record.formatActivityPrice,//活动价
formatActivityFlag:record.formatActivityFlag,//活动生效标识
formatMemberPrice:record.formatMemberPrice,//会员价
formatStatus:record.formatStatus.toString(),//项目状态
});
},
//项目列表整行点击
tableRowClick(record, index) {
this.selectSuperId();
this.state.RowData = record;
this.setState({
callnub:'1',
editvisible: true,
selectedRowKeys:[],
rowId:record.businessId,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context +"/api/admin/ProjectSize/orgProject" ,
data: {
id: record.id
},
success: function (data) {
let theArr = [];
let ProvinceCity=[];
let thisdata = data.data;
if (!data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
if(thisdata.country==1){
ProvinceCity.push(0);
}else{
ProvinceCity.push(parseInt(thisdata.province));
ProvinceCity.push(parseInt(thisdata.city));
ProvinceCity.push(parseInt(thisdata.district));
}
let str = ""
if(thisdata.type == 0) {
str = "通用"
}else if(thisdata.type == 1) {
str = "专利"
}else if(thisdata.type == 2) {
str = "软著"
}else if(thisdata.type == 3) {
str = "审计"
}else if(thisdata.type == 4) {
str = "双软"
}else if(thisdata.type == 5) {
str = "高新"
}else if(thisdata.type == 6) {
str = "商标"
}
theArr.push({
editId: thisdata.id,//每一条记录的ID
editName:thisdata.bname,//项目名称
editCname: thisdata.cname,//项目分类
editCid: thisdata.cid,//项目分类
editCountry: thisdata.country,//是否全国
editProvince: thisdata.province,//省
editCity: thisdata.city,//市
editDistrict: thisdata.district,//区
editPrice: thisdata.price,//市场价
firstPayment:thisdata.firstPayment,//首付金额
editActivityPrice: thisdata.activityPrice,//活动价
editOffset: thisdata.offset,//最低折扣
editMemberPrice: thisdata.memberPrice,//会员价
editActivityFlag:thisdata.activityFlag,//活动生效标识
editStatus:thisdata.status,//品类状态
patentTransfer: thisdata.patentTransfer ? 1 : 0,
typeStr: str,
typeStatus: thisdata.type,
editCreateId:thisdata.createName,//创建人
editTime:thisdata.createTimeFormattedDate,//创建时间
editIntroduce:thisdata.introduce,//服务内容
editProjectUrl:thisdata.projectUrl,//项目地址
editValueEffect:thisdata.valueEffect,//价值及作用
editClientSize:thisdata.clientSize,//基本条件
editBoutique:thisdata.boutique,//是否精品
orgCodeUrl: thisdata.minLogo ? splitUrl(thisdata.minLogo, ',', globalConfig.avatarHost + '/upload') : [],
cditCompanyLogoUrl: thisdata.maxLogo ? splitUrl(thisdata.maxLogo, ',', globalConfig.avatarHost + '/upload') : [],
});
};
//0 正常 1专利 2软著 3审计 4双软 5高新 6商标
let str = ""
if(thisdata.type == 0) {
str = "通用"
}else if(thisdata.type == 1) {
str = "专利"
}else if(thisdata.type == 2) {
str = "软著"
}else if(thisdata.type == 3) {
str = "审计"
}else if(thisdata.type == 4) {
str = "双软"
}else if(thisdata.type == 5) {
str = "高新"
}else if(thisdata.type == 6) {
str = "商标"
}
this.setState({
editId: thisdata.id, //每一条记录的ID
editName: thisdata.bname, //项目名称
editCname: thisdata.cname, //项目分类
editCid: thisdata.cid, //项目分类
editCountry: thisdata.country, //是否全国
editProvince: thisdata.province, //省
editCity: thisdata.city, //市
editDistrict: thisdata.district, //区
editPrice: thisdata.price, //市场价
firstPayment: thisdata.firstPayment,
editActivityPrice: thisdata.activityPrice, //活动价
editOffset: thisdata.offset, //最低折扣
editMemberPrice: thisdata.memberPrice, //会员价
editActivityFlag: thisdata.activityFlag, //活动生效标识
editStatus: thisdata.status, //品类状态
patentTransfer: thisdata.patentTransfer ? 1 : 0,
typeStr: str,
typeStatus: thisdata.type,
editCreateId: thisdata.createName, //创建人
editTime: thisdata.createTimeFormattedDate, //创建时间
editIntroduce: thisdata.introduce, //服务内容
editProjectUrl: thisdata.projectUrl, //项目地址
editValueEffect: thisdata.valueEffect, //价值及作用
editClientSize: thisdata.clientSize, //基本条件
editBoutique: thisdata.boutique, //是否精品
orgCodeUrl: thisdata.minLogo
? splitUrl(
thisdata.minLogo,
",",
globalConfig.avatarHost + "/upload"
)
: [],
companyLogoUrl: thisdata.maxLogo
? splitUrl(
thisdata.maxLogo,
",",
globalConfig.avatarHost + "/upload"
)
: [],
editDataSource: theArr,
ProvinceCity: ProvinceCity
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//左侧图片地址
getOrgCodeUrl(e) {
this.setState({ orgCodeUrl: e });
},
//右侧图片地址
getCompanyLogoUrl(e) {
this.setState({ companyLogoUrl: e });
},
//编辑一个规格,保存
editformathandleSubmit(e){
e.preventDefault();
let offsetText;
if(this.state.formatOffset){
if(this.state.formatOffset>10||this.state.formatOffset<0){
message.warning('最低折扣请输入0到10之间的数字');
return false;
}else{
offsetText=this.state.formatOffset;
}
}
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/ProjectSize/orgProjectSize',
data:{
id:this.state.formatId,//项目ID
pname:this.state.formatPname,//规格名称
price:this.state.formatPrice,//市场价
offset:offsetText,//最低折扣
activityPrice:this.state.formatActivityPrice,//活动价
activityFlag:this.state.formatActivityFlag,//活动生效标识
memberPrice:this.state.formatMemberPrice,//会员价
status:this.state.formatStatus,//项目状态
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('修改规格成功!');
this.formatLoadData();
this.editformathandleCancel();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
}
});
},
//新增一个规格,保存
formathandleSubmit(e){
e.preventDefault();
let offsetText;
if(this.state.formatOffset){
if(this.state.formatOffset>10||this.state.formatOffset<0){
message.warning('最低折扣请输入0到10之间的数字');
return false;
}else{
offsetText=this.state.formatOffset;
}
}
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/ProjectSize/addProjectSize',
data:{
pid:this.state.editId,//项目ID
pname:this.state.formatPname,//规格名称
price:this.state.formatPrice,//市场价
offset:offsetText,//最低折扣
activityPrice:this.state.formatActivityPrice,//活动价
activityFlag:this.state.formatActivityFlag,//活动生效标识
memberPrice:this.state.formatMemberPrice,//会员价
status:this.state.formatStatus,//项目状态
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('新增规格成功!');
this.formathandleCancel();
this.formatLoadData();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
}
});
},
//新增一个项目,保存
addhandleSubmit(e){
e.preventDefault();
if(!this.state.categoryName){
message.warning('请输入项目名称');
return false;
}
if(!this.state.addCid){
message.warning('请选择项目品类');
return false;
}
let isCountry=0;
let pro='';
let city='';
let dis='';
if(this.state.ProvinceCity==undefined){
message.warning('请选择项目有效范围');
return false;
}else{
switch(parseInt(this.state.ProvinceCity.length)){
case 1:pro=this.state.ProvinceCity[0];break;
case 2:pro=this.state.ProvinceCity[0];city=this.state.ProvinceCity[1];break;
case 3:pro=this.state.ProvinceCity[0];city=this.state.ProvinceCity[1];dis=this.state.ProvinceCity[2];break;
}
}
if(pro==0){
isCountry=1;
pro='';
}
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
//上级组织字典
let nameText=this.state.SuperArr;
let superText=nameText[parseInt(this.state.addCid)].id;
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/ProjectSize/addProject',
data:{
bname:this.state.categoryName,//项目名称
cid:superText,//品类类ID
boutique:this.state.boutique?this.state.boutique:'0',
country:isCountry,//是否全国
province:pro,//省
city:city,//市
district:dis,//区
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('新增项目成功!');
this.handleCancel();
this.selectSuperId();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
}
});
},
//项目整行删除
delectRow() {
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 + "/api/admin/ProjectSize/deleteProject",
data: {
id:deletedIds
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.selectSuperId();
}.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 + "/api/admin/ProjectSize/stopProject",
data: {
id:deletedIds
}
}).done(function (data) {
if (!data.error.length) {
message.success('该项目已成功停用!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.selectSuperId();
}.bind(this));
},
//规格整行删除
delectRowSize() {
let deletedIds = '';
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.formatId) {
deletedIds=rowItem.formatId;
};
};
this.setState({
selectedRowKeys: [],
loading: deletedIds.length > 0
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/deleteProjectSize",
data: {
id: deletedIds
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.formatLoadData();
}.bind(this));
},
//规格整行停用
blockRowSize() {
let deletedIds = '';
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.formatId) {
deletedIds=rowItem.formatId;
};
};
this.setState({
selectedRowKeys: [],
loading: deletedIds.length > 0
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/stopProjectSize",
data: {
id: deletedIds
}
}).done(function (data) {
if (!data.error.length) {
message.success('该项目已成功停用!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.formatLoadData();
}.bind(this));
},
addClick() {
this.state.RowData = {};
this.setState({
visible: true
});
this.addReset();
},
editClick(e) {
this.state.RowData = {};
this.setState({
editvisible: true
});
},
formatClick(e) {
this.formatReset();
this.state.RowData = {};
this.setState({
formatvisible: true
});
},
editformatClick(e) {
this.state.RowData = {};
this.setState({
editformatvisible: true
});
},
handleCancel() {
this.setState({ visible: false })
},
edithandleCancel(e) {
this.setState({
editvisible: false
});
},
formathandleCancel(e) {
this.setState({
formatvisible: false
});
},
editformathandleCancel(e) {
this.setState({
editformatvisible: false
});
},
search() {
this.loadData();
},
//搜索部分的清零
reset() {
this.state.bname = '';//项目名称清零
this.state.cid = undefined;//品类名称清零
this.state.ressSearch= undefined;//省市区清零
this.state.activityFlag = undefined;//活动生效清零
this.state.status = undefined;//项目状态清零
this.state.type = undefined;//项目分类清零
this.loadData();
},
//新增部分的清零
addReset(){
this.state.categoryName='';//项目名称清零
this.state.ProvinceCity=undefined;
this.state.addCid=undefined;
this.state.boutique='';
},
//规格新增清零
formatReset() {
this.state.formatPname = '';//规格名称清零
this.state.formatPrice = '';//市场价清零
this.state.formatOffset = '';//最低折扣清零
this.state.formatActivityPrice = '';//活动价清零
this.state.formatMemberPrice = '';//会员价清零
this.state.formatActivityFlag = undefined;//活动生效标识清零
this.state.formatStatus= undefined;//项目状态清零
this.formatLoadData();
},
//详情tab切换数据处理
callback(e) {
this.setState({
callnub: e,
})
if(e == 1) {
}
if(e == 2) {
this.formatLoadData();
}
},
//更多搜索的显示与否
searchSwitch() {
this.setState({
searchMore: !this.state.searchMore
});
},
changeList(arr) {
const newArr = [];
this.state.columns.forEach(item => {
arr.forEach(val => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr
});
},
render() {
const FormItem = Form.Item
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
}
};
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
const { getFieldDecorator } = this.props.form;
const hasSelected = this.state.selectedRowKeys.length > 0;
const { RangePicker } = DatePicker;
return (
);
}
}));
export default BusinessProject;