Commit fa817ad2 authored by xinzhedeai's avatar xinzhedeai

add:作业详情接口对接

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