update AIChart, customer followup, media selector
This commit is contained in:
@@ -75,14 +75,16 @@
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<div v-if="showRecordPhotoInput" class="input-form photo-form content-margin">
|
||||
<photo-scroller
|
||||
<media-selector
|
||||
title="登记事件照片"
|
||||
:required="selectedRequiredPhotoEventList.length > 0"
|
||||
v-model="recordPhotoList"
|
||||
v-model:photo-items="recordPhotoItemList"
|
||||
:edit-mode="true"
|
||||
:loading="recordPhotoUploading"
|
||||
@add="capturePhoto"
|
||||
@add="selectPhotoFile"
|
||||
@capture-photo="capturePhoto"
|
||||
@capture-video="captureVideo"
|
||||
/>
|
||||
</div>
|
||||
<t-cell-group
|
||||
@@ -115,10 +117,26 @@
|
||||
ref="recordPhotoInputRef"
|
||||
class="file-input"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
accept="*/*"
|
||||
multiple
|
||||
@change="handleRecordPhotoSelected"
|
||||
>
|
||||
<input
|
||||
ref="recordPhotoCameraInputRef"
|
||||
class="file-input"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
capture="environment"
|
||||
@change="handleRecordPhotoSelected"
|
||||
>
|
||||
<input
|
||||
ref="videoInputRef"
|
||||
class="file-input"
|
||||
type="file"
|
||||
accept="video/*"
|
||||
capture="environment"
|
||||
@change="handleRecordPhotoSelected"
|
||||
>
|
||||
</div>
|
||||
<bottom-popup
|
||||
v-model="eventPopupVisible"
|
||||
@@ -153,7 +171,7 @@ import EventRecordAPI from "@/api/EventRecordAPI";
|
||||
import CodeScanner from "@/components/CodeScanner.vue";
|
||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
||||
import EventOptionSelector from "@/components/EventOptionSelector.vue";
|
||||
import PhotoScroller from "@/components/PhotoScroller.vue";
|
||||
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
||||
import { useSettingStore } from "@/store/settingStore";
|
||||
import type { Customer } from "@/types/Customer";
|
||||
import type { EventItem, EventOptionSelectionMap } from "@/types/EventItem";
|
||||
@@ -386,6 +404,8 @@ function validateNumberValueList(): boolean {
|
||||
// ---------- 照片 ----------
|
||||
|
||||
const recordPhotoInputRef = ref<HTMLInputElement>();
|
||||
const recordPhotoCameraInputRef = ref<HTMLInputElement>();
|
||||
const videoInputRef = ref<HTMLInputElement>();
|
||||
const recordPhotoItemList = ref<PhotoItem[]>([]);
|
||||
const recordPhotoUploading = ref(false);
|
||||
const showRecordPhotoInput = computed(() => selectedRequiredPhotoEventList.value.length > 0 || recordPhotoItemList.value.length > 0);
|
||||
@@ -400,9 +420,17 @@ const recordPhotoList = computed<string[]>({
|
||||
});
|
||||
|
||||
function capturePhoto(): void {
|
||||
recordPhotoCameraInputRef.value?.click();
|
||||
}
|
||||
|
||||
function selectPhotoFile(): void {
|
||||
recordPhotoInputRef.value?.click();
|
||||
}
|
||||
|
||||
function captureVideo(): void {
|
||||
videoInputRef.value?.click();
|
||||
}
|
||||
|
||||
async function handleRecordPhotoSelected(event: Event): Promise<void> {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const fileList = Array.from(input.files || []);
|
||||
@@ -413,13 +441,14 @@ async function handleRecordPhotoSelected(event: Event): Promise<void> {
|
||||
try {
|
||||
const compressedFileList = await compressUploadImageList(fileList);
|
||||
const tempFileList = await AttachmentAPI.upload(compressedFileList);
|
||||
for (const item of tempFileList) {
|
||||
for (const [index, item] of tempFileList.entries()) {
|
||||
if (!item.id) {
|
||||
continue;
|
||||
}
|
||||
recordPhotoItemList.value.push({
|
||||
tempFileId: item.id,
|
||||
attachType: "PHOTO",
|
||||
mimeType: fileList[index]?.type,
|
||||
url: AttachmentAPI.getTempReadURL(item.id)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user