Blame view

src/views/tjfx/bdcdjtjfx/components/qytj.vue 5.51 KB
“miaofang committed
1 2 3 4 5 6 7 8 9
<!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-08-25 08:59:04
-->
<template>
  <div class="djlx">
    <div class="inquire">
      <el-form :model="queryForm" ref="queryForm" label-width="100px">
“miaofang committed
10 11 12
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="收件时间" class="width100">
“miaofang committed
13
              <el-date-picker
“miaofang committed
14 15
                v-model="queryForm.sj"
                type="daterange"
“miaofang committed
16
                class="width100"
“miaofang committed
17 18 19 20 21
                range-separator="至"
                :clearable="false"
                value-format="yyyy-MM-dd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
“miaofang committed
22
              >
“miaofang committed
23
              </el-date-picker>
“miaofang committed
24 25
            </el-form-item>
          </el-col>
“miaofang committed
26
          <el-col :span="11" class="btnColRight">
“miaofang committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
            <el-form-item>
              <el-button
                type="primary"
                native-type="submit"
                @click="handleSearch"
                >查询</el-button
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="concent">
      <div class="left">
        <el-table
          height="187"
          stripe
          :data="tableList"
“miaofang committed
45
           show-summary
“miaofang committed
46 47 48 49 50
          size="mini"
          border
          header-cell-class-name="table-header-gray"
        >
          <el-table-column
“miaofang committed
51
            label="区域"
“miaofang committed
52 53 54 55
            prop="name"
            minWidth="100"
            align="center" />
          <el-table-column
“miaofang committed
56 57
            label="收件数量"
            prop="value"
“miaofang committed
58 59 60 61 62 63 64 65 66 67 68 69
            minWidth="120"
            align="center"
        /></el-table>
      </div>
      <div class="right">
        <div ref="chart" style="width: 100%; height: 200px"></div>
      </div>
    </div>
  </div>
</template>
<script>
import * as echarts from "echarts";
“miaofang committed
70
import { getdatamonth } from "@/utils/util";
赵千 committed
71 72
import { getAcceptAreaStatistic } from "@/api/tjfx.js";
import {mapGetters} from "vuex";
“miaofang committed
73 74
export default {
  components: {},
赵千 committed
75 76 77
  computed: {
    ...mapGetters(["dictData"]),
  },
“miaofang committed
78 79
  data() {
    return {
“miaofang committed
80
      queryForm: {},
“miaofang committed
81
      tableList: [
赵千 committed
82 83 84 85 86
        // { name: "浐灞", value: "2" },
        // { name: "长安", value: "12" },
        // { name: "莲湖", value: "23" },
        // { name: "高新", value: "33" },
        //  { name: "高新", value: "33" },
“miaofang committed
87
      ],
“miaofang committed
88
    };
“miaofang committed
89 90
  },
  mounted() {
“miaofang committed
91
     this.setdata();
“miaofang committed
92
  },
“miaofang committed
93
  methods: {
赵千 committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

    getAcceptAreaStatistic() {
      getAcceptAreaStatistic({
        startDate: this.queryForm.sj[0],
        endDate: this.queryForm.sj[1],
        qxdm: this.queryForm.qy
      }).then(res => {
        if (res.code === 200) {
          this.tableList = []
          let dicList = this.dictData['A20']
          res.result.forEach(it=>{
            const matchingObject = dicList.find(obj => obj.dcode === it.QXDM);
            const qxmc = matchingObject != null ? matchingObject.dname : it.QXDM;
            let obj = {
              name: qxmc,
              value: it.SJCOUNT
            }
            this.tableList.push(obj)
          })
          // 创建一个 ECharts 实例
          this.chart = echarts.init(this.$refs.chart);
          // 在 ECharts 实例中配置图表
          this.chart.setOption(this.getOption());
        }
      })
    },

“miaofang committed
121 122
    getOption() {
      return {
“miaofang committed
123
        title: {
“miaofang committed
124
          text: "区域统计分析",
“miaofang committed
125 126 127 128 129 130
          x: "center",
          textStyle: {
            //主标题文本设置
            fontSize: 12, //大小
          },
        },
“miaofang committed
131 132
        tooltip: {
          trigger: "item",
“miaofang committed
133 134 135 136 137 138 139 140
          formatter: "{a} <br/>{b} : {c}个 ({d}%)",
        },
        grid: {
          top: "4%",
          left: "2%",
          right: "3%",
          bottom: "20%",
          containLabel: true,
“miaofang committed
141 142 143
        },
        series: [
          {
“miaofang committed
144
            name: "统计分析图",
“miaofang committed
145
            type: "pie",
“miaofang committed
146 147 148 149 150 151 152 153
            radius: "70%",
            center: ["50%", "100%"],
            data: this.tableList,
            itemStyle: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
“miaofang committed
154 155
              },
            },
“miaofang committed
156 157 158 159 160 161 162 163 164
            label: {
              normal: {
                formatter: "{c}/个",
                position: "inside", //让文字显示在饼状图里面
                textStyle: {
                  fontSize: 10,
                  color: "#fff",
                },
              },
“miaofang committed
165
            },
“miaofang committed
166
            center: ["50%", "50%"], // 这个属性调整图像的位置!!!!!
“miaofang committed
167 168 169 170
          },
        ],
      };
    },
“miaofang committed
171 172 173
   setdata() {
      this.queryForm.sj = getdatamonth();
      console.log("this.queryForm", this.queryForm);
赵千 committed
174
      this.getAcceptAreaStatistic()
“miaofang committed
175
    },
“miaofang committed
176 177
    handleSearch() {
      console.log(" this.queryForm", this.queryForm);
赵千 committed
178
      this.getAcceptAreaStatistic()
“miaofang committed
179
    },
“miaofang committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
  },
};
</script>
<style scoped lang="scss">
/deep/.el-card__header {
  padding: 8px 10px;
}

/deep/.el-card__body {
  padding: 3px 10px 5px 10px;
  overflow: hidden;
}
.yhjgba {
  .el-col {
    padding: 4px;
“miaofang committed
195
    margin-right: 4px;
“miaofang committed
196 197 198 199
  }
  .inquire {
    width: 100%;
    height: 40px;
“miaofang committed
200 201 202 203 204 205
    background-color: #f4f7fd;
    /deep/ .el-form {
      .el-form-item--small.el-form-item {
        margin-bottom: 5px;
      }
    }
“miaofang committed
206
  }
“miaofang committed
207

“miaofang committed
208 209 210 211
  .concent {
    width: 100%;
    height: 300px;
    display: flex;
“miaofang committed
212 213 214 215
    /deep/.el-table th {
      height: 36px !important;
      font-size: 14px;
      color: #4a4a4a;
“miaofang committed
216
    }
“miaofang committed
217 218 219 220 221 222
    .left {
      width: 70%;
      height: 200px;
    }
    .right {
      width: 30%;
“miaofang committed
223
      height: 300px;
“miaofang committed
224 225 226 227
    }
  }
}
</style>