upper attachment-selector to lib
This commit is contained in:
@@ -68,15 +68,12 @@
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<media-selector
|
||||
:model-value="globalAttachmentUrlList"
|
||||
v-model:photo-items="productStockBatchStore.attachmentItems"
|
||||
<attachment-selector
|
||||
v-model:items="productStockBatchStore.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
:edit-mode="true"
|
||||
:loading="isSaving"
|
||||
:show-remove="!isSaving"
|
||||
:busy="isSaving"
|
||||
title="共有入库记录(无专有记录时使用)"
|
||||
@update:photo-items="invalidateRequestNo"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
@@ -160,16 +157,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<media-selector
|
||||
<attachment-selector
|
||||
v-if="isAttachmentVisible(item.sku.id || '')"
|
||||
:model-value="getAttachmentUrlList(item.attachmentItems)"
|
||||
v-model:photo-items="item.attachmentItems"
|
||||
v-model:items="item.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
:edit-mode="true"
|
||||
title=""
|
||||
:loading="isSaving"
|
||||
:show-remove="!isSaving"
|
||||
@update:photo-items="invalidateRequestNo"
|
||||
:busy="isSaving"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</div>
|
||||
</t-form-item>
|
||||
@@ -185,7 +179,7 @@
|
||||
import { onBeforeRouteLeave } from "vue-router";
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
|
||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||
import ProductAPI from "@/api/ProductAPI";
|
||||
import type { ProductSkuUnit, ProductStockManualInBatchItem, ProductStockManualInBatchRequest } from "@/types/Product";
|
||||
import type { PhotoItem } from "@/types/Photo";
|
||||
@@ -250,7 +244,6 @@ const unitPickerVisible = ref(false);
|
||||
const unitPickerSkuId = ref("");
|
||||
const unitPickerDraft = ref<PickerValue[]>([]);
|
||||
const quickRemarkText = "正常入库";
|
||||
const globalAttachmentUrlList = computed(() => productStockBatchStore.attachmentItems.map(item => item.url));
|
||||
const unitPickerOptions = computed(() => {
|
||||
const item = productStockBatchStore.selectedItemList.find(candidate => candidate.sku.id === unitPickerSkuId.value);
|
||||
return getSelectableUnits(item).map(unit => ({ label: unit.name || "未命名单位", value: unit.id || "" }));
|
||||
@@ -276,10 +269,6 @@ function isDefaultSku(item: ProductStockBatchSelection): boolean {
|
||||
return !item.sku.specValueIdList?.length;
|
||||
}
|
||||
|
||||
function getAttachmentUrlList(itemList: PhotoItem[]): string[] {
|
||||
return itemList.map(item => item.url);
|
||||
}
|
||||
|
||||
function getAttachmentList(itemList: PhotoItem[]): NonNullable<ProductStockManualInBatchItem["attachmentList"]> {
|
||||
return itemList.flatMap(item => item.tempFileId ? [{
|
||||
tempFileId: item.tempFileId,
|
||||
|
||||
Reference in New Issue
Block a user