소스 검색

广西建档立卡查询

dev01 1 년 전
부모
커밋
adbbbad73f

+ 16 - 0
js/admin/povertyInquiry.js

@@ -0,0 +1,16 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import '../../css/base.less';
+
+import TopTab from '../component/manageCenter/topTab.jsx';
+import Footer from '../component/manageCenter/bottom.jsx';
+import Content from '../component/manageCenter/povertyInquiry/content.jsx';
+
+ReactDOM.render(
+    <div className="wrap clearfix">
+        <TopTab active={'povertyInquiry'}/>
+        <Content />
+        <Footer />
+    </div>,
+    document.getElementById('root')
+)

+ 1 - 0
js/component/dataDic.js

@@ -2374,6 +2374,7 @@ module.exports = {
     { value: "平台管理", key: "operate" },
     { value: "渠道管理", key: "channelList" },
     { value: "阿米巴", key: "amiba" },
+    { value: "查询管理", key: "povertyInquiry" }
   ],
   //意向进度
   intentProgress: [

+ 302 - 0
js/component/manageCenter/povertyInquiry/component/gx.jsx

@@ -0,0 +1,302 @@
+import React, { Component } from "react";
+import {
+  Form,
+  Button,
+  message,
+  Spin,
+  Upload,
+  DatePicker,
+  Select,
+  Tabs,
+  Table,
+  Modal,
+} from "antd";
+import $ from "jquery/src/ajax";
+import { ShowModal } from "@/tools";
+import moment from "moment";
+import ShowModalDiv from "@/showModal.jsx";
+import './index.less';
+
+const { TabPane } = Tabs;
+const FormItem = Form.Item;
+const Option = Select.Option;
+const { RangePicker } = DatePicker;
+
+class GxPage extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      type: 0,
+      Loading: false,
+      columns: [
+        {
+          title: "序号",
+          dataIndex: "id",
+          key: "id",
+        },
+        {
+          title: "姓名",
+          dataIndex: "name",
+          key: "name",
+        },
+        {
+          title: "市",
+          dataIndex: "city",
+          key: "city",
+        },
+        {
+          title: "县",
+          dataIndex: "county",
+          key: "county",
+        },
+        {
+          title: "乡镇",
+          dataIndex: "township",
+          key: "township",
+        },
+        {
+          title: "村",
+          dataIndex: "village",
+          key: "village",
+        },
+        {
+          title: "人口数",
+          dataIndex: "peopleSum",
+          key: "peopleSum",
+        },
+        {
+          title: "与户主关系",
+          dataIndex: "relationship",
+          key: "relationship",
+        },
+        {
+          title: "脱贫年度",
+          dataIndex: "povertyYear",
+          key: "povertyYear",
+        },
+      ],
+      dataSource: [],
+      totalcount: 0,
+      effectiveCount: 0,
+      id: "",
+      upLoad: {
+        customRequest: (options) => {
+          this.setState({
+            Loading: true,
+          })
+          let params = new FormData();
+          params.append("file", options.file);
+          $.ajax({
+            method: "post",
+            url: globalConfig.context + "/open/selectPoverty",
+            async: true,
+            cache: false,
+            contentType: false,
+            processData: false,
+            data: params
+          }).done(
+            function (data) {
+              this.setState({
+                Loading: false,
+              })
+              if (data.error.length === 0) {
+                let info = data.data
+                this.setState({
+                  dataSource: info.list,
+                  totalcount: info.totalcount,
+                  effectiveCount: info.effectiveCount,
+                  id: info.id,
+                })
+              } else {
+                message.warning(data.error[0].message);
+              }
+            }.bind(this)
+          ).always(
+            function () {
+              this.setState({
+                Loading: false,
+              });
+            }.bind(this)
+          );
+        },
+        name: "file",
+        action: globalConfig.context + "/api/user/channel/import",
+      },
+    };
+
+    this.exportExec = this.exportExec.bind(this);
+    this.onSwitch = this.onSwitch.bind(this);
+  }
+
+  componentWillMount() {
+
+  }
+
+  // 导出
+  exportExec() {
+    message.config({
+      duration: 20,
+    });
+    let loading = message.loading("下载中...");
+    this.setState({
+      Loading: true,
+    });
+
+    let data = {
+      id: this.state.id,
+      type: this.state.type,
+    };
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/open//selectPovertyById/export",
+      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({
+          Loading: false,
+        });
+      }.bind(this)
+    );
+  }
+
+  // 导出下载
+  download(fileName) {
+    window.location.href =
+      globalConfig.context + "/open/download?fileName=" + fileName;
+  }
+
+  // 下载模板
+  downLoadFile() {
+    window.open(globalConfig.context + '/open/downloadPovertyTemplate')
+  }
+
+  // 有效数据切换
+  onSwitch() {
+    this.setState({
+      Loading: true,
+    });
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/open/selectPovertyById",
+      data: {
+        id: this.state.id,
+        type: this.state.type == 0 ? 1 : 0,
+      },
+      success: function (data) {
+        this.setState({
+          Loading: false,
+        });
+        if (data.error.length === 0) {
+          this.setState({
+            type: this.state.type == 0 ? 1 : 0,
+            dataSource: data.data.list,
+          })
+        } else {
+          message.warning(data.error[0].message);
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          Loading: false,
+        });
+      }.bind(this)
+    );
+  }
+
+
+  render() {
+    const { columns, dataSource, totalcount, effectiveCount, id, type } = this.state;
+    return (
+      <div className="user-content">
+        <ShowModalDiv ShowModal={this.state.showModal} />
+        <div className="content-title" style={{ marginBottom: 10 }}>
+          <span style={{ fontWeight: 900, fontSize: 16 }}>建档立卡脱贫户-批量查询</span>
+        </div>
+        <Tabs defaultActiveKey="1">
+          <TabPane tab="操作" key="1">
+            <div
+              style={{
+                width: "100%",
+                paddingBottom: 10,
+                display: "flex",
+                flexDirection: "row",
+                justifyContent: "space-between",
+              }}
+            >
+              <div
+                style={{
+                  display: "flex"
+
+                }}
+              >
+                <Upload {...this.state.upLoad} disabled={this.state.Loading}>
+                  <Button
+                    type="primary"
+                    onClick={() => {
+
+                    }}
+                    style={{ marginLeft: "10px" }}
+                  >
+                    导入查询数据
+                  </Button>
+                </Upload>
+                <Button
+                  type="primary"
+                  onClick={this.downLoadFile}
+                  style={{ marginLeft: "10px" }}
+                >
+                  下载批量查询模板
+                </Button>
+                <Button
+                  type="primary"
+                  loading={this.state.Loading}
+                  onClick={this.exportExec}
+                  style={{ marginLeft: "10px" }}
+                  disabled={!id}
+                >
+                  导出EXCEL
+                </Button>
+              </div>
+              <div>
+                <span>数据统计:有效数据<span style={{ color: "red" }}>{effectiveCount}</span>条,共<span style={{ color: "red" }}>{totalcount}</span>条数据</span>
+                <Button
+                  type="primary"
+                  onClick={this.onSwitch}
+                  style={{ margin: "0 10px" }}
+                  disabled={!id}
+                >
+                  {type == 0 ? "仅显示有效数据" : "显示所有数据"}
+                </Button>
+              </div>
+            </div>
+          </TabPane>
+        </Tabs>
+        <div className="patent-table">
+          <Spin spinning={this.state.Loading}>
+            <Table
+              bordered
+              size="middle"
+              columns={columns}
+              dataSource={dataSource}
+            />
+          </Spin>
+        </div>
+      </div>
+    );
+  }
+}
+
+export default GxPage;

+ 3 - 0
js/component/manageCenter/povertyInquiry/component/index.less

@@ -0,0 +1,3 @@
+.ant-upload-list {
+  display: none;
+}

+ 64 - 0
js/component/manageCenter/povertyInquiry/content.jsx

@@ -0,0 +1,64 @@
+import React, { Component } from "react";
+import "../content.less";
+import "./content.less";
+import LeftTab from "../leftTab";
+import { getMenu } from "../publicMenu.js";
+
+class Content extends Component {
+  constructor() {
+    super();
+    this.state = {
+      loading: false,
+      component: <div></div>,
+    };
+  }
+  componentWillMount() {
+    var ids = window.location.href.indexOf("rid=");
+    var idk = window.location.href.substr(ids + 4);
+    var rid = idk.split("#");
+    let menu = getMenu(rid);
+    let curry;
+    if (menu[0].subMenus.length > 0) {
+      curry = menu[0].subMenus[0].url.split("#");
+    } else {
+      curry = menu[0].url.split("#");
+    }
+    if (window.location.hash) {
+      this.getKey(window.location.hash.substr(1));
+    } else {
+      this.getKey(curry[1]);
+    }
+  }
+  getKey(key) {
+    switch (key) {
+      //广西查询
+      case "gxQuery":
+        require.ensure([], () => {
+          const GxPage = require("./component/gx").default;
+          this.setState({
+            component: <GxPage />,
+          });
+        });
+        break;
+      //空白
+      default:
+        require.ensure([], () => {
+          const Module = require("../module").default;
+          this.setState({
+            component: <Module />,
+          });
+        });
+    }
+    window.location.hash = key;
+  }
+  render() {
+    return (
+      <div className="manage-content">
+        <LeftTab handlekey={this.getKey.bind(this)} />
+        <div className="content-right">{this.state.component}</div>
+      </div>
+    );
+  }
+}
+
+export default Content;

+ 102 - 0
js/component/manageCenter/povertyInquiry/content.less

@@ -0,0 +1,102 @@
+.user-content {
+    background: #fff;
+    padding: 20px;
+    .content-title {
+        color: #333;
+        font-size: 16px;
+    }
+    .user-search {
+        margin: 10px 0;
+        >input {
+            width: 140px;
+        }
+        >input,
+        >button,
+        .ant-select {
+            margin-top: 10px;
+            margin-right: 10px;
+        }
+        .ant-switch {
+            margin-left: 10px;
+        }
+        .search-more {
+            margin: 10px 0;
+        }
+        .search-div {
+            display: inline-block;
+            margin-top: 10px;
+            margin-right: 10px;
+        }
+    }
+}
+
+.ant-modal-body {
+    .modal-box {
+        overflow: hidden;
+        line-height: 28px;
+        margin-bottom: 10px;
+        .modal-box-title {
+            float: left;
+            width: 84px;
+            text-align: right;
+            margin-right: 20px;
+        }
+        .modal-box-detail {
+            float: left;
+            width: 400px;
+            >span {
+                margin-right: 6px;
+            }
+        }
+        >button {
+            margin-right: 20px;
+        }
+    }
+}
+
+.no-all-select {
+    .ant-table-selection {
+        .ant-checkbox {
+            display: none;
+        }
+    }
+}
+.addButton{float: right;margin-right: 50px!important;}
+
+.tip{
+	color: red;
+	font-size: 12px;
+}
+.division{
+	margin: 0 auto;
+	margin-top: 25px;
+	width: 80%;
+}
+
+.fa{
+	display: flex;
+	justify-content: space-around;
+}
+
+// .ant-upload-select{
+// 	vertical-align: top;
+// }
+
+.ant-upload.ant-upload-select{
+	vertical-align: top;
+}
+
+.ant-upload-list-item{
+	font-size: 14px;
+}
+.ant-modal-close-x {
+    display: block;
+    font-style: normal;
+    text-align: center;
+    text-transform: none;
+    text-rendering: auto;
+    width: 22px;
+    height: 23px;
+    line-height: 28px;
+    font-size: 21px;
+}

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.2.82",
+  "version": "1.2.83",
   "description": "",
   "main": "index.js",
   "scripts": {

+ 6 - 0
webpack.config.js

@@ -270,6 +270,12 @@ module.exports = (function () {
             chunks: ['admin/channelList', 'vendors'],
         }),
         new HtmlWebpackPlugin({
+          title: '管理员-查询管理',
+          filename: 'admin/povertyInquiry.html',
+          template: './template/template.html',
+          chunks: ['admin/povertyInquiry', 'vendors'],
+      }),
+        new HtmlWebpackPlugin({
             title: '管理员-平台管理',
             filename: 'admin/operate.html',
             template: './template/template.html',

+ 6 - 0
webpack/entry.config.js

@@ -37,6 +37,7 @@ module.exports = {
     "admin/legalAffairs": "./js/admin/legalAffairs.js",
     "admin/channelList": "./js/admin/channelList.js",
     "admin/amiba": "./js/admin/amiba.js",
+    "admin/povertyInquiry": "./js/admin/povertyInquiry.js",
     "admin/achievement": "./js/admin/achievement.js",
     "admin/customer": "./js/admin/customer.js",
     //admin/userOrder
@@ -155,6 +156,11 @@ module.exports = {
       "webpack/hot/only-dev-server",
       "./js/admin/amiba.js",
     ],
+    "admin/povertyInquiry": [
+      "webpack-dev-server/client?http://127.0.0.1:80", // WebpackDevServer host and port
+      "webpack/hot/only-dev-server",
+      "./js/admin/povertyInquiry.js",
+    ],
     "admin/achievement": [
       "webpack-dev-server/client?http://127.0.0.1:80", // WebpackDevServer host and port
       "webpack/hot/only-dev-server",