Commit e9aa1b6c authored by xinzhedeai's avatar xinzhedeai

add;检查新增test

parent 2bc79d95
......@@ -7,9 +7,7 @@ axios.defaults.timeout = 50000
// post请求头
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
axios.defaults.headers.post['Content-Type'] = 'application/json'
axios.defaults.headers.common['systemId'] = '1'
axios.defaults.headers.common['Authorization'] =
localStorage.getItem('Authorization')
axios.defaults.headers.common['Authorization'] = gemhoUtil.getCookie('token')
// 请求拦截器
axios.interceptors.request.use((config) => {
......
......@@ -25,9 +25,9 @@
</div>
<div class="checklist-container">
<div class="item_title">
{{ checkData[checkPageIndex].name }}
{{ checkData?.[checkPageIndex]?.name }}
</div>
<div v-for="(item, index) in checkData[checkPageIndex]['gqCheckItemVoList']" :key="item.id" class="check-item">
<div v-for="(item, index) in checkData?.[checkPageIndex]?.['gqCheckItemVoList']" :key="item.id" class="check-item">
<div class="item-header">
<!-- <div class="item-number">{{ index + 1 }}</div> -->
<div class="item-title">{{ item.id }}.{{ item.name }}</div>
......
......@@ -16,6 +16,8 @@ window.onload = function() {
new Vue({
el: '#app',
data: {
id: '', // 记录id || 隐患id
pageName: '', // 页面名称(用于记录页面来源,用于操作后返回上一页)
flag: 'ZG_XQ', // 值为ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情
flag: 'ADD',
// flag: 'JC_XQ',
......@@ -35,7 +37,28 @@ window.onload = function() {
reviewRecord: '',
},
mounted() {
this.getDetail()
/**
* 调转该页面时需要传递参数
* type : ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情
* id: 记录id || 隐患id
* pageName: 页面名称(用于记录页面来源,用于操作后返回上一页)
*
*/
// this.flag = gemhoUtil.getParameter('type')
// this.id = gemhoUtil.getParameter('id')
// this.pageName = gemhoUtil.getParameter('pageName')
// if (type === 'YH_XQ') { // 隐患详情
// this.getDetail4YH_XQ()
// } else if (this.flag === 'ZG_XQ') { // 整改详情
// this.getDetail4YH_XQ()
// } else if (this.flag === 'JC_XQ') { // 检查详情
// this.getDetail4JC_XQ()
// } else if (this.flag === 'ADD') { // 新增,调用模板详情方法
// this.getDetail4Template()
// }
},
watch: {
checkData: {
......@@ -50,19 +73,6 @@ window.onload = function() {
}
},
methods: {
navTo1() {
lightAppJssdk.navigation.show({
url: '_shanghu_detail.html',
title: '高区应急扫描',
isgoback: '0',
success: function(data) {
// 成功回调
},
fail: function(data) {
// 错误返回
}
});
},
getOriginMatchedItemById(id) {
const result = this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(item =>
item.id === id) || []
......@@ -102,52 +112,210 @@ window.onload = function() {
formatDate(date) {
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
},
getDetail4INIT() { // 安全检查模板初始化
this.checkDate = res.checkDate // 检查日期
this.checkPeopleName = res.checkPeopleName // 检查人员
this.rectificationDeadline = res.rectificationDeadline // 整改截止日期
this.reviewDate = res.reviewDate // 隐患审核日期
this.reviewRecord = res.reviewRecord
this.totalItems = res.itemAllCount,
// 表单数据
this.checkData = JSON.parse(JSON.stringify(res.data))
this.originCheckData = JSON.parse(JSON.stringify(res.data))
getDetail4Template() { // 安全检查模板初始化
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
http2.post({
serviceId: API_KEY_MAP["no-page"]['id'],
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {}
}, (res) => {
if (!res) { // 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
this.getDetail4Template()
}, 0);
return
}
if (res) {
console.log('接口回调数据', JSON.parse(res))
setTimeout(() => {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
var result = JSON.parse(res)
this.checkDate = result.checkDate // 检查日期
this.checkPeopleName = result.checkPeopleName // 检查人员
this.rectificationDeadline = result.rectificationDeadline // 整改截止日期
this.reviewDate = result.reviewDate // 隐患审核日期
this.reviewRecord = result.reviewRecord
this.totalItems = result.itemAllCount,
// 表单数据
this.checkData = JSON.parse(JSON.stringify(result.data))
this.originCheckData = JSON.parse(JSON.stringify(result.data))
}
})
},
getDetail4YH_XQ() { // 隐患详情
const reqParam = {
"merId": "1",
}
this.checkDate = res.checkDate // 检查日期
this.checkPeopleName = res.checkPeopleName // 检查人员
this.rectificationDeadline = res.rectificationDeadline // 整改截止日期
this.reviewDate = res.reviewDate // 隐患审核日期
this.reviewRecord = res.reviewRecord
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
http2.post({
serviceId: API_KEY_MAP["no-page"]['id'],
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {
"hdId": "1",
}
}, (res) => {
if (!res) { // 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
this.getDetail4YH_XQ()
}, 0);
return
}
if (res) {
console.log('接口回调数据', JSON.parse(res))
setTimeout(() => {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
var result = JSON.parse(res)
this.checkDate = result.checkDate // 检查日期
this.checkPeopleName = result.checkPeopleName // 检查人员
this.rectificationDeadline = result.rectificationDeadline // 整改截止日期
this.reviewDate = result.reviewDate // 隐患审核日期
this.reviewRecord = result.reviewRecord
// 表单数据
this.checkData = result.data
}
})
// 表单数据
this.checkData = res.data
},
getDetail4JC_XQ() { // 检查单详情
const reqParam = {
"merId": "1",
}
this.checkDate = res.data.checkTime // 检查日期
this.checkPeopleName = res.data.checkPeopleName // 检查人员
this.checkData = res.data.gqCheckTypeDtoList
this.noCount = res.data.hiddenCount
this.notNullCount = res.data.notRectifiedCount
this.totalItems = res.itemAllCount
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
});
http2.post({
serviceId: API_KEY_MAP["no-page"]['id'],
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {
"recordId": "1",
}
}, (res) => {
if (!res) { // 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
this.getDetail4YH_XQ()
}, 0);
return
}
if (res) {
console.log('接口回调数据', JSON.parse(res))
setTimeout(() => {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
var result = JSON.parse(res)
this.checkDate = result.data.checkTime // 检查日期
this.checkPeopleName = result.data.checkPeopleName // 检查人员
this.checkData = result.data.gqCheckTypeDtoList
this.noCount = result.data.hiddenCount
this.notNullCount = result.data.notRectifiedCount
this.totalItems = result.itemAllCount
}
})
},
add4ZG_XQ() {
const reqParam = {
"hdId": "1",
"photos": this.checkData,
if (!this.checkData.photos.length) {
vant.Dialog.alert({
message: '请上传整改图片',
})
return;
}
vant.Toast.loading({
message: '正在处理...',
forbidClick: true,
loadingType: 'spinner',
});
http2.post({
serviceId: API_KEY_MAP["no-page"]['id'],
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {
"hdId": this.id,
"photos": this.checkData,
}
}, (res, type) => {
if (!res && !type) { // 如果是中台接口返回为undefined,则重新发起请求
vant.Toast.clear()
setTimeout(() => {
this.add4ZG_XQ()
}, 0);
return
}
if (res) {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
// history.back()
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
}
})
},
add4YH_XQ(auditStatus) { // 隐患详情 审核通过或拒绝
vant.Toast.loading({
message: '正在处理...',
forbidClick: true,
loadingType: 'spinner',
});
http2.post({
serviceId: API_KEY_MAP["no-page"]['id'],
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {
"hdId": this.id,
auditStatus
}
}, (res, type) => {
if (!res && !type) { // 如果是中台接口返回为undefined,则重新发起请求
vant.Toast.clear()
setTimeout(() => {
this.add4YH_XQ()
}, 0);
return
}
if (res) {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
// history.back()
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
}
})
},
add4JC_XQ() {
const reqParam = {
var reqParam = {
"merId": "1",
"gqCheckTypeVoList": this.checkData
}
var url = "/gq/checkRecord/safeCheckRecord"
http.post(url, reqParam).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
})
}
}
});
......
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