From 2d7587fa8c01613ca7f04febe6151fff71359710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=AB=E7=8C=ABguowen?= <9290821+guowen-the-cat@user.noreply.gitee.com> Date: Wed, 17 Sep 2025 16:22:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E6=9D=A1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/bas/BasProductCode/index.vue | 165 +++++++++++++++++- 1 file changed, 159 insertions(+), 6 deletions(-) diff --git a/ruoyi-ui/src/views/bas/BasProductCode/index.vue b/ruoyi-ui/src/views/bas/BasProductCode/index.vue index 9fd9a2f..0116889 100644 --- a/ruoyi-ui/src/views/bas/BasProductCode/index.vue +++ b/ruoyi-ui/src/views/bas/BasProductCode/index.vue @@ -20,6 +20,8 @@ v-model="form[field.prop]" :placeholder="field.placeholder" :disabled="loading" + :readonly="field.readonly" + @click.native="field.prop === 'spare4' && openProductSelect()" /> @@ -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;" > + + + +
+ + + + + + + + + 搜索 + 重置 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -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; }