Commit 5d9a2a34 authored by lei's avatar lei

add:index.js getuserinfo

parent c5f1e4f1
......@@ -44,7 +44,7 @@
<!-- 第二层:商户图标、名称、等级、场所类型和地址 -->
<div
class="second-layer second-layer-zf"
v-if="userInfo.userType!=='sj'"
v-if="userInfo.userType!=='shop'"
>
<img
class="merchant-icon"
......@@ -66,7 +66,7 @@
<!-- 第二层:商户图标、名称、等级、场所类型和地址 -->
<div
class="second-layer-sj"
v-if="userInfo.userType=='sj'"
v-if="userInfo.userType=='shop'"
>
<div class="header">
<span>商家信息</span>
......
......@@ -170,11 +170,11 @@ window.onload = function () {
setTimeout(() => {
http2.post(
{
serviceId: API_KEY_MAP['noPage']['id'],
interfacePublicKey: API_KEY_MAP['noPage']['publicKey'],
interfacePrivateKey: API_KEY_MAP['noPage']['privateKey'],
serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 9,
sign: '9',
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
......@@ -195,57 +195,13 @@ window.onload = function () {
// console.log('接口回调数据', JSON.parse(res))
var result = JSON.parse(res)
this.list.push(...result.content)
this.total = result.totalElements
// this.list.push(...result.content)
// this.total = result.totalElements
if (res.code !== 200 && res.data == null) {
return
}
if (
result.data.roleDeptNameVo.roleName == '超级管理员' ||
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: '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
userType: result.data.roleDeptNameVo.userType, // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
......@@ -256,8 +212,7 @@ window.onload = function () {
result.data.merchantInfoNumVo.smallPlaceTypeName, //
unitName: result.data.merchantInfoNumVo.unitName, //
role: 'dudao',
roleName: '商家',
}
roleName: result.data.roleDeptNameVo.roleName,
}
// 生成最终菜单列表
......
const API_KEY_MAP = {
'login': { // 高区应急管理平台-爱山东用户和原系统用户绑定
login: {
// 高区应急管理平台-爱山东用户和原系统用户绑定
id: 'gqyjglptbind',
publicKey: '0450567ffc64139658baa28c5c9bc0415200b476baa3bcc3f9dc9dbbf8dbcff2fb5e93319127685469c84784d235220c0347e695fbf66c5ffede33e645bea8b3f0',
privateKey: '00b92f5f2a7c40cb07d225f2e90df9b8b23569658e4f9e04dd0a4bf4a5b374063b'
publicKey:
'0450567ffc64139658baa28c5c9bc0415200b476baa3bcc3f9dc9dbbf8dbcff2fb5e93319127685469c84784d235220c0347e695fbf66c5ffede33e645bea8b3f0',
privateKey:
'00b92f5f2a7c40cb07d225f2e90df9b8b23569658e4f9e04dd0a4bf4a5b374063b',
},
'page': { // 隐患管理-列表
page: {
// 隐患管理-列表
id: 'gqyjglptsafecheckpage',
publicKey: '045c149a329b0b1ece8e82643044dcf689fd75cc837369cd354b6df96853e483b747e7d4a79c1847bbcb9c6fc57a14358c0def828d31c00f83b7399d6f14e1b152',
privateKey: '00f3449a2e8ccb6724554a6126341b7f7ac4f99e98a313ed59851ed2a30eb69176'
publicKey:
'045c149a329b0b1ece8e82643044dcf689fd75cc837369cd354b6df96853e483b747e7d4a79c1847bbcb9c6fc57a14358c0def828d31c00f83b7399d6f14e1b152',
privateKey:
'00f3449a2e8ccb6724554a6126341b7f7ac4f99e98a313ed59851ed2a30eb69176',
},
'no-page': { // no-page
'no-page': {
// no-page
id: 'gqyjglptsafecheckdetial',
publicKey: '0432cc9a4b25646345f6ce116d566f08404e2fbb1da7e488b5333211ae82ec1c7938c46dcc9013a5e9fbd5235a482384c170f4c501991b1a9460af92dbd1ed1062',
privateKey: '5e46fef0286f55aef6bb13f12373150023a4146edcd170be770b8823b24cb319'
publicKey:
'0432cc9a4b25646345f6ce116d566f08404e2fbb1da7e488b5333211ae82ec1c7938c46dcc9013a5e9fbd5235a482384c170f4c501991b1a9460af92dbd1ed1062',
privateKey:
'5e46fef0286f55aef6bb13f12373150023a4146edcd170be770b8823b24cb319',
},
}
window.onload = function() {
window.onload = function () {
function countSelectedNo(result) {
// 获取 checkList 中 selected 为 'no' 的对象个数
return result.reduce((total, category) => {
return total + category.gqCheckItemVoList.filter(item => item.itemAnswer === 2).length;
}, 0);
return (
total +
category.gqCheckItemVoList.filter((item) => item.itemAnswer === 2)
.length
)
}, 0)
}
function countSelectedNotNull(result) {
// 获取 checkList 中 selected 不为 null 的个数
return result.reduce((total, category) => {
return total + category.gqCheckItemVoList.filter(item => item.itemAnswer !== 0).length;
}, 0);
return (
total +
category.gqCheckItemVoList.filter((item) => item.itemAnswer !== 0)
.length
)
}, 0)
}
new Vue({
......@@ -44,12 +52,9 @@ window.onload = function() {
* 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') { // 整改详情
......@@ -63,19 +68,21 @@ window.onload = function() {
watch: {
checkData: {
handler(newVal) {
const snapshot = JSON.parse(JSON.stringify(newVal));
console.log('全量变化:', snapshot);
this.noCount = countSelectedNo(newVal); // selected=no 的个数
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 的个数
this.notNullCount = countSelectedNotNull(newVal) // selected 不为 null 的个数
},
deep: true,
},
deep: true
}
},
methods: {
getOriginMatchedItemById(id) {
const result = this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(item =>
item.id === id) || []
const result =
this.originCheckData[this.checkPageIndex]['gqCheckItemVoList'].find(
(item) => item.id === id
) || []
return JSON.parse(JSON.stringify(result))
},
// 处理单选变化
......@@ -85,50 +92,63 @@ window.onload = function() {
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)
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);
console.log('上传文件:', file)
// 此处可添加实际文件上传逻辑
},
// 整改天数确认
handleDeadlineConfirm(event, item) {
console.log('select选择', event.target.value)
const value = 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);
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')}`;
return `${date.getFullYear()}-${(date.getMonth() + 1)
.toString()
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`
},
getDetail4Template() { // 安全检查模板初始化
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 重新请求
})
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);
}, 0)
return
}
if (res) {
......@@ -137,40 +157,44 @@ window.onload = function() {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
}, 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.totalItems = result.itemAllCount),
// 表单数据
this.checkData = JSON.parse(JSON.stringify(result.data))
(this.checkData = JSON.parse(JSON.stringify(result.data)))
this.originCheckData = JSON.parse(JSON.stringify(result.data))
}
})
}
)
},
getDetail4YH_XQ() { // 隐患详情
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"],
})
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 重新请求
hdId: '1',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
this.getDetail4YH_XQ()
}, 0);
}, 0)
return
}
if (res) {
......@@ -179,7 +203,7 @@ window.onload = function() {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
}, 0)
var result = JSON.parse(res)
this.checkDate = result.checkDate // 检查日期
this.checkPeopleName = result.checkPeopleName // 检查人员
......@@ -190,28 +214,32 @@ window.onload = function() {
// 表单数据
this.checkData = result.data
}
})
}
)
},
getDetail4JC_XQ() { // 检查单详情
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"],
})
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 重新请求
recordId: '1',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
this.getDetail4YH_XQ()
}, 0);
}, 0)
return
}
if (res) {
......@@ -220,7 +248,7 @@ window.onload = function() {
this.$nextTick(() => {
vant.Toast.clear()
})
}, 0);
}, 0)
var result = JSON.parse(res)
this.checkDate = result.data.checkTime // 检查日期
this.checkPeopleName = result.data.checkPeopleName // 检查人员
......@@ -229,35 +257,38 @@ window.onload = function() {
this.notNullCount = result.data.notRectifiedCount
this.totalItems = result.itemAllCount
}
})
}
)
},
add4ZG_XQ() {
if (!this.checkData.photos.length) {
vant.Dialog.alert({
message: '请上传整改图片',
})
return;
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"],
})
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,则重新发起请求
hdId: this.id,
photos: this.checkData,
},
},
(res, type) => {
if (!res && !type) {
// 如果是中台接口返回为undefined,则重新发起请求
vant.Toast.clear()
setTimeout(() => {
this.add4ZG_XQ()
}, 0);
}, 0)
return
}
if (res) {
......@@ -266,30 +297,38 @@ window.onload = function() {
message: '操作成功',
})
// history.back()
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
gemhoUtil.navigatePage(
this.pageName + '.html',
'操作完成,跳转中...'
)
}
})
}
)
},
add4YH_XQ(auditStatus) { // 隐患详情 审核通过或拒绝
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"],
})
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,则重新发起请求
hdId: this.id,
auditStatus,
},
},
(res, type) => {
if (!res && !type) {
// 如果是中台接口返回为undefined,则重新发起请求
vant.Toast.clear()
setTimeout(() => {
this.add4YH_XQ()
}, 0);
}, 0)
return
}
if (res) {
......@@ -298,25 +337,29 @@ window.onload = function() {
message: '操作成功',
})
// history.back()
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
gemhoUtil.navigatePage(
this.pageName + '.html',
'操作完成,跳转中...'
)
}
})
}
)
},
add4JC_XQ() {
var reqParam = {
"merId": "1",
"gqCheckTypeVoList": this.checkData
merId: '1',
gqCheckTypeVoList: this.checkData,
}
var url = "/gq/checkRecord/safeCheckRecord"
var url = '/gq/checkRecord/safeCheckRecord'
http.post(url, reqParam).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
gemhoUtil.navigatePage(this.pageName+'.html', '操作完成,跳转中...')
gemhoUtil.navigatePage(this.pageName + '.html', '操作完成,跳转中...')
})
},
},
})
}
}
});
}
......@@ -51,7 +51,7 @@ window.addEventListener('load', function () {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
this.page = th e - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 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