import React, { Component } from "react";
import {
AutoComplete,
Button,
DatePicker,
Input,
message,
Modal,
Select,
Spin,
Table,
Tabs,
Cascader,
} from "antd";
import { ShowModal, getNewDiccityArr } from "@/tools";
import { citySelect } from "../../../NewDicProvinceList";
import { ChooseList } from "../../order/orderNew/chooseList";
import $ from "jquery/src/ajax";
import moment from "moment";
import {
highTechColumns,
invention,
utilityModel,
softWriting,
otherTrademarks,
currency,
} from "./projecCountConfig";
import HighTech from "./highTech";
import "./index.less";
import Cascaders from "../../../common/cascaders";
const { TabPane } = Tabs;
const { RangePicker } = DatePicker;
const { Option } = Select;
class ProjecCount extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
changeList: undefined,
columns: currency((v, screen) => {
this.openProjectSummary(v, screen);
}),
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return "共" + total + "条数据";
},
},
dataSource: [],
taberReleaseDate: [],
taberProjectType: "",
taberCommodityName: "",
releaseDate: [],
searchOrderNo: "",
searchContractNo: "",
searchEnterpriseName: "",
declarationBatch: "",
projectType: "",
projectStatus: "",
province: "",
depId: "",
departmentArr: [],
contactsOption: [],
contactsOptionData: [],
customerArr: [],
commodityName: "",
kid: "",
status: 0,
searchValues: this.props.searchConfig || {},
};
this.loadData = this.loadData.bind(this);
this.resetAll = this.resetAll.bind(this);
this.changeList = this.changeList.bind(this);
this.departmentList = this.departmentList.bind(this);
this.exportPending = this.exportPending.bind(this);
this.exportExcel = this.exportExcel.bind(this);
this.selectSuperId = this.selectSuperId.bind(this);
this.supervisorCui = this.supervisorCui.bind(this);
this.httpChangeCui = this.httpChangeCui.bind(this);
this.selectAuto = this.selectAuto.bind(this);
this.openProjectSummary = this.openProjectSummary.bind(this);
}
changeList(arr) {
const newArr = [];
this.state.columns.forEach((item) => {
arr.forEach((val) => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr,
});
}
loadData(pageNo) {
this.setState({
page: pageNo,
loading: true,
taberReleaseDate: this.state.releaseDate,
taberProjectType: this.state.projectType,
taberCommodityName: this.state.commodityName,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:
globalConfig.context +
"/api/admin/statistis/selectProvincialStatistics",
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
startDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[0]
: undefined, //开始时间
endDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[1]
: undefined, //结束时间
province: this.state.province || undefined,
projectStatus: this.state.projectStatus || undefined, //项目类别
projectType: !this.state.projectType ? undefined : this.state.projectType, //项目分类
status: this.state.status,
thchDeps: this.state.depId || undefined,
projectId: this.state.kid || undefined,
},
success: function (data) {
ShowModal(this);
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];
thisdata.key = (data.data.pageNo - 1) * data.data.pageSize + i + 1;
theArr.push(thisdata);
}
}
this.state.pagination.current = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
if (data.data && data.data.list && !data.data.list.length) {
this.state.pagination.current = 0;
this.state.pagination.total = 0;
}
this.setState({
dataSource: theArr,
pagination: this.state.pagination,
});
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
}
//部门
departmentList() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectSuperId",
data: {},
success: function (data) {
let thedata = data.data;
let theArr = [];
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
} else {
thedata.map(function (item, index) {
theArr.push({
key: index,
name: item.name,
id: item.id,
});
});
}
this.setState({
departmentArr: theArr,
});
}.bind(this),
});
}
resetAll() {
this.setState(
{
newArray: [],
releaseDate: [],
searchOrderNo: "",
searchContractNo: "",
searchEnterpriseName: "",
declarationBatch: "",
province: "",
depId: "",
projectType: undefined,
projectStatus: "",
columns: currency((v, screen) => {
this.openProjectSummary(v, screen);
}),
commodityName: "",
kid: "",
status: 0,
taberReleaseDate: [],
taberProjectType: "",
taberCommodityName: "",
},
() => {
this.Cascaders.empty();
this.loadData();
}
);
}
exportPending() {
message.config({
duration: 20,
});
let loading = message.loading("下载中...");
this.setState({
exportPendingLoading: true,
});
let option = this.state.contactsOptionData.filter(
(e) => e.value === this.state.projectStatus
); // 项目类别名称
let datas = {
status: this.state.status,
projectStatusName: option.length > 0 ? option[0].label : undefined,
projectName:
this.state.projectType == "0"
? "通用" : this.state.projectType == "1"
? "专利" : this.state.projectType == "2"
? "软著" : this.state.projectType == "3"
? "审计" : this.state.projectType == "4"
? "双软" : this.state.projectType == "5"
? "高新" : this.state.projectType == "6"
? "商标" : this.state.projectType == "7"
? "会员" : "",
provinceName: !!this.state.province ? getNewDiccityArr(this.state.province) : undefined,
startDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[0]
: undefined, //开始时间
endDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[1]
: undefined, //结束时间
thchDeps: this.state.depId || undefined, //责任部门ID
projectStatus: this.state.projectStatus || undefined, //项目类别
projectType: !this.state.projectType ? undefined : this.state.projectType, //项目分类
province: this.state.province || undefined,
projectId: this.state.kid || undefined,
}
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: "/api/admin/statistis/exporProvincialList",
data: datas,
success: function (data) {
if (data.error.length === 0) {
this.download(data.data);
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
loading();
this.setState({
exportPendingLoading: false,
});
}.bind(this)
);
}
// 导出excel
exportExcel() {
message.config({
duration: 20,
});
let loading = message.loading("下载中...");
this.setState({
exportPendingLoading: true,
});
let option = this.state.contactsOptionData.filter(
(v) => v.value === this.state.taberProjectStatus
)[0].label; //项目类别名称
let data = {
pageNo: this.state.pageNo || 1,
pageSize: 9999,
startDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[0]
: undefined, //开始时间
endDate:
this.state.releaseDate.length > 0
? this.state.releaseDate[1]
: undefined, //结束时间
projectType: !this.state.projectType ? undefined : this.state.projectType, //项目分类
// typeof this.state.projectType === "number"
// ? this.state.projectType
// : undefined,
thchDepName: undefined, //咨询师部门名称
projectTypeName:
this.state.projectType == "0"
? "通用"
: this.state.projectType == "1"
? "专利"
: this.state.projectType == "2"
? "软著"
: this.state.projectType == "3"
? "审计"
: this.state.projectType == "4"
? "双软"
: this.state.projectType == "5"
? "高新"
: this.state.projectType == "6"
? "商标"
: this.state.projectType == "7"
? "会员" : "", //项目分类(中文)
projectStatusName: option || undefined, //项目品类(中文)
provinceName: getNewDiccityArr(this.state.taberProvince) || undefined, //省份(中文)
projectId: this.state.kid || undefined,
province: this.state.taberProvince || undefined,
projectStatus: this.state.taberProjectStatus || undefined, //项目类别
thchDeps: this.state.taberdepId || undefined,
status:
this.state.projectType == "4"
? 2
: this.state.projectType == "2"
? 3
: this.state.projectType == "1"
? 4
: this.state.projectType == "5"
? 1
: this.state.contactsOptionData.filter(
(v) => v.value === this.state.taberProjectStatus
).length > 0
? this.state.contactsOptionData.filter(
(v) => v.value === this.state.taberProjectStatus
)[0].label === "高新"
? 1
: 0
: 0,
screen: this.state.screen.toString(), //筛选项 0库存 1派单 2完成 3立项 4抽查 5未通过 6受理 7完结 8授权 9驳回 10下证 11申请 12公示数
};
for (let key in data) {
if (!data[key]) {
delete data[key];
}
}
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: "/api/admin/statistis/exporTaskList",
data,
success: function (data) {
if (data.error.length === 0) {
this.download(data.data);
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
loading();
this.setState({
exportPendingLoading: false,
});
}.bind(this)
);
}
download(fileName) {
window.location.href =
globalConfig.context + "/open/download?fileName=" + fileName;
}
//项目类别
selectSuperId() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
data: {
flag: 0,
},
success: function (data) {
let theArr = [];
let newTheArr = []
let thedata = data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
}
for (let i = 0; i < data.data.length; i++) {
let theData = data.data[i];
theArr.push(