123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678 |
- <template>
- <borderTemplate titleName="卫片监管" class="wpjg">
- <template v-slot:title>
- <!-- #content="row" -->
- </template>
- <div class="stacontent">
- <div class="item">
- <span class="dlabel">图斑面积:</span>
- <span class="dvalue">{{ (title.tb_mj / 1000).toFixed(2) || 0 }}k㎡</span>
- </div>
- <div class="item cursor" @click="draw_vector">
- <span class="dlabel"> 图斑个数:</span>
- <span class="dvalue">{{ title.tb_num || 0 }}个</span>
- <i style="pointer-events:all" :class="{ 'el-icon-view': true }"></i>
- </div>
- <div class="item">
- <span class="dlabel">违法占地:</span>
- <span class="dvalue">{{ wf_mj_computed }}</span>
- </div>
- <div class="item">
- <span class="dlabel"> 违法率:</span>
- <span class="dvalue">{{ wfl_computed }}</span>
- </div>
- </div>
- <div id="wpjg_echart" v-show="xzqh_flag"></div>
- <div id="wpjg_echart_xzqh" v-show="!xzqh_flag">
- </div>
- </borderTemplate>
- </template>
- <script>
- import borderTemplate from "./borderTemplate.vue";
- //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- import { QueryOne, QueryList } from "../../api/cockpitNew";
- export default {
- components: { borderTemplate },
- data() {
- return {
- sdata: {},
- title: {},
- zData: [],
- active_xzqh: [],
- xData: [],
- xData1: [],//检测板块
- xData2: [],//占用耕地
- xData3: [],//占用永久基本农田
- xData4: [],//违法占地
- xzqh_flag: true
- };
- },
- //监控data中的数据变化
- watch: {},
- methods: {
- draw_vector() {
- store.setViewerFlagb(false);
- store.setToolBarShow(false);
- store.setXzqh_flag(false);
- store.setCockpit_vector({
- title: '卫片监管完成项目',
- word: "年份权属名称",
- tableData: [],
- tablejscType: 'jsc_vpjg_zbmx',
- columns: ['图斑分类', '图斑来源', '图斑编号', '审核调查', '年份权属名称', '时间', '是否核查', '行政区划名称', '面积', '占用基本农田保护面积', '占用耕地面积'],
- })
- },
- switch_xzqh(value) {
- if (value.id == '4602') {
- this.xzqh_flag = true
- } else {
- this.xzqh_flag = false
- }
- this.zData.forEach((res) => {
- if (res.name == value.name) {
- this.active_xzqh = [];
- this.active_xzqh.push((res.tb_mj / 1000).toFixed(2), (res.zygdmj / 1000).toFixed(2), (res.zyjbntmj / 1000).toFixed(2), (res.wf_mj / 1000).toFixed(2),);
- }
- })
- this.init_wpjg_echart_xzqh(this.active_xzqh)
- },
- init_wpjg_echart_xzqh(data) {
- var dom = document.getElementById("wpjg_echart_xzqh");
- var myChart = window.echarts.init(dom);
- let barTopColor = ["#CBB835", "#33C6E2", '#157FFE', '#8F48F0'];
- let barBottomColor = ["#D09311", "#279AB0", '#154AD2', '#670BFF'];
- let option = {
- backgroundColor: 'rgba(0,0,0,0)',
- title: {
- show: false,
- text: '一行动一活动开展情况',
- top: 20,
- left: 'center',
- textStyle: {
- color: '#00eaff',
- fontSize: 18,
- fontWeight: 'normal'
- }
- },
- tooltip: {
- show: false,
- trigger: 'axis',
- formatter: '一行动一活动开展情况<br>{b}:{c}',
- backgroundColor: 'rgba(18, 57, 60, .8)', //设置背景颜色
- textStyle: {
- color: '#fff'
- },
- borderColor: "rgba(18, 57, 60, .8)",
- axisPointer: {
- type: 'shadow',
- shadowStyle: {
- color: 'rgba(0, 11, 34, .4)',
- }
- }
- },
- grid: {
- top: '14%',
- bottom: '1%',
- left: '0%',
- right: '30%',
- containLabel: true
- },
- xAxis: {
- axisTick: {
- show: false
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#1C82C5'
- }
- },
- axisLabel: {
- show: false,
- rotate: 20,
- margin: 30,
- textStyle: {
- fontSize: 14,
- color: '#DEEBFF',
- align: 'center'
- }
- },
- interval: 0
- },
- yAxis: {
- data: ['监测图斑', '占用耕地', '占用永久...', '违法占地'],
- splitLine: {
- show: false,
- lineStyle: {
- color: 'rgba(28, 130, 197, .3)'
- }
- },
- axisTick: {
- show: false
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#1C82C5'
- }
- },
- axisLabel: {
- show: true,
- margin: 10,
- textStyle: {
- fontSize: 12,
- color: '#DEEBFF',
- }
- },
- },
- series: [
- {
- name: '一行动一活动开展情况',
- type: 'pictorialBar',
- symbolSize: [8, 14],
- symbolOffset: [4, 0],
- z: 12,
- itemStyle: {
- normal: {
- color: function (params) {
- return barBottomColor[params.dataIndex];
- }
- }
- },
- label: {
- textStyle: {
- rich: {
- name: {
- color: "#fff", //#BCD3E5
- fontSize: 14,
- },
- value: {
- color: "#64DAFF",
- fontSize: 14,
- },
- unit: {
- color: "#fff", //#BCD3E5
- fontSize: 14,
- },
- },
- },
- show: true,
- position: 'right',
- fontSize: 16,
- formatter: function (params) {
- return `{value|${params.value}} {unit|k㎡}`;
- }
- },
- symbolPosition: 'end',
- data: data,
- }, {
- name: '一行动一活动开展情况',
- type: 'pictorialBar',
- symbolOffset: [-3, 0],
- symbolSize: [8, 14],
- z: 12,
- itemStyle: {
- normal: {
- color: function (params) {
- return barTopColor[params.dataIndex];
- }
- }
- },
- data: [22, 23, 18, 14],
- }, {
- type: 'bar',
- itemStyle: {
- normal: {
- color: function (params) {
- return new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [{
- offset: 1,
- color: barTopColor[params.dataIndex]
- },
- {
- offset: 0,
- color: barBottomColor[params.dataIndex]
- }
- ]
- );
- },
- opacity: .9
- }
- },
- z: 16,
- silent: true,
- barWidth: 15,
- barCategoryGap: '100%',
- data: data,
- }]
- };
- myChart.setOption(option);
- },
- init_wpjg_echart() {
- const that = this;
- var tdsc_my_chart = window.echarts.init(document.getElementById('wpjg_echart'));
- tdsc_my_chart.getZr().on('click', (params) => {
- // 这个部分照抄,你想通过点击拿到的当前柱条的数据,都可以在下面这些属性中拿到,如果我注释没有你想要的,需要console一下charts.getOption()查找对应的属性名
- // let pointInPixel = [params.offsetX, params.offsetY]
- // if (tdsc_my_chart.containPixel('grid', pointInPixel)) {
- // let xIndex = tdsc_my_chart.convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
- // console.log(xIndex)
- // }
- const actionObj = params.topTarget
- console.log('actionObj', actionObj)
- const myKey = Object.keys(actionObj).sort().filter(_ => _.indexOf('ec_inner') !== -1)[0]
- console.log('myKey', myKey)
- const res = actionObj[myKey]
- console.log(`当前点击了第${res.dataIndex}组数据中的第${res.seriesIndex}个柱子`)
- var pointInPixel = [params.offsetX, params.offsetY];
- if (tdsc_my_chart.containPixel('grid', pointInPixel)) {
- /*此处添加具体执行代码*/
- var pointInGrid = tdsc_my_chart.convertFromPixel({ seriesIndex: 0 }, pointInPixel);
- //X轴序号
- var xIndex = pointInGrid[0];
- console.log('点击了横纵坐标', pointInPixel)
- console.log('【点击了第几组数据,纵坐标】', pointInGrid)
- //获取当前图表的option
- var op = tdsc_my_chart.getOption();
- console.log('数据信息', op)
- //获得图表中我们想要的数据---下面就不简写了,默认说我们的折现有2条吧
- var xValue = op.xAxis[0].data[xIndex];
- console.log('x轴所对应的名字', xValue)
- }
- });
- const legendType = 'center'
- let option = {
- backgroundColor: 'rgba(0,0,0,0)',
- grid: {
- containLabel: true,
- bottom: '1%',
- top: '40%',
- left: '5%',
- right: legendType === 'center' ? '5%' : '25%',
- },
- tooltip: {
- show: false,
- trigger: 'axis',
- axisPointer: {
- type: 'shadow',
- },
- },
- legend: {
- orient: legendType === 'center' ? '' : 'vertical',
- bottom: "80%",
- right: legendType === 'center' ? 'center' : '2%',
- // data: ['监测图斑', '占用耕地', '占用永久基本农田', '违法占地'],
- itemWidth: 12,
- itemHeight: 12,
- itemGap: 20,
- icon: "rect",
- textStyle: {
- fontSize: 12,
- color: '#fff',
- padding: [5, 0, 0, 2],
- rich: {
- a: {
- verticalAlign: 'middle',
- },
- },
- },
- },
- xAxis: {
- triggerEvent: true,
- data: that.xData,
- axisLabel: {
- show: true,
- fontSize: 12,
- color: '#fff',
- align: 'center',
- verticalAlign: 'top',
- },
- axisLine: {
- show: true,
- lineStyle: {
- width: 1,
- color: 'rgba(239, 247, 253, .7)'
- }
- },
- axisTick: {
- show: false,
- },
- },
- yAxis: [
- {
- name: "单位/k㎡",
- nameTextStyle: {
- color: "#fff",
- fontSize: 12,
- padding: [0, 0, 4, 0], //name文字位置 对应 上右下左
- },
- axisLabel: {
- interval: 0,
- show: true,
- fontSize: 10,
- color: '#fff',
- },
- axisLine: {
- show: false,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: 'rgba(239, 247, 253, .1)'
- }
- },
- },
- ],
- series: [
- {
- name: '监测图斑',
- type: 'bar',
- barWidth: 12,
- silent: true,
- itemStyle: {
- normal: {
- color: function (params) {
- let colorItem = ['#3b93e3', '#186bb8'];
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
- [
- {
- offset: 0,
- color: colorItem[0]
- },
- {
- offset: 1,
- color: colorItem[1]
- }
- ],
- false
- );
- }
- }
- },
- data: this.xData1,
- },
- {
- name: '占用耕地',
- type: 'bar',
- barWidth: 12,
- silent: true,
- itemStyle: {
- normal: {
- color: function (params) {
- let colorItem = ['#efc943', '#ec9a1b'];
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
- [
- {
- offset: 0,
- color: colorItem[0]
- },
- {
- offset: 1,
- color: colorItem[1]
- }
- ],
- false
- );
- }
- }
- },
- data: this.xData2,
- },
- {
- name: '占用永久基本农田',
- type: 'bar',
- barWidth: 12,
- silent: true,
- itemStyle: {
- normal: {
- color: function (params) {
- let colorItem = ['#4ee1ac', '#12a972'];
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
- [
- {
- offset: 0,
- color: colorItem[0]
- },
- {
- offset: 1,
- color: colorItem[1]
- }
- ],
- false
- );
- }
- }
- },
- data: this.xData3,
- }, {
- name: '违法占地',
- type: 'bar',
- barWidth: 12,
- silent: true,
- itemStyle: {
- normal: {
- color: function (params) {
- let colorItem = ['rgb(236,128,141)', 'rgb(236,128,141)'];
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
- [
- {
- offset: 0,
- color: colorItem[0]
- },
- {
- offset: 1,
- color: colorItem[1]
- }
- ],
- false
- );
- }
- }
- },
- data: this.xData4,
- }
- ],
- }
- tdsc_my_chart.setOption(option);
- },
- async init_wpjg_title(params) {
- const that = this;
- let obj = {
- jscType: 'jsc_vpjg_hz',
- id: params ? params.id : '4602',
- beginTime: params ? params.beginTime : store.state.cockpit_date[0],
- endTime: params ? params.endTime : store.state.cockpit_date[1],
- };
- let data = await QueryOne(obj);
- this.title = data.data
- },
- async init_wpjg_echart_data(params) {
- const that = this;
- let obj = {
- jscType: 'jsc_vpjg_qxxf',
- id: params ? params.id : '4602',
- beginTime: params ? params.beginTime : store.state.cockpit_date[0],
- endTime: params ? params.endTime : store.state.cockpit_date[1],
- };
- let data = await QueryList(obj);
- that.zData = data.data;
- data.data.forEach((res) => {
- this.xData.push(res.name);
- this.xData1.push((res.tb_mj / 1000).toFixed(2));
- this.xData2.push((res.zygdmj / 1000).toFixed(2));
- this.xData3.push((res.zyjbntmj / 1000).toFixed(2));
- this.xData4.push((res.wf_mj / 1000).toFixed(2));
- })
- this.init_wpjg_echart();
- },
- setData(datas) {
- this.GetQueryListztsh(datas);
- this.getQueryListyelx(datas);
- },
- getQueryListyelx(datas) {
- let data = [];
- let links = [];
- let params = {
- ...datas,
- jscType: "jsc_wpjc_yelx",
- };
- QueryList(params).then((res) => {
- res.data.forEach((edata) => {
- if (edata.qlx_type_name && edata.hlx_type_name) {
- links.push({
- source: edata.qlx_type_name,
- target: edata.hlx_type_name,
- value: edata.xzqdm_num,
- });
- if (data.findIndex((a) => a.name == edata.qlx_type_name) < 0)
- data.push({
- name: edata.qlx_type_name,
- itemStyle: { color: colors[Math.floor(Math.random() * 12)] },
- });
- if (data.findIndex((a) => a.name == edata.hlx_type_name) < 0)
- data.push({
- name: edata.hlx_type_name,
- itemStyle: { color: colors[Math.floor(Math.random() * 12)] },
- });
- this.$nextTick(() => {
- this.$refs.echartRef.setOptions(data, links);
- });
- }
- });
- });
- },
- GetQueryListztsh(datas) {
- let params = {
- ...datas,
- jscType: "jsc_wpjc_ztsh",
- };
- QueryList(params).then((res) => {
- this.sdata = res.data && res.data.length > 0 ? res.data[0] : {};
- });
- },
- },
- computed: {
- // 计算属性的 getter
- wfl_computed: function () {
- // `this` 指向 vm 实例
- if (this.title.wfl != 0) {
- return this.title.wfl + '%'
- } else {
- return '暂无'
- }
- },
- wf_mj_computed: function () {
- // `this` 指向 vm 实例
- if ((this.title.wf_mj / 1000).toFixed(2) > 0) {
- return (this.title.wf_mj / 1000).toFixed(2) + 'k㎡'
- } else {
- return '暂无'
- }
- }
- },
- mounted() {
- this.$nextTick((res) => {
- this.init_wpjg_title();
- this.init_wpjg_echart_data();
- })
- },
- };
- </script>
- <style lang="scss" scoped>
- .wpjg {
- top: 38rem !important;
- .stacontent {
- width: 100%;
- height: 24px;
- margin-top: 0.5rem;
- margin-bottom: 1.5rem;
- }
- .item {
- width: 49%;
- height: 30%;
- display: inline-block;
- // border: #00FFFF 1px solid;
- }
- .cursor {
- cursor: pointer;
- }
- .dlabel {
- font-family: HarmonyOS Sans Naskh Arabic UI, HarmonyOS Sans Naskh Arabic UI;
- font-weight: 400;
- font-size: 14px;
- color: #bcd3e5;
- line-height: 24px;
- text-align: left;
- }
- .dvalue {
- font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
- font-weight: bold;
- color: #64daff;
- line-height: 16px;
- text-align: left;
- font-size: 12px;
- }
- }
- #wpjg_echart {
- left: -1rem;
- top: -0.9rem;
- width: 26rem;
- height: 12rem;
- }
- #wpjg_echart_xzqh {
- left: 1rem;
- width: 26rem;
- height: 12rem;
- }
- </style>
|