Blame view

src/views/tjfx/bdcdjtjfx/components/djlx.vue 6.45 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
        <el-row :gutter="24">
“miaofang committed
11 12
          <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 22 23
                range-separator="至"
                :clearable="false"
                value-format="yyyy-MM-dd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
“miaofang committed
24 25
            </el-form-item>
          </el-col>
“miaofang committed
26
          <el-col :span="7">
“miaofang committed
27 28 29 30 31
            <el-form-item label="区域" class="width100">
              <el-select
                v-model="queryForm.qy"
                class="width100"
                clearable
“miaofang committed
32
                placeholder="请选择区域"
“miaofang committed
33 34
              >
                <el-option
“miaofang committed
35
                  v-for="item in dictData['A20']"
“miaofang committed
36 37 38 39 40 41 42 43
                  :key="item.dcode"
                  :label="item.dname"
                  :value="item.dcode"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
“miaofang committed
44
          <el-col :span="4" class="btnColRight">
“miaofang committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
            <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
“miaofang committed
60
          class="tableBox"
“miaofang committed
61 62 63
          height="187"
          stripe
          :data="tableList"
“miaofang committed
64
          show-summary
“miaofang committed
65 66 67 68 69
          size="mini"
          border
          header-cell-class-name="table-header-gray"
        >
          <el-table-column
“miaofang committed
70
            label="登记类型"
“miaofang committed
71 72 73 74
            prop="name"
            minWidth="100"
            align="center" />
          <el-table-column
“miaofang committed
75 76
            label="收件数量"
            prop="value"
“miaofang committed
77 78 79 80 81 82 83 84 85 86 87 88
            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";
赵千 committed
89
import { getDjlxStatistic } from "@/api/tjfx.js";
“miaofang committed
90
import { mapGetters } from "vuex";
“miaofang committed
91
import { getdatamonth } from "@/utils/util";
“miaofang committed
92 93 94
export default {
  components: {},
  computed: {
“miaofang committed
95 96
    ...mapGetters(["dictData", "transfer"]),
  },
“miaofang committed
97 98
  data() {
    return {
“miaofang committed
99 100
      queryForm: {
        sj: [],
赵千 committed
101
        qy: ''
“miaofang committed
102
      },
“miaofang committed
103
      tableList: [
赵千 committed
104 105 106 107 108 109 110 111
        // { name: "首次登记", value: "2" },
        // { name: "变更登记", value: "12" },
        // { name: "抵押登记", value: "23" },
        // { name: "转移登记", value: "33" },
        // { name: "预告登记", value: "13" },
        // { name: "注销登记", value: "3" },
        // { name: "查封登记", value: "4" },
        // { name: "其他登记", value: "26" },
“miaofang committed
112
      ],
“miaofang committed
113
    };
“miaofang committed
114 115
  },
  mounted() {
“miaofang committed
116
    this.setdata();
“miaofang committed
117
  },
“miaofang committed
118
  methods: {
赵千 committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    getDjlxStatistic() {
      getDjlxStatistic(
        {
          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['A21']
          res.result.forEach(it=>{
            const matchingObject = dicList.find(obj => obj.dcode === it.DJLX);
            const djlxmc = matchingObject != null ? matchingObject.dname : it.DJLX;
            let obj = {
              name: djlxmc,
              value: it.SJCOUNT
            }
            this.tableList.push(obj)
          })
          // 创建一个 ECharts 实例
          this.chart = echarts.init(this.$refs.chart);
          // 在 ECharts 实例中配置图表
          this.chart.setOption(this.getOption());
        }
      })
    },
“miaofang committed
146 147
    getOption() {
      return {
“miaofang committed
148
        title: {
“miaofang committed
149
          text: "登记类型统计",
“miaofang committed
150 151 152 153 154 155
          x: "center",
          textStyle: {
            //主标题文本设置
            fontSize: 12, //大小
          },
        },
“miaofang committed
156 157
        tooltip: {
          trigger: "item",
“miaofang committed
158 159 160 161 162 163 164 165
          formatter: "{a} <br/>{b} : {c}个 ({d}%)",
        },
        grid: {
          top: "4%",
          left: "2%",
          right: "3%",
          bottom: "20%",
          containLabel: true,
“miaofang committed
166 167 168
        },
        series: [
          {
“miaofang committed
169
            name: "统计分析图",
“miaofang committed
170
            type: "pie",
“miaofang committed
171 172 173 174 175 176 177 178
            radius: "70%",
            center: ["50%", "100%"],
            data: this.tableList,
            itemStyle: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
“miaofang committed
179 180
              },
            },
“miaofang committed
181 182 183 184 185 186 187 188 189
            label: {
              normal: {
                formatter: "{c}/个",
                position: "inside", //让文字显示在饼状图里面
                textStyle: {
                  fontSize: 10,
                  color: "#fff",
                },
              },
“miaofang committed
190
            },
“miaofang committed
191
            center: ["50%", "50%"], // 这个属性调整图像的位置!!!!!
“miaofang committed
192 193 194 195
          },
        ],
      };
    },
“miaofang committed
196 197 198
    setdata() {
      this.queryForm.sj = getdatamonth();
      console.log("this.queryForm", this.queryForm);
赵千 committed
199
      this.getDjlxStatistic()
“miaofang committed
200
    },
“miaofang committed
201

“miaofang committed
202 203
    handleSearch() {
      console.log(" this.queryForm", this.queryForm);
赵千 committed
204
      this.getDjlxStatistic()
“miaofang committed
205
    },
“miaofang committed
206 207 208 209 210 211 212 213 214 215 216 217
  },
};
</script>
<style scoped lang="scss">
/deep/.el-card__header {
  padding: 8px 10px;
}

/deep/.el-card__body {
  padding: 3px 10px 5px 10px;
  overflow: hidden;
}
“miaofang committed
218
.djlx {
“miaofang committed
219 220
  .el-col {
    padding: 4px;
“miaofang committed
221
    margin-right: 4px;
“miaofang committed
222 223 224 225
  }
  .inquire {
    width: 100%;
    height: 40px;
“miaofang committed
226 227 228 229 230 231
    background-color: #f4f7fd;
    /deep/ .el-form {
      .el-form-item--small.el-form-item {
        margin-bottom: 5px;
      }
    }
“miaofang committed
232
  }
“miaofang committed
233

“miaofang committed
234 235 236 237
  .concent {
    width: 100%;
    height: 300px;
    display: flex;
“miaofang committed
238 239
    //调整表头高度
    /deep/.el-table__header {
“miaofang committed
240
      height: 22px !important;
“miaofang committed
241 242
      background-color: salmon;
    }
“miaofang committed
243 244 245 246 247 248
    .left {
      width: 70%;
      height: 200px;
    }
    .right {
      width: 30%;
“miaofang committed
249
      height: 300px;
“miaofang committed
250 251
    }
  }
“miaofang committed
252 253 254 255 256 257 258

    /deep/.el-table th {
      height: 36px !important;
      font-size: 14px;
      color: #4a4a4a;
    }

“miaofang committed
259 260
}
</style>