提交图片修改

This commit is contained in:
liyuanchao 2025-08-23 13:51:56 +08:00
parent 5a0a86fe4a
commit 9a60d90592
5 changed files with 364 additions and 340 deletions

View File

@ -59,7 +59,7 @@ const install = (Vue, vm) => {
warnsProcess:(params = {})=>vm.$u.post(config.adminPath+'/sis/alarmEvents/complete',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),

View File

@ -3,7 +3,7 @@
<!-- 可滚动内容区 -->
<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-detail1">详细地址 </view>
<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" />
</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 class="add-repair-section">
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填最多三张)</text></view>
<u-upload
:fileList="selectedImages"
@on-list-change="onListChange"
@delete="deletePic"
name="upload"
multiple
maxCount="3"
width="180"
height="180"
:autoUpload="false"
></u-upload>
<u-upload :fileList="selectedImages" @on-list-change="onListChange" @delete="deletePic" name="upload"
multiple maxCount="3" width="180" height="180" :autoUpload="false"></u-upload>
</view>
<!-- 提交按钮 -->
@ -49,20 +41,22 @@
</template>
<script>
// MediaSelectorMediaType
import MediaSelector, { MediaType } from '@/utils/mediaSelector';
// MediaSelectorMediaType
import MediaSelector, {
MediaType
} from '@/utils/mediaSelector';
import {
uploadFiles
} from '@/common/upload.js';
import toast from '../../../../uview-ui/libs/function/toast';
export default {
import toast from '../../../../uview-ui/libs/function/toast';
export default {
data() {
return {
repairInfo:{
location:'',
type:'1942879389453230082',
orderImgUrl:'',
remark:''
repairInfo: {
location: '',
type: '1942879389453230082',
orderImgUrl: '',
remark: ''
},
repairTypes: [],
selectedType: '',
@ -77,7 +71,9 @@ export default {
this.selectedType = item;
},
async getOrderType() {
let params = {parentId:'1952989217332658178'}
let params = {
parentId: '1952989217332658178'
}
let res = await this.$u.api.getRepairTypes(params);
if (res.code == '200') {
this.repairTypes = res.data
@ -96,16 +92,16 @@ export default {
},
async submit() {
if(!this.repairInfo.location) {
if (!this.repairInfo.location) {
toast('请先填写地址')
return
}
if(this.selectedImages.length<=0){
if (this.selectedImages.length <= 0) {
this.realSubmit()
return
}
console.log("t1",this.selectedImages)
console.log("t1", this.selectedImages)
const images = this.selectedImages
.map(item => item?.path?.replace('file://', '') || item?.url || null)
.filter(path => path !== null);
@ -120,16 +116,23 @@ export default {
name: 'file',
vm: this // token
});
const allSuccess = result.every(item => item.code == 200);
if (!allSuccess) {
uni.showToast({
title: '上传失败',
icon: 'none'
});
return;
}
// resultdata.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.realSubmit()
},
async realSubmit(){
async realSubmit() {
let res = await this.$u.api.addOrder2(this.repairInfo);
if (res.code == '200') {
//
@ -152,15 +155,19 @@ export default {
}
});
},
goRepaired(){
uni.navigateTo({ url: '/pages/sys/user/myRepair/repaired' });
goRepaired() {
uni.navigateTo({
url: '/pages/sys/user/myRepair/repaired'
});
},
goSelectLocation(){
uni.navigateTo({ url: '/pages/sys/user/myRepair/selectLocation' });
goSelectLocation() {
uni.navigateTo({
url: '/pages/sys/user/myRepair/selectLocation'
});
}
}
}
}
</script>
<style scoped>
@ -198,11 +205,12 @@ export default {
box-sizing: border-box;
}
.text-type{
.text-type {
font-size: 24rpx;
color:#808080;
color: #808080;
}
.right-arrow{
.right-arrow {
width: 11rpx;
height: 21rpx;
}
@ -254,6 +262,7 @@ export default {
margin-bottom: 40rpx;
box-sizing: border-box;
}
.add-repair-label {
font-size: 32rpx;
color: #000000;
@ -333,5 +342,4 @@ export default {
font-weight: bold;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
}
</style>

View File

@ -74,6 +74,12 @@
created() {
this.onRefresh()
},
onShow() {
uni.$once('refreshData', () => {
this.tabLoaded = [false, false]
this.onRefresh()
});
},
methods: {
goBack() {
uni.navigateBack();

View File

@ -142,7 +142,8 @@ export default {
async loadEevetInfo() {
let res = await this.$u.api.getWarnEventInfo({}, this.warnInfo.id);
if (res.code == "200") {
this.realImages = res.data
this.handleDesc = res.data.workReply
this.realImages = res.data.attachments
}
this.loading = false;
},
@ -182,8 +183,16 @@ export default {
name: 'file',
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();
},

View File

@ -142,6 +142,7 @@ export default {
},
onShow() {
uni.$once('refreshData', () => {
this.tabLoaded = [false, false]
this.onRefresh()
});
},