From 1d5c8878e1d9be0f2174c5a9e396463e15187ae4 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 17 Jan 2026 10:24:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(recordInbound):=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95=E8=A1=A8=E5=8D=95=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=92=8C=E5=AD=97=E6=AE=B5=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换物料编码输入组件为禁用状态的文本输入框 - 为表单添加验证规则和字段名配置 - 添加提交按钮并实现表单验证功能 - 清理无用代码和注释 --- .../recordInbound/index.vue | 147 ++++++++++-------- 1 file changed, 83 insertions(+), 64 deletions(-) diff --git a/pages/materialManagement/recordInbound/index.vue b/pages/materialManagement/recordInbound/index.vue index d40b4cc..408cf53 100644 --- a/pages/materialManagement/recordInbound/index.vue +++ b/pages/materialManagement/recordInbound/index.vue @@ -14,18 +14,24 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + + @@ -119,88 +126,100 @@ export default { return { // 基础表单数据 baseFormData: { - name: "", - age: "", - introduction: "", - sex: 2, - hobby: [5], - datetimesingle: 1627529992399, + materialCode: "", + materialName: "", + type: "", + transportType: "", + supplierName: "", + locationCode: "", + locationName: "", + warehouseCode: "", + quantity: null, + batchNo: "", + stoveCode: "", + operator: "", }, // 校验表单数据 valiFormData: { - name: "", - age: "", - introduction: "", + materialCode: "", + locationCode: "", + warehouseCode: "", + transportType: "", + quantity: "", + batchNo: "", }, // 校验规则 rules: { - name: { + materialCode: { rules: [ { required: true, - errorMessage: "姓名不能为空", + errorMessage: "物料编码不能为空", }, ], }, - age: { + locationCode: { rules: [ { required: true, - errorMessage: "年龄不能为空", + errorMessage: "库位编码不能为空", + }, + ], + }, + warehouseCode: { + rules: [ + { + required: true, + errorMessage: "仓库编码不能为空", + }, + ], + }, + transportType: { + rules: [ + { + required: true, + errorMessage: "入库类型不能为空", + }, + ], + }, + quantity: { + rules: [ + { + required: true, + errorMessage: "入库数量不能为空", }, { format: "number", - errorMessage: "年龄只能输入数字", + errorMessage: "入库数量只能输入数字", + }, + ], + }, + batchNo: { + rules: [ + { + required: true, + errorMessage: "批次号不能为空", }, ], }, }, - candidates: ['北京', '南京', '东京', '武汉', '天津', '上海', '海口'], + // candidates: ['北京', '南京', '东京', '武汉', '天津', '上海', '海口'], }; }, - computed: { - // 处理表单排列切换 - alignment() { - if (this.current === 0) return "left"; - if (this.current === 1) return "top"; - return "left"; - }, - }, + computed: {}, onLoad() {}, onReady() {}, methods: { - onClickItem(e) { - console.log(e); - this.current = e.currentIndex; - }, - add() { - this.dynamicLists.push({ - label: "域名", - rules: [ - { - required: true, - errorMessage: "域名项必填", - }, - ], - id: Date.now(), - }); - }, - del(id) { - let index = this.dynamicLists.findIndex((v) => v.id === id); - this.dynamicLists.splice(index, 1); - }, + // 提交表单 submit(ref) { - this.$refs[ref] + this.$refs.baseForm .validate() .then((res) => { - console.log("success", res); - uni.showToast({ - title: `校验通过`, - }); + console.log("表单数据信息:", res); }) .catch((err) => { - console.log("err", err); + console.log("表单错误信息:", err); }); }, },