前台页面整体保存功能完善和后台读取社区列表和读取幢列表的功能开发

This commit is contained in:
范露尧
2023-06-29 20:11:20 +08:00
parent 352c658960
commit 0032956dbe
32 changed files with 1184 additions and 159 deletions

View File

@@ -14,5 +14,9 @@ namespace Ewide.Web.Entry.Controllers
{
return View();
}
public IActionResult BuildingResult()
{
return View();
}
}
}

View File

@@ -0,0 +1,573 @@
@*
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.min.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;">宁波既有建筑外墙脱落问卷调查结果-幢列表</h3>
<el-form label-position="left" ref="form" :model="form" label-width="120px" style="margin-top:15px;">
<el-form-item label="社区/小区:" prop="name">
<el-select v-model="form.communityId" filterable clearable placeholder="请选择" @@change="selectCommunity">
<el-option v-for="item in communitys" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="提交码:" prop="name">
<el-input v-model="form.submitCode" style="width:300px"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @@click.prevent="onSubmit('form')">查询</el-button>
<el-button @@click.prevent="reset('form')">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="tableDataBuilding" style="width: 98%;margin:0 auto;" tooltip-effect="dark" @@selection-change="handleSelectionChange" row-key="id"
:expand-row-keys="expandChilds" @@row-click="clickRowHandleBuilding">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand" :model="props.row" style="width: 90%;margin:0 auto;">
<el-form-item label="提交码:">
<span style="font-weight:bold;">{{ props.row.submitCode }}</span>
</el-form-item>
<el-form-item label="社区/小区名称:">
<span style="font-weight:bold;">{{ props.row.communityName }}</span>
</el-form-item>
<el-form-item label="提交日期:">
<span style="font-weight:bold;">{{ dateFormat("mm-dd", props.row.createtime )}}</span>
</el-form-item>
<el-form-item label="幢名称:">
<span style="font-weight:bold;">{{ props.row.buildingName }}</span>
</el-form-item>
<el-form-item label="地址:">
<span style="font-weight:bold;">{{ props.row.address }}</span>
</el-form-item>
<el-form-item label="层数:">
<span style="font-weight:bold;">{{ props.row.levelCount }}</span>
</el-form-item>
<el-form-item label="总户数:">
<span style="font-weight:bold;">{{ props.row.houseHolds }}</span>
</el-form-item>
<el-form-item label="建设单位:">
<span style="font-weight:bold;">{{ props.row.buildingUnit }}</span>
</el-form-item>
<el-form-item label="设计单位:">
<span style="font-weight:bold;">{{ props.row.desingerUnit }}</span>
</el-form-item>
<el-form-item label="施工单位:">
<span style="font-weight:bold;">{{ props.row.constructionUnit }}</span>
</el-form-item>
<el-form-item label="监理单位:">
<span style="font-weight:bold;">{{ props.row.monitorUnit }}</span>
</el-form-item>
<el-form-item label="物业单位:">
<span style="font-weight:bold;">{{ props.row.wuYeUnit }}</span>
</el-form-item>
<el-form-item label="墙体问题的类型是:">
<span style="font-weight:bold;">{{ props.row.curwallproblems }}</span>
</el-form-item>
<el-form-item label="其他:">
<span style="font-weight:bold;">{{ props.row.curwallproblemother }}</span>
</el-form-item>
<el-form-item label="哪个问题最先开始出现?" v-if="props.row.curwallproblems?.length>1">
<span style="font-weight:bold;">{{ props.row.wallproblemsfirst }}</span>
</el-form-item>
<el-form-item label="第一次出现墙体问题是建成后____年">
<span style="font-weight:bold;">{{ props.row.firstproblemdate }}</span>
</el-form-item>
<el-form-item label="墙体脱落发生频率如何?">
<span style="font-weight:bold;">{{ props.row.problemfrequency }}</span>
</el-form-item>
<el-form-item label="问题多发生在哪个季节?">
<span style="font-weight:bold;">{{ props.row.problemseason }}</span>
</el-form-item>
<el-form-item label="墙体问题发生的朝向是哪面?">
<span style="font-weight:bold;">{{ props.row.wallproblemtoward }}</span>
</el-form-item>
<el-form-item label="问题照片:">
<div class="blocks">
<div class="block" v-for="fit in props.row.outside_wall_building_photos" :key="fit" @@click="handlePreview(fit,props.row.outside_wall_building_photos)">
<span class="title">{{ fit.toward }}</span>
<el-avatar shape="square" :size="100" fit="fill" :src="fit.preview"></el-avatar>
</div>
</div>
</el-form-item>
<el-form-item label="发生外墙问题的范围有多大?">
<span style="font-weight:bold;">{{ props.row.problemfanwei }}</span>
</el-form-item>
<el-form-item label="外墙问题发生在哪个高度?">
<span style="font-weight:bold;">{{ props.row.problemheight }}</span>
</el-form-item>
<el-form-item label="掉落物是什么?">
<span style="font-weight:bold;">{{ props.row.diaoluowu }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column label="提交码" width="120"><template slot-scope="props">{{ props.row.submitCode}}</template></el-table-column>
<el-table-column label="社区/小区名称" width="200"><template slot-scope="props">{{ props.row.communityName}}</template></el-table-column>
<el-table-column label="提交日期" width="120"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createtime )}}</template></el-table-column>
<el-table-column label="幢名称"><template slot-scope="props">{{ props.row.buildingName}}</template></el-table-column>
<el-table-column label="地址"><template slot-scope="props">{{ props.row.address}}</template></el-table-column>
</el-table>
@* <el-table :data="tableData" style="width: 100%" tooltip-effect="dark" @@selection-change="handleSelectionChange" row-key="id"
:expand-row-keys="expands" @@row-click="clickRowHandle">
<el-table-column type="expand">
<template slot-scope="props">
</template>
</el-table-column>
<el-table-column label="提交码"><template slot-scope="props">{{ props.row.submitCode}}</template></el-table-column>
<el-table-column label="社区/小区名称"><template slot-scope="props">{{ props.row.communityName}}</template></el-table-column>
<el-table-column label="提交日期"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createtime )}}</template></el-table-column>
<el-table-column label="交付年份"><template slot-scope="props">{{ props.row.deliveryear}}</template></el-table-column>
<el-table-column label="楼栋数"><template slot-scope="props">{{ props.row.buildcount}}</template></el-table-column>
<el-table-column label="住户总数"><template slot-scope="props">{{ props.row.householdcount}}</template></el-table-column>
<el-table-column label="总建筑面积"><template slot-scope="props">{{ props.row.totalfloorage}}</template></el-table-column>
<el-table-column label="存在外墙问题"><template slot-scope="props">{{ props.row.isExistProblem==1?'是':'否' }}</template></el-table-column>
<el-table-column label="请人修复"><template slot-scope="props">{{ props.row.problemismodify==1?'是':'否'}}</template></el-table-column>
<el-table-column label="修复单位"><template slot-scope="props">{{ props.row.problemmodifyunitname}}</template></el-table-column>
<el-table-column label="是否再次发生问题"><template slot-scope="props">{{ props.row.problemmodifyisagain==1?'是':'否'}}</template></el-table-column>
<el-table-column label="联系方式"><template slot-scope="props">{{ props.row.contract}}</template></el-table-column>
</el-table>*@
<h3 style="text-align:center;">
<el-button @@click="toCommunityPage">查看社区统计</el-button>
<el-button type="primary" @@click="export_excel" :loading="loading">导出Excel</el-button>
</h3>
<el-image ref="myImg" class="my-img" :src="dialogImageUrl" :preview-src-list="dialogImageUrls">
</el-image>
</div>
</body>
<script>
new Vue({
el: '#app',
data: function () {
return {
form: {
},
tableDataBuilding: [],
loading: false,
token: '',
communitys: [],
communityId: '',
// 获取row的key值
getRowKeys(row) {
return row.id;
},
// 要展开的行数值的元素是row的key值
expands: [],
expandChilds: [],
childFileList: [],
dialogImageUrl: '',
dialogImageUrls: [],
}
},
created: function () {
this.check_login()
this.loading = true;
this.GetCommunitys('');
},
methods: {
handlePreview(src, srcs) {
debugger
this.loading = true;
console.log(src);
this.dialogImageUrl = src.preview;
this.dialogImageUrls = srcs.map(a => { return a.preview })
this.$refs.myImg.showViewer = true
const m = (e) => { e.preventDefault() };
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false); // 禁止页面滑动
this.loading = false;
},
clickRowHandleBuilding(row, column, event) {
if (this.expandChilds.includes(row.id)) {
//return;
this.expandChilds = this.expandChilds.filter(val => val !== row.id);
} else {
this.expandChilds = [];
this.expandChilds.push(row.id);
}
},
clickRowHandle(row, column, event) {
if (this.expands.includes(row.id)) {
//return;
this.expands = this.expands.filter(val => val !== row.id);
//收缩
this.tableDataBuilding = [];
} else {
let _this = this;
const loading = this.$loading({
lock: true,
text: '加载中...请稍候',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/outsidewall/querybuilding',
data: { wallId: row.id },
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(async response => {
this.expands = [];
this.expands.push(row.id);
if (response.data.success == true) {
_this.tableDataBuilding = response.data.data;
//_this.childFileList = [];
//_this.tableDataBuilding.forEach((a) => {
// _this.childFileList.push({ filelist1: a.outside_wall_building_photo1, filelist2: a.outside_wall_building_photo2, filelist3: outside_wall_building_photo3, filelist4: outside_wall_building_photo4 })
//});
} else {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
loading.close();
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
});
loading.close();
})
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
GetCommunitys(queryString) {
let _this = this;
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: '/gb/yjb/api/outsidewall/Communitys?searchkey=' + queryString,
responseType: "json",
}).then(async response => {
_this.communitys = response.data.data
_this.loading = false;
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
},
selectCommunity(v) {
//this.form.communityName = this.getLabel(this.communitys, v);
this.communityId = v
},
onSubmit(formName) {
this.loading = true;
console.log('submit!');
let _this = this;
this.$refs[formName].validate((valid) => { // 为表单绑定验证功能
if (valid) {
//this.$alert("成功", "提示")
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/outsidewall/querybuildings',
data: _this.form,
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(async response => {
if (response.data.success == true) {
_this.tableDataBuilding = response.data.data;
} else {
_this.$alert(`<div>` + response.data.message + `</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;
})
}
});
}, reset(formName) {
this.form = {}
},
export_excel() {
this.loading = true;
this.download('/gb/yjb/api/ningbozhichun/export_excel', this.dateFormat("YYYYmmddHHMMSS", new Date()) + "-共赴宁波之春.xlsx", this.loading_false);
},
check_login() {
this.token = window.sessionStorage.getItem('__TOKEN');
if (!this.token)
location = '/gb/yjb/manage/login'
},
toCommunityPage() {
location = '/gb/yjb/OutsideWall/Result'
},
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, d) {
const date = new Date(d);
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>
<style lang="less">
.my-img {
display: none;
width: 100px;
height: 100px;
}
</style>
<style scoped>
.demo-table-expand .el-form-item {
border-bottom: 1px solid rgb(204, 204, 204);
}
.blocks {
display: flex;
text-align: center;
justify-content: space-between;
flex-wrap: wrap;
max-width: 1000px;
}
.block {
flex: 1;
display: flex;
flex-direction: column;
flex-grow: 0;
margin-right: 10px;
}
.block .title {
margin-bottom: 10px;
font-size: 14px;
color: #8492a6;
}
.el-avatar {
background: none !important;
}
.el-avatar img {
margin: 0 auto;
width: inherit;
height: auto !important;
}
.el-upload-list__item:first-child {
margin-top: 0 !important;
}
.el-upload-list__item {
margin-top: 0 !important;
}
.upload-demo {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
padding: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.el-upload-dragger {
width: 200px !important;
height: 50px !important;
}
.el-upload-dragger .el-icon-upload {
display: none !important;
}
.el-upload-dragger .el-upload__text {
line-height: 50px !important;
}
.el-upload__tip {
margin-top: -23px !important;
}
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
/* width: 90px;*/
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 5px;
width: 90%;
}
.buhuanhang {
white-space: nowrap;
width: 21%;
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
width: 98%;
margin: 0 auto;
}
.el-card__body {
padding: 12px;
}
.el-card__body p {
margin: 0px;
margin-bottom: 5px;
line-height: 1.2;
}
.el-radio.is-bordered {
margin-bottom: 10px;
}
.el-radio-button--small .el-radio-button__inner {
border-left: 1px solid #DCDFE6;
}
</style>
<style scoped>
.buhuanhang {
white-space: nowrap;
width: 21%;
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
width: 98%;
margin: 0 auto;
}
.el-card__body {
padding: 12px;
}
.el-card__body p {
margin: 0px;
margin-bottom: 5px;
line-height: 1.2;
}
.el-radio.is-bordered {
margin-bottom: 10px;
}
.el-radio-button--small .el-radio-button__inner {
border-left: 1px solid #DCDFE6;
}
</style>
</html>

View File

@@ -42,8 +42,8 @@
<el-input v-model="form.hangye"></el-input>
</el-form-item>*@
<el-form-item label="3.外墙结构:" prop="outsidewallstructurefiles">
@*:on-change="fileChange"*@
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" multiple :auto-upload="true" :on-preview="handlePreview" :on-remove="(file, fileList)=>{return handleRemove(file, fileList)}" :file-list="fileList" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList)}">
@*:on-change="fileChange" multiple *@
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" :auto-upload="true" :on-preview="handlePreview" :on-remove="(file, fileList)=>{return handleRemove(file, fileList)}" :file-list="fileList" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList)}">
<i class="el-icon-upload"></i>
<div class="el-upload__text"><em>上传外墙照片</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
@@ -165,22 +165,22 @@
</el-form-item>
<el-form-item>
8.7 问题照片:@* :on-change="fileChange1"*@
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" multiple :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,1)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist1" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,1,'东')}">
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,1)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist1" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,1,'东')}">
<i class="el-icon-upload"></i>
<div class="el-upload__text"><em>上传东面照片</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" multiple :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,2)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist2" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,2,'西')}">
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,2)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist2" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,2,'西')}">
<i class="el-icon-upload"></i>
<div class="el-upload__text"><em>上传西面照片</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" multiple :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,3)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist3" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,3,'南')}">
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,3)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist3" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,3,'南')}">
<i class="el-icon-upload"></i>
<div class="el-upload__text"><em>上传南面照片</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" multiple :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,4)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist4" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,4,'北')}">
<el-upload class="upload-demo" drag action="/gb/yjb/api/outsidewall/sysFileInfo/upload" :auto-upload="true" :on-preview="(file)=>{return handlePreview(file,props,4)}" :on-remove="(file, fileList)=>{return handleRemove(file, fileList,props)}" :file-list="childFileList[props.$index].filelist4" :on-success="(response, file, fileList)=>{return fileChange(response, file, fileList, props,4,'北')}">
<i class="el-icon-upload"></i>
<div class="el-upload__text"><em>上传北面照片</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
@@ -689,42 +689,59 @@
this.$refs[formName].validate((valid) => {
if (valid) {
if (_this.form.isExistProblem == '0') {
_this.submit2();
this.$confirm('确定提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_this.submit2();
}).catch(() => {
});
} else {
if (this.$refs[formNameChild])
if (this.$refs[formNameChild]) {
this.$refs[formNameChild].validate((valid) => {
if (valid) {
debugger
_this.submit2();
this.$confirm('确定提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_this.submit2();
}).catch(() => {
});
} else {
this.$message({
message: '幢信息问卷未填写完整',
type: 'warning'
});
}
});
} else {
this.$message({
message: '存在问题请展开幢信息进行问卷填写',
type: 'warning'
});
}
}
} else {
this.$message({
message: '社区信息问卷未填写完整',
type: 'warning'
});
}
});
},
submit2() {
debugger;
const loading = this.$loading({
lock: true,
text: '提交中...请稍候',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
let _this = this;
//let config = {
// //formData 提交请求头有两种 multipart/form-data 和 application/x-www-form-urlencoded
// // multipart/form-data 用于type=file 的input提交
// headers: {
// "Content-Type": "multipart/form-data"
// }
//};
//const fd = new FormData()
//fd.append('appid', "123")
//fd.append('wall', _this.form)
//for (let _i in _this.fileList) {
// fd.append('file', _i)
//}
//axios.post('/gb/yjb/api/outsidewall/submit', fd, config).then(res => {
// debugger
//}).catch(error => {
// console.log(error);
//});
axios({
headers: { 'Content-Type': 'multipart/form-data' },
method: 'post',
@@ -732,10 +749,9 @@
data: _this.form,
responseType: "json",
}).then(async response => {
if (response.data?.data?.success == true) {
let token = response.data.data.token;
localStorage.setItem("_token", token)
_this.$alert(`<div>提交成功</div>`, '成功', {
debugger;
if (response.data?.success == true) {
_this.$alert(`<div>提交成功,您的提交码是:` + response.data?.data + `<br/>请牢记提交码。</div>`, '提交成功', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
} else {
@@ -743,14 +759,14 @@
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
_this.loading = false;
loading.close();
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
loading.close();
})
},
getFormData(object) {

View File

@@ -18,88 +18,149 @@
<body>
<div id="app" v-loading="loading">
<h3 style="text-align:center;">宁波既有建筑外墙脱落问卷调查 报名结果</h3>
<h3 style="text-align:center;">宁波既有建筑外墙脱落问卷调查结果</h3>
<el-form label-position="left" ref="form" :model="form" label-width="120px" style="margin-top:15px;">
<el-form-item label="社区/小区:" prop="name">
<el-select v-model="form.communityId" filterable placeholder="请选择" @@change="selectCommunity">
<el-select v-model="form.communityId" filterable clearable placeholder="请选择" @@change="selectCommunity">
<el-option v-for="item in communitys" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="提交码:" prop="name">
<el-input v-model="form.submitCode" style="width:300px"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @@click.prevent="onSubmit('form')">查询</el-button>
<el-button @@click.prevent="reset('form')">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="tableData" style="width: 100%">
<el-table :data="tableData" style="width: 100%" tooltip-effect="dark" @@selection-change="handleSelectionChange" row-key="id"
:expand-row-keys="expands" @@row-click="clickRowHandle">
<el-table-column type="expand">
<template slot-scope="props">
<el-descriptions class="margin-top" title="" :column="2" border>
<el-descriptions-item :span="2">
<template slot="label">
@* <i class="el-icon-user"></i>*@
报名日期
<el-table :data="tableDataBuilding" style="width: 90%;margin:0 auto;" tooltip-effect="dark" @@selection-change="handleSelectionChange" row-key="id"
:expand-row-keys="expandChilds" @@row-click="clickRowHandleBuilding">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand" :model="props.row">
<el-form-item label="幢名称:">
<span style="font-weight:bold;">{{ props.row.buildingName }}</span>
</el-form-item>
<el-form-item label="地址:">
<span style="font-weight:bold;">{{ props.row.address }}</span>
</el-form-item>
<el-form-item label="层数:">
<span style="font-weight:bold;">{{ props.row.levelCount }}</span>
</el-form-item>
<el-form-item label="总户数:">
<span style="font-weight:bold;">{{ props.row.houseHolds }}</span>
</el-form-item>
<el-form-item label="建设单位:">
<span style="font-weight:bold;">{{ props.row.buildingUnit }}</span>
</el-form-item>
<el-form-item label="设计单位:">
<span style="font-weight:bold;">{{ props.row.desingerUnit }}</span>
</el-form-item>
<el-form-item label="施工单位:">
<span style="font-weight:bold;">{{ props.row.constructionUnit }}</span>
</el-form-item>
<el-form-item label="监理单位:">
<span style="font-weight:bold;">{{ props.row.monitorUnit }}</span>
</el-form-item>
<el-form-item label="物业单位:">
<span style="font-weight:bold;">{{ props.row.wuYeUnit }}</span>
</el-form-item>
<el-form-item prop="curwallproblems">
8.1 墙体问题的类型是:<span style="font-weight:bold;">{{ props.row.curwallproblems }}</span>
</el-form-item>
<el-form-item prop="curwallproblemother">
8.1 其他:<span style="font-weight:bold;">{{ props.row.curwallproblemother }}</span>
</el-form-item>
<el-form-item label="" v-if="props.row.curwallproblems?.length>1">
8.2 哪个问题最先开始出现?
<span style="font-weight:bold;">{{ props.row.wallproblemsfirst }}</span>
</el-form-item>
<el-form-item prop="firstproblemdate">
8.3 第一次出现墙体问题是建成后____年
<span style="font-weight:bold;">{{ props.row.firstproblemdate }}</span>
</el-form-item>
<el-form-item prop="problemfrequency">
8.4 墙体脱落发生频率如何?
<span style="font-weight:bold;">{{ props.row.problemfrequency }}</span>
</el-form-item>
<el-form-item prop="problemseason">
8.5 问题多发生在哪个季节?
<span style="font-weight:bold;">{{ props.row.problemseason }}</span>
</el-form-item>
<el-form-item prop="wallproblemtoward">
8.6 墙体问题发生的朝向是哪面?
<span style="font-weight:bold;">{{ props.row.wallproblemtoward }}</span>
</el-form-item>
<el-form-item>
8.7 问题照片:
<div class="blocks">
<div class="block" v-for="fit in props.row.outside_wall_building_photos" :key="fit" @@click="handlePreview(fit,props.row.outside_wall_building_photos)">
<span class="title">{{ fit.toward }}</span>
<el-avatar shape="square" :size="100" fit="fill" :src="fit.preview"></el-avatar>
</div>
</div>
</el-form-item>
<el-form-item prop="problemfanwei">
8.8 发生外墙问题的范围有多大?
<span style="font-weight:bold;">{{ props.row.problemfanwei }}</span>
</el-form-item>
<el-form-item prop="problemheight">
8.9 外墙问题发生在哪个高度?
<span style="font-weight:bold;">{{ props.row.problemheight }}</span>
</el-form-item>
<el-form-item prop="diaoluowu">
8.10 掉落物是什么?
<span style="font-weight:bold;">{{ props.row.diaoluowu }}</span>
</el-form-item>
</el-form>
</template>
{{ props.row.createdTime }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-user"></i>*@
姓名
</template>
{{ props.row.name }}
</el-descriptions-item>
<el-descriptions-item labelStyle="width:90px;">
<template slot="label">
@* <i class="el-icon-user"></i>*@
手机号码
</template>
{{ props.row.phone }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-mobile-phone"></i>*@
微信号码
</template>
{{ props.row.weixin_number }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-location-outline"></i>*@
身份证号码
</template>
{{ props.row.cardno }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-tickets"></i>*@
行业
</template>
@* <el-tag size="small">学校</el-tag>*@
{{ props.row.hangye }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@*<i class="el-icon-office-building"></i>*@
所在地
</template>
{{ props.row.address }}
</el-descriptions-item>
</el-descriptions>
</el-table-column>
<el-table-column label="幢名称"><template slot-scope="props">{{ props.row.buildingName}}</template></el-table-column>
<el-table-column label="地址"><template slot-scope="props">{{ props.row.address}}</template></el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="提交码"><template slot-scope="props">{{ props.row.submitCode}}</template></el-table-column>
<el-table-column label="社区/小区名称"><template slot-scope="props">{{ props.row.communityName}}</template></el-table-column>
<el-table-column label="提交日期"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createtime )}}</template></el-table-column>
<el-table-column label="交付年份"><template slot-scope="props">{{ props.row.deliveryear}}</template></el-table-column>
<el-table-column label="楼栋数"><template slot-scope="props">{{ props.row.buildcount}}</template></el-table-column>
<el-table-column label="住户总数"><template slot-scope="props">{{ props.row.householdcount}}</template></el-table-column>
<el-table-column label="总建筑面积"><template slot-scope="props">{{ props.row.totalfloorage}}</template></el-table-column>
<el-table-column label="存在外墙问题"><template slot-scope="props">{{ props.row.isExistProblem==1?'是':'否' }}</template></el-table-column>
<el-table-column label="请人修复"><template slot-scope="props">{{ props.row.problemismodify==1?'是':'否'}}</template></el-table-column>
<el-table-column label="修复单位"><template slot-scope="props">{{ props.row.problemmodifyunitname}}</template></el-table-column>
<el-table-column label="是否再次发生问题"><template slot-scope="props">{{ props.row.problemmodifyisagain==1?'是':'否'}}</template></el-table-column>
<el-table-column label="联系方式"><template slot-scope="props">{{ props.row.contract}}</template></el-table-column>
<el-table-column label="外墙照片">
<template slot-scope="props">
<el-button @@click.native.stop="lookphoto(props.row.outside_wall_photos)">点我查看</el-button>
</template>
</el-table-column>
<el-table-column label="报名日期"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createdTime )}}</template></el-table-column>
<el-table-column label="姓名/手机号码"><template slot-scope="props">{{ props.row.name}}<br />{{ props.row.phone}}</template></el-table-column>
<el-table-column label="日期/线路"><template slot-scope="props">{{ props.row.date}} {{ props.row.line}}</template></el-table-column>
</el-table>
<h3 style="text-align:center;">
<el-button @@click="load_projects">刷新数据</el-button>
<el-button @@click="toBuildPage">查看幢统计</el-button>
<el-button type="primary" @@click="export_excel" :loading="loading">导出Excel</el-button>
</h3>
<el-image ref="myImg" class="my-img" :src="dialogImageUrl" :preview-src-list="dialogImageUrls">
</el-image>
<el-dialog title="图片预览" :visible.sync="dialogTableVisible">
<div class="blocks">
<div class="block" v-for="fit in outside_wall_photos" :key="fit" @@click="handlePreview(fit,outside_wall_photos)">
<span class="title">{{ fit.toward }}</span>
<el-avatar shape="square" :size="100" fit="fill" :src="fit.preview"></el-avatar>
</div>
</div>
</el-dialog>
</div>
</body>
<script>
@@ -108,22 +169,26 @@
data: function () {
return {
form: {
name: '',
phone: '',
weixin_number: '',
cardno: '',
hangye: '',
address: '',
date: '',
line: '',
code: '',
token: ''
//,remark: ''
},
tableData: [],
tableDataBuilding: [],
loading: false,
token: '',
communitys: [], communityId: ''
communitys: [],
communityId: '',
// 获取row的key值
getRowKeys(row) {
return row.id;
},
// 要展开的行数值的元素是row的key值
expands: [],
expandChilds: [],
childFileList: [],
dialogImageUrl: '',
dialogImageUrls: [],
outside_wall_photos: [],
dialogTableVisible: false,
}
},
created: function () {
@@ -133,6 +198,83 @@
},
methods: {
lookphoto(outside_wall_photos) {
debugger;
this.outside_wall_photos = outside_wall_photos
this.dialogTableVisible = true
},
handlePreview(src, srcs) {
debugger
this.loading = true;
console.log(src);
this.dialogImageUrl = src.preview;
this.dialogImageUrls = srcs.map(a => { return a.preview })
this.$refs.myImg.showViewer = true
const m = (e) => { e.preventDefault() };
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false); // 禁止页面滑动
this.loading = false;
},
clickRowHandleBuilding(row, column, event) {
if (this.expandChilds.includes(row.id)) {
//return;
this.expandChilds = this.expandChilds.filter(val => val !== row.id);
} else {
this.expandChilds = [];
this.expandChilds.push(row.id);
}
},
clickRowHandle(row, column, event) {
if (this.expands.includes(row.id)) {
//return;
this.expands = this.expands.filter(val => val !== row.id);
//收缩
this.tableDataBuilding = [];
} else {
let _this = this;
const loading = this.$loading({
lock: true,
text: '加载中...请稍候',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/outsidewall/querybuilding',
data: { wallId: row.id },
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(async response => {
this.expands = [];
this.expands.push(row.id);
if (response.data.success == true) {
_this.tableDataBuilding = response.data.data;
//_this.childFileList = [];
//_this.tableDataBuilding.forEach((a) => {
// _this.childFileList.push({ filelist1: a.outside_wall_building_photo1, filelist2: a.outside_wall_building_photo2, filelist3: outside_wall_building_photo3, filelist4: outside_wall_building_photo4 })
//});
} else {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
loading.close();
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
});
loading.close();
})
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
GetCommunitys(queryString) {
let _this = this;
axios({
@@ -164,17 +306,16 @@
//this.$alert("成功", "提示")
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: '/gb/yjb/api/outsidewall/query/' + this.communityId,
method: 'post',
url: '/gb/yjb/api/outsidewall/query',
data: _this.form,
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(async response => {
debugger
if (response.data.success == true) {
_this.tableData = response.data;
_this.tableData = response.data.data;
} else {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
@@ -205,30 +346,8 @@
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/ningbozhichun/GetPersonList',
data: {},
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(function (response) {
console.log(response)
_this.tableData = response.data.data
_this.loading = false;
}).catch(function (error) {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
toBuildPage() {
location = '/gb/yjb/OutsideWall/BuildingResult'
},
loading_false() { this.loading = false },
@@ -303,6 +422,135 @@
}
})
</script>
<style lang="less">
.my-img {
display: none;
width: 100px;
height: 100px;
}
</style>
<style scoped>
.demo-table-expand .el-form-item {
border-bottom: 1px solid rgb(204, 204, 204);
}
.blocks {
display: flex;
text-align: center;
justify-content: space-between;
flex-wrap: wrap;
max-width: 1000px;
}
.block {
flex: 1;
display: flex;
flex-direction: column;
flex-grow: 0;
margin-right: 10px;
}
.block .title {
margin-bottom: 10px;
font-size: 14px;
color: #8492a6;
}
.el-avatar {
background: none !important;
}
.el-avatar img {
margin: 0 auto;
width: inherit;
height: auto !important;
}
.el-upload-list__item:first-child {
margin-top: 0 !important;
}
.el-upload-list__item {
margin-top: 0 !important;
}
.upload-demo {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
padding: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.el-upload-dragger {
width: 200px !important;
height: 50px !important;
}
.el-upload-dragger .el-icon-upload {
display: none !important;
}
.el-upload-dragger .el-upload__text {
line-height: 50px !important;
}
.el-upload__tip {
margin-top: -23px !important;
}
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
/* width: 90px;*/
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 5px;
width: 90%;
}
.buhuanhang {
white-space: nowrap;
width: 21%;
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
width: 98%;
margin: 0 auto;
}
.el-card__body {
padding: 12px;
}
.el-card__body p {
margin: 0px;
margin-bottom: 5px;
line-height: 1.2;
}
.el-radio.is-bordered {
margin-bottom: 10px;
}
.el-radio-button--small .el-radio-button__inner {
border-left: 1px solid #DCDFE6;
}
</style>
<style scoped>
.buhuanhang {
white-space: nowrap;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

View File

@@ -27,6 +27,7 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using NPOI.HPSF;
using Org.BouncyCastle.Crypto;
using Vote.Services.Dto;
using Vote.Services.Entities;
@@ -65,23 +66,132 @@ namespace Vote.Services.ApiController
rep_SysFile = _rep_SysFile;
}
/// <summary>
/// 获取三居系统中的社区
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[HttpGet("query/{id}")]
public async Task<dynamic> Query(string id)
/// 导出Excel
/// </summary>
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[Route("export_excel")]
public async Task<dynamic> ExportExcel(NbzcGetListInput args)
{
var entity = await repoutside_wall.AsQueryable().FirstAsync(a => a.communityId == id);
if (entity != null)
//var list = await repoutside_wall.AsQueryable().Where(a => !a.IsDeleted).OrderByDescending(a => a.CreatedTime).ToListAsync();
//var filepath = Tools.ExcelHelper.WriteExcelNingBoZhiChun(list);
//return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath };
return 1;
}
[HttpPost("querybuildings")]
public async Task<dynamic> QueryBuildings(OutsideWallQueryInput args)
{
var entity = await repoutside_wall_building.AsQueryable().LeftJoin<outside_wall>((a, b) => a.outsidewallId == b.Id)
.WhereIF(!string.IsNullOrWhiteSpace(args.communityId), (a, b) => b.communityId == args.communityId)
.WhereIF(!string.IsNullOrWhiteSpace(args.submitCode), (a, b) => b.submitCode == args.submitCode)
.Select((a, b) => new OutsideWallBuildingsOutput
{
communityId = b.Id,
createtime = b.createtime,
communityName = b.communityName,
submitCode = b.submitCode,
Address = a.Address,
BuildingId = a.BuildingId,
BuildingName = a.BuildingName,
BuildingUnit = a.BuildingUnit,
ConstructionUnit = a.ConstructionUnit,
curwallproblemother = a.curwallproblemother,
curwallproblems = a.curwallproblems,
DesingerUnit = a.DesingerUnit,
diaoluowu = a.diaoluowu,
firstproblemdate = a.firstproblemdate,
MonitorUnit = a.MonitorUnit,
Households = a.Households,
Id = a.Id,
LevelCount = a.LevelCount,
outsidewallId = a.outsidewallId,
problemfanwei = a.problemfanwei,
problemfrequency = a.problemfanwei,
problemheight = a.problemheight,
problemseason = a.problemseason,
wallproblemsfirst = a.wallproblemsfirst,
wallproblemtoward = a.wallproblemtoward,
WuYeUnit = a.WuYeUnit
})
.WithCache(60 * 60).ToListAsync();
var ids = entity.Select(a => a.Id).ToArray();
var photos = await repoutside_wall_building_photo.AsQueryable()
.Where(a => ids.Contains(a.outsidewallBuildingId)).WithCache(60 * 60).ToListAsync();
foreach (var building in entity)
{
var outside_wall_photos = await repoutside_wall_photo.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
entity.outside_wall_photos = outside_wall_photos;
var outside_wall_buildings = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
entity.outside_wall_buildings = outside_wall_buildings;
return entity;
var _ps = photos.Where(a => a.outsidewallBuildingId == building.Id).OrderBy(a => a.toward).ToList();
var _ps2 = new List<outside_wall_building_photo>();
_ps2.AddRange(_ps.Where(a => a.toward == "东"));
_ps2.AddRange(_ps.Where(a => a.toward == "西"));
_ps2.AddRange(_ps.Where(a => a.toward == "南"));
_ps2.AddRange(_ps.Where(a => a.toward == "北"));
building.outside_wall_building_photos = _ps2;
}
return null;
//var result = entity.Adapt<List<OutsideWallResultOutput>>();
//if (entity != null)
//{
// var outside_wall_photos = await repoutside_wall_photo.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_photos = outside_wall_photos;
// var outside_wall_buildings = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_buildings = outside_wall_buildings;
// return entity;
//}
return entity;
}
[HttpPost("query")]
public async Task<dynamic> Query(OutsideWallQueryInput args)
{
//repoutside_wall.Ado.SqlQuery<OutsideWallResultOutput>("")
var entity = await repoutside_wall.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(args.communityId), a => a.communityId == args.communityId)
.WhereIF(!string.IsNullOrWhiteSpace(args.submitCode), a => a.submitCode == args.submitCode)
.WithCache(60 * 60).ToListAsync();
var ids = entity.Select(a => a.Id).ToArray();
var photos = await repoutside_wall_photo.AsQueryable()
.Where(a => ids.Contains(a.outsidewallId)).WithCache(60 * 60).ToListAsync();
foreach (var wall in entity)
{
wall.outside_wall_photos = photos.Where(a => a.outsidewallId == wall.Id).ToList();
}
//var result = entity.Adapt<List<OutsideWallResultOutput>>();
//if (entity != null)
//{
// var outside_wall_photos = await repoutside_wall_photo.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_photos = outside_wall_photos;
// var outside_wall_buildings = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_buildings = outside_wall_buildings;
// return entity;
//}
return entity;
}
[HttpPost("querybuilding")]
public async Task<dynamic> QueryBuilding(OutsideWallQueryBuildingInput args)
{
var entity = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == args.wallId).WithCache(60 * 60).ToListAsync();
var ids = entity.Select(a => a.Id).ToArray();
var photos = await repoutside_wall_building_photo.AsQueryable().Where(a => ids.Contains(a.outsidewallBuildingId)).WithCache(60 * 60).ToListAsync();
foreach (var building in entity)
{
var _ps = photos.Where(a => a.outsidewallBuildingId == building.Id).OrderBy(a => a.toward).ToList();
var _ps2 = new List<outside_wall_building_photo>();
_ps2.AddRange(_ps.Where(a => a.toward == "东"));
_ps2.AddRange(_ps.Where(a => a.toward == "西"));
_ps2.AddRange(_ps.Where(a => a.toward == "南"));
_ps2.AddRange(_ps.Where(a => a.toward == "北"));
building.outside_wall_building_photos = _ps2;
}
//var result = entity.Adapt<List<OutsideWallResultOutput>>();
//if (entity != null)
//{
// var outside_wall_photos = await repoutside_wall_photo.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_photos = outside_wall_photos;
// var outside_wall_buildings = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync();
// entity.outside_wall_buildings = outside_wall_buildings;
// return entity;
//}
return entity;
}
/// <summary>
/// 获取三居系统中的社区
@@ -234,6 +344,28 @@ namespace Vote.Services.ApiController
return fileId;
}
/// <summary>
/// 生成随机字母与数字
/// </summary>
/// <param name="Length">生成长度</param>
/// <param name="Sleep">是否要在生成前将当前线程阻止以避免重复</param>
public string GetCode(int Length, bool Sleep)
{
if (Sleep) System.Threading.Thread.Sleep(3);
char[] Pattern = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
string result = "";
int n = Pattern.Length;
System.Random random = new Random(~unchecked((int)DateTime.Now.Ticks));
for (int i = 0; i < Length; i++)
{
int rnd = random.Next(0, n);
result += Pattern[rnd];
}
return result;
}
/// <summary>
/// 提交
/// </summary>
@@ -245,8 +377,10 @@ namespace Vote.Services.ApiController
{
try
{
string code = GetCode(6, true);
repoutside_wall.Ado.BeginTran();
var wall = args.Adapt<outside_wall>();
wall.submitCode = code;
wall.Id = Guid.NewGuid().ToString();
wall.createtime = DateTime.Now;
wall.isdeleted = 0;
@@ -264,6 +398,8 @@ namespace Vote.Services.ApiController
}
foreach (var item in args.buildings)
{
if (!item.curwallproblems.Any())
continue;
var build = item.Adapt<outside_wall_building>();
build.Id = Guid.NewGuid().ToString();
build.outsidewallId = wall.Id;
@@ -284,7 +420,7 @@ namespace Vote.Services.ApiController
}
}
repoutside_wall.Ado.CommitTran();
return "提交成功";
return code;
}
catch (Exception ex)
{

View File

@@ -10,11 +10,31 @@ using Vote.Services.Entities;
namespace Vote.Services.Dto
{
public class aaaaa
public class OutsideWallBuildingsOutput : outside_wall_building
{
public string appid { get; set; }
public OutsideWallInput wall { get; set; }
public FormFileCollection file { get; set; }
public string communityId { get; set; }
public string communityName { get; set; }
public string submitCode { get; set; }
public DateTime? createtime { get; set; }
}
public class OutsideWallQueryBuildingInput
{
public string wallId { get; set; }
}
public class OutsideWallQueryInput
{
public string submitCode { get; set; }
public string communityId { get; set; }
}
public class OutsideWallResultOutput : outside_wall
{
public int submitBuildCount { get; set; }
//{
// get
// {
// return this.outside_wall_buildings.Where(a => !string.IsNullOrWhiteSpace(a.curwallproblems)).Count();
// }
//}
}
/// <summary>
///

View File

@@ -13,6 +13,7 @@ namespace Vote.Services.Entities
[Serializable]
public class outside_wall
{
public string submitCode { get; set; }
/// <summary>
/// Id主键
/// </summary>

View File

@@ -10,6 +10,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Furion;
namespace Vote.Services.Entities
{
@@ -38,6 +39,15 @@ namespace Vote.Services.Entities
[DisplayName("sysfileid")]
[SugarColumn(IsPrimaryKey = true)]
public string sysfileid { get; set; }
[SugarColumn(IsIgnore = true)]
public string preview
{
get
{
var r = App.HttpContext.Request;
return $"{r.Scheme}://{r.Host}/gb/yjb/api/outsidewall/sysFileInfo/preview/{this.sysfileid}";
}
}
}
}

View File

@@ -9,6 +9,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Furion;
namespace Vote.Services.Entities
{
@@ -31,6 +32,15 @@ namespace Vote.Services.Entities
[DisplayName("sysfileid")]
[SugarColumn(IsPrimaryKey = true)]
public string sysfileid { get; set; }
[SugarColumn(IsIgnore = true)]
public string preview
{
get
{
var r = App.HttpContext.Request;
return $"{r.Scheme}://{r.Host}/gb/yjb/api/outsidewall/sysFileInfo/preview/{this.sysfileid}";
}
}
}
}

View File

@@ -113,11 +113,11 @@
<param name="_repoutside_wall_photo"></param>
<param name="memoryCache"></param>
</member>
<member name="M:Vote.Services.ApiController.OutsideWallService.Query(System.String)">
<member name="M:Vote.Services.ApiController.OutsideWallService.ExportExcel(Vote.Services.Dto.NbzcGetListInput)">
<summary>
获取三居系统中的社区
</summary>
<returns></returns>
导出Excel
</summary>
<returns></returns>
</member>
<member name="M:Vote.Services.ApiController.OutsideWallService.GetCommunitys(System.String)">
<summary>
@@ -166,6 +166,13 @@
<param name="pathType"></param>
<returns></returns>
</member>
<member name="M:Vote.Services.ApiController.OutsideWallService.GetCode(System.Int32,System.Boolean)">
<summary>
生成随机字母与数字
</summary>
<param name="Length">生成长度</param>
<param name="Sleep">是否要在生成前将当前线程阻止以避免重复</param>
</member>
<member name="M:Vote.Services.ApiController.OutsideWallService.Submit(Vote.Services.Dto.OutsideWallInput)">
<summary>
提交