@ -1,5 +1,5 @@ |
|||||
NODE_ENV=production |
NODE_ENV=production |
||||
VUE_APP_API_SERVER = https://epmet-test.elinkservice.cn/api |
# VUE_APP_API_SERVER = https://epmet-test.elinkservice.cn/api |
||||
# VUE_APP_API_SERVER = http://192.168.1.140/api |
VUE_APP_API_SERVER = http://192.168.1.140/api |
||||
VUE_APP_NODE_ENV=prod:sit |
VUE_APP_NODE_ENV=prod:sit |
||||
VUE_APP_PUBLIC_PATH=epmet-oper |
VUE_APP_PUBLIC_PATH=epmet-oper |
||||
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,135 @@ |
|||||
|
@import '../../c/config'; |
||||
|
@import '../../c/function'; |
||||
|
@import './c/common'; |
||||
|
|
||||
|
.m-pop { |
||||
|
@include shield; |
||||
|
background-color: rgba(#000, 0.9); |
||||
|
overflow-y: auto; |
||||
|
|
||||
|
.wrap { |
||||
|
position: relative; |
||||
|
margin: 120px auto; |
||||
|
width: 1020px; |
||||
|
|
||||
|
.title { |
||||
|
padding: 10px; |
||||
|
font-size: 22px; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 800; |
||||
|
color: #ffffff; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
|
img { |
||||
|
display: block; |
||||
|
margin-right: 5px; |
||||
|
} |
||||
|
span { |
||||
|
display: block; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn-close { |
||||
|
position: absolute; |
||||
|
top: -10px; |
||||
|
right: -10px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
|
||||
|
.line { |
||||
|
margin: 20px auto; |
||||
|
width: 900px; |
||||
|
height: 1px; |
||||
|
border: 1px dashed #1257c9; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.m-content { |
||||
|
display: flex; |
||||
|
} |
||||
|
|
||||
|
.m-info { |
||||
|
padding-left: 62px; |
||||
|
font-size: 16px; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #ffffff; |
||||
|
line-height: 24px; |
||||
|
width: 50%; |
||||
|
|
||||
|
.info-title { |
||||
|
margin-top: 30px; |
||||
|
font-size: 20px; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: bold; |
||||
|
color: #ffffff; |
||||
|
line-height: 30px; |
||||
|
} |
||||
|
|
||||
|
.info-prop { |
||||
|
position: relative; |
||||
|
margin: 10px 0; |
||||
|
display: flex; |
||||
|
padding-left: 15px; |
||||
|
|
||||
|
.info-pics { |
||||
|
display: flex; |
||||
|
margin: 20px 0; |
||||
|
img { |
||||
|
display: block; |
||||
|
width: 32%; |
||||
|
height: 90px; |
||||
|
margin-right: 9px; |
||||
|
object-fit: cover; |
||||
|
} |
||||
|
} |
||||
|
> span, |
||||
|
> div { |
||||
|
display: block; |
||||
|
max-width: 300px; |
||||
|
} |
||||
|
|
||||
|
&::before { |
||||
|
content: ''; |
||||
|
display: block; |
||||
|
position: absolute; |
||||
|
top: 9px; |
||||
|
left: 0; |
||||
|
width: 7px; |
||||
|
height: 7px; |
||||
|
background: #0c81fe; |
||||
|
border-radius: 3px; |
||||
|
margin-right: 10px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.m-line { |
||||
|
width: 50%; |
||||
|
|
||||
|
.stat { |
||||
|
margin: 20px 0 10px; |
||||
|
display: flex; |
||||
|
.stat-item { |
||||
|
width: 33%; |
||||
|
text-align: center; |
||||
|
|
||||
|
div { |
||||
|
font-size: 17px; |
||||
|
font-family: Source Han Serif SC; |
||||
|
font-weight: 500; |
||||
|
color: rgba(#fff, 0.5); |
||||
|
line-height: 24px; |
||||
|
&.z-weak { |
||||
|
font-size: 12px; |
||||
|
font-family: Source Han Serif SC; |
||||
|
font-weight: 500; |
||||
|
color: rgba(#fff, 0.5); |
||||
|
line-height: 24px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,135 @@ |
|||||
|
<template> |
||||
|
<div class="m-fold_text" :class="initOk ? '' : 'z-init'"> |
||||
|
<div |
||||
|
id="cnt" |
||||
|
ref="foldSlot" |
||||
|
class="fold_text-cnt" |
||||
|
:class="isFolded ? 'z-fold-' + row : ''" |
||||
|
> |
||||
|
<slot></slot> |
||||
|
</div> |
||||
|
<div v-if="!noNeedFold" class="fold_text-btn" @click="shiftFold"> |
||||
|
{{ isFolded ? "展开" : "收起" }} |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import nextTick from "dai-js/tools/nextTick"; |
||||
|
|
||||
|
export default { |
||||
|
name: "ResiSearch", |
||||
|
props: { |
||||
|
row: { |
||||
|
type: Number, |
||||
|
default: 2, |
||||
|
}, |
||||
|
lineHeight: { |
||||
|
type: Number, |
||||
|
default: 24, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
initOk: false, |
||||
|
|
||||
|
isFolded: false, |
||||
|
|
||||
|
noNeedFold: false, |
||||
|
}; |
||||
|
}, |
||||
|
computed: {}, |
||||
|
watch: {}, |
||||
|
created() { |
||||
|
this.init(); |
||||
|
}, |
||||
|
methods: { |
||||
|
async init() { |
||||
|
await nextTick(); |
||||
|
|
||||
|
const height = await this.$refs.foldSlot.offsetHeight; |
||||
|
const { row, lineHeight } = this; |
||||
|
|
||||
|
let noNeedFold = height / row < lineHeight; |
||||
|
|
||||
|
this.noNeedFold = noNeedFold; |
||||
|
this.isFolded = !noNeedFold; |
||||
|
this.initOk = true; |
||||
|
}, |
||||
|
|
||||
|
shiftFold() { |
||||
|
let { isFolded } = this; |
||||
|
this.isFolded = !isFolded; |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scope> |
||||
|
// 清除容器自身浮动 |
||||
|
@mixin cs { |
||||
|
&::after { |
||||
|
display: block; |
||||
|
visibility: hidden; |
||||
|
clear: both; |
||||
|
overflow: hidden; |
||||
|
height: 0; |
||||
|
content: ""; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 不换行显示省略号 |
||||
|
@mixin toe { |
||||
|
overflow: hidden; |
||||
|
white-space: nowrap; |
||||
|
text-overflow: ellipsis; |
||||
|
word-wrap: normal; |
||||
|
} |
||||
|
|
||||
|
// 强制文本换行 多行 |
||||
|
@mixin toeM($num) { |
||||
|
display: -webkit-box; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
-webkit-line-clamp: $num; |
||||
|
-webkit-box-orient: vertical; |
||||
|
} |
||||
|
|
||||
|
.m-fold_text { |
||||
|
@include cs; |
||||
|
|
||||
|
&.z-init { |
||||
|
background-color: rgba(#000, 0.05); |
||||
|
> view { |
||||
|
visibility: hidden; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.fold_text-cnt { |
||||
|
&.z-fold-1 { |
||||
|
@include toe; |
||||
|
} |
||||
|
&.z-fold-2 { |
||||
|
@include toeM(2); |
||||
|
} |
||||
|
&.z-fold-3 { |
||||
|
@include toeM(3); |
||||
|
} |
||||
|
&.z-fold-4 { |
||||
|
@include toeM(4); |
||||
|
} |
||||
|
&.z-fold-5 { |
||||
|
@include toeM(5); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.fold_text-btn { |
||||
|
float: right; |
||||
|
margin-right: -4px; |
||||
|
padding: 0 5px; |
||||
|
line-height: 20px; |
||||
|
color: #0c81fe; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,229 @@ |
|||||
|
<template> |
||||
|
<div class="m-pop"> |
||||
|
<div class="wrap"> |
||||
|
<cpt-card> |
||||
|
<div class="title"> |
||||
|
<img src="@/assets/img/shuju/title-tip.png" /> |
||||
|
<span>议题详情</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-close" |
||||
|
@click="handleClose"> |
||||
|
<img src="@/assets/img/shuju/people/close.png" /> |
||||
|
</div> |
||||
|
<div class="m-content"> |
||||
|
<div class="m-info"> |
||||
|
|
||||
|
<div class="info-prop"> |
||||
|
<span>议题标题:</span> |
||||
|
<span>{{ info.issueTitle }}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>议题建议:</span> |
||||
|
<span>{{ info.issueSuggestion }}</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="info-prop"> |
||||
|
<span>话题内容:</span> |
||||
|
<div>{{ info.topicInfo.topicContent }}</div> |
||||
|
<div v-if="info.topicInfo.topicImgs&&info.topicInfo.topicImgs.length>0" |
||||
|
class="info-pics"> |
||||
|
<img :src="src" |
||||
|
:key="src" |
||||
|
v-for="src in info.topicInfo.topicImgs" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>转议题时间:</span> |
||||
|
<span>{{ info.shiftIssueTime}}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>所属网格:</span> |
||||
|
<span>{{ info.belongsGridName}}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>话题发表人:</span> |
||||
|
<span>{{ info.topicInfo.publishedUser}}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>议题发起人:</span> |
||||
|
<span>{{ info.issueInitiator}}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>话题来源:</span> |
||||
|
<span>{{ info.topicInfo.groupName}}</span> |
||||
|
</div> |
||||
|
<div class="info-prop"> |
||||
|
<span>话题发表时间:</span> |
||||
|
<span>{{ info.topicInfo.publishedTimeShow}}</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="m-line"> |
||||
|
<div class="stat"> |
||||
|
<div class="stat-item"> |
||||
|
<div> |
||||
|
{{ issueTrend.realityVoteCount }}/{{ |
||||
|
issueTrend.shouldVoteCount |
||||
|
}} |
||||
|
</div> |
||||
|
<div class="z-weak">已表决/应表决</div> |
||||
|
</div> |
||||
|
<div class="stat-item"> |
||||
|
<div>{{ issueTrend.supportAmount }}</div> |
||||
|
<div class="z-weak">支持</div> |
||||
|
</div> |
||||
|
<div class="stat-item"> |
||||
|
<div>{{ issueTrend.oppositionAmount }}</div> |
||||
|
<div class="z-weak">反对</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<line-chart :list="issueChartData" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</cpt-card> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import cptCard from "@/views/modules/visual/cpts/card"; |
||||
|
import screenLoading from "@/views/modules/visual/cpts/loading"; |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import lineChart from "@/views/modules/visual/cpts/line-chart"; |
||||
|
import dateFormat from "dai-js/tools/dateFormat"; |
||||
|
|
||||
|
export default { |
||||
|
name: "demandInfo", |
||||
|
props: { |
||||
|
issueId: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
components: { |
||||
|
cptCard, |
||||
|
lineChart, |
||||
|
screenLoading, |
||||
|
}, |
||||
|
|
||||
|
data () { |
||||
|
return { |
||||
|
info: { |
||||
|
attitude: "", |
||||
|
belongsGridName: "", |
||||
|
issueIdea: "", |
||||
|
issueInitiator: "", |
||||
|
issueStatus: "", |
||||
|
issueSuggestion: "", |
||||
|
issueTitle: "", |
||||
|
joinVote: false, |
||||
|
projectId: "", |
||||
|
projectStatus: true, |
||||
|
publishIdeaFlag: false, |
||||
|
shiftIssueTime: "", |
||||
|
topicInfo: { |
||||
|
groupId: "", |
||||
|
groupName: "", |
||||
|
groupType: "", |
||||
|
publishedTime: "", |
||||
|
publishedUser: "", |
||||
|
topicContent: "", |
||||
|
topicId: "", |
||||
|
topicImgs: null, |
||||
|
}, |
||||
|
}, |
||||
|
issueTrend: {}, |
||||
|
issueChartData: [], |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
computed: {}, |
||||
|
|
||||
|
watch: { |
||||
|
issueId () { |
||||
|
this.getApiData(); |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
mounted () { |
||||
|
this.getApiData(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
handleClose () { |
||||
|
this.$emit("close"); |
||||
|
}, |
||||
|
|
||||
|
async getApiData () { |
||||
|
|
||||
|
await this.getInfo(); |
||||
|
await this.getIssueTrend() |
||||
|
}, |
||||
|
|
||||
|
//加载组织数据 |
||||
|
async getInfo () { |
||||
|
const url = "/resi/hall/issue/detail"; |
||||
|
// const url = "http://yapi.elinkservice.cn/mock/245/gov/issue/issue/resibuzz"; |
||||
|
let params = { |
||||
|
issueId: this.issueId, |
||||
|
}; |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.info = data |
||||
|
|
||||
|
this.info.topicInfo.publishedTimeShow = dateFormat(new Date(this.info.topicInfo.publishedTime * 1000), "yyyy-MM-dd") |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//加载组织数据 |
||||
|
async getIssueTrend () { |
||||
|
const url = "/resi/hall/issue/votingtrend"; |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, { |
||||
|
issueId: this.issueId, |
||||
|
}); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.issueTrend = data; |
||||
|
let chartData = []; |
||||
|
data.polyLine.forEach((item) => { |
||||
|
let date = dateFormat(new Date(item.voteDate * 1000), "yyyy-MM-dd"); |
||||
|
console.log("date:" + date); |
||||
|
chartData.push( |
||||
|
{ |
||||
|
date, |
||||
|
value: item.supportIncrement, |
||||
|
type: "支持", |
||||
|
}, |
||||
|
{ |
||||
|
date, |
||||
|
value: item.oppositionIncrement, |
||||
|
type: "反对", |
||||
|
} |
||||
|
); |
||||
|
}); |
||||
|
this.issueChartData = chartData; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style |
||||
|
lang="scss" |
||||
|
src="@/assets/scss/modules/visual/issue-info.scss" |
||||
|
scoped |
||||
|
></style> |
||||
@ -0,0 +1,34 @@ |
|||||
|
<template> |
||||
|
<div class="empty"> |
||||
|
<div class="icon"></div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data () { |
||||
|
return {} |
||||
|
}, |
||||
|
methods: {} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss" rel="stylesheet/scss"> |
||||
|
.empty { |
||||
|
width: 100%; |
||||
|
height: calc(100% - 37px); |
||||
|
margin: 15px 0; |
||||
|
|
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
.icon { |
||||
|
width: 100%; |
||||
|
height: 160px; |
||||
|
background: url("../../../../../assets/img/modules/visual/noData.png") |
||||
|
no-repeat; |
||||
|
background-size: contain; |
||||
|
background-position: 50% 50%; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,222 @@ |
|||||
|
<template> |
||||
|
<div class="m-chart"> |
||||
|
<canvas id="myChart" :width="width" :height="height" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import nextTick from "dai-js/tools/nextTick"; |
||||
|
// ios下字体渲染有bug |
||||
|
const fontFamily = "PingFang SC"; |
||||
|
const fontSize = 14; |
||||
|
|
||||
|
let chart; |
||||
|
let srcData = []; |
||||
|
|
||||
|
let textShapeList = []; |
||||
|
const addTextShape = () => { |
||||
|
if (textShapeList.length > 0) { |
||||
|
textShapeList.forEach((item) => { |
||||
|
item.remove(true); |
||||
|
}); |
||||
|
textShapeList = []; |
||||
|
} |
||||
|
// 添加折线上文本 |
||||
|
const canvas = chart.get("canvas"); |
||||
|
const group = canvas.addGroup(); |
||||
|
const shapes = {}; |
||||
|
|
||||
|
function addFn(list) { |
||||
|
const listLength = list.length; |
||||
|
list.forEach(function (obj, index) { |
||||
|
// 避免显示太多,乱七八糟 |
||||
|
if (listLength > 7 && index > 0 && index < listLength - 1) { |
||||
|
if (index % Math.ceil(listLength / 5) != 0) { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const offsetX = 6; |
||||
|
const offsetY = 1; |
||||
|
const point = chart.getPosition(obj); |
||||
|
const text = group.addShape("text", { |
||||
|
attrs: { |
||||
|
x: obj.type === "支持" ? point.x + 2 * offsetX : point.x - offsetX, |
||||
|
y: point.y + offsetY, |
||||
|
text: obj.value, |
||||
|
textAlign: "center", |
||||
|
textBaseline: "bottom", |
||||
|
fill: "#333", |
||||
|
fontWeight: 500, |
||||
|
fontFamily, |
||||
|
fontSize, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
textShapeList.push(text); // 缓存该 shape, 便于后续查找 |
||||
|
}); |
||||
|
} |
||||
|
srcData.sort((a, b) => { |
||||
|
return new Date(a.date).getTime() - new Date(b.date).getTime(); |
||||
|
}); |
||||
|
let supData = srcData.filter((item) => item.type == "支持"); |
||||
|
let oppData = srcData.filter((item) => item.type == "反对"); |
||||
|
addFn(supData); |
||||
|
addFn(oppData); |
||||
|
}; |
||||
|
|
||||
|
const iniChart = function (config, srcData) { |
||||
|
chart = new window.F2.Chart({ |
||||
|
id: "myChart", |
||||
|
...config, |
||||
|
}); |
||||
|
|
||||
|
const supColor = "#FFDA0E"; |
||||
|
const oppColor = "#00E5ED"; |
||||
|
|
||||
|
chart.source(srcData, { |
||||
|
date: { |
||||
|
range: [0, 1], |
||||
|
type: "timeCat", |
||||
|
mask: "MM-DD", |
||||
|
}, |
||||
|
value: { |
||||
|
// type: "linear", |
||||
|
}, |
||||
|
}); |
||||
|
// 设置坐标轴 |
||||
|
chart.axis("date", { |
||||
|
line: { |
||||
|
lineWidth: 1, |
||||
|
stroke: "#E7EEEE", |
||||
|
}, |
||||
|
label: { |
||||
|
fontWeight: 500, |
||||
|
fontSize, |
||||
|
fill: "#B5B7BF", |
||||
|
textBaseline: "middle", |
||||
|
}, |
||||
|
labelOffset: 25, |
||||
|
country: { |
||||
|
range: [0.1, 0.9], // 配置 range 范围,使左右两边不留边距 |
||||
|
}, |
||||
|
grid: null, |
||||
|
}); |
||||
|
chart.axis("value", { |
||||
|
line: { |
||||
|
lineWidth: 1, |
||||
|
stroke: "#E7EEEE", |
||||
|
}, |
||||
|
labelOffset: 20, |
||||
|
label: { |
||||
|
fontWeight: 500, |
||||
|
fontSize, |
||||
|
fill: "#B5B7BF", |
||||
|
}, |
||||
|
}); |
||||
|
// 类别标识区 |
||||
|
chart.legend({ |
||||
|
position: "bottom", |
||||
|
align: "center", |
||||
|
offsetY: -30, |
||||
|
custom: true, |
||||
|
nameStyle: { |
||||
|
fill: "#999", |
||||
|
fontWeight: 500, |
||||
|
fontSize, |
||||
|
}, |
||||
|
itemWidth: 150, |
||||
|
wordSpace: 25, |
||||
|
items: [ |
||||
|
{ |
||||
|
name: "支持", |
||||
|
marker(x, y, r, ctx) { |
||||
|
ctx.lineWidth = 10; |
||||
|
ctx.strokeStyle = supColor; |
||||
|
ctx.moveTo(x - r - 15, y); |
||||
|
ctx.lineTo(x + r + 15, y); |
||||
|
ctx.stroke(); |
||||
|
ctx.fill(); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: "反对", |
||||
|
marker(x, y, r, ctx) { |
||||
|
ctx.lineWidth = 10; |
||||
|
ctx.strokeStyle = oppColor; |
||||
|
ctx.moveTo(x - r - 15, y); |
||||
|
ctx.lineTo(x + r + 15, y); |
||||
|
ctx.stroke(); |
||||
|
ctx.fill(); |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
}); |
||||
|
// 添加折线 |
||||
|
chart |
||||
|
.line() |
||||
|
.position("date*value") |
||||
|
.color("type", (type) => { |
||||
|
if (type === "支持") { |
||||
|
return supColor; |
||||
|
} |
||||
|
return oppColor; |
||||
|
}) |
||||
|
.style("type", { |
||||
|
lineWidth: 1, |
||||
|
}) |
||||
|
.animate(); |
||||
|
chart.render(); |
||||
|
|
||||
|
addTextShape(); |
||||
|
|
||||
|
// 注意:需要把chart return 出来 |
||||
|
return chart; |
||||
|
}; |
||||
|
|
||||
|
export default { |
||||
|
name: "chart", |
||||
|
props: { |
||||
|
list: { |
||||
|
type: Array, |
||||
|
default: () => { |
||||
|
return []; |
||||
|
}, |
||||
|
}, |
||||
|
config: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
width: { |
||||
|
type: Number, |
||||
|
default: 400, |
||||
|
}, |
||||
|
height: { |
||||
|
type: Number, |
||||
|
default: 260, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
iniLoading: false, |
||||
|
}; |
||||
|
}, |
||||
|
watch: { |
||||
|
list(data) { |
||||
|
chart.changeData(data); |
||||
|
srcData = data; |
||||
|
addTextShape(); |
||||
|
}, |
||||
|
}, |
||||
|
async created() { |
||||
|
await nextTick(200); |
||||
|
iniChart(this.config, this.list); |
||||
|
await nextTick(200); |
||||
|
this.iniLoading = true; |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped></style> |
||||