物料条码

This commit is contained in:
猫猫guowen
2025-09-17 16:22:35 +08:00
parent c57b88b9a8
commit 2d7587fa8c

View File

@@ -20,6 +20,8 @@
v-model="form[field.prop]"
:placeholder="field.placeholder"
:disabled="loading"
:readonly="field.readonly"
@click.native="field.prop === 'spare4' && openProductSelect()"
/>
</el-form-item>
</el-col>
@@ -200,7 +202,7 @@
@selection-change="handleSelectionChange"
stripe
border
style="width: 100%;margin-bottom: 40px;height: 550px;"
style="width: 100%;margin-bottom: 40px;height: 575px;"
>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
@@ -231,6 +233,98 @@
</div>
</el-col>
</el-row>
<!-- 物资选择弹框 -->
<el-dialog
title="选择物资"
:visible.sync="productSelectVisible"
width="800px"
append-to-body
>
<div class="search-container">
<el-form :model="productQueryParams" ref="queryForm" :inline="true">
<el-form-item label="物料编码" prop="productId">
<el-input
v-model="productQueryParams.productId"
placeholder="请输入物料编码"
clearable
size="small"
@keyup.enter.native="handleProductQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="productName">
<el-input
v-model="productQueryParams.productName"
placeholder="请输入物料名称"
clearable
size="small"
@keyup.enter.native="handleProductQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleProductQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetProductQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-table
v-loading="productTableLoading"
:data="productTableData"
@row-click="handleProductSelect"
highlight-current-row
style="width: 100%"
>
<el-table-column type="index" width="50" align="center" />
<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="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="productTotal > 0"
:total="productTotal"
:page.sync="productQueryParams.pageNum"
:limit.sync="productQueryParams.pageSize"
@pagination="getProductList"
/>
</el-dialog>
</div>
</template>
@@ -238,10 +332,11 @@
import VueQr from 'vue-qr'
import VueEasyPrint from 'vue-easy-print'
import {addBasProductCode, delBasProductCode, listBasProductCode, updateBasProductCode} from "@/api/bas/BasProductCode"
import { listBasProduct } from "@/api/bas/BasProduct"
// 常量配置
const FORM_FIELDS = [
{ prop: 'spare4', label: '品号', placeholder: '请输入品号', required: true },
{ prop: 'spare4', label: '品号', placeholder: '点击选择品号', required: true, readonly: true },
{ prop: 'model', label: '型号', placeholder: '请输入型号', required: true },
{ prop: 'serial', label: '序列号', placeholder: '请输入序列号', required: true },
{ prop: 'color', label: '颜色', placeholder: '请输入颜色', required: true },
@@ -338,7 +433,22 @@ export default {
// 表单字段配置
formFields: FORM_FIELDS,
// 表格列配置
tableColumns: TABLE_COLUMNS
tableColumns: TABLE_COLUMNS,
// 物资选择弹框显示状态
productSelectVisible: false,
// 物资查询参数
productQueryParams: {
pageNum: 1,
pageSize: 10,
productId: undefined,
productName: undefined
},
// 物资表格数据
productTableData: [],
// 物资表格加载状态
productTableLoading: false,
// 物资总条数
productTotal: 0
}
},
computed: {
@@ -561,6 +671,50 @@ export default {
this.selectedRows = selection
},
// 打开物资选择弹框
openProductSelect() {
this.productSelectVisible = true;
this.getProductList();
},
// 获取物资列表
async getProductList() {
this.productTableLoading = true;
try {
const response = await listBasProduct(this.productQueryParams);
this.productTableData = response.rows || [];
this.productTotal = response.total || 0;
} catch (error) {
this.$message.error('获取物资数据失败:' + error.message);
} finally {
this.productTableLoading = false;
}
},
// 物资查询按钮操作
handleProductQuery() {
this.productQueryParams.pageNum = 1;
this.getProductList();
},
// 重置物资查询表单
resetProductQuery() {
this.$refs.queryForm.resetFields();
this.productQueryParams = {
pageNum: 1,
pageSize: 10,
productId: undefined,
productName: undefined
};
this.getProductList();
},
// 选择物资
handleProductSelect(row) {
this.form.spare4 = row.productId;
this.productSelectVisible = false;
},
// 二维码编码方法
procode(text) {
const key = "0"
@@ -659,7 +813,7 @@ export default {
}
.form-container {
margin-bottom: 20px;
margin-bottom: 0px;
}
.preview-container {
@@ -733,11 +887,10 @@ export default {
/* 表单样式 */
.form-container .el-form {
padding: 0 20px 20px;
padding: 0 20px 10px;
}
.form-actions {
margin-top: 20px;
text-align: center;
}