功能完善
This commit is contained in:
@@ -82,7 +82,7 @@ namespace Ewide.Core.Service
|
||||
/// <param name="input"></param>
|
||||
/// <remarks>默认用户名/密码:admin/admin</remarks>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/login")]
|
||||
[HttpPost("/gb/yjb/login")]
|
||||
[AllowAnonymous]
|
||||
[Op(LogOpType.GRANT)]
|
||||
public async Task<LoginOutput> LoginAsync([Required] LoginInput input)
|
||||
|
||||
58
20220330_Vote/Ewide.Core/Util/DEntityExtensions.cs
Normal file
58
20220330_Vote/Ewide.Core/Util/DEntityExtensions.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Furion;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.LinqBuilder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Util
|
||||
{
|
||||
public static class DEntityExtensions
|
||||
{
|
||||
public async static Task<TEntity> InsertOrUpdate<TEntity>(this TEntity entity) where TEntity : DEntityBase, IPrivateEntity, new()
|
||||
{
|
||||
if (entity.Id.IsNullOrEmpty())
|
||||
await entity.SetInsertDefaultValue().InsertAsync();
|
||||
else
|
||||
await entity.SetUpdateDefaultValue().UpdateExcludeAsync(new[] { nameof(entity.CreatedTime), nameof(entity.CreatedUserId), nameof(entity.CreatedUserName) });
|
||||
return entity;
|
||||
}
|
||||
public async static Task<TEntity> InsertOrUpdate<TEntity>(this TEntity entity, bool isInsert) where TEntity : DEntityBase, IPrivateEntity, new()
|
||||
{
|
||||
if (isInsert)
|
||||
await entity.SetInsertDefaultValue().InsertAsync();
|
||||
else
|
||||
await entity.SetUpdateDefaultValue().UpdateAsync();
|
||||
return entity;
|
||||
}
|
||||
public static TEntity SetInsertDefaultValue<TEntity>(this TEntity entity) where TEntity : DEntityBase
|
||||
{
|
||||
if (string.IsNullOrEmpty(entity.Id))
|
||||
entity.Id = Guid.NewGuid().ToString();
|
||||
if (!entity.CreatedTime.HasValue)
|
||||
entity.CreatedTime = DateTime.Now;
|
||||
//if (string.IsNullOrEmpty(entity.CreatedUserId))
|
||||
entity.CreatedUserId = GetUserId();
|
||||
if (string.IsNullOrEmpty(entity.CreatedUserName))
|
||||
entity.CreatedUserName = App.GetService<UserManager>().Name;
|
||||
return entity;
|
||||
}
|
||||
public static TEntity SetUpdateDefaultValue<TEntity>(this TEntity entity) where TEntity : DEntityBase
|
||||
{
|
||||
entity.UpdatedTime = DateTime.Now;
|
||||
entity.UpdatedUserId = GetUserId();
|
||||
entity.UpdatedUserName = App.GetService<UserManager>().Name;
|
||||
return entity;
|
||||
}
|
||||
private static string GetUserId()
|
||||
{
|
||||
var userid = App.GetService<UserManager>().UserId;
|
||||
//if (string.IsNullOrWhiteSpace(userid))
|
||||
// userid = App.GetService<UserManager>().WorkUSERID;
|
||||
return userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace Ewide.Web.Core
|
||||
{
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
pattern: "gb/yjb/{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Web.Entry.Controllers
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class ManageController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public IActionResult Login()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public IActionResult Expert()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -6,6 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Web.Entry.Controllers
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class VoteController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
|
||||
@@ -78,4 +78,28 @@
|
||||
<Folder Include="wwwroot\Upload\Default\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
<HintPath>bin\Debug\net5.0\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI">
|
||||
<HintPath>bin\Debug\net5.0\NPOI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OOXML">
|
||||
<HintPath>bin\Debug\net5.0\NPOI.OOXML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXml4Net">
|
||||
<HintPath>bin\Debug\net5.0\NPOI.OpenXml4Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXmlFormats">
|
||||
<HintPath>bin\Debug\net5.0\NPOI.OpenXmlFormats.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\ExcelTemplate\2021年度甬江杯投票.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
120
20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml
Normal file
120
20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml
Normal file
@@ -0,0 +1,120 @@
|
||||
@*
|
||||
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-table :data="tableData" style="width: 20%;margin:0 auto;">
|
||||
<el-table-column prop="login_code" label="专家"> </el-table-column>
|
||||
<el-table-column prop="is_vote" label="是否投票" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="info" v-if="scope.row.is_vote==true">已投</el-tag>
|
||||
<el-tag type="danger" v-else>未投</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<h3 style="text-align:center;">
|
||||
<el-button @@click="load_vote">刷新数据</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: [],
|
||||
loading: false,
|
||||
token: ''
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.check_login()
|
||||
this.loading = true;
|
||||
this.load_vote();
|
||||
|
||||
},
|
||||
methods: {
|
||||
show_expert_vote() {
|
||||
location = '/gb/yjb/manage/index'
|
||||
},
|
||||
check_login() {
|
||||
this.token = window.sessionStorage.getItem('__TOKEN');
|
||||
if (!this.token)
|
||||
location = '/gb/yjb/manage/login'
|
||||
},
|
||||
|
||||
load_vote() {
|
||||
this.loading = true;
|
||||
let _this = this;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/expert-vote',
|
||||
data: {},
|
||||
responseType: "json",
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + _this.token
|
||||
}
|
||||
}).then(function (response) {
|
||||
_this.tableData = response.data.data
|
||||
console.log(_this.tableData)
|
||||
_this.loading = false;
|
||||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
},
|
||||
loading_false() { this.loading = false },
|
||||
|
||||
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>
|
||||
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>
|
||||
269
20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml
Normal file
269
20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml
Normal file
@@ -0,0 +1,269 @@
|
||||
@*
|
||||
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>
|
||||
<script src="http://lib.baomitu.com/jsencrypt/3.2.1/jsencrypt.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app" v-loading="loading">
|
||||
<h3 style="text-align:center;">后台登录</h3>
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" style="width:500px;margin:0 auto;">
|
||||
<el-form-item label="账号" prop="account">
|
||||
<el-input v-model="ruleForm.account" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="ruleForm.password" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @@click="login('ruleForm')">登录</el-button>
|
||||
@*<el-button @@click="resetForm('ruleForm')">重置</el-button>*@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</body>
|
||||
<style scoped>
|
||||
.buhuanhang {
|
||||
white-space: nowrap;
|
||||
width: 21%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
RSA_PUBLIC_KEY: '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC273zAyijb3uX6O66VThrdfHtzZJn3d/SBM8qiETS7PijyNY3zNecAB+F/owxOWSB/6ojBo5Eu0FCiENxfpenTZB7sKrYu6NVH5gkfHLa6jz4pNzlGP93Q6RON4KjMZolAfRevBQ7vD6sOfJfMDnYi8xk+dRXcqc6PWY8fQiGs5QIDAQAB-----END PUBLIC KEY-----'
|
||||
,
|
||||
ruleForm: {
|
||||
account: '',
|
||||
password: '',
|
||||
},
|
||||
loading: false,
|
||||
rules: {
|
||||
account: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' },
|
||||
{ min: 3, message: '最少 3 个字符', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ min: 5, message: '最少 5 个字符', trigger: 'blur' }
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
methods: {
|
||||
encryptByRSA(message, publicKey) {
|
||||
const Encrypt = new JSEncrypt()
|
||||
Encrypt.setPublicKey(publicKey)
|
||||
return Encrypt.encrypt(message)
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
},
|
||||
login(formName) {
|
||||
let _this = this;
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
_this.ruleForm.password = _this.encryptByRSA(_this.ruleForm.password, _this.RSA_PUBLIC_KEY)
|
||||
//return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/login',
|
||||
data: _this.ruleForm,
|
||||
responseType: "json",
|
||||
}).then(async response => {
|
||||
if (response.data.success != true) {
|
||||
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
//reject();
|
||||
} else {
|
||||
//resolve(true)
|
||||
//location = '/manage/index'
|
||||
if (!response.data.data.passed)
|
||||
_this.$alert(response.data.data.descriptions);
|
||||
else {
|
||||
window.sessionStorage.setItem('__TOKEN', response.data.data.token);
|
||||
location = '/gb/yjb/manage/index'
|
||||
}
|
||||
}
|
||||
_this.loading = false;
|
||||
}).catch(async error => {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
//})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
async checkcode() {
|
||||
let _this = this;
|
||||
//检验码
|
||||
if (this.logincode.length < 6) {
|
||||
this.$alert(`<div>提交码输入错误</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return false;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/check-submit-code',
|
||||
data: { 'code': this.logincode },
|
||||
responseType: "json",
|
||||
}).then(async response => {
|
||||
if (response.data.data != true) {
|
||||
_this.$alert(`<div>提交码输入错误</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
reject();
|
||||
} else {
|
||||
resolve(true)
|
||||
}
|
||||
_this.loading = false;
|
||||
}).catch(async error => {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
})
|
||||
},
|
||||
async submit() {
|
||||
let _this = this;
|
||||
await this.checkcode().then(a => {
|
||||
if (a == false)
|
||||
return;
|
||||
var no_select0 = this.projects0.filter(a => { return !a.vote }).length;
|
||||
var no_select1 = this.projects1.filter(a => { return !a.vote }).length;
|
||||
var no_select2 = this.projects2.filter(a => { return !a.vote }).length;
|
||||
var no_select3 = this.projects3.filter(a => { return !a.vote }).length;
|
||||
var no_select4 = this.projects4.filter(a => { return !a.vote }).length;
|
||||
var no_select5 = this.projects5.filter(a => { return !a.vote }).length;
|
||||
if (no_select0 > 0 || no_select1 > 0 || no_select2 > 0 || no_select3 > 0 || no_select4 > 0 || no_select5 > 0) {
|
||||
this.$alert(`<div>请全部选择完毕后再次提交!</div><p>目前[房建工程]未选择的有` + no_select0 + `个</p><p>目前[市政工程]未选择的有` + no_select1 + `个</p><p>目前[轨道工程]未选择的有` + no_select2 + `个</p><p>目前[电力工程]未选择的有` + no_select3 + `个</p><p>目前[交通工程]未选择的有` + no_select4 + `个</p><p>目前[水利工程]未选择的有` + no_select5 + `个</p>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
//每个专业必须有一个不同意
|
||||
no_select0 = this.projects0.filter(a => { return a.vote == "false" }).length;
|
||||
no_select1 = this.projects1.filter(a => { return a.vote == "false" }).length;
|
||||
no_select2 = this.projects2.filter(a => { return a.vote == "false" }).length;
|
||||
no_select3 = this.projects3.filter(a => { return a.vote == "false" }).length;
|
||||
no_select4 = this.projects4.filter(a => { return a.vote == "false" }).length;
|
||||
no_select5 = this.projects5.filter(a => { return a.vote == "false" }).length;
|
||||
if (no_select0 < 1 || no_select1 < 1 || no_select2 < 1 || no_select3 < 1 || no_select4 < 1 || no_select5 < 1) {
|
||||
this.$alert(`<div>每个专业必须有一个不同意!</div><p>目前[房建工程]不同意的有` + no_select0 + `个</p><p>目前[市政工程]不同意的有` + no_select1 + `个</p><p>目前[轨道工程]不同意的有` + no_select2 + `个</p><p>目前[电力工程]不同意的有` + no_select3 + `个</p><p>目前[交通工程]不同意的有` + no_select4 + `个</p><p>目前[水利工程]不同意的有` + no_select5 + `个</p>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
var allselects = this.projects0.concat(this.projects1).concat(this.projects2).concat(this.projects3).concat(this.projects4).concat(this.projects5);
|
||||
console.log('allselects:', allselects)
|
||||
if (allselects.filter(a => { return a.vote == "false" }).length < 10) {
|
||||
this.$alert(`<div>不同意总数不能少于10个!</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
var allselects = this.projects0.concat(this.projects1).concat(this.projects2).concat(this.projects3).concat(this.projects4).concat(this.projects5);
|
||||
this.$confirm('您此次选择了同意' + allselects.filter(a => { return a.vote == "true" }).length + '个,不同意' + allselects.filter(a => { return a.vote == "false" }).length + '个,是否继续提交?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
_this.loading = true;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/submit-vote',
|
||||
data: { 'code': this.logincode, 'projects': allselects },
|
||||
responseType: "json",
|
||||
}).then(async response => {
|
||||
if (response.data.data != true) {
|
||||
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
} else {
|
||||
_this.$alert(`<div>提交成功</div>`, '成功', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
}
|
||||
_this.loading = false;
|
||||
}).catch(async error => {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
load_projects() {
|
||||
let _this = this;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/list',
|
||||
data: {},
|
||||
responseType: "json",
|
||||
}).then(function (response) {
|
||||
_this.projects = response.data.data
|
||||
_this.projects0 = _this.projects.filter(a => { return a.type == 0; })
|
||||
_this.projects1 = _this.projects.filter(a => { return a.type == 1; })
|
||||
_this.projects2 = _this.projects.filter(a => { return a.type == 2; })
|
||||
_this.projects3 = _this.projects.filter(a => { return a.type == 3; })
|
||||
_this.projects4 = _this.projects.filter(a => { return a.type == 4; })
|
||||
_this.projects5 = _this.projects.filter(a => { return a.type == 5; })
|
||||
_this.loading = false;
|
||||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
},
|
||||
loading_false() { this.loading = false },
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>@ViewData["Title"] - Furion</title>
|
||||
<title>2021年度宁波市“甬江建设杯”选票</title>
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
||||
@@ -3,3 +3,292 @@
|
||||
*@
|
||||
@{
|
||||
}
|
||||
|
||||
<!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>
|
||||
<el-collapse-item title="房建工程" name="1">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects0" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="市政工程" name="2">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects1" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="轨道工程" name="3">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects2" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="电力工程" name="4">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects3" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="交通工程" name="5">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects4" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="水利工程" name="6">
|
||||
<el-descriptions class="margin-top" title="" :column="1" border v-for="project in projects5" :key="project.id">
|
||||
<el-descriptions-item label-class-name="buhuanhang" label="项目名称">{{project.serial_number}}:{{project.name}}</el-descriptions-item>
|
||||
<el-descriptions-item label="请投票">
|
||||
<template>
|
||||
<el-radio-group v-model="project.vote">
|
||||
<el-radio label="true">同意</el-radio>
|
||||
<el-radio label="false">不同意</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
<h3 style="text-align:center;">
|
||||
<el-input v-model="logincode" placeholder="请输入提交码"></el-input>
|
||||
</h3>
|
||||
<h3 style="text-align:center;">
|
||||
<el-button @@click="alltrue">全部同意</el-button>
|
||||
<el-button type="primary" @@click="submit">提交</el-button>
|
||||
</h3>
|
||||
</div>
|
||||
</body>
|
||||
<style scoped>
|
||||
.buhuanhang {
|
||||
white-space: nowrap;
|
||||
width: 21%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
projects: [],
|
||||
projects0: [],
|
||||
projects1: [],
|
||||
projects2: [],
|
||||
projects3: [],
|
||||
projects4: [],
|
||||
projects5: [],
|
||||
confirm_title: '',
|
||||
loading: false,
|
||||
logincode: ''
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.loading = true;
|
||||
this.load_projects();
|
||||
|
||||
},
|
||||
methods: {
|
||||
alltrue() {
|
||||
this.projects0 = this.projects0.map(a => { a.vote = "true"; return a; });
|
||||
this.projects1 = this.projects1.map(a => { a.vote = "true"; return a; });
|
||||
this.projects2 = this.projects2.map(a => { a.vote = "true"; return a; });
|
||||
this.projects3 = this.projects3.map(a => { a.vote = "true"; return a; });
|
||||
this.projects4 = this.projects4.map(a => { a.vote = "true"; return a; });
|
||||
this.projects5 = this.projects5.map(a => { a.vote = "true"; return a; });
|
||||
},
|
||||
async checkcode() {
|
||||
let _this = this;
|
||||
//检验码
|
||||
if (this.logincode.length < 6) {
|
||||
this.$alert(`<div>提交码输入错误</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return false;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/check-submit-code',
|
||||
data: { 'code': this.logincode },
|
||||
responseType: "json",
|
||||
}).then(async response => {
|
||||
if (response.data.data != true) {
|
||||
_this.$alert(`<div>提交码输入错误</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
reject();
|
||||
} else {
|
||||
resolve(true)
|
||||
}
|
||||
_this.loading = false;
|
||||
}).catch(async error => {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
})
|
||||
},
|
||||
async submit() {
|
||||
let _this = this;
|
||||
await this.checkcode().then(a => {
|
||||
if (a == false)
|
||||
return;
|
||||
var no_select0 = this.projects0.filter(a => { return !a.vote }).length;
|
||||
var no_select1 = this.projects1.filter(a => { return !a.vote }).length;
|
||||
var no_select2 = this.projects2.filter(a => { return !a.vote }).length;
|
||||
var no_select3 = this.projects3.filter(a => { return !a.vote }).length;
|
||||
var no_select4 = this.projects4.filter(a => { return !a.vote }).length;
|
||||
var no_select5 = this.projects5.filter(a => { return !a.vote }).length;
|
||||
if (no_select0 > 0 || no_select1 > 0 || no_select2 > 0 || no_select3 > 0 || no_select4 > 0 || no_select5 > 0) {
|
||||
this.$alert(`<div>请全部选择完毕后再次提交!</div><p>目前[房建工程]未选择的有` + no_select0 + `个</p><p>目前[市政工程]未选择的有` + no_select1 + `个</p><p>目前[轨道工程]未选择的有` + no_select2 + `个</p><p>目前[电力工程]未选择的有` + no_select3 + `个</p><p>目前[交通工程]未选择的有` + no_select4 + `个</p><p>目前[水利工程]未选择的有` + no_select5 + `个</p>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
//每个专业必须有一个不同意
|
||||
no_select0 = this.projects0.filter(a => { return a.vote == "false" }).length;
|
||||
no_select1 = this.projects1.filter(a => { return a.vote == "false" }).length;
|
||||
no_select2 = this.projects2.filter(a => { return a.vote == "false" }).length;
|
||||
no_select3 = this.projects3.filter(a => { return a.vote == "false" }).length;
|
||||
no_select4 = this.projects4.filter(a => { return a.vote == "false" }).length;
|
||||
no_select5 = this.projects5.filter(a => { return a.vote == "false" }).length;
|
||||
if (no_select0 < 1 || no_select1 < 1 || no_select2 < 1 || no_select3 < 1 || no_select4 < 1 || no_select5 < 1) {
|
||||
this.$alert(`<div>每个专业必须有一个不同意!</div><p>目前[房建工程]不同意的有` + no_select0 + `个</p><p>目前[市政工程]不同意的有` + no_select1 + `个</p><p>目前[轨道工程]不同意的有` + no_select2 + `个</p><p>目前[电力工程]不同意的有` + no_select3 + `个</p><p>目前[交通工程]不同意的有` + no_select4 + `个</p><p>目前[水利工程]不同意的有` + no_select5 + `个</p>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
var allselects = this.projects0.concat(this.projects1).concat(this.projects2).concat(this.projects3).concat(this.projects4).concat(this.projects5);
|
||||
console.log('allselects:', allselects)
|
||||
if (allselects.filter(a => { return a.vote == "false" }).length < 10) {
|
||||
this.$alert(`<div>不同意总数不能少于10个!</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
return;
|
||||
}
|
||||
var allselects = this.projects0.concat(this.projects1).concat(this.projects2).concat(this.projects3).concat(this.projects4).concat(this.projects5);
|
||||
this.$confirm('您此次选择了同意' + allselects.filter(a => { return a.vote == "true" }).length + '个,不同意' + allselects.filter(a => { return a.vote == "false" }).length + '个,是否继续提交?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
_this.loading = true;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/submit-vote',
|
||||
data: { 'code': this.logincode, 'projects': allselects },
|
||||
responseType: "json",
|
||||
}).then(async response => {
|
||||
if (response.data.data != true) {
|
||||
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
} else {
|
||||
_this.$alert(`<div>提交成功</div>`, '成功', {
|
||||
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
|
||||
}).then(a => { }).catch(err => { console.log(err) });
|
||||
}
|
||||
_this.loading = false;
|
||||
}).catch(async error => {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
load_projects() {
|
||||
let _this = this;
|
||||
axios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
method: 'post',
|
||||
url: '/gb/yjb/api/projects/list',
|
||||
data: {},
|
||||
responseType: "json",
|
||||
}).then(function (response) {
|
||||
_this.projects = response.data.data
|
||||
_this.projects.map(a => { a.vote = !a.vote ? '' : a.vote.toString(); return a; });
|
||||
_this.projects0 = _this.projects.filter(a => { return a.type == 0; })
|
||||
_this.projects1 = _this.projects.filter(a => { return a.type == 1; })
|
||||
_this.projects2 = _this.projects.filter(a => { return a.type == 2; })
|
||||
_this.projects3 = _this.projects.filter(a => { return a.type == 3; })
|
||||
_this.projects4 = _this.projects.filter(a => { return a.type == 4; })
|
||||
_this.projects5 = _this.projects.filter(a => { return a.type == 5; })
|
||||
_this.loading = false;
|
||||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
_this.$message({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
})
|
||||
_this.loading = false;
|
||||
})
|
||||
},
|
||||
loading_false() { this.loading = false },
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Binary file not shown.
@@ -1,9 +1,13 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Ewide.Core.Util;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,12 +19,17 @@ namespace Vote.Services.ApiController
|
||||
/// 项目
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Vote", Order = 0)]
|
||||
[Route("/gb/yjb/api/projects")]
|
||||
public class ProjectsService : IDynamicApiController
|
||||
{
|
||||
private readonly IRepository<Entities.Projects> rep_Projects;
|
||||
public ProjectsService(IRepository<Entities.Projects> _rep_Projects)
|
||||
private readonly IRepository<Entities.Experts> rep_Experts;
|
||||
private readonly IRepository<Entities.VoteRecords> rep_VoteRecords;
|
||||
public ProjectsService(IRepository<Entities.Projects> _rep_Projects, IRepository<Entities.Experts> _rep_Experts, IRepository<Entities.VoteRecords> _rep_VoteRecords)
|
||||
{
|
||||
rep_Projects = _rep_Projects;
|
||||
rep_Experts = _rep_Experts;
|
||||
rep_VoteRecords = _rep_VoteRecords;
|
||||
}
|
||||
/// <summary>
|
||||
/// 列表
|
||||
@@ -28,14 +37,153 @@ namespace Vote.Services.ApiController
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
public async Task<dynamic> List()
|
||||
public async Task<dynamic> List(ProjectsInput args)
|
||||
{
|
||||
var data = await rep_Projects.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
//.ProjectToType<ProjectsOutput>()
|
||||
.Where(args.type != null, a => (int)a.type == args.type)
|
||||
.ProjectToType<ProjectsOutput>()
|
||||
.OrderBy(a => a.serial_number)
|
||||
.ToPagedListAsync();
|
||||
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检验提交码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
public async Task<dynamic> CheckSubmitCode(CheckSubmitCodeInput args)
|
||||
{
|
||||
var data = await rep_Experts.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
.Where(a => a.login_code == args.code)
|
||||
.FirstOrDefaultAsync();
|
||||
return data != null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
public async Task<dynamic> SubmitSubmitVote(SubmitInput args)
|
||||
{
|
||||
var data = await rep_Experts.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
.Where(a => a.login_code == args.code)
|
||||
.FirstOrDefaultAsync();
|
||||
_ = (data == null) ? throw Oops.Oh("提交码错误") : 1;
|
||||
//var list = args.projects.Adapt<List<Entities.VoteRecords>>();
|
||||
//删除这个专家上次提交的结果
|
||||
//或者提示不能再次提交
|
||||
_ = (await rep_VoteRecords.DetachedEntities.Where(a => !a.IsDeleted && a.expert_login_code == args.code).CountAsync() > 0) ? throw Oops.Oh("已提交,无需再次提交") : 1;
|
||||
var now = DateTime.Now;
|
||||
args.projects.ForEach(async a =>
|
||||
{
|
||||
var model = new Entities.VoteRecords
|
||||
{
|
||||
expert_login_code = args.code,
|
||||
project_id = a.id,
|
||||
is_agree = a.vote,
|
||||
vote_time = now
|
||||
};
|
||||
await model.InsertOrUpdate();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
private async Task<List<ProjectsList2Output>> GetVoteData()
|
||||
{
|
||||
var query = from a in rep_Projects.DetachedEntities
|
||||
join b in rep_VoteRecords.DetachedEntities
|
||||
on a.Id equals b.project_id into grouping
|
||||
from p in grouping.DefaultIfEmpty()
|
||||
group new { a, p } by new { a.Id, a.name, a.serial_number, a.type } into pp
|
||||
select new ProjectsList2Output
|
||||
{
|
||||
serial_number = pp.Key.serial_number,
|
||||
id = pp.Key.Id,
|
||||
name = pp.Key.name,
|
||||
yes_count = pp.Where(a => a.p.is_agree).Count(),
|
||||
no_count = pp.Where(a => !a.p.is_agree).Count(),
|
||||
type = pp.Key.type
|
||||
};
|
||||
return await query.OrderBy(a => a.serial_number).ToListAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> List2()
|
||||
{
|
||||
|
||||
//var data = rep_Projects.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
// //.Where(args.type != null, a => (int)a.type == args.type)
|
||||
// .Join(rep_VoteRecords.DetachedEntities, a => a.Id, a => a.project_id, (a, b) =>
|
||||
// new
|
||||
// {
|
||||
// //a.Id,
|
||||
// //type = (int)a.type,
|
||||
// //serial_number = a.serial_number,
|
||||
// //name = a.name,
|
||||
// //no_count = b.Where(bb => !bb.is_agree).Count(),
|
||||
// //yes_count = b.Where(bb => bb.is_agree).Count(),
|
||||
// }).ToList();
|
||||
////.ProjectToType<ProjectsList2Output>()
|
||||
////.OrderBy(a => a.serial_number)
|
||||
////.ToListAsync();
|
||||
var data = await GetVoteData();
|
||||
var data0 = data.Where(a => a.type == Entities.EnumProjectType.FangJian).ToList();
|
||||
var data1 = data.Where(a => a.type == Entities.EnumProjectType.ShiZheng).ToList();
|
||||
var data2 = data.Where(a => a.type == Entities.EnumProjectType.GuiDaoGongCheng).ToList();
|
||||
var data3 = data.Where(a => a.type == Entities.EnumProjectType.DianLiGongCheng).ToList();
|
||||
var data4 = data.Where(a => a.type == Entities.EnumProjectType.JiaoTongGongCheng).ToList();
|
||||
var data5 = data.Where(a => a.type == Entities.EnumProjectType.ShuiLiGongCheng).ToList();
|
||||
return new
|
||||
{
|
||||
data0,
|
||||
data1,
|
||||
data2,
|
||||
data3,
|
||||
data4,
|
||||
data5
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> Download()
|
||||
{
|
||||
var data = await GetVoteData();
|
||||
var filepath = Tools.ExcelHelper.WriteTemplate(data, 4, "C");
|
||||
return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath };
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> ExpertVote()
|
||||
{
|
||||
var list = await rep_Experts.DetachedEntities.GroupJoin(rep_VoteRecords.DetachedEntities, a => a.login_code, a => a.expert_login_code, (a, b) => new { a, b })
|
||||
.SelectMany(a => a.b.DefaultIfEmpty(), (a, b) => new { a.a.Id, a.a.login_code, is_vote = b != null })
|
||||
.Distinct().ToListAsync();
|
||||
return list;
|
||||
//var query = from a in rep_Experts.DetachedEntities
|
||||
// join b in rep_VoteRecords.DetachedEntities on a.login_code equals b.expert_login_code into temp
|
||||
// from tt in temp.DefaultIfEmpty()
|
||||
// select new
|
||||
// {
|
||||
// a.Id,
|
||||
// a.login_code,
|
||||
// is_vote = tt == null
|
||||
// };
|
||||
//return await query.ToListAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Ewide.Core.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -10,9 +11,17 @@ namespace Vote.Services.Dto
|
||||
{
|
||||
public class ProjectsInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目类型
|
||||
/// </summary>
|
||||
public int? type { get; set; }
|
||||
}
|
||||
public class ProjectsOutput
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 项目序号
|
||||
/// </summary>
|
||||
@@ -35,5 +44,71 @@ namespace Vote.Services.Dto
|
||||
return type.GetEnumDescription();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool vote { get; set; } = false;
|
||||
}
|
||||
public class CheckSubmitCodeInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string code { get; set; }
|
||||
}
|
||||
public class SubmitInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string code { get; set; }
|
||||
[Required]
|
||||
public List<ProjectsOutput> projects { get; set; }
|
||||
}
|
||||
|
||||
public class ProjectsList2Output
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 项目序号
|
||||
/// </summary>
|
||||
public int serial_number { get; set; }
|
||||
/// <summary>
|
||||
/// 工程名称
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
public int no_count { get; set; }
|
||||
public int yes_count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool is_agree
|
||||
{
|
||||
get
|
||||
{
|
||||
return yes_count >= 12;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目类型
|
||||
/// </summary>
|
||||
public EnumProjectType type { get; set; }
|
||||
/// <summary>
|
||||
/// 项目类型
|
||||
/// </summary>
|
||||
public string type_title
|
||||
{
|
||||
get
|
||||
{
|
||||
return type.GetEnumDescription();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
212
20220330_Vote/Vote.Services/Tools/ExcelHelper.cs
Normal file
212
20220330_Vote/Vote.Services/Tools/ExcelHelper.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using Furion;
|
||||
using Furion.FriendlyException;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Vote.Services.Dto;
|
||||
|
||||
namespace Vote.Services.Tools
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class ExcelHelper
|
||||
{
|
||||
static ExcelHelper()
|
||||
{
|
||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断是否为兼容模式
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetIsCompatible(string filePath)
|
||||
{
|
||||
return filePath.EndsWith(".xls", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建工作薄
|
||||
/// </summary>
|
||||
/// <param name="isCompatible"></param>
|
||||
/// <returns></returns>
|
||||
public static IWorkbook CreateWorkbook(bool isCompatible)
|
||||
{
|
||||
if (isCompatible)
|
||||
{
|
||||
return new HSSFWorkbook();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new XSSFWorkbook();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建工作薄(依据文件流)
|
||||
/// </summary>
|
||||
/// <param name="isCompatible"></param>
|
||||
/// <param name="stream"></param>
|
||||
/// <returns></returns>
|
||||
public static IWorkbook CreateWorkbook(bool isCompatible, dynamic stream)
|
||||
{
|
||||
if (isCompatible)
|
||||
{
|
||||
return new HSSFWorkbook(stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new XSSFWorkbook(stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 列名字母转索引
|
||||
/// </summary>
|
||||
/// <param name="columnName"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToExcelColumnIndex(this string columnName)
|
||||
{
|
||||
if (!Regex.IsMatch(columnName.ToUpper(), @"[A-Z]+")) { throw new Exception("invalid parameter"); }
|
||||
int index = 0;
|
||||
char[] chars = columnName.ToUpper().ToCharArray();
|
||||
for (int i = 0; i < chars.Length; i++)
|
||||
{
|
||||
index += ((int)chars[i] - (int)'A' + 1) * (int)Math.Pow(26, chars.Length - i - 1);
|
||||
}
|
||||
return index - 1;
|
||||
}
|
||||
/// <summary>
|
||||
/// 列索引转字母
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToExcelColumnName(this int index)
|
||||
{
|
||||
if (index < 0) { throw new Exception("invalid parameter"); }
|
||||
List<string> chars = new List<string>();
|
||||
do
|
||||
{
|
||||
if (chars.Count > 0) index--;
|
||||
chars.Insert(0, ((char)(index % 26 + (int)'A')).ToString());
|
||||
index = (int)((index - index % 26) / 26);
|
||||
} while (index > 0);
|
||||
return String.Join(string.Empty, chars.ToArray());
|
||||
}
|
||||
|
||||
|
||||
private static List<ProjectsList2Output> GetDataByType(List<ProjectsList2Output> list, Entities.EnumProjectType type)
|
||||
{
|
||||
return list.Where(a => a.type == type).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string WriteTemplate(List<ProjectsList2Output> list, int start_row, string start_column)
|
||||
{
|
||||
try
|
||||
{
|
||||
string template_name = "2021年度甬江杯投票.xlsx";
|
||||
string excelFilePath = $"{App.WebHostEnvironment.WebRootPath}\\ExcelTemplate\\{template_name}";
|
||||
string outputPath = string.Empty;
|
||||
if (!string.IsNullOrEmpty(excelFilePath))
|
||||
{
|
||||
using (FileStream excelFileStream = System.IO.File.OpenRead(excelFilePath))
|
||||
{
|
||||
bool isCompatible = ExcelHelper.GetIsCompatible(excelFilePath);
|
||||
IWorkbook workbook = ExcelHelper.CreateWorkbook(isCompatible, excelFileStream);
|
||||
ISheet sheet = null;
|
||||
sheet = workbook.GetSheetAt(1);
|
||||
Dictionary<string, string> dic_sheet_config = new Dictionary<string, string>();
|
||||
var data = GetDataByType(list, Entities.EnumProjectType.FangJian);
|
||||
//从第几行开始 , 比如 行号是4 , 就写3
|
||||
var startRowIndex = start_row - 1;
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var length0 = data.Count;
|
||||
data = GetDataByType(list, Entities.EnumProjectType.ShiZheng);
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = length0 + 1 + startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var length1 = data.Count;
|
||||
data = GetDataByType(list, Entities.EnumProjectType.GuiDaoGongCheng);
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = length0 + 1 + length1 + 1 + startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var length2 = data.Count;
|
||||
data = GetDataByType(list, Entities.EnumProjectType.DianLiGongCheng);
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var length3 = data.Count;
|
||||
data = GetDataByType(list, Entities.EnumProjectType.JiaoTongGongCheng);
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + length3 + 1 + startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var length4 = data.Count;
|
||||
data = GetDataByType(list, Entities.EnumProjectType.ShuiLiGongCheng);
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + length3 + 1 + length4 + 1 + startRowIndex + i;
|
||||
int cell_start_index = start_column.ToExcelColumnIndex();
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
|
||||
sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
|
||||
}
|
||||
var file = new FileInfo(excelFilePath);
|
||||
var savePath = file.DirectoryName + "\\OutPut\\";
|
||||
if (!Directory.Exists(savePath))
|
||||
Directory.CreateDirectory(savePath);
|
||||
outputPath = savePath + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + template_name;
|
||||
using (var filess = new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
workbook.Write(filess);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outputPath;
|
||||
}
|
||||
catch (System.IO.IOException ioex)
|
||||
{
|
||||
throw Oops.Oh("文件被占用,请检查文件模板");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,22 @@
|
||||
<ProjectReference Include="..\Ewide.Core\Ewide.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
<HintPath>..\Ewide.Web.Entry\bin\Debug\net5.0\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI">
|
||||
<HintPath>..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OOXML">
|
||||
<HintPath>..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OOXML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXml4Net">
|
||||
<HintPath>..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OpenXml4Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NPOI.OpenXmlFormats">
|
||||
<HintPath>..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OpenXmlFormats.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -9,12 +9,52 @@
|
||||
项目
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.List">
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.List(Vote.Services.Dto.ProjectsInput)">
|
||||
<summary>
|
||||
列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.CheckSubmitCode(Vote.Services.Dto.CheckSubmitCodeInput)">
|
||||
<summary>
|
||||
检验提交码
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.SubmitSubmitVote(Vote.Services.Dto.SubmitInput)">
|
||||
<summary>
|
||||
提交
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.List2">
|
||||
<summary>
|
||||
列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.Download">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.ApiController.ProjectsService.ExpertVote">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsInput.type">
|
||||
<summary>
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsOutput.id">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsOutput.serial_number">
|
||||
<summary>
|
||||
项目序号
|
||||
@@ -35,6 +75,51 @@
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsOutput.vote">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.CheckSubmitCodeInput.code">
|
||||
<summary>
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.SubmitInput.code">
|
||||
<summary>
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.id">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.serial_number">
|
||||
<summary>
|
||||
项目序号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.name">
|
||||
<summary>
|
||||
工程名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.is_agree">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.type">
|
||||
<summary>
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Vote.Services.Dto.ProjectsList2Output.type_title">
|
||||
<summary>
|
||||
项目类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Vote.Services.Entities.Experts">
|
||||
<summary>
|
||||
专家表
|
||||
@@ -130,5 +215,52 @@
|
||||
投票时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Vote.Services.Tools.ExcelHelper">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.GetIsCompatible(System.String)">
|
||||
<summary>
|
||||
判断是否为兼容模式
|
||||
</summary>
|
||||
<param name="filePath"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.CreateWorkbook(System.Boolean)">
|
||||
<summary>
|
||||
创建工作薄
|
||||
</summary>
|
||||
<param name="isCompatible"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.CreateWorkbook(System.Boolean,System.Object)">
|
||||
<summary>
|
||||
创建工作薄(依据文件流)
|
||||
</summary>
|
||||
<param name="isCompatible"></param>
|
||||
<param name="stream"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.ToExcelColumnIndex(System.String)">
|
||||
<summary>
|
||||
列名字母转索引
|
||||
</summary>
|
||||
<param name="columnName"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.ToExcelColumnName(System.Int32)">
|
||||
<summary>
|
||||
列索引转字母
|
||||
</summary>
|
||||
<param name="index"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Vote.Services.Tools.ExcelHelper.WriteTemplate(System.Collections.Generic.List{Vote.Services.Dto.ProjectsList2Output},System.Int32,System.String)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
Reference in New Issue
Block a user