integrated_traffic_uniapp/pages/application/safetymeeting/safetymeeting-detail.vue

352 lines
10 KiB
Vue
Raw Normal View History

2024-03-05 18:13:32 +08:00
<template>
<view>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">安全例会详情</block>
</cu-custom>
<scroll-view scroll-y>
<view class="dy-card">
<view class="dy-card-title">
<text>{{pd.MEETING_TITLE}}</text>
</view>
<view class="dy-card-content">
<view class="dy-card-content-item">
<text>主持人</text>
<text>{{pd.HOST_PERSON}}</text>
</view>
<view class="dy-card-content-item">
<text>记录人</text>
<text>{{pd.RECORDER}}</text>
</view>
<view class="dy-card-content-item">
<text>会议开始时间</text>
<text>{{pd.MEETING_DATE_START}}</text>
</view>
<view class="dy-card-content-item">
<text>会议结束时间</text>
<text>{{pd.MEETING_DATE_END}}</text>
</view>
<view class="dy-card-content-item">
<text>会议类型</text>
<text>{{pd.MEETING_TYPE === '1' ? '安全生产例会' : pd.MEETING_TYPE === '2' ? '安全生产委员会会议' : ''}}</text>
</view>
<view class="dy-card-content-item">
<text>会议内容</text>
<rich-text :nodes="pd.MEETING_CONTENT"></rich-text>
</view>
</view>
</view>
<view class="cu-tabbar-height"></view>
</scroll-view>
<uni-drawer ref="showHiddenWindow" mode="right" :mask-click="true">
<scroll-view scroll-y="true" style="height: 100vh;">
<view class="de-drawer">
<view class="cu-bar bg-white">
<view class="action">实时照片</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<!-- 循环展示隐患图片因为只允许一张故使用v-if控制 -->
<view class="bg-img" v-if="liveImgs.length > 0" @tap="ViewImage"
:data-url="liveImgs[0].FILEPATH">
<image :src="liveImgs[0].IMGFILES_ID ? (baseImgPath + liveImgs[0].FILEPATH) : liveImgs[0].FILEPATH" mode="aspectFill"></image>
<!-- 删除图片按钮 -->
<view class="cu-tag bg-red" @tap.stop="DelImg" data-type="0">
<text class='cuIcon-close'></text>
</view>
</view>
<!-- 上传图片按钮仅当没有图片时显示 -->
<view class="solids" @tap="ChooseImage"
v-if="liveImgs.length === 0">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
2024-03-05 18:13:32 +08:00
</view>
</view>
<view class="cu-form-group" style="border: none;" v-if="!forbidEdit">
<view class="title">签字</view>
<button class="cu-btn bg-green shadow" @tap="modalShow = true" data-target="Modal">手写签字</button>
2024-03-05 18:13:32 +08:00
</view>
<view class="cu-bar bg-white" v-show="signImgList && signImgList.length > 0">
<view class="action">
签字照片
</view>
2024-03-05 18:13:32 +08:00
</view>
<view class="cu-form-group" v-show="signImgList && signImgList.length > 0">
<view class="grid col-4 grid-square flex-sub">
<view style="width: 60%;" class="bg-img" v-for="(item,index) in signImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="signImgList[index].filePath">
<image :src="signImgList[index].filePath" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="delImg" data-type="0" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
2024-03-05 18:13:32 +08:00
</view>
</view>
<view class="cu-modal" :class="{'show':modalShow}">
<sign @confirm="subCanvas" @cancel="modalShow = false"></sign>
</view>
<view class="cu-form-group" style="margin-top: 20px;">
<button class="cu-btn block bg-blue margin-tb-sm" @click="submitMeetingAttendance"></button>
</view>
2024-03-05 18:13:32 +08:00
</scroll-view>
</uni-drawer>
<view class="cu-form-group">
<view class="title">是否参会</view>
<button class="cu-btn round bg-blue" @click="addMeeting"></button>
2024-03-05 18:13:32 +08:00
</view>
</view>
</template>
<script>
import {
basePath,loginUser
} from '@/common/tool.js';
import sign from '@/components/sign/sign.vue';
2024-03-05 18:13:32 +08:00
import ykAuthpup from "@/components/yk-authpup/yk-authpup"
import {baseImgPath} from "../../../common/tool";
2024-03-05 18:13:32 +08:00
export default {
components: {
sign,
2024-03-05 18:13:32 +08:00
ykAuthpup
},
data() {
return {
baseImgPath: baseImgPath,
modalShow: false,
2024-03-05 18:13:32 +08:00
permissionID:'',
SAFETY_MEETING_ID : '',
varList:[],
pd:[],
noClick:true,
ACCIDENTS_NAME:"",
MEETING_TITLE:"",
MEETING_TYPE:"",
MEETING_ADDRESS:"",
HOST_PERSON:"",
MEETING_CONTENT:"",
RECORDER:"",
MEETING_DATE_START:"",
MEETING_DATE_END:"",
liveImgs: [],
signImgList: [],
LIVEPHOTOS: '',
SIGNATUREPICTURE: '',
2024-03-05 18:13:32 +08:00
}
},
onLoad(e){
var _this = this;
_this.SAFETY_MEETING_ID=e.id;
_this.getData();
},
methods: {
//跳转事件
goToEdit(e) {
uni.navigateTo({
url: '/pages/application/basic-info-manage/basic-information/basic-information-edit'
});
},
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/safetymeeting/goEdit',
method: 'POST',
dataType: 'json',
header:{
'Content-type':'application/x-www-form-urlencoded'
},
data: {
SAFETY_MEETING_ID: _this.SAFETY_MEETING_ID,
USER_ID:loginUser.USER_ID,
},
success: (res) => {
if (res.data != null) {
uni.hideLoading();
_this.pd = res.data.pd;
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
ChooseImage() {
var _this = this;
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['camera'],
success: (res) => {
let img = {
IMGFILES_ID: '',
FILEPATH: res.tempFilePaths[0]
};
_this.liveImgs = [img];
}
});
},
DelImg() {
var _this = this;
uni.showModal({
content: '确定要删除这张图片吗?',
cancelColor: "#000000",
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
_this.liveImgs = [];
}
}
})
},
subCanvas (e) {
this.signImgList.splice(0, this.signImgList.length);
this.signImgList.push(e);
this.SIGNATUREPICTURE = e.filePath;
this.modalShow = false;
},
delImg (e) {
var _this = this;
let i = e.currentTarget.dataset.index
uni.showModal({
content: '确定要删除这张图片吗?',
cancelColor: "#000000",
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
_this.signImgList.splice(i, 1)
}
}
})
},
submitMeetingAttendance() {
if (this.liveImgs.length === 0 || this.signImgList.length === 0) {
uni.showToast({
title: '请上传实时照片和签字图片',
icon: 'none'
});
return;
}
2024-03-05 18:13:32 +08:00
const livePhotoPath = this.liveImgs[0].FILEPATH;
const signPhotoPath = this.signImgList[0].filePath;
const params = {
SAFETY_MEETING_ID: this.SAFETY_MEETING_ID,
LIVEPHOTOS: livePhotoPath,
SIGNATUREPICTURE: signPhotoPath,
ATTENDANCE_STATUS: '1'
};
uni.showLoading({
title: '提交中...'
});
uni.request({
url: basePath + '/app/safetymeeting/edit',
method: 'POST',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: params,
success: (res) => {
uni.hideLoading();
if (res.data.result === 'success') {
uni.showToast({
title: '提交成功',
icon: 'success'
});
this.$refs.showHiddenWindow.close();
} else {
uni.showToast({
title: '提交失败',
icon: 'none'
});
}
}
});
},
addMeeting() {
2024-03-05 18:13:32 +08:00
if (this.$refs.showHiddenWindow) {
// 清空实时照片和签字图片数组
this.liveImgs = [];
this.signImgList = [];
2024-03-05 18:13:32 +08:00
this.$refs.showHiddenWindow.open();
}
this.creatorList = [{
NAME: loginUser.NAME,
USER_ID: loginUser.USER_ID
}]
// 重新打开抽屉(drawer)时,上面的代码会重置照片和签字
2024-03-05 18:13:32 +08:00
this.$refs['showHiddenWindow'].open()
this.showHiddenWindow = true
this.hiddenIsEdit = true
},
openAuth(permissionID){
this.permissionID = permissionID;
setTimeout(()=>{
this.$refs['authpup'].open();
},200)
},
}
}
</script>
<style>
.dy-card {
background-color: #fff;
border-radius: 10upx;
margin: 30upx;
}
.dy-card-title {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #eee;
min-height: 80upx;
line-height: 80upx;
padding: 0 30upx;
}
.dy-card-content {
padding: 0upx 30upx 30upx;
}
.dy-card-content-item {
margin-top: 20upx;
}
.dy-card-content-item .title {
display: flex;
align-items: center;
}
/* 注释掉未使用的样式 */
/* .dy-card-content-item .title .l {
width: 10upx;
height: 30upx;
border-radius: 20upx;
background-color: #666;
margin-right: 10upx;
} */
.dy-card-content-item .content,
.dy-card-content-item .name text {
background-color: #F1F1F1;
padding: 10upx 14upx;
margin-top: 14upx;
line-height: 1.6;
display: inline-block; /* 如果需要显示为inline-block */
}
.delete-icon text {
color: white; /* 图标颜色为白色 */
font-size: 14px; /* 图标大小,根据需要调整 */
}
</style>