feat:出库记录
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-08-04 17:27:37 +08:00
parent 28295b283e
commit 98d6dd0d9b
9 changed files with 391 additions and 296 deletions

View File

@@ -1,20 +1,25 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import {useVbenModal} from '@vben/common-ui';
import {$t} from '@vben/locales';
import {cloneDeep} from '@vben/utils';
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import {type FormSchemaGetter, useVbenForm} from "#/adapter/form";
import {
applicationAdd,
applicationInfo,
applicationUpdate
} from '#/api/property/assetManage/application';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import { modalSchema } from './data';
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";
import { assetList } from "#/api/property/assetManage/asset";
import { userList } from "#/api/system/user";
import {modalSchema} from './data';
import {assetTypeselect} from "#/api/property/assetType";
import {depotList} from "#/api/property/assetManage/depot";
import {suppliersList} from "#/api/property/assetManage/suppliers";
import {assetList} from "#/api/property/assetManage/asset";
import {userList} from "#/api/system/user";
import type {AssetVO} from "#/api/property/assetManage/asset/model";
const emit = defineEmits<{ reload: [] }>();
@@ -39,7 +44,7 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
@@ -48,15 +53,15 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
formApi.getValues().then(setupPackageSelect);
async function upSelectUser(nickName: string){
const list=await userList({
nickName:nickName,
async function upSelectUser(nickName: string) {
const list = await userList({
nickName: nickName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.userName;
item.value=item.id;
const options = list.map(item => {
item.label = item.userName;
item.value = item.id;
})
fromApi.updateSchema([
{
@@ -71,15 +76,15 @@ async function upSelectUser(nickName: string){
]);
}
async function upSelectAssets(assetsName: string){
const list=await assetList({
assetsName:assetsName,
async function upSelectAssets(assetsName: string) {
const list = await assetList({
assetsName: assetsName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.assetsName;
item.value=item.id;
const options = list.map(item => {
item.label = item.assetsName;
item.value = item.id;
})
fromApi.updateSchema([
{
@@ -94,15 +99,18 @@ async function upSelectAssets(assetsName: string){
]);
}
const assetsData = ref<AssetVO[]>([])
async function setupPackageSelect() {
const users = await userList({
pageNum: 1,
pageSize: 10,
pageSize: 1000,
});
const assets = await assetList({
pageNum: 1,
pageSize: 10,
pageSize: 1000,
});
assetsData.value = assets.rows
const options = users.rows.map((item) => ({
label: item.nickName,
value: item.userId,
@@ -121,7 +129,7 @@ async function setupPackageSelect() {
},
async select(userId) {
await upSelectUser(userId);
userId=""
userId = ""
},
fieldName: 'userId',
},
@@ -131,18 +139,30 @@ async function setupPackageSelect() {
optionLabelProp: 'label',
options: assetOptions,
showSearch: true,
onChange: async (value: string) => {
// 找到选中的服务数据
const assetInfo = assetsData.value.find(item => item.id === value);
if (assetInfo) {
formApi.updateSchema([{
componentProps: {
max:assetInfo.stock
},
fieldName: 'number',
}])
}
},
},
async select(assetsId) {
await upSelectAssets(assetsId);
assetsId=""
assetsId = ""
},
fieldName: 'assetId',
},
]);
}
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
@@ -156,7 +176,7 @@ const [BasicModal, modalApi] = useVbenModal({
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
@@ -172,7 +192,7 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
const {valid} = await formApi.validate();
if (!valid) {
return;
}
@@ -197,7 +217,7 @@ async function handleClosed() {
<template>
<BasicModal :title="title">
<BasicForm />
<BasicForm/>
</BasicModal>
</template>