import React from 'react';
import ReactDom from 'react-dom';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import '../content.less';
import { citySelect } from '../../../NewDicProvinceList';
import {
getNewDiccityArr,
} from "@/tools.js";
import { Form, Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload, Popconfirm, AutoComplete, Tabs, Tag } from 'antd';
import { patternOrganization, conditionOrganization } from '../../../dataDic.js';
import { getPattern, getCondition } from '../../../tools.js';
import { ChooseList } from "../../order/orderNew/chooseList";
import StaffSearch from '../../../../component/common/staffSearch';
const confirm = Modal.confirm;
const { TabPane } = Tabs
const Organization = Form.create()(React.createClass({
loadData(pageNo) {
this.state.data = [];
this.setState({
loading: true,
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/organization/listOrganizationManagement',
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
name: this.state.name, //组织名称
superId: this.state.superId,//上级组织
type: this.state.type,//组织类型
depNo: this.state.depNo1,//组织编号
},
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,
id: thisdata.id,//每一条记录的ID
depNo: thisdata.depNo,//组织编号
name: thisdata.name,//组织名称
type: thisdata.type,//组织类型
managerId: thisdata.managerName,//负责人
superId: thisdata.superName,//上级组织
status: thisdata.status,//组织状态
workingHoursName: thisdata.workingHoursName,
hideSign: thisdata.hideSign,//显示标识
approval: thisdata.approval,
});
};
this.state.pagination.current = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
this.setState({
dataSource: theArr,
page: data.data.pageNo,
pagination: this.state.pagination
});
};
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
getInitialState() {
return {
approval: 1,
editvisible: false,
workingHoursType: 0,
searchMore: true,
selectedRowKeys: [],
selectedRows: [],
loading: false,
workTimeList: [],
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return '共' + total + '条数据';
}
},
columns: [
{
title: '组织编号',
dataIndex: 'depNo',
key: 'depNo',
}, {
title: '组织名称',
dataIndex: 'name',
key: 'name',
}, {
title: '负责人',
dataIndex: 'managerId',
key: 'managerId',
}, {
title: '组织类型',
dataIndex: 'type',
key: 'type',
render: text => { return getPattern(text) }
}, {
title: '上级组织',
dataIndex: 'superId',
key: 'superId',
}, {
title: '组织状态',
dataIndex: 'status',
key: 'status',
render: text => { return getCondition(text) }
}, {
title: '作息时间类型',
dataIndex: 'workingHoursName',
key: 'workingHoursName',
}, {
title: '显示标识',
dataIndex: 'hideSign',
key: 'hideSign',
render: text => { return ["不显示", "显示"][text] }
},
],
dataSource: [],
searchTime: [,],
};
},
componentWillMount() {
this.selectSuperId();
this.getWorkTimeList();
},
//获取上级组织
selectSuperId() {
this.state.data = []
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectSuperId",
data: {
hideSign: 2,//查询所有(0不显示 1显示 2所有)
},
success: function (data) {
let theArr = [];
let theId = [];//用于保存上级组织的ID和名称
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 < data.data.length; i++) {
let theData = data.data[i];
theArr.push(
{theData.name}
);
theId.push(
[theData.id, theData.name]
);
};
this.setState({
SuperArr: thedata,
contactsOption: theArr,
theId: theId,
orderStatusOptions: data.data,
});
}.bind(this),
}).always(function () {
this.loadData(this.state.page);
this.setState({
loading: false
});
}.bind(this));
},
//获取作息时间
getWorkTimeList() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/department/workingHours/list",
data: {},
success: function (data) {
if (data.error.length === 0) {
this.setState({
workTimeList: data.data,
});
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//编辑部门,保存
edithandleSubmit(e) {
e.preventDefault();
if (!this.state.depNo) {
message.warning('请填写组织编号');
return
}
//上级组织字典
let nameText = this.state.SuperArr
let superText = this.state.editSuperId;
let upId = this.state.theId;
let oldId = '';
let superOne = this.state.editDataSource[0].editSuperId;
if (superOne == superText) {
for (let j = 0; j < upId.length; j++) {
if (superText == upId[j][1]) {
oldId = upId[j][0]
}
}
};
let remarksText = (this.state.editRemarks) ? this.state.editRemarks : '该组织没有职能说明,请完善!';
let isStatus = this.state.editStatus;
let _this = this;
if (isStatus == 1) {
confirm({
title: '是否要解散该部门?',
onOk() {
if (!(superOne == superText)) {
confirm({
title: '上级组织已修改,是否保存?',
onOk() {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:
globalConfig.context +
"/api/admin/organization/updateOrganization",
data: {
name: _this.state.editName, //组织名称
type: _this.state.editType, //组织类型
managerId: _this.state.theTypes
? _this.state.theTypes
: _this.state.managerIdOrganizationId, //负责人ID
financeId: _this.state.theTypes2
? _this.state.theTypes2
: _this.state.financeId, //负责人ID
approvalAid: _this.state.theTypes1
? _this.state.theTypes1
: _this.state.approvalAid, //审核人ID
retrialFinanceId: _this.state.theTypes3
? _this.state.theTypes3
: _this.state.reviewerId, // 复审人
expenseFinanceId: _this.state.theTypes4
? _this.state.theTypes4
: _this.state.accountrId, // 报销审核人
superId: _this.state.editSuperId, //上级组织
status: _this.state.editStatus, //组织状态
remarks: remarksText, //组织职能说明
id: _this.state.editId, //组织ID
updateOrganization: _this.state.updateOrganization,
abbreviation: _this.state.abbreviation,
workingHoursType: _this.state.workingHoursType,
hideSign: _this.state.hideSign,//显示标识
depNo: _this.state.depNo,//组织编号
approval: _this.state.approval, //是否需要特批审核
expenseRetrialFinanceExamine: _this.state.expenseRetrialFinanceExamine, // 财务复审
ceoExamine: _this.state.ceoExamine, // 董事长审核
cfoExamine: _this.state.cfoExamine, // 财务总监审核
viceCeoExamine: _this.state.viceCeoExamine, // 集团副总审核
cashierExamine: _this.state.cashierExamine, // 出纳审核
techAdminId: _this.state.techAdminId, // 技术总监
operationGuaranteeId: _this.state.operationGuaranteeId, // 运营保障部审核
}
}).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)
);
return false
}
})
} else {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:
globalConfig.context +
"/api/admin/organization/updateOrganization",
data: {
name: _this.state.editName, //组织名称
type: _this.state.editType, //组织类型
managerId: _this.state.theTypes
? _this.state.theTypes
: _this.state.managerIdOrganizationId, //负责人ID
financeId: _this.state.theTypes2
? _this.state.theTypes2
: _this.state.financeId, //负责人ID
approvalAid: _this.state.theTypes1
? _this.state.theTypes1
: _this.state.approvalAid, //审核人ID
retrialFinanceId: _this.state.theTypes3
? _this.state.theTypes3
: _this.state.reviewerId, // 复审人
expenseFinanceId: _this.state.theTypes4
? _this.state.theTypes4
: _this.state.accountrId, // 报销审核人
superId: oldId, //上级组织
status: _this.state.editStatus, //组织状态
remarks: remarksText, //组织职能说明
id: _this.state.editId, //组织ID
abbreviation: _this.state.abbreviation,
workingHoursType: _this.state.workingHoursType,
hideSign: _this.state.hideSign,//显示标识
depNo: _this.state.depNo,//组织编号
approval: _this.state.approval, //是否需要特批审核
expenseRetrialFinanceExamine: _this.state.expenseRetrialFinanceExamine, // 财务复审
ceoExamine: _this.state.ceoExamine, // 董事长审核
cfoExamine: _this.state.cfoExamine, // 财务总监审核
viceCeoExamine: _this.state.viceCeoExamine, // 集团副总审核
cashierExamine: _this.state.cashierExamine, // 出纳审核
techAdminId: _this.state.techAdminId, // 技术总监
operationGuaranteeId: _this.state.operationGuaranteeId, // 运营保障部审核
}
}).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)
);
}
}
})
} else {
if (!(superOne == superText)) {
confirm({
title: '上级组织已修改,是否保存?',
onOk() {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:
globalConfig.context +
"/api/admin/organization/updateOrganization",
data: {
name: _this.state.editName, //组织名称
type: _this.state.editType, //组织类型
managerId: _this.state.theTypes
? _this.state.theTypes
: _this.state.managerIdOrganizationId, //负责人ID
financeId: _this.state.theTypes2
? _this.state.theTypes2
: _this.state.financeId, //负责人ID
approvalAid: _this.state.theTypes1
? _this.state.theTypes1
: _this.state.approvalAid, //审核人ID
retrialFinanceId: _this.state.theTypes3
? _this.state.theTypes3
: _this.state.reviewerId, // 复审人
expenseFinanceId: _this.state.theTypes4
? _this.state.theTypes4
: _this.state.accountrId, // 报销审核人
superId: _this.state.editSuperId, //上级组织
status: _this.state.editStatus, //组织状态
province: _this.state.province,//省份
remarks: remarksText, //组织职能说明
id: _this.state.editId, //组织ID
abbreviation: _this.state.abbreviation,
workingHoursType: _this.state.workingHoursType,
hideSign: _this.state.hideSign,//显示标识
depNo: _this.state.depNo,//组织编号
approval: _this.state.approval, //是否需要特批审核
expenseRetrialFinanceExamine: _this.state.expenseRetrialFinanceExamine, // 财务复审
ceoExamine: _this.state.ceoExamine, // 董事长审核
cfoExamine: _this.state.cfoExamine, // 财务总监审核
viceCeoExamine: _this.state.viceCeoExamine, // 集团副总审核
cashierExamine: _this.state.cashierExamine, // 出纳审核
techAdminId: _this.state.techAdminId, // 技术总监
operationGuaranteeId: _this.state.operationGuaranteeId, // 运营保障部审核
}
}).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)
);
return false
}
})
} else {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:
globalConfig.context +
"/api/admin/organization/updateOrganization",
data: {
name: _this.state.editName, //组织名称
type: _this.state.editType, //组织类型
managerId: _this.state.theTypes
? _this.state.theTypes
: _this.state.managerIdOrganizationId, //负责人ID
financeId: _this.state.theTypes2
? _this.state.theTypes2
: _this.state.financeId, //负责人ID
approvalAid: _this.state.theTypes1
? _this.state.theTypes1
: _this.state.approvalAid, //审核人ID
retrialFinanceId: _this.state.theTypes3
? _this.state.theTypes3
: _this.state.reviewerId, // 复审人
expenseFinanceId: _this.state.theTypes4
? _this.state.theTypes4
: _this.state.accountrId, // 报销审核人
superId: oldId, //上级组织
status: _this.state.editStatus, //组织状态
remarks: remarksText, //组织职能说明
id: _this.state.editId, //组织ID
abbreviation: _this.state.abbreviation,
province: _this.state.province,
workingHoursType: _this.state.workingHoursType,
hideSign: _this.state.hideSign,//显示标识
depNo: _this.state.depNo,//组织编号
approval: _this.state.approval, // 是否需要特批
expenseRetrialFinanceExamine: _this.state.expenseRetrialFinanceExamine, // 财务复审
ceoExamine: _this.state.ceoExamine, // 董事长审核
cfoExamine: _this.state.cfoExamine, // 财务总监审核
viceCeoExamine: _this.state.viceCeoExamine, // 集团副总审核
cashierExamine: _this.state.cashierExamine, // 出纳审核
techAdminId: _this.state.techAdminId, // 技术总监
operationGuaranteeId: _this.state.operationGuaranteeId, // 运营保障部审核
}
}).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)
);
}
}
},
//整行点击
tableRowClick(record, index) {
this.selectSuperId();
this.state.RowData = record;
this.setState({
editvisible: true,
selectedRowKeys: [],
rowId: record.businessId,
})
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectAllById",
data: {
id: record.id
},
success: function (data) {
let theArr = [];
let thisdata = data.data;
if (data.error.length === 0) {
theArr.push({
editId: thisdata.id, //每一条记录的ID
editName: thisdata.name, //组织名称
editManagerId: thisdata.managerId, //负责人
editType: thisdata.type, //组织类型
editStatus: thisdata.status, //组织状态
province: thisdata.province,//省份
editSuperId: thisdata.superId, //上级组织
depNo: thisdata.depNo, //组织编号
editCreateId: thisdata.createId, //创建人
editTime: thisdata.createTime, //创建时间
editRemarks: thisdata.remarks, //组织职能说明
workingHoursType: thisdata.workingHoursType,//作息时间类型
financeId: thisdata.financeId, // 财务负责人
approvalAid: thisdata.approvalAid, // 审核人
reviewerId: thisdata.retrialFinanceId, // 财务复审
reviewerName: thisdata.retrialFinanceName,
accountrId: thisdata.expenseFinanceId, // 报销审核
accountrName: thisdata.expenseFinanceName,
hideSign: thisdata.hideSign,//显示标识
approval: thisdata.approval, // 特批审核
expenseRetrialFinanceExamine: thisdata.expenseRetrialFinanceExamine, //财务复审
expenseRetrialFinanceExamineList: thisdata.expenseRetrialFinanceExamineList,
ceoExamine: thisdata.ceoExamine, //董事长审核
ceoExamineList: thisdata.ceoExamineList,
cfoExamine: thisdata.cfoExamine, //财务总监审核
cfoExamineList: thisdata.cfoExamineList,
viceCeoExamine: thisdata.viceCeoExamine, //集团副总审核
viceCeoExamineList: thisdata.viceCeoExamineList,
cashierExamine: thisdata.cashierExamine, //出纳审核
cashierExamineList: thisdata.cashierExamineList,
techAdminId: thisdata.techAdminId, // 技术总监
techAdminName: thisdata.techAdminName,
operationGuaranteeId: thisdata.operationGuaranteeId, // 运营保障部审核
operationGuaranteeName: thisdata.operationGuaranteeName,
});
this.setState({
editId: thisdata.id, //每一条记录的ID
financeId: thisdata.financeId,
financeName: thisdata.financeName,
approvalAid: thisdata.approvalAid, // 审核人
approvalName: thisdata.approvalName, // 审核人
editName: thisdata.name, //组织名称
managerIdOrganization: thisdata.managerName, //负责人名字
managerIdOrganizationId: thisdata.managerId, //负责人idmanagerName
reviewerId: thisdata.retrialFinanceId, // 财务复审
reviewerName: thisdata.retrialFinanceName,
accountrId: thisdata.expenseFinanceId, // 报销审核
accountrName: thisdata.expenseFinanceName,
editType: thisdata.type, //组织类型
editStatus: thisdata.status, //组织状态
province: thisdata.province, //省份
editSuperId: thisdata.superId, //上级组织
depNo: thisdata.depNo, //组织编号
editCreateId: thisdata.createId, //创建人
editTime: thisdata.createTime, //创建时间
editRemarks: thisdata.remarks, //组织职能说明
workingHoursType: thisdata.workingHoursType,//作息时间类型
editDataSource: theArr,
abbreviation: thisdata.abbreviation,
hideSign: thisdata.hideSign,//显示标识
approval: thisdata.approval, // 特批审核
expenseRetrialFinanceExamine: thisdata.expenseRetrialFinanceExamine, //财务复审
expenseRetrialFinanceExamineList: thisdata.expenseRetrialFinanceExamineList,
ceoExamine: thisdata.ceoExamine, //董事长审核
ceoExamineList: thisdata.ceoExamineList,
cfoExamine: thisdata.cfoExamine, //财务总监审核
cfoExamineList: thisdata.cfoExamineList,
viceCeoExamine: thisdata.viceCeoExamine, //集团副总审核
viceCeoExamineList: thisdata.viceCeoExamineList,
cashierExamine: thisdata.cashierExamine, //出纳审核
cashierExamineList: thisdata.cashierExamineList,
techAdminId: thisdata.techAdminId, // 技术总监
techAdminName: thisdata.techAdminName,
operationGuaranteeId: thisdata.operationGuaranteeId, // 运营保障部审核
operationGuaranteeName: thisdata.operationGuaranteeName,
});
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(function (data) {
this.setState({
loading: false
});
}.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: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/deleteById",
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));
},
//新增一个部门,保存
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.depNo) {
message.warning('请填写组织编号');
return false;
}
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/organization/addOrganization',
data: {
name: this.state.nameOrganization,//组织名称
managerId: this.state.theTypes,//负责人ID
type: this.state.typeOrganization, //组织类型
superId: this.state.upOrganization,//上级组织
remarks: this.state.remarksOrganization,//组织职能说明
workingHoursType: this.state.workingHoursType,//作息时间
hideSign: this.state.hideSign,//显示标识
depNo: this.state.depNo,//组织编号
}
}).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));
}
});
},
//主管初始加载(自动补全)
supervisor(e) {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectName",
data: {
name: 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 () {
this.setState({
loading: false
});
}.bind(this));
},
selectAutosel(value) {
this.setState({
adminName: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
aid: theType
})
},
//上级主管输入框失去焦点是判断客户是否存在
selectAuto(value, options) {
this.setState({
managerIdOrganization: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes: theType
})
},
selectAuto1(value, options) {
this.setState({
approvalAid: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes1: theType
})
},
selectAuto2(value, options) {
this.setState({
financeId: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes2: theType
})
},
selectAuto3(value, options) {
this.setState({
reviewerId: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes3: theType
})
},
selectAuto4(value, options) {
this.setState({
accountrId: value
})
let theType = '';
let contactLists = this.state.customerArr || [];
if (value) {
contactLists.map(function (item) {
if (item.name == value.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes4: theType
})
},
//失去焦点时
blurChange(e) {
let theType = '';
let contactLists = this.state.customerArr || [];
if (e) {
contactLists.map(function (item) {
if (item.name == e.toString()) {
theType = item.id
}
});
} else {
this.setState({
reviewerId: null
})
}
this.setState({
theTypes3: theType,
})
},
httpChangesel(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
adminName: e
})
},
//值改变时请求客户名称
httpChange(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
managerIdOrganization: e
})
},
httpChange1(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
approvalName: e
})
},
httpChange2(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
financeName: e
})
},
httpChange3(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
reviewerName: e
})
},
httpChange4(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
accountrName: e
})
},
addClick() {
this.state.DepN = '';//组织编号
this.state.theTypes = '';
this.state.nameOrganization = '';//组织名称清零
this.state.managerIdOrganization = '';//负责人ID清零
this.state.financeId = "";//负责人ID清零
this.state.financeName = "";//负责人ID清零
this.state.approvalAid = "";//审核人ID清零
this.state.approvalName = "";//审核人清零
this.state.techAdminId = ""; // 技术总监
this.state.techAdminName = "";
this.state.operationGuaranteeId = ""; // 运营保障部审核
this.state.operationGuaranteeName = "";
this.state.reviewerId = "";//复审人
this.state.reviewerName = "";//复审人
this.state.accountrId = "";//报销审核人
this.state.accountrName = "";//报销审核人
this.state.approvalName = ""; //特批审核人
this.state.typeOrganization = undefined; //组织类型清零
this.state.upOrganization = undefined;//上级组织清零
this.state.remarksOrganization = '';//组织职能说明清零
this.state.hideSign = 1;//显示标识默认为1(显示)
this.state.approval = 1;//特批审核 1(需要)
this.state.RowData = {};
this.setState({
workingHoursType: 0,
visible: true
});
this.selectSuperId();
},
editClick() {
this.state.RowData = {};
this.setState({
editvisible: true
});
},
handleCancel() {
this.setState({ visible: false })
},
edithandleCancel() {
this.loadData(this.state.page);
this.setState({ editvisible: false })
},
search() {
this.loadData();
},
//把搜索的部分置零
reset() {
this.state.superId = undefined;//上级组织清零
this.state.name = '';//组织名称清零
this.state.type = undefined;//组织类型清零
this.state.depNo1 = '';//组织编号清零
this.loadData();
},
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
});
},
handleOk() {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/expenseConfig/addDeTails',
data: {
type: this.state.addtype, // 类型
aid: this.state.aid, // 管理员编号
adminName: this.state.adminName, // 管理员名称
depId: this.state.editId, // 部门编号
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('添加成功!');
let list = this.state.addtype == 1
? this.state.expenseRetrialFinanceExamineList : this.state.addtype == 2
? this.state.ceoExamineList : this.state.addtype == 3
? this.state.cfoExamineList : this.state.addtype == 4
? this.state.viceCeoExamineList : this.state.addtype == 5
? this.state.cashierExamineList : []
list.push(data.data)
if (this.state.addtype == 1) {
this.setState({
expenseRetrialFinanceExamineList: list
})
} else if (this.state.addtype == 2) {
this.setState({
ceoExamineList: list
})
} if (this.state.addtype == 3) {
this.setState({
cfoExamineList: list
})
} if (this.state.addtype == 4) {
this.setState({
viceCeoExamineList: list
})
} if (this.state.addtype == 5) {
this.setState({
cashierExamineList: list
})
}
this.handleNo()
} else {
message.warning(data.error[0].message);
}
}.bind(this));
},
handleNo() {
this.setState({
addtype: -1,
aid: "",
adminName: "",
})
},
deleteDeTails(type, dataList, id) {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/expenseConfig/deleteDeTails',
data: {
id, //
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('移除成功!');
let lx = dataList.findIndex(item => item.id === id)
dataList.splice(lx, 1)
if (type == 1) {
this.setState({
expenseRetrialFinanceExamineList: dataList
})
} else if (type == 2) {
this.setState({
ceoExamineList: dataList
})
} if (type == 3) {
this.setState({
cfoExamineList: dataList
})
} if (type == 4) {
this.setState({
viceCeoExamineList: dataList
})
} if (type == 5) {
this.setState({
cashierExamineList: dataList
})
}
} else {
message.warning(data.error[0].message);
}
}.bind(this));
},
render() {
const FormItem = Form.Item
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
},
onSelect: (recordt, selected, selectedRows) => {
this.setState({
recordt: recordt.id
})
},
};
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
const { getFieldDecorator } = this.props.form;
const hasSelected = this.state.selectedRowKeys.length > 0;
const { RangePicker } = DatePicker;
const dataSources = this.state.customerArr || [];
const options = dataSources.map((group, index) =>
)
const options2 = dataSources.map((group, index) =>
)
return (
);
}
}));
export default Organization;