增加接口联调
This commit is contained in:
@@ -15,147 +15,160 @@
|
||||
</customHeader>
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<!-- 1 单选 2多选 3判断 4 问答 5 读卡 6 扫码 7 拍照 8 视频 9 定位(暂时去掉了) -->
|
||||
<view class="white-bg">
|
||||
<view class="blue-title">{{optionObj.optionName}}</view>
|
||||
<view class="blue-sub-title" style="margin-bottom:20rpx;">
|
||||
巡检日期:<text>{{parseTime(optionObj.planTime,'{y}-{m}-{d} 星期{a}')}}</text>
|
||||
</view>
|
||||
<view class="report-list" v-for="(item, index) in optionObj.list" :key="index">
|
||||
<!-- 单选 -->
|
||||
<block v-if="item.pointType==1">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<multipleSelect :multiple="false" :value="item.chooseList" downInner
|
||||
:options="item.optionList" @change="(...args) => changeCheck(...args, item)"
|
||||
:slabel="'optionContent'" :svalue="'optionId'"
|
||||
>
|
||||
</multipleSelect>
|
||||
</block>
|
||||
<!-- 多选 -->
|
||||
<block v-else-if="item.pointType==2">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<multipleSelect :multiple="true" :value="item.chooseList" downInner
|
||||
:options="item.optionList" @change="(...args) => changeCheck(...args, item)"
|
||||
:slabel="'optionContent'" :svalue="'optionId'"
|
||||
>
|
||||
</multipleSelect>
|
||||
</block>
|
||||
<!-- 判断 -->
|
||||
<block v-if="item.pointType==3">
|
||||
<view class="r-list">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="r-right">
|
||||
<radio-group @change="radioChange($event,item)" style="transform:scale(0.9)">
|
||||
<!-- <radio value="1" color="#02C74C" style="margin-right:30rpx;" >是</radio>
|
||||
<radio value="2" color="#02C74C">否</radio> -->
|
||||
<radio :value="item2.optionId+''" color="#02C74C"
|
||||
v-for="(item2,index) in item.optionList" :key="index"
|
||||
:style="{marginRight:index==0?'30rpx':'0'}"
|
||||
<!-- 下拉刷新 -->
|
||||
<mescroll-uni ref="mescrollRef" @init="mescrollInit"
|
||||
:down="downOption" @down="downCallback"
|
||||
:fixed="false" class="scroll-h"
|
||||
>
|
||||
<!-- 1 单选 2多选 3判断 4 问答 5 读卡 6 扫码 7 拍照 8 视频 9 定位(暂时去掉了) -->
|
||||
<view class="white-bg">
|
||||
<view class="blue-title">{{optionObj.groupName}}</view>
|
||||
<view class="blue-sub-title" style="margin-bottom:20rpx;">
|
||||
巡检日期:<text>{{parseTime(optionObj.lastCheckTime,'{y}-{m}-{d} 星期{a}')}}</text>
|
||||
</view>
|
||||
<block v-if="optionObj.pointList">
|
||||
<block v-if="optionObj.pointList.length>0">
|
||||
<view class="report-list" v-for="(item, index) in optionObj.pointList" :key="index">
|
||||
<!-- 单选 -->
|
||||
<block v-if="item.pointType==1">
|
||||
<view class="r-left" style="width:100%">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<multipleSelect :multiple="false" :value="item.chooseList" downInner
|
||||
:options="item.optionList" @change="(...args) => changeCheck(...args, item)"
|
||||
:slabel="'optionContent'" :svalue="'optionTitle'"
|
||||
>
|
||||
{{item2.optionContent}}
|
||||
</radio>
|
||||
</radio-group>
|
||||
</multipleSelect>
|
||||
</block>
|
||||
<!-- 多选 -->
|
||||
<block v-else-if="item.pointType==2">
|
||||
<view class="r-left" style="width:100%">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<multipleSelect :multiple="true" :value="item.chooseList" downInner
|
||||
:options="item.optionList" @change="(...args) => changeCheck(...args, item)"
|
||||
:slabel="'optionContent'" :svalue="'optionTitle'"
|
||||
>
|
||||
</multipleSelect>
|
||||
</block>
|
||||
<!-- 判断 -->
|
||||
<block v-if="item.pointType==3">
|
||||
<view class="r-list">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="r-right">
|
||||
<radio-group @change="radioChange($event,item)" style="transform:scale(0.9)">
|
||||
<radio :value="item2.optionTitle" color="#02C74C"
|
||||
v-for="(item2,index) in item.optionList" :key="index"
|
||||
:style="{marginRight:index==0?'30rpx':'0'}"
|
||||
:checked="item2.optionTitle === item.resultContent"
|
||||
>
|
||||
{{item2.optionContent}}
|
||||
</radio>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 问答 -->
|
||||
<block v-else-if="item.pointType==4">
|
||||
<view class="r-left" style="width:100%">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="r-input">
|
||||
<!-- <input class="uni-input" placeholder="请输入" placeholder-class="place-input" /> -->
|
||||
<textarea class="textarea" v-model="item.resultContent" auto-height placeholder="请输入" placeholder-class="place-input"></textarea>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 读卡 -->
|
||||
<block v-else-if="item.pointType==5">
|
||||
<view class="r-list" >
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="r-right" @click.stop="initNFC">
|
||||
<img :src="'static/images/polling/icon-NFCcode.png'" class="img-nfc" /> 开始识别
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</block>
|
||||
<!-- 扫码 -->
|
||||
<block v-else-if="item.pointType==6">
|
||||
<view class="r-list">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="r-right r-active" v-if="item.resultContent" @click="handleScan(item)">
|
||||
<img :src="'static/images/polling/icon-QRcode-b.png'" class="img-nfc" />
|
||||
<view>扫码成功<view class="r-font">点击再次扫码</view></view>
|
||||
</view>
|
||||
<view class="r-right" v-else @click="handleScan(item)">
|
||||
<img :src="'static/images/polling/icon-QRcode.png'" class="img-nfc" /> 开始扫码
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef APP-PLUS -->
|
||||
<view class="r-right r-active">
|
||||
<img :src="'static/images/polling/icon-QRcode-b.png'" class="img-nfc" />
|
||||
<view>扫码成功</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</block>
|
||||
<!-- 拍照 -->
|
||||
<block v-else-if="item.pointType==7">
|
||||
<view class="r-left" style="width:100%">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<view class="img-show" v-for="(item2,index) in imgArr2" :key="index">
|
||||
<img :src="item2" />
|
||||
</view>
|
||||
<view class="img-con" @click="chooseImage(item)">
|
||||
<img :src="'static/images/polling/icon-AddPic.png'" class="img-pic" />
|
||||
<view>添加照片</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 视频 -->
|
||||
<block v-else-if="item.pointType==8">
|
||||
<view class="r-left" style="width:100%">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<view class="img-show" v-for="(item2,index) in videoArr2" :key="index">
|
||||
<video :src="item2" controls></video>
|
||||
</view>
|
||||
<view class="img-con" @click="chooseVideo(item)">
|
||||
<img :src="'static/images/polling/icon-AddVideo.png'" class="img-pic" />
|
||||
<view>添加视频</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="report-border" :style="{borderColor:index<optionObj.pointList.length-1?'#E7E7E7':'#fff'}"></view>
|
||||
</view>
|
||||
<view class="btn-submit">
|
||||
<button type="primary" @click="handleSubmit" :loading="submitLoading">提交</button>
|
||||
</view>
|
||||
</block>
|
||||
<view v-else class="no-data">
|
||||
<img :src="'static/images/polling/pic-NoResult.png'" class="no-pic" />
|
||||
</view>
|
||||
</block>
|
||||
<!-- 问答 -->
|
||||
<block v-else-if="item.pointType==4">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="r-input">
|
||||
<!-- <input class="uni-input" placeholder="请输入" placeholder-class="place-input" /> -->
|
||||
<textarea class="textarea" v-model="item.result" auto-height placeholder="请输入" placeholder-class="place-input"></textarea>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 读卡 -->
|
||||
<block v-else-if="item.pointType==5">
|
||||
<view class="r-list">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="r-right" @click="initNFC">
|
||||
<img :src="'static/images/polling/icon-NFCcode.png'" class="img-nfc" /> 开始识别
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</block>
|
||||
<!-- 扫码 -->
|
||||
<block v-else-if="item.pointType==6">
|
||||
<view class="r-list">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view class="r-right r-active" v-if="scanStr" @click="handleScan">
|
||||
<img :src="'static/images/polling/icon-QRcode-b.png'" class="img-nfc" />
|
||||
<view>扫码成功<view class="r-font">点击再次扫码</view></view>
|
||||
</view>
|
||||
<view class="r-right" v-else @click="handleScan">
|
||||
<img :src="'static/images/polling/icon-QRcode.png'" class="img-nfc" /> 开始扫码
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</block>
|
||||
<!-- 拍照 -->
|
||||
<block v-else-if="item.pointType==7">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<view class="img-show" v-for="(item,index) in imgArr" :key="index">
|
||||
<img :src="item" />
|
||||
</view>
|
||||
<view class="img-con" @click="chooseImage">
|
||||
<img :src="'static/images/polling/icon-AddPic.png'" class="img-pic" />
|
||||
<view>添加照片</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 视频 -->
|
||||
<block v-else-if="item.pointType==8">
|
||||
<view class="r-left">
|
||||
<view>{{String(index+1).padStart(2, '0')+'.'}}</view>
|
||||
<view>{{ item.pointName }}</view>
|
||||
</view>
|
||||
<view class="img-flex">
|
||||
<!-- v-for="(item,index) in videoArr" :key="index" -->
|
||||
<view class="img-show" v-for="(item,index) in videoArr" :key="index">
|
||||
<!-- @error="videoErrorCallback"
|
||||
:danmu-list="danmuList" -->
|
||||
<!-- <video id="myVideo" :src="videoArr"
|
||||
enable-danmu danmu-btn controls
|
||||
></video> -->
|
||||
<video :src="item" controls></video>
|
||||
</view>
|
||||
<view class="img-con" @click="chooseVideo">
|
||||
<img :src="'static/images/polling/icon-AddVideo.png'" class="img-pic" />
|
||||
<view>添加视频</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="report-border" :style="{borderColor:index<optionObj.list.length-1?'#E7E7E7':'#fff'}"></view>
|
||||
<view v-else class="no-data">
|
||||
<img :src="'static/images/polling/pic-NoResult.png'" class="no-pic" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn-submit">
|
||||
<button type="primary" @click="handleSubmit">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
<!-- 弹窗提示 -->
|
||||
<pollingShowModal :visible="visible"
|
||||
@@ -170,244 +183,224 @@
|
||||
@confirm="handleConfirm"
|
||||
ref="showModel"
|
||||
></pollingShowModal>
|
||||
|
||||
<!-- 普通弹窗提示 -->
|
||||
<customShowModal
|
||||
:title="''"
|
||||
:content="content3"
|
||||
:visible="visible3"
|
||||
:btnFlag2="false"
|
||||
@confirm="handleClose3"
|
||||
ref="showModel3"
|
||||
></customShowModal>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref,onMounted,onUnmounted,nextTick,computed,reactive } from 'vue'
|
||||
import { onLoad,onHide} from '@dcloudio/uni-app';
|
||||
import { MINIO_KEY } from '@/enums/cacheEnums';
|
||||
import customHeader from '@/components/customHeader.vue';
|
||||
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
|
||||
import multipleSelect from "@/components/multipleSelect.vue";
|
||||
import pollingShowModal from "@/components/pollingShowModal.vue";
|
||||
import customShowModal from "@/components/customShowModal.vue"
|
||||
import { parseTime } from '@/utils/datetime.js';
|
||||
import { formatTaskStatus } from '@/utils/status.js';
|
||||
import { taskDetail } from '@/api/polling.js'
|
||||
import {uploadFileMinio} from '@/utils/minio.js'
|
||||
import { taskGroupDetail,submitResult,minioUpload } from '@/api/polling.js'
|
||||
import {compressImageUni,getMinioThumbUrl} from '@/utils/common.js'
|
||||
// import {uploadFileMinio} from '@/utils/minio.js'
|
||||
// #ifdef APP-PLUS
|
||||
import nfcUtil from "@/utils/nfcUtil.js"
|
||||
// #endif
|
||||
|
||||
let workId = ref(undefined);
|
||||
let checkList=[
|
||||
{ value: 0, text: "答案1" },
|
||||
{ value: 1, text: "答案2" },
|
||||
{ value: 2, text: "答案3" },
|
||||
{ value: 3, text: "答案4" },
|
||||
{ value: 4, text: "答案5" },
|
||||
{ value: 4, text: "答案6" }
|
||||
];
|
||||
let taskId = ref(undefined);
|
||||
let groupId = ref(undefined);
|
||||
let minioObj = ref({});
|
||||
onLoad(option => {
|
||||
// console.log(option)
|
||||
workId.value = option.id;
|
||||
getList();
|
||||
taskId.value = option.taskId;
|
||||
groupId.value = option.groupId;
|
||||
|
||||
minioObj.value = JSON.parse(uni.getStorageSync(MINIO_KEY) || "\{\}")
|
||||
// console.log(minioObj.value)
|
||||
})
|
||||
|
||||
|
||||
// 下拉刷新
|
||||
const mescrollRef = ref(null);
|
||||
const mescrollInit = (mescroll) => {
|
||||
mescrollRef.value = mescroll;
|
||||
};
|
||||
const downOption = ref({
|
||||
auto: true,
|
||||
textInOffset: '下拉刷新',
|
||||
textOutOffset: '释放更新',
|
||||
textLoading: '刷新中...'
|
||||
});
|
||||
// 下拉刷新
|
||||
const downCallback = async (mescroll) => {
|
||||
try {
|
||||
getList();
|
||||
} catch (error) {
|
||||
mescroll.endErr();
|
||||
} finally {
|
||||
mescroll.endSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
let list = ref([]);
|
||||
let optionObj = ref({})
|
||||
|
||||
// 获取数据列表
|
||||
const getList = () => {
|
||||
// let res = await noticeList();
|
||||
// 1 单选 2多选 3判断 4问答 5 读卡 6 扫码 7 拍照 8 视频 9 定位
|
||||
let res = {
|
||||
"code": 200,
|
||||
"msg": "操作成功",
|
||||
"data": {
|
||||
optionName:'配电箱箱体和内部线路检查',
|
||||
planTime:new Date().getTime(),
|
||||
list:[
|
||||
{
|
||||
pointName:'技术中心机房总电源', pointId:202512297899, pointType:1,
|
||||
optionList:[
|
||||
{
|
||||
"optionId": 189,
|
||||
"pointId": 188,
|
||||
"optionTitle": "A",
|
||||
"optionContent": "卫生检查1",
|
||||
"createTime": "2025-11-11 11:48:43",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:48:43",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 190,
|
||||
"pointId": 188,
|
||||
"optionTitle": "B",
|
||||
"optionContent": "卫生检查2",
|
||||
"createTime": "2025-11-11 11:48:43",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:48:43",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 191,
|
||||
"pointId": 188,
|
||||
"optionTitle": "C",
|
||||
"optionContent": "卫生检查3",
|
||||
"createTime": "2025-11-11 11:48:43",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:48:43",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 192,
|
||||
"pointId": 188,
|
||||
"optionTitle": "D",
|
||||
"optionContent": "卫生检查4",
|
||||
"createTime": "2025-11-11 11:48:43",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:48:43",
|
||||
"modifyUser": "SSEYS1695"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ pointName:'监控室消防设备阀门正常开启闭合', pointId:202512297899, pointType:2,
|
||||
optionList:[
|
||||
{
|
||||
"optionId": 182,
|
||||
"pointId": 122,
|
||||
"optionTitle": "A",
|
||||
"optionContent": "区域一",
|
||||
"createTime": "2025-11-11 11:40:52",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:40:52",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 183,
|
||||
"pointId": 122,
|
||||
"optionTitle": "B",
|
||||
"optionContent": "区域二",
|
||||
"createTime": "2025-11-11 11:40:52",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:40:52",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 184,
|
||||
"pointId": 122,
|
||||
"optionTitle": "C",
|
||||
"optionContent": "区域三",
|
||||
"createTime": "2025-11-11 11:40:52",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:40:52",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 185,
|
||||
"pointId": 122,
|
||||
"optionTitle": "D",
|
||||
"optionContent": "区域四",
|
||||
"createTime": "2025-11-11 11:40:52",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 11:40:52",
|
||||
"modifyUser": "SSEYS1695"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ pointName:'监控室10组灭火器压力指针处于绿色区域', pointId:202512297899, pointType:3,
|
||||
optionList:[
|
||||
{
|
||||
"optionId": 154,
|
||||
"pointId": 127,
|
||||
"optionTitle": "A",
|
||||
"optionContent": "是",
|
||||
"createTime": "2025-11-11 09:56:34",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 09:56:34",
|
||||
"modifyUser": "SSEYS1695"
|
||||
},
|
||||
{
|
||||
"optionId": 155,
|
||||
"pointId": 127,
|
||||
"optionTitle": "B",
|
||||
"optionContent": "否",
|
||||
"createTime": "2025-11-11 09:56:34",
|
||||
"createUser": "SSEYS1695",
|
||||
"modifyTime": "2025-11-11 09:56:34",
|
||||
"modifyUser": "SSEYS1695"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ pointName:'库房灭火器压力指针处于绿色区', pointId:202512297899,pointType:4,},
|
||||
{ pointName:'技术中心机房总电源', pointId:202512297899,pointType:5,},
|
||||
{ pointName:'监控室消防设备阀门正常监控室消防设备阀门正常监控室消防设备阀门正常', pointId:202512297899,pointType:6,},
|
||||
{ pointName:'库房灭火器压力指针处于绿色区', pointId:202512297899,pointType:7,},
|
||||
{ pointName:'技术中心机房总电源', pointId:202512297899,pointType:8,},
|
||||
],
|
||||
}
|
||||
const getList = async() => {
|
||||
let param = {
|
||||
taskId:taskId.value,
|
||||
groupId:groupId.value
|
||||
}
|
||||
let data = res.data||{};
|
||||
// data.list.forEach(item=>{
|
||||
// item.chooseList
|
||||
// })
|
||||
// 1 单选 2多选 3判断 4问答 5 读卡 6 扫码 7 拍照 8 视频 9 定位
|
||||
let res = await taskGroupDetail(param);
|
||||
let data = res||{};
|
||||
data.pointList.forEach(item=>{
|
||||
if(item.resultContent){
|
||||
if(item.pointType==2 ||item.pointType==1){
|
||||
item['chooseList'] = item.resultContent.split(",") //JSON.parse(item.resultContent)
|
||||
}else if(item.pointType==7){
|
||||
imgArr.value=[];
|
||||
imgArr2.value=[];
|
||||
let imgList = item.resultContent.split(",");
|
||||
imgList.forEach(imgUrl=>{
|
||||
imgArr.value.push(imgUrl);
|
||||
let urlNew = minioObj.value.endpoint + "/thumb/"+minioObj.value.bucketName +"/"+imgUrl
|
||||
imgArr2.value.push(urlNew)
|
||||
})
|
||||
|
||||
}else if(item.pointType==8){
|
||||
videoArr.value=[];
|
||||
videoArr2.value=[]
|
||||
let videoList = item.resultContent.split(",");
|
||||
videoList.forEach(videoUrl=>{
|
||||
videoArr.value.push(videoUrl);
|
||||
let urlNew = minioObj.value.endpoint + "/"+minioObj.value.bucketName +"/"+videoUrl
|
||||
videoArr2.value.push(urlNew)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
// console.log(data.pointList)
|
||||
optionObj.value = data
|
||||
}
|
||||
|
||||
// 跳转问题上报页面
|
||||
const handleQuestion=()=>{
|
||||
uni.navigateTo({
|
||||
url: '/pages/business/polling/problemReport?id='+workId.value
|
||||
url: '/pages/business/polling/problemReport?taskId='+taskId.value+"&groupId="+groupId.value
|
||||
});
|
||||
}
|
||||
|
||||
// radio 单选选择
|
||||
// radio 判断选择
|
||||
const radioChange=(e,item)=>{
|
||||
// console.log(e,item)
|
||||
// console.log("radioChange=>",e,item)
|
||||
let radioValue = e.detail.value;
|
||||
item['optionIds']=radioValue;
|
||||
|
||||
item['resultContent']=radioValue;
|
||||
console.log("222判断radioChange=>",item)
|
||||
}
|
||||
|
||||
// 单选多选处理
|
||||
const changeCheck = (param,param2,item) => {
|
||||
// console.log(param,param2,item)
|
||||
item['optionIds'] = param2.join(",");
|
||||
// console.log(item)
|
||||
// console.log("111多选changeCheck=>",param,param2)
|
||||
item['resultContent'] = param2.join(",");//JSON.stringify(param);
|
||||
console.log("222多选changeCheck=>",item)
|
||||
}
|
||||
|
||||
// 照片及拍照处理
|
||||
const imgArr = ref([]);
|
||||
const imgArr2=ref([]);
|
||||
const chooseImage = () => {
|
||||
imgArr.value = [];
|
||||
uni.chooseImage({
|
||||
// count: 1, // 默认是9,这里设置为1次只选1张
|
||||
sizeType: ['compressed'], // 可以指定是原图还是压缩图,可选 'original' 或 'compressed'
|
||||
sourceType: ['album', 'camera'], // 指定来源是相册还是相机,默认二者都有
|
||||
success: async (res) => {
|
||||
// 选择成功,返回本地文件路径列表
|
||||
let files = res.tempFilePaths;
|
||||
// console.log('图片临时路径:', files, res.tempFiles);
|
||||
// 显示本地图片
|
||||
imgArr.value.push(...res.tempFilePaths)
|
||||
const chooseImage = (item) => {
|
||||
console.log("item=>",item)
|
||||
try {
|
||||
uni.chooseImage({
|
||||
// count: 1, // 默认是9,这里设置为1次只选1张
|
||||
// sizeType: ['compressed'], // 可以指定是原图还是压缩图,可选 'original' 或 'compressed'
|
||||
sourceType: ['album', 'camera'], // 指定来源是相册还是相机,默认二者都有
|
||||
// quality:80,
|
||||
// width:'1920px',
|
||||
// height:'1920px',
|
||||
success: async (res) => {
|
||||
// 选择成功,返回本地文件路径列表
|
||||
let files = res.tempFilePaths;
|
||||
// console.log('111图片临时路径:', files, res.tempFiles);
|
||||
files.forEach(async file=>{
|
||||
let compressImg = file;
|
||||
// #ifdef APP-PLUS
|
||||
// 压缩图片
|
||||
compressImg = await compressImageUni(file);
|
||||
// console.log("333压缩图片返回=>",compressImg)
|
||||
// #endif
|
||||
|
||||
// 执行上传
|
||||
uploadFileMinio(res.tempFiles,'/polling',files).then(res=>{
|
||||
console.log("上传成功后图片路径====>",res)
|
||||
imgArr2.value = res;
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('选择图片失败', err);
|
||||
}
|
||||
});
|
||||
// 执行上传
|
||||
let param = {
|
||||
filePath: compressImg,
|
||||
name: 'file',
|
||||
formData: {
|
||||
directory:'polling'
|
||||
},
|
||||
}
|
||||
minioUpload(param).then(res=>{
|
||||
let data = res.data;
|
||||
// console.log("444图片上传成功=>",data)
|
||||
imgArr2.value.push(data.fileUrl)
|
||||
imgArr.value.push(data.fileName)//传给后台的路径
|
||||
item.resultContent = imgArr.value.join(",")
|
||||
})
|
||||
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('选择图片失败', err);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
|
||||
// 视频处理
|
||||
const videoSrc = ref('');
|
||||
const videoArr = ref([]);
|
||||
const chooseVideo = () => {
|
||||
const videoArr2 = ref([]);
|
||||
const chooseVideo = (item) => {
|
||||
uni.chooseVideo({
|
||||
sourceType: ['album', 'camera'], // 来源:相册和相机
|
||||
maxDuration: 60, // 最大时长(秒)
|
||||
camera: 'back', // 使用后置摄像头
|
||||
compressed: true, // 压缩视频
|
||||
success: (res) => {
|
||||
videoSrc.value=res.tempFilePath;
|
||||
videoArr.value.push(res.tempFilePath)
|
||||
console.log("res=>",res)
|
||||
// videoSrc.value=res.tempFilePath;
|
||||
// videoArr.value.push(res.tempFilePath)
|
||||
console.log('视频路径:', res.tempFilePath);
|
||||
console.log('视频时长:', res.duration);
|
||||
console.log('视频大小:', res.size);
|
||||
// console.log('视频时长:', res.duration);
|
||||
// console.log('视频大小:', res.size);
|
||||
// 执行上传
|
||||
let param = {
|
||||
filePath: res.tempFilePath,
|
||||
name: 'file',
|
||||
formData: {
|
||||
directory:'polling'
|
||||
},
|
||||
}
|
||||
minioUpload(param).then(uploadRes=>{
|
||||
let data = uploadRes.data;
|
||||
videoArr.value.push(data.fileName)//传给后台的路径
|
||||
videoArr2.value.push(data.fileUrl)
|
||||
item.resultContent = videoArr.value.join(",")
|
||||
}).finally(()=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择视频失败:', err);
|
||||
@@ -418,35 +411,40 @@ const chooseVideo = () => {
|
||||
|
||||
// nfc 处理
|
||||
let discoveryCallback = null
|
||||
const initNFC = () => {
|
||||
|
||||
const initNFC = async(item) => {
|
||||
// console.log("initNFC=>",plus)
|
||||
|
||||
//这里用异步获取读取到的NFC数据
|
||||
const nfcId = await nfcUtil.listenNFCStatus();
|
||||
console.log("initNFC=>",nfcId)
|
||||
|
||||
// 确保在 App 环境
|
||||
if (typeof plus === 'undefined') {
|
||||
showModel('此功能仅支持 App 端')
|
||||
return
|
||||
}
|
||||
// if (typeof plus === 'undefined') {
|
||||
// showModel3('此功能仅支持 App 端')
|
||||
// return
|
||||
// }
|
||||
|
||||
// 检查设备是否支持NFC
|
||||
if (!plus.nfc) {
|
||||
showModel('设备不支持 NFC')
|
||||
return;
|
||||
}
|
||||
if (!plus.nfc.isSupportNFC()) {
|
||||
showModel('设备不支持 NFC')
|
||||
return;
|
||||
}
|
||||
// // 检查设备是否支持NFC
|
||||
// if (!plus.nfc) {
|
||||
// showModel3('设备不支持 NFC')
|
||||
// return;
|
||||
// }
|
||||
// if (!plus.nfc.isSupportNFC()) {
|
||||
// showModel3('设备不支持 NFC')
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 检查NFC是否开启
|
||||
plus.nfc.isNFCEnabled((enabled) => {
|
||||
if (enabled) {
|
||||
startDiscovery()
|
||||
} else {
|
||||
showModel('请先开启设备NFC功能')
|
||||
}
|
||||
},(error) => {
|
||||
console.error('检查NFC状态失败:'+error.message);
|
||||
showModel('检查NFC状态失败')
|
||||
})
|
||||
// // 检查NFC是否开启
|
||||
// plus.nfc.isNFCEnabled((enabled) => {
|
||||
// if (enabled) {
|
||||
// startDiscovery()
|
||||
// } else {
|
||||
// showModel3('请先开启设备NFC功能')
|
||||
// }
|
||||
// },(error) => {
|
||||
// console.error('检查NFC状态失败:'+error.message);
|
||||
// showModel3('检查NFC状态失败')
|
||||
// })
|
||||
}
|
||||
// 执行NFC扫描
|
||||
const startDiscovery = () => {
|
||||
@@ -479,27 +477,14 @@ const startDiscovery = () => {
|
||||
|
||||
// 扫二维码
|
||||
const scanStr = ref(undefined);
|
||||
const handleScan = () => {
|
||||
// 调用扫码API
|
||||
const handleScan = (item) => {
|
||||
// 调用扫码API
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
scanStr.value = res.result;
|
||||
console.log('扫码结果:', res.result); // 二维码内容
|
||||
console.log('码类型:', res.scanType); // 码类型,如 QR_CODE
|
||||
// ['optionIds'] = res.result;
|
||||
// 处理扫码结果,例如跳转页面
|
||||
// 如果是URL,可以跳转
|
||||
// if (res.result.startsWith('http')) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/webview/webview?url=' + encodeURIComponent(res.result)
|
||||
// });
|
||||
// } else {
|
||||
// // 其他内容,如文本,可以展示或处理
|
||||
// uni.showModal({
|
||||
// content: `扫描到内容:${res.result}`,
|
||||
// showCancel: false
|
||||
// });
|
||||
// }
|
||||
item.resultContent = res.result
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('扫码失败:', err);
|
||||
@@ -508,9 +493,44 @@ const handleScan = () => {
|
||||
}
|
||||
|
||||
// 提交
|
||||
let submitParam = {}
|
||||
let submitLoading = ref(false)
|
||||
const handleSubmit=()=>{
|
||||
showModel('有未完成的巡检项');
|
||||
// showModel2('此巡检项已完成');
|
||||
submitLoading.value = true;
|
||||
let list = optionObj.value.pointList;
|
||||
let flag = false;
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const item = list[i];
|
||||
if(!item.resultContent){
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果有未完成的项提示
|
||||
if(flag){
|
||||
showModel('有未完成的巡检项');
|
||||
}
|
||||
|
||||
// 循环处理给后台传值
|
||||
let arr = [];
|
||||
list.forEach(item => {
|
||||
arr.push({
|
||||
pointId:item.pointId,
|
||||
resultContent:item.resultContent||'',
|
||||
resultId: item.resultId || undefined
|
||||
})
|
||||
});
|
||||
submitParam = {
|
||||
taskId:taskId.value,
|
||||
groupId:groupId.value,
|
||||
resultList:arr
|
||||
}
|
||||
console.log(flag)
|
||||
|
||||
// 都答好了直接提交
|
||||
if(!flag){
|
||||
handleConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义弹窗
|
||||
@@ -532,37 +552,70 @@ const showModel=(str)=>{
|
||||
subTime.value=undefined;
|
||||
}
|
||||
const showModel2=(str)=>{
|
||||
visible.value = true;
|
||||
content.value = str;
|
||||
subContent.value='提交时间';
|
||||
btnTxt.value='确定';
|
||||
btnFlag2.value=false;
|
||||
isGreen.value = true;
|
||||
subTime.value = new Date().getTime();
|
||||
visible.value = true;
|
||||
}
|
||||
//关闭
|
||||
const handleClose=()=>{
|
||||
visible.value = false;
|
||||
submitLoading.value = false;
|
||||
}
|
||||
|
||||
// 执行提交
|
||||
const handleConfirm=()=>{
|
||||
if(isGreen.value){
|
||||
try {
|
||||
if(isGreen.value){
|
||||
visible.value = false;
|
||||
isGreen.value=false;
|
||||
}else{
|
||||
// 执行提交
|
||||
submitResult(submitParam).then(res=>{
|
||||
subTime.value = res;
|
||||
visible.value = false;
|
||||
console.log("submitResult=>",visible.value)
|
||||
showModel2('此巡检项已完成');
|
||||
}).finally(() => {
|
||||
submitLoading.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log("==========",error)
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 组件卸载时停止监听
|
||||
// 基础弹窗
|
||||
const visible3 = ref(false);
|
||||
const content3 = ref('');
|
||||
const showModel3=(str)=>{
|
||||
visible3.value = true;
|
||||
content3.value = str;
|
||||
}
|
||||
const handleClose3=()=>{
|
||||
visible3.value = false;
|
||||
submitLoading.value = false;
|
||||
}
|
||||
|
||||
|
||||
onUnmounted(() => {
|
||||
// #ifdef APP-PLUS
|
||||
if (discoveryCallback) {
|
||||
plus.nfc.removeEventListener('discovered', discoveryCallback)
|
||||
}
|
||||
plus.nfc.stopDiscovery?.()
|
||||
// #endif
|
||||
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.scroll-h{
|
||||
/* #ifdef APP-PLUS */
|
||||
height:calc(100vh - 78px) !important;
|
||||
/* #endif */
|
||||
/* #ifndef APP-PLUS */
|
||||
height: calc(100vh - 60px) !important;
|
||||
/* #endif */
|
||||
}
|
||||
.head-right{}
|
||||
.head-right .btn-yellow{
|
||||
background-color: #FCC123;
|
||||
@@ -609,7 +662,7 @@ onUnmounted(() => {
|
||||
}
|
||||
.report-list .r-left{
|
||||
display: flex;
|
||||
/* align-items: center; */
|
||||
align-items: center;
|
||||
width:70%;
|
||||
font-size:28rpx;
|
||||
}
|
||||
@@ -715,6 +768,9 @@ onUnmounted(() => {
|
||||
}
|
||||
.r-left .r-l-right{
|
||||
|
||||
}
|
||||
.no-data{
|
||||
padding:200rpx 0 200rpx;
|
||||
}
|
||||
.no-data .no-pic{
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user