diff --git a/src/pages/home/branch/manage/industry/branch/analysisDetails.js b/src/pages/home/branch/manage/industry/branch/analysisDetails.js index b3568f3..46d8330 100644 --- a/src/pages/home/branch/manage/industry/branch/analysisDetails.js +++ b/src/pages/home/branch/manage/industry/branch/analysisDetails.js @@ -24,7 +24,7 @@ class AnalysisDetails extends Component { api.post("/admin/manage/industry/get_primary_industry_data", { 行业: this.props.value }) .then(res => { this.setState({ - data: res + data: res.result }) }).catch(err => { console.log(err) diff --git a/src/pages/home/branch/manage/industry/branch/data.js b/src/pages/home/branch/manage/industry/branch/data.js index a002df3..1377fd6 100644 --- a/src/pages/home/branch/manage/industry/branch/data.js +++ b/src/pages/home/branch/manage/industry/branch/data.js @@ -4,6 +4,11 @@ import api from "@/api/request" import FeTable from "@/components/table" import { UploadOutlined } from '@ant-design/icons'; +var status = { + name: '', + sort: '' +} + class IndustryData extends Component { constructor(props) { super(props) @@ -11,31 +16,36 @@ class IndustryData extends Component { data: [], columns: [], MacroDataVisible: false, + total: 0, + form: { + search: {}, + sort: {}, + page_no: 1, + page_size: 10 + }, } } componentDidMount() { - this.onSearch("") + this.init() } - onSearch = (value) => { - api.post("/admin/macro/search_macro_data", { - "一级行业": value['一级行业'], - "skip": 1, - "limit": 10 - }).then(res => { + init = () => { + api.post("/admin/macro/search_macro_data", this.state.form).then(res => { if (res.result.total !== 0) { this.setState({ - data: res.result.data, - columns: Object.keys(res.result.data[0]).map((key, i) => { + total: res.result.total, + data: res.result.records, + columns: Object.keys(res.result.records[0]).map((key, i) => { return key === "数据" || key === "数据单位" ? { - title: key+"(回车修改)", + title: key + "(回车修改)", dataIndex: key, key: i, align: 'center', - render: (record) => , + sorter: (a, b, c) => { this.sort(c, key) }, defaultSortOrder: 'descend', + render: (record) => , } : { - title: key, dataIndex: key, align: 'center', key: i + title: key, dataIndex: key, align: 'center', key: i,sorter: (a, b, c) => { this.sort(c, key) }, defaultSortOrder: 'descend', } }) }) @@ -50,6 +60,39 @@ class IndustryData extends Component { }) } + + onSearch = (value) => { + const search = { search: {}, page_no: 1 } + value && Object.keys(value).forEach(key => { + if (value[key] && value[key].length !== 0) { + search.search[key] = value[key] + } + }) + this.setState({ + form: Object.assign(this.state.form, search) + }, () => { + this.init() + }) + } + + sort = (c, item, search) => { + if (status.name === item && status.sort === c) { + return false + } else { + status = { + name: item, + sort: c + } + this.setState({ + form: Object.assign(this.state.form, { + sort: { [item]: c === 'ascend' ? 'asc' : 'desc' } + }) + }, () => { + this.onSearch() + }) + } + } + macroDataForm = React.createRef() setMacroDataVisible = () => { @@ -69,6 +112,7 @@ class IndustryData extends Component { api.post("/admin/macro/upload_macro_data", form) .then(res => { message.success(res.info) + this.init() }).catch(err => { console.log(err) }) @@ -76,17 +120,38 @@ class IndustryData extends Component { editValue = {} - callback(value) { + callback(e,value) { this.editValue = value } - onEdit(key,e){ + onEdit(key, e) { this.editValue[key] = e.target.value - api.post("/admin/macro/edit_macro_data",this.editValue).then(res=>{ + api.post("/admin/macro/edit_macro_data", this.editValue).then(res => { message.success(res.info) }) } + pageChange = (current, pageSize) => { + this.setState({ + form: Object.assign(this.state.form, { + page_no: current, + page_size: pageSize + }) + }, () => { + this.init() + }) + } + + onShowSizeChange = (current, pageSize) => { + this.setState({ + form: Object.assign(this.state.form, { + page_no: current, + page_size: pageSize + }) + }, () => { + this.init() + }) + } render() { return ( @@ -143,11 +208,9 @@ class IndustryData extends Component { > 上传宏观数据 - - - + ) } diff --git a/src/pages/home/branch/manage/industry/branch/report.js b/src/pages/home/branch/manage/industry/branch/report.js index 8df1ab6..69e8852 100644 --- a/src/pages/home/branch/manage/industry/branch/report.js +++ b/src/pages/home/branch/manage/industry/branch/report.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Row, Input, Button, Form, Upload, Modal, notification, Space } from "antd"; +import { Row, Input, Button, Form, Upload, Modal, notification, Space, message } from "antd"; import api from "@/api/request" import FeTable from "@/components/table" import { UploadOutlined} from '@ant-design/icons'; @@ -19,22 +19,20 @@ class IndustryReport extends Component { macroFileForm = React.createRef() - componentDidMount() { - this.onSearch({industry:"",time:""}) - } + componentDidMount() {} onSearch = (value) => { api.post("/admin/macro/search_macroscopic_report", { "industry": value.industry, - "time": value.time, - "skip": 1, - "limit": 10 + // "time": value.time, + // "skip": 1, + // "limit": 10 }).then(res => { if (res.result.total !== 0) { this.setState({ - data: res.result.data, - columns: Object.keys(res.result.data[0]).map((key, i) => { + data: res.result, + columns: Object.keys(res.result[0]).map((key, i) => { return key === "报告fid" ? { title: key, dataIndex: key, @@ -45,6 +43,8 @@ class IndustryReport extends Component { title: key, dataIndex: key, align: 'center', key: i } }) + },()=>{ + message.info(res.info) }) } else { this.setState({ diff --git a/src/pages/home/branch/modal/threshold.js b/src/pages/home/branch/modal/threshold.js index 3ae685f..9e28223 100644 --- a/src/pages/home/branch/modal/threshold.js +++ b/src/pages/home/branch/modal/threshold.js @@ -51,6 +51,8 @@ class Threshold extends Component { .then(res => { this.setState({ questionnaire: res.data?res.data:{} + },()=>{ + message.info(res.info) }) }) .catch((err)=>{