Commit 5d9a2a34 authored by lei's avatar lei

add:index.js getuserinfo

parent c5f1e4f1
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<!-- 第二层:商户图标、名称、等级、场所类型和地址 --> <!-- 第二层:商户图标、名称、等级、场所类型和地址 -->
<div <div
class="second-layer second-layer-zf" class="second-layer second-layer-zf"
v-if="userInfo.userType!=='sj'" v-if="userInfo.userType!=='shop'"
> >
<img <img
class="merchant-icon" class="merchant-icon"
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<!-- 第二层:商户图标、名称、等级、场所类型和地址 --> <!-- 第二层:商户图标、名称、等级、场所类型和地址 -->
<div <div
class="second-layer-sj" class="second-layer-sj"
v-if="userInfo.userType=='sj'" v-if="userInfo.userType=='shop'"
> >
<div class="header"> <div class="header">
<span>商家信息</span> <span>商家信息</span>
......
...@@ -170,11 +170,11 @@ window.onload = function () { ...@@ -170,11 +170,11 @@ window.onload = function () {
setTimeout(() => { setTimeout(() => {
http2.post( http2.post(
{ {
serviceId: API_KEY_MAP['noPage']['id'], serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['noPage']['publicKey'], interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['noPage']['privateKey'], interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: { reqParams: {
sign: 9, sign: '9',
pageNum: this.page++, // 每次请求增加下一页 pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size, pageSize: this.size,
...@@ -195,69 +195,24 @@ window.onload = function () { ...@@ -195,69 +195,24 @@ window.onload = function () {
// console.log('接口回调数据', JSON.parse(res)) // console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res) var result = JSON.parse(res)
this.list.push(...result.content) // this.list.push(...result.content)
this.total = result.totalElements // this.total = result.totalElements
if (res.code !== 200 && res.data == null) { if (res.code !== 200 && res.data == null) {
return return
} }
if ( this.userInfo = {
result.data.roleDeptNameVo.roleName == '超级管理员' || userType: result.data.roleDeptNameVo.userType, // 登录用户type
result.data.roleDeptNameVo.roleName == '超级管理员' userId: '1', // 登录用户id
) { userName: '张三', // 登录用户name
this.userInfo = { deptId: '1', // 登录用户部门id
userType: 'gl', // 登录用户type deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name
userId: '1', // 登录用户id businessAddress:
userName: '张三', // 登录用户name result.data.merchantInfoNumVo.businessAddress, //
deptId: '1', // 登录用户部门id smallPlaceTypeName:
deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name result.data.merchantInfoNumVo.smallPlaceTypeName, //
role: 'dudao', unitName: result.data.merchantInfoNumVo.unitName, //
roleName: '督导人员', role: 'dudao',
} roleName: result.data.roleDeptNameVo.roleName,
} else if (result.data.roleDeptNameVo.roleName == '行业管理') {
this.userInfo = {
userType: 'gl', // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name
role: 'dudao',
roleName: '行业检查',
}
} else if (result.data.roleDeptNameVo.roleName == '街道主管') {
this.userInfo = {
userType: 'gl', // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name
role: 'dudao',
roleName: '行业检查',
}
} else if (result.data.roleDeptNameVo.roleName == '日常管理') {
this.userInfo = {
userType: 'gl', // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name
role: 'dudao',
roleName: '日常检查',
}
} else if (result.data.roleDeptNameVo.roleName == '商户') {
this.userInfo = {
userType: 'sj', // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
deptName: result.data.roleDeptNameVo.deptName, // 登录用户部门name
businessAddress:
result.data.merchantInfoNumVo.businessAddress, //
smallPlaceTypeName:
result.data.merchantInfoNumVo.smallPlaceTypeName, //
unitName: result.data.merchantInfoNumVo.unitName, //
role: 'dudao',
roleName: '商家',
}
} }
// 生成最终菜单列表 // 生成最终菜单列表
......
const API_KEY_MAP = { const API_KEY_MAP = {
'login': { // 高区应急管理平台-爱山东用户和原系统用户绑定 login: {
id: 'gqyjglptbind', // 高区应急管理平台-爱山东用户和原系统用户绑定
publicKey: '0450567ffc64139658baa28c5c9bc0415200b476baa3bcc3f9dc9dbbf8dbcff2fb5e93319127685469c84784d235220c0347e695fbf66c5ffede33e645bea8b3f0', id: 'gqyjglptbind',
privateKey: '00b92f5f2a7c40cb07d225f2e90df9b8b23569658e4f9e04dd0a4bf4a5b374063b' publicKey:
}, '0450567ffc64139658baa28c5c9bc0415200b476baa3bcc3f9dc9dbbf8dbcff2fb5e93319127685469c84784d235220c0347e695fbf66c5ffede33e645bea8b3f0',
'page': { // 隐患管理-列表 privateKey:
id: 'gqyjglptsafecheckpage', '00b92f5f2a7c40cb07d225f2e90df9b8b23569658e4f9e04dd0a4bf4a5b374063b',
publicKey: '045c149a329b0b1ece8e82643044dcf689fd75cc837369cd354b6df96853e483b747e7d4a79c1847bbcb9c6fc57a14358c0def828d31c00f83b7399d6f14e1b152', },
privateKey: '00f3449a2e8ccb6724554a6126341b7f7ac4f99e98a313ed59851ed2a30eb69176' page: {
}, // 隐患管理-列表
'no-page': { // no-page id: 'gqyjglptsafecheckpage',
id: 'gqyjglptsafecheckdetial', publicKey:
publicKey: '0432cc9a4b25646345f6ce116d566f08404e2fbb1da7e488b5333211ae82ec1c7938c46dcc9013a5e9fbd5235a482384c170f4c501991b1a9460af92dbd1ed1062', '045c149a329b0b1ece8e82643044dcf689fd75cc837369cd354b6df96853e483b747e7d4a79c1847bbcb9c6fc57a14358c0def828d31c00f83b7399d6f14e1b152',
privateKey: '5e46fef0286f55aef6bb13f12373150023a4146edcd170be770b8823b24cb319' privateKey:
}, '00f3449a2e8ccb6724554a6126341b7f7ac4f99e98a313ed59851ed2a30eb69176',
},
'no-page': {
// no-page
id: 'gqyjglptsafecheckdetial',
publicKey:
'0432cc9a4b25646345f6ce116d566f08404e2fbb1da7e488b5333211ae82ec1c7938c46dcc9013a5e9fbd5235a482384c170f4c501991b1a9460af92dbd1ed1062',
privateKey:
'5e46fef0286f55aef6bb13f12373150023a4146edcd170be770b8823b24cb319',
},
} }
window.onload = function() { window.onload = function () {
function countSelectedNo(result) { function countSelectedNo(result) {
// 获取 checkList 中 selected 为 'no' 的对象个数 // 获取 checkList 中 selected 为 'no' 的对象个数
return result.reduce((total, category) => { return result.reduce((total, category) => {
return total + category.gqCheckItemVoList.filter(item => item.itemAnswer === 2).length; return (
}, 0); total +
} category.gqCheckItemVoList.filter((item) => item.itemAnswer === 2)
.length
)
}, 0)
}
function countSelectedNotNull(result) { function countSelectedNotNull(result) {
// 获取 checkList 中 selected 不为 null 的个数 // 获取 checkList 中 selected 不为 null 的个数
return result.reduce((total, category) => { return result.reduce((total, category) => {
return total + category.gqCheckItemVoList.filter(item => item.itemAnswer !== 0).length; return (
}, 0); total +
} category.gqCheckItemVoList.filter((item) => item.itemAnswer !== 0)
.length
)
}, 0)
}
new Vue({ new Vue({
el: '#app', el: '#app',
data: { data: {
id: '', // 记录id || 隐患id id: '', // 记录id || 隐患id
pageName: '', // 页面名称(用于记录页面来源,用于操作后返回上一页) 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',
// flag: 'YH_XQ', // flag: 'YH_XQ',
deadlineOptions: ['1', '3', '5', '7'], deadlineOptions: ['1', '3', '5', '7'],
checkData: [], // 提交给后端,图片使用vant结构,base64,后端处理,不走爱山东中台。(数据量大!) checkData: [], // 提交给后端,图片使用vant结构,base64,后端处理,不走爱山东中台。(数据量大!)
originCheckData: [], originCheckData: [],
checkPageIndex: 0, checkPageIndex: 0,
noCount: 0, noCount: 0,
totalItems: 0, totalItems: 0,
notNullCount: 0, notNullCount: 0,
// 外层表单信息 // 外层表单信息
checkDate: gemhoUtil.getTargetDateYMD(), // 检查日期 checkDate: gemhoUtil.getTargetDateYMD(), // 检查日期
checkPeopleName: '', // 检查人员 checkPeopleName: '', // 检查人员
rectificationDeadline: '', // 整改截止日期 rectificationDeadline: '', // 整改截止日期
reviewDate: '', // 隐患审核日期 reviewDate: '', // 隐患审核日期
reviewRecord: '', reviewRecord: '',
}, },
mounted() { mounted() {
/** /**
* 调转该页面时需要传递参数 * 调转该页面时需要传递参数
* type : ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情 * type : ADD新增、JC_XQ检查详情、ZG_XQ整改详情、YH_XQ隐患详情
* id: 记录id || 隐患id * id: 记录id || 隐患id
* pageName: 页面名称(用于记录页面来源,用于操作后返回上一页) * pageName: 页面名称(用于记录页面来源,用于操作后返回上一页)
* *
*/ */
// this.flag = gemhoUtil.getParameter('type')
// this.flag = gemhoUtil.getParameter('type') // this.id = gemhoUtil.getParameter('id')
// this.id = gemhoUtil.getParameter('id') // this.pageName = gemhoUtil.getParameter('pageName')
// 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: {
handler(newVal) {
const snapshot = JSON.parse(JSON.stringify(newVal))
console.log('全量变化:', snapshot)
this.noCount = countSelectedNo(newVal) // selected=no 的个数
// this.totalItems = getTotalCheckListItems(newVal); // checkList 子元素总数
this.notNullCount = countSelectedNotNull(newVal) // selected 不为 null 的个数
},
deep: true,
},
},
methods: {
getOriginMatchedItemById(id) {
const result =
this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(
(item) => item.id === id
) || []
return JSON.parse(JSON.stringify(result))
},
// 处理单选变化
handleSelectionChange(val, item, index) {
console.log(val, item, '数据改变了前')
const newItem = this.getOriginMatchedItemById(item.id)
console.log(val, newItem, '数据改变了。。。。newItem')
newItem.itemAnswer = val
// console.log(this.checkData[this.checkPageIndex]['gqCheckItemVoList'])
this.$set(
this.checkData[this.checkPageIndex]['gqCheckItemVoList'],
index,
JSON.parse(JSON.stringify())
)
console.log(
val,
this.checkData[this.checkPageIndex]['gqCheckItemVoList'][index],
'数据改变了后',
index
)
},
// 文件上传处理
handleFileUpload(file) {
console.log('上传文件:', file)
// 此处可添加实际文件上传逻辑
},
// 整改天数确认
handleDeadlineConfirm(event, item) {
console.log('select选择', event.target.value)
const value = event.target.value
if (value) {
const days = parseInt(value)
item.deadlineDays = days
const deadlineDate = new Date()
deadlineDate.setDate(deadlineDate.getDate() + days)
item.deadlineDate = this.formatDate(deadlineDate)
}
// this.showDeadlinePicker = false;
},
// 日期格式化
formatDate(date) {
return `${date.getFullYear()}-${(date.getMonth() + 1)
.toString()
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
},
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() {
// 隐患详情
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
// if (type === 'YH_XQ') { // 隐患详情 // 表单数据
// this.getDetail4YH_XQ() this.checkData = result.data
// } else if (this.flag === 'ZG_XQ') { // 整改详情 }
// this.getDetail4YH_XQ() }
// } else if (this.flag === 'JC_XQ') { // 检查详情 )
// this.getDetail4JC_XQ() },
// } else if (this.flag === 'ADD') { // 新增,调用模板详情方法 getDetail4JC_XQ() {
// this.getDetail4Template() // 检查单详情
// } vant.Toast.loading({
}, message: '正在加载...',
watch: { forbidClick: true,
checkData: { loadingType: 'spinner',
handler(newVal) { })
const snapshot = JSON.parse(JSON.stringify(newVal)); http2.post(
console.log('全量变化:', snapshot); {
this.noCount = countSelectedNo(newVal); // selected=no 的个数 serviceId: API_KEY_MAP['no-page']['id'],
// this.totalItems = getTotalCheckListItems(newVal); // checkList 子元素总数 interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
this.notNullCount = countSelectedNotNull(newVal); // selected 不为 null 的个数 interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
}, reqParams: {
deep: true recordId: '1',
} },
}, },
methods: { (res) => {
getOriginMatchedItemById(id) { if (!res) {
const result = this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(item => // 中台返回为undefined 重新请求
item.id === id) || [] vant.Toast.clear()
return JSON.parse(JSON.stringify(result)) setTimeout(() => {
}, this.getDetail4YH_XQ()
// 处理单选变化 }, 0)
handleSelectionChange(val, item, index) { return
console.log(val, item, '数据改变了前') }
const newItem = this.getOriginMatchedItemById(item.id) if (res) {
console.log(val, newItem, '数据改变了。。。。newItem') console.log('接口回调数据', JSON.parse(res))
newItem.itemAnswer = val setTimeout(() => {
// console.log(this.checkData[this.checkPageIndex]['gqCheckItemVoList']) this.$nextTick(() => {
this.$set(this.checkData[this.checkPageIndex]['gqCheckItemVoList'], index, JSON.parse(JSON vant.Toast.clear()
.stringify())); })
console.log(val, this.checkData[this.checkPageIndex]['gqCheckItemVoList'][index], '数据改变了后', }, 0)
index) var result = JSON.parse(res)
}, this.checkDate = result.data.checkTime // 检查日期
// 文件上传处理 this.checkPeopleName = result.data.checkPeopleName // 检查人员
handleFileUpload(file) { this.checkData = result.data.gqCheckTypeDtoList
console.log('上传文件:', file); this.noCount = result.data.hiddenCount
// 此处可添加实际文件上传逻辑 this.notNullCount = result.data.notRectifiedCount
}, this.totalItems = result.itemAllCount
// 整改天数确认 }
handleDeadlineConfirm(event, item) { }
console.log('select选择', event.target.value) )
const value = event.target.value; },
if (value) { add4ZG_XQ() {
const days = parseInt(value); if (!this.checkData.photos.length) {
item.deadlineDays = days; vant.Dialog.alert({
const deadlineDate = new Date(); message: '请上传整改图片',
deadlineDate.setDate(deadlineDate.getDate() + days); })
item.deadlineDate = this.formatDate(deadlineDate); return
} }
// this.showDeadlinePicker = false; vant.Toast.loading({
}, message: '正在处理...',
// 日期格式化 forbidClick: true,
formatDate(date) { loadingType: 'spinner',
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`; })
}, http2.post(
getDetail4Template() { // 安全检查模板初始化 {
vant.Toast.loading({ serviceId: API_KEY_MAP['no-page']['id'],
message: '正在加载...', interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
forbidClick: true, interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
loadingType: 'spinner', reqParams: {
}); hdId: this.id,
http2.post({ photos: this.checkData,
serviceId: API_KEY_MAP["no-page"]['id'], },
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"], },
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"], (res, type) => {
reqParams: {} if (!res && !type) {
}, (res) => { // 如果是中台接口返回为undefined,则重新发起请求
if (!res) { // 中台返回为undefined 重新请求 vant.Toast.clear()
vant.Toast.clear() setTimeout(() => {
setTimeout(() => { this.add4ZG_XQ()
this.getDetail4Template() }, 0)
}, 0); return
return }
} if (res) {
if (res) { console.log('添加结果', res)
console.log('接口回调数据', JSON.parse(res)) vant.Toast({
setTimeout(() => { message: '操作成功',
this.$nextTick(() => { })
vant.Toast.clear() // history.back()
}) gemhoUtil.navigatePage(
}, 0); this.pageName + '.html',
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, add4YH_XQ(auditStatus) {
// 表单数据 // 隐患详情 审核通过或拒绝
this.checkData = JSON.parse(JSON.stringify(result.data)) vant.Toast.loading({
this.originCheckData = JSON.parse(JSON.stringify(result.data)) 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() {
var reqParam = {
merId: '1',
gqCheckTypeVoList: this.checkData,
}
var url = '/gq/checkRecord/safeCheckRecord'
}, http.post(url, reqParam).then((res) => {
getDetail4YH_XQ() { // 隐患详情 console.log('添加结果', res)
vant.Toast.loading({ vant.Toast({
message: '正在加载...', message: '操作成功',
forbidClick: true, })
loadingType: 'spinner', gemhoUtil.navigatePage(this.pageName + '.html', '操作完成,跳转中...')
}); })
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
}
})
},
getDetail4JC_XQ() { // 检查单详情
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() {
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() {
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', '操作完成,跳转中...')
})
}
}
});
}
\ No newline at end of file
...@@ -51,7 +51,7 @@ window.addEventListener('load', function () { ...@@ -51,7 +51,7 @@ window.addEventListener('load', function () {
if (!res) { if (!res) {
// 中台返回为undefined 重新请求 // 中台返回为undefined 重新请求
vant.Toast.clear() vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值 this.page = th e - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => { setTimeout(() => {
// this.getList() // this.getList()
}, 0) }, 0)
......
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