refactor(ui): 优化按钮事件处理及表格列显示
修复按钮事件冒泡问题,移除未使用的表格列和代码 清理库存管理页面冗余状态和表单校验逻辑
This commit is contained in:
@@ -96,19 +96,19 @@
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-check"
|
||||
@click="handleApprove(scope.row)"
|
||||
@click.stop="handleApprove(scope.row)"
|
||||
>审批</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
@click.stop="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
@click.stop="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<el-table-column label="卷号" align="center" prop="coilDetail.currentCoilNo"
|
||||
:show-overflow-tooltip="true" />
|
||||
<el-table-column label="质量状态" align="center" prop="coilDetail.qualityStatus" />
|
||||
<el-table-column label="打包状态" align="center" prop="coilDetail.packingStatus" />
|
||||
<!-- <el-table-column label="打包状态" align="center" prop="coilDetail.packingStatus" /> -->
|
||||
<el-table-column label="切边要求" align="center" prop="coilDetail.edgeRequirement" />
|
||||
<el-table-column label="包装要求" align="center" prop="coilDetail.packagingRequirement" />
|
||||
<el-table-column label="存储位置" align="center" prop="coilDetail.actualWarehouseName" width="120"
|
||||
@@ -97,7 +97,7 @@
|
||||
<el-table-column label="物料" align="center" prop="coilDetail.itemName" width="100" />
|
||||
<el-table-column label="规格" align="center" prop="coilDetail.specification" width="100" />
|
||||
<el-table-column label="材质" align="center" prop="coilDetail.material" />
|
||||
<el-table-column label="厂家" align="center" prop="coilDetail.manufacturer" />
|
||||
<!-- <el-table-column label="厂家" align="center" prop="coilDetail.manufacturer" /> -->
|
||||
<!-- <el-table-column label="重量(t)" align="center" prop="coilDetail.netWeight" width="100" /> -->
|
||||
<el-table-column label="库区" align="center" prop="coilDetail.warehouseName" width="120"
|
||||
:show-overflow-tooltip="true" />
|
||||
|
||||
@@ -115,12 +115,6 @@ export default {
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
@@ -146,31 +140,6 @@ export default {
|
||||
warehouseType: 'real',
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
warehouseId: [
|
||||
{ required: true, message: "仓库/库区/库位ID不能为空", trigger: "blur" }
|
||||
],
|
||||
itemType: [
|
||||
{ required: true, message: "物品类型不能为空", trigger: "change" }
|
||||
],
|
||||
itemId: [
|
||||
{ required: true, message: "物品ID不能为空", trigger: "blur" }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: "库存数量不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "单位不能为空", trigger: "blur" }
|
||||
],
|
||||
batchNo: [
|
||||
{ required: true, message: "批次号不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
// 暂存用于创建出库单或移库单的数据
|
||||
stockBoxData: [],
|
||||
// 选中的数据
|
||||
selectedRows: [],
|
||||
// 钻取相关数据
|
||||
drillDownVisible: false,
|
||||
dialogTitle: '',
|
||||
@@ -270,11 +239,6 @@ export default {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
@@ -304,78 +268,12 @@ export default {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.selectedRows = selection;
|
||||
this.ids = selection.map(item => item.stockId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.stockId != null) {
|
||||
updateStock(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addStock(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const stockIds = row.stockId || this.ids;
|
||||
this.$modal.confirm('是否确认删除库存:原材料/产品与库区/库位的存放关系编号为"' + stockIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delStock(stockIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('wms/stock/export', {
|
||||
...this.queryParams
|
||||
}, `stock_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleStockBox() {
|
||||
// 添加到暂存单据中,并且去重,去重依据为stockId是否相同
|
||||
const list = [...this.selectedRows, ...this.stockBoxData];
|
||||
const uniqueStockBoxData = list.filter((item, index, self) =>
|
||||
index === self.findIndex(t => t.stockId === item.stockId)
|
||||
);
|
||||
this.stockBoxData = uniqueStockBoxData;
|
||||
|
||||
this.$modal.msgSuccess("暂存成功,请点击“暂存单据”按钮生成单据");
|
||||
},
|
||||
handleGenerateBill(data) {
|
||||
addStockIoWithDetail(data).then(response => {
|
||||
this.$modal.msgSuccess("生成单据成功");
|
||||
});
|
||||
},
|
||||
handleViewStockBox() {
|
||||
// 查看暂存单据
|
||||
this.stockBoxVisible = true;
|
||||
},
|
||||
/** 处理表格行点击 */
|
||||
handleTableRowClick(row) {
|
||||
this.handleDrillDown(row);
|
||||
@@ -411,7 +309,7 @@ export default {
|
||||
'未知物料';
|
||||
|
||||
// 设置对话框标题
|
||||
this.dialogTitle = `${row.itemType === 'product' ? '成品' : '原材料'}库存明细 - ${this.drillDownParams.itemName}`;
|
||||
this.dialogTitle = `${row.itemType === 'product' ? '成品' : '原材料'}库存明细`;
|
||||
|
||||
// 打开弹窗
|
||||
this.drillDownVisible = true;
|
||||
|
||||
Reference in New Issue
Block a user