|
@@ -3,7 +3,7 @@
|
|
|
<van-nav-bar class="navBar" left-arrow title="生动化陈列" @click-left="onClickLeft">
|
|
<van-nav-bar class="navBar" left-arrow title="生动化陈列" @click-left="onClickLeft">
|
|
|
<template #right v-if="formData">
|
|
<template #right v-if="formData">
|
|
|
<span
|
|
<span
|
|
|
- v-if="isEdit && insert == 'true' && formData.processStatus != 1"
|
|
|
|
|
|
|
+ v-if="formData.processStatus != 1"
|
|
|
@click="onSubmit"
|
|
@click="onSubmit"
|
|
|
style="
|
|
style="
|
|
|
color: white;
|
|
color: white;
|
|
@@ -126,9 +126,15 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
-import { getCollectionInfosBatch, addCollectionAnswerBatch, getVisitsDetail } from '@/api/index';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ getCollectionInfosBatch,
|
|
|
|
|
+ addCollectionAnswerBatch,
|
|
|
|
|
+ getVisitsDetail,
|
|
|
|
|
+ selectUserDistanceTheStore,
|
|
|
|
|
+} from '@/api/index';
|
|
|
import taskTips from './taskTips';
|
|
import taskTips from './taskTips';
|
|
|
import deleteUploadImgTaskPhoto from '@/components/deleteUploadImgTaskPhoto';
|
|
import deleteUploadImgTaskPhoto from '@/components/deleteUploadImgTaskPhoto';
|
|
|
|
|
+import { getPosition, getTicketFun } from '@/utils/TXApiFun';
|
|
|
import { mapState } from 'vuex';
|
|
import { mapState } from 'vuex';
|
|
|
export default {
|
|
export default {
|
|
|
name: 'abnortaskPhotoTakingmalVisit',
|
|
name: 'abnortaskPhotoTakingmalVisit',
|
|
@@ -140,7 +146,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- isEdit: true,
|
|
|
|
|
formData: null,
|
|
formData: null,
|
|
|
dataList: null,
|
|
dataList: null,
|
|
|
taskIds: [],
|
|
taskIds: [],
|
|
@@ -153,6 +158,8 @@ export default {
|
|
|
spanArr: [],
|
|
spanArr: [],
|
|
|
pos: 0,
|
|
pos: 0,
|
|
|
mediaIds: [],
|
|
mediaIds: [],
|
|
|
|
|
+ mediaInfos: [],
|
|
|
|
|
+ editFlag: true,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
activated() {
|
|
activated() {
|
|
@@ -161,6 +168,8 @@ export default {
|
|
|
this.storeGroupId = this.$route.query.storeGroupId || '';
|
|
this.storeGroupId = this.$route.query.storeGroupId || '';
|
|
|
this.objectType = this.$route.query.photoType || '';
|
|
this.objectType = this.$route.query.photoType || '';
|
|
|
this.insert = this.$route.query.insert;
|
|
this.insert = this.$route.query.insert;
|
|
|
|
|
+ // 授权
|
|
|
|
|
+ // getTicketFun(['uploadImage']).then(() => {});
|
|
|
if (this.$route.query.source == 'historicalDetails') {
|
|
if (this.$route.query.source == 'historicalDetails') {
|
|
|
this.getVisitsDetailFun();
|
|
this.getVisitsDetailFun();
|
|
|
} else {
|
|
} else {
|
|
@@ -175,6 +184,39 @@ export default {
|
|
|
},
|
|
},
|
|
|
watch: {},
|
|
watch: {},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 授权
|
|
|
|
|
+ getTicketFunfun() {
|
|
|
|
|
+ getTicketFun()
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ getPosition()
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ let { TXisBD } = res;
|
|
|
|
|
+ // this.lat = TXisBD.lat;
|
|
|
|
|
+ // this.lon = TXisBD.lon;
|
|
|
|
|
+ this.selectUserDistanceTheStoreFun(TXisBD);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((error) => {
|
|
|
|
|
+ this.$dialog.alert({
|
|
|
|
|
+ message: error,
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ selectUserDistanceTheStoreFun(TXisBD) {
|
|
|
|
|
+ selectUserDistanceTheStore({
|
|
|
|
|
+ visitsId: this.visitsId, // Long 拜访id
|
|
|
|
|
+ lon: TXisBD.lon, // String 经度
|
|
|
|
|
+ lat: TXisBD.lat, // String 纬度
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.editFlag = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.editFlag = true;
|
|
|
|
|
+ this.$toast(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
taskObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
taskObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
const cellValue = row[column.property];
|
|
const cellValue = row[column.property];
|
|
|
if (cellValue && ['conditionIdentifyNum'].includes(column.property)) {
|
|
if (cellValue && ['conditionIdentifyNum'].includes(column.property)) {
|
|
@@ -213,6 +255,7 @@ export default {
|
|
|
if (res.data.sfaTaskList) {
|
|
if (res.data.sfaTaskList) {
|
|
|
this.dataList = res.data.sfaTaskList.filter((val) => val.taskType == '5');
|
|
this.dataList = res.data.sfaTaskList.filter((val) => val.taskType == '5');
|
|
|
this.formData = this.dataList[0];
|
|
this.formData = this.dataList[0];
|
|
|
|
|
+ this.isEditFun();
|
|
|
} else {
|
|
} else {
|
|
|
this.formData = null;
|
|
this.formData = null;
|
|
|
}
|
|
}
|
|
@@ -229,11 +272,15 @@ export default {
|
|
|
if (res.data && res.data.length) {
|
|
if (res.data && res.data.length) {
|
|
|
this.dataList = res.data;
|
|
this.dataList = res.data;
|
|
|
this.formData = res.data[0];
|
|
this.formData = res.data[0];
|
|
|
|
|
+ this.isEditFun();
|
|
|
} else {
|
|
} else {
|
|
|
this.formData = null;
|
|
this.formData = null;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ isEditFun() {
|
|
|
|
|
+ this.getTicketFunfun();
|
|
|
|
|
+ },
|
|
|
openDialog(item) {
|
|
openDialog(item) {
|
|
|
this.vanPopup = true;
|
|
this.vanPopup = true;
|
|
|
console.log(item);
|
|
console.log(item);
|
|
@@ -243,53 +290,62 @@ export default {
|
|
|
this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
|
|
this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- waitUploadReady(interval = 1000) {
|
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
|
- const intervalId = setInterval(() => {
|
|
|
|
|
- const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
|
|
|
|
|
- if (taskPhoto && taskPhoto.isUploadImg) {
|
|
|
|
|
- clearInterval(intervalId);
|
|
|
|
|
- resolve();
|
|
|
|
|
- }
|
|
|
|
|
- }, interval);
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- async onSubmit() {
|
|
|
|
|
|
|
+ onSubmit() {
|
|
|
this.toastLoading(0, '提交中,请稍候...', true);
|
|
this.toastLoading(0, '提交中,请稍候...', true);
|
|
|
- try {
|
|
|
|
|
- const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
|
|
|
|
|
- if (taskPhoto && !taskPhoto.isUploadImg) {
|
|
|
|
|
- await this.waitUploadReady(1000);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let formData = {
|
|
|
|
|
- storeId: this.$route.query.storeId,
|
|
|
|
|
- storeCode: this.$route.query.storeCode,
|
|
|
|
|
- storeGroupId: this.$route.query.storeGroupId,
|
|
|
|
|
- visitsId: this.visitsId,
|
|
|
|
|
- taskList: this.taskIds.split(',').map((val) => Number(val)),
|
|
|
|
|
- insert: true,
|
|
|
|
|
- collectionAnswers: [],
|
|
|
|
|
- checkUnManage: 'N',
|
|
|
|
|
- deviceCode: '',
|
|
|
|
|
- putInCode: '',
|
|
|
|
|
- equipmentCode: '',
|
|
|
|
|
- collectionItemId: taskPhoto ? taskPhoto.collectionItemId : '',
|
|
|
|
|
- objectType: this.$route.query.photoType,
|
|
|
|
|
- locationRemark: taskPhoto ? taskPhoto.locationRemark : '',
|
|
|
|
|
- mediaInfos: [],
|
|
|
|
|
- isH5: this.userInfo.photoMethod == '1',
|
|
|
|
|
- };
|
|
|
|
|
- if (this.userInfo.photoMethod == '1') {
|
|
|
|
|
- formData.mediaInfos = [];
|
|
|
|
|
- } else if (taskPhoto) {
|
|
|
|
|
- formData.mediaInfos = taskPhoto.imgArr;
|
|
|
|
|
|
|
+ const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
|
|
|
|
|
+ let formData = {
|
|
|
|
|
+ storeId: this.$route.query.storeId,
|
|
|
|
|
+ storeCode: this.$route.query.storeCode,
|
|
|
|
|
+ storeGroupId: this.$route.query.storeGroupId,
|
|
|
|
|
+ visitsId: this.visitsId,
|
|
|
|
|
+ taskList: this.taskIds.split(',').map((val) => Number(val)),
|
|
|
|
|
+ insert: true,
|
|
|
|
|
+ collectionAnswers: [],
|
|
|
|
|
+ checkUnManage: 'N',
|
|
|
|
|
+ deviceCode: '',
|
|
|
|
|
+ putInCode: '',
|
|
|
|
|
+ equipmentCode: '',
|
|
|
|
|
+ collectionItemId: taskPhoto ? taskPhoto.collectionItemId : '',
|
|
|
|
|
+ objectType: this.$route.query.photoType,
|
|
|
|
|
+ locationRemark: taskPhoto ? taskPhoto.locationRemark : '',
|
|
|
|
|
+ mediaInfos: [],
|
|
|
|
|
+ isH5: this.userInfo.photoMethod == '1',
|
|
|
|
|
+ };
|
|
|
|
|
+ if (this.userInfo.photoMethod == '1') {
|
|
|
|
|
+ formData.mediaInfos = [];
|
|
|
|
|
+ this.addCollection(formData);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.mediaInfos = [];
|
|
|
|
|
+ let imgArr = JSON.parse(JSON.stringify(taskPhoto.imgArr));
|
|
|
|
|
+ this.syncUpload(imgArr, () => {
|
|
|
|
|
+ this.toastLoading().clear();
|
|
|
|
|
+ formData.mediaInfos = this.mediaInfos;
|
|
|
|
|
+ this.addCollection(formData);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ syncUpload(imgArr, callback) {
|
|
|
|
|
+ if (!imgArr.length) {
|
|
|
|
|
+ callback && callback();
|
|
|
|
|
+ return;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var item = imgArr.pop();
|
|
|
|
|
+ if (!item.mediaId) {
|
|
|
|
|
+ wx.uploadImage({
|
|
|
|
|
+ localId: item.mediaFileUrl,
|
|
|
|
|
+ isShowProgressTips: 0, // 默认为1,显示进度提示
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ this.mediaInfos.push({
|
|
|
|
|
+ mediaId: res.serverId,
|
|
|
|
|
+ mediaFileUrl: item.mediaFileUrl,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.syncUpload(imgArr, callback);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.mediaInfos.push(item);
|
|
|
|
|
+ this.syncUpload(imgArr, callback);
|
|
|
}
|
|
}
|
|
|
- await this.addCollection(formData);
|
|
|
|
|
- } catch (err) {
|
|
|
|
|
- this.$toast(err.message || '提交失败,请稍后再试');
|
|
|
|
|
- } finally {
|
|
|
|
|
- this.toastLoading().clear();
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
addCollection(formData) {
|
|
addCollection(formData) {
|
|
@@ -323,6 +379,7 @@ export default {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
padding-bottom: 46px;
|
|
padding-bottom: 46px;
|
|
|
|
|
+ // overflow-y: auto;
|
|
|
.container {
|
|
.container {
|
|
|
background: #fff;
|
|
background: #fff;
|
|
|
width: 100%;
|
|
width: 100%;
|