|
|
<template>
|
|
|
<div class="p-2">
|
|
|
<el-card shadow="never">
|
|
|
<el-form label-width="120px" label-position="right" :inline="true" :model="queryForm" class="demo-form-inline">
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
<el-select v-model="queryForm.warehouseId" placeholder="请选择所属仓库">
|
|
|
<el-option
|
|
|
v-for="item in baseStoreList"
|
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="出库单号" prop="outstockCode">
|
|
|
<el-input v-model="queryForm.outstockCode" placeholder="请输入出库单号" clearable/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
|
|
|
<el-card style="margin-top: 8px" shadow="never">
|
|
|
<template #header>
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="Plus" @click="parentTableAdd">新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">修改
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">删除
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
<!-- <el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>-->
|
|
|
<!-- </el-col>-->
|
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
|
|
|
@queryTable="getParentTable"></right-toolbar>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
<el-table v-loading="parentTableLoad" :data="parentTableData" style="width: 100%" highlight-current-row
|
|
|
@current-change="parentTableCellClick"
|
|
|
@selection-change="selectionChange" ref="parentTableRef">
|
|
|
<el-table-column type="selection" width="55"/>
|
|
|
<el-table-column label="仓库" align="center" prop="warehouseName"/>
|
|
|
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
|
|
|
<el-table-column label="出库类型" align="center" prop="outstockType">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="wms_out_type" :value="scope.row.outstockType"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="物料大类" align="center" prop="materialCategoryId">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="material_mategories" :value="scope.row.materialCategoryId"/>
|
|
|
</template>
|
|
|
</el-table-column>-->
|
|
|
<!-- <el-table-column label="工单类型" align="center" prop="orderType">-->
|
|
|
<!-- <template #default="scope">-->
|
|
|
<!-- <dict-tag :options="wms_instock_type" :value="scope.row.orderType"/>-->
|
|
|
<!-- </template>-->
|
|
|
<!-- </el-table-column>-->
|
|
|
<el-table-column label="订单编号" align="center" prop="orderNo"/>
|
|
|
<el-table-column label="审核人" align="center" prop="auditBy"/>
|
|
|
<el-table-column label="审核时间" align="center" prop="auditTime" width="180">
|
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="审核状态" align="center" prop="auditStatus">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="approve_status" :value="scope.row.auditStatus"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="审核意见" align="center" prop="auditComments"/>
|
|
|
<el-table-column label="客户" align="center" prop="customerId">
|
|
|
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="入库方式" align="center" prop="inMethod">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="wms_allocate_way" :value="scope.row.inMethod"/>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
<el-table-column label="操作" fixed="right" width="260">
|
|
|
<template #default="scope">
|
|
|
<!-- <el-button size="small" @click.stop="viewDetails(scope.row)">-->
|
|
|
<!-- 查看-->
|
|
|
<!-- </el-button>-->
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="warning"
|
|
|
v-if="scope.row.needApprove && (scope.row.auditStatus === null || scope.row.auditStatus === undefined || scope.row.auditStatus === '')"
|
|
|
@click.stop="openApprove(scope.row)"
|
|
|
>审批</el-button>
|
|
|
<el-button size="small" @click.stop="parentTableUpdate(scope.row)">
|
|
|
修改
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="danger"
|
|
|
@click.stop="parentTableDelete(scope.row)"
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<pagination v-show="parentTableTotal > 0" :total="parentTableTotal" v-model:page="queryForm.pageNum"
|
|
|
v-model:limit="queryForm.pageSize" @pagination="getParentTable"/>
|
|
|
</el-card>
|
|
|
|
|
|
<el-card style="margin-top: 8px" shadow="never">
|
|
|
<el-table :data="childrenTableData" style="width: 100%" v-loading="childrenTableLoad">
|
|
|
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
|
|
|
<!-- <el-table-column label="出库单 主键" align="center" prop="outstockId" v-if="columns[2].visible"/> -->
|
|
|
<el-table-column label="物料" align="center" prop="materialCode"/>
|
|
|
<el-table-column label="计划数量" align="center" prop="outstockQty"/>
|
|
|
<el-table-column label="实出数量" align="center" prop="outSum"/>
|
|
|
<!-- <el-table-column label="物料大类" align="center" prop="materialCategoryName">-->
|
|
|
<!-- </el-table-column>-->
|
|
|
<el-table-column label="是否高价值" align="center" prop="isHighValue">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" fixed="right" width="200">
|
|
|
<template #default="scope">
|
|
|
<!-- <el-button size="small" @click="childrenTableUpdate( scope.row)">
|
|
|
打印
|
|
|
</el-button> -->
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="danger"
|
|
|
@click="childrenTableUDelete(scope.row)"
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
|
<!-- <el-tooltip content="打印" placement="top">
|
|
|
<el-button type="primary" @click="handlePrint(scope.row)">打印</el-button>
|
|
|
</el-tooltip> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-card>
|
|
|
|
|
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
|
|
<el-card shadow="never">
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView" ref="dialogFormRef">
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
<el-select v-model="dialogForm.warehouseId" placeholder="请选择所属仓库">
|
|
|
<el-option
|
|
|
v-for="item in baseStoreList"
|
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="出库类型" prop="outstockType">
|
|
|
<el-select v-model="dialogForm.outstockType" placeholder="请选择出库类型">
|
|
|
<el-option
|
|
|
v-for="dict in wms_out_type"
|
|
|
:key="dict.value"
|
|
|
:label="dict.label"
|
|
|
:value="dict.value"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="物料大类" prop="materialCategoryId">-->
|
|
|
<!-- <el-select v-model="dialogForm.materialCategoryId" placeholder="请选择物料大类" @change="setMaterialList">-->
|
|
|
<!-- <el-option v-for="item in mategoryOptions"-->
|
|
|
<!-- :key="item.materialCategoryId"-->
|
|
|
<!-- :label="item.materialCategoryName"-->
|
|
|
<!-- :value="item.materialCategoryId"-->
|
|
|
<!-- />-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<!-- <el-form-item label="工单类型" prop="orderType">-->
|
|
|
<!-- <el-select v-model="dialogForm.orderType" placeholder="请选择工单类型">-->
|
|
|
<!-- <el-option-->
|
|
|
<!-- v-for="dict in wms_instock_type"-->
|
|
|
<!-- :key="dict.value"-->
|
|
|
<!-- :label="dict.label"-->
|
|
|
<!-- :value="dict.value"-->
|
|
|
<!-- ></el-option>-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<!-- <el-form-item label="审核人" prop="auditBy">-->
|
|
|
<!-- <el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">-->
|
|
|
<!-- <el-option-->
|
|
|
<!-- v-for="item in userList"-->
|
|
|
<!-- :key="item.userId"-->
|
|
|
<!-- :label="item.userName"-->
|
|
|
<!-- :value="item.userName"-->
|
|
|
<!-- />-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<el-form-item label="销售客户" prop="customerId" v-if =" dialogForm.outstockType === '1' ">
|
|
|
<el-select v-model="dialogForm.customerId" placeholder="请选择客户">
|
|
|
<el-option
|
|
|
v-for="item in baseCustomerList"
|
|
|
:key="item.customerId"
|
|
|
:label="item.customerName"
|
|
|
:value="item.customerId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
<el-card style="margin-top: 8px" shadow="never">
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell">新增</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table :data="dialogtable" style="width: 100%">
|
|
|
<!-- <el-table-column label="物料大类" prop="materialCategoryId">
|
|
|
<el-select v-model="dialogForm.materialCategoryId" placeholder="" :disabled="true">
|
|
|
<el-option v-for="item in mategoryOptions"
|
|
|
:key="item.materialCategoryId"
|
|
|
:label="item.materialCategoryName"
|
|
|
:value="item.materialCategoryId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-table-column>-->
|
|
|
|
|
|
|
|
|
<el-table-column label="物料编码" prop="materialCode">
|
|
|
<!-- <template #default="scope">
|
|
|
<el-select
|
|
|
v-model="scope.row.materialId"
|
|
|
placeholder="选择物料"
|
|
|
style="width: 240px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="i in materialList"
|
|
|
:label="i.materialCode+'('+i.materialName+')'"
|
|
|
:value="i.materialId"
|
|
|
:key="i.materialId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>-->
|
|
|
<template #default="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.materialCode"
|
|
|
placeholder="请点击检索物料"
|
|
|
@click="handleMaterialAdd('material', scope.$index)" >
|
|
|
<template #append>
|
|
|
<el-icon class="el-input__icon"><search/></el-icon>
|
|
|
</template>
|
|
|
</el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="物料名称" prop="materialName">
|
|
|
<template #default="scope">
|
|
|
<el-select
|
|
|
v-model="scope.row.materialName"
|
|
|
placeholder="选择物料"
|
|
|
style="width: 240px"
|
|
|
:disabled="true"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="i in materialList"
|
|
|
:label="i.materialName"
|
|
|
:value="i.materialName"
|
|
|
:key="i.materialId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="物料单位" prop="materialUnit">
|
|
|
<template #default="scope">
|
|
|
<el-select
|
|
|
v-model="scope.row.materialUnit"
|
|
|
placeholder="选择物料"
|
|
|
style="width: 240px"
|
|
|
:disabled="true"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="i in materialList"
|
|
|
:label="i.materialUnit"
|
|
|
:value="i.materialUnit"
|
|
|
:key="i.materialId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="物料规格" prop="materialSpe">
|
|
|
<template #default="scope">
|
|
|
<el-select
|
|
|
v-model="scope.row.materialSpe"
|
|
|
placeholder="选择物料"
|
|
|
style="width: 240px"
|
|
|
:disabled="true"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="i in materialList"
|
|
|
:label="i.materialSpec"
|
|
|
:value="i.materialSpec"
|
|
|
:key="i.materialId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="计划出库数量" prop="outstockQty">
|
|
|
<template #default="scope">
|
|
|
<el-input v-model="scope.row.outstockQty" placeholder="请输入计划数量" style="width: 200px;"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" fixed="right" width="200">
|
|
|
<template #default="scope">
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="danger"
|
|
|
@click="tableUDelete(scope.row)"
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="已包数量" prop="printedNum">
|
|
|
<template #default="scope">
|
|
|
<el-input v-model="scope.row.printedNum" placeholder="请输入已包数量" />
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
<!-- <el-table-column label="分包数量" prop="printNum">
|
|
|
<template #default="scope">
|
|
|
<el-input v-model="scope.row.printNum" placeholder="请输入分包数量" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="打印数量" prop="barcodeNum">
|
|
|
<template #default="scope">
|
|
|
<el-input v-model="scope.row.barcodeNum" placeholder="请输入打印数量" />
|
|
|
</template> -->
|
|
|
<!-- </el-table-column> -->
|
|
|
|
|
|
<!-- <el-table-column label="erp同步状态" prop="erpSynchronousStatus">-->
|
|
|
<!-- <template #default="scope">-->
|
|
|
<!-- <el-select-->
|
|
|
<!-- v-model="scope.row.erpSynchronousStatus"-->
|
|
|
<!-- placeholder="选择erp同步状态"-->
|
|
|
<!-- >-->
|
|
|
<!-- <el-option-->
|
|
|
<!-- label="1"-->
|
|
|
<!-- value="1"-->
|
|
|
<!-- />-->
|
|
|
<!-- <el-option-->
|
|
|
<!-- label="2"-->
|
|
|
<!-- value="2"-->
|
|
|
<!-- />-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </template>-->
|
|
|
<!-- </el-table-column>-->
|
|
|
</el-table>
|
|
|
</el-card>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">关闭</el-button>
|
|
|
<el-button type="primary" @click="dialogSubmit">
|
|
|
确定
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog v-model="parentTableInfoVisible" title="修改父表格" width="40%">
|
|
|
<el-form :model="parentTableInfoForm" label-width="120px">
|
|
|
<el-form-item label="仓库" prop="warehouseId">
|
|
|
<el-select v-model="parentTableInfoForm.warehouseId" placeholder="请选择所属仓库" :disabled="true">
|
|
|
<el-option
|
|
|
v-for="item in baseStoreList"
|
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="出库类型" prop="outstockType">
|
|
|
<el-select v-model="parentTableInfoForm.outstockType" placeholder="请选择出库类型">
|
|
|
<el-option
|
|
|
v-for="dict in wms_out_type"
|
|
|
:key="dict.value"
|
|
|
:label="dict.label"
|
|
|
:value="dict.value"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="销售客户" prop="customerId" v-if="parentTableInfoForm.outstockType === '1'">
|
|
|
<el-select v-model="parentTableInfoForm.customerId" placeholder="请选择客户" >
|
|
|
<el-option
|
|
|
v-for="item in baseCustomerList"
|
|
|
:key="item.customerId"
|
|
|
:label="item.customerName"
|
|
|
:value="item.customerId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- <el-form-item label="物料大类" prop="materialCategoryId">-->
|
|
|
<!-- <el-select v-model="parentTableInfoForm.materialCategoryId" placeholder="请选择物料大类">-->
|
|
|
<!-- <el-option v-for="item in mategoryOptions"-->
|
|
|
<!-- :key="item.materialCategoryId"-->
|
|
|
<!-- :label="item.materialCategoryName"-->
|
|
|
<!-- :value="item.materialCategoryId"-->
|
|
|
<!-- />-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<!-- <el-form-item label="工单类型" prop="orderType">-->
|
|
|
<!-- <el-select v-model="parentTableInfoForm.orderType" placeholder="请选择工单类型(字典:1销售订单,2生产订单,3手工,4系统生成)" :disabled="true">-->
|
|
|
<!-- <el-option-->
|
|
|
<!-- v-for="dict in wms_instock_type"-->
|
|
|
<!-- :key="dict.value"-->
|
|
|
<!-- :label="dict.label"-->
|
|
|
<!-- :value="dict.value"-->
|
|
|
<!-- ></el-option>-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<el-form-item label="审核人" prop="auditBy">
|
|
|
<el-select v-model="parentTableInfoForm.auditBy" placeholder="请选择审核人" :disabled="true">
|
|
|
<el-option
|
|
|
v-for="item in userList"
|
|
|
:key="item.userId"
|
|
|
:label="item.userName"
|
|
|
:value="item.userName"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="parentTableInfoVisible = false">关闭</el-button>
|
|
|
<el-button type="primary" @click="parentTableInfoSubmit">
|
|
|
确定
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog v-model="childrenTableInfoVisible" title="条码生成" width="40%">
|
|
|
<el-form :model="childrenTableInfoForm" label-width="120px">
|
|
|
<el-form-item label="物料" prop="materialId">
|
|
|
<el-select v-model="childrenTableInfoForm.materialId" placeholder="请选择物料">
|
|
|
<el-option
|
|
|
v-for="item in materialList"
|
|
|
:key="item.materialId"
|
|
|
:label="item.materialCode"
|
|
|
:value="item.materialId"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="入库数量" prop="instockQty">
|
|
|
<el-input v-model="childrenTableInfoForm.instockQty" placeholder="请输入入库数量" />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="有无条码" prop="codeYesNo">-->
|
|
|
<!-- <el-radio-group v-model="childrenTableInfoForm.codeYesNo">-->
|
|
|
<!-- <el-radio-->
|
|
|
<!-- v-for="dict in wms_barcode_if"-->
|
|
|
<!-- :key="dict.value"-->
|
|
|
<!-- :value="dict.value"-->
|
|
|
<!-- >{{dict.label}}</el-radio>-->
|
|
|
<!-- </el-radio-group>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
<el-form-item label="已包数量" prop="printedNum">
|
|
|
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="分包数量" prop="printNum">
|
|
|
<el-input v-model="childrenTableInfoForm.printNum" placeholder="请输入分包数量" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="打印数量" prop="barcodeNum">
|
|
|
<el-input v-model="childrenTableInfoForm.barcodeNum" placeholder="请输入打印条码数量" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="childrenTableInfoVisible = false">关闭</el-button>
|
|
|
<el-button type="primary" @click="submitForm">
|
|
|
确定
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
|
|
|
<MaterialSelectInWMS
|
|
|
@selection="handleSelection"
|
|
|
ref="materialSelectRef"
|
|
|
v-if="materialOpen"
|
|
|
:materialCategoryId="dialogForm.materialCategoryId"
|
|
|
></MaterialSelectInWMS>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitMaterialForm">确 定</el-button>
|
|
|
<el-button @click="materialOpen = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 审批对话框 -->
|
|
|
<el-dialog v-model="approveDialogVisible" title="出库单审批" width="40%">
|
|
|
<el-form :model="approveForm" label-width="120px">
|
|
|
<el-form-item label="审核状态" prop="auditStatus">
|
|
|
<el-select v-model="approveForm.auditStatus" placeholder="请选择审核状态">
|
|
|
<el-option v-for="d in approve_status" :key="d.value" :label="d.label" :value="d.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="审核意见" prop="auditComments">
|
|
|
<el-input v-model="approveForm.auditComments" type="textarea" placeholder="请输入审核意见" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="approveDialogVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click="submitApprove">确认审批</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Linkage" lang="ts">
|
|
|
import { listOutstockOrder, getOutstockOrder, delOutstockOrder, addOutstockOrder, updateOutstockOrder } from '@/api/wms/outstockOrder';
|
|
|
import { approveOutstockOrder } from '@/api/wms/outstockOrder';
|
|
|
import { OutstockOrderVO, OutstockOrderQuery, OutstockOrderForm } from '@/api/wms/outstockOrder/types';
|
|
|
import {reactive} from 'vue'
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
|
|
|
import {UserVO} from "@/api/system/user/types";
|
|
|
import { getUserList, listUser } from '@/api/system/user';
|
|
|
import { listOutstockDetail, getOutstockDetail, delOutstockDetail, addOutstockDetail, updateOutstockDetail, getOutstockDetailList } from '@/api/wms/outstockDetail';
|
|
|
import { OutstockDetailVO, OutstockDetailQuery, OutstockDetailForm } from '@/api/wms/outstockDetail/types';
|
|
|
import { getMaterialListVo, getMaterailCount } from '@/api/wms/instockDetail';
|
|
|
import {
|
|
|
getMaterialList
|
|
|
} from '@/api/wms/linkage'
|
|
|
|
|
|
import MaterialSelectInWMS from "@/views/wms/baseMaterialInfo/addMaterialInWMS.vue";
|
|
|
|
|
|
import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory';
|
|
|
import { getWmsBaseCustomerList } from '@/api/wms/wmsBaseCustomer';
|
|
|
|
|
|
|
|
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const {
|
|
|
wms_out_type,
|
|
|
wms_barcode_if,
|
|
|
wms_instock_type,
|
|
|
approve_status,
|
|
|
erp_synchronous_status,
|
|
|
material_mategories,
|
|
|
mes_material_categories,
|
|
|
wms_allocate_status,
|
|
|
wms_allocate_create,
|
|
|
wms_allocate_way
|
|
|
} = toRefs<any>(proxy?.useDict('wms_out_type', 'wms_barcode_if', 'wms_instock_type', 'approve_status', 'erp_synchronous_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
|
|
|
|
|
|
|
|
|
interface User {
|
|
|
date: string
|
|
|
name: string
|
|
|
address: string
|
|
|
}
|
|
|
|
|
|
const parentTableTotal = ref(0)
|
|
|
const dialogVisible = ref(false)
|
|
|
const parentTableInfoVisible = ref(false)
|
|
|
const childrenTableInfoVisible = ref(false)
|
|
|
// 审批
|
|
|
const approveDialogVisible = ref(false)
|
|
|
const approveForm = ref<Partial<OutstockOrderForm>>({ outstockId: undefined, auditStatus: '', auditComments: '' })
|
|
|
const dialogFormRef = ref()
|
|
|
// const childrenTableInfoSubmit = ref(false)
|
|
|
const updateDialog = ref(false)
|
|
|
const dialogTitle = ref('添加')
|
|
|
|
|
|
const dialogForm = ref({})
|
|
|
const parentTableInfoForm = ref({})
|
|
|
const childrenTableInfoForm = ref({})
|
|
|
|
|
|
const queryForm = ref({
|
|
|
outstockCode: '',
|
|
|
materialCategoryId: '',
|
|
|
materialCategoryName: '',
|
|
|
warehouseId: '',
|
|
|
outstockType: '',
|
|
|
customerId: undefined,
|
|
|
pageNum: 1,
|
|
|
pageSize: 10
|
|
|
})
|
|
|
const parentTableRef = ref()
|
|
|
const parentTableData = ref([])
|
|
|
const ids = ref([])
|
|
|
// 兼容右上角工具条依赖
|
|
|
const showSearch = ref(true)
|
|
|
const columns = ref([])
|
|
|
const childrenTableData = ref([])
|
|
|
const dialogtable = ref([])
|
|
|
const baseStoreList = ref([]);
|
|
|
const userList = ref([]);
|
|
|
const materialList = ref([]);
|
|
|
const parentTableLoad = ref(false)
|
|
|
const childrenTableLoad = ref(false)
|
|
|
const isView = ref(false)
|
|
|
const partntTableSelectCell = ref({})
|
|
|
let supplierList = ref([]);
|
|
|
|
|
|
/** 查询出库单大类下物料数量接口 */
|
|
|
// const getMaterialCount = async () => {
|
|
|
// const materialId = form.value.materialId
|
|
|
// console.log(materialId)
|
|
|
// const res = await getMaterailCount({ 'materialId': materialId });
|
|
|
// console.log(res.data);
|
|
|
// form.value.stockQty = res.data;
|
|
|
// console.log(form.stockQty)
|
|
|
// }
|
|
|
|
|
|
|
|
|
// 获取路由实例
|
|
|
const route = useRoute();// 获取路由实例
|
|
|
// 初始化时获取路由参数并设置到查询表单
|
|
|
let routeOutstockTypeValue = '';
|
|
|
if (route.query.outstockType) {
|
|
|
// 确保值是字符串类型,如果是数组则取第一个元素
|
|
|
const outstockTypeValue = Array.isArray(route.query.outstockType)
|
|
|
? route.query.outstockType[0]
|
|
|
: route.query.outstockType;
|
|
|
queryForm.value.outstockType = outstockTypeValue;
|
|
|
routeOutstockTypeValue = outstockTypeValue; // 保存路由参数值
|
|
|
}
|
|
|
|
|
|
// 获取仓库
|
|
|
getBaseWarehouseList(null).then(e => {
|
|
|
baseStoreList.value = e.data
|
|
|
})
|
|
|
listUser().then(e => {
|
|
|
userList.value = e.rows;
|
|
|
})
|
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
|
updateOutstockDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
|
|
|
}
|
|
|
|
|
|
let mategoryOptions = ref([]);
|
|
|
const getMaterialCategorySelect = async () => {
|
|
|
const res = await getBaseMaterialCategoryListInWMS(null);
|
|
|
mategoryOptions.value = res.data;
|
|
|
};
|
|
|
|
|
|
// 获取父表格数据
|
|
|
const getParentTable = async () => {
|
|
|
|
|
|
await getMaterialCategorySelect();
|
|
|
|
|
|
parentTableLoad.value = true
|
|
|
await listOutstockOrder(queryForm.value).then(async (e) => {
|
|
|
parentTableLoad.value = false
|
|
|
parentTableData.value = e.rows
|
|
|
parentTableTotal.value = e.total
|
|
|
const promises = parentTableData.value.map(async (row) => {
|
|
|
const res = await getOutstockDetailList({ outstockId: row.outstockId });
|
|
|
row.needApprove = res.data.some(d => d.isHighValue === '1');
|
|
|
});
|
|
|
await Promise.all(promises);
|
|
|
if (e.rows.length > 0) {
|
|
|
parentTableRef.value.setCurrentRow(e.rows[0])
|
|
|
await getChildrenTable({outstockId: e.rows[0].outstockId})
|
|
|
} else {
|
|
|
childrenTableData.value = []
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 获取子表格数据
|
|
|
const getChildrenTable = async (form) => {
|
|
|
childrenTableLoad.value = true
|
|
|
console.log(form)
|
|
|
await getOutstockDetailList({...form}).then(e => {
|
|
|
childrenTableLoad.value = false
|
|
|
childrenTableData.value = e.data
|
|
|
// parentTableTotal.value = e.total
|
|
|
})
|
|
|
}
|
|
|
|
|
|
getParentTable()
|
|
|
/** 打印按钮操作 */
|
|
|
const handlePrint = async (row?: OutstockDetailVO) => {
|
|
|
reset();
|
|
|
const _outstockDetailId = row?.outstockDetailId || ids.value[0]
|
|
|
const res = await getOutstockDetail(_outstockDetailId);
|
|
|
Object.assign(childrenTableInfoForm.value, res.data);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
// 查询
|
|
|
const query = async () => {
|
|
|
ids.value = []
|
|
|
parentTableRef.value?.clearSelection()
|
|
|
await getParentTable()
|
|
|
}
|
|
|
const reset = () => {
|
|
|
queryForm.value.outstockCode = '';
|
|
|
queryForm.value.materialCategoryId = '';
|
|
|
queryForm.value.materialCategoryName = '';
|
|
|
queryForm.value.warehouseId = '';
|
|
|
queryForm.value.outstockType = routeOutstockTypeValue;
|
|
|
queryForm.value.customerId = undefined;
|
|
|
queryForm.value.pageNum = 1;
|
|
|
queryForm.value.pageSize = 10;
|
|
|
}
|
|
|
|
|
|
// 父表格行点击
|
|
|
const parentTableCellClick = async (e) => {
|
|
|
partntTableSelectCell.value = e
|
|
|
await getChildrenTable({outstockId: e.outstockId})
|
|
|
}
|
|
|
|
|
|
// 表格多选
|
|
|
const selectionChange = (e) => {
|
|
|
ids.value = e.map(v => v.outstockId)
|
|
|
}
|
|
|
|
|
|
|
|
|
// 父表格新增
|
|
|
const parentTableAdd = () => {
|
|
|
getBaseCustomerList();
|
|
|
dialogVisible.value = true
|
|
|
dialogForm.value = {}
|
|
|
dialogtable.value = []
|
|
|
}
|
|
|
// 父表格修改
|
|
|
const parentTableUpdate = async (e) => {
|
|
|
getBaseCustomerList();
|
|
|
let id = ref(null)
|
|
|
if (e) {
|
|
|
id.value = e.outstockId
|
|
|
} else {
|
|
|
id.value = ids.value?.[0]
|
|
|
}
|
|
|
if (!id.value) return
|
|
|
parentTableInfoForm.value = (await getOutstockOrder(id.value)).data
|
|
|
parentTableInfoVisible.value = true
|
|
|
updateDialog.value = true
|
|
|
}
|
|
|
// 父表格删除
|
|
|
const parentTableDelete = async (e) => {
|
|
|
const delList = ref([])
|
|
|
if (e) {
|
|
|
delList.value = [e.outstockId]
|
|
|
} else {
|
|
|
delList.value = ids.value
|
|
|
}
|
|
|
ElMessageBox.confirm(
|
|
|
'确定要删除这些数据吗?',
|
|
|
'Warning',
|
|
|
{
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
}
|
|
|
)
|
|
|
.then(async () => {
|
|
|
await delOutstockOrder(delList.value.toString()).then(e => {
|
|
|
ElMessage({
|
|
|
type: 'success',
|
|
|
message: '删除完成',
|
|
|
})
|
|
|
getParentTable()
|
|
|
})
|
|
|
})
|
|
|
.catch(() => {
|
|
|
ElMessage({
|
|
|
type: 'info',
|
|
|
message: '取消',
|
|
|
})
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 获取物料列表
|
|
|
const setMaterialList = (materialCategoryId) => {
|
|
|
getMaterialList({materialCategoryId}).then(e => {
|
|
|
materialList.value = e.data
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 添加子表格行
|
|
|
const addDialogTableCell = () => {
|
|
|
dialogtable.value.push({})
|
|
|
}
|
|
|
|
|
|
const dialogSubmit = async () => {
|
|
|
// 首先进行表单验证
|
|
|
if (!dialogFormRef.value) {
|
|
|
ElMessage.error('表单引用未找到');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
await dialogFormRef.value.validate();
|
|
|
} catch (error) {
|
|
|
ElMessage.error('请填写完整的表单信息');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
console.log(dialogtable.value)
|
|
|
// 将前端行映射为后端明细字段,并进行基本校验与过滤
|
|
|
const detailList = (dialogtable.value || [])
|
|
|
.map((item: any) => ({
|
|
|
materialId: item.materialId,
|
|
|
materialCode: item.materialCode,
|
|
|
materialName: item.materialName,
|
|
|
materialSpe: item.materialSpe || item.materialSpec, // 前端 materialSpec -> 后端 materialSpe
|
|
|
unitName: item.materialUnit, // 前端 materialUnit -> 后端 unitName
|
|
|
outstockQty: Number(item.outstockQty || 0),
|
|
|
materialCategoryId: dialogForm.value.materialCategoryId
|
|
|
}))
|
|
|
.filter(d => d.materialCode && Number(d.outstockQty) > 0);
|
|
|
|
|
|
console.log(detailList)
|
|
|
if (!detailList.length) {
|
|
|
ElMessage.error('请添加至少一条物料且数量>0');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
console.log(detailList, dialogtable.value);
|
|
|
|
|
|
const payload: OutstockOrderForm = {
|
|
|
...dialogForm.value,
|
|
|
detailList: detailList
|
|
|
};
|
|
|
|
|
|
console.log(payload)
|
|
|
addOutstockOrder(payload).then(() => {
|
|
|
ElMessage.success('保存成功');
|
|
|
dialogVisible.value = false;
|
|
|
getParentTable();
|
|
|
}).catch(error => {
|
|
|
ElMessage.error('新增失败,请重试');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
const parentTableInfoSubmit = () =>{
|
|
|
updateOutstockOrder(parentTableInfoForm.value).then(e=>{
|
|
|
ElMessage({
|
|
|
type: 'success',
|
|
|
message: '修改完成',
|
|
|
})
|
|
|
parentTableInfoVisible.value = false
|
|
|
getParentTable()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 子表格修改
|
|
|
const childrenTableUpdate = async (e) => {
|
|
|
const res = await getOutstockDetail(e.outstockDetailId);
|
|
|
childrenTableInfoForm.value = res.data;
|
|
|
childrenTableInfoVisible.value = true
|
|
|
}
|
|
|
// 子表格数据新增删除
|
|
|
const tableUDelete = (row) => {
|
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
'确定要删除这些数据吗?',
|
|
|
'Warning',
|
|
|
{
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
}
|
|
|
)
|
|
|
.then(async () => {
|
|
|
const index = dialogtable.value.indexOf(row);
|
|
|
console.log(index)
|
|
|
dialogtable.value.splice(index,1)
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 子表格删除
|
|
|
const childrenTableUDelete = (e) => {
|
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
'确定要删除这些数据吗?',
|
|
|
'Warning',
|
|
|
{
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
}
|
|
|
)
|
|
|
.then(async () => {
|
|
|
await delOutstockDetail(e.outstockDetailId).then(async (e) => {
|
|
|
ElMessage({
|
|
|
type: 'success',
|
|
|
message: '删除完成',
|
|
|
})
|
|
|
await getChildrenTable({outstockId: partntTableSelectCell.value.outstockId})
|
|
|
})
|
|
|
})
|
|
|
.catch(() => {
|
|
|
ElMessage({
|
|
|
type: 'info',
|
|
|
message: '取消',
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
/* 以下为添加物料信息对话框相关方法 */
|
|
|
let materialSelectRef = ref();//物料选择对话框绑定
|
|
|
const materialOpen = ref(false);//物料选择对话框显示
|
|
|
const selectType = ref(''); // 用于标识当前选择的是哪个字段
|
|
|
const selectedMaterial = ref(null); // 存储选中的物料完整信息
|
|
|
const currentRowIndex = ref(-1); // 存储当前正在编辑的行索引
|
|
|
|
|
|
/** 处理从MaterialSelect组件接收到的选择 */
|
|
|
const handleSelection = (row) => {
|
|
|
selectedMaterial.value = row;
|
|
|
};
|
|
|
|
|
|
/** 提交物料BOM信息按钮 */
|
|
|
const submitMaterialForm = () => {
|
|
|
if (!selectedMaterial.value) {
|
|
|
// 如果没有选中行,则尝试从表格中获取
|
|
|
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
}
|
|
|
|
|
|
if (selectedMaterial.value) {
|
|
|
if (selectType.value === 'material') {
|
|
|
// 只更新当前正在编辑的行
|
|
|
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
|
|
|
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
|
|
|
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
|
|
|
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
|
|
|
dialogtable.value[currentRowIndex.value].unitName = selectedMaterial.value.materialUnit;
|
|
|
dialogtable.value[currentRowIndex.value].materialSpe = selectedMaterial.value.materialSpec;
|
|
|
// 可以根据需要添加更多字段
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 重置选中的物料信息和关闭对话框
|
|
|
selectedMaterial.value = null;
|
|
|
materialOpen.value = false;
|
|
|
};
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
const handleMaterialAdd = (type, index) => {
|
|
|
selectType.value = type;
|
|
|
currentRowIndex.value = index; // 保存当前正在编辑的行索引
|
|
|
materialOpen.value = true;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 审批弹窗打开
|
|
|
const openApprove = (row) => {
|
|
|
if (!row || !row.outstockId) {
|
|
|
ElMessage({ type: 'warning', message: '未获取到出库单ID' })
|
|
|
return
|
|
|
}
|
|
|
approveForm.value = {
|
|
|
outstockId: row.outstockId,
|
|
|
auditStatus: approveForm.value.auditStatus ?? '',
|
|
|
auditComments: approveForm.value.auditComments ?? ''
|
|
|
}
|
|
|
approveDialogVisible.value = true
|
|
|
}
|
|
|
|
|
|
// 审批提交
|
|
|
const submitApprove = async () => {
|
|
|
const payload = {
|
|
|
outstockId: approveForm.value.outstockId!,
|
|
|
auditStatus: approveForm.value.auditStatus ?? '',
|
|
|
auditComments: approveForm.value.auditComments ?? ''
|
|
|
}
|
|
|
if (!payload.outstockId) {
|
|
|
ElMessage({ type: 'warning', message: '缺少出库单ID,无法提交审批' })
|
|
|
return
|
|
|
}
|
|
|
if (!payload.auditStatus) {
|
|
|
ElMessage({ type: 'warning', message: '请选择审核状态' })
|
|
|
return
|
|
|
}
|
|
|
try {
|
|
|
await approveOutstockOrder(payload)
|
|
|
ElMessage({ type: 'success', message: '审批成功' })
|
|
|
approveDialogVisible.value = false
|
|
|
// 刷新父表格
|
|
|
await getParentTable()
|
|
|
} catch (err) {
|
|
|
ElMessage({ type: 'error', message: '审批失败,请重试' })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取客户信息
|
|
|
let baseCustomerList = ref([]);
|
|
|
const getBaseCustomerList = async () => {
|
|
|
const res = await getWmsBaseCustomerList(null);
|
|
|
baseCustomerList.value = res.data;
|
|
|
}
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
queryForm.value.pageNum = 1;
|
|
|
getParentTable();
|
|
|
}
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
|
reset();
|
|
|
handleQuery();
|
|
|
}
|
|
|
|
|
|
|
|
|
</script>
|
|
|
<style>
|
|
|
.demo-form-inline .el-input {
|
|
|
--el-input-width: 220px;
|
|
|
}
|
|
|
|
|
|
.demo-form-inline .el-select {
|
|
|
--el-select-width: 220px;
|
|
|
}
|
|
|
</style>
|