feat(产品选择): 新增产品快速添加功能并优化展示
- 在产品选择和原材料选择组件中新增快速添加功能 - 移除产品编号搜索字段,将规格信息显示在标题中 - 优化卡片信息布局为网格显示 - 在空数据提示中添加快速新增链接 - 删除不再使用的半成品视图文件
This commit is contained in:
@@ -14,10 +14,10 @@
|
||||
@close="handleClose">
|
||||
<!-- 搜索区域 -->
|
||||
<el-form :inline="true" :model="queryParams" class="search-form" size="small">
|
||||
<el-form-item label="产品编号">
|
||||
<!-- <el-form-item label="产品编号">
|
||||
<el-input v-model="queryParams.productCode" placeholder="请输入产品编号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称">
|
||||
<MemoInput storageKey="productName" v-model="queryParams.productName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -45,6 +45,7 @@
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleAdd" title="添加产品">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -67,10 +68,9 @@
|
||||
<div class="card-content">
|
||||
<div class="card-title">
|
||||
<span class="name">{{ item.productName }}</span>
|
||||
<span class="code">[{{ item.productCode }}]</span>
|
||||
<span class="code">[{{ item.specification || '-' }}]</span>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<div class="info-item">规格:<span>{{ item.specification || '-' }}</span></div>
|
||||
<div class="info-item">材质:<span>{{ item.material || '-' }}</span></div>
|
||||
<div class="info-item">厂家:<span>{{ item.manufacturer || '-' }}</span></div>
|
||||
<div class="info-item">表面处理:<span>{{ item.surfaceTreatmentDesc || '-' }}</span></div>
|
||||
@@ -81,7 +81,8 @@
|
||||
|
||||
<!-- 空数据提示 -->
|
||||
<div class="empty-tip" v-if="productList.length === 0 && !loading">
|
||||
暂无匹配的产品数据
|
||||
暂无匹配的产品数据,
|
||||
<span @click="handleAdd" style="cursor: pointer; color: #409eff;">点击快速新增产品</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,12 +93,58 @@
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改产品对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="400px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="产品编号" prop="productCode">
|
||||
<el-input v-model="form.productCode" placeholder="请输入产品编号" />
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="产品名称" prop="productName">
|
||||
<el-input v-model="form.productName" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="负责人" prop="owner">
|
||||
<el-input v-model="form.owner" :multiple="false" placeholder="请填写负责人" />
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="材质" prop="material">
|
||||
<el-input v-model="form.material" placeholder="请输入材质" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="厂家" prop="manufacturer">
|
||||
<el-input v-model="form.manufacturer" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="表面处理" prop="surfaceTreatmentDesc">
|
||||
<el-input v-model="form.surfaceTreatmentDesc" placeholder="请输入表面处理" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="镀层质量" prop="zincLayer">
|
||||
<el-input v-model="form.zincLayer" placeholder="请输入镀层质量" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProduct, getProduct } from '@/api/wms/product';
|
||||
import { listProduct, getProduct, addProduct } from '@/api/wms/product';
|
||||
import MemoInput from '@/components/MemoInput/index.vue';
|
||||
|
||||
export default {
|
||||
@@ -124,6 +171,21 @@ export default {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
productList: [],
|
||||
open: false,
|
||||
form: {},
|
||||
rules: {
|
||||
productName: [
|
||||
{ required: true, message: "产品名称不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "计量单位不能为空", trigger: "blur" }
|
||||
],
|
||||
specification: [
|
||||
{ required: true, message: "规格不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
buttonLoading: false,
|
||||
title: '新增产品',
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -270,7 +332,81 @@ export default {
|
||||
handleClose() {
|
||||
this.selectedId = this.value || '';
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
// this.reset();
|
||||
this.form = { ...this.queryParams };
|
||||
this.open = true;
|
||||
this.title = "添加产品";
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
|
||||
if (this.form.productId != null) {
|
||||
updateProduct(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addProduct({
|
||||
...this.form,
|
||||
productCode: this.form.material || '' + (this.form.zincLayer || '') + new Date().getTime(),
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
productId: undefined,
|
||||
productCode: undefined,
|
||||
productName: undefined,
|
||||
owner: undefined,
|
||||
baseMaterialId: undefined,
|
||||
surfaceTreatmentId: undefined,
|
||||
customerReqId: undefined,
|
||||
packagingId: undefined,
|
||||
thickness: undefined,
|
||||
width: undefined,
|
||||
innerDiameter: undefined,
|
||||
isEnabled: undefined,
|
||||
unit: '卷',
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined,
|
||||
type: undefined,
|
||||
specification: undefined,
|
||||
material: undefined,
|
||||
manufacturer: undefined,
|
||||
surfaceTreatmentDesc: undefined,
|
||||
zincLayer: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.listRecentlySelected();
|
||||
@@ -365,9 +501,9 @@ export default {
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
@close="handleClose" append-to-body>
|
||||
<!-- 搜索区域 -->
|
||||
<el-form :inline="true" :model="queryParams" class="search-form" size="small">
|
||||
<el-form-item label="编号">
|
||||
<el-input v-model="queryParams.rawMaterialCode" placeholder="请输入原材料编号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称">
|
||||
<MemoInput storageKey="productName" v-model="queryParams.rawMaterialName" placeholder="请输入原材料名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -45,6 +41,7 @@
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -67,10 +64,9 @@
|
||||
<div class="card-content">
|
||||
<div class="card-title">
|
||||
<span class="name">{{ item.rawMaterialName }}</span>
|
||||
<span class="code">[{{ item.rawMaterialCode }}]</span>
|
||||
<span class="code">[{{ item.specification || '-' }}]</span>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<div class="info-item">规格:<span>{{ item.specification || '-' }}</span></div>
|
||||
<div class="info-item">材质:<span>{{ item.material || '-' }}</span></div>
|
||||
<div class="info-item">厂家:<span>{{ item.manufacturer || '-' }}</span></div>
|
||||
<div class="info-item">表面处理:<span>{{ item.surfaceTreatmentDesc || '-' }}</span></div>
|
||||
@@ -81,7 +77,8 @@
|
||||
|
||||
<!-- 空数据提示 -->
|
||||
<div class="empty-tip" v-if="rawMaterialList.length === 0 && !loading">
|
||||
暂无匹配的原材料数据
|
||||
暂无匹配的原材料数据,
|
||||
<span @click="handleAdd" style="cursor: pointer; color: #409eff;">点击快速新增原材料</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -93,11 +90,48 @@
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改原材料对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="400px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<!-- <el-form-item label="原材料编号" prop="rawMaterialCode">
|
||||
<el-input v-model="form.rawMaterialCode" placeholder="请输入原材料编号" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="原材料名称" prop="rawMaterialName">
|
||||
<el-input v-model="form.rawMaterialName" placeholder="请输入原材料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="材质" prop="material">
|
||||
<el-input v-model="form.material" placeholder="请输入材质" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="厂家" prop="manufacturer">
|
||||
<el-input v-model="form.manufacturer" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="表面处理" prop="surfaceTreatmentDesc">
|
||||
<el-input v-model="form.surfaceTreatmentDesc" placeholder="请输入表面处理" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="镀层质量" prop="zincLayer">
|
||||
<el-input v-model="form.zincLayer" placeholder="请输入镀层质量" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRawMaterial, getRawMaterial } from '@/api/wms/rawMaterial';
|
||||
import { listRawMaterial, getRawMaterial, updateRawMaterial, addRawMaterial } from '@/api/wms/rawMaterial';
|
||||
import MemoInput from '@/components/MemoInput/index.vue'
|
||||
|
||||
export default {
|
||||
@@ -143,7 +177,30 @@ export default {
|
||||
},
|
||||
// ✅ 单选核心变量:选中的ID和单条数据对象
|
||||
selectedId: '',
|
||||
selectedRow: {}
|
||||
selectedRow: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
// rawMaterialCode: [
|
||||
// { required: true, message: "原材料编号不能为空", trigger: "blur" }
|
||||
// ],
|
||||
rawMaterialName: [
|
||||
{ required: true, message: "原材料名称不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "计量单位不能为空", trigger: "blur" }
|
||||
],
|
||||
specification: [
|
||||
{ required: true, message: "规格不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
// 提交按钮加载状态
|
||||
buttonLoading: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -187,6 +244,91 @@ export default {
|
||||
return this.selectedId === rawMaterialId;
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
rawMaterialId: undefined,
|
||||
rawMaterialCode: undefined,
|
||||
rawMaterialName: undefined,
|
||||
steelGrade: undefined,
|
||||
targetColdGrade: undefined,
|
||||
baseMaterialId: undefined,
|
||||
surfaceTreatmentId: undefined,
|
||||
thickness: undefined,
|
||||
thicknessDeviation: undefined,
|
||||
width: undefined,
|
||||
targetColdWidth: undefined,
|
||||
targetColdThickness: undefined,
|
||||
crown: undefined,
|
||||
coilWeight: undefined,
|
||||
surfaceQuality: undefined,
|
||||
hardnessHv5: undefined,
|
||||
hardnessDiff: undefined,
|
||||
compositionMn: undefined,
|
||||
compositionP: undefined,
|
||||
grainSize: undefined,
|
||||
headTailCutFlag: undefined,
|
||||
inspectionResult: undefined,
|
||||
isEnabled: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined,
|
||||
specification: undefined,
|
||||
unit: '卷',
|
||||
material: undefined,
|
||||
manufacturer: undefined,
|
||||
surfaceTreatmentDesc: undefined,
|
||||
zincLayer: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
// this.reset();
|
||||
this.form = { ...this.queryParams };
|
||||
this.open = true;
|
||||
this.title = "添加原材料";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.rawMaterialId != null) {
|
||||
updateRawMaterial({
|
||||
...this.form,
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$store.dispatch('category/getRawMaterialMap');
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addRawMaterial({
|
||||
...this.form,
|
||||
rawMaterialCode: this.form.material || '' + (this.form.zincLayer || '') + new Date().getTime(),
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$store.dispatch('category/getRawMaterialMap');
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取最近选择的原材料数据
|
||||
async listRecentlySelected() {
|
||||
try {
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
<PlanList ref="planList" @select="handlePlanSelect"/>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="19">
|
||||
<el-card>
|
||||
<el-col :span="19" style="height: calc(100vh - 124px); overflow-y: scroll;">
|
||||
<el-card v-if="!selectedPlan">
|
||||
<el-empty description="请先选择发货计划" />
|
||||
</el-card>
|
||||
<el-card v-else>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="发货单名称" prop="waybillName">
|
||||
@@ -25,6 +28,12 @@
|
||||
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-descriptions :column="2" :data="queryParams" border>
|
||||
<el-descriptions-item label="单据总数">{{ deliveryCountTotal }}</el-descriptions-item>
|
||||
<el-descriptions-item label="已发数量">{{ deliveryCountFinished }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" border :data="deliveryWaybillList" highlight-current-row
|
||||
@@ -199,6 +208,16 @@ export default {
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
computed: {
|
||||
/** 计算已发货数量 */
|
||||
deliveryCountFinished() {
|
||||
return this.deliveryWaybillList.filter(row => row.status === 1 || row.status === 2).length;
|
||||
},
|
||||
/** 计算总数量 */
|
||||
deliveryCountTotal() {
|
||||
return this.deliveryWaybillList.length;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询发货单列表 */
|
||||
getList() {
|
||||
|
||||
@@ -1,411 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="半成品编号" prop="productCode">
|
||||
<el-input
|
||||
v-model="queryParams.productCode"
|
||||
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="salesManager">
|
||||
<el-input v-model="queryParams.owner" :multiple="false" placeholder="请填写负责人" />
|
||||
</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"
|
||||
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<KLPTable v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="半成品类型编号" align="center" prop="productCode" />
|
||||
<el-table-column label="半成品类型名称" align="center" prop="productName" />
|
||||
<el-table-column label="负责人" align="center" prop="owner" />
|
||||
<!-- <el-table-column label="基础材质" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CategoryRenderer :category-id="scope.row.baseMaterialId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="表面处理" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CategoryRenderer :category-id="scope.row.surfaceTreatmentId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户需求" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CategoryRenderer :category-id="scope.row.customerReqId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包装方式" align="center">
|
||||
<template slot-scope="scope">
|
||||
<CategoryRenderer :category-id="scope.row.packagingId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="厚度" align="center" prop="thickness" />
|
||||
<el-table-column label="宽度" align="center" prop="width" />
|
||||
<el-table-column label="内径" align="center" prop="innerDiameter" /> -->
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<!-- <el-table-column label="是否启用" align="center" prop="isEnabled">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.common_swicth" :value="scope.row.isEnabled"/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="参数" align="center">
|
||||
<template slot-scope="scope">
|
||||
<BomInfoMini :bomId="scope.row.bomId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-document"
|
||||
@click="goLedger(scope.row)"
|
||||
>台账</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-data-analysis"
|
||||
@click="handleBom(scope.row)"
|
||||
>参数</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</KLPTable>
|
||||
|
||||
<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="400px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<!-- <el-divider>基础信息</el-divider> -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="半成品编号" prop="productCode">
|
||||
<el-input v-model="form.productCode" placeholder="请输入半成品编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="半成品名称" prop="productName">
|
||||
<el-input v-model="form.productName" placeholder="请输入半成品名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人" prop="owner">
|
||||
<el-input v-model="form.owner" :multiple="false" placeholder="请填写负责人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-dialog title="参数" @close="bomDialogVisible = false" :visible.sync="bomDialogVisible" width="600px" append-to-body>
|
||||
<BomPanel :id="bomId" type="product" @addBom="handleAddBom" :itemId="itemId" />
|
||||
</el-dialog> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/wms/product";
|
||||
import CategoryRenderer from '@/components/KLPService/Renderer/CategoryRenderer.vue';
|
||||
import UserSelect from '@/components/KLPService/UserSelect';
|
||||
// import BomPanel from '../bom/components/BomPanel.vue';
|
||||
import BomInfoMini from '@/components/KLPService/Renderer/BomInfoMini.vue';
|
||||
|
||||
export default {
|
||||
name: "Product",
|
||||
components: {
|
||||
CategoryRenderer,
|
||||
UserSelect,
|
||||
// BomPanel,
|
||||
BomInfoMini
|
||||
},
|
||||
dicts: ['common_swicth'],
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 半成品表格数据
|
||||
productList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
type: 'semi',
|
||||
productCode: undefined,
|
||||
productName: undefined,
|
||||
owner: undefined,
|
||||
baseMaterialId: undefined,
|
||||
surfaceTreatmentId: undefined,
|
||||
customerReqId: undefined,
|
||||
packagingId: undefined,
|
||||
thickness: undefined,
|
||||
width: undefined,
|
||||
innerDiameter: undefined,
|
||||
isEnabled: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
productCode: [
|
||||
{ required: true, message: "半成品编号不能为空", trigger: "blur" }
|
||||
],
|
||||
productName: [
|
||||
{ required: true, message: "半成品名称不能为空", trigger: "blur" }
|
||||
],
|
||||
owner: [
|
||||
{ required: true, message: "负责人不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
bomDialogVisible: false,
|
||||
bomId: undefined,
|
||||
itemId: undefined,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询半成品列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listProduct(this.queryParams).then(response => {
|
||||
this.productList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAddBom(bom) {
|
||||
this.bomId = bom.bomId;
|
||||
this.getList();
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
productId: undefined,
|
||||
productCode: undefined,
|
||||
productName: undefined,
|
||||
owner: undefined,
|
||||
baseMaterialId: undefined,
|
||||
surfaceTreatmentId: undefined,
|
||||
customerReqId: undefined,
|
||||
packagingId: undefined,
|
||||
thickness: undefined,
|
||||
width: undefined,
|
||||
innerDiameter: undefined,
|
||||
isEnabled: undefined,
|
||||
unit: '卷',
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined,
|
||||
type: 'semi'
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
goLedger(row) {
|
||||
this.$router.push({
|
||||
path: '/wms/ledger',
|
||||
query: {
|
||||
itemId: row.productId,
|
||||
itemType: 'product'
|
||||
}
|
||||
})
|
||||
},
|
||||
handleBom(row) {
|
||||
this.bomDialogVisible = true;
|
||||
this.bomId = row.bomId;
|
||||
this.itemId = row.productId;
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.productId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加半成品";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const productId = row.productId || this.ids
|
||||
getProduct(productId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改半成品";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.productId != null) {
|
||||
updateProduct(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$store.dispatch('category/getProductMap');
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addProduct(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$store.dispatch('category/getProductMap');
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const productIds = row.productId || this.ids;
|
||||
this.$modal.confirm('是否确认删除半成品编号为"' + productIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delProduct(productIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$store.dispatch('category/getProductMap');
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('wms/product/export', {
|
||||
...this.queryParams
|
||||
}, `product_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user