zhengpz
2021-07-29 5f02eb6289bad2b570f403d44c49255240130202
接口对接
4 files modified
1 files added
327 ■■■■ changed files
src/api/securityUnitOperation/securityUnitOperation.js 15 ●●●●● patch | view | raw | blame | history
src/views/home/index.vue 52 ●●●●● patch | view | raw | blame | history
src/views/home/indexEchart.js 111 ●●●●● patch | view | raw | blame | history
src/views/securityUnitOperation/economicAnalysis.vue 140 ●●●●● patch | view | raw | blame | history
src/views/securityUnitOperation/securityEchart.js 9 ●●●●● patch | view | raw | blame | history
src/api/securityUnitOperation/securityUnitOperation.js
New file
@@ -0,0 +1,15 @@
import request from "@/router/axios";
export const getCompanys = (params) => {
    return request({
        url: "/api/information/selectIn",
        method: "post",
        params:params
    });
};
export const selectPCount = (params) => {
    return request({
        url: "/api/information/selectPCount",
        method: "post",
        params:params
    });
};
src/views/home/index.vue
@@ -320,8 +320,8 @@
      value2: "",
      options2: [],
      rightData: {
        poorPerformance: 35,
        qualification: 22,
        poorPerformance: 0,
        qualification: 0,
        socialSecurity: 0,
        noholder: 0,
      },
@@ -360,7 +360,6 @@
      // securityPer().then(res => {
      //   if (res.data.code === 200) {
      //     let data = res.data.data;
      let data = [];
      //   let right1Echart = echarts.init(document.getElementById("right1Echart"));
      //   right1Echart.setOption(optionJs.right1Data(data));
      //   }
@@ -368,13 +367,16 @@
      //   let right2Echart = echarts.init(document.getElementById("right2Echart"));
      //   right2Echart.setOption(optionJs.right2Data(data));
      // selectFj().then((res) => {
      //   if (res.data.code === 200) {
      //     debugger;
      //   }
      // });
      let right3Echart = echarts.init(document.getElementById("right3Echart"));
      right3Echart.setOption(optionJs.right3Data(data));
      selectFj().then((res) => {
        if (res.data.code === 200) {
          let right3Echart = echarts.init(
            document.getElementById("right3Echart")
          );
          right3Echart.setOption(optionJs.right3Data(res.data.data));
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    initMapEchart(data, type) {
      let mapEchart = echarts.init(document.getElementById("map"));
@@ -531,8 +533,8 @@
        if (res.data.code === 200) {
          this.options1 = res.data.data;
          this.options2 = res.data.data;
          this.value1 = this.options1[0].value;
          this.value2 = this.options2[0].value;
          this.value1 = this.options1[0].value || "";
          this.value2 = this.options2[0].value || "";
          // 获取完辖区列表之后再获取具体数据
          this.getNoholderNum();
          this.getNoSocialSecurity();
@@ -548,6 +550,8 @@
      noholderNum({ jurisdiction: this.value2 }).then((res) => {
        if (res.data.code === 200) {
          this.rightData.noholder = res.data.data[0].Count;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
@@ -556,22 +560,30 @@
      noSocialSecurity({ jurisdiction: this.value2 }).then((res) => {
        if (res.data.code === 200) {
          this.rightData.socialSecurity = res.data.data[0].Count;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    // 现实表现差
    getPoorPerformance() {
      // selectBx({ jurisdiction: this.value1 }).then((res) => {
      //   if (res.data.code === 200) {
      //   }
      // });
      selectBx({ jurisdiction: this.value1 }).then((res) => {
        if (res.data.code === 200) {
          this.rightData.poorPerformance = res.data.data[0].count;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    // 资格审查异常
    getQualification() {
      // selectExtype({ jurisdiction: this.value1 }).then((res) => {
      //   if (res.data.code === 200) {
      //   }
      // });
      selectExtype({ jurisdiction: this.value1 }).then((res) => {
        if (res.data.code === 200) {
          this.rightData.qualification = res.data.data[0].count;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    peoWarning() {
      this.getNoholderNum();
src/views/home/indexEchart.js
@@ -358,76 +358,45 @@
}
function right3Data(allData) {
  let data = [
    {
      name: "新建县",
      value: 154
    },
    {
      name: "安义县",
      value: 611
    },
    {
      name: "红谷滩新区",
      value: 400
    },
    {
      name: "西湖区",
      value: 200
    },
    {
      name: "东湖区",
      value: 250
    },
    {
      name: "经开区",
      value: 281
    },
    {
      name: "青云谱区",
      value: 320
    },
    {
      name: "高新区",
      value: 231
    },
    {
      name: "湾里区",
      value: 210
    },
    {
      name: "进贤县",
      value: 187
    },
    {
      name: "青山湖区",
      value: 190
  let data = [];
  let sumValue = 0;
  let legendData = [];
  let datas = allData.sort((a, b) => {
    return b.Count - a.Count
  })
  datas.forEach(item => {
    let obj = {
      name: item.jurname,
      value: item.Count
    }
  ];
    legendData.push(item.jurname)
    sumValue += Number(item.Count)
    data.push(obj)
  })
  // let arrName = getArrayValue(data, "name");
  // let arrValue = getArrayValue(data, "value");
  let sumValue = 1000;
  // let sumValue = 1000;
  // let objData = array2obj(data, "name");
  let optionData = getData(data);
  function getArrayValue(array, key) {
    var key = key || "value";
    var res = [];
    if (array) {
      array.forEach(function (t) {
        res.push(t[key]);
      });
    }
    return res;
  }
  // function getArrayValue(array, key) {
  //   var key = key || "value";
  //   var res = [];
  //   if (array) {
  //     array.forEach(function (t) {
  //       res.push(t[key]);
  //     });
  //   }
  //   return res;
  // }
  function array2obj(array, key) {
    var resObj = {};
    for (var i = 0; i < array.length; i++) {
      resObj[array[i][key]] = array[i];
    }
    return resObj;
  }
  // function array2obj(array, key) {
  //   var resObj = {};
  //   for (var i = 0; i < array.length; i++) {
  //     resObj[array[i][key]] = array[i];
  //   }
  //   return resObj;
  // }
  function getData(data) {
    var res = {
@@ -441,7 +410,7 @@
        clockWise: true,
        z: 2,
        hoverAnimation: false,
        radius: [90 - i * 8 + "%", 85 - i * 8 + "%"],
        radius: [83 - i * 12 + '%', 78 - i * 12 + '%'],
        center: ["30%", "50%"],
        labelLine: {
          show: false
@@ -503,19 +472,7 @@
      //   icon: "circle",
      itemHeight: 10,
      show: true,
      data: [
        "新建县",
        "安义县",
        "红谷滩新区",
        "西湖区",
        "东湖区",
        "经开区",
        "青云谱区",
        "高新区",
        "湾里区",
        "进贤县",
        "青山湖区"
      ],
      data: legendData,
      selectedMode: false,
      textStyle: {
        color: "#fff"
src/views/securityUnitOperation/economicAnalysis.vue
@@ -15,21 +15,31 @@
              >
              </el-option>
            </el-select>
            <el-select class="select1" v-model="value1" placeholder="请选择">
            <el-select
              class="select1"
              v-model="value1"
              placeholder="请选择"
              @change="fenjuChange"
            >
              <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                :key="item.id"
                :label="item.title"
                :value="item.id"
              >
              </el-option>
            </el-select>
            <el-select class="select2" v-model="value2" placeholder="请选择">
            <el-select
              class="select2"
              v-model="value2"
              placeholder="请选择"
              @change="changeCompanys"
            >
              <el-option
                v-for="item in options2"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                :key="item.departmentid"
                :label="item.enterpriseName"
                :value="item.departmentid"
              >
              </el-option>
            </el-select>
@@ -89,74 +99,45 @@
<script>
import * as echarts from "echarts";
import echartJs from "./securityEchart.js";
import { lazyTreeJu } from "../../api/index/index";
import {
  getCompanys,
  selectPCount,
} from "../../api/securityUnitOperation/securityUnitOperation";
export default {
  data() {
    return {
      value1: "1",
      value2: "1",
       value0: "2012",
      value1: "",
      value2: "",
      value0: "2012",
      options0: [
        {
          value: "2012",
          label: "2012年"
          label: "2012年",
        },
        {
          value: "2011",
          label: "2011年"
          label: "2011年",
        },
        {
          value: "2010",
          label: "2010年"
          label: "2010年",
        },
        {
          value: "2009",
          label: "2009年"
          label: "2009年",
        },
        {
          value: "2008",
          label: "2008年"
          label: "2008年",
        },
        {
          value: "2007",
          label: "2007年"
        }
          label: "2007年",
        },
      ],
      options1: [
        {
          value: "1",
          label: "南昌市公安局"
        },
        {
          value: "2",
          label: "东湖分局"
        },
        {
          value: "3",
          label: "西湖分局"
        },
        {
          value: "4",
          label: "青云谱分局"
        },
        {
          value: "5",
          label: "青山湖分局"
        }
      ],
      options2: [
        {
          value: "1",
          label: "江西省永安保安服务有限公司"
        },
        {
          value: "2",
          label: "南昌市赣水保安服务有限公司"
        },
        {
          value: "3",
          label: "江西中业兴达保安服务有限公司"
        }
      ]
      options1: [],
      options2: [],
    };
  },
  methods: {
@@ -168,18 +149,57 @@
        document.getElementById("middleEchart1")
      );
      middleEchart1.setOption(echartJs.economicMiddle(data));
      let middleEchart2 = echarts.init(
        document.getElementById("middleEchart2")
      );
      middleEchart2.setOption(echartJs.economicPieOption(data));
    },
    toEconomicTable() {
      this.$router.push({ path: "/securityUnitOperation/economicTable" });
    }
    },
    getFenju() {
      lazyTreeJu().then((res) => {
        if (res.data.code === 200) {
          this.options1 = res.data.data;
          this.value1 = this.options1[0] ? this.options1[0].id : "";
          this.getCompanys();
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    fenjuChange() {
      this.getCompanys();
    },
    pieChange() {
      let params = {
        jurisdiction: this.value1,
        deptid: this.value2,
      };
      selectPCount(params).then((res) => {
        if (res.data.code === 200) {
          let middleEchart2 = echarts.init(
            document.getElementById("middleEchart2")
          );
          middleEchart2.setOption(echartJs.economicPieOption(res.data.data[0]));
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    getCompanys() {
      getCompanys({ jurisdiction: this.value1 }).then((res) => {
        if (res.data.code === 200) {
          this.options2 = res.data.data;
          this.value2 = this.options2[0] ? this.options2[0].departmentid : "";
          this.pieChange();
        }
      });
    },
    changeCompanys() {
      this.pieChange();
    },
  },
  mounted() {
    this.setEchart();
  }
    this.getFenju();
  },
};
</script>
<style lang="scss" scoped>
src/views/securityUnitOperation/securityEchart.js
@@ -354,9 +354,10 @@
  };
  return option;
}
function economicPieOption() {
function economicPieOption(allData) {
  let title = "总";
  let total = "111";
  let total = Number(allData.PCount) + Number(allData.WPCount);
  let option = {
    title: [
      {
@@ -411,8 +412,8 @@
        type: "pie",
        radius: ["40%", "70%"],
        data: [
          { value: 1048, name: "已派遣人数" },
          { value: 735, name: "未派遣人" }
          { value: allData.PCount, name: "已派遣人数" },
          { value: allData.WPCount, name: "未派遣人" }
        ]
      }
    ]