<script setup lang="ts">
|
import { computed, reactive, ref } from "vue";
|
import { onLoad } from "@dcloudio/uni-app";
|
import { getMaterialPage, type MaterialItem } from "../../../api/basic-data";
|
import { getPurchase, getPurchaseOrderPage, type PurchaseRecord } from "../../../api/purchase";
|
import { getSupplierSimpleList, type SupplierItem } from "../../../api/supplier";
|
import {
|
getBatchPage,
|
createArrivalNotice,
|
createArrivalNoticeLine,
|
createItemReceiptDetail,
|
createItemReceipt,
|
createItemReceiptLine,
|
createReturnVendorDetail,
|
createReturnVendor,
|
createReturnVendorLine,
|
deleteArrivalNoticeLine,
|
deleteItemReceiptDetail,
|
deleteItemReceiptLine,
|
deleteReturnVendorDetail,
|
deleteReturnVendorLine,
|
generateAutoCode,
|
getArrivalNotice,
|
getArrivalNoticePage,
|
getArrivalNoticeLinePage,
|
getItemReceipt,
|
getItemReceiptDetailListByLine,
|
getItemReceiptLinePage,
|
getMaterialStockPage,
|
getReturnVendor,
|
getReturnVendorDetailListByLine,
|
getReturnVendorLinePage,
|
getWarehouseAreaSimpleList,
|
getWarehouseLocationSimpleList,
|
getWarehouseSimpleList,
|
submitArrivalNotice,
|
submitItemReceipt,
|
submitReturnVendor,
|
stockItemReceipt,
|
finishItemReceipt,
|
stockReturnVendor,
|
finishReturnVendor,
|
checkReturnVendorQuantity,
|
updateArrivalNotice,
|
updateArrivalNoticeLine,
|
updateItemReceiptDetail,
|
updateItemReceipt,
|
updateItemReceiptLine,
|
updateReturnVendorDetail,
|
updateReturnVendor,
|
updateReturnVendorLine,
|
type ArrivalNotice,
|
type ArrivalNoticeLine,
|
type Batch,
|
type ItemReceiptDetail,
|
type ItemReceipt,
|
type ItemReceiptLine,
|
type MaterialStock,
|
type ReturnVendor,
|
type ReturnVendorDetail,
|
type ReturnVendorLine,
|
type Warehouse,
|
type WarehouseArea,
|
type WarehouseLocation,
|
} from "../../../api/wls";
|
import { useAuth } from "../../../stores/auth";
|
import { dateText, dayText, materialOptionText } from "./shared";
|
|
type Kind = "arrival-notice" | "item-receipt" | "return-vendor";
|
type Header = ArrivalNotice & ItemReceipt & ReturnVendor;
|
type Line = ArrivalNoticeLine & ItemReceiptLine & ReturnVendorLine;
|
const props = defineProps<{ kind: Kind }>();
|
const { hasPermission, state } = useAuth();
|
const id = ref<number>();
|
const mode = ref<"edit" | "detail" | "stock" | "finish">("edit");
|
const saving = ref(false);
|
const generating = ref(false);
|
const suppliers = ref<SupplierItem[]>([]);
|
const materials = ref<MaterialItem[]>([]);
|
const notices = ref<ArrivalNotice[]>([]);
|
const arrivalLines = ref<ArrivalNoticeLine[]>([]);
|
const orders = ref<PurchaseRecord[]>([]);
|
const batchesByLine = ref<Record<number, Batch[]>>({});
|
const showBatchSelect = ref(false);
|
const batchLineIndex = ref<number>();
|
const batchKeyword = ref("");
|
const warehouses = ref<Warehouse[]>([]);
|
const stockLocations = ref<WarehouseLocation[]>([]);
|
const stockAreas = ref<WarehouseArea[]>([]);
|
const receiptDetails = ref<Record<number, ItemReceiptDetail[]>>({});
|
const returnDetails = ref<Record<number, ReturnVendorDetail[]>>({});
|
const stockRecords = ref<MaterialStock[]>([]);
|
const stockLine = ref<Line>();
|
const showStockForm = ref(false);
|
const showStockRecordSelect = ref(false);
|
const stockKeyword = ref("");
|
const stockSaving = ref(false);
|
const stockDetail = reactive<ItemReceiptDetail & ReturnVendorDetail & { quantityMax?: number }>({});
|
const form = reactive<Header>({ status: 0 });
|
const lines = ref<Line[]>([]);
|
const materialOptions = computed(() => materials.value.map(materialOptionText));
|
const noticeOptions = computed(() => notices.value.map(item => `${item.code || "--"} - ${item.name || "--"} / ${item.vendorName || "无供应商"} / ${item.purchaseOrderCode || "无采购订单"}`));
|
const arrivalLineOptions = computed(() => arrivalLines.value.map(item => `${item.itemCode || "--"} - ${item.itemName || "--"} / ${item.specification || "无规格"} / 到货${item.arrivalQuantity ?? "--"}${item.unitMeasureName || ""}`));
|
const orderOptions = computed(() => orders.value.map(item => `${item.no || "--"} / ${item.supplierName || "无供应商"} / ${(item.totalPrice || 0).toFixed(2)}元`));
|
const warehouseOptions = computed(() => warehouses.value.map(item => `${item.code || "--"} - ${item.name || "--"} / ${item.address || "无地址"}`));
|
const stockLocationOptions = computed(() => stockLocations.value.map(item => `${item.code || "--"} - ${item.name || "--"} / ${item.warehouseName || "无仓库"}`));
|
const stockAreaOptions = computed(() => stockAreas.value.map(item => `${item.code || "--"} - ${item.name || "--"} / ${item.locationName || "无库区"}`));
|
const stockRecordOptions = computed(() => stockRecords.value.map(item => `${item.warehouseName || "--"} / ${item.locationName || "--"} / ${item.areaName || "--"} / ${item.batchCode || "无批次"} / 可用${item.availableQuantity ?? item.quantity ?? "--"}${item.unitMeasureName || ""}`));
|
const currentBatchList = computed(() => batchLineIndex.value === undefined ? [] : batchesByLine.value[batchLineIndex.value] || []);
|
const lineMaterialText = (line?: Line) => materialOptionText(line?.itemId ? { code: line.itemCode, name: line.itemName, specification: line.specification, unitMeasureName: line.unitMeasureName } : undefined);
|
const config = computed(() => ({
|
"arrival-notice": { title: "到货通知", code: "通知单编号", name: "通知单名称", date: "到货日期", dateKey: "arrivalDate", permission: "mes:wm-arrival-notice", rule: "WM_ARRIVAL_NOTICE_CODE" },
|
"item-receipt": { title: "采购入库", code: "入库单编号", name: "入库单名称", date: "入库日期", dateKey: "receiptDate", permission: "mes:wm-item-receipt", rule: "WM_ITEM_RECEIPT_CODE" },
|
"return-vendor": { title: "采购退货", code: "退货单编号", name: "退货单名称", date: "退货日期", dateKey: "returnDate", permission: "mes:wm-return-vendor", rule: "WM_RETURN_VENDOR_CODE" },
|
}[props.kind]));
|
const readonly = computed(() => mode.value !== "edit");
|
const canSave = computed(() => !readonly.value && (id.value ? hasPermission(`${config.value.permission}:update`) : hasPermission(`${config.value.permission}:create`)));
|
const canSubmit = computed(() => id.value && !readonly.value && Number(form.status) === 0 && hasPermission(`${config.value.permission}:update`));
|
const canStock = computed(() => id.value && mode.value === "stock" && (props.kind === "item-receipt" ? hasPermission("mes:wm-item-receipt:update") : hasPermission("mes:wm-return-vendor:update")));
|
const canFinish = computed(() => id.value && mode.value === "finish" && (props.kind === "item-receipt" ? hasPermission("mes:wm-item-receipt:finish") : hasPermission("mes:wm-return-vendor:update-status")));
|
const canEditLine = computed(() => !readonly.value && (id.value ? hasPermission(`${config.value.permission}:update`) : hasPermission(`${config.value.permission}:create`)));
|
const canEditStockDetail = computed(() => mode.value === "stock" && (props.kind === "item-receipt" ? hasPermission("mes:wm-item-receipt:update") : hasPermission("mes:wm-return-vendor:update")));
|
const errorText = (error: unknown) => error instanceof Error ? error.message : "操作失败";
|
const num = (value: string) => { const n = Number(value); return Number.isFinite(n) ? n : 0; };
|
const qualityText = (value?: number | string) => value === undefined || value === "" ? "--" : ({ 0: "合格", 1: "不合格", 2: "待检", QUALIFIED: "合格", UNQUALIFIED: "不合格", PENDING: "待检" } as Record<string, string>)[String(value)] || String(value);
|
const frozenText = (value?: boolean) => value === undefined ? "--" : value ? "是" : "否";
|
function dateValue() { return String((form as Record<string, unknown>)[config.value.dateKey] || ""); }
|
function setDate(value: string) { (form as Record<string, unknown>)[config.value.dateKey] = value; }
|
function selectSupplier(event: { detail: { value: string } }) {
|
const supplier = suppliers.value[Number(event.detail.value)];
|
form.vendorId = supplier?.id;
|
form.vendorName = supplier?.name;
|
form.vendorCode = supplier?.code;
|
}
|
async function selectNotice(event: { detail: { value: string } }) {
|
const notice = notices.value[Number(event.detail.value)];
|
form.noticeId = notice?.id;
|
form.noticeCode = notice?.code;
|
form.vendorId = notice?.vendorId;
|
form.vendorName = notice?.vendorName;
|
form.vendorCode = notice?.vendorCode;
|
form.purchaseOrderCode = notice?.purchaseOrderCode || notice?.purchaseOrderNo;
|
await loadArrivalLines();
|
}
|
function selectPurchaseOrder(event: { detail: { value: string } }) {
|
const order = orders.value[Number(event.detail.value)];
|
form.purchaseOrderId = order?.id;
|
form.purchaseOrderCode = order?.no || order?.orderNo;
|
form.vendorId = order?.supplierId;
|
form.vendorName = order?.supplierName;
|
}
|
function selectArrivalLine(event: { detail: { value: string } }, index: number) {
|
const noticeLine = arrivalLines.value[Number(event.detail.value)];
|
const line = lines.value[index];
|
if (!noticeLine || !line) return;
|
line.noticeId = form.noticeId;
|
line.arrivalNoticeLineId = noticeLine.id;
|
line.itemId = noticeLine.itemId;
|
line.itemCode = noticeLine.itemCode;
|
line.itemName = noticeLine.itemName;
|
line.specification = noticeLine.specification;
|
line.unitMeasureName = noticeLine.unitMeasureName;
|
line.receivedQuantity = noticeLine.arrivalQuantity;
|
}
|
async function selectMaterial(event: { detail: { value: string } }, index: number) {
|
const material = materials.value[Number(event.detail.value)];
|
const line = lines.value[index];
|
if (!material || !line) return;
|
line.itemId = material.id;
|
line.itemCode = material.code;
|
line.itemName = material.name;
|
line.specification = material.specification;
|
line.unitMeasureName = material.unitMeasureName;
|
line.batchId = undefined;
|
line.batchCode = "";
|
if (props.kind === "return-vendor") await loadBatches(index);
|
}
|
function addLine() {
|
lines.value.push({ iqcCheckFlag: false, arrivalQuantity: props.kind === "arrival-notice" ? 1 : undefined, receivedQuantity: props.kind === "item-receipt" ? 1 : undefined, quantity: props.kind === "return-vendor" ? 1 : undefined });
|
}
|
async function removeLine(line: Line, index: number) {
|
if (!state.accessToken || readonly.value) return;
|
if (!line.id) { lines.value.splice(index, 1); return; }
|
const ok = await new Promise<boolean>(resolve => uni.showModal({ title: "确认删除", content: `确定删除明细 ${line.itemName || ""} 吗?`, success: r => resolve(r.confirm) }));
|
if (!ok) return;
|
try {
|
if (props.kind === "arrival-notice") await deleteArrivalNoticeLine(state.accessToken, line.id);
|
else if (props.kind === "item-receipt") await deleteItemReceiptLine(state.accessToken, line.id);
|
else await deleteReturnVendorLine(state.accessToken, line.id);
|
lines.value.splice(index, 1);
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
}
|
async function generateCode() {
|
if (!state.accessToken || generating.value || readonly.value) return;
|
generating.value = true;
|
try { form.code = await generateAutoCode(state.accessToken, config.value.rule); }
|
catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
finally { generating.value = false; }
|
}
|
async function load() {
|
if (!state.accessToken) return;
|
try {
|
const [supplierData, materialData, noticeData, orderData, warehouseData] = await Promise.all([
|
getSupplierSimpleList(state.accessToken),
|
getMaterialPage(state.accessToken, { pageNo: 1, pageSize: 200, status: 0 }),
|
props.kind === "item-receipt" ? getArrivalNoticePage(state.accessToken, { pageNo: 1, pageSize: 100, status: 3 }) : Promise.resolve({ list: [], total: 0 }),
|
props.kind === "arrival-notice" || props.kind === "return-vendor" ? getPurchaseOrderPage(state.accessToken, { pageNo: 1, pageSize: 100, status: 20 }) : Promise.resolve({ list: [], total: 0 }),
|
props.kind === "item-receipt" ? getWarehouseSimpleList(state.accessToken) : Promise.resolve([]),
|
]);
|
suppliers.value = supplierData;
|
materials.value = materialData.list;
|
notices.value = noticeData.list;
|
orders.value = orderData.list;
|
warehouses.value = warehouseData;
|
if (!id.value) {
|
if (props.kind === "arrival-notice" && !lines.value.length) addLine();
|
return;
|
}
|
const header = props.kind === "arrival-notice" ? await getArrivalNotice(state.accessToken, id.value) : props.kind === "item-receipt" ? await getItemReceipt(state.accessToken, id.value) : await getReturnVendor(state.accessToken, id.value);
|
Object.assign(form, header);
|
if (props.kind === "item-receipt" && form.noticeId && !form.noticeCode) {
|
try {
|
const notice = await getArrivalNotice(state.accessToken, form.noticeId);
|
form.noticeCode = notice?.code;
|
form.vendorId = form.vendorId || notice?.vendorId;
|
form.vendorName = form.vendorName || notice?.vendorName;
|
form.vendorCode = form.vendorCode || notice?.vendorCode;
|
form.purchaseOrderCode = form.purchaseOrderCode || notice?.purchaseOrderCode || notice?.purchaseOrderNo;
|
} catch {}
|
}
|
if (props.kind === "arrival-notice" && form.purchaseOrderId && !form.purchaseOrderCode) {
|
try {
|
const order = await getPurchase(state.accessToken, "order", form.purchaseOrderId);
|
form.purchaseOrderCode = order?.no || order?.orderNo;
|
form.vendorId = form.vendorId || order?.supplierId;
|
form.vendorName = form.vendorName || order?.supplierName;
|
} catch {}
|
}
|
if (props.kind === "return-vendor" && form.purchaseOrderId && !form.purchaseOrderCode) {
|
try {
|
const order = await getPurchase(state.accessToken, "order", form.purchaseOrderId);
|
form.purchaseOrderCode = order?.no || order?.orderNo;
|
form.vendorId = form.vendorId || order?.supplierId;
|
form.vendorName = form.vendorName || order?.supplierName;
|
} catch {}
|
}
|
const lineData = props.kind === "arrival-notice"
|
? await getArrivalNoticeLinePage(state.accessToken, { pageNo: 1, pageSize: 200, noticeId: id.value })
|
: props.kind === "item-receipt"
|
? await getItemReceiptLinePage(state.accessToken, { pageNo: 1, pageSize: 200, receiptId: id.value })
|
: await getReturnVendorLinePage(state.accessToken, { pageNo: 1, pageSize: 200, returnId: id.value });
|
lines.value = lineData.list as Line[];
|
if (props.kind === "item-receipt" && form.noticeId) await loadArrivalLines();
|
if (props.kind === "return-vendor") await Promise.all(lines.value.map((_, index) => loadBatches(index)));
|
if (props.kind === "item-receipt") await Promise.all(lines.value.filter(line => line.id).map(line => loadReceiptDetails(line.id!)));
|
if (props.kind === "return-vendor") await Promise.all(lines.value.filter(line => line.id).map(line => loadReturnDetails(line.id!)));
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
}
|
function validate() {
|
if (!form.code?.trim() || (props.kind !== "item-receipt" && !form.name?.trim()) || !form.vendorId || !dateValue()) return "请补全编号、名称、供应商和日期";
|
if (props.kind !== "arrival-notice" && !id.value) return "";
|
if (props.kind !== "arrival-notice" && !lines.value.length) return "";
|
const invalid = lines.value.findIndex(line => !line.itemId || !(props.kind === "arrival-notice" ? line.arrivalQuantity : props.kind === "item-receipt" ? line.receivedQuantity : line.quantity));
|
if (invalid >= 0) return `请补全第 ${invalid + 1} 条明细`;
|
return "";
|
}
|
async function loadBatches(index: number) {
|
if (!state.accessToken) return;
|
const line = lines.value[index];
|
if (!line?.itemId) { batchesByLine.value[index] = []; return; }
|
const data = await getBatchPage(state.accessToken, { pageNo: 1, pageSize: 100, code: batchKeyword.value.trim() || undefined, itemId: line.itemId, vendorId: form.vendorId });
|
batchesByLine.value[index] = data.list;
|
}
|
async function loadArrivalLines() {
|
if (!state.accessToken || !form.noticeId) { arrivalLines.value = []; return; }
|
const data = await getArrivalNoticeLinePage(state.accessToken, { pageNo: 1, pageSize: 200, noticeId: form.noticeId });
|
arrivalLines.value = data.list;
|
}
|
function batchOptionText(batch?: Batch) {
|
return batch ? `${batch.code || "--"} / ${batch.itemCode || "--"} - ${batch.itemName || "--"} / ${batch.itemSpecification || "无规格"} / ${batch.unitName || "无单位"} / ${batch.vendorName || "无供应商"}` : "请选择批次号";
|
}
|
async function openBatch(index: number) {
|
const line = lines.value[index];
|
if (!line?.itemId) {
|
uni.showToast({ title: "请先选择产品物料", icon: "none" });
|
return;
|
}
|
if (!form.vendorId) {
|
uni.showToast({ title: "请先选择供应商", icon: "none" });
|
return;
|
}
|
batchLineIndex.value = index;
|
batchKeyword.value = "";
|
await loadBatches(index);
|
showBatchSelect.value = true;
|
}
|
async function searchBatches() {
|
if (batchLineIndex.value === undefined) return;
|
await loadBatches(batchLineIndex.value);
|
}
|
function chooseBatch(batch: Batch) {
|
const index = batchLineIndex.value;
|
const line = index === undefined ? undefined : lines.value[index];
|
if (!batch || !line) return;
|
line.batchId = batch.id;
|
line.batchCode = batch.code;
|
showBatchSelect.value = false;
|
}
|
async function loadReceiptDetails(lineId: number) {
|
if (!state.accessToken) return;
|
receiptDetails.value = { ...receiptDetails.value, [lineId]: await getItemReceiptDetailListByLine(state.accessToken, lineId) };
|
}
|
function stockDetails(line: Line) {
|
return line.id ? receiptDetails.value[line.id] || [] : [];
|
}
|
async function loadReturnDetails(lineId: number) {
|
if (!state.accessToken) return;
|
returnDetails.value = { ...returnDetails.value, [lineId]: await getReturnVendorDetailListByLine(state.accessToken, lineId) };
|
}
|
function pickingDetails(line: Line) {
|
return line.id ? returnDetails.value[line.id] || [] : [];
|
}
|
async function selectStockWarehouse(event: { detail: { value: string } }) {
|
if (!state.accessToken) return;
|
const warehouse = warehouses.value[Number(event.detail.value)];
|
stockDetail.warehouseId = warehouse?.id;
|
stockDetail.warehouseName = warehouse?.name;
|
stockDetail.locationId = undefined;
|
stockDetail.locationName = "";
|
stockDetail.areaId = undefined;
|
stockDetail.areaName = "";
|
stockLocations.value = warehouse?.id ? await getWarehouseLocationSimpleList(state.accessToken, warehouse.id) : [];
|
stockAreas.value = [];
|
}
|
async function selectStockLocation(event: { detail: { value: string } }) {
|
if (!state.accessToken) return;
|
const location = stockLocations.value[Number(event.detail.value)];
|
stockDetail.locationId = location?.id;
|
stockDetail.locationName = location?.name;
|
stockDetail.areaId = undefined;
|
stockDetail.areaName = "";
|
stockAreas.value = location?.id ? await getWarehouseAreaSimpleList(state.accessToken, location.id) : [];
|
}
|
function selectStockArea(event: { detail: { value: string } }) {
|
const area = stockAreas.value[Number(event.detail.value)];
|
stockDetail.areaId = area?.id;
|
stockDetail.areaName = area?.name;
|
}
|
async function loadStockRecords(line: Line) {
|
if (!state.accessToken || !line.itemId) { stockRecords.value = []; return; }
|
const data = await getMaterialStockPage(state.accessToken, { pageNo: 1, pageSize: 100, batchCode: stockKeyword.value.trim() || undefined, frozen: false, itemId: line.itemId, virtualFilter: "exclude" });
|
stockRecords.value = data.list;
|
}
|
function selectStockRecord(event: { detail: { value: string } }) {
|
const stock = stockRecords.value[Number(event.detail.value)];
|
chooseStockRecord(stock);
|
}
|
function chooseStockRecord(stock?: MaterialStock) {
|
if (!stock) return;
|
stockDetail.materialStockId = stock.id;
|
stockDetail.batchId = stock.batchId;
|
stockDetail.batchCode = stock.batchCode;
|
stockDetail.warehouseId = stock.warehouseId;
|
stockDetail.warehouseName = stock.warehouseName;
|
stockDetail.locationId = stock.locationId;
|
stockDetail.locationName = stock.locationName;
|
stockDetail.areaId = stock.areaId;
|
stockDetail.areaName = stock.areaName;
|
stockDetail.quantity = stock.quantity;
|
stockDetail.quantityMax = stock.quantity;
|
showStockRecordSelect.value = false;
|
}
|
async function openStockDetail(line: Line, detail?: ItemReceiptDetail | ReturnVendorDetail) {
|
if (mode.value !== "stock" || !state.accessToken || !id.value || !line.id) return;
|
stockLine.value = line;
|
Object.keys(stockDetail).forEach(key => delete (stockDetail as Record<string, unknown>)[key]);
|
Object.assign(stockDetail, {
|
receiptId: props.kind === "item-receipt" ? id.value : undefined,
|
returnId: props.kind === "return-vendor" ? id.value : undefined,
|
lineId: line.id,
|
itemId: line.itemId,
|
itemCode: line.itemCode,
|
itemName: line.itemName,
|
specification: line.specification,
|
unitMeasureName: line.unitMeasureName,
|
batchId: line.batchId,
|
batchCode: line.batchCode,
|
quantity: line.receivedQuantity,
|
...detail,
|
});
|
if (props.kind === "item-receipt") {
|
if (!warehouses.value.length) warehouses.value = await getWarehouseSimpleList(state.accessToken);
|
stockLocations.value = stockDetail.warehouseId ? await getWarehouseLocationSimpleList(state.accessToken, stockDetail.warehouseId) : [];
|
stockAreas.value = stockDetail.locationId ? await getWarehouseAreaSimpleList(state.accessToken, stockDetail.locationId) : [];
|
} else if (props.kind === "return-vendor") {
|
stockKeyword.value = "";
|
await loadStockRecords(line);
|
stockDetail.quantity = detail?.quantity || line.quantity;
|
stockDetail.quantityMax = detail?.quantityMax || detail?.quantity || line.quantity;
|
}
|
showStockForm.value = true;
|
}
|
async function searchStockRecords() {
|
if (!stockLine.value) return;
|
await loadStockRecords(stockLine.value);
|
}
|
async function saveStockDetail() {
|
if (!state.accessToken || !stockLine.value?.id || stockSaving.value) return;
|
if (props.kind === "item-receipt" && (!stockDetail.itemId || !stockDetail.warehouseId || !stockDetail.locationId || !stockDetail.areaId || !stockDetail.quantity)) {
|
return uni.showToast({ title: "请补全物料、仓库、库区、库位和数量", icon: "none" });
|
}
|
if (props.kind === "return-vendor" && (!stockDetail.itemId || !stockDetail.materialStockId || !stockDetail.quantity)) {
|
return uni.showToast({ title: "请补全库存记录和数量", icon: "none" });
|
}
|
if (props.kind === "return-vendor" && stockDetail.quantityMax !== undefined && Number(stockDetail.quantity || 0) > Number(stockDetail.quantityMax)) {
|
return uni.showToast({ title: "数量不能超过库存记录数量", icon: "none" });
|
}
|
stockSaving.value = true;
|
try {
|
if (props.kind === "item-receipt") {
|
if (stockDetail.id) await updateItemReceiptDetail(state.accessToken, { ...stockDetail });
|
else stockDetail.id = await createItemReceiptDetail(state.accessToken, { ...stockDetail });
|
} else {
|
if (stockDetail.id) await updateReturnVendorDetail(state.accessToken, { ...stockDetail });
|
else stockDetail.id = await createReturnVendorDetail(state.accessToken, { ...stockDetail });
|
}
|
uni.showToast({ title: "保存成功", icon: "success" });
|
showStockForm.value = false;
|
if (props.kind === "item-receipt") await loadReceiptDetails(stockLine.value.id);
|
else await loadReturnDetails(stockLine.value.id);
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
finally { stockSaving.value = false; }
|
}
|
async function removeStockDetail(line: Line, detail: ItemReceiptDetail | ReturnVendorDetail) {
|
if (!state.accessToken || mode.value !== "stock" || !line.id || !detail.id) return;
|
const ok = await new Promise<boolean>(resolve => uni.showModal({ title: "确认删除", content: `确定删除${props.kind === "item-receipt" ? "上架" : "拣货"}明细 ${detail.warehouseName || ""} 吗?`, success: r => resolve(r.confirm) }));
|
if (!ok) return;
|
try {
|
if (props.kind === "item-receipt") {
|
await deleteItemReceiptDetail(state.accessToken, detail.id);
|
await loadReceiptDetails(line.id);
|
} else {
|
await deleteReturnVendorDetail(state.accessToken, detail.id);
|
await loadReturnDetails(line.id);
|
}
|
uni.showToast({ title: "删除成功", icon: "success" });
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
}
|
async function save() {
|
const warning = validate();
|
if (warning) return uni.showToast({ title: warning, icon: "none" });
|
if (!state.accessToken || saving.value || !canSave.value) return;
|
saving.value = true;
|
try {
|
const savedId = id.value
|
? (props.kind === "arrival-notice" ? await updateArrivalNotice(state.accessToken, { ...form, id: id.value }) : props.kind === "item-receipt" ? await updateItemReceipt(state.accessToken, { ...form, id: id.value }) : await updateReturnVendor(state.accessToken, { ...form, id: id.value }), id.value)
|
: props.kind === "arrival-notice" ? await createArrivalNotice(state.accessToken, form) : props.kind === "item-receipt" ? await createItemReceipt(state.accessToken, form) : await createReturnVendor(state.accessToken, form);
|
const isCreate = !id.value;
|
id.value = savedId;
|
if (isCreate && props.kind !== "arrival-notice") {
|
form.id = savedId;
|
form.status = 0;
|
lines.value = [];
|
uni.showToast({ title: "主单保存成功", icon: "success" });
|
return;
|
}
|
for (const line of lines.value) {
|
const payload = { ...line };
|
if (props.kind === "item-receipt") delete payload.batchCode;
|
if (props.kind === "arrival-notice") { payload.noticeId = savedId; line.id ? await updateArrivalNoticeLine(state.accessToken, payload) : line.id = await createArrivalNoticeLine(state.accessToken, payload); }
|
else if (props.kind === "item-receipt") { payload.receiptId = savedId; line.id ? await updateItemReceiptLine(state.accessToken, payload) : line.id = await createItemReceiptLine(state.accessToken, payload); }
|
else { payload.returnId = savedId; line.id ? await updateReturnVendorLine(state.accessToken, payload) : line.id = await createReturnVendorLine(state.accessToken, payload); }
|
}
|
uni.showToast({ title: "保存成功", icon: "success" });
|
setTimeout(() => uni.navigateBack(), 500);
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
finally { saving.value = false; }
|
}
|
async function submitDoc() {
|
if (!state.accessToken || !id.value) return;
|
try {
|
if (props.kind === "arrival-notice") await submitArrivalNotice(state.accessToken, id.value);
|
else if (props.kind === "item-receipt") await submitItemReceipt(state.accessToken, id.value);
|
else await submitReturnVendor(state.accessToken, id.value);
|
uni.showToast({ title: "提交成功", icon: "success" });
|
setTimeout(() => uni.navigateBack(), 500);
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
}
|
async function confirmBusinessAction(action: "stock" | "finish") {
|
if (!state.accessToken || !id.value) return;
|
const title = props.kind === "item-receipt" ? (action === "stock" ? "执行上架" : "执行入库") : (action === "stock" ? "执行拣货" : "完成退货");
|
const ok = await new Promise<boolean>(resolve => uni.showModal({ title, content: `确认${title} ${form.code || ""} 吗?`, success: r => resolve(r.confirm) }));
|
if (!ok) return;
|
try {
|
if (props.kind === "item-receipt") {
|
if (action === "stock") await stockItemReceipt(state.accessToken, id.value);
|
else await finishItemReceipt(state.accessToken, id.value);
|
} else {
|
if (action === "stock") {
|
const match = await checkReturnVendorQuantity(state.accessToken, id.value);
|
if (!match) {
|
const confirmMismatch = await new Promise<boolean>(resolve => uni.showModal({ title: "数量不一致", content: "退货数量与拣货数量不一致,确认执行拣货?", success: r => resolve(r.confirm) }));
|
if (!confirmMismatch) return;
|
}
|
await stockReturnVendor(state.accessToken, id.value);
|
} else await finishReturnVendor(state.accessToken, id.value);
|
}
|
uni.showToast({ title: "操作成功", icon: "success" });
|
setTimeout(() => uni.navigateBack(), 500);
|
} catch (error) { uni.showToast({ title: errorText(error), icon: "none" }); }
|
}
|
onLoad(query => { id.value = query.id ? Number(query.id) : undefined; mode.value = query.mode === "detail" || query.mode === "stock" || query.mode === "finish" ? query.mode : "edit"; load(); });
|
</script>
|
|
<template>
|
<view class="page">
|
<view class="form-card">
|
<view class="field code-field"><text>{{ config.code }} <text class="required">*</text></text><input v-model="form.code" :disabled="readonly" :placeholder="`请输入${config.code}`" /><button v-if="!readonly" :loading="generating" :disabled="generating" @click="generateCode">生成</button></view>
|
<view class="field"><text>{{ config.name }} <text v-if="kind !== 'item-receipt'" class="required">*</text></text><input v-model="form.name" :disabled="readonly" :placeholder="`请输入${config.name}`" /></view>
|
<view v-if="kind === 'arrival-notice'" class="field"><text>采购订单</text><picker v-if="!readonly" :range="orderOptions" @change="selectPurchaseOrder"><view class="picker"><text>{{ form.purchaseOrderCode || '请选择采购订单' }}</text><text>›</text></view></picker><text v-else class="value">{{ form.purchaseOrderCode || form.purchaseOrderNo || '--' }}</text></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>到货通知单</text><picker v-if="!readonly" :range="noticeOptions" @change="selectNotice"><view class="picker"><text>{{ form.noticeCode || '请选择到货通知单' }}</text><text>›</text></view></picker><text v-else class="value">{{ form.noticeCode || form.noticeId || '--' }}</text></view>
|
<view v-if="kind === 'return-vendor'" class="field"><text>采购订单</text><picker v-if="!readonly" :range="orderOptions" @change="selectPurchaseOrder"><view class="picker"><text>{{ form.purchaseOrderCode || '请选择采购订单' }}</text><text>›</text></view></picker><text v-else class="value">{{ form.purchaseOrderCode || '--' }}</text></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>采购订单号</text><input v-model="form.purchaseOrderCode" :disabled="readonly" placeholder="请输入采购订单号" /></view>
|
<view class="field"><text>供应商 <text class="required">*</text></text><picker v-if="!readonly && kind === 'item-receipt'" :range="suppliers" range-key="name" @change="selectSupplier"><view class="picker"><text>{{ form.vendorName || '请选择供应商' }}</text><text>›</text></view></picker><text v-else class="value">{{ form.vendorName || '--' }}</text></view>
|
<view class="field"><text>{{ config.date }} <text class="required">*</text></text><picker v-if="!readonly" mode="date" :value="dateValue()" @change="setDate($event.detail.value)"><view class="picker"><text>{{ dayText(dateValue()) }}</text><text>›</text></view></picker><text v-else class="value">{{ dayText(dateValue()) }}</text></view>
|
<template v-if="kind === 'arrival-notice'"><view class="field"><text>联系人</text><input v-model="form.contactName" :disabled="readonly" placeholder="请输入联系人" /></view><view class="field"><text>联系方式</text><input v-model="form.contactTelephone" :disabled="readonly" placeholder="请输入联系方式" /></view></template>
|
<template v-if="kind === 'return-vendor'"><view class="field column"><text>退货原因</text><textarea v-model="form.returnReason" :disabled="readonly" placeholder="请输入退货原因" ></textarea></view><view class="field"><text>运单号</text><input v-model="form.transportCode" :disabled="readonly" placeholder="请输入运单号" /></view><view class="field"><text>联系电话</text><input v-model="form.transportTelephone" :disabled="readonly" placeholder="请输入联系电话" /></view></template>
|
<view v-if="readonly" class="field"><text>创建时间</text><text class="value">{{ dateText(form.createTime) }}</text></view>
|
<view class="field column"><text>备注</text><textarea v-model="form.remark" :disabled="readonly" placeholder="请输入备注" ></textarea></view>
|
</view>
|
<view v-if="id" class="form-card">
|
<view class="section"><text>{{ kind === 'arrival-notice' ? '通知单行' : kind === 'item-receipt' ? '入库单行' : '退货单行' }}</text><button v-if="canEditLine" @click="addLine">新增明细</button></view>
|
<view v-for="(line,index) in lines" :key="line.id || index" class="line">
|
<view class="line-head"><text>明细 {{ index + 1 }}</text><button v-if="kind === 'item-receipt' && canEditStockDetail && line.id" @click="openStockDetail(line)">上架</button><button v-else-if="kind === 'return-vendor' && canEditStockDetail && line.id" @click="openStockDetail(line)">拣货</button><button v-else-if="canEditLine" class="danger" @click="removeLine(line,index)">删除</button></view>
|
<view v-if="kind === 'item-receipt' && form.noticeId" class="field"><text>到货通知单行</text><picker v-if="!readonly" :range="arrivalLineOptions" @change="selectArrivalLine($event,index)"><view class="picker"><text>{{ line.arrivalNoticeLineId ? lineMaterialText(line) : '请选择到货通知单行' }}</text><text>›</text></view></picker><text v-else class="value">{{ line.arrivalNoticeLineId ? lineMaterialText(line) : '--' }}</text></view>
|
<view class="field"><text>产品物料 <text class="required">*</text></text><picker v-if="!readonly && !(kind === 'item-receipt' && line.arrivalNoticeLineId)" :range="materialOptions" @change="selectMaterial($event,index)"><view class="picker"><text>{{ lineMaterialText(line) }}</text><text>›</text></view></picker><text v-else class="value">{{ line.itemId ? lineMaterialText(line) : '--' }}</text></view>
|
<view class="field"><text>物料编码</text><text class="value">{{ line.itemCode || '--' }}</text></view>
|
<view class="field"><text>规格型号</text><text class="value">{{ line.specification || '--' }}</text></view>
|
<view class="field"><text>单位</text><text class="value">{{ line.unitMeasureName || '--' }}</text></view>
|
<view v-if="kind === 'arrival-notice'" class="field"><text>到货数量 <text class="required">*</text></text><input :value="String(line.arrivalQuantity || '')" :disabled="readonly" type="digit" placeholder="请输入到货数量" @input="line.arrivalQuantity=num($event.detail.value)" /></view>
|
<view v-if="kind === 'arrival-notice'" class="field"><text>是否检验</text><switch :checked="line.iqcCheckFlag" :disabled="readonly" @change="line.iqcCheckFlag=$event.detail.value" /></view>
|
<view v-if="kind === 'arrival-notice'" class="field"><text>合格数量</text><text class="value">{{ line.qualifiedQuantity ?? '--' }}</text></view>
|
<view v-if="kind === 'arrival-notice'" class="field"><text>检验单号</text><text class="value">{{ line.iqcCode || '--' }}</text></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>入库数量 <text class="required">*</text></text><input :value="String(line.receivedQuantity || '')" :disabled="readonly" type="digit" placeholder="请输入入库数量" @input="line.receivedQuantity=num($event.detail.value)" /></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>生产日期</text><picker v-if="!readonly" mode="date" :value="line.productionDate" @change="line.productionDate=$event.detail.value"><view class="picker"><text>{{ dayText(line.productionDate) }}</text><text>›</text></view></picker><text v-else class="value">{{ dayText(line.productionDate) }}</text></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>有效期</text><picker v-if="!readonly" mode="date" :value="line.expireDate" @change="line.expireDate=$event.detail.value"><view class="picker"><text>{{ dayText(line.expireDate) }}</text><text>›</text></view></picker><text v-else class="value">{{ dayText(line.expireDate) }}</text></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>生产批号</text><input v-model="line.lotNumber" :disabled="readonly" placeholder="请输入生产批号" /></view>
|
<view v-if="kind === 'item-receipt'" class="field"><text>批次号</text><input v-model="line.batchCode" disabled placeholder="由填写信息自动生成" /></view>
|
<view v-if="kind === 'return-vendor'" class="field"><text>批次号</text><view v-if="!readonly" class="picker" @click="openBatch(index)"><text>{{ line.batchCode || '请选择批次号' }}</text><text>›</text></view><text v-else class="value">{{ line.batchCode || '--' }}</text></view>
|
<view v-if="kind === 'return-vendor'" class="field"><text>退货数量 <text class="required">*</text></text><input :value="String(line.quantity || '')" :disabled="readonly" type="digit" placeholder="请输入退货数量" @input="line.quantity=num($event.detail.value)" /></view>
|
<view class="field column"><text>明细备注</text><textarea v-model="line.remark" :disabled="readonly" placeholder="请输入备注" ></textarea></view>
|
<view v-if="kind === 'item-receipt' && line.id" class="stock-details">
|
<view class="stock-title"><text>上架明细</text></view>
|
<view v-for="detail in stockDetails(line)" :key="detail.id" class="stock-row">
|
<view class="stock-info">
|
<text>仓库:{{ detail.warehouseName || '--' }}</text>
|
<text>库区:{{ detail.locationName || '--' }}</text>
|
<text>库位:{{ detail.areaName || '--' }}</text>
|
<text>数量:{{ detail.quantity ?? '--' }}</text>
|
</view>
|
<view v-if="canEditStockDetail" class="stock-actions">
|
<button @click="openStockDetail(line, detail)">编辑</button>
|
<button class="danger" @click="removeStockDetail(line, detail)">删除</button>
|
</view>
|
</view>
|
<view v-if="!stockDetails(line).length" class="empty small">暂无上架明细</view>
|
</view>
|
<view v-if="kind === 'return-vendor' && line.id" class="stock-details">
|
<view class="stock-title"><text>拣货明细</text></view>
|
<view v-for="detail in pickingDetails(line)" :key="detail.id" class="stock-row">
|
<view class="stock-info">
|
<text>批次号:{{ detail.batchCode || '--' }}</text>
|
<text>仓库:{{ detail.warehouseName || '--' }}</text>
|
<text>库区:{{ detail.locationName || '--' }}</text>
|
<text>库位:{{ detail.areaName || '--' }}</text>
|
<text>数量:{{ detail.quantity ?? '--' }}</text>
|
</view>
|
<view v-if="canEditStockDetail" class="stock-actions">
|
<button @click="openStockDetail(line, detail)">编辑</button>
|
<button class="danger" @click="removeStockDetail(line, detail)">删除</button>
|
</view>
|
</view>
|
<view v-if="!pickingDetails(line).length" class="empty small">暂无拣货明细</view>
|
</view>
|
</view>
|
<view v-if="!lines.length" class="empty">暂无明细</view>
|
</view>
|
<button v-if="canSave" class="save" :loading="saving" :disabled="saving" @click="save">保存</button>
|
<button v-if="canSubmit" class="submit" @click="submitDoc">提交</button>
|
<button v-if="canStock" class="submit" @click="confirmBusinessAction('stock')">{{ kind === 'item-receipt' ? '执行上架' : '执行拣货' }}</button>
|
<button v-if="canFinish" class="submit" @click="confirmBusinessAction('finish')">{{ kind === 'item-receipt' ? '执行入库' : '完成退货' }}</button>
|
<button v-else-if="readonly && hasPermission(`${config.permission}:update`)" class="save" @click="mode='edit'">编辑</button>
|
<view v-if="showBatchSelect" class="mask">
|
<view class="modal">
|
<view class="modal-title">选择批次号</view>
|
<view class="select-search"><input v-model="batchKeyword" placeholder="搜索批次编号" confirm-type="search" @confirm="searchBatches" /><text v-if="batchKeyword" @click="batchKeyword='';searchBatches()">清除</text><text @click="searchBatches">搜索</text></view>
|
<scroll-view class="modal-list" scroll-y>
|
<view v-for="batch in currentBatchList" :key="batch.id" class="select-row" @click="chooseBatch(batch)">
|
<text class="select-title">{{ batch.code || '暂无批次编号' }}</text>
|
<text>物料编码:{{ batch.itemCode || '--' }}</text>
|
<text>物料名称:{{ batch.itemName || '--' }}</text>
|
<text>规格型号:{{ batch.itemSpecification || '--' }}</text>
|
<text>单位:{{ batch.unitName || '--' }}</text>
|
<text>供应商编码:{{ batch.vendorCode || '--' }}</text>
|
<text>供应商名称:{{ batch.vendorName || '--' }}</text>
|
<text>客户编码:{{ batch.clientCode || '--' }}</text>
|
<text>客户名称:{{ batch.clientName || '--' }}</text>
|
<text>销售订单编号:{{ batch.salesOrderCode || '--' }}</text>
|
<text>采购订单编号:{{ batch.purchaseOrderCode || '--' }}</text>
|
<text>订单编码:{{ batch.workOrderCode || '--' }}</text>
|
<text>工作站编码:{{ batch.workstationCode || '--' }}</text>
|
<text>生产任务编号:{{ batch.taskCode || '--' }}</text>
|
<text>工具编号:{{ batch.toolCode || '--' }}</text>
|
<text>生产批号:{{ batch.lotNumber || '--' }}</text>
|
<text>质量状态:{{ qualityText(batch.qualityStatus) }}</text>
|
<text>生产日期:{{ dayText(batch.produceDate) }}</text>
|
<text>有效期:{{ dayText(batch.expireDate) }}</text>
|
<text>入库日期:{{ dayText(batch.receiptDate) }}</text>
|
</view>
|
<view v-if="!currentBatchList.length" class="empty">暂无批次</view>
|
</scroll-view>
|
<view class="modal-actions"><button @click="showBatchSelect=false">关闭</button></view>
|
</view>
|
</view>
|
<view v-if="showStockForm" class="mask">
|
<view class="modal">
|
<view class="modal-title">{{ stockDetail.id ? (kind === 'item-receipt' ? '编辑上架明细' : '编辑拣货明细') : (kind === 'item-receipt' ? '新增上架明细' : '新增拣货明细') }}</view>
|
<view class="field"><text>物料</text><text class="value">{{ materialOptionText(stockDetail.itemId ? { code: stockDetail.itemCode, name: stockDetail.itemName, specification: stockDetail.specification, unitMeasureName: stockDetail.unitMeasureName } : undefined) }}</text></view>
|
<view v-if="kind === 'return-vendor'" class="field"><text>库存记录 <text class="required">*</text></text><view class="picker" @click="showStockRecordSelect=true"><text>{{ stockDetail.materialStockId ? stockRecordOptions[stockRecords.findIndex(i=>i.id===stockDetail.materialStockId)] || stockDetail.batchCode || '已选择库存记录' : '请选择库存记录' }}</text><text>›</text></view></view>
|
<view class="field"><text>{{ kind === 'item-receipt' ? '入库仓库' : '仓库' }} <text v-if="kind === 'item-receipt'" class="required">*</text></text><picker v-if="kind === 'item-receipt'" :range="warehouseOptions" @change="selectStockWarehouse"><view class="picker"><text>{{ stockDetail.warehouseName || '请选择仓库' }}</text><text>›</text></view></picker><text v-else class="value">{{ stockDetail.warehouseName || '--' }}</text></view>
|
<view class="field"><text>库区 <text v-if="kind === 'item-receipt'" class="required">*</text></text><picker v-if="kind === 'item-receipt'" :range="stockLocationOptions" @change="selectStockLocation"><view class="picker"><text>{{ stockDetail.locationName || '请选择库区' }}</text><text>›</text></view></picker><text v-else class="value">{{ stockDetail.locationName || '--' }}</text></view>
|
<view class="field"><text>库位 <text v-if="kind === 'item-receipt'" class="required">*</text></text><picker v-if="kind === 'item-receipt'" :range="stockAreaOptions" @change="selectStockArea"><view class="picker"><text>{{ stockDetail.areaName || '请选择库位' }}</text><text>›</text></view></picker><text v-else class="value">{{ stockDetail.areaName || '--' }}</text></view>
|
<view v-if="kind === 'return-vendor'" class="field"><text>批次号</text><text class="value">{{ stockDetail.batchCode || '--' }}</text></view>
|
<view class="field"><text>数量 <text class="required">*</text></text><input :value="String(stockDetail.quantity || '')" type="digit" placeholder="请输入数量" @input="stockDetail.quantity=num($event.detail.value)" /></view>
|
<view class="modal-actions">
|
<button @click="showStockForm=false">取消</button>
|
<button class="primary" :loading="stockSaving" :disabled="stockSaving" @click="saveStockDetail">保存</button>
|
</view>
|
</view>
|
</view>
|
<view v-if="showStockRecordSelect" class="mask stock-select-mask">
|
<view class="modal">
|
<view class="modal-title">选择库存记录</view>
|
<view class="select-search"><input v-model="stockKeyword" placeholder="搜索批次号" confirm-type="search" @confirm="searchStockRecords" /><text v-if="stockKeyword" @click="stockKeyword='';searchStockRecords()">清除</text><text @click="searchStockRecords">搜索</text></view>
|
<scroll-view class="modal-list" scroll-y>
|
<view v-for="stock in stockRecords" :key="stock.id" class="select-row" @click="chooseStockRecord(stock)">
|
<text class="select-title">{{ stock.warehouseName || '--' }} / {{ stock.batchCode || '无批次' }}</text>
|
<text>物料编码:{{ stock.itemCode || '--' }}</text>
|
<text>物料名称:{{ stock.itemName || '--' }}</text>
|
<text>规格型号:{{ stock.specification || '--' }}</text>
|
<text>单位:{{ stock.unitMeasureName || '--' }}</text>
|
<text>入库批次号:{{ stock.batchCode || '--' }}</text>
|
<text>仓库:{{ stock.warehouseName || '--' }}</text>
|
<text>库区:{{ stock.locationName || '--' }}</text>
|
<text>库位:{{ stock.areaName || '--' }}</text>
|
<text>在库数量:{{ stock.quantity ?? '--' }}</text>
|
<text>冻结数量:{{ stock.frozenQuantity ?? '--' }}</text>
|
<text>占用量:{{ stock.reservedQuantity ?? '--' }}</text>
|
<text>在途量:{{ stock.inTransitQuantity ?? '--' }}</text>
|
<text>可用量:{{ stock.availableQuantity ?? '--' }}</text>
|
<text>入库日期:{{ dateText(stock.receiptTime) }}</text>
|
<text>冻结:{{ frozenText(stock.frozen) }}</text>
|
</view>
|
<view v-if="!stockRecords.length" class="empty">暂无库存记录</view>
|
</scroll-view>
|
<view class="modal-actions"><button @click="showStockRecordSelect=false">关闭</button></view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<style lang="scss" scoped>
|
.page{min-height:100vh;padding:24rpx 30rpx 70rpx;background:#f6f7f9}.form-card{overflow:hidden;margin-bottom:20rpx;background:#fff;border-radius:16rpx}.field{display:flex;align-items:center;min-height:96rpx;padding:0 24rpx;gap:20rpx;border-bottom:1rpx solid #eef1f5}.field>text:first-child{width:190rpx;flex:none;color:#33455d;font-size:27rpx}.field>picker{display:block;flex:1;min-width:0}.field input,.picker,.value{min-width:0;flex:1;color:#1e3049;font-size:27rpx;text-align:right}.picker{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12rpx;color:#65758a}.picker text:first-child,.value{min-width:0;flex:1;overflow:hidden;text-align:right;text-overflow:ellipsis;white-space:nowrap}.picker text:last-child{flex:none;width:24rpx;color:#8092a7;font-size:36rpx;text-align:right}.code-field button,.section button,.line-head button,.stock-actions button{flex:none;min-width:112rpx;padding:0 16rpx;margin:0;color:var(--color-primary, #1769d8);font-size:24rpx;line-height:56rpx;background:#fff;border:1rpx solid var(--color-primary, #1769d8);border-radius:8rpx}.column{align-items:flex-start;flex-direction:column;padding:20rpx 24rpx}.column>text:first-child{width:auto}.column textarea{width:100%;height:130rpx;font-size:27rpx}.section,.line-head{display:flex;align-items:center;justify-content:space-between;min-height:82rpx;padding:0 24rpx;color:#1d2f46;font-size:28rpx;font-weight:600;border-bottom:1rpx solid #eef1f5}.line{margin:20rpx;border:1rpx solid #eef1f5;border-radius:14rpx;overflow:hidden}.danger{color:#c65050!important;border-color:#e3a0a0!important}.empty{padding:32rpx;color:#8795a8;font-size:25rpx;text-align:center}.empty.small{padding:20rpx}.save,.submit{margin-top:24rpx;color:#fff;font-size:30rpx;background:var(--color-primary, #1769d8);border-radius:12rpx}.submit{background:#12a06a}.stock-details{padding:18rpx 24rpx 22rpx;background:#fbfcff;border-top:1rpx solid #eef1f5}.stock-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:14rpx;color:#1d2f46;font-size:27rpx;font-weight:600}.stock-row{padding:16rpx 0;border-top:1rpx solid #edf1f6}.stock-row:first-of-type{border-top:0}.stock-info{display:grid;grid-template-columns:1fr 1fr;gap:10rpx 18rpx;color:#40536c;font-size:25rpx}.stock-info text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stock-actions{display:flex;justify-content:flex-end;gap:12rpx;margin-top:14rpx}.mask{position:fixed;left:0;right:0;top:0;bottom:0;z-index:20;display:flex;align-items:flex-end;background:rgba(20,32,48,.45)}.stock-select-mask{z-index:30}.modal{width:100%;max-height:86vh;overflow:auto;padding-bottom:30rpx;background:#fff;border-radius:24rpx 24rpx 0 0}.modal-title{height:96rpx;line-height:96rpx;text-align:center;color:#122033;font-size:30rpx;font-weight:700;border-bottom:1rpx solid #eef1f5}.select-search{display:flex;align-items:center;height:76rpx;margin:18rpx 24rpx 0;padding:0 18rpx;gap:18rpx;background:#f6f8fb;border-radius:14rpx}.select-search input{min-width:0;flex:1;color:#1e3049;font-size:26rpx}.select-search text{flex:none;color:var(--color-primary, #1769d8);font-size:24rpx}.modal-list{max-height:60vh;padding:20rpx 24rpx;box-sizing:border-box;background:#f3f6fb}.select-row{display:grid;gap:9rpx;padding:22rpx;margin-bottom:16rpx;color:#66778c;font-size:23rpx;background:#fff;border-radius:14rpx}.select-title{color:#20334c;font-size:29rpx;font-weight:600}.modal-actions{display:flex;gap:18rpx;padding:24rpx}.modal-actions button{flex:1;margin:0;color:var(--color-primary, #1769d8);background:#fff;border:1rpx solid var(--color-primary, #1769d8);border-radius:12rpx}.modal-actions .primary{color:#fff;background:var(--color-primary, #1769d8)}.save::after,.submit::after,button::after{border:0}
|
</style>
|