卡片添加操作按钮

This commit is contained in:
ngfchl
2022-12-04 19:51:21 +08:00
parent 1d75576d04
commit fdea1e5564

View File

@@ -109,7 +109,13 @@
</div>
<div class="text item" style="font-size: 13px;text-align: right;">
<div>
<el-button type="success" size="mini" @click="showHistoryList(site.id)">历史数据
<el-button type="primary" size="mini" @click="signIn(site.id)">签到
</el-button>
<el-button type="info" size="mini" @click="updateSite(site.id)">更新
</el-button>
<el-button type="danger" size="mini" @click="editSite(site.id)">编辑
</el-button>
<el-button type="success" size="mini" @click="showHistoryList(site.id)">历史 c
</el-button>
</div>
<hr>
@@ -231,26 +237,26 @@
}
const vm = new Vue({
el: '#status',
data() {
return {
chart: null,
ptData: {},
option: {},
showList: false,
showSiteChart: false,
begInvite: false,
showLogo: true,
showLegend: true,
shuffle: false,
el: '#status',
data() {
return {
chart: null,
ptData: {},
option: {},
showList: false,
showSiteChart: false,
begInvite: false,
showLogo: true,
showLegend: true,
shuffle: false,
}
},
beforeMount() {
}
},
beforeMount() {
},
mounted() {
{#this.chart = this.$refs.charts.chart#}
},
mounted() {
{#this.chart = this.$refs.charts.chart#}
this.getData()
},
watch: {
@@ -263,34 +269,43 @@
deep: true,
}
},
methods: {
showHistoryList(id) {
axios.get(
"{% url 'site_data_api' %}" + '?id=' + id
).then(res => {
console.log('获取数据列表成功', res.data)
let data = res.data
if ((typeof res.data) == "string") {
data = JSON.parse(data)
}
{#console.log(typeof res.data.data)#}
if (res.data.code === 0) {
{#this.ptData = res.data.data#}
{#this.ptData = res.data.data#}
{#this.setPie()#}
{#this.setCard()#}
methods: {
signIn(id) {
alert(id)
},
updateSite(id) {
alert(id)
},
editSite(id) {
alert(id)
},
showHistoryList(id) {
axios.get(
"{% url 'site_data_api' %}" + '?id=' + id
).then(res => {
console.log('获取数据列表成功', res.data)
let data = res.data
if ((typeof res.data) == "string") {
data = JSON.parse(data)
}
{#console.log(typeof res.data.data)#}
if (res.data.code === 0) {
{#this.ptData = res.data.data#}
{#this.ptData = res.data.data#}
{#this.setPie()#}
{#this.setCard()#}
this.setLine(data.data)
} else {
this.loading = false
this.$message({
type: 'warning',
message: '获取数据列表失败!'
});
}
})
//.catch(res => {
//console.log('获取数据列表失败', res)
this.setLine(data.data)
} else {
this.loading = false
this.$message({
type: 'warning',
message: '获取数据列表失败!'
});
}
})
//.catch(res => {
//console.log('获取数据列表失败', res)
// this.$message({
// type: 'warning',
// message: '获取数据列表失败!' + res
@@ -311,28 +326,28 @@
this.showLogo = !this.showLogo
this.setPie()
}
,
showLegendMode() {
this.showLegend = !this.showLegend
this.setPie()
}
,
setChartOption(option) {
{#this.option = option#}
if (this.chart) {
this.chart.clear()
,
showLegendMode() {
this.showLegend = !this.showLegend
this.setPie()
}
this.chart.setOption(option)
window.addEventListener("resize", () => {
this.chart.resize()
})
//this.$nextTick(() => {//自适应宽度
// this.chart.resize();
//})
}
,
shuffleList() {
this.shuffle = true
,
setChartOption(option) {
{#this.option = option#}
if (this.chart) {
this.chart.clear()
}
this.chart.setOption(option)
window.addEventListener("resize", () => {
this.chart.resize()
})
//this.$nextTick(() => {//自适应宽度
// this.chart.resize();
//})
}
,
shuffleList() {
this.shuffle = true
this.ptData.status_list.sort(() => {
return Math.random() > 0.5 ? -1 : 1
})
@@ -494,15 +509,15 @@
this.setChartOption(option)
}, 50)
},
setTree() {
let ptData = this.ptData
let begInvite = !this.begInvite
let uploadedList = []
let downloadedList = []
ptData.status_list.forEach((site, index) => {
uploadedList.push({
'value': site.uploaded,
'path': 'uploaded/' + site.name,
setTree() {
let ptData = this.ptData
let begInvite = !this.begInvite
let uploadedList = []
let downloadedList = []
ptData.status_list.forEach((site, index) => {
uploadedList.push({
'value': site.uploaded,
'path': 'uploaded/' + site.name,
'name': `${site.name}\t${renderSize(site.uploaded)}`
})
downloadedList.push({
@@ -779,9 +794,9 @@
},
getData() {
axios.get(
"{% url "site_status_api" %}"
getData() {
axios.get(
"{% url "site_status_api" %}"
).then(res => {
console.log('获取数据列表成功', res.data)
if (res.data.code === 0) {
@@ -797,9 +812,9 @@
message: '获取数据列表失败!'
});
}
}).catch(res => {
console.log('获取数据列表失败', res)
this.$message({
}).catch(res => {
console.log('获取数据列表失败', res)
this.$message({
type: 'warning',
message: '获取数据列表失败!' + res
});