增加新增专家功能
This commit is contained in:
@@ -27,7 +27,34 @@
|
|||||||
<h3 style="text-align:center;">
|
<h3 style="text-align:center;">
|
||||||
<el-button @click="load_vote">刷新数据</el-button>
|
<el-button @click="load_vote">刷新数据</el-button>
|
||||||
<el-button @click="show_expert_vote">查看项目投票情况</el-button>
|
<el-button @click="show_expert_vote">查看项目投票情况</el-button>
|
||||||
|
<el-button @click="show_dialog">新增专家</el-button>
|
||||||
</h3>
|
</h3>
|
||||||
|
<el-dialog title="新增专家" :visible.sync="dialogVisible" width="20%">
|
||||||
|
<div class="blocks">
|
||||||
|
<el-input v-model="addexpertnum" placeholder="输入新增专家个数" style="width:100px"></el-input>
|
||||||
|
<el-button @click="add_expert">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--<el-dialog v-model="dialogVisible" title="弹框" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" append-to-body width="60%">
|
||||||
|
<el-form :model="pageData.loginForm" ref="loginFormRef" label-position="top">
|
||||||
|
<el-form-item label="手机号码" label-width="80px" prop="phone" :rules="[{ required: true, trigger: 'blur', min: 11, max: 11, message: '请输入正确的手机号码' }]">
|
||||||
|
<el-input v-model="pageData.loginForm.phone" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="验证码" label-width="80px" prop="code" :rules="[{ required: true, trigger: 'blur', min: 4, max: 4, message: '请输入验证码' }]">
|
||||||
|
<el-input type="text" maxlength="4" placeholder="验证码" v-model="pageData.loginForm.code">
|
||||||
|
<template slot="append" #append>
|
||||||
|
<el-button :disabled="pageData.loginForm.disabled" @click="(v,v2)=>funHandles.getCode(v,pageData,loginFormRef)">{{ pageData.loginForm.valiBtn }}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">-->
|
||||||
|
<!--<el-button @click="dialogFormVisible = false">Cancel</el-button>-->
|
||||||
|
<!--<el-button type="primary" @click="(v,v2)=>funHandles.verifyKey(pageData,loginFormRef)">登录</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>-->
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -43,7 +70,9 @@
|
|||||||
return {
|
return {
|
||||||
tableData: [],
|
tableData: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
token: ''
|
token: '',
|
||||||
|
dialogVisible: false,
|
||||||
|
addexpertnum: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
@@ -79,6 +108,8 @@
|
|||||||
console.log(_this.tableData)
|
console.log(_this.tableData)
|
||||||
_this.loading = false;
|
_this.loading = false;
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
if (error.response.status == 403)
|
||||||
|
location = '../manage/login.html'
|
||||||
console.log(error)
|
console.log(error)
|
||||||
_this.$message({
|
_this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -108,6 +139,35 @@
|
|||||||
};
|
};
|
||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
show_dialog() {
|
||||||
|
this.dialogVisible = true
|
||||||
|
}
|
||||||
|
,
|
||||||
|
add_expert() {
|
||||||
|
this.loading = true;
|
||||||
|
let _this = this;
|
||||||
|
axios({
|
||||||
|
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||||
|
method: 'post',
|
||||||
|
url: '/gb/yjb/api/projects/expert',
|
||||||
|
data: { expertnum: this.addexpertnum },
|
||||||
|
responseType: "json",
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Bearer ' + _this.token
|
||||||
|
}
|
||||||
|
}).then(function (response) {
|
||||||
|
_this.loading = false;
|
||||||
|
location.reload();
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error)
|
||||||
|
_this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: error.message
|
||||||
|
})
|
||||||
|
_this.loading = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -109,6 +109,8 @@
|
|||||||
//console.log(_this.tableData0)
|
//console.log(_this.tableData0)
|
||||||
_this.loading = false;
|
_this.loading = false;
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
if (error.response.status == 403)
|
||||||
|
location = '../manage/login.html'
|
||||||
console.log(error)
|
console.log(error)
|
||||||
_this.$message({
|
_this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Vote.Services.Dto;
|
using Vote.Services.Dto;
|
||||||
|
using Vote.Services.Entities;
|
||||||
|
using static Vote.Services.Dto.ProjectsList2Output;
|
||||||
|
|
||||||
namespace Vote.Services.ApiController
|
namespace Vote.Services.ApiController
|
||||||
{
|
{
|
||||||
@@ -177,7 +180,9 @@ namespace Vote.Services.ApiController
|
|||||||
{
|
{
|
||||||
var list = await rep_Experts.DetachedEntities.GroupJoin(rep_VoteRecords.DetachedEntities, a => a.login_code, a => a.expert_login_code, (a, b) => new { a, b })
|
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 })
|
.SelectMany(a => a.b.DefaultIfEmpty(), (a, b) => new { a.a.Id, a.a.login_code, is_vote = b != null })
|
||||||
.Distinct().ToListAsync();
|
.Distinct()
|
||||||
|
.OrderBy(a => a.Id)
|
||||||
|
.ToListAsync();
|
||||||
return list;
|
return list;
|
||||||
//var query = from a in rep_Experts.DetachedEntities
|
//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
|
// join b in rep_VoteRecords.DetachedEntities on a.login_code equals b.expert_login_code into temp
|
||||||
@@ -193,5 +198,28 @@ namespace Vote.Services.ApiController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 新增专家
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task AddExpert(AddExpertInput args)
|
||||||
|
{
|
||||||
|
if (args == null || args.expertnum <= 0)
|
||||||
|
throw Oops.Oh("参数异常");
|
||||||
|
var list = new List<Experts>();
|
||||||
|
for (int i = 0; i < args.expertnum; i++)
|
||||||
|
{
|
||||||
|
var newid = Ulid.NewUlid().ToString();
|
||||||
|
var newidsimple = newid.ToUpper().Replace("I", "").Replace("L", "").Replace("0", "").Replace("O", "").Replace("1", "");
|
||||||
|
list.Add(new Experts
|
||||||
|
{
|
||||||
|
Id = newid,
|
||||||
|
login_code = newidsimple.Substring(newidsimple.Length - 6, 6),
|
||||||
|
CreatedTime = DateTime.Now
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await rep_Experts.InsertAsync(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,5 +111,10 @@ namespace Vote.Services.Dto
|
|||||||
return type.GetEnumDescription();
|
return type.GetEnumDescription();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class AddExpertInput
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public int expertnum { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<PackageReference Include="NPOI" Version="2.6.0" />
|
<PackageReference Include="NPOI" Version="2.6.0" />
|
||||||
<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
|
<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
||||||
|
<PackageReference Include="Ulid" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -244,6 +244,12 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Vote.Services.ApiController.ProjectsService.AddExpert(Vote.Services.Dto.ProjectsList2Output.AddExpertInput)">
|
||||||
|
<summary>
|
||||||
|
新增专家
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Vote.Services.ApiController.WxService">
|
<member name="T:Vote.Services.ApiController.WxService">
|
||||||
<summary>
|
<summary>
|
||||||
微信
|
微信
|
||||||
|
|||||||
Reference in New Issue
Block a user