first
parent
aabfd08229
commit
c472019cc7
@ -0,0 +1,38 @@
|
|||||||
|
import { request } from '../../request';
|
||||||
|
|
||||||
|
const prefix = `/wms/wms/recpt/`;
|
||||||
|
// ${functions}列表}
|
||||||
|
export function selectWmsItemRecptList(data: any) {
|
||||||
|
return request.get(`${prefix}list`, data);
|
||||||
|
}
|
||||||
|
// 查询所有${functions}
|
||||||
|
export function selectAllWmsItemRecptList(data: any) {
|
||||||
|
return request.get(`${prefix}selectAll`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行入库
|
||||||
|
export function executeWmsItemRecpt(data: any) {
|
||||||
|
return request.post(`${prefix}execute`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportWmsItemRecpt(data: any) {
|
||||||
|
return request.get(`${prefix}export`, data);
|
||||||
|
}
|
||||||
|
export function getWmsItemRecpt(id: string | number) {
|
||||||
|
return request.get(`${prefix}${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export function addWmsItemRecpt(data: any) {
|
||||||
|
return request.post(`${prefix}add`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
export function editWmsItemRecpt(data: any) {
|
||||||
|
return request.post(`${prefix}edit`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
export function delWmsItemRecpt(ids: string | number) {
|
||||||
|
return request.post(`${prefix}remove/${ids}`);
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
import { request } from '../../request';
|
||||||
|
|
||||||
|
const prefix = `/wms/wms/recptLine/`;
|
||||||
|
// ${functions}列表}
|
||||||
|
export function selectWmsItemRecptLineList(data: any) {
|
||||||
|
return request.get(`${prefix}list`, data);
|
||||||
|
}
|
||||||
|
// 查询所有${functions}
|
||||||
|
export function selectAllWmsItemRecptLineList(data: any) {
|
||||||
|
return request.get(`${prefix}selectAll`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportWmsItemRecptLine(data: any) {
|
||||||
|
return request.get(`${prefix}export`, data);
|
||||||
|
}
|
||||||
|
export function getWmsItemRecptLine(id: string | number) {
|
||||||
|
return request.get(`${prefix}${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export function addWmsItemRecptLine(data: any) {
|
||||||
|
return request.post(`${prefix}add`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
export function editWmsItemRecptLine(data: any) {
|
||||||
|
return request.post(`${prefix}edit`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
export function delWmsItemRecptLine(ids: string | number) {
|
||||||
|
return request.post(`${prefix}remove/${ids}`);
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
import { request } from '../../request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库列表
|
||||||
|
*/
|
||||||
|
export async function list(reqBody: any) {
|
||||||
|
// console.log('reqBody', reqBody);
|
||||||
|
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/list`, { params: reqBody });
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有仓库记录
|
||||||
|
*/
|
||||||
|
export async function getlist(reqBody: any) {
|
||||||
|
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/getlist`, reqBody);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getWorksstationIds() {
|
||||||
|
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/getWorksstationIds`, {});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 仓库新增
|
||||||
|
*/
|
||||||
|
export async function add(reqBody: object) {
|
||||||
|
const data = await request.post<ApiAuth.Token>(`/wms/wms/warehouse`, reqBody);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
export async function getInfo(warehouseId: number) {
|
||||||
|
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/${warehouseId}`, {});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*/
|
||||||
|
export async function update(reqBody: object) {
|
||||||
|
const data = await request.put<ApiAuth.Token>(`/wms/wms/warehouse`, reqBody);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
export async function deleteInfo(warehouseId: number) {
|
||||||
|
const data = await request.delete<ApiAuth.Token>(`/wms/wms/warehouse/${warehouseId}`, {});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据仓库id获取库区库位列表
|
||||||
|
export function getWarehouseAreaList(warehouseId: number) {
|
||||||
|
return request.get(`/wms/wms/warehouse/getTreeList`, { params: { warehouseId } });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取所有的仓库信息
|
||||||
|
export function getAllWarehouseList() {
|
||||||
|
return request.get(`/wms/wms/warehouse/getlist`);
|
||||||
|
}
|
||||||
@ -0,0 +1,351 @@
|
|||||||
|
<template>
|
||||||
|
<my-dialog
|
||||||
|
v-model:show="modalVisible"
|
||||||
|
:title="title"
|
||||||
|
:loading="subDialog"
|
||||||
|
width="1000px"
|
||||||
|
@submit="submit"
|
||||||
|
@cancel="cancel"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
<div>
|
||||||
|
<n-form ref="formRef" label-placement="left" :label-width="100" :model="formModel" :rules="rules">
|
||||||
|
<n-grid :cols="24" :x-gap="18">
|
||||||
|
<!-- <n-form-item-grid-item :span="8" label="入库单ID" path="recptId">
|
||||||
|
<n-input v-model:value="formModel.recptId" placeholder="请输入入库单ID" />
|
||||||
|
</n-form-item-grid-item> -->
|
||||||
|
<!-- <n-form-item-grid-item :span="8" label="产品物料ID" path="itemId">
|
||||||
|
<n-input v-model:value="formModel.itemId" placeholder="请输入产品物料ID" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="产品物料编码" path="itemCode">
|
||||||
|
<n-input v-model:value="formModel.itemCode" placeholder="请输入产品物料编码" />
|
||||||
|
</n-form-item-grid-item> -->
|
||||||
|
<n-form-item-grid-item :span="8" label="产品物料名称" path="itemName">
|
||||||
|
<n-input v-model:value="formModel.itemName" disabled placeholder="请输入产品物料名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="规格型号" path="specification">
|
||||||
|
<n-input v-model:value="formModel.specification" placeholder="请输入规格型号" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="单位" path="unitOfMeasure">
|
||||||
|
<n-input v-model:value="formModel.unitOfMeasure" placeholder="请输入单位" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<!-- <n-form-item-grid-item :span="8" label="应入数量" path="quantityRecived">
|
||||||
|
<n-input v-model:value="formModel.quantityRecived" placeholder="请输入应入数量" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="验收数量" path="quantityChecked">
|
||||||
|
<n-input v-model:value="formModel.quantityChecked" placeholder="请输入验收数量" />
|
||||||
|
</n-form-item-grid-item> -->
|
||||||
|
<n-form-item-grid-item :span="8" label="入库数量" path="quantitySaved">
|
||||||
|
<n-input v-model:value="formModel.quantitySaved" placeholder="请输入上架数量" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="入库批次号" path="batchCode">
|
||||||
|
<n-input v-model:value="formModel.batchCode" placeholder="请输入入库批次号" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="仓库名称" path="warehouseName">
|
||||||
|
<n-input v-model:value="formModel.warehouseName" disabled />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="库区名称" path="locationName">
|
||||||
|
<n-select v-model:value="formModel.locationId" :options="locationOptions" @update:value="locationSelect">
|
||||||
|
<template #empty>
|
||||||
|
<div>
|
||||||
|
<n-empty v-if="locationOptions.length === 0" description="暂无数据" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-select>
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="库位名称" path="locationName">
|
||||||
|
<n-select v-model:value="formModel.areaId" :options="areaOptions" @update:value="areaSelect">
|
||||||
|
<template #empty>
|
||||||
|
<div>
|
||||||
|
<n-empty v-if="areaOptions.length === 0" description="暂无数据" />
|
||||||
|
<n-empty v-if="!formModel.locationId && areaOptions.length > 0" description="请选择库区" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</n-select>
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="有效期" path="expireDate">
|
||||||
|
<n-date-picker v-model:value="formModel.expireDate" type="date" placeholder="请选择有效期" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="备注" path="remark">
|
||||||
|
<n-input v-model:value="formModel.remark" placeholder="请输入备注" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="来料检验单ID" path="iqcId">
|
||||||
|
<n-input v-model:value="formModel.iqcId" placeholder="请输入来料检验单ID" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="来料检验单编号" path="iqcCode">
|
||||||
|
<n-input v-model:value="formModel.iqcCode" placeholder="请输入来料检验单编号" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<!-- <n-form-item-grid-item :span="8" label="净重" path="weight">
|
||||||
|
<n-input-number v-model:value="formModel.weight" placeholder="请输入净重" />
|
||||||
|
</n-form-item-grid-item> -->
|
||||||
|
<!-- <n-form-item-grid-item :span="8" label="应入重量" path="weightRecived">
|
||||||
|
<n-input-number v-model:value="formModel.weightRecived" placeholder="请输入应入重量" />
|
||||||
|
</n-form-item-grid-item> -->
|
||||||
|
<n-form-item-grid-item :span="8" label="入库重量" path="totalWeight">
|
||||||
|
<n-input-number v-model:value="formModel.totalWeight" placeholder="请输入毛重" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="重量单位" path="weightUnit">
|
||||||
|
<n-input v-model:value="formModel.weightUnit" placeholder="请输入重量单位" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="容器码" path="containerCode">
|
||||||
|
<n-input v-model:value="formModel.containerCode" placeholder="请输入容器码" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
</n-grid>
|
||||||
|
</n-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</my-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, watch } from 'vue';
|
||||||
|
import { useMessage } from 'naive-ui';
|
||||||
|
import type { FormInst } from 'naive-ui';
|
||||||
|
// import { createRequiredFormRule } from '@/utils';
|
||||||
|
import { editWmsItemRecptLine, addWmsItemRecptLine } from '@/service/api/wms/recptLine';
|
||||||
|
import { selectAllWmsStorageLocationList } from '@/service/api/wms/location';
|
||||||
|
import { selectAllWmsStorageAreaList } from '@/service/api/wms/area';
|
||||||
|
const locationOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const areaOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
export interface Props {
|
||||||
|
/** 弹窗可见性 */
|
||||||
|
visible: boolean;
|
||||||
|
/**
|
||||||
|
* 弹窗类型
|
||||||
|
* add: 新增
|
||||||
|
* edit: 编辑
|
||||||
|
*/
|
||||||
|
type?: 'add' | 'edit';
|
||||||
|
/** 编辑的表格行数据 */
|
||||||
|
editData?: any;
|
||||||
|
getList;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ModalType = NonNullable<Props['type']>;
|
||||||
|
const subDialog = ref<boolean>(false);
|
||||||
|
|
||||||
|
defineOptions({ name: 'TableActionModal' });
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
type: 'add',
|
||||||
|
editData: null
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
const message = useMessage();
|
||||||
|
const modalVisible = computed({
|
||||||
|
get() {
|
||||||
|
return props.visible;
|
||||||
|
},
|
||||||
|
set(visible) {
|
||||||
|
emit('update:visible', visible);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const cancel = () => {
|
||||||
|
modalVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const title = computed(() => {
|
||||||
|
const titles: Record<ModalType, string> = {
|
||||||
|
add: '添加物料入库单行',
|
||||||
|
edit: '编辑物料入库单行'
|
||||||
|
};
|
||||||
|
return titles[props.type];
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRef = ref<HTMLElement & FormInst>();
|
||||||
|
|
||||||
|
const formModel = ref<wms.recptLineRawType.columns>({
|
||||||
|
lineId: null,
|
||||||
|
recptId: null,
|
||||||
|
itemId: null,
|
||||||
|
itemCode: null,
|
||||||
|
itemName: null,
|
||||||
|
specification: null,
|
||||||
|
unitOfMeasure: null,
|
||||||
|
quantityRecived: null,
|
||||||
|
quantityChecked: null,
|
||||||
|
quantitySaved: null,
|
||||||
|
batchCode: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
expireDate: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
weight: null,
|
||||||
|
weightRecived: null,
|
||||||
|
totalWeight: null,
|
||||||
|
weightUnit: null,
|
||||||
|
containerCode: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = {};
|
||||||
|
|
||||||
|
function handleUpdateFormModelByModalType() {
|
||||||
|
const handlers: Record<ModalType, () => void> = {
|
||||||
|
add: () => {
|
||||||
|
reset();
|
||||||
|
},
|
||||||
|
edit: () => {
|
||||||
|
reset();
|
||||||
|
if (props.editData) {
|
||||||
|
Object.assign(formModel.value, props.editData);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
handlers[props.type]();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit() {
|
||||||
|
await formRef.value?.validate(vaild => {
|
||||||
|
if (!vaild) {
|
||||||
|
if (formModel.value.lineId) {
|
||||||
|
editWmsItemRecptLine(formModel.value)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('修改成功');
|
||||||
|
subDialog.value = false;
|
||||||
|
props.getList();
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.success('修改失败');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addWmsItemRecptLine(formModel.value)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('新增成功');
|
||||||
|
props.getList();
|
||||||
|
subDialog.value = false;
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.success('修改失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function reset() {
|
||||||
|
formModel.value = {
|
||||||
|
lineId: null,
|
||||||
|
recptId: null,
|
||||||
|
itemId: null,
|
||||||
|
itemCode: null,
|
||||||
|
itemName: null,
|
||||||
|
specification: null,
|
||||||
|
unitOfMeasure: null,
|
||||||
|
quantityRecived: null,
|
||||||
|
quantityChecked: null,
|
||||||
|
quantitySaved: null,
|
||||||
|
batchCode: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
expireDate: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
weight: null,
|
||||||
|
weightRecived: null,
|
||||||
|
totalWeight: null,
|
||||||
|
weightUnit: null,
|
||||||
|
containerCode: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
newValue => {
|
||||||
|
if (newValue) {
|
||||||
|
handleUpdateFormModelByModalType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function locationSelect(_val, item) {
|
||||||
|
formModel.value.locationId = item.locationId;
|
||||||
|
formModel.value.locationCode = item.locationCode;
|
||||||
|
formModel.value.locationName = item.locationName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
selectAllWmsStorageAreaList({ locationId: item.locationId }).then(res => {
|
||||||
|
areaOptions.value = [];
|
||||||
|
res.data.forEach(listItem => {
|
||||||
|
areaOptions.value.push({
|
||||||
|
value: listItem.areaId,
|
||||||
|
label: listItem.areaName,
|
||||||
|
...listItem
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function areaSelect(_val, item) {
|
||||||
|
formModel.value.areaId = item.areaId;
|
||||||
|
formModel.value.areaCode = item.areaCode;
|
||||||
|
formModel.value.areaName = item.areaName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
}
|
||||||
|
function init() {
|
||||||
|
// console.log(formModel.value, '------');
|
||||||
|
selectAllWmsStorageLocationList({ warehouseId: formModel.value.warehouseId }).then(res => {
|
||||||
|
locationOptions.value = [];
|
||||||
|
res.data.forEach(listItem => {
|
||||||
|
locationOptions.value.push({
|
||||||
|
value: listItem.locationId,
|
||||||
|
label: listItem.locationName,
|
||||||
|
...listItem
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
selectAllWmsStorageAreaList({ locationId: formModel.value.locationId }).then(res => {
|
||||||
|
areaOptions.value = [];
|
||||||
|
res.data.forEach(listItem => {
|
||||||
|
areaOptions.value.push({
|
||||||
|
value: listItem.areaId,
|
||||||
|
label: listItem.areaName,
|
||||||
|
...listItem
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@ -0,0 +1,691 @@
|
|||||||
|
<template>
|
||||||
|
<div class="h-full">
|
||||||
|
<my-card title="订单信息">
|
||||||
|
<template #right>
|
||||||
|
<div>
|
||||||
|
<component :is="useBackBtn()"></component>
|
||||||
|
<component :is="useBtn(submitInfo, 'lock', 'small', '保存入库', '#646fff')" v-if="!info"></component>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<n-descriptions label-width="100px" label-placement="left" :column="3" bordered>
|
||||||
|
<n-descriptions-item :span="1" label="入库单编号:">
|
||||||
|
{{ RecptInfo.recptCode }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="单据状态:">
|
||||||
|
<dict-tag :options="wms_item_recpt_status" :value="RecptInfo.status"></dict-tag>
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="订单类型:">
|
||||||
|
采购订单
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="入库单名称:">
|
||||||
|
{{ RecptInfo.recptName }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="应入数量:">
|
||||||
|
{{ RecptInfo.quantityRecived }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="应入重量:">
|
||||||
|
{{ RecptInfo.weightRecived }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="入库数量:">
|
||||||
|
{{ num }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="入库重量:">
|
||||||
|
{{ weight }}
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="入库仓库:">
|
||||||
|
<n-select
|
||||||
|
v-model:value="RecptInfo.warehouseId"
|
||||||
|
disabled
|
||||||
|
class="w-210px"
|
||||||
|
:options="storageOptions"
|
||||||
|
@update:value="storageSelect"
|
||||||
|
></n-select>
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="入库日期:">
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="RecptInfo.recptDate"
|
||||||
|
:disabled="info"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择入库日期"
|
||||||
|
/>
|
||||||
|
</n-descriptions-item>
|
||||||
|
|
||||||
|
<n-descriptions-item :span="1" label="保管人:">
|
||||||
|
<n-select
|
||||||
|
v-model:value="RecptInfo.manageBy"
|
||||||
|
:disabled="info"
|
||||||
|
class="w-210px"
|
||||||
|
:options="userOptions"
|
||||||
|
@update:value="manageSelect"
|
||||||
|
></n-select>
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="负责人:">
|
||||||
|
<n-select class="w-210px" :disabled="info" :options="userOptions" @update:value="headSelect"></n-select>
|
||||||
|
</n-descriptions-item>
|
||||||
|
<!-- <n-descriptions-item :span="1" label="业务部门:">
|
||||||
|
<n-tree-select
|
||||||
|
v-model:value="RecptInfo.salseDeptId"
|
||||||
|
:options="menuOptions"
|
||||||
|
label-field="label"
|
||||||
|
key-field="id"
|
||||||
|
@update:value="deptSelect"
|
||||||
|
></n-tree-select>
|
||||||
|
</n-descriptions-item>
|
||||||
|
<n-descriptions-item :span="1" label="业务员:">
|
||||||
|
<n-select
|
||||||
|
v-model:value="RecptInfo.salseBy"
|
||||||
|
class="w-210px"
|
||||||
|
:options="salesOptions"
|
||||||
|
@update:value="salseSelect"
|
||||||
|
></n-select>
|
||||||
|
</n-descriptions-item> -->
|
||||||
|
<n-descriptions-item :span="1" label="备注:">
|
||||||
|
<!-- {{ RecptInfo.remark }} -->
|
||||||
|
<n-input v-model:value="RecptInfo.remark" :disabled="info"></n-input>
|
||||||
|
</n-descriptions-item>
|
||||||
|
</n-descriptions>
|
||||||
|
</my-card>
|
||||||
|
<!-- <my-card title="搜索条件" search>
|
||||||
|
<n-form ref="formRef" inline label-width="auto" :model="searchForm" size="medium">
|
||||||
|
<n-form-item>
|
||||||
|
<component :is="useSearchBtn(search, reset)"></component>
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
</my-card> -->
|
||||||
|
<my-card title="产品(物料)信息">
|
||||||
|
<template #right>
|
||||||
|
<div class="flex-center">
|
||||||
|
<component
|
||||||
|
:is="useDelBtn(delSelect, undefined, '确定要删除所有已选中的数据吗?', Boolean(!selectKeys.length))"
|
||||||
|
v-hasPermi="['wms:recptLine:remove']"
|
||||||
|
></component>
|
||||||
|
<!-- <component :is="useAddBtn(handleAddTable, undefined, '新增')" v-hasPermi="['wms:recptLine:add']"></component> -->
|
||||||
|
<!-- <component :is="useDownBtn(handleExport)"></component> -->
|
||||||
|
<n-button size="small" class="mr-5px" type="primary" @click="getWmsItemRecptLineData">
|
||||||
|
<icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
|
||||||
|
刷新表格
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<n-form ref="dataRef" :model="data" :rules="rules">
|
||||||
|
<n-data-table
|
||||||
|
:row-key="row => row.lineId"
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
:loading="loading"
|
||||||
|
:scroll-x="1600"
|
||||||
|
@update-checked-row-keys="handleSelect"
|
||||||
|
/>
|
||||||
|
</n-form>
|
||||||
|
|
||||||
|
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
|
||||||
|
</div>
|
||||||
|
<!-- <table-action-modal
|
||||||
|
v-model:visible="showModal"
|
||||||
|
:type="modalType"
|
||||||
|
:edit-data="editData"
|
||||||
|
:get-list="getWmsItemRecptLineData"
|
||||||
|
/> -->
|
||||||
|
</my-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="tsx" setup>
|
||||||
|
import { ref, getCurrentInstance, computed } from 'vue';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { useMessage } from 'naive-ui';
|
||||||
|
import type { DataTableColumns, DataTableRowKey, FormInst } from 'naive-ui';
|
||||||
|
import { allUserList } from '@/service';
|
||||||
|
import { BigNumber } from 'bignumber.js';
|
||||||
|
import { useLoading } from '@/hooks';
|
||||||
|
import { getWmsItemRecpt, executeWmsItemRecpt } from '@/service/api/wms/recpt';
|
||||||
|
import { selectWmsItemRecptLineList, delWmsItemRecptLine } from '@/service/api/wms/recptLine';
|
||||||
|
import { useDelBtn, useBackBtn, useBtn } from '@/hooks/common/useBtn';
|
||||||
|
import { getlist, getWarehouseAreaList } from '@/service/api/wms/warehouse';
|
||||||
|
|
||||||
|
const info = ref<boolean>(false);
|
||||||
|
const dataRef = ref<FormInst | null>(null);
|
||||||
|
// import { createRequiredFormRule } from '~/src/utils';
|
||||||
|
// const formItem = ref<null | FormInst>(null);
|
||||||
|
const rules: any = {};
|
||||||
|
const storageOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const { proxy } = getCurrentInstance() as any;
|
||||||
|
const { wms_item_recpt_status, wms_item_recpt_type } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const message = useMessage();
|
||||||
|
|
||||||
|
// const delIds = ref();
|
||||||
|
// const show = ref(false);
|
||||||
|
const total = ref();
|
||||||
|
// const page = ref(1);
|
||||||
|
const searchForm = ref<{
|
||||||
|
pageNum: number;
|
||||||
|
pageSize: number;
|
||||||
|
total: number;
|
||||||
|
recptId: null | string | number;
|
||||||
|
}>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
recptId: null
|
||||||
|
});
|
||||||
|
|
||||||
|
// const editData = ref<wms.recptLineRawType.columns>({
|
||||||
|
// lineId: null,
|
||||||
|
// recptId: null,
|
||||||
|
// itemId: null,
|
||||||
|
// itemCode: null,
|
||||||
|
// itemName: null,
|
||||||
|
// specification: null,
|
||||||
|
// unitOfMeasure: null,
|
||||||
|
// quantityRecived: null,
|
||||||
|
// quantityChecked: null,
|
||||||
|
// quantitySaved: null,
|
||||||
|
// batchCode: null,
|
||||||
|
// warehouseId: null,
|
||||||
|
// warehouseCode: null,
|
||||||
|
// warehouseName: null,
|
||||||
|
// locationId: null,
|
||||||
|
// locationCode: null,
|
||||||
|
// locationName: null,
|
||||||
|
// areaId: null,
|
||||||
|
// areaCode: null,
|
||||||
|
// areaName: null,
|
||||||
|
// expireDate: null,
|
||||||
|
// remark: null,
|
||||||
|
// attr1: null,
|
||||||
|
// attr2: null,
|
||||||
|
// attr3: null,
|
||||||
|
// attr4: null,
|
||||||
|
// createBy: null,
|
||||||
|
// createTime: null,
|
||||||
|
// updateBy: null,
|
||||||
|
// updateTime: null,
|
||||||
|
// iqcId: null,
|
||||||
|
// iqcCode: null,
|
||||||
|
// weight: null,
|
||||||
|
// weightRecived: null,
|
||||||
|
// totalWeight: null,
|
||||||
|
// weightUnit: null,
|
||||||
|
// containerCode: null
|
||||||
|
// });
|
||||||
|
|
||||||
|
const selectKeys = ref<DataTableRowKey[]>([]);
|
||||||
|
function handleSelect(keys: DataTableRowKey[]) {
|
||||||
|
selectKeys.value = keys;
|
||||||
|
}
|
||||||
|
// const list = ref<{ data: wms.recptLineRawType.columns[] }>({ data: [] });
|
||||||
|
const data = ref<wms.recptLineRawType.columns[]>([]);
|
||||||
|
const options = ref<any[]>([]);
|
||||||
|
// const menuOptions = ref();
|
||||||
|
const userOptions = ref<any[]>([]);
|
||||||
|
// const salesOptions = ref<any[]>([]);
|
||||||
|
// const deptId = ref();
|
||||||
|
|
||||||
|
function getUser() {
|
||||||
|
allUserList({ deptId: null }).then(res => {
|
||||||
|
// console.log(res.data, '----');
|
||||||
|
if (!Array.isArray(res.data)) return;
|
||||||
|
res.data.forEach(item => {
|
||||||
|
userOptions.value.push({
|
||||||
|
label: item.nickName,
|
||||||
|
value: item.userId,
|
||||||
|
...item
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// function salesUser(_val) {
|
||||||
|
// salesOptions.value = [];
|
||||||
|
// allUserList({ deptId: _val }).then(res => {
|
||||||
|
// res.data.forEach(item => {
|
||||||
|
// salesOptions.value.push({
|
||||||
|
// label: item.nickName,
|
||||||
|
// value: item.userId
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// function getDeptTree() {
|
||||||
|
// deptTreeSelect().then(response => {
|
||||||
|
// menuOptions.value = response.data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
const columns: Ref<DataTableColumns<wms.recptLineRawType.columns>> = ref([
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
align: 'center',
|
||||||
|
disabled: _row => {
|
||||||
|
return info.value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料类型',
|
||||||
|
key: 'itemTypeName',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料编码',
|
||||||
|
key: 'itemCode',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料名称',
|
||||||
|
key: 'itemName',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '规格型号',
|
||||||
|
key: 'specification',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '应入数量',
|
||||||
|
// key: 'quantityRecived',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '验收数量',
|
||||||
|
// key: 'quantityChecked',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '已入库数量',
|
||||||
|
// key: 'quantitySavedTemp',
|
||||||
|
// width: 120,
|
||||||
|
// render: row => {
|
||||||
|
// return `${row.quantitySavedTemp}`;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '已入库重量',
|
||||||
|
// key: 'weightSavedTemp',
|
||||||
|
// width: 120,
|
||||||
|
// render: row => {
|
||||||
|
// return `${row.weightSavedTemp}`;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '入库数量',
|
||||||
|
key: 'quantitySaved',
|
||||||
|
width: 180,
|
||||||
|
render: row => {
|
||||||
|
return (
|
||||||
|
<div class="flex-center">
|
||||||
|
<sapn class="color-red mr-5px">*</sapn>
|
||||||
|
<n-form-item path={`quantitySaved${row.recptId}`}>
|
||||||
|
<n-input disabled={info.value} v-model:value={row.quantitySaved}></n-input>
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '入库重量',
|
||||||
|
key: 'weight',
|
||||||
|
width: 180,
|
||||||
|
render: row => {
|
||||||
|
return (
|
||||||
|
<div class="flex-center">
|
||||||
|
<sapn class="color-red mr-5px">*</sapn>
|
||||||
|
<n-form-item path={`weight${row.recptId}`}>
|
||||||
|
<n-input disabled={info.value} v-model:value={row.weight}></n-input>
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '仓库名称',
|
||||||
|
key: 'warehouseName',
|
||||||
|
width: 180,
|
||||||
|
render: row => {
|
||||||
|
return (
|
||||||
|
<n-cascader
|
||||||
|
disabled={info.value}
|
||||||
|
options={options.value}
|
||||||
|
label-field="pname"
|
||||||
|
value-field="id"
|
||||||
|
children-field="children"
|
||||||
|
ellipsis-tag-popover-props={true}
|
||||||
|
v-model:value={row.areaName}
|
||||||
|
placeholder="请选择仓库"
|
||||||
|
clearable
|
||||||
|
check-strategy="child"
|
||||||
|
cascade={false}
|
||||||
|
onUpdateValue={(_value, item) => {
|
||||||
|
// row.warehouseId = value;
|
||||||
|
row.areaId = item.id;
|
||||||
|
row.locationId = item.pid;
|
||||||
|
row.areaName = item.pname;
|
||||||
|
}}
|
||||||
|
></n-cascader>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '入库批次号',
|
||||||
|
key: 'batchCode',
|
||||||
|
width: 190,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// {
|
||||||
|
// title: '库区名称',
|
||||||
|
// key: 'locationName',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '库位名称',
|
||||||
|
// key: 'areaName',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '来料检验单编号',
|
||||||
|
// key: 'iqcCode',
|
||||||
|
// width: 130
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '应入重量',
|
||||||
|
// key: 'weightRecived',
|
||||||
|
// width: 120
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 220,
|
||||||
|
align: 'center',
|
||||||
|
render: (_row, index) => {
|
||||||
|
return [
|
||||||
|
info.value
|
||||||
|
? ''
|
||||||
|
: // useEditBtn(() => handleEditTable(row.lineId as number)),
|
||||||
|
useDelBtn(() => {
|
||||||
|
// delWmsItemRecptLine(row.lineId as number).then(res => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// window.$message?.success('删除成功');
|
||||||
|
// init();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// console.log(index);
|
||||||
|
data.value.splice(index, 1);
|
||||||
|
// console.log(data.value);
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]) as Ref<DataTableColumns<any>>;
|
||||||
|
|
||||||
|
const { loading, startLoading, endLoading } = useLoading(false);
|
||||||
|
// const { setTrue: openModal } = useBoolean();
|
||||||
|
|
||||||
|
// function setModalType(type: ModalType) {
|
||||||
|
// modalType.value = type;
|
||||||
|
// }
|
||||||
|
// 重置
|
||||||
|
// function reset() {
|
||||||
|
// searchForm.value.pageNum = 1;
|
||||||
|
// page.value = 1;
|
||||||
|
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
// const { pageNum, pageSize, ...rest } = searchForm.value;
|
||||||
|
// for (const key in rest) {
|
||||||
|
// if (searchForm.value[key] !== '') {
|
||||||
|
// searchForm.value[key] = '';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// getWmsItemRecptLineData();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function search() {
|
||||||
|
// searchForm.value.pageNum = 1;
|
||||||
|
// init();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
// function handleAddTable() {
|
||||||
|
// setModalType('add');
|
||||||
|
|
||||||
|
// openModal();
|
||||||
|
// }
|
||||||
|
// 编辑
|
||||||
|
// async function handleEditTable(lineId: number) {
|
||||||
|
// getWmsItemRecptLine(lineId).then(res => {
|
||||||
|
// for (const key in res.data) {
|
||||||
|
// if ((key.includes('Date') || key.includes('Time')) && key !== 'createTime' && key !== 'updateTime') {
|
||||||
|
// res.data[key] = new Date(res.data[key] as unknown as string).getTime();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// editData.value = deepClone(res.data);
|
||||||
|
// editData.value.expireDate = new Date(editData.value.expireDate as unknown as string).getTime();
|
||||||
|
// setModalType('edit');
|
||||||
|
// openModal();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 获取信息
|
||||||
|
function getWmsItemRecptLineData() {
|
||||||
|
searchForm.value.recptId = route.query.id as string;
|
||||||
|
startLoading();
|
||||||
|
selectWmsItemRecptLineList({ params: searchForm.value }).then(res => {
|
||||||
|
data.value = res.rows;
|
||||||
|
if (!Array.isArray(res.rows)) return;
|
||||||
|
data.value.forEach(item => {
|
||||||
|
item.quantitySavedTemp = item.quantitySaved;
|
||||||
|
item.weightSavedTemp = item.weight as string;
|
||||||
|
// item.quantitySaved = '0';
|
||||||
|
// item.weight = 0;
|
||||||
|
// 生成表单校验
|
||||||
|
rules[`quantitySaved${item.recptId}`] = {
|
||||||
|
trigger: ['input', 'blur'],
|
||||||
|
validator: (rule, _value, callback) => {
|
||||||
|
const tempRecptId = rule.field.split('quantitySaved')[1] as string;
|
||||||
|
if (parseInt(tempRecptId, 10) === item.recptId && (Number(item.weight) || Number(item.quantitySaved))) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
return callback('数量和重量必须有一个大于0');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
rules[`weight${item.recptId}`] = {
|
||||||
|
trigger: ['input', 'blur'],
|
||||||
|
validator: (rule, _value, callback) => {
|
||||||
|
const tempRecptId = rule.field.split('weight')[1] as string;
|
||||||
|
if (parseInt(tempRecptId, 10) === item.recptId && (Number(item.weight) || Number(item.quantitySaved))) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
return callback('数量和重量必须有一个大于0');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// list.value.data = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
searchForm.value.total = res.total;
|
||||||
|
if (data.value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
endLoading();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function delSelect() {
|
||||||
|
delWmsItemRecptLine(selectKeys.value.join(',') as string).then(() => {
|
||||||
|
getWmsItemRecptLineData();
|
||||||
|
message.success('删除成功');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// function handleExport() {
|
||||||
|
// show.value = true;
|
||||||
|
// }
|
||||||
|
const RecptInfo = ref<wms.recptRawType.columns>({
|
||||||
|
recptId: null,
|
||||||
|
recptCode: null,
|
||||||
|
recptName: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
poCode: null,
|
||||||
|
vendorId: null,
|
||||||
|
vendorCode: null,
|
||||||
|
vendorName: null,
|
||||||
|
vendorNick: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
recptDate: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
type: null,
|
||||||
|
fromBillId: null,
|
||||||
|
fromBillCode: null,
|
||||||
|
fromBillName: null,
|
||||||
|
snidCode: null,
|
||||||
|
createByNick: null,
|
||||||
|
manageBy: null,
|
||||||
|
manageByNick: null,
|
||||||
|
headBy: null,
|
||||||
|
headByNick: null,
|
||||||
|
salseDeptId: null,
|
||||||
|
salseDeptName: null,
|
||||||
|
salseBy: null,
|
||||||
|
salseByNick: null
|
||||||
|
});
|
||||||
|
const num = computed(() => {
|
||||||
|
// 计算data中quantitySaved的相加的值使用bigNumber进行计算
|
||||||
|
|
||||||
|
const val = data.value.reduce((acc, cur) => {
|
||||||
|
const num1 = new BigNumber(acc);
|
||||||
|
const num2 = new BigNumber(cur.quantitySaved || 0);
|
||||||
|
return num1.plus(num2).toNumber();
|
||||||
|
}, 0);
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
RecptInfo.value.quantitySaved = val;
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
const weight = computed(() => {
|
||||||
|
const val = data.value.reduce((acc, cur) => {
|
||||||
|
const num1 = new BigNumber(acc);
|
||||||
|
const num2 = new BigNumber(cur.weight || 0);
|
||||||
|
return num1.plus(num2).toNumber();
|
||||||
|
}, 0);
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
RecptInfo.value.weightSaved = val;
|
||||||
|
return val;
|
||||||
|
});
|
||||||
|
// function deptSelect(_val, item) {
|
||||||
|
// // console.log(_val, item, '11');
|
||||||
|
// salesUser(_val);
|
||||||
|
// RecptInfo.value.salseDeptName = item.label;
|
||||||
|
// }
|
||||||
|
function getRecptInfo() {
|
||||||
|
getWmsItemRecpt(route.query.id as string).then(res => {
|
||||||
|
// console.log(res, res.data.salseDeptId, '11');
|
||||||
|
RecptInfo.value = res.data;
|
||||||
|
RecptInfo.value.recptDate = new Date(RecptInfo.value.recptDate as unknown as string).getTime();
|
||||||
|
// salesUser(res.data.salseDeptId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function storageSelect(_val, item) {
|
||||||
|
RecptInfo.value.warehouseId = item.warehouseId;
|
||||||
|
RecptInfo.value.warehouseCode = item.warehouseCode;
|
||||||
|
RecptInfo.value.warehouseName = item.warehouseName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
// selectAllWmsStorageLocationList({ warehouseId: item.warehouseId }).then(res => {
|
||||||
|
// locationOptions.value = [];
|
||||||
|
// res.data.forEach(listItem => {
|
||||||
|
// locationOptions.value.push({
|
||||||
|
// value: listItem.locationId,
|
||||||
|
// label: listItem.locationName,
|
||||||
|
// ...listItem
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
function manageSelect(_val, item) {
|
||||||
|
RecptInfo.value.manageBy = item.userId;
|
||||||
|
RecptInfo.value.manageByNick = item.nickName;
|
||||||
|
}
|
||||||
|
function headSelect(_val, item) {
|
||||||
|
RecptInfo.value.headBy = item.userId;
|
||||||
|
RecptInfo.value.headByNick = item.nickName;
|
||||||
|
// console.log(item, '1');
|
||||||
|
}
|
||||||
|
// function salseSelect(_val, item) {
|
||||||
|
// RecptInfo.value.salseBy = item.userId;
|
||||||
|
// RecptInfo.value.salseByNick = item.nickName;
|
||||||
|
// }
|
||||||
|
function getStorage(val) {
|
||||||
|
if (!val) return;
|
||||||
|
getWarehouseAreaList(val).then(res => {
|
||||||
|
options.value = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function submitInfo() {
|
||||||
|
dataRef.value?.validate(err => {
|
||||||
|
if (!err) {
|
||||||
|
console.log('校验通过');
|
||||||
|
RecptInfo.value.lineList = data.value;
|
||||||
|
executeWmsItemRecpt(RecptInfo.value).then(res => {
|
||||||
|
// console.log(res);
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('入库成功');
|
||||||
|
router.go(-1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// console.log(RecptInfo.value, data.value, '--------');
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
info.value = Boolean(route.query.info);
|
||||||
|
getWmsItemRecptLineData();
|
||||||
|
getRecptInfo();
|
||||||
|
getlist({}).then(res => {
|
||||||
|
if (!Array.isArray(res.data)) return;
|
||||||
|
res.data.forEach(item => {
|
||||||
|
storageOptions.value.push({
|
||||||
|
value: item.warehouseId,
|
||||||
|
label: item.warehouseName,
|
||||||
|
...item
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
getStorage(route.query.warehouseId as string);
|
||||||
|
getUser();
|
||||||
|
// 获取部门信息
|
||||||
|
// getDeptTree();
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
</script>
|
||||||
@ -0,0 +1,367 @@
|
|||||||
|
<template>
|
||||||
|
<my-dialog
|
||||||
|
v-model:show="modalVisible"
|
||||||
|
:title="title"
|
||||||
|
:loading="subDialog"
|
||||||
|
width="1000px"
|
||||||
|
@submit="submit"
|
||||||
|
@cancel="cancel"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
|
<div>
|
||||||
|
<n-form ref="formRef" label-placement="left" :label-width="100" :model="formModel" :rules="rules">
|
||||||
|
<n-grid :cols="24" :x-gap="18">
|
||||||
|
<n-form-item-grid-item :span="8" label="入库单名称" path="recptName">
|
||||||
|
<n-input v-model:value="formModel.recptName" placeholder="请输入入库单名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="采购订单编号" path="poCode">
|
||||||
|
<n-input v-model:value="formModel.poCode" placeholder="请输入采购订单编号" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="供应商名称" path="vendorName">
|
||||||
|
<n-select :options="supperOptions" @update:value="supperSelect"></n-select>
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="仓库名称" path="warehouseName">
|
||||||
|
<n-select v-moedl:value="formModel.warehouseId" :options="storageOptions" @update:value="storageSelect" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="入库日期" path="recptDate">
|
||||||
|
<n-date-picker v-model:value="formModel.recptDate" type="date" placeholder="请选择入库日期" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="单据状态" path="status">
|
||||||
|
<n-select
|
||||||
|
v-model:value="formModel.status"
|
||||||
|
disabled
|
||||||
|
filterable
|
||||||
|
placeholder="请选择单据状态"
|
||||||
|
:options="wms_item_recpt_status"
|
||||||
|
/>
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="备注" path="remark">
|
||||||
|
<n-input v-model:value="formModel.remark" placeholder="请输入备注" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="单据类型" path="type">
|
||||||
|
<n-select
|
||||||
|
v-model:value="formModel.type"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择单据类型"
|
||||||
|
:options="wms_item_recpt_type"
|
||||||
|
/>
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="来源单据ID" path="fromBillId">
|
||||||
|
<n-input v-model:value="formModel.fromBillId" placeholder="请输入来源单据ID" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="来源单据编码" path="fromBillCode">
|
||||||
|
<n-input v-model:value="formModel.fromBillCode" placeholder="请输入来源单据编码" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="来源单据名称" path="fromBillName">
|
||||||
|
<n-input v-model:value="formModel.fromBillName" placeholder="请输入来源单据名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="创建者名称" path="createByNick">
|
||||||
|
<n-input v-model:value="formModel.createByNick" placeholder="请输入创建者名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="保管人" path="manageBy">
|
||||||
|
<n-input v-model:value="formModel.manageBy" placeholder="请输入保管人" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="保管人简称" path="manageByNick">
|
||||||
|
<n-input v-model:value="formModel.manageByNick" placeholder="请输入保管人简称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="负责人" path="headBy">
|
||||||
|
<n-input v-model:value="formModel.headBy" placeholder="请输入负责人" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="负责人简称" path="headByNick">
|
||||||
|
<n-input v-model:value="formModel.headByNick" placeholder="请输入负责人简称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="业务部门" path="salseDeptId">
|
||||||
|
<n-input v-model:value="formModel.salseDeptId" placeholder="请输入业务部门" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="业务部门名称" path="salseDeptName">
|
||||||
|
<n-input v-model:value="formModel.salseDeptName" placeholder="请输入业务部门名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
|
||||||
|
<n-form-item-grid-item :span="8" label="业务员" path="salseBy">
|
||||||
|
<n-input v-model:value="formModel.salseBy" placeholder="请输入业务员" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
<n-form-item-grid-item :span="8" label="业务员名称" path="salseByNick">
|
||||||
|
<n-input v-model:value="formModel.salseByNick" placeholder="请输入业务员名称" />
|
||||||
|
</n-form-item-grid-item>
|
||||||
|
</n-grid>
|
||||||
|
</n-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</my-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, watch, getCurrentInstance } from 'vue';
|
||||||
|
import { useMessage } from 'naive-ui';
|
||||||
|
import type { FormInst } from 'naive-ui';
|
||||||
|
import { createRequiredFormRule } from '@/utils';
|
||||||
|
import { editWmsItemRecpt, addWmsItemRecpt } from '@/service/api/wms/recpt';
|
||||||
|
import { getlist } from '@/service/api/wms/warehouse';
|
||||||
|
import { getAllSupplier } from '@/service/api/erp/rawProcureList';
|
||||||
|
const supperOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const storageOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const locationOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const areaOptions = ref<{ value: string; label: string }[]>([]);
|
||||||
|
const { proxy } = getCurrentInstance() as any;
|
||||||
|
const { wms_item_recpt_status, wms_item_recpt_type } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
|
||||||
|
export interface Props {
|
||||||
|
/** 弹窗可见性 */
|
||||||
|
visible: boolean;
|
||||||
|
/**
|
||||||
|
* 弹窗类型
|
||||||
|
* add: 新增
|
||||||
|
* edit: 编辑
|
||||||
|
*/
|
||||||
|
type?: 'add' | 'edit';
|
||||||
|
/** 编辑的表格行数据 */
|
||||||
|
editData?: any;
|
||||||
|
getList;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ModalType = NonNullable<Props['type']>;
|
||||||
|
const subDialog = ref<boolean>(false);
|
||||||
|
|
||||||
|
defineOptions({ name: 'TableActionModal' });
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
type: 'add',
|
||||||
|
editData: null
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
const message = useMessage();
|
||||||
|
const modalVisible = computed({
|
||||||
|
get() {
|
||||||
|
return props.visible;
|
||||||
|
},
|
||||||
|
set(visible) {
|
||||||
|
emit('update:visible', visible);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const cancel = () => {
|
||||||
|
modalVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const title = computed(() => {
|
||||||
|
const titles: Record<ModalType, string> = {
|
||||||
|
add: '添加物料入库单',
|
||||||
|
edit: '编辑物料入库单'
|
||||||
|
};
|
||||||
|
return titles[props.type];
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRef = ref<HTMLElement & FormInst>();
|
||||||
|
|
||||||
|
const formModel = ref<WMS.recptRawType.columns>({
|
||||||
|
recptId: null,
|
||||||
|
recptCode: null,
|
||||||
|
recptName: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
poCode: null,
|
||||||
|
vendorId: null,
|
||||||
|
vendorCode: null,
|
||||||
|
vendorName: null,
|
||||||
|
vendorNick: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
recptDate: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
type: null,
|
||||||
|
fromBillId: null,
|
||||||
|
fromBillCode: null,
|
||||||
|
fromBillName: null,
|
||||||
|
snidCode: null,
|
||||||
|
createByNick: null,
|
||||||
|
manageBy: null,
|
||||||
|
manageByNick: null,
|
||||||
|
headBy: null,
|
||||||
|
headByNick: null,
|
||||||
|
salseDeptId: null,
|
||||||
|
salseDeptName: null,
|
||||||
|
salseBy: null,
|
||||||
|
salseByNick: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
recptCode: createRequiredFormRule('入库单编号不能为空'),
|
||||||
|
recptName: createRequiredFormRule('入库单名称不能为空')
|
||||||
|
};
|
||||||
|
|
||||||
|
function handleUpdateFormModelByModalType() {
|
||||||
|
const handlers: Record<ModalType, () => void> = {
|
||||||
|
add: () => {
|
||||||
|
reset();
|
||||||
|
},
|
||||||
|
edit: () => {
|
||||||
|
reset();
|
||||||
|
if (props.editData) {
|
||||||
|
Object.assign(formModel.value, props.editData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
handlers[props.type]();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit() {
|
||||||
|
await formRef.value?.validate(vaild => {
|
||||||
|
if (!vaild) {
|
||||||
|
if (formModel.value.recptId) {
|
||||||
|
editWmsItemRecpt(formModel.value)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('修改成功');
|
||||||
|
subDialog.value = false;
|
||||||
|
props.getList();
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.success('修改失败');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addWmsItemRecpt(formModel.value)
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('新增成功');
|
||||||
|
props.getList();
|
||||||
|
subDialog.value = false;
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.success('修改失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function reset() {
|
||||||
|
formModel.value = {
|
||||||
|
recptId: null,
|
||||||
|
recptCode: null,
|
||||||
|
recptName: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
poCode: null,
|
||||||
|
vendorId: null,
|
||||||
|
vendorCode: null,
|
||||||
|
vendorName: null,
|
||||||
|
vendorNick: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
recptDate: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
type: null,
|
||||||
|
fromBillId: null,
|
||||||
|
fromBillCode: null,
|
||||||
|
fromBillName: null,
|
||||||
|
snidCode: null,
|
||||||
|
createByNick: null,
|
||||||
|
manageBy: null,
|
||||||
|
manageByNick: null,
|
||||||
|
headBy: null,
|
||||||
|
headByNick: null,
|
||||||
|
salseDeptId: null,
|
||||||
|
salseDeptName: null,
|
||||||
|
salseBy: null,
|
||||||
|
salseByNick: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
newValue => {
|
||||||
|
if (newValue) {
|
||||||
|
handleUpdateFormModelByModalType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function supperSelect(_val, item) {
|
||||||
|
formModel.value.vendorId = item.id;
|
||||||
|
formModel.value.vendorCode = item.vendorCode;
|
||||||
|
formModel.value.vendorName = item.vendorName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
}
|
||||||
|
function storageSelect(_val, item) {
|
||||||
|
formModel.value.warehouseId = item.warehouseId;
|
||||||
|
formModel.value.warehouseCode = item.warehouseCode;
|
||||||
|
formModel.value.warehouseName = item.warehouseName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
}
|
||||||
|
function locationSelect(_val, item) {
|
||||||
|
formModel.value.locationId = item.locationId;
|
||||||
|
formModel.value.locationCode = item.locationCode;
|
||||||
|
formModel.value.locationName = item.locationName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
}
|
||||||
|
function areaSelect(_val, item) {
|
||||||
|
formModel.value.areaId = item.areaId;
|
||||||
|
formModel.value.areaCode = item.areaCode;
|
||||||
|
formModel.value.areaName = item.areaName;
|
||||||
|
// console.log(formModel.value, item, '------');
|
||||||
|
}
|
||||||
|
function init() {
|
||||||
|
getAllSupplier({ attr1: 'FL' }).then(res => {
|
||||||
|
if (!Array.isArray(res.data)) return;
|
||||||
|
res.data.forEach(item => {
|
||||||
|
supperOptions.value.push({
|
||||||
|
value: item.id,
|
||||||
|
label: item.vendorName,
|
||||||
|
...item
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
getlist({}).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if (!Array.isArray(res.data)) return;
|
||||||
|
res.data.forEach(item => {
|
||||||
|
storageOptions.value.push({
|
||||||
|
value: item.warehouseId,
|
||||||
|
label: item.warehouseName,
|
||||||
|
...item
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@ -0,0 +1,377 @@
|
|||||||
|
<template>
|
||||||
|
<div class="h-full">
|
||||||
|
<my-card title="搜索条件" search>
|
||||||
|
<n-form ref="formRef" inline label-width="auto" :model="searchForm" size="medium">
|
||||||
|
<n-form-item label="采购订单编号">
|
||||||
|
<n-input v-model:value="searchForm.poCode" placeholder="请输入采购订单编号" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="供应商名称">
|
||||||
|
<n-input v-model:value="searchForm.vendorName" placeholder="请输入供应商名称" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="单据状态">
|
||||||
|
<n-select v-model:value="searchForm.status" class="w-180px" :options="wms_item_recpt_status"></n-select>
|
||||||
|
<!-- <n-input v-model:value="searchForm.status" placeholder="请选择单据状态" /> -->
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item>
|
||||||
|
<component :is="useSearchBtn(search, reset)"></component>
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
</my-card>
|
||||||
|
<my-card title="采购入库列表">
|
||||||
|
<template #right>
|
||||||
|
<div class="flex-center">
|
||||||
|
<component
|
||||||
|
:is="useDelBtn(delSelect, undefined, '确定要删除所有已选中的数据吗?', Boolean(!selectKeys.length))"
|
||||||
|
v-hasPermi="['wms:recpt:remove']"
|
||||||
|
></component>
|
||||||
|
<!-- <component :is="useAddBtn(handleAddTable, undefined, '新增')" v-hasPermi="['wms:recpt:add']"></component>
|
||||||
|
<component :is="useDownBtn(handleExport)"></component> -->
|
||||||
|
<n-button size="small" class="mr-5px" type="primary" @click="getWmsItemRecptData">
|
||||||
|
<icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
|
||||||
|
刷新表格
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div>
|
||||||
|
<n-data-table
|
||||||
|
:row-key="row => row.recptId"
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
:loading="loading"
|
||||||
|
:scroll-x="1000"
|
||||||
|
@update-checked-row-keys="handleSelect"
|
||||||
|
/>
|
||||||
|
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
|
||||||
|
</div>
|
||||||
|
<table-action-modal
|
||||||
|
v-model:visible="showModal"
|
||||||
|
:type="modalType"
|
||||||
|
:edit-data="editData"
|
||||||
|
:get-list="getWmsItemRecptData"
|
||||||
|
/>
|
||||||
|
</my-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="tsx" setup>
|
||||||
|
import { ref, getCurrentInstance } from 'vue';
|
||||||
|
import type { Ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useMessage } from 'naive-ui';
|
||||||
|
import type { DataTableColumns, DataTableRowKey } from 'naive-ui';
|
||||||
|
import { useLoading, useBoolean } from '@/hooks';
|
||||||
|
// import { deepClone } from '@/utils';
|
||||||
|
import { selectWmsItemRecptList, delWmsItemRecpt } from '@/service/api/wms/recpt';
|
||||||
|
import { useSearchBtn, useDelBtn, useBtn, useEditBtn } from '@/hooks/common/useBtn';
|
||||||
|
// import { download } from '@/service/request/helpers';
|
||||||
|
import type { ModalType } from './components/table-action-modal.vue';
|
||||||
|
import TableActionModal from './components/table-action-modal.vue';
|
||||||
|
const router = useRouter();
|
||||||
|
const { proxy } = getCurrentInstance() as any;
|
||||||
|
const { wms_item_recpt_status } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
|
||||||
|
|
||||||
|
// const collapseFlag = ref<boolean>(false);
|
||||||
|
const { bool: showModal } = useBoolean();
|
||||||
|
const modalType = ref<ModalType>('add');
|
||||||
|
// const menuOptions = ref();
|
||||||
|
const message = useMessage();
|
||||||
|
|
||||||
|
// const delIds = ref();
|
||||||
|
// const show = ref(false);
|
||||||
|
const total = ref();
|
||||||
|
const page = ref(1);
|
||||||
|
const searchForm = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
poCode: undefined,
|
||||||
|
vendorName: undefined,
|
||||||
|
attr1: 'YL',
|
||||||
|
status: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const editData = ref<wms.recptRawType.columns>({
|
||||||
|
recptId: null,
|
||||||
|
recptCode: null,
|
||||||
|
recptName: null,
|
||||||
|
iqcId: null,
|
||||||
|
iqcCode: null,
|
||||||
|
poCode: null,
|
||||||
|
vendorId: null,
|
||||||
|
vendorCode: null,
|
||||||
|
vendorName: null,
|
||||||
|
vendorNick: null,
|
||||||
|
warehouseId: null,
|
||||||
|
warehouseCode: null,
|
||||||
|
warehouseName: null,
|
||||||
|
locationId: null,
|
||||||
|
locationCode: null,
|
||||||
|
locationName: null,
|
||||||
|
areaId: null,
|
||||||
|
areaCode: null,
|
||||||
|
areaName: null,
|
||||||
|
recptDate: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
type: null,
|
||||||
|
fromBillId: null,
|
||||||
|
fromBillCode: null,
|
||||||
|
fromBillName: null,
|
||||||
|
snidCode: null,
|
||||||
|
createByNick: null,
|
||||||
|
manageBy: null,
|
||||||
|
manageByNick: null,
|
||||||
|
headBy: null,
|
||||||
|
headByNick: null,
|
||||||
|
salseDeptId: null,
|
||||||
|
salseDeptName: null,
|
||||||
|
salseBy: null,
|
||||||
|
salseByNick: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const selectKeys = ref<DataTableRowKey[]>([]);
|
||||||
|
function handleSelect(keys: DataTableRowKey[]) {
|
||||||
|
selectKeys.value = keys;
|
||||||
|
}
|
||||||
|
const data = ref<wms.recptRawType.columns[]>([]);
|
||||||
|
const columns: Ref<DataTableColumns<wms.recptRawType.columns>> = ref([
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '入库单编号',
|
||||||
|
key: 'recptCode',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '入库单名称',
|
||||||
|
key: 'recptName',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '采购订单编号',
|
||||||
|
key: 'poCode',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '供应商名称',
|
||||||
|
key: 'vendorName',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '仓库名称',
|
||||||
|
key: 'warehouseName',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '库区名称',
|
||||||
|
// key: 'locationName',
|
||||||
|
// align: 'center',
|
||||||
|
// width: 110
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '库位名称',
|
||||||
|
// key: 'areaName',
|
||||||
|
// align: 'center',
|
||||||
|
// width: 110
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '入库日期',
|
||||||
|
key: 'recptDate',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '单据状态',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
render: row => {
|
||||||
|
return <dict-tag options={wms_item_recpt_status.value} value={row.status}></dict-tag>;
|
||||||
|
},
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '来源单据编码',
|
||||||
|
key: 'fromBillCode',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '负责人简称',
|
||||||
|
key: 'headByNick',
|
||||||
|
align: 'center',
|
||||||
|
width: 110,
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 220,
|
||||||
|
align: 'center',
|
||||||
|
render: row => {
|
||||||
|
console.log(wms_item_recpt_status.value, row.status, '----');
|
||||||
|
const Btn: JSX.Element[] = [];
|
||||||
|
if (row.status !== 'FINISHED') {
|
||||||
|
Btn.push(
|
||||||
|
useEditBtn(
|
||||||
|
() => {
|
||||||
|
router.push({
|
||||||
|
name: 'storage_auxiliaryProduceinfo',
|
||||||
|
query: { id: row.recptId, warehouseId: row.warehouseId }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'tiny',
|
||||||
|
'执行入库'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Btn.push(
|
||||||
|
// useInfoBtn(
|
||||||
|
// () => {
|
||||||
|
// router.push({
|
||||||
|
// name: 'storage_auxiliaryProduceinfo',
|
||||||
|
// query: { id: row.recptId, warehouseId: row.warehouseId, info: 'true' }
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// 'tiny',
|
||||||
|
// '查看详情'
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
|
// Btn.push(
|
||||||
|
// useDelBtn(() => {
|
||||||
|
// delWmsItemRecpt(row.recptId as number).then(res => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// window.$message?.success('删除成功');
|
||||||
|
// init();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }, 'tiny')
|
||||||
|
// );
|
||||||
|
return Btn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]) as Ref<DataTableColumns<any>>;
|
||||||
|
|
||||||
|
const { loading, startLoading, endLoading } = useLoading(false);
|
||||||
|
// const { setTrue: openModal } = useBoolean();
|
||||||
|
|
||||||
|
// function setModalType(type: ModalType) {
|
||||||
|
// modalType.value = type;
|
||||||
|
// }
|
||||||
|
// 重置
|
||||||
|
function reset() {
|
||||||
|
searchForm.value.pageNum = 1;
|
||||||
|
page.value = 1;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const { pageNum, pageSize, ...rest } = searchForm.value;
|
||||||
|
for (const key in rest) {
|
||||||
|
if (searchForm.value[key] !== '' && searchForm.value[key] !== 'YL') {
|
||||||
|
searchForm.value[key] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getWmsItemRecptData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEditTable(issueId: number) {
|
||||||
|
console.log("执行部入库操作", issueId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function search() {
|
||||||
|
searchForm.value.pageNum = 1;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
// function handleAddTable() {
|
||||||
|
// setModalType('add');
|
||||||
|
|
||||||
|
// openModal();
|
||||||
|
// }
|
||||||
|
// 编辑
|
||||||
|
// async function handleEditTable(recptId: number) {
|
||||||
|
// getWmsItemRecpt(recptId).then(res => {
|
||||||
|
// for (const key in res.data) {
|
||||||
|
// if ((key.includes('Date') || key.includes('Time')) && key !== 'createTime' && key !== 'updateTime') {
|
||||||
|
// res.data[key] = new Date(res.data[key] as unknown as string).getTime();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// editData.value = deepClone(res.data);
|
||||||
|
// editData.value.recptDate = new Date(editData.value.recptDate as unknown as string).getTime();
|
||||||
|
// setModalType('edit');
|
||||||
|
// openModal();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 获取信息
|
||||||
|
function getWmsItemRecptData() {
|
||||||
|
startLoading();
|
||||||
|
selectWmsItemRecptList({ params: searchForm.value }).then(res => {
|
||||||
|
data.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
searchForm.value.total = res.total;
|
||||||
|
if (data.value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
endLoading();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
function delSelect() {
|
||||||
|
delWmsItemRecpt(selectKeys.value.join(',') as string).then(() => {
|
||||||
|
getWmsItemRecptData();
|
||||||
|
message.success('删除成功');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// function handleExport() {
|
||||||
|
// show.value = true;
|
||||||
|
// }
|
||||||
|
function init() {
|
||||||
|
getWmsItemRecptData();
|
||||||
|
// 获取供应商列表
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue