export default {
name: 'LineChart',
data() {
return {
options: {
grid: {
left: 10,
top: 60,
right: 60,
bottom: 10,
containLabel: true,
},
legend: {
show: true,
orient: "horizontal",
icon: "rect",
itemGap: 30,
padding: [6, 10, 5, 10],
itemWidth: 31,
itemHeight: 1,
left: "right",
top: "top",
},
xAxis: {
type: "category",
axisLine: {
show: true,
},
axisTick: {
show: false,
},
data: [],
},
yAxis: {
type: "value",
axisLine: {
show: true,
},
axisTick: {
show: false,
},
},
tooltip: {
show: true,
trigger: "axis",
axisPointer: {
type: "none",
},
},
series: [{
"name": "审计项目数量",
"type": "line"
}, {
"name": "审计合同数量",
"type": "line"
}],
dataset: {
dimensions: ["month", "project_num_month", "contract_num_month", "money"],
source: [{
month: "1月",
auditCount: "223",
contractCount: "265",
payCount: "252",
},
{
month: "2月",
auditCount: "233",
contractCount: "425",
payCount: "352",
},
{
month: "3月",
auditCount: "472",
contractCount: "125",
payCount: "212",
},
{
month: "4月",
auditCount: "125",
contractCount: "325",
payCount: "342",
},
],
},
}
};
},
props: {
source: {
type: Array
}
},
watch: {
source: {
handler(val) {
this.setDataset(val)
},
deep: true
},
cur: {
handler(val) {
this.$emit('search', {
metaDataKey: 'jcjl',
name: 'shijian',
relation: 'EQ',
value: val
})
}
}
},
mounted() {
this.setDataset(this.source || [])
},
methods: {
getMonthAuditCount() {
this.$axios({
method: "post",
url: "app/data/getCustomData",
data: {
"appId": "441640388290150402",
"datasetCode": "sy_money_month",
"current": 1,
"size": 10,
"conditionList": []
}
}).then((res) => {
console.log(res);
})
},
setDataset(val = []) {
console.log(val);
let source = this.options.dataset.source
if (source.length > 0) {
val = source.map(item => {
let find = val.find(i => i.month == item.month) || {}
return {
...item,
...find
}
})
}
console.log(val, 'xxxxxxxx', this.options.dataset)
this.$set(this.options.dataset, "source", val)
},
resize() {
this.$refs.BaseEchart.resizeChart()
}
}
}