Commit 9be7af28 authored by lei's avatar lei

add:安全检查list接口、首页安全信息接口联调

parent f1d55a71
This diff is collapsed.
This diff is collapsed.
......@@ -2,101 +2,103 @@
* 请求拦截、相应拦截、错误统一处理
*/
// 环境的切换
axios.defaults.baseURL = 'http://192.168.3.37:8036'
axios.defaults.baseURL = 'http://192.168.2.16:8080'
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'] =
localStorage.getItem('Authorization')
// 请求拦截器
axios.interceptors.request.use(config => {
console.log('request拦截器', config)
vant.Toast.loading({
message: '加载中...',
forbidClick: true,
loadingType: 'spinner',
});
return config
axios.interceptors.request.use((config) => {
vant.Toast.loading({
message: '加载中...',
forbidClick: true,
loadingType: 'spinner',
})
return config
})
// 响应拦截器
axios.interceptors.response.use((res) => {
// 成功的响应数据 服务器的相关的数据返回来之后,响应拦截器能够检测到,可以做一些事
vant.Toast.clear()
return res;
}, (error) => {
// 响应失败的时候的回调函数
return Promise.reject(new Error(error))
})
axios.interceptors.response.use(
(res) => {
// 成功的响应数据 服务器的相关的数据返回来之后,响应拦截器能够检测到,可以做一些事
vant.Toast.clear()
return res
},
(error) => {
// 响应失败的时候的回调函数
return Promise.reject(new Error(error))
}
)
var http = {
get: function(url, params) {
return new Promise((resolve, reject) => {
axios
.get(url, {
params: params
})
.then(res => {
resolve(res.data)
})
.catch(err => {
reject(err.data)
})
})
},
post: function(url, params) {
return new Promise((resolve, reject) => {
axios
.post(url, params)
.then(res => {
let response = res.data
console.log('res.statusCode', response)
if (response.statusCode >= 300 || response.status >= 300) {
// alert('系统发生错误')
vant.Dialog.alert({
title: '信息提示',
message: response.message,
})
return
}
resolve(res.data)
})
.catch(err => {
reject(err.data)
})
})
},
postFile: function(url, params) {
return new Promise((resolve, reject) => {
axios({
url,
method: 'post',
data: params,
headers: {
'Content-Type': 'application/json', // 'multipart/form-data;',
'Authorization': localStorage.getItem('Authorization')
},
}).then(res => {
let response = res.data
console.log('res.statusCode', response)
if (response.statusCode >= 300 || response.status >= 300) {
// alert('系统发生错误')
vant.Dialog.alert({
title: '信息提示',
message: response.message,
})
return
}
resolve(res.data)
})
.catch(err => {
reject(err.data)
})
})
},
get: function (url, params) {
return new Promise((resolve, reject) => {
axios
.get(url, {
params: params,
})
.then((res) => {
resolve(res.data)
})
.catch((err) => {
reject(err.data)
})
})
},
post: function (url, params) {
return new Promise((resolve, reject) => {
axios
.post(url, params)
.then((res) => {
let response = res.data
console.log('res.statusCode', response)
if (response.statusCode >= 300 || response.status >= 300) {
// alert('系统发生错误')
vant.Dialog.alert({
title: '信息提示',
message: response.message,
})
return
}
resolve(res.data)
})
.catch((err) => {
reject(err.data)
})
})
},
postFile: function (url, params) {
return new Promise((resolve, reject) => {
axios({
url,
method: 'post',
data: params,
headers: {
'Content-Type': 'application/json', // 'multipart/form-data;',
Authorization: localStorage.getItem('Authorization'),
},
})
.then((res) => {
let response = res.data
console.log('res.statusCode', response)
if (response.statusCode >= 300 || response.status >= 300) {
// alert('系统发生错误')
vant.Dialog.alert({
title: '信息提示',
message: response.message,
})
return
}
resolve(res.data)
})
.catch((err) => {
reject(err.data)
})
})
},
}
......@@ -34,6 +34,8 @@ document.write('<script type="text/javascript" src="' + contextPath + '/sdk/vue.
<script type="text/javascript" src="' + contextPath + '/sdk/flexible.js"></script>\
<script type="text/javascript" src="' + contextPath + '/sdk/util.js?rev=' + jsVersion + '"></script>\
<script type="text/javascript" src="' + contextPath + '/sdk/jssdk2/apiKeyMap.js?rev=' + jsVersion + '"></script>\
<script type="text/javascript" src="' + contextPath + '/sdk/axios.min.js"></script>\
<script type="text/javascript" src="' + contextPath + '/sdk/axios_http.js"></script>\
<script type="text/javascript" src="' + contextPath + '/sdk/http.js?rev=' + jsVersion + '"></script>');
......
......@@ -14,36 +14,36 @@
<div class="header">
<!-- <div class="level">安全等级</div> -->
<div class="title">
<img src="../image/code/sj.png" alt=""><span>威海市宝威酒店有限公司</span>
<img src="../image/code/sj.png" alt=""><span>{{userInfo.unitName}}</span>
</div>
<div class="detail">
<van-row>
<van-col span="24">场所类型: 小餐饮</van-col>
<van-col span="24">场所类型: {{userInfo.smallPlaceTypeName}}</van-col>
</van-row>
<van-row type="flex" justify="space-around"
style="width:100%; margin-top: .3rem; margin-bottom: .3rem;">
<van-col span="6">自查数:75</van-col>
<van-col span="6">检查数:75</van-col>
<van-col span="6">隐患数:75</van-col>
<van-col span="6">未整改:75</van-col>
<van-col span="6">自查数:{{userData.checkSelfCount}}</van-col>
<van-col span="6">检查数:{{userData.checkCount}}</van-col>
<van-col span="6">隐患数:{{userData.hiddenCount}}</van-col>
<van-col span="6">未整改:{{userData.hiddenNoReCount}}</van-col>
</van-row>
<van-row>
<van-col span="24">山东省威海市环翠区和谐街35-6</van-col>
<van-col span="24">{{userInfo.businessAddress}}</van-col>
</van-row>
</div>
<!-- Tab栏 -->
<van-tabs v-model:active="activeTab" title-active-color="#1989fa" line-height="2px"
<van-tabs v-model:active="activeTab" @click="getMerchantSelfCheckData" title-active-color="#1989fa" line-height="2px"
style="margin-bottom: 15px;">
<van-tab title="检查记录"></van-tab>
<van-tab title="自查记录"></van-tab>
<van-tab title="检查记录" name="1"></van-tab>
<van-tab title="自查记录" name="2"></van-tab>
</van-tabs>
</div>
<van-list>
<van-cell v-for="item in filteredHazards" :key="item.id">
<van-cell v-for="item in hazardList" :key="item.id">
<div style="width: 100%;">
<!-- 第一行:隐患描述 -->
<div style="
......@@ -54,17 +54,17 @@
font-size: 0.3rem;
font-weight: bold;
font-family: PingFang SC;
">{{ item.description }}</div>
">{{ item.remark }}</div>
<!-- 第二行:状态和时间 -->
<div style="display: flex; justify-content: start; gap: .34rem; margin: 8px 0;">
<span style="color: #737373; font-size: 0.28rem;">检查时间:{{ item.date }}</span>
<span style="color: #737373; font-size: 0.28rem;">检查时间:{{ item.checkTime }}</span>
</div>
<!-- 第三行:商家和箭头 -->
<div style="display: flex; justify-content: start; gap: .4rem; align-items: center;">
<span>检查人:XXX</span>
<span>隐患数:985</span>
<span>未整改:21</span>
<span>检查人:{{item.checkPeople}}</span>
<span>隐患数:{{item.hiddenCount}}</span>
<span>未整改:{{item.notRectifiedCount}}</span>
</div>
</div>
</van-cell>
......
// 在原有Vue实例中添加
new Vue({
el: '#app',
data() {
return {
// 新增子Tab数据
subActiveTab: 0,
hazardList: [{
id: 1,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待审核',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
{
id: 2,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待整改',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
// 更多示例数据...
],
activeTab: 0,
showTimePicker: false,
// 新增以下数据
showTypePicker: false,
typeOptions: ['小餐饮', '酒店', '商场', '学校', '医疗机构'],
formData: {
principal: '',
phone: '',
area: '',
businessHours: '',
type: '', // 新增类型字段
},
checkList: [{
id: 1,
date: '2024-03-15',
result: '合格'
},
{
id: 2,
date: '2024-03-14',
result: '不合格'
}
]
}
},
computed: {
filteredHazards() {
const statusMap = ['全部', '待审核', '待整改', '已整改'];
return this.hazardList.filter(item =>
this.subActiveTab === 0 ? true : item.status === statusMap[this.subActiveTab]
);
}
},
methods: {
// 新增选择确认方法
onConfirmType(value) {
this.formData.type = value;
this.showTypePicker = false;
},
onConfirmTime(time) {
this.formData.businessHours = time;
this.showTimePicker = false;
},
statusTagType(status) {
const types = {
'待审核': 'warning',
'待整改': 'primary',
'已整改': 'success',
'整改逾期': 'danger',
};
return types[status] || '';
},
viewDetail(id) {
console.log('查看详情:', id);
// 这里添加跳转逻辑
}
}
});
\ No newline at end of file
var VUE = null
window.addEventListener('load', function () {
VUE = new Vue({
el: '#app',
data() {
return {
// 新增子Tab数据
activeTab: '1',
hazardList: [
// 更多示例数据...
],
// 新增以下数据
userInfo: {},
userData: {
checkCount: 0, //检查数
checkSelfCount: 0, //自查数
hiddenCount: 0, //隐患数
hiddenNoReCount: 0, //未整改数
},
}
},
created() {
this.init()
},
computed: {},
methods: {
//初始化页面
init() {
this.getUserInfo()
this.getUserData()
this.getMerchantSelfCheckData()
},
/**请求数据 */
// 获取用户数据的方法
getUserData() {
http
.get('/gq/checkRecord/merHomeStatistics?date=' + this.selectedDate)
.then((res) => {
if (res.code == 200) {
this.userData = res.data
}
})
},
//获取用户信息
getUserInfo() {
http.get('/gq/information/getAll/141 ').then((res) => {
if (res.code !== 200 && res.data == null) {
return
}
if (res.data.roleDeptNameVo.roleName == '商户') {
this.userInfo = {
userType: 'sj', // 登录用户type
userId: '1', // 登录用户id
userName: '张三', // 登录用户name
deptId: '1', // 登录用户部门id
deptName: res.data.roleDeptNameVo.deptName, // 登录用户部门name
businessAddress: res.data.merchantInfoNumVo.businessAddress, //
smallPlaceTypeName: res.data.merchantInfoNumVo.smallPlaceTypeName, //
unitName: res.data.merchantInfoNumVo.unitName, //
role: 'dudao',
roleName: '商家',
}
}
})
},
//获取商户自查数据
getMerchantSelfCheckData() {
http
.get(
'/gq/checkRecord/list?merId=1&pageSize=10&pageNum=0&type=' +
this.activeTab
)
.then((res) => {
this.hazardList = res.rows
})
},
},
})
})
// 在原有Vue实例中添加
new Vue({
el: '#app',
data() {
return {
shanghuName: '',
// 新增子Tab数据
subActiveTab: 0,
hazardList: [{
id: 1,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待审核',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
{
id: 2,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待整改',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
// 更多示例数据...
],
activeTab: 0,
}
},
computed: {
filteredHazards() {
const statusMap = ['全部', '待审核', '待整改', '已整改'];
return this.hazardList.filter(item =>
this.subActiveTab === 0 ? true : item.status === statusMap[this.subActiveTab]
);
}
},
methods: {
onSearch() {
console.log('xxxx')
},
// 新增选择确认方法
onConfirmType(value) {
this.formData.type = value;
this.showTypePicker = false;
},
onConfirmTime(time) {
this.formData.businessHours = time;
this.showTimePicker = false;
var VUE = null
window.addEventListener("load", function() {
VUE = new Vue({
// 在原有Vue实例中添加
el: '#app',
data() {
return {
shanghuName: '',
// 新增子Tab数据
subActiveTab: 0,
hazardList: [{
id: 1,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待审核',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
{
id: 2,
description: '消防通道被货物堵塞,存在严重安全隐患',
status: '待整改',
date: '2024-03-15',
shop: 'XX餐饮店',
type: 2
},
// 更多示例数据...
],
activeTab: 0,
}
},
statusTagType(status) {
const types = {
'待审核': 'warning',
'待整改': 'primary',
'已整改': 'success',
'整改逾期': 'danger',
};
return types[status] || '';
computed: {
filteredHazards() {
const statusMap = ['全部', '待审核', '待整改', '已整改'];
return this.hazardList.filter(item =>
this.subActiveTab === 0 ? true : item.status === statusMap[this.subActiveTab]
);
}
},
viewDetail(id) {
console.log('查看详情:', id);
// 这里添加跳转逻辑
methods: {
onSearch() {
console.log('xxxx')
},
// 新增选择确认方法
onConfirmType(value) {
this.formData.type = value;
this.showTypePicker = false;
},
onConfirmTime(time) {
this.formData.businessHours = time;
this.showTimePicker = false;
},
statusTagType(status) {
const types = {
'待审核': 'warning',
'待整改': 'primary',
'已整改': 'success',
'整改逾期': 'danger',
};
return types[status] || '';
},
viewDetail(id) {
console.log('查看详情:', id);
// 这里添加跳转逻辑
}
}
}
});
\ No newline at end of file
});
})
\ No newline at end of file
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