data() {
return {
dataList:{},
}
}
<template>
<span slot="action">
<!-- <span slot="action" slot-scope="text, record"> -->
<div class="index-container-ty">
<a-spin :spinning="loading">
<a-row type="flex" justify="start" :gutter="1">
<a-col :sm="24" :lg="8">
<a-card>
<div slot="title" class="index-md-title">
<img src="../../assets/zaiban.png" />
未分配任务【{{ dataSource1.total }}】
</div>
<div slot="extra">
<a v-if="dataSource1 && dataSource1.length > 0" slot="footer" @click="goPage"
>更多 <a-icon type="double-right"
/></a>
</div>
<a-table
:class="'my-index-table tytable2'"
ref="table2"
size="small"
rowKey="id"
:columns="columns"
:dataSource="dataSource1.records"
:pagination="false"
>
<template slot="ellipsisText" slot-scope="text">
<j-ellipsis :value="text" :length="textMaxLength"></j-ellipsis>
</template>
<template slot="dayWarnning" slot-scope="text, record">
<a-icon type="bulb" theme="twoTone" style="font-size: 22px" :twoToneColor="getTipColor(record)" />
</template>
<template slot="action" slot-scope="text,record">
<a @click="handleData(record)">详情</a>
</template>
</a-table>
<div class="pagination">
<a-pagination size="small" :current="dataSource1.current" :total="dataSource1.total" @change="onChangePage1" show-quick-jumper :page-size="5"/>
</div>
</a-card>
</a-col>
<a-col :sm="24" :lg="8">
<a-card>
<div slot="title" class="index-md-title">
<img src="../../assets/guaz.png" />
未完成任务【{{ dataSource2.total }}】
</div>
<a-table
:class="'my-index-table tytable4'"
ref="table4"
size="small"
rowKey="id"
:columns="columns"
:dataSource="dataSource2.records"
:pagination="false"
>
<template slot="ellipsisText" slot-scope="text">
<j-ellipsis :value="text" :length="textMaxLength"></j-ellipsis>
</template>
<template slot="dayWarnning" slot-scope="text, record">
<a-icon type="bulb" theme="twoTone" style="font-size: 22px" :twoToneColor="getTipColor(record)" />
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleData">详情</a>
</span>
</a-table>
<div class="pagination">
<a-pagination size="small" :current="dataSource2.current" :total="dataSource2.total" @change="onChangePage2" show-quick-jumper :page-size="5"/>
</div>
</a-card>
</a-col>
<a-col :sm="24" :lg="8">
<a-card >
<div slot="title" class="index-md-title">
<img src="../../assets/daiban.png" />
已完成任务【{{ dataSource3.total }}】
</div>
<a-table
:class="'my-index-table tytable1'"
ref="table1"
size="small"
rowKey="id"
:columns="columns"
:dataSource="dataSource3.records"
:pagination="false"
>
<template slot="ellipsisText" slot-scope="text">
<j-ellipsis :value="text" :length="textMaxLength"></j-ellipsis>
</template>
<template slot="dayWarnning" slot-scope="text, record">
<a-icon type="bulb" theme="twoTone" style="font-size: 22px" :twoToneColor="getTipColor(record)" />
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleData">详情</a>
</span>
</a-table>
<div id="components-pagination-demo-mini" class="pagination">
<a-pagination size="small" :current="dataSource3.current" :total="dataSource3.total" @change="onChangePage3" show-quick-jumper :page-size="5"/>
</div>
</a-card>
</a-col>
<a-col :span="24">
<div style="height: 66px"></div>
</a-col>
<!-- 饼状图 -->
<a-col :span="24" :lg="13">
<div>
<v-chart :forceFit="true" :height="height" :data="data" :scale="scale">
<v-tooltip :showTitle="false" dataKey="item*percent" />
<v-axis />
<v-legend dataKey="item" />
<v-pie position="percent" color="item" :v-style="pieStyle" :label="labelConfig" />
<v-coord type="theta" />
</v-chart>
</div>
</a-col>
<!-- 分组柱状图 -->
<a-col :span="24" :lg="11">
<div>
<v-chart :forceFit="true" :height="height" :data="data1">
<v-tooltip />
<v-axis />
<v-legend />
<v-bar position="月份*月均降雨量" color="name" :adjust="adjust" />
</v-chart>
</div>
</a-col>
</a-row>
</a-spin>
</div>
</span>
</template>
<script>
import noDataPng from '@/assets/nodata.png'
import JEllipsis from '@/components/jeecg/JEllipsis'
import { getToBigScreen } from '@/api/api'
const DataSet = require('@antv/data-set') //饼状图
//饼状图
const sourceData = [
{ item: '未分配任务', count: 40 },
{ item: '未完成任务', count: 21 },
{ item: '已完成任务', count: 17 },
]
//饼状图
const scale = [
{
dataKey: 'percent',
min: 0,
formatter: '.0%',
},
]
//饼状图
const dv = new DataSet.View().source(sourceData)
dv.transform({
type: 'percent',
field: 'count',
dimension: 'item',
as: 'percent',
})
const data = dv.rows
// 分组柱状图
const DataSet1 = require('@antv/data-set')
const sourceData1 = [
{
name: '未分配任务',
'Jan.': 18.9,
'Feb.': 28.8,
'Mar.': 39.3,
'Apr.': 1.4,
May: 47,
'Jun.': 20.3,
'Jul.': 24,
'Aug.': 35.6,
},
{
name: '未完成任务',
'Jan.': 12.4,
'Feb.': 23.2,
'Mar.': 34.5,
'Apr.': 9.7,
May: 52.6,
'Jun.': 35.5,
'Jul.': 37.4,
'Aug.': 42.4,
},
{
name: '已完成任务',
'Jan.': 12.4,
'Feb.': 23.2,
'Mar.': 34.5,
'Apr.': 9.7,
May: 52.6,
'Jun.': 35.5,
'Jul.': 37.4,
'Aug.': 42.4,
},
]
const dv1 = new DataSet1.View().source(sourceData1)
dv1.transform({
type: 'fold',
fields: ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Aug.'],
key: '月份',
value: '月均降雨量',
})
const data1 = dv1.rows
export default {
name: 'IndexTask',
components: { JEllipsis, getToBigScreen },
data() {
return {
//饼状图
data,
scale,
data1,
height: 390,
pieStyle: {
stroke: '#fff',
lineWidth: 1,
},
labelConfig: [
'percent',
{
formatter: (val, item) => {
return item.point.item + ': ' + val
},
},
],
adjust: [
{
type: 'dodge',
marginRatio: 1 / 32,
},
],
loading: false,
textMaxLength: 8,
dataList:{},
dataSource1: {},
dataSource2: {},
dataSource3: {},
// current:1,
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 8,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
},
},
{
title: '名称',
align: 'center',
dataIndex: 'name',
width: 88,
},
{
title: 'Tool简介',
align: 'center',
dataIndex: 'introduction',
},
{
title: 'Tool目的',
align: 'center',
dataIndex: 'purpose',
scopedSlots: { customRender: 'ellipsisText' },
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
},
],
}
},
created() {
this.mock()
this.getList()
},
mounted() {},
methods: {
// 获取数据
getList(){
let params = {
// type:'',
pageSize : 5,
pageNo : 1
}
getToBigScreen(params).then(res => {
if(res.success) {
this.dataList = res.result
this.dataSource1 = res.result.weifenpei
this.dataSource2 = res.result.weiwancheng
this.dataSource3 = res.result.yiwancheng
}else{
this.$message.error(res.message)
}
console.log(res)
})
},
reGetList3(){
let params = {
pageSize : 5,
pageNo : this.dataSource3.current,
type:3
}
getToBigScreen(params).then(res => {
if(res.success) {
this.dataSource3 = res.result.yiwancheng
}else{
this.$message.error(res.message)
}
console.log(res)
})
},
reGetList1(){
let params = {
pageSize : 5,
pageNo : this.dataSource1.current,
type:1
}
getToBigScreen(params).then(res => {
if(res.success) {
this.dataSource1 = res.result.weifenpei
}else{
this.$message.error(res.message)
}
console.log(res)
})
},
reGetList2(){
let params = {
pageSize : 5,
pageNo : this.dataSource2.current,
type:2
}
getToBigScreen(params).then(res => {
if(res.success) {
this.dataSource2 = res.result.weiwancheng
}else{
this.$message.error(res.message)
}
console.log(res)
})
},
mock(rd) {
console.log('你好==' + JSON.stringify(rd))
getToBigScreen().then((res) => {
if (res.success) {
this.dataSource = res.result
}
})
},
getTipColor(rd) {
let num = rd.restDay
if (num <= 0) {
return tip_red
} else if (num >= 1 && num < 4) {
return tip_yellow
} else if (num >= 4) {
return tip_green
}
},
goPage() {
this.$message.success('请根据具体业务跳转页面')
//this.$router.push({ path: '/comp/mytask' })
},
ifNullDataSource(ds, tb) {
this.$nextTick(() => {
if (!ds || ds.length == 0) {
var tmp = document.createElement('img')
tmp.src = noDataPng
tmp.width = 300
let tbclass = `${tb} .ant-table-placeholder`
document.querySelector(tbclass).innerHTML = ''
document.querySelector(tbclass).appendChild(tmp)
}
})
},
handleData(data) {
this.$router.push({path:'/store/ToToolsList',query:{data}})
console.log(data)
this.$message.success('进入详情页面')
},
onChangePage3(page) {
this.dataSource3.current = page
this.reGetList3()
},
onChangePage1(page) {
this.dataSource1.current = page
this.reGetList1()
},
onChangePage2(page) {
this.dataSource2.current = page
this.reGetList2()
},
},
}
</script>
<style>
.my-index-table {
height: 270px;
}
.my-index-table table {
font-size: 14px !important;
}
.index-container-ty .ant-card-head-title {
padding-top: 6px;
padding-bottom: 6px;
}
.index-container-ty .ant-card-extra {
padding: 0;
}
.index-container-ty .ant-card-extra a {
color: #fff;
}
.index-container-ty .ant-card-extra a:hover {
color: #152ede;
}
.index-container-ty .ant-card-head-wrapper,
.index-container-ty .ant-card-head {
line-height: 24px;
min-height: 24px;
/*background: #90aeff;*/
background: #7196fb;
}
.index-container-ty .ant-card-body {
padding: 10px 12px 0px 12px;
}
/* .index-container-ty .ant-card-actions{background: #fff}
.index-container-ty .ant-card-actions li {margin:2px 0;}
.index-container-ty .ant-card-actions > li > span{width: 100%}*/
.index-container-ty .ant-table-footer {
text-align: right;
padding: 6px 12px 6px 6px;
background: #fff;
border-top: 2px solid #f7f1f1;
}
.index-md-title {
postion: relative;
padding-left: 24px;
width: 100%;
color: #fff;
font-size: 21px;
font-family: cursive;
}
.index-md-title img {
position: absolute;
height: 32px;
top: 2px;
left: 14px;
}
.index-container-ty .ant-card-body {
/*border-left:1px solid #90aeff;
/*border-right:1px solid #90aeff;
border-bottom:1px solid #90aeff;*/
}
.index-container-ty .ant-table-thead > tr > th,
.index-container-ty .ant-table-tbody > tr > td {
border-bottom: 1px solid #90aeff;
}
.index-container-ty
.ant-table-small
> .ant-table-content
> .ant-table-fixed-left
> .ant-table-body-outer
> .ant-table-body-inner
> table
> .ant-table-thead
> tr
> th,
.index-container-ty
.ant-table-small
> .ant-table-content
> .ant-table-fixed-right
> .ant-table-body-outer
> .ant-table-body-inner
> table
> .ant-table-thead
> tr
> th {
border-bottom: 1px solid #90aeff;
}
.index-container-ty
.ant-table-small
> .ant-table-content
> .ant-table-scroll
> .ant-table-body
> table
> .ant-table-thead
> tr
> th {
border-bottom: 1px solid #90aeff;
}
.index-container-ty .ant-table-small {
border: 1px solid #90aeff;
}
.index-container-ty .ant-table-placeholder {
padding: 0;
}
/*.ant-card-body {*/
/* position: relative!important;*/
/*}*/
.pagination {
margin: 10px auto;
text-align: center;
}
</style>