Commit e9aa1b6c authored by xinzhedeai's avatar xinzhedeai

add;检查新增test

parent 2bc79d95
...@@ -7,9 +7,7 @@ axios.defaults.timeout = 50000 ...@@ -7,9 +7,7 @@ axios.defaults.timeout = 50000
// post请求头 // post请求头
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' // 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.post['Content-Type'] = 'application/json'
axios.defaults.headers.common['systemId'] = '1' axios.defaults.headers.common['Authorization'] = gemhoUtil.getCookie('token')
axios.defaults.headers.common['Authorization'] =
localStorage.getItem('Authorization')
// 请求拦截器 // 请求拦截器
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
</div> </div>
<div class="checklist-container"> <div class="checklist-container">
<div class="item_title"> <div class="item_title">
{{ checkData[checkPageIndex].name }} {{ checkData?.[checkPageIndex]?.name }}
</div> </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-header">
<!-- <div class="item-number">{{ index + 1 }}</div> --> <!-- <div class="item-number">{{ index + 1 }}</div> -->
<div class="item-title">{{ item.id }}.{{ item.name }}</div> <div class="item-title">{{ item.id }}.{{ item.name }}</div>
......
...@@ -16,6 +16,8 @@ window.onload = function() { ...@@ -16,6 +16,8 @@ window.onload = function() {
new Vue({ new Vue({
el: '#app', el: '#app',
data: { data: {
id: '', // 记录id || 隐患id
pageName: '', // 页面名称(用于记录页面来源,用于操作后返回上一页)
flag: 'ZG_XQ', // 值为ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情 flag: 'ZG_XQ', // 值为ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情
flag: 'ADD', flag: 'ADD',
// flag: 'JC_XQ', // flag: 'JC_XQ',
...@@ -35,7 +37,28 @@ window.onload = function() { ...@@ -35,7 +37,28 @@ window.onload = function() {
reviewRecord: '', reviewRecord: '',
}, },
mounted() { 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: { watch: {
checkData: { checkData: {
...@@ -50,19 +73,6 @@ window.onload = function() { ...@@ -50,19 +73,6 @@ window.onload = function() {
} }
}, },
methods: { methods: {
navTo1() {
lightAppJssdk.navigation.show({
url: '_shanghu_detail.html',
title: '高区应急扫描',
isgoback: '0',
success: function(data) {
// 成功回调
},
fail: function(data) {
// 错误返回
}
});
},
getOriginMatchedItemById(id) { getOriginMatchedItemById(id) {
const result = this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(item => const result = this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(item =>
item.id === id) || [] item.id === id) || []
...@@ -102,52 +112,210 @@ window.onload = function() { ...@@ -102,52 +112,210 @@ window.onload = function() {
formatDate(date) { formatDate(date) {
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`; return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
}, },
getDetail4INIT() { // 安全检查模板初始化 getDetail4Template() { // 安全检查模板初始化
this.checkDate = res.checkDate // 检查日期 vant.Toast.loading({
this.checkPeopleName = res.checkPeopleName // 检查人员 message: '正在加载...',
this.rectificationDeadline = res.rectificationDeadline // 整改截止日期 forbidClick: true,
this.reviewDate = res.reviewDate // 隐患审核日期 loadingType: 'spinner',
this.reviewRecord = res.reviewRecord });
this.totalItems = res.itemAllCount, http2.post({
// 表单数据 serviceId: API_KEY_MAP["no-page"]['id'],
this.checkData = JSON.parse(JSON.stringify(res.data)) interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
this.originCheckData = JSON.parse(JSON.stringify(res.data)) 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() { // 隐患详情 getDetail4YH_XQ() { // 隐患详情
const reqParam = { vant.Toast.loading({
"merId": "1", message: '正在加载...',
} forbidClick: true,
this.checkDate = res.checkDate // 检查日期 loadingType: 'spinner',
this.checkPeopleName = res.checkPeopleName // 检查人员 });
this.rectificationDeadline = res.rectificationDeadline // 整改截止日期 http2.post({
this.reviewDate = res.reviewDate // 隐患审核日期 serviceId: API_KEY_MAP["no-page"]['id'],
this.reviewRecord = res.reviewRecord 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() { // 检查单详情 getDetail4JC_XQ() { // 检查单详情
const reqParam = { vant.Toast.loading({
"merId": "1", message: '正在加载...',
} forbidClick: true,
this.checkDate = res.data.checkTime // 检查日期 loadingType: 'spinner',
this.checkPeopleName = res.data.checkPeopleName // 检查人员 });
this.checkData = res.data.gqCheckTypeDtoList http2.post({
this.noCount = res.data.hiddenCount serviceId: API_KEY_MAP["no-page"]['id'],
this.notNullCount = res.data.notRectifiedCount interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
this.totalItems = res.itemAllCount 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() { add4ZG_XQ() {
const reqParam = { if (!this.checkData.photos.length) {
"hdId": "1", vant.Dialog.alert({
"photos": this.checkData, 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() { add4JC_XQ() {
const reqParam = { var reqParam = {
"merId": "1", "merId": "1",
"gqCheckTypeVoList": this.checkData "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