|
|
@@ -70,7 +70,7 @@
|
|
|
<view class="image-grid">
|
|
|
<view
|
|
|
v-for="(image, index) in leaveImageFiles"
|
|
|
- :key="image.uid || index"
|
|
|
+ :key="image.ossId || image.uid || index"
|
|
|
class="image-item"
|
|
|
@click="handleImageClick(image, index, $event)"
|
|
|
>
|
|
|
@@ -113,7 +113,7 @@
|
|
|
<view
|
|
|
class="file-card"
|
|
|
v-for="(file, index) in leaveNonImageFiles"
|
|
|
- :key="file.uid || index"
|
|
|
+ :key="file.ossId || file.uid || index"
|
|
|
>
|
|
|
<view class="file-icon-container">
|
|
|
<u-icon
|
|
|
@@ -236,7 +236,7 @@
|
|
|
<view class="image-grid">
|
|
|
<view
|
|
|
v-for="(image, index) in imageFiles"
|
|
|
- :key="image.uid || index"
|
|
|
+ :key="image.ossId || image.uid || index"
|
|
|
class="image-item"
|
|
|
@click="handleImageClick(image, index, $event)"
|
|
|
>
|
|
|
@@ -337,7 +337,7 @@
|
|
|
<view
|
|
|
class="file-card"
|
|
|
v-for="(file, index) in nonImageFiles"
|
|
|
- :key="file.uid"
|
|
|
+ :key="file.ossId || file.uid || index"
|
|
|
>
|
|
|
<view class="file-icon-container">
|
|
|
<u-icon
|
|
|
@@ -804,6 +804,7 @@ export default {
|
|
|
status: 'success',
|
|
|
type: fileType,
|
|
|
size: item.fileSize || 0,
|
|
|
+ blobUrl: '',
|
|
|
};
|
|
|
});
|
|
|
if (isCancel) {
|
|
|
@@ -1364,6 +1365,66 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // —— 提交前限制:根据请假类型配置校验销假要求 ——
|
|
|
+ try {
|
|
|
+ const typeCode =
|
|
|
+ this.leaveInfo.leaveTypeCode ||
|
|
|
+ this.leaveInfo.leave_type_code ||
|
|
|
+ this.leaveInfo.leave_type ||
|
|
|
+ this.leaveInfo.leaveType ||
|
|
|
+ '';
|
|
|
+ if (typeCode) {
|
|
|
+ const resp = await request({
|
|
|
+ url: '/xgLeaveTypeConfig/xgLeaveTypeConfig/list',
|
|
|
+ method: 'GET',
|
|
|
+ params: { deleted: 0, isEnabled: '1', pageSize: 1000 },
|
|
|
+ });
|
|
|
+ if (resp && resp.code === 200) {
|
|
|
+ const rows = resp.rows || [];
|
|
|
+ const matched = rows.find(
|
|
|
+ (it) =>
|
|
|
+ it.leaveTypeCode === typeCode ||
|
|
|
+ it.leave_type_code === typeCode ||
|
|
|
+ it.code === typeCode,
|
|
|
+ );
|
|
|
+ if (matched) {
|
|
|
+ const needPhotoRaw =
|
|
|
+ matched.need_photo_on_cancel ?? matched.needPhotoOnCancel;
|
|
|
+ const needLocationRaw =
|
|
|
+ matched.need_location_on_cancel ?? matched.needLocationOnCancel;
|
|
|
+ const needPhotoOnCancel =
|
|
|
+ String(needPhotoRaw) === '1' || needPhotoRaw === 1;
|
|
|
+ const needLocationOnCancel =
|
|
|
+ String(needLocationRaw) === '1' || needLocationRaw === 1;
|
|
|
+
|
|
|
+ if (needPhotoOnCancel) {
|
|
|
+ const hasRequiredImage = this.attachmentList.some(
|
|
|
+ (f) => this.isImageFile(f) && f.status === 'success' && f.ossId,
|
|
|
+ );
|
|
|
+ if (!hasRequiredImage) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '该请假类型要求上传销假图片',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (needLocationOnCancel) {
|
|
|
+ if (!this.cancelForm.cancelLocation) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '该请假类型要求提供销假定位',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.warn('提交前限制校验失败(忽略并继续):', e?.message || e);
|
|
|
+ }
|
|
|
+
|
|
|
// 汇总附件ossIds
|
|
|
const cancelPhotoOssIds = this.attachmentList
|
|
|
.filter((f) => f.status === 'success' && f.ossId)
|
|
|
@@ -1505,7 +1566,7 @@ export default {
|
|
|
try {
|
|
|
const blobUrl = await this.getImageBlobUrl(file.url);
|
|
|
if (blobUrl) {
|
|
|
- file.blobUrl = blobUrl;
|
|
|
+ this.$set(file, 'blobUrl', blobUrl);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.warn('处理图片失败:', file?.name, e);
|