Commit ba1ce7ce authored by xinzhedeai's avatar xinzhedeai

add:特种作业

parent 9d630289
html,
body {
letter-spacing: 0.01rem;
}
.wrapper {
/* padding: 0.2rem; */
background-color: #fff;
}
.header {
padding: 0.2rem;
}
.func_btn {
width: 7.12rem;
height: 0.8rem;
background: #1081e3;
border-radius: 0.1rem;
font-family: PingFang SC;
font-weight: 500;
font-size: 0.3rem;
color: #ffffff;
margin: 0 auto;
border-width: 0;
margin-left: 0.2rem;
cursor: pointer;
}
.func_btn span {
font-size: 0.5rem;
vertical-align: -0.05rem;
margin-right: 0.1rem;
}
/* 添加以下样式 */
.van-tabs__line {
background-color: #1989fa;
}
.blue-text {
color: #1989fa;
font-weight: 500;
}
.van-list {
background: #fff;
border-radius: 8px;
margin: 0 0.1rem;
}
.subNavWrapper .van-cell {
padding: 12px 10px;
}
.van-tab {
color: #000;
}
.van-tab__text {
font-weight: bold;
font-size: 0.3rem;
/* color: #000; */
}
.van-tab--active {
color: #1081e3;
}
.van-field__label {
font-weight: bold;
}
.van-field__control {
color: #737373;
}
.subNavWrapper {
background-color: #f5f6fa;
padding: 0.2rem 0.2rem;
margin-top: 0rem;
}
.subNavWrapper .van-tab__text {
color: #5b5b5b;
}
.subNavWrapper .van-tab--active span {
color: #fff;
font-size: 0.28rem;
}
.subNavWrapper .van-tabs__nav--card {
border: none !important;
}
.subNavWrapper .van-tabs--card {
margin-bottom: 0.3rem;
}
.subNavWrapper .van-tabs__nav--card .van-tab {
color: #5b5b5b;
border: none !important;
}
.subNavWrapper .van-tabs__nav--card .van-tab.van-tab--active {
color: #ffffff;
background: #58a5e8;
border-radius: 0.4rem;
}
.subNavWrapper .van-list {
background: #f5f6fa;
}
.subNavWrapper .van-cell {
margin-bottom: 0.3rem;
}
.subNavWrapper .van-tabs__nav {
background: #f5f6fa;
margin: 0;
}
.navToBtn {
color: #5b5b5b;
font-size: 0.36rem;
margin-top: 0.04rem;
position: absolute;
right: 0;
}
/* 应急演练提示内容样式 */
.msgTip{
background: rgb(251, 231, 231);
border-radius: 0.04rem;
font-weight: 500;
font-size: 0.28rem;
color: rgb(255, 0, 0);
padding: .2rem .3rem;
}
.tab1-row1{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 8px;
}
.bold{
color: #333;
font-size: 0.3rem;
font-weight: bold;
}
.tab1-row2{
display: flex; justify-content: space-between; color: #666; font-size: 0.28rem; margin-bottom: 8px;
}
.tab1-row2 span{
display: inline-block; width: 50%;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover">
<title>特种作业报备</title>
<script type="text/javascript" src="../sdk/includeHead.js"></script>
</head>
<body>
<div id="app">
<div class="wrapper" v-cloak>
<!-- 商户头部信息 -->
<div class="header">
<van-search v-model="title" show-action placeholder="请输入特种作业类型" @search="onSearch">
<template #action>
<div @click="onSearch"></div>
</template>
</van-search>
</div>
<!-- 功能 -->
<button v-if="userType!=='shop'" type="info" class="func_btn" @click="viewDetail"><span>+</span>特种作业报备</button>
<div class="subNavWrapper">
<van-list v-model:loading="loading" :offset="10" :finished="finished" finished-text="没有更多了" @load="getList" :immediate-check="false">
<van-cell v-for="item in hazardList" :key="item.id" @click="viewDetail(item)">
<div style="width: 100%;position: relative;">
<div class="tab1-row1" v-if="userType=='wgy'||userType=='safety'">
<span>商家名称:{{ item.exerciseDate }}</span>
</div>
<div class="tab1-row1" v-if="userType=='shop'">
<span>特种作业类型:{{ item.exerciseDate }}</span>
</div>
<div class="tab1-row1">
<span>作业时间:{{ item.exerciseDate }}</span>
</div>
<div class="tab1-row1">
<span>作业公司:{{ item.exerciseDate }}</span>
</div>
<div class="tab1-row1">
<span>作业人员姓名:{{ item.exerciseDate }}</span>
</div>
</div>
</van-cell>
</van-list>
</div>
</div>
</body>
</html>
\ No newline at end of file
/**
* author: dabao
* date: 2024-03-15
* description: 商户首页
*/
var VUE = null
window.addEventListener("load", function() {
VUE = new Vue({
el: '#app',
data() {
return {
reMark:'',
title: '',
userType: gemhoUtil.getCookie('userType'),
hazardList: [ // 更多示例数据...
],
merId: '',
loading: false,
finished: false,
page: 1,
size: 6,
total: 0,
}
},
mounted() {
this.init() // 获取隐患记录
},
methods: {
reset() {
this.page = 1
this.size = 10
this.total = 0
this.hazardList = []
},
onSearch() {
console.log('xxxx', this.title)
this.init()
},
init() {
this.reset()
this.getList()
},
viewDetail(item) {
let params = {
id: item.id ||'',
merId: gemhoUtil.getParameter('merId'),
pageName: '_tezhongzuoye'
}
// 这里添加跳转逻辑
var pageUrl = '_tezhongzuoye_detail.html' // 安全培训详情页面
let url = gemhoUtil.setParameter(pageUrl, params)
gemhoUtil.navigatePage(url, '跳转中...')
},
getList() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post({
serviceId: API_KEY_MAP['page']['id'],
interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: {
sign: 30,
title: this.title,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
sort: 'lawId,desc',
},
},
(res) => {
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
this.page = this.page - 1 // 重新请求后,分页数恢复上一次请求的值
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
console.log('接口信息', result)
if (result.code !== 200 && result.data == null) {
return
}
this.hazardList.push(...result.rows)
this.reMark = result.reMark
this.total = result.total
if (this.page * this.size >= this.total) {
this.finished = true // 下滑不在刷新数据
}
}
this.loading = false
}
)
}, 0)
},
}
});
})
\ No newline at end of file
html,
body {
letter-spacing: 0.01rem;
background-color: #fff;
overflow-x: hidden;
}
.wrapper {
/* padding: 0.2rem; */
background-color: #fff;
}
.header {
padding: 0.2rem;
background: #fff;
}
.header .title {
font-weight: bold;
font-size: 0.32rem;
color: #000000;
display: flex;
justify-content: start;
align-items: center;
gap: 0.2rem;
padding: 0.3rem 0.3rem;
}
.header .title img {
width: 0.51rem;
height: 0.52rem;
}
.detail {
width: 100%;
/* height: 1.88rem; */
background: #f5f6fa;
border-radius: 0.01rem;
/* padding-left: 0.2rem; */
padding: 0.3rem;
margin-bottom: 0.2rem;
display: flex;
align-items: start;
flex-direction: column;
justify-content: space-around;
/* padding-bottom: 0.1rem;
gap: 0.1rem; */
}
.detail .van-col {
font-family: PingFang SC;
font-weight: 500;
font-size: 0.28rem;
color: #737373;
}
.detail span {
font-family: PingFang SC;
font-weight: 500;
font-size: 0.28rem;
color: #737373;
}
.detail .detail_link {
position: absolute;
right: 0.3rem;
font-size: 0.26rem;
color: #1081e3;
cursor: pointer;
}
.func_btn {
width: 7.12rem;
height: 0.8rem;
background: #1081e3;
border-radius: 0.1rem;
font-family: PingFang SC;
font-weight: 500;
font-size: 0.3rem;
color: #ffffff;
margin: 0 auto;
border-width: 0;
margin-left: 0.2rem;
cursor: pointer;
}
.func_btn span {
font-size: 0.5rem;
vertical-align: -0.05rem;
margin-right: 0.1rem;
}
.tag {
display: inline-block;
width: 1.9rem;
height: 0.42rem;
line-height: 0.42rem;
text-align: center;
border-radius: 21px;
font-weight: 500;
font-size: 0.28rem;
color: #ffffff;
}
.green {
background: #00b55e;
}
.yellow {
background: rgba(255, 148, 21, 1);
}
.red {
background: rgba(255, 33, 49, 1);
}
/* 添加以下样式 */
.van-tabs__line {
background-color: #1989fa;
}
.blue-text {
color: #1989fa;
font-weight: 500;
}
.van-list {
background: #fff;
border-radius: 8px;
margin: 0 0.1rem;
}
.subNavWrapper .van-cell {
padding: 12px 10px;
}
.van-tab {
color: #000;
}
.van-tab__text {
font-weight: bold;
font-size: 0.3rem;
/* color: #000; */
}
.van-tab--active {
color: #1081e3;
}
.van-field__label {
font-weight: bold;
}
.van-field__control {
color: #737373;
}
.navToBtn {
color: #5b5b5b;
font-size: 0.36rem;
margin-top: 0.04rem;
position: absolute;
right: 0;
}
[v-cloak] {
display: none;
}
/* 基础重置样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
/* 去除移动端点击高亮 */
}
body {
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
font-size: 16px;
background-color: #f8f9fa;
}
/* 表单容器 */
.form-container {
max-width: 750px;
/* 移动端最大宽度 */
margin: .05rem auto .2rem;
padding: 0 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
/* 表单单项 */
.form-item {
display: flex;
align-items: center;
/* 垂直居中 */
height: 50px;
padding: 0 12px;
border-bottom: 1px solid #f0f2f5;
}
/* 最后一项去除下边框 */
.form-item:last-child {
border-bottom: none;
}
/* 表单标题 */
.form-label {
flex-shrink: 0;
/* 防止标题被压缩 */
width: 1.8rem;
/* 标题固定宽度,可根据需求调整 */
color: #333;
font-size: .15rem;
text-align: left;
/* 标题左对齐 */
}
/* 输入框容器 */
.form-input-wrap {
flex: 1;
/* 占据剩余空间 */
height: 100%;
display: flex;
align-items: center;
padding-left: 0.2rem;
}
/* 输入框样式 */
.form-input {
width: 100%;
height: .7rem;
/* 输入框高度小于容器,留出垂直空间 */
border: none;
outline: none;
font-size: .3rem;
color: #666;
}
/* 输入框placeholder样式 */
.form-input::placeholder {
color: #999;
font-size: .14rem;
}
/* 输入框聚焦效果 */
.form-input:focus {
color: #262626;
}
.imager-item-title {
height: .5rem;
line-height: .5rem;
/* padding: 0 .12rem !important; */
font-size: .14rem !important;
margin-left: .24rem !important;
/* border-bottom: 1px solid #f0f2f5; */
margin-bottom: .15rem !important;
font-weight: 400;
}
.save-btn {
width: 98%;
background: #1890ff;
color: #fff;
border: none;
padding: 7px 20px;
border-radius: 3px;
font-size: 16px;
cursor: pointer;
margin-bottom: .4rem;
}
.textareaEle {
width: 100%;
border: 1px solid #CACACA;
font-size: .28rem;
border-radius: .05rem;
padding: .15rem;
}
.merchant-icon {
width: 100%;
}
.date-wrapper .van-cell {
padding-left: 0;
margin-top: -.23rem;
}
/* 必填标题 */
.title_require {
position: relative;
padding: 0;
margin: 0;
/* margin-top: 0.1rem; */
/* padding-left: 0.2rem; */
font-size: .28rem;
}
.title_require::before {
position: absolute;
content: '*';
color: #ee0a24;
font-size: .14rem;
left: -10px;
top: 50%;
transform: translateY(-50%);
}
.selector {
width: 4rem;
height: 0.6rem;
font-size: 0.3rem;
border: 1px solid #d7d7d7;
background-color: #fff;
}
input:disabled {
background-color: #fff;
color: #9b9fab;
}
select:disabled {
border: none;
/* 移除默认箭头 */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* 调整右侧内边距,防止文字溢出 */
padding-right: 25px;
/* 可选:统一背景色 */
background-color: white;
}
.form-label-div {
height: 50px;
line-height: 50px;
padding: 0 12px;
font-size: .28rem;
font-weight: 500;
margin-bottom: -.3rem;
}
.img-wrapper {
display: flex;
gap: .16rem;
margin-top: 0.25rem;
margin-bottom: 0.15rem;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover" />
<title>应急演练</title>
<!-- 在 includeHead.js 之后添加环境判断 -->
<script src="../sdk/includeHead.js"></script>
<script type="text/javascript" src="../sdk/axios_http3.js"></script>
</head>
<body>
<div id="app" class="page_wrapper" v-cloak>
<div class="third-layer">
<!-- form开始 -->
<div class="form-container">
<div class="form-item">
<span class="form-label title_require">单位名称</span>
<div class="form-input-wrap">
{{ formData.xxx || '养大酸奶有限公司' }}
</div>
</div>
<div class="form-item">
<span class="form-label title_require">联系人</span>
<div class="form-input-wrap">
{{ formData.xxx || '养大酸奶有限公司' }}
</div>
</div>
<div class="form-item">
<span class="form-label title_require">电话</span>
<div class="form-input-wrap">
{{ formData.xxx || '养大酸奶有限公司' }}
</div>
</div>
<div class="form-item">
<span class="form-label title_require">特种作业类别</span>
<div class="form-input-wrap">
<select class="selector" v-model="formData.safetyTrainingType" :disabled="flag=='XQ'">
<option v-for="(item, i) in tabList4lv2" v-if="item.dictValue!='0'" :key="i"
:label="item.dictLabel" :value="item.dictValue">
</option>
</select>
</div>
</div>
<div class="form-item">
<span class="form-label title_require">作业公司</span>
<div class="form-input-wrap">
<input type="text" v-model="formData.title" :disabled="flag=='XQ'" class="form-input"
placeholder="">
</div>
</div>
<div class="form-item">
<span class="form-label title_require">作业人员姓名</span>
<div class="form-input-wrap">
<input type="text" v-model="formData.participantsNum" :disabled="flag=='XQ'"
class="form-input" placeholder="">
</div>
</div>
<!-- 详情模式 -->
<div class="form-label form-label-div">上传作业证件(最多6张)</div>
<div class="img-wrapper">
<div style="position: relative;" v-for="(imgItem, index) in formData.images">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.images, index)" />
<div v-if="flag=='XG'" class="van-uploader__preview-delete"
@click="handleDeleteFloorPlan(index, 'floorPlan')"><i
class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div>
<div v-if="formData.images.length<6 && flag=='ADD' ">
<van-uploader :before-read="beforeRead" :after-read="(file) => afterRead(file, 'floorPlan')"
class="uploader-wrapper" :deletable="false" :preview-image="false">
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt=""
srcset="">
</van-uploader>
</div>
</div>
<div><van-checkbox v-model="formData.check">
我已阅读
<span style="color:blue; font-size:.2rem;">《提醒事项》</span>
</van-checkbox>
<!-- form结束 -->
<button class="save-btn" style="margin-left: 50%; transform: translateX(-50%);" v-if="!formData.id"
@click="submitForm">提交报备</button>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
/**
* author: dabao
* date: 2024-03-15
* description: 商户首页
*/
var VUE = null
window.addEventListener("load", function() {
VUE = new Vue({
el: '#app',
data() {
return {
previewUrl: BASE_URL,
flag: 'XQ',
flag: 'ADD',
showDatePicker: false, // 控制日期选择器显示
minDate: new Date(gemhoUtil.getTargetDateYMD()), // 最小可选日期
maxDate: new Date(2099, 11, 31), // 最大可选日期
tabList4lv2: [],
// 日期选择的最小范围,这里设置为当前日期的前 10 年
// maxDate: new Date(new Date().getFullYear() + 10, 11),
// 新增以下数据
formData: {
images: [],
exerciseDate: gemhoUtil.getTargetDateYMD(),
},
id: ''
}
},
created() {
},
mounted() {
this.id = gemhoUtil.getParameter('id')
if (this.id) { // 详情
this.flag = 'XQ'
this.detail() // 获取商户信息
} else {
this.flag = 'ADD'
}
},
methods: {
// 处理平面图删除
handleDeleteFloorPlan(index, type) {
this.formData.images.splice(index, 1);
},
beforeRead(file) {
if (!['image/png', 'image/jpeg', 'image/jpg'].includes(file.type)) {
vant.Dialog.alert({
title: '信息提示',
message: '文件格式不正确'
})
return;
}
if (file.size > (10 * 1024 * 1024)) {
vant.Dialog.alert({
title: '信息提示',
message: '文件大小不可超过10M'
})
return false;
}
return true;
},
afterRead(file, type) { // 调用爱山东中台系统,将数据流传递过去
vant.Toast.loading({
message: '正在处理...',
forbidClick: true,
loadingType: 'spinner',
});
// 文件读取完成后的处理逻辑
const formData = new FormData();
formData.append('file', file.file); // 通过FormData构建要上传的文件数据
// formData.append('biz_content',SM.encrypt('dangerjob', API_KEY_MAP["upload"]["publicKey"]));
// 发送HTTP POST请求
fetch(BASE_URL + '/common/upload', {
method: 'POST',
body: formData,
headers: {
'Authorization': gemhoUtil.getCookie('token'),
}
})
.then(response => {
if (response.ok) {
return response.json();
}
throw new Error('Network response was not ok.');
})
.then(value => {
console.log(value, 'value图片上********'); // 处理后端返回的数据
if (value) { // 返回信息不为空,则进行解密操作
this.formData.images.push(value.fileName)
// 可根据后端返回的数据做进一步处理,如显示上传成功信息等
setTimeout(() => {
vant.Toast.clear()
}, 0);
} else {
this.afterRead(file)
}
})
.catch(error => {
// console.error('There has been a problem with your fetch operation:', error);
});
},
showDatePickerModal() {
if (this.flag == 'XQ') {
return
}
this.showDatePicker = true
},
showImage(list, index) {
const images = list.map((item) => {
return this.previewUrl + item
})
console.log(images, 'images')
vant.ImagePreview({
images,
startPosition: index,
closeable: true,
});
},
gotoPage(stringifyUrl) {
let url = gemhoUtil.setParameter(`src/_${stringifyUrl}.html`)
gemhoUtil.navigatePage(url, '跳转中...')
},
// 确认日期选择
onDateConfirm(date) {
// 将 Date 对象格式化为 YYYY-MM-DD 字符串
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
this.formData.exerciseDate = `${year}-${month}-${day}`;
this.showDatePicker = false;
},
// 文件上传处理
handleFileUpload(file) {
console.log('上传文件:', file);
// 此处可添加实际文件上传逻辑
},
submitForm() {
if (!this.formData.title) {
vant.Dialog.alert({
message: '演练标题不可为空',
})
return;
}
if (!this.formData.participantsNum) {
vant.Dialog.alert({
message: '负责人数不可为空',
})
return;
}
if (!this.formData.responsiblePerson) {
vant.Dialog.alert({
message: '负责人不可为空',
})
return;
}
if (!this.formData.images.length) {
vant.Dialog.alert({
message: '图片不可为空',
})
return;
}
vant.Toast.loading({
message: '正在处理...',
forbidClick: true,
loadingType: 'spinner',
});
var reqParam = {
merId: gemhoUtil.getParameter('merId'),
exerciseType: '2', // 应急演练
...this.formData,
}
reqParam.images = this.formData.images.join(',')
http3.post('/gaoqu/exercise', reqParam).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: res.code === 200 ? '操作成功' : '操作失败',
})
// location.reload()
})
},
//获取商户信息
detail() {
vant.Toast.loading({
message: '正在加载...',
forbidClick: true,
loadingType: 'spinner',
})
setTimeout(() => {
http2.post({
serviceId: API_KEY_MAP['no-page']['id'],
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 31,
exerciseId: this.id,
sort: 'lawId,desc',
},
},
(res) => {
console.log('res', JSON.parse(res))
if (!res) {
// 中台返回为undefined 重新请求
vant.Toast.clear()
setTimeout(() => {
// this.getList()
}, 0)
return
}
if (res) {
var result = JSON.parse(res)
// 图片数据结构处理
let tempData = result.data
if (tempData['images']) {
tempData['images'] = tempData['images'] ? tempData[
'images'].split(',') : []
}
this.formData = tempData
}
}
)
}, 0)
},
}
});
})
\ 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