|
@@ -46,9 +46,10 @@
|
|
<!-- 线下巡查 -->
|
|
<!-- 线下巡查 -->
|
|
<view class="map_tit">
|
|
<view class="map_tit">
|
|
<image style="width: 186rpx; height: 40rpx" src="/static/img/right_img.png"></image>
|
|
<image style="width: 186rpx; height: 40rpx" src="/static/img/right_img.png"></image>
|
|
- <view class="">巡查报告</view>
|
|
|
|
|
|
+ <view class="">{{ taskDetails.cr_title }}</view>
|
|
<image style="width: 186rpx; height: 40rpx" src="/static/img/left_img.png"></image>
|
|
<image style="width: 186rpx; height: 40rpx" src="/static/img/left_img.png"></image>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view v-if="taskDetails.progress == '-1'" style="margin-left: 10%; font-size: 36rpx; color: red">驳回原因:{{ taskDetails.feedback }}</view>
|
|
<view class="" style="width: 90%; margin: auto">
|
|
<view class="" style="width: 90%; margin: auto">
|
|
<view class="" style="display: flex; align-items: center">
|
|
<view class="" style="display: flex; align-items: center">
|
|
<view class="dw" @click="dwBtn">
|
|
<view class="dw" @click="dwBtn">
|
|
@@ -57,7 +58,7 @@
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view v-if="longitude != ''" :style="{ color: dwShow ? '#07c160' : 'red' }" style="width: 340rpx; margin-left: 20rpx; font-size: 24rpx">
|
|
<view v-if="longitude != ''" :style="{ color: dwShow ? '#07c160' : 'red' }" style="width: 340rpx; margin-left: 20rpx; font-size: 24rpx">
|
|
- 当前经纬度{{ longitude }},{{ latitude }}
|
|
|
|
|
|
+ 当前经纬度{{ latitude }},{{ longitude }}
|
|
</view>
|
|
</view>
|
|
<view v-else style="margin-left: 20rpx; color: rgba(68, 68, 68, 0.6)">请点击左侧签到按钮获取当前经纬度</view>
|
|
<view v-else style="margin-left: 20rpx; color: rgba(68, 68, 68, 0.6)">请点击左侧签到按钮获取当前经纬度</view>
|
|
</view>
|
|
</view>
|
|
@@ -94,7 +95,14 @@
|
|
<view style="width: 100%; margin: auto">
|
|
<view style="width: 100%; margin: auto">
|
|
<!-- <Segmented activeColor="#EDA98E" :current="item.status" :target="item" :values="displayedItems" @clickItem="onClickItem" styleType="button"></Segmented> -->
|
|
<!-- <Segmented activeColor="#EDA98E" :current="item.status" :target="item" :values="displayedItems" @clickItem="onClickItem" styleType="button"></Segmented> -->
|
|
<!-- 默认选中未知 -->
|
|
<!-- 默认选中未知 -->
|
|
- <Segmented activeColor="#c87d5a" :target="item" :values="displayedItems" @clickItem="onClickItem" styleType="button"></Segmented>
|
|
|
|
|
|
+ <Segmented
|
|
|
|
+ activeColor="#c87d5a"
|
|
|
|
+ :current="item.segCurrent ? item.segCurrent : 0"
|
|
|
|
+ :target="item"
|
|
|
|
+ :values="displayedItems"
|
|
|
|
+ @clickItem="onClickItem"
|
|
|
|
+ styleType="button"
|
|
|
|
+ ></Segmented>
|
|
<!-- 每项上传的照片 -->
|
|
<!-- 每项上传的照片 -->
|
|
<view class="" style="display: flex; flex-wrap: wrap; justify-content: start; margin-top: 20rpx">
|
|
<view class="" style="display: flex; flex-wrap: wrap; justify-content: start; margin-top: 20rpx">
|
|
<image
|
|
<image
|
|
@@ -186,7 +194,7 @@ export default {
|
|
videoSrc: 'https://huli-app.wenlvti.net/map_source/static/images/video/',
|
|
videoSrc: 'https://huli-app.wenlvti.net/map_source/static/images/video/',
|
|
taskDetails: {} /* 任务详情 */,
|
|
taskDetails: {} /* 任务详情 */,
|
|
taskId: '' /* 任务id */,
|
|
taskId: '' /* 任务id */,
|
|
- submitStatuso: '' /* 任务状态*/,
|
|
|
|
|
|
+ submitStatus: 1 /* 提交状态*/,
|
|
eventTypeId: '' /* 异常事件类型id */,
|
|
eventTypeId: '' /* 异常事件类型id */,
|
|
stateId: '' /* 状态id */,
|
|
stateId: '' /* 状态id */,
|
|
items: [{ title: '未知' }, { title: '正常', status: 1 }, { title: '异常', status: 2 }],
|
|
items: [{ title: '未知' }, { title: '正常', status: 1 }, { title: '异常', status: 2 }],
|
|
@@ -236,7 +244,6 @@ export default {
|
|
this.taskId = o.id; /* 任务id */
|
|
this.taskId = o.id; /* 任务id */
|
|
this.cr_id = o.cr_id; /* 文物id */
|
|
this.cr_id = o.cr_id; /* 文物id */
|
|
this.cr_code = o.cr_code;
|
|
this.cr_code = o.cr_code;
|
|
- this.submitStatuso = o.submit_statuso; /* 提交的任务状态 */
|
|
|
|
// 处理状态
|
|
// 处理状态
|
|
this.displayedItems = this.items.map((item) => item.title);
|
|
this.displayedItems = this.items.map((item) => item.title);
|
|
this.getPatrolTaskDetails(o.id);
|
|
this.getPatrolTaskDetails(o.id);
|
|
@@ -258,8 +265,11 @@ export default {
|
|
dwBtn() {
|
|
dwBtn() {
|
|
uni.getLocation({
|
|
uni.getLocation({
|
|
type: 'gcj02',
|
|
type: 'gcj02',
|
|
|
|
+ isHighAccuracy: true,
|
|
success: function (data) {
|
|
success: function (data) {
|
|
that.$api.distanceCheck({ cr_id: that.cr_id, longitude: data.longitude, latitude: data.latitude }, function (res) {
|
|
that.$api.distanceCheck({ cr_id: that.cr_id, longitude: data.longitude, latitude: data.latitude }, function (res) {
|
|
|
|
+ //存储经纬度
|
|
|
|
+ that.position = res.longitude + ',' + res.latitude;
|
|
if (res.data === false && res.code == 0) {
|
|
if (res.data === false && res.code == 0) {
|
|
that.dwShow = false;
|
|
that.dwShow = false;
|
|
that.longitude = data.longitude;
|
|
that.longitude = data.longitude;
|
|
@@ -321,6 +331,7 @@ export default {
|
|
// console.log(res, 'resres');
|
|
// console.log(res, 'resres');
|
|
if (res.code === 1) {
|
|
if (res.code === 1) {
|
|
// that.assetList = res.data;
|
|
// that.assetList = res.data;
|
|
|
|
+ //这边是巡查记录给资产赋值,如果有资产巡查记录,则改变显示的资产信息
|
|
let alist = res.data;
|
|
let alist = res.data;
|
|
that.taskDetails.patrolTaskAnnexList.forEach((requestItem, index) => {
|
|
that.taskDetails.patrolTaskAnnexList.forEach((requestItem, index) => {
|
|
// console.log(alist, '999999');
|
|
// console.log(alist, '999999');
|
|
@@ -336,13 +347,23 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
alist[i].status_text = requestItem.status_text;
|
|
alist[i].status_text = requestItem.status_text;
|
|
|
|
+ //状态高光
|
|
|
|
+ alist[i].segCurrent = requestItem.status;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ alist.forEach((item, i) => {
|
|
|
|
+ //如果资产是特殊文物,则提交状态改为特殊文物
|
|
|
|
+ if (item.is_special == 1) {
|
|
|
|
+ alist[i].submitStatus = 2;
|
|
|
|
+ that.submitStatus = 2;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
that.assetList = alist;
|
|
that.assetList = alist;
|
|
|
|
|
|
- that.postList = { main_body_id: 1, task_id: that.taskId, submit_status: that.submitStatuso, property_list: [] };
|
|
|
|
|
|
+ that.postList = { main_body_id: 1, task_id: that.taskId, submit_status: that.submitStatus, property_list: [] };
|
|
} else {
|
|
} else {
|
|
console.log(res.msg);
|
|
console.log(res.msg);
|
|
}
|
|
}
|
|
@@ -434,28 +455,25 @@ export default {
|
|
this.postList.property_list[tarIndex].event_type = this.eventTypeId;
|
|
this.postList.property_list[tarIndex].event_type = this.eventTypeId;
|
|
|
|
|
|
// 检查描述和图片是否已填写
|
|
// 检查描述和图片是否已填写
|
|
- for (var i = 0; i < this.postList.property_list.length; i++) {
|
|
|
|
- let property = this.postList.property_list[i];
|
|
|
|
-
|
|
|
|
- // 检查描述是否已填写
|
|
|
|
- if (!property.desc || property.desc.trim() === '') {
|
|
|
|
- // 新加
|
|
|
|
- if (this.normal) {
|
|
|
|
- this.$common.errorToShow('请填写问题描述');
|
|
|
|
- } else {
|
|
|
|
- this.describeVal = '未发现异常';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // this.$common.errorToShow('请填写问题描述');
|
|
|
|
- return;
|
|
|
|
|
|
+ let property = this.postList.property_list[tarIndex];
|
|
|
|
+ // 检查描述是否已填写
|
|
|
|
+ if (!property.desc || property.desc.trim() === '') {
|
|
|
|
+ // 新加
|
|
|
|
+ if (this.normal) {
|
|
|
|
+ this.$common.errorToShow('请填写问题描述');
|
|
|
|
+ } else {
|
|
|
|
+ this.describeVal = '未发现异常';
|
|
}
|
|
}
|
|
|
|
|
|
- // 检查是否有至少一张图片
|
|
|
|
- if (property.images.length === 0) {
|
|
|
|
- this.$common.errorToShow('请上传图片');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ // this.$common.errorToShow('请填写问题描述');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // 检查是否有至少一张图片
|
|
|
|
+ if (property.images.length === 0) {
|
|
|
|
+ this.$common.errorToShow('请上传图片');
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+
|
|
// 检查描述和图片是否已填写end
|
|
// 检查描述和图片是否已填写end
|
|
this.show = false;
|
|
this.show = false;
|
|
this.normal = false;
|
|
this.normal = false;
|
|
@@ -464,27 +482,30 @@ export default {
|
|
// console.log('上传的照片66', this.fileList); /* 照片 */
|
|
// console.log('上传的照片66', this.fileList); /* 照片 */
|
|
let arr = [];
|
|
let arr = [];
|
|
//显示每项上传的图片, 遍历this.fileList,为每个项创建包含url属性的对象,并推送到新数组
|
|
//显示每项上传的图片, 遍历this.fileList,为每个项创建包含url属性的对象,并推送到新数组
|
|
- this.assetList.forEach((obj) => {
|
|
|
|
- if (!obj.extraImages) {
|
|
|
|
- obj.extraImages = [];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const uniqueUrls = new Set();
|
|
|
|
- const deduplicatedExtraImages = [];
|
|
|
|
-
|
|
|
|
- obj.extraImages.forEach((imageObj) => {
|
|
|
|
- const url = imageObj.url;
|
|
|
|
- if (!uniqueUrls.has(url)) {
|
|
|
|
- uniqueUrls.add(url);
|
|
|
|
- deduplicatedExtraImages.push(imageObj);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- obj.extraImages = deduplicatedExtraImages;
|
|
|
|
- });
|
|
|
|
|
|
+ // this.assetList.forEach((obj) => {
|
|
|
|
+ // //当前资产图片清空重新写入(还存在一个问题,删掉不另外增加图片,无法触发this.fileList的修改,导致单纯删某张图片删不掉)
|
|
|
|
+ // if (obj.id == this.postList.property_list[tarIndex].id) {
|
|
|
|
+ // obj.extraImages = [];
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // const uniqueUrls = new Set();
|
|
|
|
+ // const deduplicatedExtraImages = [];
|
|
|
|
+
|
|
|
|
+ // obj.extraImages.forEach((imageObj) => {
|
|
|
|
+ // const url = imageObj.url;
|
|
|
|
+ // if (!uniqueUrls.has(url)) {
|
|
|
|
+ // uniqueUrls.add(url);
|
|
|
|
+ // deduplicatedExtraImages.push(imageObj);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // obj.extraImages = deduplicatedExtraImages;
|
|
|
|
+ // });
|
|
|
|
|
|
this.assetList.forEach((obj) => {
|
|
this.assetList.forEach((obj) => {
|
|
if (obj.id === this.assetDetails.id) {
|
|
if (obj.id === this.assetDetails.id) {
|
|
|
|
+ //先将当前资产图片清空,再重新写入
|
|
|
|
+ obj.extraImages = [];
|
|
this.postList.property_list.forEach((item) => {
|
|
this.postList.property_list.forEach((item) => {
|
|
obj.describeVal = item.desc;
|
|
obj.describeVal = item.desc;
|
|
});
|
|
});
|
|
@@ -518,20 +539,28 @@ export default {
|
|
allItemsValid = false; // 遇到不符合条件的对象时,标记为不通过
|
|
allItemsValid = false; // 遇到不符合条件的对象时,标记为不通过
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ // 移除的域名
|
|
if (allItemsValid) {
|
|
if (allItemsValid) {
|
|
- // 需要移除的域名
|
|
|
|
- const domainToRemove = 'https://meng.wenlvti.net';
|
|
|
|
|
|
+ const prefixToKeep = '/uploads/';
|
|
|
|
+
|
|
|
|
+ // 检查 postList 和其 property_list 是否存在并结构正确
|
|
if (this.postList && Array.isArray(this.postList.property_list)) {
|
|
if (this.postList && Array.isArray(this.postList.property_list)) {
|
|
- for (const property of this.postList.property_list) {
|
|
|
|
|
|
+ // 遍历每个 property
|
|
|
|
+ this.postList.property_list.forEach((property) => {
|
|
|
|
+ // 检查 images 是否存在并是一个数组
|
|
if (property.images && Array.isArray(property.images)) {
|
|
if (property.images && Array.isArray(property.images)) {
|
|
- for (const imageObj of property.images) {
|
|
|
|
- if (imageObj.url && imageObj.url.startsWith(domainToRemove)) {
|
|
|
|
- imageObj.url = imageObj.url.substring(domainToRemove.length);
|
|
|
|
|
|
+ // 更新每个图片的 URL
|
|
|
|
+ property.images.forEach((imageObj) => {
|
|
|
|
+ // 检查 URL 是否包含需要保留的前缀
|
|
|
|
+ if (imageObj.url && imageObj.url.includes(prefixToKeep)) {
|
|
|
|
+ // 获取 "uploads" 在 URL 中的位置
|
|
|
|
+ const index = imageObj.url.indexOf(prefixToKeep);
|
|
|
|
+ // 从 "uploads" 开始截取 URL
|
|
|
|
+ imageObj.url = imageObj.url.substring(index);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
// 需要移除的域名end
|
|
// 需要移除的域名end
|
|
|
|
|
|
@@ -552,7 +581,7 @@ export default {
|
|
if (that.assetList[0].is_special === 0) {
|
|
if (that.assetList[0].is_special === 0) {
|
|
uni.getLocation({
|
|
uni.getLocation({
|
|
type: 'gcj02',
|
|
type: 'gcj02',
|
|
-
|
|
|
|
|
|
+ isHighAccuracy: true,
|
|
success: function (res) {
|
|
success: function (res) {
|
|
that.position = res.longitude + ',' + res.latitude;
|
|
that.position = res.longitude + ',' + res.latitude;
|
|
mypost.position = that.position;
|
|
mypost.position = that.position;
|
|
@@ -561,20 +590,20 @@ export default {
|
|
that.$api.distanceCheck({ cr_id: that.cr_id, longitude: res.longitude, latitude: res.latitude }, function (res) {
|
|
that.$api.distanceCheck({ cr_id: that.cr_id, longitude: res.longitude, latitude: res.latitude }, function (res) {
|
|
if (res.data === false && res.code == 0) {
|
|
if (res.data === false && res.code == 0) {
|
|
that.$common.errorToShow(res.msg);
|
|
that.$common.errorToShow(res.msg);
|
|
- console.log(res, '不是特殊文物距离过远');
|
|
|
|
|
|
+ // console.log(res, '不是特殊文物距离过远');
|
|
} else {
|
|
} else {
|
|
- console.log(res, '不是特殊文物距离ok');
|
|
|
|
|
|
+ // console.log(res, '不是特殊文物距离ok');
|
|
that.$api.submitTask(mypost, function (res) {
|
|
that.$api.submitTask(mypost, function (res) {
|
|
if (res.code == 1) {
|
|
if (res.code == 1) {
|
|
// console.log(res, '提交成功');
|
|
// console.log(res, '提交成功');
|
|
- that.$common.successToShow('提交成功');
|
|
|
|
|
|
+ that.$common.successToShow(res.msg);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
uni.switchTab({
|
|
uni.switchTab({
|
|
url: '/pages/shouhu/shouhu'
|
|
url: '/pages/shouhu/shouhu'
|
|
});
|
|
});
|
|
}, 1000);
|
|
}, 1000);
|
|
} else {
|
|
} else {
|
|
- that.$common.errorToShow('请稍后再试');
|
|
|
|
|
|
+ that.$common.errorToShow(res.msg);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -587,17 +616,19 @@ export default {
|
|
} else {
|
|
} else {
|
|
// 特殊文物不用判断距离
|
|
// 特殊文物不用判断距离
|
|
console.log('特殊文物不用判断距离');
|
|
console.log('特殊文物不用判断距离');
|
|
|
|
+ //提交参数传入经纬度
|
|
|
|
+ mypost.position = that.position;
|
|
that.$api.submitTask(mypost, function (res) {
|
|
that.$api.submitTask(mypost, function (res) {
|
|
if (res.code == 1) {
|
|
if (res.code == 1) {
|
|
// console.log(res, '提交成功');
|
|
// console.log(res, '提交成功');
|
|
- that.$common.successToShow('提交成功');
|
|
|
|
|
|
+ that.$common.successToShow(res.msg);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
uni.switchTab({
|
|
uni.switchTab({
|
|
url: '/pages/shouhu/shouhu'
|
|
url: '/pages/shouhu/shouhu'
|
|
});
|
|
});
|
|
}, 1000);
|
|
}, 1000);
|
|
} else {
|
|
} else {
|
|
- that.$common.errorToShow('请稍后再试');
|
|
|
|
|
|
+ that.$common.errorToShow(res.msg);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|