首页left1

This commit is contained in:
熊丽君
2021-12-08 14:13:08 +08:00
parent 6895a51323
commit cc2569e366
6 changed files with 494 additions and 371 deletions

View File

@ -1,7 +1,7 @@
<template>
<div>
<container3>
<img class="img" src="./conter.png" style="width: 100%;height:100%">
<img class="img" src="./conter2.jpg" style="width: 100%;height:100%">
<rocketTit class="tit">今日动态</rocketTit>
<div class="data">
<div class="data-item">

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,104 @@
<template>
<div class="container2">
<div class="tit">
<rocketTit>{{title}}</rocketTit>
<div class="datePicker">
<slot name="datePicker"></slot>
</div>
</div>
<div class="content">
<div class="snap">
<slot name="snap"></slot>
</div>
<slot />
</div>
</div>
</template>
<script>
import rocketTit from "../../../components/rocketTit/index.vue";
export default {
name: 'Container2',
components: {
rocketTit,
},
props: {
title: {
type: String,
default: '',
},
selected: {
type: Boolean,
default: false,
},
},
data () {
return {
}
},
}
</script>
<style lang="scss" scoped>
.container2 {
display: flex;
flex-direction: column;
width: 538px;
height: 288px;
background-image: url(./bg.png);
background-size: cover;
color: #ffffff;
font-size: 16px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
.tit {
padding: 16px 16px 16px 24px;
position: relative;
.datePicker {
position: absolute;
right: 16px;
top: 12px;
::v-deep .el-date-editor {
border-radius: 0;
box-shadow: none !important;
border: 1px solid rgba(255, 255, 255, 0.2);
vertical-align: middle;
color: #fff;
background-color: transparent;
.el-range-input,
.el-range-separator {
color: #fff;
}
.el-range-editor.is-active {
border-color: #fff !important;
}
input {
background-color: transparent;
}
}
}
}
.content {
flex: 1;
padding: 2px;
box-sizing: border-box;
overflow: hidden;
position: relative;
.snap {
position: absolute;
top: 20px;
left: 25px;
font-weight: 300;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

View File

@ -1,349 +1,350 @@
<template>
<container2 title="经营责任书完成概况">
<div class="wrap">
<el-row class="content1">
<el-col :span="12">
<div id="left1" ref="left1" class="chart1"></div>
</el-col>
<el-col :span="12">
<div class="record">
<div>0进展指标 <span class="num">2</span></div>
</div>
</el-col>
</el-row>
<el-row class="content2">
<el-row class="titWrap">
<el-col :span="12" class="tit">责任书各类完成情况百分比</el-col>
<el-col :span="12" style="text-align:right">
<bigScreenTabs v-model="index" :titleArr="['部门', '类型']"></bigScreenTabs>
</el-col>
</el-row>
<div class="tabContent" v-show="index == 0">
<div id="left2"></div>
</div>
<div class="tabContent" v-show="index == 1">
<div id="left3"></div>
</div>
</el-row>
</div>
</container2>
<div>
<container2 title="经营责任书完成概况">
<div class="wrap">
<el-row class="content1">
<el-col :span="24">
<div id="left1" ref="left1" class="chart1"></div>
</el-col>
<!-- <el-col :span="12">
<div class="record">
<div>0进展指标 <span class="num">2</span></div>
</div>
</el-col> -->
</el-row>
</div>
</container2>
<container2 title="收入概况" style="margin-top: 10px">
<div class="wrap">
<el-row class="content2">
<el-col :span="24">
<div id="left2" ref="left2" class="chart2"></div>
</el-col>
</el-row>
</div>
</container2>
</div>
</template>
<script>
import rocketTit from "../components/rocketTit/index.vue";
import container2 from "../components/container2/index.vue";
import bigScreenTabs from "../components/bigScreenTabs/index.vue";
import rocketTit from '../components/rocketTit/index.vue'
import container2 from './components/container2/index.vue'
import bigScreenTabs from '../components/bigScreenTabs/index.vue'
// import {Liquid} from '@antv/g2plot';
// import resize from '../../dashboard/mixins/resize'
export default {
// mixins: [resize],
name: 'left1',
components: {
rocketTit,
container2,
bigScreenTabs,
},
data () {
return {
index: 0,
// mixins: [resize],
name: 'left1',
components: {
rocketTit,
container2,
bigScreenTabs,
},
data() {
return {
index: 0,
data: [
{
"year": "2021-01",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-02",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-03",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-04",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-05",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-06",
"value": ~~(Math.random() * 100),
"category": "部门一"
},
{
"year": "2021-01",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
{
"year": "2021-02",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
{
"year": "2021-03",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
{
"year": "2021-04",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
{
"year": "2021-05",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
{
"year": "2021-06",
"value": ~~(Math.random() * 100),
"category": "部门二"
},
]
}
},
mounted () {
this.$nextTick(() => {
this.initChart()
this.initLine()
})
},
beforeDestroy () {
},
methods: {
initChart () {
const { Liquid } = G2Plot;
const liquidPlot = new Liquid(this.$refs.left1, {
percent: 0.25,
statistic: {
content: {
style: {
color: 'rgb(255,255,255)',
fontSize: 18,
},
customHtml: (container, view, { percent }) => {
const text = `总体<br/>完成情况 ${(percent * 100).toFixed(0)}%`;
return `<div>${text}</div>`;
},
}
},
outline: {
border: 4,
style: {
stroke: 'l(0) 0:rgba(89, 184, 244, 1) 0.5:rgba(106, 232, 216, 1) 1:rgba(88, 151, 240, 1)'
}
},
wave: {
length: 128,
},
});
console.log(liquidPlot.render())
// liquidPlot.render();
},
initLine () {
const { Line } = G2Plot;
let arr = this.data;
const line = new Line('left2', {
data: arr,
xField: 'year',
yField: 'value',
padding: 'auto',
seriesField: 'category',
legend: {
position: 'top',
title: {
style: {
color: '#ffffff'
}
},
itemName: {
style: {
fill: '#ffffff'
}
}
},
// 配置折线趋势填充
area: {
style: {
fillOpacity: 0.15,
},
},
xAxis: {
type: 'time',
label: {
// 数值格式化为千分位
style: {
stroke: 'rgba(145, 213, 254, 0.1)',
fill: '#ffffff',
}
},
},
yAxis: {
label: {
// 数值格式化为千分位
formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`),
style: {
stroke: 'rgba(145, 213, 254, 0.1)',
fill: '#ffffff',
}
},
grid: {
line: {
style: {
stroke: 'rgba(145, 213, 254, 0.1)',
fill: '#ffffff',
lineWidth: 2,
lineDash: [4, 5],
strokeOpacity: 0,
cursor: 'pointer'
}
}
},
line: {
style: {
stroke: 'rgba(145, 213, 254, 0.1)',
fill: '#ffffff',
lineWidth: 2,
}
}
},
});
const line1 = new Line('left3', {
data: arr,
xField: 'year',
yField: 'value',
padding: 'auto',
seriesField: 'category',
legend: {
position: 'top',
title: {
style: {
color: '#ffffff'
}
}
},
// 配置折线趋势填充
area: {
style: {
fillOpacity: 0.15,
},
},
xAxis: {
type: 'time',
},
yAxis: {
label: {
// 数值格式化为千分位
formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`),
},
},
});
line.render();
line1.render();
}
}
data: [
{
year: '2021-01',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-02',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-03',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-04',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-05',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-06',
value: ~~(Math.random() * 100),
category: '部门一',
},
{
year: '2021-01',
value: ~~(Math.random() * 100),
category: '部门二',
},
{
year: '2021-02',
value: ~~(Math.random() * 100),
category: '部门二',
},
{
year: '2021-03',
value: ~~(Math.random() * 100),
category: '部门二',
},
{
year: '2021-04',
value: ~~(Math.random() * 100),
category: '部门二',
},
{
year: '2021-05',
value: ~~(Math.random() * 100),
category: '部门二',
},
{
year: '2021-06',
value: ~~(Math.random() * 100),
category: '部门二',
},
],
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
this.initLine()
})
},
beforeDestroy() {},
methods: {
initChart() {
const { Liquid, Pie } = G2Plot
const data = [
{ type: '类别一', value: 235 },
{ type: '类别二', value: 565 },
{ type: '类别三', value: 927 },
{ type: '类别四', value: 574 },
{ type: '类别五', value: 214 },
{ type: '类别六', value: 214 },
{ type: '类别七', value: 214 },
{ type: '类别八', value: 214 },
{ type: '类别九', value: 214 },
{ type: '类别十', value: 214 },
]
const calcAverageValue = (data, type) => {
const items = data.filter(d => d.type === type)
return items.length ? items.reduce((a, b) => a + b.value, 0) / items.length : '-'
}
const liquidPlot = new Pie(this.$refs.left1, {
data: data,
angleField: 'value',
colorField: 'type',
legend: {
itemHeight: 13,
pageNavigator: {
marker: {
style: {
// 非激活,不可点击态时的填充色设置
inactiveFill: '#fff',
inactiveOpacity: 0.45,
// 默认填充色设置
fill: '#fff',
opacity: 0.8,
size: 12,
},
},
text: {
style: {
fill: '#fff',
fontSize: 8,
},
},
},
offsetX: -30,
itemName: {
style: {
fill: '#fff',
},
},
itemValue: {
formatter: (text, item) => {
return calcAverageValue(data, item.value)
},
style: (item, index) => {
return {
fill: '#fff',
}
},
},
},
// legend: {
// position: 'right-top',
// offsetX: 8,
// title: {
// text: '产品类别 (平均销售量)',
// spacing: 8,
// },
// itemName: {
// style: (item, index) => {
// return {
// fill: calcAverageValue(data, item.value) > 10000 ? 'red' : 'green',
// };
// },
// },
// itemValue: {
// formatter: (text, item) => {
// return calcAverageValue(data, item.value);
// },
// style: (item, index) => {
// return {
// fill: calcAverageValue(data, item.value) > 10000 ? 'red' : 'green',
// };
// },
// },
// },
color: ['#4e7cde', '#4eba97', '#506186', '#d2a31d', '#c65a49'],
radius: 0.9,
label: {
type: 'inner',
offset: '-30%',
content: ({ percent }) => `${(percent * 100).toFixed(0)}%`,
style: {
fontSize: 14,
textAlign: 'center',
},
},
interactions: [{ type: 'element-active' }],
pieStyle: {
lineWidth: 0,
},
})
// const liquidPlot = new Liquid(this.$refs.left1, {
// percent: 0.25,
// statistic: {
// content: {
// style: {
// color: 'rgb(255,255,255)',
// fontSize: 18,
// },
// customHtml: (container, view, { percent }) => {
// const text = `总体<br/>完成情况 ${(percent * 100).toFixed(0)}%`;
// return `<div>${text}</div>`;
// },
// }
// },
// outline: {
// border: 4,
// style: {
// stroke: 'l(0) 0:rgba(89, 184, 244, 1) 0.5:rgba(106, 232, 216, 1) 1:rgba(88, 151, 240, 1)'
// }
// },
// wave: {
// length: 128,
// },
// });
console.log(liquidPlot.render())
// liquidPlot.render();
},
initLine() {
const { Line } = G2Plot
let arr = this.data
const line = new Line(this.$refs.left2, {
//
})
line.render()
},
},
}
</script>
<style lang="scss" scoped>
.wrap {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
.content1 {
height: 200px;
.chart1 {
margin: 0 auto;
width: 192px;
height: 192px;
background: transparent;
}
// height: 200px;
height: 100%;
.record {
display: flex;
align-items: center;
height: 192px;
padding-left: 30px;
> div {
flex: 1;
position: relative;
::before {
content: "";
display: inline-block;
width: 9px;
height: 9px;
background: #ffffff;
border-radius: 50%;
position: absolute;
left: -18px;
top: 18px;
}
}
}
.chart1 {
margin: 0 auto;
// width: 192px;
width: 100%;
height: 192px;
background: transparent;
}
.record {
display: flex;
align-items: center;
height: 192px;
padding-left: 30px;
> div {
flex: 1;
position: relative;
::before {
content: '';
display: inline-block;
width: 9px;
height: 9px;
background: #ffffff;
border-radius: 50%;
position: absolute;
left: -18px;
top: 18px;
}
}
}
}
.num {
font-size: 30px;
font-family: Roboto-BlackItalic, Roboto;
font-weight: normal;
color: #91d5fe;
vertical-align: sub;
// margin-right: 3px;
font-size: 30px;
font-family: Roboto-BlackItalic, Roboto;
font-weight: normal;
color: #91d5fe;
vertical-align: sub;
// margin-right: 3px;
}
.content2 {
padding: 20px;
flex: 1;
box-sizing: border-box;
display: flex;
flex-direction: column;
padding: 20px;
flex: 1;
box-sizing: border-box;
display: flex;
flex-direction: column;
.titWrap {
height: 30px;
}
.titWrap {
height: 30px;
}
.tabContent {
flex: 1;
}
.tabContent > div {
width: 100%;
height: 100%;
}
.tabContent {
flex: 1;
}
.tabContent > div {
width: 100%;
height: 100%;
}
.tit {
font-size: 16px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #ffffff;
line-height: 22px;
position: relative;
padding-left: 15px;
}
.tit::after {
content: "";
display: block;
position: absolute;
top: 3px;
left: 0px;
width: 4px;
height: 16px;
background: #00ffff;
}
.tit {
font-size: 16px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #ffffff;
line-height: 22px;
position: relative;
padding-left: 15px;
}
.tit::after {
content: '';
display: block;
position: absolute;
top: 3px;
left: 0px;
width: 4px;
height: 16px;
background: #00ffff;
}
}
</style>

View File

@ -1,6 +1,29 @@
<template>
<div>
<rocketTit style="margin-bottom: 9px">生产动态</rocketTit>
<div>
<container2 title="经营责任书完成概况">
<div class="wrap">
<el-row class="content1">
<el-col :span="24">
<div id="left1" ref="left1" class="chart1"></div>
</el-col>
<!-- <el-col :span="12">
<div class="record">
<div>0进展指标 <span class="num">2</span></div>
</div>
</el-col> -->
</el-row>
</div>
</container2>
<container2 title="收入概况" style="margin-top: 10px">
<div class="wrap">
<el-row class="content2">
<el-col :span="24">
<div id="left2" ref="left2" class="chart2"></div>
</el-col>
</el-row>
</div>
</container2>
<!-- <rocketTit style="margin-bottom: 9px">生产动态</rocketTit>
<container4>
<el-row style="height: 100%">
<el-col :span="12" style="height: 100%">
@ -20,65 +43,60 @@
</div>
</el-col>
</el-row>
</container4>
</div>
</container4> -->
</div>
</template>
<script>
import rocketTit from "../components/rocketTit/index.vue";
import container4 from "../components/container4/index.vue";
import rocketTit from '../components/rocketTit/index.vue'
import container4 from '../components/container4/index.vue'
import resize from '../../dashboard/mixins/resize'
export default {
mixins: [resize],
name: 'right1',
components: {
rocketTit,
container4,
},
data () {
return {}
},
mounted () {
},
beforeDestroy () {
},
methods: {
}
mixins: [resize],
name: 'right1',
components: {
rocketTit,
container4,
},
data() {
return {}
},
mounted() {},
beforeDestroy() {},
methods: {},
}
</script>
<style lang="scss" scoped>
.right1_bg {
width: 211px;
height: 132px;
background-size: cover;
text-align: center;
padding: 10px 0 10px 0;
margin: 20px auto 0 auto;
width: 211px;
height: 132px;
background-size: cover;
text-align: center;
padding: 10px 0 10px 0;
margin: 20px auto 0 auto;
font-size: 14px;
.num {
font-size: 30px;
font-family: Roboto-Black, Roboto;
font-weight: 900;
line-height: 35px;
margin-right: 3px;
vertical-align: middle;
}
font-size: 14px;
.num {
font-size: 30px;
font-family: Roboto-Black, Roboto;
font-weight: 900;
line-height: 35px;
margin-right: 3px;
vertical-align: middle;
}
}
.right1_bg1 {
background-image: url(./right1-1.png);
.num {
color: #f6d97e;
}
background-image: url(./right1-1.png);
.num {
color: #f6d97e;
}
}
.right1_bg2 {
background-image: url(./right1-2.png);
.num {
color: #1098ff;
}
background-image: url(./right1-2.png);
.num {
color: #1098ff;
}
}
</style>