Compare commits

..

2 Commits

Author SHA1 Message Date
ljh 7a1de2d58a 修改发货通知单页面 2024-07-09 01:45:18 +09:00
ljh 3976c54e34 完善单位物料功能 2024-07-09 01:33:59 +09:00
17 changed files with 1492 additions and 140 deletions

View File

@ -112,4 +112,10 @@ public class Invoice : EntityTenant
[SugarColumn(ColumnName = "State", ColumnDescription = "状态")]
public int? State { get; set; }
/// <summary>
/// 审核状态
/// </summary>
[SugarColumn(ColumnName = "AuditState", ColumnDescription = "状态")]
public int? AuditState { get; set; }
}

View File

@ -36,5 +36,36 @@ public class MaterialList : EntityBaseId
/// </summary>
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
public string? Remarks { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnName = "CodeNum", ColumnDescription = "编码", Length = 32)]
public string? CodeNum { get; set; }
/// <summary>
/// 规格型号
/// </summary>
[SugarColumn(ColumnName = "Specifications", ColumnDescription = "规格型号", Length = 32)]
public string? Specifications { get; set; }
/// <summary>
/// 计划数量
/// </summary>
[SugarColumn(ColumnName = "PlanQty", ColumnDescription = "计划数量")]
public int? PlanQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[SugarColumn(ColumnName = "ShipmentQty", ColumnDescription = "发货数量")]
public int? ShipmentQty { get; set; }
/// <summary>
/// 行扫描率
/// </summary>
[SugarColumn(ColumnName = "ScanRate", ColumnDescription = "行扫描率", Length = 32)]
public string? ScanRate { get; set; }
}

View File

@ -276,3 +276,20 @@ public class QueryByIdInvoiceInput : DeleteInvoiceInput
{
}
/// <summary>
/// 更新发货单审核状态
/// </summary>
public class UpdateInvoiceAuditStateInput
{
/// <summary>
/// 主键
/// </summary>
public virtual string[] Ids { get; set; }
/// <summary>
///
/// </summary>
public virtual int? AuditStatus { get; set; }
}

View File

@ -129,6 +129,11 @@ public class InvoiceOutput
/// 软删除
/// </summary>
public bool IsDelete { get; set; }
/// <summary>
/// 审核状态
/// </summary>
public int? AuditState { get; set; }
}

View File

@ -4,6 +4,7 @@ using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http;
using NewLife.Reflection;
using Nest;
using AngleSharp.Dom;
namespace Admin.NET.Application;
/// <summary>
@ -362,5 +363,26 @@ public class InvoiceService : IDynamicApiController, ITransient
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 更新发货单审核状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateAuditState")]
public async Task UpdateAuditState(UpdateInvoiceAuditStateInput input)
{
var list = await _rep.AsQueryable()
.Where(a => !a.IsDelete)
.Where(t => input.Ids.Contains(t.Id.ToString()))
.ToListAsync();
foreach (var item in list)
{
item.AuditState = input.AuditStatus;
await _rep.AsUpdateable(item).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}
}

View File

@ -3,106 +3,135 @@ using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application;
/// <summary>
/// 物料列表基础输入参数
/// </summary>
public class MaterialListBaseInput
{
/// <summary>
/// 物料列表基础输入参数
/// 物料ID
/// </summary>
public class MaterialListBaseInput
{
/// <summary>
/// 物料ID
/// </summary>
public virtual long? MaterialsId { get; set; }
/// <summary>
/// 单位
/// </summary>
public virtual string? Unit { get; set; }
/// <summary>
/// 数量
/// </summary>
public virtual int? Count { get; set; }
/// <summary>
/// 来源ID
/// </summary>
public virtual long? SourceId { get; set; }
/// <summary>
/// 备注
/// </summary>
public virtual string? Remarks { get; set; }
}
public virtual long? MaterialsId { get; set; }
/// <summary>
/// 物料列表分页查询输入参数
/// 单位
/// </summary>
public class MaterialListInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 来源ID
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
public virtual string? Unit { get; set; }
/// <summary>
/// 物料列表增加输入参
/// 数量
/// </summary>
public class AddMaterialListInput : MaterialListBaseInput
{
}
public virtual int? Count { get; set; }
/// <summary>
/// 物料列表删除输入参数
/// 来源ID
/// </summary>
public class DeleteMaterialListInput : BaseIdInput
{
}
public virtual long? SourceId { get; set; }
/// <summary>
/// 物料列表更新输入参数
/// 编码
/// </summary>
public class UpdateMaterialListInput : MaterialListBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
public string? CodeNum { get; set; }
/// <summary>
/// 物料列表主键查询输入参数
/// 备注
/// </summary>
public class QueryByIdMaterialListInput : DeleteMaterialListInput
{
public virtual string? Remarks { get; set; }
}
/// <summary>
/// 规格型号
/// </summary>
public virtual string? Specifications { get; set; }
/// <summary>
/// 计划数量
/// </summary>
public virtual int? PlanQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
public virtual int? ShipmentQty { get; set; }
/// <summary>
/// 行扫描率
/// </summary>
public virtual string? ScanRate { get; set; }
}
/// <summary>
/// 物料列表分页查询输入参数
/// </summary>
public class MaterialListInput : BasePageInput
{
/// <summary>
/// 关键字查询
/// </summary>
public string? SearchKey { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public long? MaterialsId { get; set; }
/// <summary>
/// 单位
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// 数量
/// </summary>
public int? Count { get; set; }
/// <summary>
/// 来源ID
/// </summary>
public long? SourceId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 物料列表增加输入参数
/// </summary>
public class AddMaterialListInput : MaterialListBaseInput
{
}
/// <summary>
/// 物料列表删除输入参数
/// </summary>
public class DeleteMaterialListInput : BaseIdInput
{
}
/// <summary>
/// 物料列表更新输入参数
/// </summary>
public class UpdateMaterialListInput : MaterialListBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
/// 物料列表主键查询输入参数
/// </summary>
public class QueryByIdMaterialListInput : DeleteMaterialListInput
{
}

View File

@ -34,7 +34,32 @@ public class MaterialListOutput
/// 备注
/// </summary>
public string? Remarks { get; set; }
}
/// <summary>
/// 编码
/// </summary>
public string? CodeNum { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? Specifications { get; set; }
/// <summary>
/// 计划数量
/// </summary>
public int? PlanQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
public int? ShipmentQty { get; set; }
/// <summary>
/// 行扫描率
/// </summary>
public string? ScanRate { get; set; }
}

View File

@ -303,3 +303,16 @@ public class QueryByIdProductRetrospectInput : DeleteProductRetrospectInput
{
}
/// <summary>
///
/// </summary>
public class CheckCodeStatusOutInput
{
/// <summary>
/// 状态
/// </summary>
public long State { get; set; }
}

View File

@ -172,32 +172,33 @@ public class ProductRetrospectService : IDynamicApiController, ITransient
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "CheckCodeStatus")]
public async Task<int> CheckCodeStatus(string? productCode)
public async Task<CheckCodeStatusOutInput> CheckCodeStatus(string? productCode)
{
int state = 0;
var codeEnt = await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select<ProductRetrospectOutput>().ToListAsync();
if (codeEnt == null || codeEnt.Count<1)
{
return 0;
state = 0;
}
var last = codeEnt.OrderBy(a => a.WarehousingDate).FirstOrDefault();
var receipt = last.Receipt == null ? "" : last.Receipt;
if (receipt.Contains("汇报单"))
{
return 1;
state = 1;
}
else if (receipt.Contains("仓库"))
{
return 2;
state = 2;
}
else if (receipt.Contains("发货"))
{
return 3;
state = 3;
}
else if (receipt.Contains("分销"))
{
return 3;
state = 3;
}
return 3;
return new CheckCodeStatusOutInput { State = state };
}
public async Task AddRetrospect(PrintCodeDetail item ,ReportTable report,string receipt, string location ,long? sourceId,long? warehousingId)
{

View File

@ -261,7 +261,7 @@ public class ReportTableService : IDynamicApiController, ITransient
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 };
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate);
@ -436,5 +436,38 @@ public class ReportTableService : IDynamicApiController, ITransient
}
return result;
}
/// <summary>
/// 更新状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
[ApiDescriptionSettings(Name = "UpdateState")]
public async Task UpdateState(AddReportContext input)
{
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
if (unitGroup == null)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var units = await _repUnit.ListByGroupId(unitGroup.Id);
if (units == null || units.Count < 1)
{
throw new ArgumentNullException(nameof(unitGroup));
}
var unit = units.Find(a => a.Name == input.Name);
if (unit == null)
throw new ArgumentNullException(nameof(unitGroup));
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0 };
var addReport = await Add(newReport);
var others = units.FindAll(a => a.Rate < unit.Rate);
var entity = input.Adapt<ReportTable>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}

View File

@ -5,6 +5,7 @@ enum Api {
UpdateInvoice = '/api/invoice/update',
PageInvoice = '/api/invoice/page',
DetailInvoice = '/api/invoice/detail',
UpdateAuditStateInvoice = '/api/invoice/UpdateAuditState',
}
// 增加发货通知单
@ -47,4 +48,13 @@ export const detailInvoice = (id: any) =>
data: { id },
});
// 审核汇报单
export const updateAuditStateInvoice = (params?: any) =>
request({
url: Api.UpdateAuditStateInvoice,
method: 'post',
data: params,
});

View File

@ -1,6 +1,6 @@
<template>
<div class="invoice-container" style="height: 100vh">
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" >
<div class="invoice-container" >
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" >
<el-card class="box-card">
<el-row :gutter="35">
<el-form-item v-show="false">
@ -114,8 +114,9 @@
<el-card class="box-card" >
<template #header>
<div class="card-header">
<span>明细信息</span>
<el-button type="primary" icon="ele-Plus" @click="addColumn"></el-button>
</div>
</template>
<el-table
:data="ruleForm.tableData"
@ -125,30 +126,45 @@
row-key="id"
border=""
>
<el-table-column prop="materialsId" label="物料" width="180" align="center">
<template #default="scope">
<el-select v-model="scope.row.materialsId" placeholder="请选择" autocomplete="off" controls-position="right" clearable @change="materialsChange">
<el-table-column prop="materialsId" label="商品名称" width="180" align="center">
<template #default="scope">
<el-select v-model="scope.row.materialsId" placeholder="请选择" autocomplete="off" controls-position="right" clearable @change="materialsChange(scope.row)">
<el-option :label="item.name" :value="item.id" v-for="item, index in materials" :key="index" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-select v-model="scope.row.unit" placeholder="请选择" clearable autocomplete="off" >
<el-option :label="item.name" :value="item.name" v-for="item, index in units" :key="index" />
</el-select>
</template>
</template>
</el-table-column>
<el-table-column prop="count" label="数量" width="100" show-overflow-tooltip="" >
<el-table-column prop="codeNum" label="商品编码" width="100" show-overflow-tooltip="" >
<template #default="scope">
<el-input-number v-model="scope.row.count" autocomplete="off" controls-position="right"/>
</template>
<el-input v-model="scope.row.codeNum" autocomplete="off" controls-position="right"/>
</template>
</el-table-column>
<el-table-column prop="specifications" label="规格型号" width="100" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.specifications" autocomplete="off" controls-position="right"/>
</template>
</el-table-column>
<el-table-column prop="planQty" label="计划数量" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-input-number v-model="scope.row.planQty" autocomplete="off" controls-position="right" @change="qtyChange(scope.row)"/>
</template>
</el-table-column>
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.remarks" autocomplete="off" />
</template>
</el-table-column>
<el-table-column prop="shipmentQty" label="发货数量" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-input-number v-model="scope.row.shipmentQty" autocomplete="off" controls-position="right" @change="qtyChange(scope.row)"/>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-select v-model="scope.row.unit" placeholder="请选择" autocomplete="off" controls-position="right" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in units" :key="index" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="scanRate" label="行扫描率" width="120" show-overflow-tooltip="" >
<template #default="scope">
<el-input v-model="scope.row.scanRate" autocomplete="off" controls-position="right" :formatter="formatScanRate"/>
</template>
</el-table-column>
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" >
<template #default="scope">
<el-button link type="primary" icon="el-icon-delete" @click.prevent="handleColDelete(scope.$index)">删除</el-button>
@ -156,7 +172,7 @@
</el-table-column>
</el-table>
</el-card>
<el-button icon="ele-Plus" @click="addColumn"></el-button>
<div class="footer" align="right" >
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit" :disabled="props.disabled"> </el-button>
@ -174,19 +190,18 @@
}
</style>
<script lang="ts" setup>
import { ref, onMounted, reactive } from 'vue';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { addInvoice, updateInvoice, detailInvoice } from "/@/api/main/invoice";
import { listWarehouse } from '/@/api/main/warehouse';
import { listSupplier } from '/@/api/main/supplier';
import { listCustom } from '/@/api/main/custom';
import { listMaterials, detailMaterials, materialListBySourceId } from '/@/api/main/materials';
import { listUnitGroup } from '/@/api/main/unit';
import { getCurrentDate } from '/@/utils/formatTime';
import {onMounted, ref} from 'vue';
import type {FormRules} from "element-plus";
import {ElMessage} from "element-plus";
import {addInvoice, detailInvoice, updateInvoice} from "/@/api/main/invoice";
import {listWarehouse} from '/@/api/main/warehouse';
import {listSupplier} from '/@/api/main/supplier';
import {listCustom} from '/@/api/main/custom';
import {detailMaterials, listMaterials, materialListBySourceId} from '/@/api/main/materials';
import {listUnitGroup} from '/@/api/main/unit';
import {getCurrentDate} from '/@/utils/formatTime';
//
//
var props = defineProps({
title: {
type: String,
@ -209,6 +224,13 @@
const units = ref<any>([]);
const tableData = ref<any>([]);
const formatScanRate = (value) => {
if (value) {
return `${value}%`;
}
return value;
}
//
const rules = ref<FormRules>({
// businessType: [{required: true, message: '', trigger: 'blur',},],
@ -255,10 +277,13 @@
* 物料值变更
* @param clearBindUserId 是否清空
*/
const materialsChange = async (value : any) => {
const materialsChange = async (row : any) => {
//ruleForm.value.materialsId=value.id;
let material = (await detailMaterials(value)).data.result;
let material = (await detailMaterials(row.materialsId)).data.result;
//console.log(material);
row.specifications = material.specifications;
row.codeNum = material.codeNum;
row.unit = material.unit;
if(material.id){
var res = await listUnitGroup(material.unitGroupId ?? 0);
units.value = res.data.result ?? [];
@ -266,9 +291,21 @@
};
/**
* 数量change事件
* @param row
*/
const qtyChange = async (row : any) => {
if(row.shipmentQty && row.shipmentQty) {
row.scanRate=Math.round((row.shipmentQty / row.planQty) * 100);
}
};
//
function addColumn() {
if(!ruleForm.value.tableData){
ruleForm.value.tableData=[];
}
ruleForm.value.tableData.push({
materialsId: null,
unit: '箱',

View File

@ -107,6 +107,8 @@
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddInvoice" v-auth="'invoice:add'"> </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-Check" @click="handleAuditStateChange('1')" > 审核 </el-button>
<el-button type="primary" style="margin-left:5px;" icon="ele-CloseBold" @click="handleAuditStateChange('0')" > 反审核 </el-button>
</el-button-group>
</el-form-item>
@ -122,8 +124,10 @@
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
@sort-change="sortChange"
@selection-change="handleSelectionChange"
border="">
<el-table-column type="selection" width="60"/>
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="codeNum" label="单号" width="140" show-overflow-tooltip="" />
<el-table-column prop="startDate" label="业务日期" width="140" show-overflow-tooltip="" />
@ -140,12 +144,19 @@
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column prop="customExpand" label="方案客户拓展" width="90" show-overflow-tooltip="" />
<el-table-column prop="sendOutExpand" label="发货拓展" width="140" show-overflow-tooltip="" />
<el-table-column prop="state" label="发货状态" width="140" show-overflow-tooltip :formatter="formatState">
</el-table-column>
<el-table-column prop="state" label="发货状态" width="140" show-overflow-tooltip :formatter="formatState"/>
<el-table-column prop="auditState" label="审核状态" width="140" show-overflow-tooltip="" :formatter="formatAuditState"/>
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('invoice:update') || auth('invoice:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditInvoice(scope.row)" v-auth="'invoice:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delInvoice(scope.row)" v-auth="'invoice:delete'"> </el-button>
<div v-if="scope.row.auditState===1">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openBrowseInvoice(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
</div>
<div v-else>
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditInvoice(scope.row)" v-auth="'invoice:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delInvoice(scope.row)" v-auth="'invoice:delete'"> </el-button>
</div>
</template>
</el-table-column>
</el-table>
@ -167,7 +178,7 @@
</el-card>
</div>
<div v-else class="reportDetailTable-container">
<el-card >
<el-card style="height: 100vh;overflow-y:scroll">
<editDialog
ref="editDialogRef"
:row = "state.editRow"
@ -188,7 +199,8 @@ import {reactive, ref} from "vue";
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
import editDialog from '/@/views/inventoryManagement/invoice/component/editDialog.vue'
import { pageInvoice, deleteInvoice } from '/@/api/main/invoice';
import {pageInvoice, deleteInvoice, updateAuditStateInvoice} from '/@/api/main/invoice';
import {updateStateReportDetailTable} from "/@/api/main/reportDetailTable";
const showAdvanceQueryUI = ref(false);
@ -210,6 +222,20 @@ import {reactive, ref} from "vue";
const printInvoiceTitle = ref("");
const editInvoiceTitle = ref("");
const multipleSelection = ref([])
const handleSelectionChange = (val: []) => {
multipleSelection.value = val
}
//
const handleAuditStateChange = async (val: any) => {
if(multipleSelection.value.length === 0){ return ElMessage.error("至少选择一条数据")}
let ids = [] as any;
multipleSelection.value.forEach(item => {
ids.push(item.id);
})
await updateAuditStateInvoice({ids,auditStatus:val});
await handleQuery();
};
//
const changeAdvanceQueryUI = () => {
@ -220,6 +246,10 @@ import {reactive, ref} from "vue";
return cellValue === 1 ? '装货中' : '未装货';
}
const formatAuditState = (row, column, cellValue) => {
return cellValue === 1 ? '已审核' : '未审核';
}
//
const close = () => {
state.editShow = false;
@ -261,6 +291,13 @@ import {reactive, ref} from "vue";
state.editDisabled = false;
};
//
const openBrowseInvoice = (row: any) => {
state.editRow = row;
state.editShow = true;
state.editDisabled = true;
};
//
const delInvoice = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {

View File

@ -0,0 +1,252 @@
<template>
<div class="warehouseDetails-container">
<el-dialog v-model="isShowDialog" :width="800" draggable="">
<template #header>
<div style="color: #fff">
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
<span>{{ props.title }}</span>
</div>
</template>
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35">
<el-form-item v-show="false">
<el-input v-model="ruleForm.id" />
</el-form-item>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="物料" :rules="[{ required: true, message: '物料不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.materialsId" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in materials"
:key="index" />
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="商品条码" prop="goodCode">
<el-input v-model="ruleForm.goodCode" placeholder="请输入商品条码" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="物料编码" prop="materialsNum">
<el-input v-model="ruleForm.materialsNum" placeholder="请输入物料编码" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="规格" prop="specifications">
<el-input v-model="ruleForm.specifications" placeholder="请输入规格" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="分类" prop="classify">
<el-input v-model="ruleForm.classify" placeholder="请输入分类" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="库存数量" prop="count">
<el-input-number v-model="ruleForm.count" placeholder="请输入库存数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="库存单位" prop="unit">
<el-input v-model="ruleForm.unit" placeholder="请输入库存单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本数量" prop="baseCount">
<el-input-number v-model="ruleForm.baseCount" placeholder="请输入基本数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本单位" prop="baseUnit">
<el-input v-model="ruleForm.baseUnit" placeholder="请输入基本单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="包装比例" prop="packageScale">
<el-input v-model="ruleForm.packageScale" placeholder="请输入包装比例" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="批次" prop="batch">
<el-input v-model="ruleForm.batch" placeholder="请输入批次" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="公司" prop="custom">
<el-input v-model="ruleForm.custom" placeholder="请输入公司" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="品牌" prop="brand">
<el-input v-model="ruleForm.brand" placeholder="请输入品牌" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="条码类型" prop="codeType">
<el-input v-model="ruleForm.codeType" placeholder="请输入条码类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="条码数量" prop="codeCount">
<el-input-number v-model="ruleForm.codeCount" placeholder="请输入条码数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="库位" prop="warehouseLocation">
<el-input v-model="ruleForm.warehouseLocation" placeholder="请输入库位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="生产日期" prop="productDate">
<el-date-picker v-model="ruleForm.productDate" type="date" placeholder="生产日期" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="失效日期" prop="loseDate">
<el-date-picker v-model="ruleForm.loseDate" type="date" placeholder="失效日期" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单重" prop="singleWeight">
<el-input v-model="ruleForm.singleWeight" placeholder="请输入单重" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="总重" prop="totalWeight">
<el-input v-model="ruleForm.totalWeight" placeholder="请输入总重" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="单价" prop="unitPrice">
<el-input v-model="ruleForm.unitPrice" placeholder="请输入单价" maxlength="10" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="总价" prop="totalPrice">
<el-input v-model="ruleForm.totalPrice" placeholder="请输入总价" maxlength="10" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="备注" prop="remarks">
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="源ID" prop="sourceId">
<el-input v-model="ruleForm.sourceId" placeholder="请输入源ID" maxlength="20" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="仓库ID" prop="warehouseId">
<el-input v-model="ruleForm.warehouseId" placeholder="请输入仓库ID" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="拓展字段" prop="expandField">
<el-input v-model="ruleForm.expandField" placeholder="请输入拓展字段" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped>
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>
<script lang="ts" setup>
import { ref,onMounted } from "vue";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { addWarehouseDetails, updateWarehouseDetails, detailWarehouseDetails } from "/@/api/main/warehouseDetails";
import { pageMaterials, deleteMaterials, listMaterials } from '/@/api/main/materials';
//
var props = defineProps({
title: {
type: String,
default: "",
},
});
//
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//
const rules = ref<FormRules>({
});
const materials = ref<any>([]);
//
const openDialog = async (row: any) => {
// ruleForm.value = JSON.parse(JSON.stringify(row));
// detail
let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id)
ruleForm.value = (await detailWarehouseDetails(rowData.id)).data.result;
else
ruleForm.value = rowData;
materials.value = (await listMaterials()).data.result;
isShowDialog.value = true;
//console.log(materials.value);
};
//
const closeDialog = () => {
emit("reloadTable");
isShowDialog.value = false;
};
//
const cancel = () => {
isShowDialog.value = false;
};
//
const submit = async () => {
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
if (isValid) {
let values = ruleForm.value;
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
await addWarehouseDetails(values);
} else {
await updateWarehouseDetails(values);
}
closeDialog();
} else {
ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
type: "error",
});
}
});
};
//
onMounted(async () => {
});
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,344 @@
<template>
<div class="warehouseDetails-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="关键字">
<el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="名称">
<el-input v-model="queryParams.name" clearable="" placeholder="请输入名称"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="商品条码">
<el-input v-model="queryParams.goodCode" clearable="" placeholder="请输入商品条码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="物料编码">
<el-input v-model="queryParams.materialsNum" clearable="" placeholder="请输入物料编码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="规格">
<el-input v-model="queryParams.specifications" clearable="" placeholder="请输入规格"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="分类">
<el-input v-model="queryParams.classify" clearable="" placeholder="请输入分类"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="库存数量">
<el-input-number v-model="queryParams.count" clearable="" placeholder="请输入库存数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="库存单位">
<el-input v-model="queryParams.unit" clearable="" placeholder="请输入库存单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本数量">
<el-input-number v-model="queryParams.baseCount" clearable="" placeholder="请输入基本数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本单位">
<el-input v-model="queryParams.baseUnit" clearable="" placeholder="请输入基本单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="包装比例">
<el-input v-model="queryParams.packageScale" clearable="" placeholder="请输入包装比例"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="批次">
<el-input v-model="queryParams.batch" clearable="" placeholder="请输入批次"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="公司">
<el-input v-model="queryParams.custom" clearable="" placeholder="请输入公司"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="品牌">
<el-input v-model="queryParams.brand" clearable="" placeholder="请输入品牌"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="条码类型">
<el-input v-model="queryParams.codeType" clearable="" placeholder="请输入条码类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="条码数量">
<el-input-number v-model="queryParams.codeCount" clearable="" placeholder="请输入条码数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="库位">
<el-input v-model="queryParams.warehouseLocation" clearable="" placeholder="请输入库位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产日期">
<el-date-picker placeholder="请选择生产日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.productDateRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="失效日期">
<el-date-picker placeholder="请选择失效日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.loseDateRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单重">
<el-input v-model="queryParams.singleWeight" clearable="" placeholder="请输入单重"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="总重">
<el-input v-model="queryParams.totalWeight" clearable="" placeholder="请输入总重"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单价">
<el-input v-model="queryParams.unitPrice" clearable="" placeholder="请输入单价"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="总价">
<el-input v-model="queryParams.totalPrice" clearable="" placeholder="请输入总价"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="源ID">
<el-input v-model="queryParams.sourceId" clearable="" placeholder="请输入源ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="仓库ID">
<el-input v-model="queryParams.warehouseId" clearable="" placeholder="请输入仓库ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="拓展字段">
<el-input v-model="queryParams.expandField" clearable="" placeholder="请输入拓展字段"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'warehouseDetails:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<!-- <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWarehouseDetails" v-auth="'warehouseDetails:add'"> </el-button> -->
</el-button-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="goodCode" label="商品条码" width="140" show-overflow-tooltip="" />
<el-table-column prop="materialsNum" label="物料编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="specifications" label="规格" width="140" show-overflow-tooltip="" />
<el-table-column prop="classify" label="分类" width="140" show-overflow-tooltip="" />
<el-table-column prop="count" label="库存数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="unit" label="库存单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseCount" label="基本数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="packageScale" label="包装比例" width="140" show-overflow-tooltip="" />
<el-table-column prop="batch" label="批次" width="140" show-overflow-tooltip="" />
<el-table-column prop="custom" label="公司" width="140" show-overflow-tooltip="" />
<el-table-column prop="brand" label="品牌" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeType" label="条码类型" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeCount" label="条码数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseLocation" label="库位" width="140" show-overflow-tooltip="" />
<el-table-column prop="productDate" label="生产日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="loseDate" label="失效日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="singleWeight" label="单重" width="140" show-overflow-tooltip="" />
<el-table-column prop="totalWeight" label="总重" width="140" show-overflow-tooltip="" />
<el-table-column prop="unitPrice" label="单价" width="140" show-overflow-tooltip="" />
<el-table-column prop="totalPrice" label="总价" width="140" show-overflow-tooltip="" />
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceId" label="源ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseId" label="仓库ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="expandField" label="拓展字段" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehouseDetails:update') || auth('warehouseDetails:delete')">
<template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehouseDetails(scope.row)" v-auth="'warehouseDetails:update'"> </el-button>
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehouseDetails(scope.row)" v-auth="'warehouseDetails:delete'"> </el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<editDialog
ref="editDialogRef"
:title="editWarehouseDetailsTitle"
@reloadTable="handleQuery"
/>
</el-card>
</div>
</template>
<script lang="ts" setup="" name="warehouseDetails">
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
import editDialog from '/@/views/warehouseManagement/warehouseDetails/component/editDialog.vue'
import { pageWarehouseDetails, deleteWarehouseDetails } from '/@/api/main/warehouseDetails';
const showAdvanceQueryUI = ref(false);
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
page: 1,
pageSize: 10,
total: 0,
});
const editWarehouseDetailsTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
//
const handleQuery = async () => {
loading.value = true;
var res = await pageWarehouseDetails(Object.assign(queryParams.value, tableParams.value));
tableData.value = res.data.result?.items ?? [];
tableParams.value.total = res.data.result?.total;
loading.value = false;
};
//
const sortChange = async (column: any) => {
queryParams.value.field = column.prop;
queryParams.value.order = column.order;
await handleQuery();
};
//
const openAddWarehouseDetails = () => {
editWarehouseDetailsTitle.value = '添加仓库统计';
editDialogRef.value.openDialog({});
};
//
const openEditWarehouseDetails = (row: any) => {
editWarehouseDetailsTitle.value = '编辑仓库统计';
editDialogRef.value.openDialog(row);
};
//
const delWarehouseDetails = (row: any) => {
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await deleteWarehouseDetails(row);
handleQuery();
ElMessage.success("删除成功");
})
.catch(() => {});
};
//
const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
tableParams.value.page = val;
handleQuery();
};
handleQuery();
</script>
<style scoped>
:deep(.el-ipnut),
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>

View File

@ -0,0 +1,203 @@
<template>
<div class="warehousingStatistics-container">
<el-dialog v-model="isShowDialog" :width="800" draggable="">
<template #header>
<div style="color: #fff">
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
<span>{{ props.title }}</span>
</div>
</template>
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35">
<el-form-item v-show="false">
<el-input v-model="ruleForm.id" />
</el-form-item>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="物料" :rules="[{ required: true, message: '物料不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.materialsId" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in materials"
:key="index" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="名称" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入名称" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col> -->
<!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="物料编码" prop="codeNum">
<el-input v-model="ruleForm.codeNum" placeholder="请输入物料编码" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col> -->
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="入库数量" prop="count">
<el-input-number v-model="ruleForm.count" placeholder="请输入入库数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="入库单位" prop="unit">
<el-input v-model="ruleForm.unit" placeholder="请输入入库单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本数量" prop="baseCount">
<el-input-number v-model="ruleForm.baseCount" placeholder="请输入基本数量" clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="基本单位" prop="baseUnit">
<el-input v-model="ruleForm.baseUnit" placeholder="请输入基本单位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="品牌" prop="brand">
<el-input v-model="ruleForm.brand" placeholder="请输入品牌" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="规格" prop="specifications">
<el-input v-model="ruleForm.specifications" placeholder="请输入规格" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="入库类型" prop="warehousingType">
<el-input v-model="ruleForm.warehousingType" placeholder="请输入入库类型" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="来源ID" prop="sourceId">
<el-input v-model="ruleForm.sourceId" placeholder="请输入来源ID" maxlength="20" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="入库日期" prop="warehousingDate">
<el-date-picker v-model="ruleForm.warehousingDate" type="date" placeholder="入库日期" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="入库仓库ID" prop="warehouseId">
<el-input v-model="ruleForm.warehouseId" placeholder="请输入入库仓库ID" maxlength="20" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="库位" prop="warehouseLocation">
<el-input v-model="ruleForm.warehouseLocation" placeholder="请输入库位" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="供应商" prop="supplier">
<el-input v-model="ruleForm.supplier" placeholder="请输入供应商" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="备注" prop="remarks">
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="32" show-word-limit clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped>
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>
<script lang="ts" setup>
import { ref,onMounted } from "vue";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { addWarehousingStatistics, updateWarehousingStatistics, detailWarehousingStatistics } from "/@/api/main/warehousingStatistics";
import { pageMaterials, deleteMaterials, listMaterials } from '/@/api/main/materials';
//
var props = defineProps({
title: {
type: String,
default: "",
},
});
//
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//
const rules = ref<FormRules>({
});
const materials = ref<any>([]);
//
const openDialog = async (row: any) => {
// ruleForm.value = JSON.parse(JSON.stringify(row));
// detail
let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id)
ruleForm.value = (await detailWarehousingStatistics(rowData.id)).data.result;
else
ruleForm.value = rowData;
materials.value = (await listMaterials()).data.result;
isShowDialog.value = true;
};
//
const closeDialog = () => {
emit("reloadTable");
isShowDialog.value = false;
};
//
const cancel = () => {
isShowDialog.value = false;
};
//
const submit = async () => {
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
if (isValid) {
let values = ruleForm.value;
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
await addWarehousingStatistics(values);
} else {
await updateWarehousingStatistics(values);
}
closeDialog();
} else {
ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
type: "error",
});
}
});
};
//
onMounted(async () => {
});
//
defineExpose({ openDialog });
</script>

View File

@ -0,0 +1,287 @@
<template>
<div class="warehousingStatistics-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="关键字">
<el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="名称">
<el-input v-model="queryParams.name" clearable="" placeholder="请输入名称"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="物料编码">
<el-input v-model="queryParams.codeNum" clearable="" placeholder="请输入物料编码"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库数量">
<el-input-number v-model="queryParams.count" clearable="" placeholder="请输入入库数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库单位">
<el-input v-model="queryParams.unit" clearable="" placeholder="请输入入库单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本数量">
<el-input-number v-model="queryParams.baseCount" clearable="" placeholder="请输入基本数量"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本单位">
<el-input v-model="queryParams.baseUnit" clearable="" placeholder="请输入基本单位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="品牌">
<el-input v-model="queryParams.brand" clearable="" placeholder="请输入品牌"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="规格">
<el-input v-model="queryParams.specifications" clearable="" placeholder="请输入规格"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库类型">
<el-input v-model="queryParams.warehousingType" clearable="" placeholder="请输入入库类型"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="物料ID">
<el-input v-model="queryParams.materialsId" clearable="" placeholder="请输入物料ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="来源ID">
<el-input v-model="queryParams.sourceId" clearable="" placeholder="请输入来源ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库日期">
<el-date-picker placeholder="请选择入库日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.warehousingDateRange" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库仓库ID">
<el-input v-model="queryParams.warehouseId" clearable="" placeholder="请输入入库仓库ID"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="库位">
<el-input v-model="queryParams.warehouseLocation" clearable="" placeholder="请输入库位"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="供应商">
<el-input v-model="queryParams.supplier" clearable="" placeholder="请输入供应商"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'warehousingStatistics:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> </el-button>
<!-- <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWarehousingStatistics" v-auth="'warehousingStatistics:add'"> </el-button> -->
</el-button-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table
:data="tableData"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
@sort-change="sortChange"
border="">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />
<el-table-column prop="codeNum" label="物料编码" width="140" show-overflow-tooltip="" />
<el-table-column prop="count" label="入库数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="unit" label="入库单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseCount" label="基本数量" width="140" show-overflow-tooltip="" />
<el-table-column prop="baseUnit" label="基本单位" width="140" show-overflow-tooltip="" />
<el-table-column prop="brand" label="品牌" width="140" show-overflow-tooltip="" />
<el-table-column prop="specifications" label="规格" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehousingType" label="入库类型" width="140" show-overflow-tooltip="" />
<!-- <el-table-column prop="materialsId" label="物料ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="sourceId" label="来源ID" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseId" label="入库仓库ID" width="90" show-overflow-tooltip="" /> -->
<el-table-column prop="warehousingDate" label="入库日期" width="140" show-overflow-tooltip="" />
<el-table-column prop="warehouseLocation" label="库位" width="140" show-overflow-tooltip="" />
<el-table-column prop="supplier" label="供应商" width="140" show-overflow-tooltip="" />
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
<el-table-column label="操作" width="120" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('warehousingStatistics:update') || auth('warehousingStatistics:delete')">
<template #default="scope">
<!-- <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:update'"> </el-button> -->
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> </el-button>
<!-- <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWarehousingStatistics(scope.row)" v-auth="'warehousingStatistics:delete'"> </el-button> -->
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
<printDetailDialog
ref="printDetailDialogRef"
:title="printDetailTableTitle"
/>
<editDialog
ref="editDialogRef"
:title="editWarehousingStatisticsTitle"
@reloadTable="handleQuery"
/>
</el-card>
</div>
</template>
<script lang="ts" setup="" name="warehousingStatistics">
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
import printDetailDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
import editDialog from '/@/views/warehouseManagement/warehousingStatistics/component/editDialog.vue'
import { pageWarehousingStatistics, deleteWarehousingStatistics } from '/@/api/main/warehousingStatistics';
const showAdvanceQueryUI = ref(false);
const printDetailDialogRef = ref();
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
page: 1,
pageSize: 10,
total: 0,
});
const editWarehousingStatisticsTitle = ref("");
const printDetailTableTitle = ref("");
//
const changeAdvanceQueryUI = () => {
showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
//
const handleQuery = async () => {
loading.value = true;
var res = await pageWarehousingStatistics(Object.assign(queryParams.value, tableParams.value));
tableData.value = res.data.result?.items ?? [];
tableParams.value.total = res.data.result?.total;
loading.value = false;
};
//
const sortChange = async (column: any) => {
queryParams.value.field = column.prop;
queryParams.value.order = column.order;
await handleQuery();
};
// //
// const openAddWarehousingStatistics = () => {
// editWarehousingStatisticsTitle.value = '';
// editDialogRef.value.openDialog({});
// };
// //
// const openEditWarehousingStatistics = (row: any) => {
// editWarehousingStatisticsTitle.value = '';
// editDialogRef.value.openDialog(row);
// };
//
const readReportDetailTable = (row: any) => {
printDetailTableTitle.value = '条码详情';
//console.log(row);
printDetailDialogRef.value.openDialog(row.id);
};
//
// const delWarehousingStatistics = (row: any) => {
// ElMessageBox.confirm(`?`, "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(async () => {
// await deleteWarehousingStatistics(row);
// handleQuery();
// ElMessage.success("");
// })
// .catch(() => {});
// };
//
const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
tableParams.value.page = val;
handleQuery();
};
handleQuery();
</script>
<style scoped>
:deep(.el-ipnut),
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
</style>