2025-03-19 19:24:36 +08:00

882 lines
26 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="main">
<div class="pageHeader">
<div class="hederContent">
<img :src="user.Membership_Headimage" alt="" />
<div>
<p>{{ detailObj.userName || "" }}</p>
<p class="fs12">巡查人员</p>
</div>
</div>
</div>
<div class="addressBox">
<div class="contentBox">
<image
src="/static/images/publicity/dingwei.png"
mode="aspectFit"
class="addressIcon"
></image>
<div>
<p class="xuncha address">{{ detailObj.template.title || "-" }}</p>
<div>
<span>巡查时间</span
><span>{{
detailObj.createdAt
? $moment(detailObj.createdAt).format("YYYY-MM-DD HH:mm:ss")
: "-"
}}</span>
</div>
</div>
</div>
</div>
<div class="formBox">
<ul>
<li>
<span :class="inputfocus ? 'circle' : 'circle'"></span>
<div class="examineContent">
<div class="titleBox">
<i :class="inputfocus ? 'img-zds activezds' : 'img-zds'"></i>
<div
:class="inputfocus ? 'titleTextActive' : 'titleText'"
style="display: flex"
>
<i style="color: red; margin-right: 5px">*</i>巡查内容
</div>
</div>
<div class="inputBox">
<textarea
auto-height
v-model="uploadResult"
placeholder="请输入巡查内容"
disabled
></textarea>
</div>
<div class="tagList" v-for="(tags, i) in tagList" :key="i">
<div class="tagName">
<span
style="display: inline-block; max-width: calc(100% - 10rpx)"
>
{{ tags.question.title || "" }}
</span>
<span v-if="tags.isRequired" style="color: red">*</span>
</div>
<div class="tagsBox">
<div
v-for="(tag, s) in tags.choiceResponse"
:key="s"
class="tagUnit active"
>
{{ tag }}
</div>
</div>
<!-- <div class="tagsBox">
<div
v-for="(tag, s) in tags.question.options"
:key="s"
@tap="selectTag(tag, tags.question)"
:class="tag.ischecked ? 'tagUnit active ' : 'tagUnit'"
>
{{ tag.text }}
</div>
</div> -->
</div>
</div>
</li>
<li>
<span :class="imgfocus ? 'circle' : 'circle'"></span>
<div class="examineContent">
<div class="titleBox">
<i
:class="
imgfocus
? 'img-upload activeupload'
: 'img-upload activeupload'
"
></i>
<div
style="display: flex"
:class="imgfocus ? 'titleTextActive' : 'titleTextActive'"
>
<i style="color: red; margin-right: 5px">*</i>现场图片
</div>
</div>
<div class="uploadBox">
<div
class="uploadList"
v-for="(item, index) in imgsList"
:key="index"
>
<image
:src="item"
@click="showImg2(index, imgsList)"
mode="aspectFill"
/>
</div>
</div>
</div>
</li>
<li>
<span
:class="
radiofocus
? 'circle circleActive circle-last'
: 'circle circle-last'
"
>
</span>
<div class="examineContent">
<radio-group style="display: flex">
<label
class="uni-list-cell"
v-for="(item, index) in options"
:key="item.value"
>
<view>
<radio
:value="item.value"
color="#409eff"
:checked="index === current"
style="transform: scale(0.8)"
:disabled="true"
/>
</view>
<view>{{ item.name }}</view>
</label>
</radio-group>
</div>
</li>
</ul>
<view v-if="pageType === 'error' && extendObj.errorStatus >= 0">
<ul>
<li>
<span class="circle"> </span>
<div class="examineContent">
<div class="titleBox">
<div class="titleTextActive" style="display: flex">
<i style="color: red; margin-right: 5px">*</i>异常处理人
</div>
</div>
<div class="inputBox" style="margin-top: 12rpx">
<picker
v-if="extendObj.errorStatus === 0"
:value="selectPersonIndex"
:range="selectPersonList"
@change="handleChangePerson"
range-key="STAFF_NAME"
>
{{
selectPersonIndex === -1
? "--请选择处理人--"
: selectPersonList[selectPersonIndex].STAFF_NAME
}}
</picker>
<view v-else>{{ showPersonName || "" }}</view>
</div>
</div>
</li>
<li>
<span :class="inputfocus ? 'circle' : 'circle'"></span>
<div class="examineContent">
<div class="titleBox">
<i class="img-zds"></i>
<div
:class="inputfocus ? 'titleTextActive' : 'titleText'"
style="display: flex"
>
<i style="color: red; margin-right: 5px">*</i>整改意见
</div>
</div>
<div class="inputBox">
<textarea
auto-height
v-model="suggestion"
placeholder="请输入整改意见"
:disabled="extendObj.errorStatus !== 0"
></textarea>
</div>
</div>
</li>
</ul>
<button
v-if="extendObj.errorStatus === 0"
class="btn"
@click="handleGetUpdate"
>
提交
</button>
</view>
<view v-if="pageType === 'error' && extendObj.errorStatus >= 1">
<ul>
<li>
<span :class="imgfocus ? 'circle' : 'circle'"></span>
<div class="examineContent">
<div class="titleBox">
<i
:class="
imgfocus
? 'img-upload activeupload'
: 'img-upload activeupload'
"
></i>
<div
style="display: flex"
:class="imgfocus ? 'titleTextActive' : 'titleTextActive'"
>
<i style="color: red; margin-right: 5px">*</i>反馈图片
</div>
</div>
<div class="uploadBox">
<div
class="uploadList"
v-for="(item, index) in feedbackImgList"
:key="index"
>
<span
v-if="extendObj.errorStatus === 1"
class="upload-file-remove"
@click.stop="deleteImgFunc(item, index)"
>×</span
>
<image
:src="item"
@click="showImg2(index, feedbackImgList)"
mode="aspectFill"
/>
</div>
<div
class="uploadAdd"
@click="submitImg"
v-if="extendObj.errorStatus === 1"
>
<div class="upload-file-add-container">
<span class="walk-manage-plus">+</span>
</div>
</div>
</div>
</div>
</li>
<li>
<span :class="inputfocus ? 'circle' : 'circle'"></span>
<div class="examineContent">
<div class="titleBox">
<i :class="inputfocus ? 'img-zds activezds' : 'img-zds'"></i>
<div
:class="inputfocus ? 'titleTextActive' : 'titleText'"
style="display: flex"
>
<i style="color: red; margin-right: 5px">*</i>反馈内容
</div>
</div>
<div class="inputBox">
<textarea
auto-height
v-model="feedbackContent"
placeholder="请输入整改意见"
:disabled="extendObj.errorStatus === 2"
></textarea>
</div>
</div>
</li>
<button
v-if="extendObj.errorStatus === 1"
class="btn"
@click="handleGetUpdate"
>
提交
</button>
</ul>
</view>
</div>
</view>
</template>
<script>
import { mapGetters } from "vuex";
export default {
data() {
let nowTime = this.$util.cutDate(new Date(), "hh:mm:ss");
return {
now_time: nowTime,
inputfocus: true, // 是否聚焦
uploadResult: "", // 巡查内容
tagList: [], // 当前显示的巡查内容
imgfocus: false, // 是否聚焦图片
radiofocus: false, // 类型的聚焦
options: [
{
name: "情况正常",
value: "0",
},
{
name: "急需处理",
value: "1",
},
],
value: "0",
current: 0,
selectAnwersList: [], // 选择的答案列表
selectAnwersObj: {}, // 已经选择答案的实际对象格式 问题的id: [选项1选项2]
detailObj: {}, //点位详情
imgsList: [],
submit: false, // 是否提交成功了
requiredList: [], // 必填项的数组
pageType: "", // 页面类型
extendObj: {},
selectPerson: "--请选择处理人--",
selectPersonIndex: -1,
selectPersonList: [],
suggestion: "", // 整改意见
feedbackContent: "", // 反馈内容
feedbackImgList: [], // 反馈图片
showPersonName: "", // 当状态过了 直接显示 名称
};
},
computed: {
...mapGetters({
user: "getUser",
}),
},
onLoad(query) {
console.log("query", query);
if (query.pageType) {
this.pageType = query.pageType;
}
console.log("this.pageType", this.pageType);
console.log("user", this.user);
if (query.id) {
this.handleGetDetail(query.id);
}
},
methods: {
// 删除图片
deleteImgFunc(item, index) {
this.feedbackImgList.splice(index, 1);
},
// 修改选择的异常处理人
handleChangePerson(e) {
let index = Number(e.detail.value);
this.selectPersonIndex = index;
},
showImg2(index, imgList) {
uni.previewImage({
urls: imgList,
current: index,
loop: true,
indicator: "number",
});
},
async handleGetDetail(id) {
const data = await this.$request.$webNodeGet(
`questionnaire-responses/${id}`
);
let obj = data.data;
console.log("obj", obj);
this.detailObj = obj;
this.tagList = obj.questionResponses;
console.log("this.tagList", this.tagList);
if (obj.extend) {
let extend = JSON.parse(obj.extend);
this.uploadResult = extend.uploadResult;
this.imgsList = extend.imgsList;
this.current = extend.situation;
this.extendObj = extend;
if (extend.errorStatus === 1) {
this.suggestion = extend.suggestion;
this.showPersonName = extend.person.MEMBERSHIP_NAME;
}
if (extend.errorStatus > 1) {
this.feedbackContent = extend.feedbackContent;
this.feedbackImgList = extend.feedbackImgList;
}
}
console.log("this.extendObj", this.extendObj);
// 获取处理人列表
if (this.extendObj.errorStatus === 0) {
this.handleGetPersonList();
}
},
async handleGetPersonList() {
const req = {
SERVERPART_ID: this.detailObj.serverPartId,
PROVINCE_CODE: this.user.ProvinceCode,
};
console.log("req", req);
const data = await this.$request.$getMp("GetDealerList", req);
console.log("handleGetPersonList", data);
let list = data.Data.List;
this.selectPersonList = list;
},
async handleGetUpdate() {
let req = {};
if (this.extendObj.errorStatus === 0) {
if (this.selectPersonIndex === -1) {
uni.showToast({
title: "请选择处理人!",
icon: "none",
});
return;
}
if (!this.suggestion) {
uni.showToast({
title: "请输入整改意见!",
icon: "none",
});
return;
}
let personObj = this.selectPersonList[this.selectPersonIndex];
console.log("personObj", personObj);
req = {
...this.extendObj,
person: personObj,
errorStatus: 1,
suggestion: this.suggestion,
suggestTime: this.$util.cutDate(new Date(), "YYYY-MM-DD hh:mm:ss"), // 选处理人的时间
suggestPerson: {
STAFF_NAME: this.user.UserName,
STAFF_ID: this.user.UserId,
MEMBERSHIP_NAME: this.user.Membership_Name,
MEMBERSHIP_ID: this.user.Membership_Id,
},
};
} else if (this.extendObj.errorStatus === 1) {
if (!(this.feedbackImgList && this.feedbackImgList.length > 0)) {
uni.showToast({
title: "请选择上传反馈图片!",
icon: "none",
});
return;
}
if (!this.feedbackContent) {
uni.showToast({
title: "请输入反馈内容!",
icon: "none",
});
return;
}
console.log("this.feedbackImgList", this.feedbackImgList);
console.log("his.feedbackContent", this.feedbackContent);
req = {
...this.extendObj,
feedbackImgList: this.feedbackImgList,
feedbackContent: this.feedbackContent,
feedbackTime: this.$util.cutDate(new Date(), "YYYY-MM-DD hh:mm:ss"), // 反馈时间
errorStatus: 2,
};
}
const data = await this.$request.$webNodePOST(
`questionnaire-responses/${this.detailObj.id}/extend`,
{ extend: JSON.stringify(req) }
);
console.log("data", data);
if (data.code === 200) {
uni.showToast({
title: "提交成功!",
icon: "success",
});
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 1000);
} else {
uni.showToast({
title: data.message,
icon: "none",
});
}
},
submitImg(e) {
this.imgfocus = true;
let _this = this;
uni.chooseImage({
count: 9, //默认9
sizeType: ["original", "compressed"],
sourceType: ["camera"],
// "album",
success: function (rs) {
console.log("rs", rs);
let quality = 100;
if (rs.tempFiles[0].size > 1024 * 200) {
quality = ((1024 * 200) / rs.tempFiles[0].size) * 100;
}
if (quality < 100 && rs.tempFiles[0].path.indexOf(".jpg") > -1) {
uni.compressImage({
src: rs.tempFilePaths[0], // 图片路径
quality: quality, // 压缩质量
success(res) {
console.log("res", res);
let data = {};
if (res.data) {
data = JSON.parse(res.data);
}
console.log("data", data);
uni.showLoading({
title: "图片上传中...",
});
uni.uploadFile({
// url: "https://user.eshangtech.com/Coop.Merchant/Handler/handler_ajax.ashx?action_type=UploadFile&folder=MBWA",
url: "https://es.robot-z.cn/oss/upload",
filePath: res.tempFilePath,
header: {
"Content-Type": "multipart/form-data",
},
formData: {},
fileType: "image",
name: "file",
success(res) {
console.log("res", res);
let data = {};
if (res.data) {
data = JSON.parse(res.data);
}
console.log("data", data);
uni.hideLoading();
_this.feedbackImgList.push(
`https://es.robot-z.cn/${data.data.path}`
);
},
fail(error) {
console.log("error", error);
_this.noPost = true;
},
});
},
fail(error) {
_this.noPost = true;
},
});
} else {
uni.showLoading({
title: "图片上传中...",
// mask: true
});
uni.uploadFile({
// url: "https://user.eshangtech.com/Coop.Merchant/Handler/handler_ajax.ashx?action_type=UploadFile&folder=MBWA",
url: "https://es.robot-z.cn/oss/upload",
filePath: rs.tempFilePaths[0],
fileType: "image",
header: {
"Content-Type": "multipart/form-data",
},
name: "file",
success(res) {
console.log("res", res);
let data = {};
if (res.data) {
data = JSON.parse(res.data);
}
console.log("data", data);
uni.hideLoading();
_this.feedbackImgList.push(
`https://es.robot-z.cn/${data.data.path}`
);
// path;
},
fail(error) {
console.log("error", error);
_this.noPost = true;
},
});
}
},
fail: function (err) {},
});
},
},
};
</script>
<style lang="less" scoped>
.main {
width: 100%;
// height: 100vh;
background-color: #fff;
box-sizing: border-box;
padding-bottom: env(safe-area-inset-bottom); /* 兼容 iOS 11.2+ */
padding-bottom: constant(safe-area-inset-bottom);
.pageHeader {
height: 120rpx;
width: 100%;
background-color: rgb(246, 246, 246);
box-shadow: rgb(214, 207, 207) 4rpx 0px 20rpx;
background: url("../../static/images/mbwa/bj_logo.png") no-repeat bottom
right;
background-size: 34%;
padding-left: 30rpx;
box-sizing: border-box;
.hederContent {
display: flex;
align-items: center;
img {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
margin-top: 10rpx;
margin-right: 20rpx;
}
}
}
.addressBox {
color: #727272;
padding: 30rpx;
.contentBox {
display: flex;
.addressIcon {
display: inline-block;
width: 49rpx;
height: 48rpx;
border-radius: 10rpx;
margin-right: 6rpx;
}
.xuncha {
font-size: 26rpx;
color: #1b1c20;
}
}
}
.formBox {
position: relative;
margin-left: 24rpx;
box-sizing: border-box;
ul {
li {
width: 100%;
position: relative;
margin-top: 16rpx;
.circle {
background-color: #b2b2b2;
height: 16rpx;
width: 16rpx;
border-radius: 50%;
position: absolute;
top: 16rpx;
left: 1rpx;
}
.circle-first {
top: 14rpx;
}
.circle-last {
top: 46rpx;
}
.circleActive {
height: 16rpx;
width: 16rpx;
border-radius: 50%;
position: absolute;
left: 1rpx;
top: 18rpx;
background-color: #409eff;
}
.examineContent {
width: 100%;
box-sizing: border-box;
padding-left: 40rpx;
.titleBox {
display: flex;
align-items: center;
.img-zds {
display: inline-block;
width: 32rpx;
height: 32rpx;
background: url("../../static/images/mbwa/content_img_gray.png")
no-repeat center;
background-size: contain;
margin-right: 6rpx;
}
.img-upload {
display: inline-block;
width: 32rpx;
height: 32rpx;
background: url("../../static/images/mbwa/pic_img_gray.png")
no-repeat center;
background-size: contain;
margin-right: 6rpx;
}
.activezds {
background-image: url("../../static/images/mbwa/zdsgl_sm_nr.png");
}
.activeupload {
background-image: url("../../static/images/mbwa/zdsgl_sm_pic.png");
}
.titleText {
font-size: 26rpx;
color: #7a7a7a;
}
.titleTextActive {
font-size: 26rpx;
color: #409eff;
}
}
.inputBox {
color: #939393;
font-size: 24rpx;
padding-bottom: 40rpx;
width: 100%;
box-sizing: border-box;
textarea {
min-height: 50rpx;
font-size: 24rpx;
line-height: 1.8;
border-bottom: 1rpx solid #eee;
margin-top: 20rpx;
color: #727272;
}
}
.tagList {
display: flex;
font-size: 24rpx;
color: #606266;
width: 100%;
box-sizing: border-box;
.tagName {
width: 200rpx;
margin-right: 16rpx;
font-size: 22rpx;
line-height: 2.9;
}
.tagsBox {
width: calc(100% - 200rpx);
// width: 546rpx;
padding: 0 24rpx 0 12rpx;
}
.tagUnit {
padding: 4rpx 16rpx;
background-color: #f4f4f4;
color: #606266;
border-radius: 24rpx;
margin: 8rpx;
font-size: 22rpx;
display: inline-block;
vertical-align: middle;
}
.active {
color: #ed7043;
background-color: #fdf1ec;
}
}
.uploadBox {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: flex-start;
width: 100%;
box-sizing: border-box;
padding: 20rpx 0;
/* padding-left: 54rpx; */
min-height: 160rpx;
.uploadList {
position: relative;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
background-color: #f1f1f1;
box-sizing: border-box;
width: 160rpx;
height: 160rpx;
border-radius: 6rpx;
margin-top: 16rpx;
}
.uploadList:nth-child(3n-1) {
margin-left: 16rpx;
margin-right: 16rpx;
}
.uploadList image {
width: 160rpx;
height: 160rpx;
border-radius: 6rpx;
}
.uploadAdd {
width: 26%;
box-sizing: border-box;
.upload-file-add-container {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
border: 1rpx dashed #c6c6c6;
height: 160rpx;
width: 160rpx;
margin-top: 15rpx;
border-radius: 6rpx;
margin-left: 12rpx;
.walk-manage-plus {
line-height: 60rpx;
width: 62rpx;
height: 62rpx;
text-align: center;
border-radius: 50%;
background-color: #409eff;
color: #ffffff;
font-size: 48rpx;
box-shadow: 0 2rpx 6rpx 0 #eee;
}
}
}
}
.uni-list-cell {
justify-content: unset;
margin-top: 28rpx;
}
.uni-list-cell:after {
background-color: #f9f9f9;
}
}
}
.active .img-zds {
background-image: url("../../static/images/mbwa/zdsgl_sm_nr.png");
}
}
.btn {
width: 80%;
margin: 0 auto;
margin-top: 50rpx;
background-color: #409eff;
border-radius: 10rpx;
color: #fff;
font-size: 28rpx;
line-height: 2.8;
margin-top: 96rpx;
}
}
}
</style>