Commit d92b4366 authored by xinzhedeai's avatar xinzhedeai

隐患列表api 新增api

parent 633f5d92
This diff is collapsed.
This diff is collapsed.
......@@ -48,7 +48,7 @@ var userInfo = {
}
var token =
"Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJkZTZlMjMwNDEyNGU0MjA2OGE0ZDZhYTJjZDgzNGM1NyIsInVzZXIiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0.EtHtN1UsPPe-EQMZ8yCt8-ln-zpRR76ou2mUrZ8x5y_9LIoS-_0ZT5DPIHKu9fDKggIWtSYgr4aSWxkOKND6xw";
"Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI5MzYzZTcwYTUzNzU0ODkxYTQ2YWJjMGI2ZmYxNGY4OCIsInVzZXIiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0._QR-As4S1_XI3AFKDukHwJpYuOkeAW76nNGrVrhF3lJMijAuWdjriVeYBDuHVN8MsIeIi7wVn9Di4wPKvJJXDg";
localStorage.setItem('Authorization', token)
localStorage.setItem('appCounty', userInfo.user.county)
......
......@@ -68,5 +68,29 @@ var http = {
})
})
},
postFile: function(url, params) {
return new Promise((resolve, reject) => {
axios({
url,
method: 'POST',
data: params,
headers: {
'Content-Type':'multipart/form-data;',
'Authorization': localStorage.getItem('Authorization')
},
}).then(res => {
let response = res.data
console.log('res.statusCode', response)
if(response.statusCode >= 300){
// alert('系统发生错误')
return
}
resolve(res.data)
})
.catch(err => {
reject(err.data)
})
})
},
}
......@@ -20,6 +20,7 @@ document.write('<script type="text/javascript" src="' + contextPath + '/js/vue.m
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/vant/2.12.54/vant.min.js"></script>\
<script type="text/javascript" src="' + contextPath + '/js/flexible.js"></script>\
<script type="text/javascript" src="' + contextPath + '/js/axios.min.js"></script>\
<script type="text/javascript" src="' + contextPath + '/js/util.js"></script>\
<script type="text/javascript" src="' + contextPath + '/js/common.js"></script>\
<script type="text/javascript" src="' + contextPath + '/js/http.js?rev=' + jsVersion + '"></script>');
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ window.addEventListener("load", function() {
},
methods: {
nav(item){
location.href='./yh-list.html'
location.href='./yh-list.html?companyId='+item.companyId
},
resetSearchForm(){
this.page = 0
......
......@@ -9,38 +9,37 @@ window.addEventListener("load", function() {
return {
form: {
// 检查日期
hdInspectDate: '',
hdInspectDate: '2024-03-08 00:00:00',
// 检查人员
hdInspectExpert: '',
hdInspectExpert: '发发发',
// 隐患类型
hdLevel: '1',
// 安全类别
curSelectSecType: '',
curSelectSecType: '安全资料类',
// 安全检查类别
curSelectSecCheckTypeReplace: '',
curSelectSecCheckTypeReplace: '测试资料',
// 当前选择的安全检查内容
curSelectCheckContent: '',
curSelectCheckContent: '测试内容',
// 发现问题
hdName: '',
hdName: '测试问题',
// 隐患描述
hdDesc: "",
hdDesc: "水电费双方都",
// 检查依据
basis: '',
basis: '测试依据',
// 隐患整改建议
suggestion: '',
suggestion: '测试建议',
// 隐患图片
hdPic: null,
// hdPic: null,
// 隐患整改日期
hdRectificationDate: '2024-3-8 10:04:09',
hdRectificationDate: '2024-03-08',
// 隐患整改图片
hdRectificationPic: null,
// hdRectificationPic: null,
// 整改图片文件路径
rectFilePath: '',
// 审核人
hdAcceptancePerson: "刘德华",
hdRectificationRecord: '24年02月22日 审核未通过;24年02月22日 审核未通过',
hdInspectDate: '2024-3-11 14:37:53',
hdStatus: 1,
hdStatus: 0, // 整改中
},
// 企业id
companyId: localStorage.getItem('companyId'),
......@@ -122,16 +121,20 @@ window.addEventListener("load", function() {
return
}
let formData = {
...this.form
}
formData.county = localStorage.getItem('appCounty');
delete formData.hdPic
delete formData.hdRectificationPic
delete formData.imgsrcurl
delete formData.imgrecturl
delete formData.hdFilePath
delete formData.rectFilePath
let formData = new FormData()
for (const key of Object.keys(this.form)) {
formData.append(key, this.form[key]);
}
formData.append('companyId', getParameter('companyId'))
// delete formData.hdPic
// delete formData.hdRectificationPic
// delete formData.imgsrcurl
// delete formData.imgrecturl
// delete formData.hdFilePath
// delete formData.rectFilePath
// delete formData.hdInspectDate
if (!this.form.comment) {
delete formData.comment
......@@ -143,12 +146,15 @@ window.addEventListener("load", function() {
delete formData.hdRectificationDate
}
formData.append('hdPic', this.fileList[0].file )
var url = this.form.hdId ? "/api/thHiddenDanger/update" : "/api/thHiddenDanger"
http.post(url, {
...formData
}).then((res) => {
http.postFile(url, formData).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
// this.secCheckTypeReplace = res.content || []
})
......@@ -157,7 +163,8 @@ window.addEventListener("load", function() {
},
formatDate(date) {
return `${date.getFullYear() + 1}/${date.getMonth() + 1}/${date.getDate()}`;
console.log(((date.getMonth()+1)>9?'':'0'))
return `${date.getFullYear() + 1}-${((date.getMonth()+1)>9?'':'0')+(date.getMonth() + 1)}-${(date.getDate()>9?'':'0')+date.getDate()} 00:00:00`;
},
onConfirm4secType(value, index) {
console.log('value', value)
......
......@@ -26,21 +26,21 @@
<div class="list-item-wrapper" >
<p class="">
<span id="">
隐患描述 {{item==1}}
{{item.hdDesc}}
</span>
</p>
<p class="list-content-fz">
<p class="list-content-fz" v-if="item.hdStatus==0">
<van-tag type="warning" size="mini">整改中</van-tag>
</p>
<!-- <p class="list-content-fz" v-if="item==2">
<p class="list-content-fz" v-if="item.hdStatus==3">
<van-tag type="warning">待审核</van-tag>
</p>
<p class="list-content-fz" v-if="item==3">
<p class="list-content-fz" v-if="item.hdStatus==1">
<van-tag type="primary">审核通过</van-tag>
</p>
<p class="list-content-fz" v-if="item==4">
<p class="list-content-fz" v-if="item.hdStatus==2">
<van-tag type="danger">审核未通过</van-tag>
</p> -->
</p>
<div class="list-function-btn-wrapper pd-01rem">
<van-button type="info" size="mini">查看</van-button>
<van-button type="info" size="mini">编辑</van-button>
......
/**
* author: dabao
*/
var VUE = null
window.addEventListener("load", function() {
var VUE = new Vue({
VUE = new Vue({
el: '#app',
data() {
return {
......@@ -10,6 +11,9 @@ window.addEventListener("load", function() {
list: [],
loading: false,
finished: false,
page: 0,
size: 20,
total: 0
}
},
mounted() {
......@@ -20,22 +24,30 @@ window.addEventListener("load", function() {
// location.href='./yh-list.html'
},
add(){
location.href='./yh-list-detail.html'
location.href='./yh-list-detail.html?companyId='+getParameter('companyId')
},
getList(){
console.log('到底了,开始加载。。。。')
for (let i = 0; i < 10; i++) {
this.list.push(this.list.length + 1);
}
console.log(this.list)
http.get('/api/thHiddenDanger',{
page: this.page++,// 每次请求增加下一页
size: this.size,
companyId: getParameter('companyId'),
county: localStorage.getItem('appCounty'),
sort: 'hdId,desc',
}).then((res)=>{
this.loading = false; // 加载状态结束
console.log('响应结果', res.content)
this.list.push(...res.content);
this.total = res.totalElements
console.log('响应结果list', this.list)
console.log('响应结果totalElements', res.totalElements)
if(this.page*this.size >= this.total){
this.finished = true; // 下滑不在刷新数据
}
})
// 加载状态结束
this.loading = false;
// // 数据全部加载完成
if (this.list.length >= 40) {
this.finished = true;
}
}
},
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment