功能完善
This commit is contained in:
260
20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml
Normal file
260
20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml
Normal file
@@ -0,0 +1,260 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
||||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script src="http://lib.baomitu.com/qs/6.10.3/qs.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app" v-loading="loading">
|
||||
<h3 style="text-align:center;">2021年度宁波市“甬江建设杯”选票结果</h3>
|
||||
<el-collapse style="width: 80%;margin:0 auto;">
|
||||
<el-collapse-item title="房建工程" name="1">
|
||||
<el-table :data="tableData0" style="width:95%;margin:0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="市政工程" name="2">
|
||||
<el-table :data="tableData1" style="width: 95%; margin: 0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="轨道工程" name="3">
|
||||
<el-table :data="tableData2" style="width: 95%; margin: 0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="电力工程" name="4">
|
||||
<el-table :data="tableData3" style="width: 95%; margin: 0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="交通工程" name="5">
|
||||
<el-table :data="tableData4" style="width: 95%; margin: 0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="水利工程" name="6">
|
||||
<el-table :data="tableData5" style="width: 95%; margin: 0 auto;">
|
||||
<el-table-column prop="serial_number" label="序号" width="120"> </el-table-column>
|
||||
<el-table-column prop="name" label="工程名称"> </el-table-column>
|
||||
<el-table-column prop="no_count" label="不同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="yes_count" label="同意票数" width="120"> </el-table-column>
|
||||
<el-table-column prop="is_agree" label="是否通过" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_agree==true">通过</el-tag>
|
||||
<el-tag type="danger" v-else>不通过</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
</el-collapsestyle="width:>
|
||||
|
||||
|
||||
<h3 style="text-align:center;">
|
||||
<el-button @@click="load_projects">刷新数据</el-button>
|
||||
<el-button type="primary" @@click="export_excel">导出Excel</el-button>
|
||||
<el-button @@click="show_expert_vote">查看专家投票情况</el-button>
|
||||
</h3>
|
||||
</div>
|
||||
</body>
|
||||
<style scoped>
|
||||
.buhuanhang {
|
||||
white-space: nowrap;
|
||||
width: 21%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
tableData0: [],
|
||||
tableData1: [],
|
||||
tableData2: [],
|
||||
tableData3: [],
|
||||
tableData4: [],
|
||||
tableData5: [],
|
||||
loading: false,
|
||||
token: ''
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.check_login()
|
||||
this.loading = true;
|
||||
this.load_projects();
|
||||
|
||||
},
|
||||
methods: {
|
||||
show_expert_vote() {
|
||||
location = '/gb/yjb/manage/expert'
|
||||
},
|
||||
export_excel() {
|
||||
this.download('/gb/yjb/api/projects/download', this.dateFormat("YYYYmmddHHMMss", new Date()) + "-2021年度甬江杯投票.xlsx", this.loading_false);
|
||||
},
|
||||
check_login() {
|
||||
this.token = window.sessionStorage.getItem('__TOKEN');
|
||||
if (!this.token)
|
||||
location = '/gb/yjb/manage/login'
|
||||
},
|
||||
|
||||
load_projects() {
|
||||
this.loading = true;
|
||||
let _this = this;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/list2',
|
||||
data: {},
|
||||
responseType: "json",
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + _this.token
|
||||
}
|
||||
}).then(function (response) {
|
||||
_this.tableData0 = response.data.data.data0
|
||||
_this.tableData1 = response.data.data.data1
|
||||
_this.tableData2 = response.data.data.data2
|
||||
_this.tableData3 = response.data.data.data3
|
||||
_this.tableData4 = response.data.data.data4
|
||||
_this.tableData5 = response.data.data.data5
|
||||
console.log(_this.tableData0)
|
||||
_this.loading = false;
|
||||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
},
|
||||
loading_false() { this.loading = false },
|
||||
|
||||
download(url, filename, callback) {
|
||||
let _this = this;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: url,
|
||||
data: {},
|
||||
responseType: "blob",
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + _this.token
|
||||
}
|
||||
}).then(function (response) {
|
||||
console.log(response);
|
||||
//解析文件充blod中解析
|
||||
const url = window.URL.createObjectURL(
|
||||
new Blob([response.data], { type: "application/vnd.ms-excel" })
|
||||
);
|
||||
const link = document.createElement("a");
|
||||
link.style.display = "none";
|
||||
link.href = url;
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
callback();
|
||||
}).catch(function (error) {
|
||||
callback();
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
})
|
||||
},
|
||||
getMonthWeek(now) {
|
||||
var a = now.getYear();
|
||||
var b = now.getMonth() + 1;
|
||||
var c = now.getDate();
|
||||
/*
|
||||
a = d = 当前日期
|
||||
b = 6 - w = 当前周的还有几天过完(不算今天)
|
||||
a + b 的和在除以7 就是当天是当前月份的第几周
|
||||
*/
|
||||
var date = new Date(a, parseInt(b) - 1, c), w = date.getDay(), d = date.getDate();
|
||||
return Math.ceil(
|
||||
(d + 6 - w) / 7
|
||||
);
|
||||
},
|
||||
dateFormat(fmt, date) {
|
||||
let ret;
|
||||
const opt = {
|
||||
"Y+": date.getFullYear().toString(), // 年
|
||||
"m+": (date.getMonth() + 1).toString(), // 月
|
||||
"d+": date.getDate().toString(), // 日
|
||||
"H+": date.getHours().toString(), // 时
|
||||
"M+": date.getMinutes().toString(), // 分
|
||||
"S+": date.getSeconds().toString() // 秒
|
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||||
};
|
||||
for (let k in opt) {
|
||||
ret = new RegExp("(" + k + ")").exec(fmt);
|
||||
if (ret) {
|
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||||
};
|
||||
};
|
||||
return fmt;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user