283 lines
14 KiB
HTML
283 lines
14 KiB
HTML
|
|
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<link rel="stylesheet" href="/lib/element-ui/theme-chalk/index.css">
|
|
<script src="/lib/vue2/vue.min.js"></script>
|
|
<script src="/lib/element-ui/theme-chalk/index.js"></script>
|
|
<script src="/lib/axios/axios.min.js"></script>
|
|
<script src="/lib/qs/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 v-for="(prolist,idx) in tableData" :title="prolist.name" :name="idx" v-show="prolist.data.length>0" :key="idx">
|
|
<el-table :data="prolist.data" 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="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 {
|
|
tableData: [],
|
|
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'
|
|
location = 'Expert.html'
|
|
},
|
|
export_excel() {
|
|
this.download('/gb/yjb/api/projects/download', this.dateFormat("YYYYmmddHHMMSS", new Date()) + "-2022年度甬江杯投票.xlsx", this.loading_false);
|
|
},
|
|
check_login() {
|
|
this.token = window.sessionStorage.getItem('__TOKEN');
|
|
if (!this.token)
|
|
location = '../manage/login.html'
|
|
},
|
|
|
|
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.tableData = [];
|
|
console.log(response)
|
|
var _data = response.data.data.data
|
|
var typeList = response.data.data.typeList
|
|
for (var i = 0; i < typeList.length; i++) {
|
|
var _p = _data.filter(a => { return a.type == i; });
|
|
_this.tableData.push({ name: typeList[i], data: _p })
|
|
}
|
|
console.log(_this.tableData)
|
|
//_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> |