初始化

This commit is contained in:
张怡蓉
2025-12-23 13:36:18 +08:00
commit d427ebf6d0
1232 changed files with 239447 additions and 0 deletions

View File

@@ -0,0 +1,688 @@
<template>
<div class="app-container">
<!-- 主表信息录入 -->
<el-form :model="formData" ref="formRef" size="small" :inline="true" label-width="68px" :rules="rules">
<!-- <el-form-item label="仓库" prop="warehouseId" required>-->
<!-- <el-select v-model="formData.warehouseId" placeholder="请选择仓库" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in warehouseOptions"-->
<!-- :key="dict.warehouseId"-->
<!-- :label="dict.warehouseName"-->
<!-- :value="dict.warehouseId"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="盘点类型" prop="checkType" required>
<el-select v-model="formData.checkType" placeholder="请选择盘点类型" clearable @change="handleCheckTypeChange">
<el-option
v-for="dict in dict.type.check_stock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="warning" icon="el-icon-refresh" size="mini" @click="reset">重置</el-button>
<el-button type="success" icon="el-icon-check" size="mini" @click="handleSave"
v-hasPermi="['check:stockCheck:saveBill']">保存单据
</el-button>
</el-form-item>
</el-form>
<div class="mb8">
<el-button type="primary" icon="el-icon-plus" size="mini" v-hasPermi="['check:productAndStock:list']"
@click="handleSelectMaterials">选择物资
</el-button>
<el-button type="info" icon="el-icon-refresh-right" size="mini" @click="handleReload">重新建单</el-button>
</div>
<!-- 物资明细表格 -->
<el-table v-loading="loading" :data="materialList">
<el-table-column label="物资编号" align="left" prop="productId"/>
<el-table-column label="品名" align="left" prop="productName"/>
<el-table-column label="批号" align="left" prop="lotNo"/>
<el-table-column label="数量" align="right" prop="quantity"/>
<el-table-column label="仓库编号" align="left" prop="warehouseId"/>
<el-table-column label="货位名称" align="left" prop="cargoSpaceName"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 选择物料物资弹窗 -->
<el-dialog title="选择物资" :visible.sync="materialDialogByProduct" width="800px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="品号" prop="productId">
<el-input
v-model="queryParams.productId"
placeholder="请输入品号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="品名" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入品名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批号" prop="lotNo">
<el-input
v-model="queryParams.lotNo"
placeholder="请输入批号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="盘点状态" prop="spare7">
<el-select v-model="queryParams.spare7" placeholder="请选择盘点状态" clearable>
<el-option
v-for="dict in dict.type.check_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="info" size="mini" @click="resetPdRecordButton"
v-hasPermi="['stock:management:resetPdRecord']">重置盘点记录
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialOptions" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="盘点状态" align="center" prop="spare7">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_status" :value="scope.row.spare7"/>
</template>
</el-table-column>
<el-table-column label="品号" align="center" prop="productId"/>
<el-table-column label="NC号" align="center" prop="spare9"/>
<el-table-column label="品名" align="center" prop="productName"/>
<el-table-column label="数量" align="center" prop="quantity"/>
<el-table-column label="规格" align="center" prop="spec"/>
<el-table-column label="品号描述" align="center" prop="price"/>
<el-table-column label="英文描述" align="center" prop="cargoNo"/>
<el-table-column label="图号" align="center" prop="unit"/>
<el-table-column label="电压" align="center" prop="spare5"/>
<el-table-column label="电源线" align="center" prop="spare10"/>
<el-table-column label="插头" align="center" prop="spare11"/>
<el-table-column label="接嘴" align="center" prop="spare12"/>
<el-table-column label="快捷码" align="center" prop="spare13"/>
<el-table-column label="库存单位编号" align="center" prop="spare14"/>
<el-table-column label="库存单位名称" align="center" prop="spare15"/>
<el-table-column label="品号群组" align="center" prop="spare16"/>
<el-table-column label="归类品" align="center" prop="spare17"/>
<el-table-column label="计量体系" align="center" prop="spare18"/>
<el-table-column label="群组名称" align="center" prop="spare19"/>
<el-table-column label="批号管理" align="center" prop="spare20"/>
<el-table-column label="状态" align="center" prop="spare21"/>
<el-table-column label="产品大类" align="center" prop="spare22"/>
<el-table-column label="产品二类" align="center" prop="spare23"/>
<el-table-column label="产品线/产品系列" align="center" prop="spare24"/>
<el-table-column label="BOM状态" align="center" prop="spare25"/>
<el-table-column label="产品定位" align="center" prop="spare26"/>
<el-table-column label="电脑板型号" align="center" prop="spare27"/>
<el-table-column label="非标要求" align="center" prop="spare28"/>
<el-table-column label="品牌" align="center" prop="spare29"/>
<el-table-column label="非标颜色" align="center" prop="spare30"/>
<el-table-column label="主颜色" align="center" prop="spare31"/>
<el-table-column label="辅助颜色" align="center" prop="spare32"/>
<el-table-column label="是否标准款" align="center" prop="spare33"/>
<el-table-column label="包装方式" align="center" prop="spare34"/>
<el-table-column label="主要包装方式" align="center" prop="spare35"/>
<el-table-column label="描述" align="center" prop="remark"/>
<el-table-column label="长" align="center" prop="spare36"/>
<el-table-column label="宽" align="center" prop="spare37"/>
<el-table-column label="高" align="center" prop="spare38"/>
<el-table-column label="包装材积" align="center" prop="spare39"/>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getMaterialList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelectMaterials">确定</el-button>
<el-button @click="cancelSelectMaterials">取消</el-button>
</div>
</el-dialog>
<!-- 选择托盘弹窗 -->
<el-dialog title="选择货位" :visible.sync="materialDialogByTrayCode" width="800px" append-to-body>
<el-form :model="trayQueryParams" ref="trayQueryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="品号" prop="productId">
<el-input
v-model="trayQueryParams.productId"
placeholder="请输入品号"
clearable
@keyup.enter.native="handleTrayQuery"
/>
</el-form-item>
<el-form-item label="序列号" prop="trayCode">
<el-input
v-model="trayQueryParams.trayCode"
placeholder="请输入序列号"
clearable
@keyup.enter.native="handleTrayQuery"
/>
</el-form-item>
<el-form-item label="货位-排" prop="thePlatoon">
<el-input
v-model="trayQueryParams.thePlatoon"
placeholder="请输入货位-排"
clearable
@keyup.enter.native="handleTrayQuery"
/>
</el-form-item>
<el-form-item label="货位-列" prop="theColumn">
<el-input
v-model="trayQueryParams.theColumn"
placeholder="请输入货位-列"
clearable
@keyup.enter.native="handleTrayQuery"
/>
</el-form-item>
<el-form-item label="货位-层" prop="theFloor">
<el-input
v-model="trayQueryParams.theFloor"
placeholder="请输入货位-层"
clearable
@keyup.enter.native="handleTrayQuery"
/>
</el-form-item>
<el-form-item label="盘点状态" prop="spare7">
<el-select v-model="queryParams.spare7" placeholder="请选择盘点状态" clearable>
<el-option
v-for="dict in dict.type.check_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleTrayQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetTrayQuery">重置</el-button>
<el-button icon="info" size="mini" @click="resetPdRecordButton"
v-hasPermi="['stock:management:resetPdRecord']">重置盘点记录
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="trayLoading" :data="trayOptions" @selection-change="handleTraySelectionChange"
@row-click="handleRowClick">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="盘点状态" align="center" prop="spare7">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_status" :value="scope.row.spare7"/>
</template>
</el-table-column>
<el-table-column label="品号" align="left" prop="productId"/>
<el-table-column label="品名" align="left" prop="productName"/>
<el-table-column label="批号" align="left" prop="lotNo"/>
<el-table-column label="序列号" align="left" prop="spare6"/>
<el-table-column label="托盘编码" align="left" prop="trayCode"/>
<el-table-column label="货位名称" align="left" prop="cargoSpaceName"/>
<el-table-column label="数量" align="left" prop="quantity"/>
<el-table-column label="仓库" align="left" prop="warehouseId"/>
</el-table>
<pagination
v-show="trayTotal > 0"
:total="trayTotal"
:page.sync="trayQueryParams.pageNum"
:limit.sync="trayQueryParams.pageSize"
@pagination="getMaterialByTrayCodeList"
/>
<!-- 托盘详情弹窗 -->
<el-dialog
title="托盘详情"
:visible.sync="trayDetailVisible"
width="600px"
append-to-body
>
<el-table :data="trayDetailList">
<el-table-column label="品号" align="center" prop="productId"/>
<el-table-column label="NC号" align="center" prop="spare9"/>
<el-table-column label="品名" align="center" prop="productName"/>
<el-table-column label="数量" align="center" prop="quantity"/>
<el-table-column label="规格" align="center" prop="spec"/>
<el-table-column label="品号描述" align="center" prop="price"/>
<el-table-column label="英文描述" align="center" prop="cargoNo"/>
<el-table-column label="图号" align="center" prop="unit"/>
<el-table-column label="电压" align="center" prop="spare5"/>
<el-table-column label="电源线" align="center" prop="spare10"/>
<el-table-column label="插头" align="center" prop="spare11"/>
<el-table-column label="接嘴" align="center" prop="spare12"/>
<el-table-column label="快捷码" align="center" prop="spare13"/>
<el-table-column label="库存单位编号" align="center" prop="spare14"/>
<el-table-column label="库存单位名称" align="center" prop="spare15"/>
<el-table-column label="品号群组" align="center" prop="spare16"/>
<el-table-column label="归类品" align="center" prop="spare17"/>
<el-table-column label="计量体系" align="center" prop="spare18"/>
<el-table-column label="群组名称" align="center" prop="spare19"/>
<el-table-column label="批号管理" align="center" prop="spare20"/>
<el-table-column label="状态" align="center" prop="spare21"/>
<el-table-column label="产品大类" align="center" prop="spare22"/>
<el-table-column label="产品二类" align="center" prop="spare23"/>
<el-table-column label="产品线/产品系列" align="center" prop="spare24"/>
<el-table-column label="BOM状态" align="center" prop="spare25"/>
<el-table-column label="产品定位" align="center" prop="spare26"/>
<el-table-column label="电脑板型号" align="center" prop="spare27"/>
<el-table-column label="非标要求" align="center" prop="spare28"/>
<el-table-column label="品牌" align="center" prop="spare29"/>
<el-table-column label="非标颜色" align="center" prop="spare30"/>
<el-table-column label="主颜色" align="center" prop="spare31"/>
<el-table-column label="辅助颜色" align="center" prop="spare32"/>
<el-table-column label="是否标准款" align="center" prop="spare33"/>
<el-table-column label="包装方式" align="center" prop="spare34"/>
<el-table-column label="主要包装方式" align="center" prop="spare35"/>
<el-table-column label="描述" align="center" prop="remark"/>
<el-table-column label="长" align="center" prop="spare36"/>
<el-table-column label="宽" align="center" prop="spare37"/>
<el-table-column label="高" align="center" prop="spare38"/>
<el-table-column label="包装材积" align="center" prop="spare39"/>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="trayDetailVisible = false">关闭</el-button>
</div>
</el-dialog>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelectMaterials">确定</el-button>
<el-button @click="cancelSelectMaterials">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listWarehouse} from "@/api/bas/warehouse";
import {saveCheckStock} from "@/api/check/stockCheck";
import {listManagement, listProductAndStockPd, resetPdRecord} from "@/api/stock/management"
import {listCargoSpaceByRoadway} from "@/api/bas/cargoSpace"
export default {
name: "AddOutStock",
dicts: ['check_stock_type', 'bill_status', 'check_status'],
data() {
return {
// 上一次选择的单据类型
oldCheckType: null,
// 遮罩层
loading: false,
materialLoading: false,
trayLoading: false,
// 总条数
total: 0,
// 托盘总条数
trayTotal: 0,
// 表单验证规则
rules: {
warehouseId: [
{required: true, message: '请选择仓库', trigger: "change"}
],
checkType: [
{required: true, message: '请选择单据类型', trigger: "change"}
]
},
// 主表数据
formData: {
warehouseId: "01",
customerNo: null,
checkType: null
},
// 仓库选项
warehouseOptions: [],
// 物资明细列表
materialList: [],
// 选择物资弹窗
materialDialogByProduct: false,
materialDialogByTrayCode: false,
// 物资选择列表
materialOptions: [],
// 托盘选择列表
trayOptions: [],
// 已选择的物资
selectedMaterials: [],
// 已选择的托盘
selectedTrays: [],
// 物资查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
onlyIdentity: null,
productId: null,
lotNo: null,
productName: null,
quantity: null,
warehouseId: null,
spare7: null,
},
// 托盘查询参数
trayQueryParams: {
pageNum: 1,
pageSize: 10,
trayCode: null,
productId: null,
thePlatoon: null,
theColumn: null,
theFloor: null,
warehouseId: null,
status: null,
locked: null,
spare7: null
},
// 托盘详情弹窗显示状态
trayDetailVisible: false,
// 托盘详情列表
trayDetailList: []
}
},
created() {
this.getWarehouseOptions();
},
methods: {
/** 获取仓库选项 */
getWarehouseOptions() {
var param = {
pageNum: 1,
pageSize: 99,
typeData: ['1', '2']
}
listWarehouse(param).then(response => {
this.warehouseOptions = response.rows;
});
},
/** 打开选择物资弹窗 */
handleSelectMaterials() {
// if (!this.formData.warehouseId) {
// this.$modal.msgError('请选择仓库');
// return;
// }
if (!this.formData.checkType) {
this.$modal.msgError('请选择单据类型');
return;
}
if (this.formData.checkType === '1') {
this.materialDialogByProduct = true;
// 设置查询参数中的仓库ID为主表选择的仓库
this.queryParams.warehouseId = "01";
this.getMaterialList();
} else if (this.formData.checkType === '2') {
this.materialDialogByTrayCode = true;
// 设置查询参数中的仓库ID为主表选择的仓库
this.queryParams.warehouseId = "01";
this.getMaterialByTrayCodeList();
}
},
/** 获取物资列表 */
getMaterialList() {
this.materialLoading = true;
if (this.formData.checkType === '1') {
listProductAndStockPd(this.queryParams).then(response => {
this.materialOptions = response.rows;
this.total = response.total;
this.materialLoading = false;
});
}
},
/* 获取托盘物资列表*/
getMaterialByTrayCodeList() {
this.trayLoading = true;
if (this.formData.checkType === '2') {
this.trayQueryParams.warehouseId = "01";
this.trayQueryParams.status = 2;
this.trayQueryParams.locked = 'N';
listCargoSpaceByRoadway(this.trayQueryParams).then(response => {
this.trayOptions = response.rows;
this.trayTotal = response.total;
this.trayLoading = false;
});
}
},
/** 物资选择变更 */
handleSelectionChange(selection) {
this.selectedMaterials = selection;
},
/** 托盘选择变更 */
handleTraySelectionChange(selection) {
this.selectedTrays = selection;
},
/** 托盘行点击事件 */
handleRowClick(row) {
if (this.formData.checkType === '2' && row.trayCode) {
const params = {
pageNum: 1,
pageSize: 10,
trayCode: row.trayCode,
warehouseId: this.formData.warehouseId
};
listManagement(params).then(response => {
this.trayDetailList = response.rows;
this.trayDetailVisible = true;
});
}
},
/** 确认选择物资 */
confirmSelectMaterials() {
if (this.formData.checkType === '1') {
this.confirmSelectMaterialsByProduct();
} else if (this.formData.checkType === '2') {
this.confirmSelectMaterialsByTray();
}
},
/** 确认选择物料物资 */
confirmSelectMaterialsByProduct() {
if (this.selectedMaterials.length === 0) {
this.$modal.msgError('请选择物资');
return;
}
// 过滤掉已经存在的物资
const newMaterials = this.selectedMaterials.filter(item => {
return !this.materialList.some(existing => existing.onlyIdentity === item.onlyIdentity);
});
if (newMaterials.length === 0) {
this.$modal.msgWarning('选择的物资已存在');
return;
}
this.materialList = this.materialList.concat(
newMaterials.map(item => ({
productId: item.productId,
productGuId: item.productGuid,
productName: item.productName,
quantity: item.quantity,
lotNo: item.lotNo,
onlyIdentity: item.onlyIdentity,
warehouseId: item.warehouseId,
cargoSpaceId: item.cargoSpaceId,
cargoSpaceName: item.cargoSpaceName,
spec: item.spare1,
// spare3: item.spare3,
spare1: item.spare4,
spare3: item.spare5,
spare4: item.spare6,
spare5: item.voltage,
spare6: item.power,
spare7: item.phase,
spare2: item.netWeight,
spare8: item.grossWeight,
spare9: item.distribution,
unit: item.model,
orderId: item.orderId
}))
);
this.materialDialogByProduct = false;
this.selectedMaterials = [];
},
/** 确认选择托盘物资 */
confirmSelectMaterialsByTray() {
if (this.selectedTrays.length === 0) {
this.$modal.msgError('请选择托盘');
return;
}
// 过滤掉已经存在的托盘
const newTrays = this.selectedTrays.filter(item => {
return !this.materialList.some(existing => existing.trayCode === item.trayCode);
});
if (newTrays.length === 0) {
this.$modal.msgWarning('选择的托盘已存在');
return;
}
this.materialList = this.materialList.concat(
newTrays.map(item => ({
productId: item.productId,
productGuId: item.productGuid,
productName: item.productName,
quantity: item.quantity,
lotNo: item.lotNo,
trayCode: item.trayCode,
warehouseId: item.warehouseId,
cargoSpaceId: item.cargoSpaceId,
cargoSpaceName: item.cargoSpaceName,
spec: item.spare1,
spare1: item.spare4,
spare3: item.spare5,
spare4: item.spare6,
spare5: item.voltage,
spare6: item.power,
spare7: item.phase,
spare2: item.netWeight,
spare8: item.grossWeight,
spare9: item.distribution,
unit: item.model,
// orderId: item.orderId
}))
);
this.materialDialogByTrayCode = false;
this.selectedTrays = [];
},
/** 取消选择物资 */
cancelSelectMaterials() {
if (this.formData.checkType === '1') {
this.cancelSelectMaterialsByProduct();
} else if (this.formData.checkType === '2') {
this.cancelSelectMaterialsByTray();
}
},
/** 取消选择物料物资 */
cancelSelectMaterialsByProduct() {
this.selectedMaterials = [];
this.materialDialogByProduct = false;
},
/** 取消选择托盘物资 */
cancelSelectMaterialsByTray() {
this.selectedTrays = [];
this.materialDialogByTrayCode = false;
},
/** 物资搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getMaterialList();
},
/** 物资重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 托盘搜索按钮操作 */
handleTrayQuery() {
this.trayQueryParams.pageNum = 1;
this.getMaterialByTrayCodeList();
},
/** 托盘重置按钮操作 */
resetTrayQuery() {
this.resetForm("trayQueryForm");
this.handleTrayQuery();
},
/** 重置重置按钮操作 */
resetPdRecordButton() {
resetPdRecord().then(response => {
this.$modal.msgSuccess('重置成功');
this.handleQuery();
})
},
/** 删除物资 */
handleDelete(index) {
this.materialList.splice(index, 1);
},
/** 保存单据 */
handleSave() {
this.$refs.formRef.validate(valid => {
if (valid) {
if (this.materialList.length === 0) {
this.$modal.msgError('请选择物资');
return;
}
const data = {
checkStockin: this.formData,
detailList: this.materialList
};
console.log(data)
// 这里需要调用保存接口
saveCheckStock(data).then(response => {
this.$modal.msgSuccess('保存成功:' + response.msg);
this.$tab.refreshPage(this.$route);
// this.reset();
});
}
});
},
/** 单据类型变更处理 */
handleCheckTypeChange(value) {
if (this.materialList.length > 0) {
this.$modal.msgWarning('已添加物资,不能更改单据类型');
this.$nextTick(() => {
this.formData.checkType = this.oldCheckType;
});
return;
}
this.oldCheckType = value;
},
/** 重置数据 */
reset() {
this.formData = {
warehouseId: null,
customerNo: null,
outType: null
};
this.materialList = [];
},
/** 重新建单 */
handleReload() {
this.$tab.refreshPage(this.$route);
},
}
};
</script>
<style scoped>
.el-form-item >>> .el-form-item__label {
white-space: nowrap;
width: auto;
min-width: fit-content;
}
</style>

View File

@@ -0,0 +1,393 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="盘点单据编号" prop="checkStockDetailId">
<el-input
v-model="queryParams.checkStockDetailId"
placeholder="请输入盘点单据编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="库存编号" prop="stockId">
<el-input
v-model="queryParams.stockId"
placeholder="请输入库存编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="托盘编码" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位编号" prop="cargoSpaceId">
<el-input
v-model="queryParams.cargoSpaceId"
placeholder="请输入货位编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="品号" prop="productId">
<el-input
v-model="queryParams.productId"
placeholder="请输入品号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-select
v-model="queryParams.warehouseId"
placeholder="请选择仓库"
clearable
@change="handleQuery"
>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item label="审核状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择审核状态" clearable>
<el-option
v-for="dict in dict.type.audit_diff_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="操作方式" prop="recordType">
<el-select v-model="queryParams.recordType" placeholder="请选择操作方式" clearable>
<el-option
v-for="dict in dict.type.record_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-check"
size="mini"
:disabled="multiple || queryParams.status === '1'"
@click="handleAudit"
v-hasPermi="['check:difference:audit']"
>审核</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple || queryParams.status === '1'"
@click="handleDelete"
v-hasPermi="['check:difference:delete']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="differenceList" @selection-change="handleSelectionChange" max-height="650">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="仓库" align="left" prop="warehouseName" />
<el-table-column label="盘点单据编号" align="left" prop="checkStockDetailId" />
<el-table-column label="库存编号" align="left" prop="stockId" />
<el-table-column label="托盘编码" align="left" prop="trayCode" />
<el-table-column label="货位名称" align="left" prop="cargoSpaceName" />
<el-table-column label="品号" align="left" prop="productId" />
<el-table-column label="品名" align="left" prop="extraField.materialDesc"/>
<el-table-column label="英文描述" align="left" prop="extraField.englishDesc"/>
<el-table-column label="原值" align="right" prop="oldQuantity" />
<el-table-column label="新值" align="right" prop="newQuantity" />
<el-table-column label="操作方式" align="left" prop="recordType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.record_type" :value="scope.row.recordType"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="left" prop="createTime" />
<el-table-column label="审核状态" align="left" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.audit_diff_status" :value="scope.row.status"/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改盘点差异对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="盘点单据编号" prop="checkStockDetailId">
<el-input v-model="form.checkStockDetailId" placeholder="请输入盘点单据编号" />
</el-form-item>
<el-form-item label="库存编号" prop="stockId">
<el-input v-model="form.stockId" placeholder="请输入库存编号" />
</el-form-item>
<el-form-item label="托盘编码" prop="trayCode">
<el-input v-model="form.trayCode" placeholder="请输入托盘编码" />
</el-form-item>
<el-form-item label="货位编号" prop="cargoSpaceId">
<el-input v-model="form.cargoSpaceId" placeholder="请输入货位编号" />
</el-form-item>
<el-form-item label="品号" prop="productId">
<el-input v-model="form.productId" placeholder="请输入品号" />
</el-form-item>
<el-form-item label="批次号" prop="lotNo">
<el-input v-model="form.lotNo" placeholder="请输入批次号" />
</el-form-item>
<el-form-item label="供应商" prop="supplier">
<el-input v-model="form.supplier" placeholder="请输入供应商" />
</el-form-item>
<el-form-item label="客户" prop="customer">
<el-input v-model="form.customer" placeholder="请输入客户" />
</el-form-item>
<el-form-item label="原值" prop="oldQuantity">
<el-input v-model="form.oldQuantity" placeholder="请输入原值" />
</el-form-item>
<el-form-item label="新值" prop="newQuantity">
<el-input v-model="form.newQuantity" placeholder="请输入新值" />
</el-form-item>
<el-form-item label="物料标识" prop="productGuid">
<el-input v-model="form.productGuid" placeholder="请输入物料标识" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDifference, getDifference, delDifference, addDifference, updateDifference, auditDifference } from "@/api/check/difference"
import { listDifferenceRecordFinish } from "@/api/check/DifferenceRecordFinish"
import DictTag from "@/components/DictTag"
import {listWarehouse} from "@/api/bas/warehouse";
export default {
name: "Difference",
dicts:['record_type','audit_diff_status'],
components: {
DictTag
},
data() {
return {
warehouseOptions:[],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 盘点差异表格数据
differenceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
checkStockDetailId: null,
stockId: null,
trayCode: null,
cargoSpaceId: null,
productId: null,
lotNo: null,
supplier: null,
customer: null,
oldQuantity: null,
newQuantity: null,
recordType: null,
productGuid: null,
status: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
this.getWarehouseList()
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
if (this.warehouseOptions.length > 0) {
this.handleQuery();
}
});
},
/** 查询盘点差异列表 */
getList() {
this.loading = true
if (this.queryParams.status === '1' || this.queryParams.status === '2') {
// 已审核,查询历史表
listDifferenceRecordFinish(this.queryParams).then(response => {
this.differenceList = response.rows
this.total = response.total
this.loading = false
})
} else {
// 未审核或未选择状态,查询差异表
listDifference(this.queryParams).then(response => {
this.differenceList = response.rows
this.total = response.total
this.loading = false
})
}
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
checkGuid: null,
checkStockDetailId: null,
stockId: null,
trayCode: null,
cargoSpaceId: null,
productId: null,
lotNo: null,
supplier: null,
customer: null,
oldQuantity: null,
newQuantity: null,
recordType: null,
createTime: null,
productGuid: null,
status: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.checkGuid)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加盘点差异"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const checkGuid = row.checkGuid || this.ids
getDifference(checkGuid).then(response => {
this.form = response.data
this.open = true
this.title = "修改盘点差异"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.checkGuid != null) {
updateDifference(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addDifference(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const checkGuids = row.checkGuid || this.ids
this.$modal.confirm('是否确认删除编号为"' + checkGuids + '"的数据项?').then(function() {
return delDifference(checkGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('check/difference/export', {
...this.queryParams
}, `difference_${new Date().getTime()}.xlsx`)
},
/** 审核按钮操作 */
handleAudit() {
const checkGuids = this.ids
this.$modal.confirm('是否确认审核编号为"' + checkGuids + '"的数据项?').then(function() {
return auditDifference(checkGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess('审核成功')
}).catch(() => {})
},
}
}
</script>
<style scoped>
.el-form-item >>> .el-form-item__label {
white-space: nowrap;
width: auto;
min-width: fit-content;
}
</style>

View File

@@ -0,0 +1,534 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="库存编号" prop="stockId">
<el-input
v-model="queryParams.stockId"
placeholder="请输入库存编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位编号" prop="cargoSpaceId">
<el-input
v-model="queryParams.cargoSpaceId"
placeholder="请输入货位编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="库存状态" prop="stockStatus">
<el-select v-model="queryParams.stockStatus" placeholder="请选择库存状态" clearable>
<el-option
v-for="dict in dict.type.stock_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="入库日期" prop="startDate">
<el-date-picker clearable
v-model="queryParams.inDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择入库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="托盘编码" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="品名" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入品名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库">
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['stock:management:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['stock:management:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="single"
@click="handleDelete"
v-hasPermi="['stock:management:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['stock:management:export']"
>{{$t('stockManagement.export')}} &lt;!&ndash; 导出 &ndash;&gt;</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="库存编号" align="left" prop="stockId" />
<el-table-column label="货位编号" align="left" prop="cargoSpaceId" />
<el-table-column label="货位名称" align="left" prop="cargoSpaceName" />
<el-table-column label="库存状态" align="left" prop="stockStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.stock_status" :value="scope.row.stockStatus"/>
</template>
</el-table-column>
<el-table-column label="货位状态" align="left" prop="cargoSpaceStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.cargo_space_lock_status" :value="scope.row.cargoSpaceStatus"/>
</template>
</el-table-column>
<el-table-column label="物料状态" align="left" prop="productStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.product_status" :value="scope.row.productStatus"/>
</template>
</el-table-column>
<el-table-column label="品号" align="left" prop="extraField.productId" />
<el-table-column label="品名" align="left" prop="extraField.materialDesc" />
<el-table-column label="英文描述" align="left" prop="extraField.englishDesc" />
<el-table-column label="净重" align="right" prop="extraField.netWeight" />
<el-table-column label="长" align="right" prop="extraField.length" />
<el-table-column label="宽" align="right" prop="extraField.width" />
<el-table-column label="高" align="right" prop="extraField.height" />
<el-table-column label="体积" align="right" prop="extraField.volume" />
<el-table-column label="库存数量" align="right" prop="quantity" />
<el-table-column label="入库主单" align="left" prop="stockinId" />
<el-table-column label="入库子单编号" align="left" prop="stockinDetailId" />
<el-table-column label="仓库" align="left" prop="warehouseName" />
<el-table-column label="入库时间" align="left" prop="inDate" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['stock:management:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['stock:management:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 新增库存信息对话框 -->
<el-dialog title="新增库存信息" :visible.sync="addOpen" width="500px" append-to-body>
<el-form ref="addForm" :model="addForm" :rules="addRules" label-width="80px">
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="addForm.warehouseId" placeholder="请选择仓库" clearable>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item label="品名" prop="materialDesc">
<el-select v-model="addForm.extraField.productId" placeholder="请选择品名" clearable filterable>
<el-option
v-for="item in productOptions"
:key="item.productId"
:label="item.productName"
:value="item.productId"
/>
</el-select>
</el-form-item>
<el-form-item label="库存数量" prop="quantity">
<el-input v-model="addForm.quantity" placeholder="请输入库存数量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAddForm">确定</el-button>
<el-button @click="cancelAdd">取消</el-button>
</div>
</el-dialog>
<!-- 修改库存信息对话框 -->
<el-dialog title="修改库存信息" :visible.sync="editOpen" width="500px" append-to-body>
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="80px">
<el-form-item label="库存编号" prop="stockId">
<el-input v-model="editForm.stockId" placeholder="请输入库存编号" disabled />
</el-form-item>
<el-form-item label="品号" prop="productId">
<el-input v-model="editForm.extraField.productId" placeholder="请输入品号" disabled />
</el-form-item>
<el-form-item label="品名" prop="materialDesc">
<el-input v-model="editForm.extraField.materialDesc" placeholder="请输入品名" disabled />
</el-form-item>
<el-form-item label="英文描述" prop="englishDesc">
<el-input v-model="editForm.extraField.englishDesc" placeholder="请输入英文描述" disabled />
</el-form-item>
<el-form-item label="库存数量" prop="quantity">
<el-input v-model="editForm.quantity" placeholder="请输入库存数量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitEditForm">确定</el-button>
<el-button @click="cancelEdit">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listManagement, getManagement, delManagement, addManagement, updateManagement } from "@/api/stock/management"
import {listWarehouse} from "@/api/bas/warehouse"
import {addDifference} from "@/api/check/difference";
import {listBasProduct} from "@/api/bas/BasProduct"
export default {
name: "Management",
dicts: ['product_status', 'stock_status','cargo_space_status','cargo_space_lock_status'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 库存信息表格数据
managementList: [],
// 仓库选项
warehouseOptions: [],
// 物料选项
productOptions: [],
// 是否显示新增弹出层
addOpen: false,
// 是否显示修改弹出层
editOpen: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockId: null,
cargoSpaceId: null,
stockStatus: '1',
productStatus: '1',
lotNo: null,
inDate: null,
backDate: null,
productGuid: null,
quantity: null,
jobId: null,
trayCode: null,
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
spare6: null,
typeData: ["3"]
},
// 新增表单参数
addForm: {
extraField:{}
},
// 修改表单参数
editForm: {
extraField:{}
},
// 新增表单校验
addRules: {
/*stockId: [
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
]*/
},
// 修改表单校验
editRules: {
/*stockId: [
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
]*/
},
pdData:{}
}
},
created() {
this.getWarehouseList();
this.getProductList();
this.getList()
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
var data = {
"typeData": ["3"]
}
listWarehouse(data).then(response => {
this.warehouseOptions = response.rows;
});
},
/** 获取物料列表 */
getProductList() {
listBasProduct().then(response => {
this.productOptions = response.rows;
});
},
/** 查询库存信息列表 */
getList() {
this.loading = true
listManagement(this.queryParams).then(response => {
this.managementList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消新增按钮
cancelAdd() {
this.addOpen = false
this.resetAdd()
},
// 取消修改按钮
cancelEdit() {
this.editOpen = false
this.resetEdit()
},
// 新增表单重置
resetAdd() {
this.addForm = {
stockId: null,
cargoSpaceId: null,
stockStatus: null,
productStatus: null,
lotNo: null,
inDate: null,
backDate: null,
productGuid: null,
quantity: null,
jobId: null,
trayCode: null,
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
spare6: null,
extraField:{}
}
this.resetForm("addForm")
},
// 修改表单重置
resetEdit() {
this.editForm = {
stockId: null,
cargoSpaceId: null,
stockStatus: null,
productStatus: null,
lotNo: null,
inDate: null,
backDate: null,
productGuid: null,
quantity: null,
jobId: null,
trayCode: null,
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
spare6: null,
extraField:{}
}
this.resetForm("editForm")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.stockId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.resetAdd()
this.addOpen = true
},
/** 修改按钮操作 */
handleUpdate(row) {
this.resetEdit()
const stockId = row.stockId || this.ids
console.log(stockId)
getManagement(stockId).then(response => {
this.editForm = response.data
this.editOpen = true
console.log(this.editForm)
})
},
/** 提交新增表单 */
submitAddForm() {
this.$refs["addForm"].validate(valid => {
if (valid) {
this.pdData={}
//新增
this.pdData= {
newQuantity: this.addForm.quantity,
warehouseId: this.addForm.warehouseId,
productId: this.addForm.extraField.productId,
recordType: 2
}
addDifference(this.pdData).then(response => {
this.$modal.msgSuccess("新增成功")
this.addOpen = false
this.getList()
});
}
})
},
/** 提交修改表单 */
submitEditForm() {
this.$refs["editForm"].validate(valid => {
if (valid) {
this.pdData={}
//修改
this.pdData= {
stockId: this.editForm.stockId,
newQuantity: this.editForm.quantity,
warehouseId: this.editForm.warehouseId,
productId: this.editForm.productId,
recordType: 1
}
addDifference(this.pdData).then(response => {
this.$modal.msgSuccess("修改成功")
this.editOpen = false
this.getList()
});
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const stockId = row.stockId || this.ids[0]
this.$modal.confirm("是否确认删除该库存信息?").then(function() {
//删除
const pdData = {
stockId: stockId,
oldQuantity: row.quantity,
warehouseId: row.warehouseId,
productId: row.productId,
recordType: 3
}
console.log(pdData)
return addDifference(pdData);
}).then(() => {
this.$modal.msgSuccess("删除成功")
this.getList()
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('stock/management/export', {
...this.queryParams
}, `management_${new Date().getTime()}.xlsx`)
}
}
}
</script>
<style scoped>
/* 统一表单控件宽度 */
.el-select,
.el-input {
width: 100%;
}
</style>

View File

@@ -0,0 +1,443 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="任务ID" prop="jobId">
<el-input
v-model="queryParams.jobId"
placeholder="请输入任务ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="任务状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable>
<el-option
v-for="dict in dict.type.mydo_job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="任务号" prop="taskNo">
<el-input
v-model="queryParams.taskNo"
placeholder="请输入任务号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="序列号" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入序列号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单号" prop="lineId">
<el-input
v-model="queryParams.lineId"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="datetime" style="width: 206px"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="finishTime">
<el-date-picker clearable
v-model="queryParams.finishTime"
type="datetime" style="width: 206px"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="multiple"
@click="handleCompletedManually({type: 'completed'})"
v-hasPermi="['job:mydoJob:manualCompleted']"
>手动完成</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleCompletedManually({type: 'invalid'})"
v-hasPermi="['job:mydoJob:manualInvalidation']"
>手动作废</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row :current-row="currentRow"
max-height="400">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务ID" align="left" prop="jobId" width="160"/>
<el-table-column label="任务状态" align="left" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column label="上线类型" align="left" prop="onLineType">
<template slot-scope="scope">
<dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>
</template>
</el-table-column>-->
<el-table-column label="任务号" align="left" prop="taskNo" />
<el-table-column label="任务类型" align="left" prop="inOrOut">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_in_job_type" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<!-- <el-table-column label="供应商" align="left" prop="supplierName" key="supplierId" value="supplierName" />-->
<!-- <el-table-column label="部门" align="left" prop="departmentName" />-->
<el-table-column label="序列号" align="left" prop="trayCode" />
<el-table-column label="货位" align="left" prop="cargoSpaceName" width="160"/>
<el-table-column label="订单号" align="left" prop="lineId" />
<el-table-column label="入口" align="left" prop="entranceId" />
<!-- <el-table-column label="优先级" align="right" prop="priority" />-->
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase">
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>-->
<el-table-column label="创建时间" align="left" prop="createTime" width="160"/>
<el-table-column label="开始时间" align="left" prop="startTime" width="160"/>
<el-table-column label="结束时间" align="left" prop="finishTime" width="160"/>
<!-- <el-table-column label="仓库" align="left" prop="warehouseName" />-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange"
max-height="300"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="子任务ID" align="left" prop="jobDetailId" width="160" />
<el-table-column label="任务ID" align="left" prop="jobId" width="160"/>
<el-table-column label="单据ID" align="left" prop="inOrOutId" width="160"/>
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" width="160"/>
<el-table-column label="品号" align="left" prop="productId" />
<el-table-column label="品名" align="left" prop="productName" width="160"/>
<el-table-column label="入库数量" align="right" prop="inQuantity" />
<el-table-column label="机型" align="left" prop="unit"/><!--机型-->
<el-table-column label="分销" align="left" prop="spare9"/><!--分销-->
<el-table-column label="规格" align="left" prop="spec"/><!--规格-->
<el-table-column label="型号" align="left" prop="spare1"/><!--型号-->
<el-table-column label="净重" align="left" prop="spare2"/><!--净重-->
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色-->
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号-->
<el-table-column label="电压" align="left" prop="spare5"/><!--电压-->
<el-table-column label="功率" align="left" prop="spare6"/><!--功率-->
<el-table-column label="相位" align="left" prop="spare7"/><!--相位-->
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重-->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import {
listMydoJob,
getMydoJob,
delMydoJob,
addMydoJob,
updateMydoJob,
manualInvalidation,
manualCompleted
} from "@/api/job/inmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
import {listWarehouse} from "@/api/bas/warehouse";
export default {
name: "MydoJob",
dicts: ['execution_phase_type', 'check_in_job_type', 'on_line_type', 'mydo_job_status'],
data() {
return {
warehouseOptions:[],
// 遮罩层
loading: true,
detailLoading:false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 任务表表格数据
mydoJobList: [],
// 子任务表表格数据
mydoJobDetailList:[],
// 当前选中行
currentRow:null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null,
inOut:"3"
},
queryDetailParams:{
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
jobId: [
{ required: true, message: '任务ID不能为空', trigger: "blur" }
],
status: [
{ required: true, message: '状态不能为空', trigger: "change" }
],
taskNo: [
{ required: true, message: '任务号不能为空', trigger: "blur" }
],
}
}
},
created() {
// 获取字典数据后,设置默认值
this.getList()
this.getWarehouseList()
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
if (this.warehouseOptions.length > 0) {
this.handleQuery();
}
});
},
/** 查询任务表列表 */
getList() {
this.loading = true
listMydoJob(this.queryParams).then(response => {
this.mydoJobList = response.rows
this.total = response.total
this.loading = false
// 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]);
}else {
this.mydoJobDetailList = []
this.detailLoading = false
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
// 清空子表数据和当前选中行
this.mydoJobDetailList = []
this.detailTotal = 0
this.currentRow = null
this.queryDetailParams.jobId = null
this.queryDetailParams.status = null
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 清空子表数据
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.currentRow = null;
this.queryDetailParams.jobId = null;
// 重新查询主表数据
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
// 只处理主表的多选
if (selection.length > 0 && selection[0].hasOwnProperty('jobDetailId')) {
return;
}
this.ids = selection.map(item => item.jobId);
this.single = selection.length!==1;
this.multiple = !selection.length;
},
// 手动完成/作废
handleCompletedManually(row) {
//console.log("1111")
const jobIds = this.ids;
if (jobIds.length === 0) {
this.$modal.msgError('请选择要操作的数据');
return;
}
if (jobIds.length > 1) {
this.$modal.msgError('请选择一条数据进行操作');
return;
}
var data = {
"jobId": jobIds[0],
}
if (row.type === 'invalid'){
//手动作废
manualInvalidation(data).then(response => {
this.$modal.msgSuccess('操作成功');
this.getList();
})
}else if (row.type === 'completed'){
//手动完成
manualCompleted(data).then(response => {
this.$modal.msgSuccess(this.$t('checkJobIn.operaSuccess'));
this.getList();
})
}
},
/** 导出按钮操作 */
handleExport() {
this.download('job/mydoJob/export', {
...this.queryParams
}, `mydoJob_${new Date().getTime()}.xlsx`)
},
/** 行点击事件处理 */
handleRowClick(row) {
// 设置当前选中行
this.currentRow = row;
// 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status = row.status;
// 查询子表格数据
this.getDetailList();
},
/** 查询子任务表列表 */
getDetailList() {
// 如果没有选中的主任务,不加载子任务
if (!this.queryDetailParams.jobId) {
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.detailLoading = false;
return;
}
this.detailLoading = true;
listMydoJobDetail(this.queryDetailParams).then(response => {
this.mydoJobDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
}
}
</script>
<style scoped>
.el-table >>> .current-row {
background-color: #f0f9eb;
}
</style>

View File

@@ -0,0 +1,442 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="任务ID" prop="jobId">
<el-input
v-model="queryParams.jobId"
placeholder="请输入任务ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="任务状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable>
<el-option
v-for="dict in dict.type.mydo_job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="任务号" prop="taskNo">
<el-input
v-model="queryParams.taskNo"
placeholder="请输入任务号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="序列号" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入序列号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单号" prop="lineId">
<el-input
v-model="queryParams.lineId"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="datetime" style="width: 206px"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="finishTime">
<el-date-picker clearable
v-model="queryParams.finishTime"
type="datetime" style="width: 206px"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'invalid'})"
v-hasPermi="['job:checkMydoJob:OuthandFinish']"
>{{$t('checkJobOut.manualInvalid')}}</el-button> &lt;!&ndash; 手动作废 &ndash;&gt;
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'completed'})"
v-hasPermi="['job:checkMydoJob:OuthandInvalidation']"
>{{$t('checkJobOut.manualFinish')}}</el-button> &lt;!&ndash; 手动完成 &ndash;&gt;
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange"
@row-click="handleRowClick" max-height="400">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="任务ID" align="left" prop="jobId"/>
<el-table-column label="任务状态" align="left" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="任务号" align="left" prop="taskNo"/>
<el-table-column label="任务类型" align="left" prop="inOrOut">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_out_job_type" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<!-- <el-table-column label="部门" align="left" prop="departmentName" />-->
<el-table-column label="序列号" align="left" prop="trayCode"/>
<el-table-column label="货位" align="left" prop="cargoSpaceName"/>
<el-table-column label="订单号" align="right" prop="lineId"/>
<!-- <el-table-column label="执行阶段" align="left" prop="executionPhase">
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>-->
<el-table-column label="出口" align="left" prop="exitId"/>
<el-table-column label="创建时间" align="left" prop="createTime" width="180">
</el-table-column>
<el-table-column label="开始时间" align="left" prop="startTime" width="180"/>
<el-table-column label="结束时间" align="left" prop="finishTime" width="180"/>
<!-- <el-table-column label="仓库" align="left" prop="warehouseName" />-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="loading" :data="mydoJobDetailList" @selection-change="handleSelectionChange">
<el-table-column label="子任务ID" align="left" prop="jobDetailId" width="160"/>
<el-table-column label="任务ID" align="left" prop="jobId" width="160"/>
<el-table-column label="单据ID" align="left" prop="inOrOutId" width="160"/>
<el-table-column label="子单据ID" align="left" prop="inOrOutDId" width="160"/>
<el-table-column label="库存ID" align="left" prop="stockId" width="160"/>
<el-table-column label="品号" align="left" prop="productId"/>
<el-table-column label="品名" align="left" prop="productName" width="160"/>
<el-table-column label="出库数量" align="right" prop="outQuantity"/> <!-- 出库数量 -->
<el-table-column label="机型" align="left" prop="unit"/><!--机型-->
<el-table-column label="分销" align="left" prop="spare9"/><!--分销-->
<el-table-column label="规格" align="left" prop="spec"/><!--规格-->
<el-table-column label="型号" align="left" prop="spare1"/><!--型号-->
<el-table-column label="净重" align="left" prop="spare2"/><!--净重-->
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色-->
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号-->
<el-table-column label="电压" align="left" prop="spare5"/><!--电压-->
<el-table-column label="功率" align="left" prop="spare6"/><!--功率-->
<el-table-column label="相位" align="left" prop="spare7"/><!--相位-->
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重-->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import {listMydoJobOut} from "@/api/job/OutmydoJob"
import {listMydoJobDetail} from "@/api/job/mydoJobDetail"
import {listWarehouse} from "@/api/bas/warehouse";
export default {
name: "MydoJob",
dicts: ['execution_phase_type', 'check_out_job_type', 'on_line_type', 'mydo_job_status'],
data() {
return {
warehouseOptions: [],
// 遮罩层
loading: true,
detailLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 任务表表格数据
mydoJobList: [],
// 子任务表表格数据
mydoJobDetailList: [],
// 当前选中行
currentRow: null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null,
inOut: '4'
},
queryDetailParams: {
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
jobId: [
{required: true, message: '请输入任务ID', trigger: 'blur'}
],
status: [
{required: true, message: '请选择任务状态', trigger: 'change'}
],
taskNo: [
{required: true, message: '请输入任务号', trigger: 'blur'}
],
}
}
},
created() {
// 获取字典数据后,设置默认值
this.getList()
this.getWarehouseList()
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
if (this.warehouseOptions.length > 0) {
this.handleQuery();
}
});
},
/** 查询任务表列表 */
getList() {
this.loading = true
listMydoJobOut(this.queryParams).then(response => {
this.mydoJobList = response.rows
this.total = response.total
this.loading = false
// 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]);
} else {
this.mydoJobDetailList = []
this.detailLoading = false
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
// 清空子表数据和当前选中行
this.mydoJobDetailList = []
this.detailTotal = 0
this.currentRow = null
this.queryDetailParams.jobId = null
this.queryDetailParams.status = null
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 清空子表数据
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.currentRow = null;
this.queryDetailParams.jobId = null;
// 重新查询主表数据
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
// 只处理主表的多选
if (selection.length > 0 && selection[0].hasOwnProperty('jobDetailId')) {
return;
}
this.ids = selection.map(item => item.jobId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
// 手动完成/作废
handleCompletedManually(row) {
const jobIds = this.ids;
if (jobIds.length === 0) {
this.$modal.msgError('请选择要操作的数据');
return;
}
if (row.type === 'invalid') {
//手动作废
} else if (row.type === 'completed') {
//手动完成
}
},
/** 导出按钮操作 */
handleExport() {
this.download('job/mydoJob/export', {
...this.queryParams
}, `mydoJob_${new Date().getTime()}.xlsx`)
},
/** 行点击事件处理 */
handleRowClick(row) {
// 设置当前选中行
this.currentRow = row;
// 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status = row.status;
// 查询子表格数据
this.getDetailList();
},
/** 查询子任务表列表 */
getDetailList() {
// 如果没有选中的主任务,不加载子任务
if (!this.queryDetailParams.jobId) {
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.detailLoading = false;
return;
}
this.detailLoading = true;
listMydoJobDetail(this.queryDetailParams).then(response => {
this.mydoJobDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
/** 手动完成按钮操作 */
handleManualFinish(row) {
const jobIds = row.jobId || this.ids;
if (jobIds.length === 0) {
this.$modal.msgError('请选择要操作的数据');
return;
}
this.$modal.confirm('是否确认完成任务编号为"' + jobIds + '"的数据项?').then(function () {
return manualFinish(jobIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess('手动完成成功');
}).catch(() => {
});
},
/** 手动作废按钮操作 */
handleManualInvalid(row) {
const jobIds = row.jobId || this.ids;
if (jobIds.length === 0) {
this.$modal.msgError('请选择要操作的数据');
return;
}
this.$modal.confirm('是否确认作废任务编号为"' + jobIds + '"的数据项?').then(function () {
return manualInvalid(jobIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess('手动作废成功');
}).catch(() => {
});
},
}
}
</script>
<style scoped>
.el-table >>> .current-row {
background-color: #f0f9eb;
}
</style>

View File

@@ -0,0 +1,556 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="盘点单据" prop="stockCheckId">
<el-input
v-model="queryParams.stockCheckId"
placeholder="请输入盘点单据号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="盘点类型" prop="checkType">
<el-select v-model="queryParams.checkType" placeholder="请选择盘点类型" clearable>
<el-option
v-for="dict in dict.type.check_stock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.check_bill_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId" placeholder="请选择仓库" clearable>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
:disabled="single"
@click="handleReview"
v-hasPermi="['check:stockCheck:edit']"
>审核</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleAutoAllocation"
v-hasPermi="['check:stockCheck:autoAllocation']"
>自动分配</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleConfirmation"
v-hasPermi="['check:stockCheck:edit']"
>确认</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleInvalidated"
v-hasPermi="['check:stockCheck:edit']"
>作废</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="stockCheckList" @selection-change="handleSelectionChange" @row-click="handleRowClick" max-height="400">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="盘点单据" align="left" prop="stockCheckId" />
<el-table-column label="盘点类型" align="left" prop="checkType">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_stock_type" :value="scope.row.checkType"/>
</template>
</el-table-column>
<el-table-column label="单据状态" align="left" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_bill_status" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column label="仓库" align="left" prop="warehouseName" />-->
<el-table-column label="部门" align="left" prop="departmentName" />
<el-table-column label="创建人" align="left" prop="createManId" />
<!-- <el-table-column label="盘点位置" align="left" prop="spare1" />-->
<el-table-column label="创建时间" align="left" prop="createDate" />
<el-table-column label="完成时间" align="left" prop="finishDate" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="stockCheckDetailList" @selection-change="handleDetailSelectionChange">
<el-table-column label="子单ID" align="left" prop="stockCheckDetailId" width="160" />
<el-table-column label="主单ID" align="left" prop="stockCheckId" width="160" />
<el-table-column label="货位名称" align="left" prop="cargoSpaceName" width="160"/>
<el-table-column label="品号" align="left" prop="productId"/><!--品号-->
<el-table-column label="品名" align="left" prop="productName" width="160"/><!--品号-->
<el-table-column label="批号" align="left" prop="lotNo"/><!--批号-->
<el-table-column label="机型" align="left" prop="unit"/><!--机型-->
<el-table-column label="分销" align="left" prop="spare9"/><!--分销-->
<el-table-column label="规格" align="left" prop="spec"/><!--规格-->
<el-table-column label="型号" align="left" prop="spare1"/><!--型号-->
<el-table-column label="净重" align="left" prop="spare2"/><!--净重-->
<el-table-column label="颜色" align="left" prop="spare3"/><!--颜色-->
<el-table-column label="序列号" align="left" prop="spare4"/><!--序列号-->
<el-table-column label="电压" align="left" prop="spare5"/><!--电压-->
<el-table-column label="功率" align="left" prop="spare6"/><!--功率-->
<el-table-column label="相位" align="left" prop="spare7"/><!--相位-->
<el-table-column label="毛重" align="left" prop="spare8"/><!--毛重-->
<el-table-column label="计划数量" align="right" prop="quantity"/>
<el-table-column label="扫码数量" align="right" prop="scanNum"/>
<el-table-column label="实际数量" align="right" prop="assignNum"/>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
<!-- 审核弹窗 -->
<el-dialog title="审核" :visible.sync="auditDialogVisible" width="500px" append-to-body>
<el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="100px">
<el-form-item label="选择出口" prop="exitId">
<el-select v-model="auditForm.exitId" placeholder="请选择出口" clearable style="width: 100%">
<el-option
v-for="item in exitOptions"
:key="item.exitId"
:label="item.exitName"
:value="item.exitId">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelAudit">取消</el-button>
<el-button type="primary" @click="submitAudit">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listStockCheck, getStockCheck, delStockCheck, addStockCheck, updateStockCheck,autoAllocation } from "@/api/check/stockCheck"
import { listStockCheckDetail } from "@/api/check/stockCheckDetail"
import { listWarehouse } from "@/api/bas/warehouse"
export default {
name: "StockCheck",
dicts: ['check_stock_type', 'check_bill_status'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 仓库选项列表
warehouseOptions: [],
// 盘库单据主信息表格数据
stockCheckList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 明细遮罩层
detailLoading: false,
// 明细选中数组
detailIds: [],
// 明细总条数
detailTotal: 0,
// 明细表格数据
stockCheckDetailList: [],
// 选中数据
selectedRows: [],
// 审核弹窗显示状态
auditDialogVisible: false,
// 审核表单数据
auditForm: {
exitId: null
},
// 审核表单验证规则
auditRules: {
exitId: [
{ required: true, message: '请选择出口', trigger: 'change' }
]
},
// 出口选项(动态设置)
exitOptions: [],
// 所有出口数据(按仓库ID分组)
allExitOptions: {
'01': [
{ exitId: "L2004", exitName: 'L2004' },
{ exitId: 'L2006', exitName: 'L2006' },
]
},
// 当前审核的单据
currentAuditStock: null,
// 明细查询参数
queryDetailParams: {
pageNum: 1,
pageSize: 10,
stockCheckGuid: null,
status: null
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockCheckId: null,
checkType: null,
createDate: null,
createManId: null,
status: null,
warehouseId: null,
finishDate: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null
},
// 表单参数
form: {},
// 表单校验
rules: {
stockCheckId: [
{ required: true, message: "请输入盘点单据ID", trigger: "blur" }
],
checkType: [
{ required: true, message: "请选择盘点类型", trigger: "change" }
],
createDate: [
{ required: true, message: "请选择创建日期", trigger: "blur" }
],
status: [
{ required: true, message: "请选择状态", trigger: "change" }
],
}
}
},
created() {
this.getList();
this.getWarehouseList();
},
methods: {
/** 行点击事件处理 */
handleRowClick(row) {
this.queryDetailParams.stockCheckGuid = row.stockGuid
this.queryDetailParams.status = row.status
this.getDetailList()
},
/** 查询盘库单据主信息列表 */
getList() {
this.loading = true
listStockCheck(this.queryParams).then(response => {
this.stockCheckList = response.rows
this.total = response.total
this.loading = false
// 获取列表后,自动点击第一行数据
if (this.stockCheckList.length > 0) {
this.handleRowClick(this.stockCheckList[0])
}else {
this.stockCheckDetailList = []
this.detailLoading = false
}
})
},
/** 查询仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询明细列表 */
getDetailList() {
this.detailLoading = true
listStockCheckDetail(this.queryDetailParams).then(response => {
this.stockCheckDetailList = response.rows
this.detailTotal = response.total
this.detailLoading = false
})
},
/** 明细多选框选中数据 */
handleDetailSelectionChange(selection) {
this.detailIds = selection.map(item => item.stockCheckDetailId)
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
stockGuid: null,
stockCheckId: null,
checkType: null,
createDate: null,
createManId: null,
status: null,
warehouseId: null,
finishDate: null,
erpBill: null,
stockSource: null,
departmentNo: null,
customerNo: null,
classNo: null,
supplierNo: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
// 清空子表数据和相关状态
this.stockCheckDetailList = []
this.detailTotal = 0
this.queryDetailParams.stockCheckGuid = null
this.queryDetailParams.status = null
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.stockGuid)
this.single = selection.length!==1
this.multiple = !selection.length
if (selection.length === 1) {
this.queryDetailParams.stockCheckGuid = selection[0].stockGuid
this.queryDetailParams.status = selection[0].status
this.getDetailList()
} else {
this.queryDetailParams.stockCheckGuid = null
this.stockCheckDetailList = []
this.detailTotal = 0
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.stockGuid != null) {
updateStockCheck(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addStockCheck(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 作废按钮操作 */
handleInvalidated(row) {
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row.stockGuid || this.ids[0]));
if (stockCheck.status === "1" || stockCheck.status === "2") {
let data = {
"stockGuid": stockCheck.stockGuid,
"status": "5"
}
updateStockCheck(data).then(response => {
this.$modal.msgSuccess('作废成功')
this.getList()
})
} else {
this.$modal.msgError('只有未执行的单据可以作废')
}
},
/** 审核按钮操作 */
handleReview(row) {
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row?.stockGuid || this.ids[0]));
if (stockCheck.status === "2") {
this.$modal.msgError('单据已审核')
return
}
if (stockCheck.status === "1") {
const data = {
"stockGuid": stockCheck.stockGuid,
"status": "2"
}
updateStockCheck(data).then(response => {
this.$modal.msgSuccess('审核成功')
this.getList()
})
} else {
this.$modal.msgError('只有未审核的单据可以审核')
}
},
/** 确认按钮操作 */
handleConfirmation(row) {
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row?.stockGuid || this.ids[0]));
if (stockCheck.status === "3") {
let data = {
"stockGuid": stockCheck.stockGuid,
"status": "4"
}
updateStockCheck(data).then(response => {
this.$modal.msgSuccess('确认成功')
this.getList()
})
} else {
this.$modal.msgError('只有已审核的单据可以确认')
}
},
handleAutoAllocation(row){
if (this.ids.length !== 1){
this.$modal.msgError('只能选择一条记录进行自动分配')
}
const stockCheckData = {
"stockGuid": this.ids[0]
}
autoAllocation(stockCheckData).then(response => {
this.$modal.msgSuccess(response.msg)
this.getList()
})
},
/** 根据仓库ID设置出口选项 */
setExitOptionsByWarehouse(warehouseId) {
try {
console.log('设置出口选项,仓库ID:', warehouseId)
// 如果没有有效的仓库ID,清空出口选项
if (!warehouseId) {
this.exitOptions = []
console.warn('没有找到有效的仓库ID,已清空出口选项')
return
}
// 根据仓库ID获取对应的出口选项
this.exitOptions = this.allExitOptions[warehouseId] || []
// 如果没有对应key的默认为空数组,并给出提示
if (!this.allExitOptions[warehouseId]) {
console.warn(`仓库ID ${warehouseId} 没有配置出口选项,已设置为空数组`)
}
console.log('可用出口:', this.exitOptions)
// 如果最终没有可用的出口选项,给出提示
if (this.exitOptions.length === 0) {
//console.warn('当前仓库没有可用的出口选项')
this.exitOptions=[{exitId: '0', exitName: '默认出口'}]
}
} catch (error) {
console.error('设置出口选项时发生错误:', error)
// 发生错误时,设置为空数组,确保不会影响用户操作
this.exitOptions = []
}
},
/** 提交审核 */
submitAudit() {
this.$refs["auditForm"].validate(valid => {
if (valid) {
const data = {
"stockGuid": this.currentAuditStock.stockGuid,
"status": "2"
}
updateStockCheck(data).then(response => {
this.$modal.msgSuccess('审核成功')
this.auditDialogVisible = false
this.getList()
})
}
})
},
/** 取消审核 */
cancelAudit() {
this.auditDialogVisible = false
this.auditForm.exitId = null
this.currentAuditStock = null
}
}
}
</script>
<style scoped>
.el-form-item >>> .el-form-item__label {
white-space: nowrap;
width: auto;
min-width: fit-content;
}
</style>