提交图片修改
This commit is contained in:
@@ -59,7 +59,7 @@ const install = (Vue, vm) => {
|
|||||||
warnsProcess:(params = {})=>vm.$u.post(config.adminPath+'/sis/alarmEvents/complete',params),
|
warnsProcess:(params = {})=>vm.$u.post(config.adminPath+'/sis/alarmEvents/complete',params),
|
||||||
|
|
||||||
getWarnDetail:(params = {}, id) => vm.$u.get(config.adminPath+`/sis/alarmEvents/${id}`,params),
|
getWarnDetail:(params = {}, id) => vm.$u.get(config.adminPath+`/sis/alarmEvents/${id}`,params),
|
||||||
getWarnEventInfo:(params = {}, alarmId) => vm.$u.get(config.adminPath+`/sis/alarmEventAttachments/query/${alarmId}`,params),
|
getWarnEventInfo:(params = {}, alarmId) => vm.$u.get(config.adminPath+`/sis/alarmEventProcess/query/result/${alarmId}`,params),
|
||||||
|
|
||||||
//巡检任务列表
|
//巡检任务列表
|
||||||
getInspection:(params = {})=>vm.$u.get(config.adminPath+'/property/item/list',params),
|
getInspection:(params = {})=>vm.$u.get(config.adminPath+'/property/item/list',params),
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<!-- 可滚动内容区 -->
|
<!-- 可滚动内容区 -->
|
||||||
<view class="add-repair-scroll-content">
|
<view class="add-repair-scroll-content">
|
||||||
<!-- 地址选择 -->
|
<!-- 地址选择 -->
|
||||||
<!-- <view class="add-repair-section">
|
<!-- <view class="add-repair-section">
|
||||||
<view class="add-repair-detail">
|
<view class="add-repair-detail">
|
||||||
<view class="add-repair-detail1">详细地址 </view>
|
<view class="add-repair-detail1">详细地址 </view>
|
||||||
<input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" />
|
<input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" />
|
||||||
@@ -22,24 +22,16 @@
|
|||||||
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
||||||
</view>
|
</view>
|
||||||
<view class="add-repair-label">问题详情 <text class="add-repair-optional">(非必填)</text></view>
|
<view class="add-repair-label">问题详情 <text class="add-repair-optional">(非必填)</text></view>
|
||||||
<textarea v-model="repairInfo.remark" class="add-repair-detail-textarea" placeholder="如果以上报事不能解决您的问题,可以在这里填写说明" />
|
<textarea v-model="repairInfo.remark" class="add-repair-detail-textarea"
|
||||||
|
placeholder="如果以上报事不能解决您的问题,可以在这里填写说明" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 上传照片 -->
|
<!-- 上传照片 -->
|
||||||
<view class="add-repair-section">
|
<view class="add-repair-section">
|
||||||
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填,最多三张)</text></view>
|
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填,最多三张)</text></view>
|
||||||
<u-upload
|
<u-upload :fileList="selectedImages" @on-list-change="onListChange" @delete="deletePic" name="upload"
|
||||||
:fileList="selectedImages"
|
multiple maxCount="3" width="180" height="180" :autoUpload="false"></u-upload>
|
||||||
@on-list-change="onListChange"
|
|
||||||
@delete="deletePic"
|
|
||||||
name="upload"
|
|
||||||
multiple
|
|
||||||
maxCount="3"
|
|
||||||
width="180"
|
|
||||||
height="180"
|
|
||||||
:autoUpload="false"
|
|
||||||
></u-upload>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 提交按钮 -->
|
<!-- 提交按钮 -->
|
||||||
@@ -49,20 +41,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 导入MediaSelector和MediaType
|
// 导入MediaSelector和MediaType
|
||||||
import MediaSelector, { MediaType } from '@/utils/mediaSelector';
|
import MediaSelector, {
|
||||||
|
MediaType
|
||||||
|
} from '@/utils/mediaSelector';
|
||||||
import {
|
import {
|
||||||
uploadFiles
|
uploadFiles
|
||||||
} from '@/common/upload.js';
|
} from '@/common/upload.js';
|
||||||
import toast from '../../../../uview-ui/libs/function/toast';
|
import toast from '../../../../uview-ui/libs/function/toast';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
repairInfo:{
|
repairInfo: {
|
||||||
location:'',
|
location: '',
|
||||||
type:'1942879389453230082',
|
type: '1942879389453230082',
|
||||||
orderImgUrl:'',
|
orderImgUrl: '',
|
||||||
remark:''
|
remark: ''
|
||||||
},
|
},
|
||||||
repairTypes: [],
|
repairTypes: [],
|
||||||
selectedType: '',
|
selectedType: '',
|
||||||
@@ -77,7 +71,9 @@ export default {
|
|||||||
this.selectedType = item;
|
this.selectedType = item;
|
||||||
},
|
},
|
||||||
async getOrderType() {
|
async getOrderType() {
|
||||||
let params = {parentId:'1952989217332658178'}
|
let params = {
|
||||||
|
parentId: '1952989217332658178'
|
||||||
|
}
|
||||||
let res = await this.$u.api.getRepairTypes(params);
|
let res = await this.$u.api.getRepairTypes(params);
|
||||||
if (res.code == '200') {
|
if (res.code == '200') {
|
||||||
this.repairTypes = res.data
|
this.repairTypes = res.data
|
||||||
@@ -96,16 +92,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if(!this.repairInfo.location) {
|
if (!this.repairInfo.location) {
|
||||||
toast('请先填写地址')
|
toast('请先填写地址')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.selectedImages.length<=0){
|
if (this.selectedImages.length <= 0) {
|
||||||
this.realSubmit()
|
this.realSubmit()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log("t1",this.selectedImages)
|
console.log("t1", this.selectedImages)
|
||||||
const images = this.selectedImages
|
const images = this.selectedImages
|
||||||
.map(item => item?.path?.replace('file://', '') || item?.url || null)
|
.map(item => item?.path?.replace('file://', '') || item?.url || null)
|
||||||
.filter(path => path !== null);
|
.filter(path => path !== null);
|
||||||
@@ -120,16 +116,23 @@ export default {
|
|||||||
name: 'file',
|
name: 'file',
|
||||||
vm: this // 关键:用于注入 token 等
|
vm: this // 关键:用于注入 token 等
|
||||||
});
|
});
|
||||||
|
const allSuccess = result.every(item => item.code == 200);
|
||||||
|
if (!allSuccess) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 遍历result获取data.url加上,分割
|
// 遍历result获取data.url加上,分割
|
||||||
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
|
const urls = result.map(item => item.data?.ossId || '').filter(ossId => ossId !== '');
|
||||||
this.repairInfo.orderImgUrl = urls.join(',');
|
this.repairInfo.orderImgUrl = urls.join(',');
|
||||||
this.realSubmit()
|
this.realSubmit()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async realSubmit(){
|
async realSubmit() {
|
||||||
let res = await this.$u.api.addOrder2(this.repairInfo);
|
let res = await this.$u.api.addOrder2(this.repairInfo);
|
||||||
if (res.code == '200') {
|
if (res.code == '200') {
|
||||||
// 关闭页面前发送事件通知前页面刷新
|
// 关闭页面前发送事件通知前页面刷新
|
||||||
@@ -152,15 +155,19 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goRepaired(){
|
goRepaired() {
|
||||||
uni.navigateTo({ url: '/pages/sys/user/myRepair/repaired' });
|
uni.navigateTo({
|
||||||
|
url: '/pages/sys/user/myRepair/repaired'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
goSelectLocation(){
|
goSelectLocation() {
|
||||||
uni.navigateTo({ url: '/pages/sys/user/myRepair/selectLocation' });
|
uni.navigateTo({
|
||||||
|
url: '/pages/sys/user/myRepair/selectLocation'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -198,11 +205,12 @@ export default {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-type{
|
.text-type {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color:#808080;
|
color: #808080;
|
||||||
}
|
}
|
||||||
.right-arrow{
|
|
||||||
|
.right-arrow {
|
||||||
width: 11rpx;
|
width: 11rpx;
|
||||||
height: 21rpx;
|
height: 21rpx;
|
||||||
}
|
}
|
||||||
@@ -254,6 +262,7 @@ export default {
|
|||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-repair-label {
|
.add-repair-label {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
@@ -333,5 +342,4 @@ export default {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
|
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
@@ -74,6 +74,12 @@
|
|||||||
created() {
|
created() {
|
||||||
this.onRefresh()
|
this.onRefresh()
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
uni.$once('refreshData', () => {
|
||||||
|
this.tabLoaded = [false, false]
|
||||||
|
this.onRefresh()
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goBack() {
|
goBack() {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
|
@@ -142,7 +142,8 @@ export default {
|
|||||||
async loadEevetInfo() {
|
async loadEevetInfo() {
|
||||||
let res = await this.$u.api.getWarnEventInfo({}, this.warnInfo.id);
|
let res = await this.$u.api.getWarnEventInfo({}, this.warnInfo.id);
|
||||||
if (res.code == "200") {
|
if (res.code == "200") {
|
||||||
this.realImages = res.data
|
this.handleDesc = res.data.workReply
|
||||||
|
this.realImages = res.data.attachments
|
||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
@@ -182,8 +183,16 @@ export default {
|
|||||||
name: 'file',
|
name: 'file',
|
||||||
vm: this
|
vm: this
|
||||||
});
|
});
|
||||||
|
const allSuccess = result.every(item => item.code == 200);
|
||||||
|
if (!allSuccess) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.realImages = result.map(item => item.data?.url || '').filter(url => url !== '');
|
this.realImages = result.map(item => item.data?.ossId || '').filter(ossId => ossId !== '');
|
||||||
this.realSubmit();
|
this.realSubmit();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -142,6 +142,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
uni.$once('refreshData', () => {
|
uni.$once('refreshData', () => {
|
||||||
|
this.tabLoaded = [false, false]
|
||||||
this.onRefresh()
|
this.onRefresh()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user