v1.2.1版本,优化调整了很多,整改验收阶段新加字段
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 新增弹窗 -->
|
||||
<u-popup :show="showAddPopup" mode="center" round="20" @close="showAddPopup = false">
|
||||
<u-popup :show="showAddPopup" mode="center" round="20" :safe-area-inset-bottom="false" @close="showAddPopup = false">
|
||||
<view class="popup-content">
|
||||
<view class="popup-header">
|
||||
<view class="popup-title text-bold">新增隐患排查</view>
|
||||
@@ -69,6 +69,20 @@
|
||||
</view>
|
||||
<scroll-view class="popup-body" scroll-y>
|
||||
<view class="flex margin-bottom">
|
||||
<view class="text-gray">检查形式</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<view class="source-choose-scroll">
|
||||
<up-choose
|
||||
v-model="formData.source"
|
||||
:options="sourceOptions"
|
||||
:wrap="false"
|
||||
item-width="152rpx"
|
||||
item-height="64rpx"
|
||||
></up-choose>
|
||||
</view>
|
||||
<!-- <view class="text-gray text-sm margin-top-xs">左右滑动可查看更多来源</view> -->
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">隐患图片</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
@@ -101,12 +115,6 @@
|
||||
item-width="183rpx"
|
||||
item-height="72rpx"
|
||||
></up-choose>
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">隐患来源</view>
|
||||
<view class="text-red">*</view>
|
||||
</view>
|
||||
<up-choose v-model="formData.source" :options="sourceOptions" :wrap="false" item-width="183rpx"
|
||||
item-height="72rpx"></up-choose>
|
||||
<view class="flex margin-bottom margin-top">
|
||||
<view class="text-gray">隐患位置</view>
|
||||
<view class="text-red">*</view>
|
||||
@@ -158,7 +166,7 @@
|
||||
</u-popup>
|
||||
|
||||
<!-- 选择法规弹出框 -->
|
||||
<u-popup :show="showLawPopup" mode="center" round="20" @close="showLawPopup = false">
|
||||
<u-popup :show="showLawPopup" mode="center" round="20" :safe-area-inset-bottom="false" @close="showLawPopup = false">
|
||||
<view class="law-popup">
|
||||
<view class="popup-header">
|
||||
<view class="popup-title">选择法律依据</view>
|
||||
@@ -249,13 +257,8 @@
|
||||
analyzeHazardImage
|
||||
} from '@/request/api.js'
|
||||
import { getAreaList } from '@/request/three_one_api/area.js'
|
||||
import { addTimestampWatermark } from '@/utils/watermark.js'
|
||||
import {
|
||||
baseUrl,
|
||||
getToken,
|
||||
toImageUrl,
|
||||
imageBaseUrl
|
||||
} from '@/request/request.js'
|
||||
import { toImageUrl } from '@/request/request.js'
|
||||
import { createUploadListHandlers, buildAttachmentItem } from '@/utils/upload.js'
|
||||
|
||||
// 弹窗控制
|
||||
const showAddPopup = ref(false);
|
||||
@@ -533,16 +536,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const attachments = fileList1.value.map(file => {
|
||||
const path = file.serverPath || '';
|
||||
const fileName = path ? path.split('/').pop() : (file.name || '');
|
||||
return {
|
||||
fileName: fileName || '',
|
||||
filePath: path,
|
||||
fileType: file.type || 'image/png',
|
||||
fileSize: file.size || 0
|
||||
};
|
||||
});
|
||||
const attachments = fileList1.value
|
||||
.filter((f) => f.status === 'success')
|
||||
.map((file) => buildAttachmentItem(file));
|
||||
|
||||
// 获取隐患标签ID
|
||||
const selectedTag = tagOptions.value[formData.tagIndex];
|
||||
@@ -640,9 +636,11 @@
|
||||
})
|
||||
}
|
||||
const Rectification = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
})
|
||||
let url = `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
if (item.deadline) {
|
||||
url += `&deadline=${encodeURIComponent(item.deadline)}`
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
|
||||
// 编辑整改信息(待验收状态)
|
||||
@@ -664,77 +662,15 @@
|
||||
})
|
||||
}
|
||||
const fileList1 = ref([]);
|
||||
|
||||
// 删除图片
|
||||
const deletePic = (event) => {
|
||||
fileList1.value.splice(event.index, 1);
|
||||
};
|
||||
|
||||
// 新增图片
|
||||
const afterRead = async (event) => {
|
||||
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file);
|
||||
let fileListLen = fileList1.value.length;
|
||||
lists.map((item) => {
|
||||
fileList1.value.push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中',
|
||||
});
|
||||
});
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
let watermarkedUrl = lists[i].url;
|
||||
try {
|
||||
const instance = getCurrentInstance();
|
||||
watermarkedUrl = await addTimestampWatermark({
|
||||
tempFilePath: lists[i].url,
|
||||
canvasId: 'watermarkCanvas',
|
||||
canvasWidthRef: canvasWidth,
|
||||
canvasHeightRef: canvasHeight,
|
||||
instance
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('加水印失败,将使用原图上传:', e);
|
||||
}
|
||||
const result = await uploadFilePromise(watermarkedUrl);
|
||||
let item = fileList1.value[fileListLen];
|
||||
const serverPath = typeof result === 'string' ? result : (result?.url || result?.path || '');
|
||||
fileList1.value.splice(fileListLen, 1, {
|
||||
...item,
|
||||
status: 'success',
|
||||
message: '',
|
||||
// url: baseUrl + serverPath,
|
||||
url: toImageUrl(serverPath),
|
||||
serverPath: serverPath,
|
||||
});
|
||||
fileListLen++;
|
||||
const uploadInstance = getCurrentInstance();
|
||||
const { afterRead, deletePic } = createUploadListHandlers(fileList1, {
|
||||
watermark: {
|
||||
canvasId: 'watermarkCanvas',
|
||||
canvasWidthRef: canvasWidth,
|
||||
canvasHeightRef: canvasHeight,
|
||||
instance: uploadInstance
|
||||
}
|
||||
};
|
||||
|
||||
const uploadFilePromise = (filePath) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: baseUrl + '/frontend/attachment/upload',
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Authorization': getToken()
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data);
|
||||
if (data.code === 0) {
|
||||
resolve(data.data);
|
||||
} else {
|
||||
reject(data.msg || '上传失败');
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败:', err);
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
// AI 识别隐患
|
||||
const aiAnalyzing = ref(false);
|
||||
@@ -833,19 +769,19 @@
|
||||
//隐患来源
|
||||
const sourceOptions = ref([{
|
||||
id: 1,
|
||||
title: '随手拍'
|
||||
title: '部门检查'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '企业自查'
|
||||
title: '都导检查'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '行业互查'
|
||||
title: '企业自查'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '专家诊查'
|
||||
title: '行业互查'
|
||||
}
|
||||
])
|
||||
|
||||
@@ -1013,6 +949,43 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// 检查形式横向滚动,露出第 4 项一角提示可滑动
|
||||
.source-choose-scroll {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
:deep(.up-choose) {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
:deep(.u-tag-wrapper) {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
:deep(.u-tag) {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
box-sizing: border-box;
|
||||
padding: 0 8rpx !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
:deep(.u-tag__content) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
:deep(.u-tag__text) {
|
||||
font-size: 24rpx !important;
|
||||
line-height: 1.3 !important;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-footer {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #eee;
|
||||
|
||||
Reference in New Issue
Block a user