Commit fa817ad2 authored by xinzhedeai's avatar xinzhedeai

add:作业详情接口对接

parent 58975c71
......@@ -13,7 +13,7 @@
<div class="wrapper" v-cloak>
<!-- 商户头部信息 -->
<div class="header" v-if="userType=='shop'">
<van-search v-model="title" show-action placeholder="请输入特种作业类型" @search="onSearch">
<van-search v-model="workTypeName" show-action placeholder="请输入特种作业类型" @search="onSearch">
<template #action>
<div @click="onSearch"></div>
</template>
......@@ -34,24 +34,24 @@
<van-cell v-for="item in hazardList" :key="item.id" @click="viewDetail(item)">
<div style="width: 100%;position: relative;">
<div class="reminder-badge" v-if="item.msgFlag"></div>
<div class="tab1-row1" v-if="userType=='wgy'||userType=='safety'">
<span>商家名称:{{ item.exerciseDate }}</span>
<div class="tab1-row1" v-if="userType!=='shop'">
<span>商家名称:{{ item.merName }}</span>
</div>
<div class="tab1-row1" v-if="userType=='shop'">
<span>特种作业类型:{{ item.exerciseDate }}</span>
<span>特种作业类型:{{ item.workTypeName }}</span>
</div>
<div class="tab1-row1">
<span>作业时间起始:{{ item.exerciseDate }}</span>
<span>作业时间开始:{{ item.startTime }}</span>
</div>
<div class="tab1-row1">
<span>作业时间结束:{{ item.exerciseDate }}</span>
<span>作业时间结束:{{ item.endTime }}</span>
</div>
<div class="tab1-row1">
<span>作业公司:{{ item.exerciseDate }}</span>
<span>作业公司:{{ item.companyName }}</span>
</div>
<div class="tab1-row1">
<span>作业人员姓名:{{ item.exerciseDate }}</span>
<span>作业人员姓名:{{ item.workerName }}</span>
</div>
</div>
</van-cell>
......
......@@ -15,6 +15,7 @@ window.addEventListener("load", function() {
hazardList: [ // 更多示例数据...
],
workTypeName: '',
merId: '',
merName: '',
loading: false,
......@@ -65,8 +66,8 @@ window.addEventListener("load", function() {
interfacePublicKey: API_KEY_MAP['page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['page']['privateKey'],
reqParams: {
sign: 30,
title: this.title,
sign: 32,
workTypeName: this.workTypeName,
merName: this.merName,
pageNum: this.page++, // 每次请求增加下一页
pageSize: this.size,
......
......@@ -30,8 +30,8 @@ window.addEventListener("load", function () {
interfacePublicKey: API_KEY_MAP["no-page"]["publicKey"],
interfacePrivateKey: API_KEY_MAP["no-page"]["privateKey"],
reqParams: {
sign: 17, // 隐患详情
type: gemhoUtil.getParameter('type'),
sign: 34, // 隐患详情
workType: gemhoUtil.getParameter('type'),
}
}, (res) => {
if (res) {
......@@ -48,7 +48,7 @@ window.addEventListener("load", function () {
toolbar: false // 关键配置:禁用工具栏
},
});
quill.root.innerHTML = this.detailInfo.content || ''
quill.root.innerHTML = this.detailInfo || ''
}
})
......
......@@ -20,29 +20,29 @@
<div class="form-item">
<span class="form-label title_require">单位名称</span>
<div class="form-input-wrap" style="font-size: 15px;color: #666;">
{{ formData.xxx || '养大酸奶有限公司' }}
<div class="form-input-wrap" style="font-size: 15px;color: #9b9fab;">
{{ formData.merchantName }}
</div>
</div>
<div class="form-item">
<span class="form-label title_require">联系人</span>
<div class="form-input-wrap" style="font-size: 15px;color: #666;">
{{ formData.xxx || '养大酸奶有限公司' }}
<div class="form-input-wrap" style="font-size: 15px;color: #9b9fab;">
{{ formData.merchantName }}
</div>
</div>
<div class="form-item">
<span class="form-label title_require">电话</span>
<div class="form-input-wrap" style="font-size: 15px;color: #666;">
{{ formData.xxx || '养大酸奶有限公司' }}
<div class="form-input-wrap" style="font-size: 15px;color: #9b9fab;">
{{ formData.merchantPhone }}
</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"
<select class="selector" v-model="formData.workType" :disabled="flag=='XQ'">
<option v-for="(item, i) in tabList4lv2" :key="i"
:label="item.dictLabel" :value="item.dictValue">
</option>
</select>
......@@ -51,7 +51,7 @@
<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"
<input type="text" v-model="formData.companyName" :disabled="flag=='XQ'" class="form-input"
placeholder="">
</div>
</div>
......@@ -59,7 +59,7 @@
<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"
<input type="text" v-model="formData.workerName" :disabled="flag=='XQ'" class="form-input"
placeholder="">
</div>
</div>
......@@ -67,14 +67,14 @@
<!-- 详情模式 -->
<div class="form-label form-label-div" style="width: 4rem;">上传作业证件(最多6张)</div>
<div class="img-wrapper">
<div style="position: relative;" v-for="(imgItem, index) in formData.images">
<div style="position: relative;" v-for="(imgItem, index) in formData.attachmentFile">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.images, index)" />
@click="showImage(formData.attachmentFile, 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' ">
<div v-if="formData.attachmentFile.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="">
......@@ -118,7 +118,7 @@
</van-popup>
<div style="margin-top: .1rem;"><van-checkbox v-model="formData.check" icon-size="16px" style="color:blue; font-size:.2rem;">
我已阅读
<span style="color:blue; ">《提醒事项》</span>
<span style="color:blue;" @click="showTipPage">《提醒事项》</span>
</van-checkbox>
<!-- form结束 -->
<button class="save-btn" style="margin-top: .1rem;margin-left: 50%; transform: translateX(-50%);" v-if="!formData.id"
......
......@@ -22,10 +22,15 @@ window.addEventListener("load", function() {
// maxDate: new Date(new Date().getFullYear() + 10, 11),
// 新增以下数据
formData: {
images: [],
attachmentFile: [],
exerciseDate: gemhoUtil.getTargetDateYMD(),
workTypeName: '',
workType: '',
companyName:'',
workerName:'',
startTime: '', // 开始时间字段
endTime: '' // 结束时间字段
},
id: ''
}
......@@ -41,11 +46,12 @@ window.addEventListener("load", function() {
} else {
this.flag = 'ADD'
}
this.getDict4tab1()
},
methods: {
showTipPage(){
let param = {
type: this.formData.type,
type: this.formData.workType,
pageName: '_tezhongzuoye_detail',
}
let url = gemhoUtil.setParameter('_tezhongzuoye_detail-text.html', param)
......@@ -62,7 +68,7 @@ window.addEventListener("load", function() {
page: 1,
size: 9999,
sign: 15,
dictType: 'training_exercise_type'
dictType: 'special_work_type'
}
}, (res) => {
if (!res) { // 中台返回为undefined 重新请求
......@@ -87,7 +93,7 @@ window.addEventListener("load", function() {
},
// 处理平面图删除
handleDeleteFloorPlan(index, type) {
this.formData.images.splice(index, 1);
this.formData.attachmentFile.splice(index, 1);
},
beforeRead(file) {
if (!['image/png', 'image/jpeg', 'image/jpg'].includes(file.type)) {
......@@ -134,7 +140,7 @@ window.addEventListener("load", function() {
.then(value => {
console.log(value, 'value图片上********'); // 处理后端返回的数据
if (value) { // 返回信息不为空,则进行解密操作
this.formData.images.push(value.fileName)
this.formData.attachmentFile.push(value.fileName)
// 可根据后端返回的数据做进一步处理,如显示上传成功信息等
setTimeout(() => {
vant.Toast.clear()
......@@ -184,12 +190,12 @@ window.addEventListener("load", function() {
},
showImage(list, index) {
const images = list.map((item) => {
const attachmentFile = list.map((item) => {
return this.previewUrl + item
})
console.log(images, 'images')
console.log(attachmentFile, 'attachmentFile')
vant.ImagePreview({
images,
attachmentFile,
startPosition: index,
closeable: true,
});
......@@ -223,7 +229,7 @@ window.addEventListener("load", function() {
})
return;
}
if (!this.formData.images.length) {
if (!this.formData.attachmentFile.length) {
vant.Dialog.alert({
message: '作业证件不可为空',
......@@ -241,7 +247,7 @@ window.addEventListener("load", function() {
exerciseType: '2', // 应急演练
...this.formData,
}
reqParam.images = this.formData.images.join(',')
reqParam.attachmentFile = this.formData.attachmentFile.join(',')
http3.post('/gaoqu/exercise', reqParam).then((res) => {
console.log('添加结果', res)
......@@ -264,8 +270,8 @@ window.addEventListener("load", function() {
interfacePublicKey: API_KEY_MAP['no-page']['publicKey'],
interfacePrivateKey: API_KEY_MAP['no-page']['privateKey'],
reqParams: {
sign: 31,
exerciseId: this.id,
sign: 33,
specialWorkId: this.id,
sort: 'lawId,desc',
},
},
......@@ -283,9 +289,9 @@ window.addEventListener("load", function() {
var result = JSON.parse(res)
// 图片数据结构处理
let tempData = result.data
if (tempData['images']) {
tempData['images'] = tempData['images'] ? tempData[
'images'].split(',') : []
if (tempData['attachmentFile']) {
tempData['attachmentFile'] = tempData['attachmentFile'] ? tempData[
'attachmentFile'].split(',') : []
}
this.formData = tempData
......
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