From e0fc742ce655e913ff995a7e39a253e7ddc5cdc2 Mon Sep 17 00:00:00 2001
From: ll <1079863556@qq.com>
Date: Mon, 14 Jul 2025 17:29:12 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E7=89=A9=E8=B4=A8=E7=9F=AB=E6=AD=A3?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=AD=A3=EF=BC=8C?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=83=8E=E6=AC=A1=E7=9F=AB=E6=AD=A3=E7=95=8C?=
=?UTF-8?q?=E9=9D=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=A7=B0=E9=87=8D=E7=9F=AB?=
=?UTF-8?q?=E6=AD=A3=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dryMatterCorrection.js | 6 +-
src/api/parityCorrection/parityCorrection.js | 46 +++
src/api/weightCorrection/weightCorrection.js | 44 +++
.../dryMatterCorrection/index.vue | 189 ++++++++----
.../parityCorrection/index.vue | 59 ++++
.../weightCorrection/index.vue | 292 ++++++++++++++++++
6 files changed, 565 insertions(+), 71 deletions(-)
create mode 100644 src/api/parityCorrection/parityCorrection.js
create mode 100644 src/api/weightCorrection/weightCorrection.js
create mode 100644 src/views/parityCorrection/parityCorrection/index.vue
create mode 100644 src/views/weightCorrection/weightCorrection/index.vue
diff --git a/src/api/dryMatterCorrection/dryMatterCorrection.js b/src/api/dryMatterCorrection/dryMatterCorrection.js
index 9018311..77f69e3 100644
--- a/src/api/dryMatterCorrection/dryMatterCorrection.js
+++ b/src/api/dryMatterCorrection/dryMatterCorrection.js
@@ -5,9 +5,7 @@ export function listDryMatterCorrection(query) {
return request({
url: '/dryMatterCorrection/dryMatterCorrection/list',
method: 'get',
- params: {
- datetime: query.datetime // 只传递年月参数
- }
+ params: query
})
}
@@ -43,4 +41,4 @@ export function delDryMatterCorrection(id) {
url: '/dryMatterCorrection/dryMatterCorrection/' + id,
method: 'delete'
})
-}
\ No newline at end of file
+}
diff --git a/src/api/parityCorrection/parityCorrection.js b/src/api/parityCorrection/parityCorrection.js
new file mode 100644
index 0000000..788539b
--- /dev/null
+++ b/src/api/parityCorrection/parityCorrection.js
@@ -0,0 +1,46 @@
+// import request from '@/utils/request'
+
+// // 查询胎次校正列表
+// export function listParityCorrection(query) {
+// return request({
+// url: '/parityCorrection/parityCorrection/list',
+// method: 'get',
+// params: query
+// })
+// }
+
+// // 查询胎次校正详细
+// export function getParityCorrection(id) {
+// return request({
+// url: '/parityCorrection/parityCorrection/' + id,
+// method: 'get'
+// })
+// }
+
+// // 新增胎次校正
+// export function addParityCorrection(data) {
+// return request({
+// url: '/parityCorrection/parityCorrection',
+// method: 'post',
+// data: data
+// })
+// }
+
+// // 修改胎次校正
+// export function updateParityCorrection(data) {
+// return request({
+// url: '/parityCorrection/parityCorrection',
+// method: 'put',
+// data: data
+// })
+// }
+
+// // 删除胎次校正
+// export function delParityCorrection(id) {
+// return request({
+// url: '/parityCorrection/parityCorrection/' + id,
+// method: 'delete'
+// })
+// }
+// 可以保留空文件或删除此文件
+// 因为前端不再需要调用后端API
\ No newline at end of file
diff --git a/src/api/weightCorrection/weightCorrection.js b/src/api/weightCorrection/weightCorrection.js
new file mode 100644
index 0000000..c804f8f
--- /dev/null
+++ b/src/api/weightCorrection/weightCorrection.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询称重校正列表
+export function listWeightCorrection(query) {
+ return request({
+ url: '/weightCorrection/weightCorrection/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询称重校正详细
+export function getWeightCorrection(id) {
+ return request({
+ url: '/weightCorrection/weightCorrection/' + id,
+ method: 'get'
+ })
+}
+
+// 新增称重校正
+export function addWeightCorrection(data) {
+ return request({
+ url: '/weightCorrection/weightCorrection',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改称重校正
+export function updateWeightCorrection(data) {
+ return request({
+ url: '/weightCorrection/weightCorrection',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除称重校正
+export function delWeightCorrection(id) {
+ return request({
+ url: '/weightCorrection/weightCorrection/' + id,
+ method: 'delete'
+ })
+}
diff --git a/src/views/dryMatterCorrection/dryMatterCorrection/index.vue b/src/views/dryMatterCorrection/dryMatterCorrection/index.vue
index fedf5dc..b0eaa63 100644
--- a/src/views/dryMatterCorrection/dryMatterCorrection/index.vue
+++ b/src/views/dryMatterCorrection/dryMatterCorrection/index.vue
@@ -4,11 +4,21 @@
+
+
+
+
+
搜索
重置
@@ -57,23 +67,31 @@
-
-
-
+
+
+
+
- {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}
+ {{ parseTime(scope.row.datetime, '{y}-{m}') }}
+
+
+
+
+
-
-
-
+
- {{ calculateCoefficient(scope.row.content, scope.row.standard) }}
+ {{ scope.row.coefficient != null ? scope.row.coefficient.toFixed(4) : '' }}
-
+
修改
删除
@@ -91,28 +109,35 @@
-
+
+ type="month"
+ value-format="YYYY-MM"
+ placeholder="请选择年月"
+ style="width: 100%">
-
-
+
+
+
-
+
-
+
-
-
+
+
@@ -129,6 +154,7 @@
import { listDryMatterCorrection, getDryMatterCorrection, delDryMatterCorrection, addDryMatterCorrection, updateDryMatterCorrection } from "@/api/dryMatterCorrection/dryMatterCorrection"
const { proxy } = getCurrentInstance()
+const { da_ranch } = proxy.useDict('da_ranch')
const dryMatterCorrectionList = ref([])
const open = ref(false)
@@ -141,33 +167,47 @@ const total = ref(0)
const title = ref("")
const data = reactive({
- form: {},
+ form: {
+ coefficient: null
+ },
queryParams: {
pageNum: 1,
pageSize: 10,
datetime: null,
factory: null,
- content: null,
- standard: null
},
rules: {
- datetime: [
- { required: true, message: "年月不能为空", trigger: "blur" }
- ],
- factory: [
- { required: true, message: "厂区不能为空", trigger: "blur" }
- ],
+ datetime: [{ required: true, message: "年月不能为空", trigger: "blur" }],
+ factory: [{ required: true, message: "厂区不能为空", trigger: "blur" }],
content: [
- { required: true, message: "干物质含量不能为空", trigger: "blur" }
+ { required: true, message: "干物质含量不能为空", trigger: "blur" },
+ { pattern: /^\d+(\.\d+)?$/, message: "请输入有效数字", trigger: "blur" }
],
standard: [
- { required: true, message: "干物质标准不能为空", trigger: "blur" }
+ { required: true, message: "干物质标准不能为空", trigger: "blur" },
+ { pattern: /^\d+(\.\d+)?$/, message: "请输入有效数字", trigger: "blur" },
+ { validator: (rule, value, callback) => {
+ if (value == 0) {
+ callback(new Error("干物质标准不能为零"));
+ } else {
+ callback();
+ }
+ }, trigger: "blur" }
]
}
})
const { queryParams, form, rules } = toRefs(data)
+/** 计算干物质系数 */
+function calculateCoefficient() {
+ if (form.value.content && form.value.standard && form.value.standard != 0) {
+ form.value.coefficient = parseFloat(form.value.content) / parseFloat(form.value.standard);
+ } else {
+ form.value.coefficient = null;
+ }
+}
+
/** 查询干物质校正列表 */
function getList() {
loading.value = true
@@ -192,7 +232,7 @@ function reset() {
factory: null,
content: null,
standard: null,
- coefficient: null // 新增系数字段
+ coefficient: null
}
proxy.resetForm("dryMatterCorrectionRef")
}
@@ -229,47 +269,26 @@ function handleUpdate(row) {
const _id = row.id || ids.value
getDryMatterCorrection(_id).then(response => {
form.value = response.data
- // 计算修改时的干物质系数
- form.value.coefficient = calculateCoefficient(form.value.content, form.value.standard)
+ // 确保系数已计算
+ if (form.value.content && form.value.standard) {
+ form.value.coefficient = form.value.content / form.value.standard;
+ }
+ // 将日期转换为年月格式
+ if (form.value.datetime) {
+ form.value.datetime = proxy.parseTime(form.value.datetime, "{y}-{m}");
+ }
open.value = true
title.value = "修改干物质校正"
})
}
-/** 表单中计算干物质系数 */
-function calculateCoefficientInForm() {
- if (form.value.content && form.value.standard) {
- const content = parseFloat(form.value.content)
- const standard = parseFloat(form.value.standard)
- if (!isNaN(content) && !isNaN(standard) && standard !== 0) {
- form.value.coefficient = (content / standard).toFixed(4)
- } else {
- form.value.coefficient = null
- }
- } else {
- form.value.coefficient = null
- }
-}
-
-/** 表格中计算干物质系数 */
-function calculateCoefficient(content, standard) {
- if (content && standard) {
- const contentVal = parseFloat(content)
- const standardVal = parseFloat(standard)
- if (!isNaN(contentVal) && !isNaN(standardVal) && standardVal !== 0) {
- return (contentVal / standardVal).toFixed(4)
- }
- }
- return 'N/A'
-}
-
/** 提交按钮 */
function submitForm() {
proxy.$refs["dryMatterCorrectionRef"].validate(valid => {
if (valid) {
- // 提交前确保系数已计算
- if (!form.value.coefficient) {
- calculateCoefficientInForm()
+ // 确保系数已计算
+ if (form.value.content && form.value.standard && form.value.standard != 0) {
+ form.value.coefficient = form.value.content / form.value.standard;
}
if (form.value.id != null) {
@@ -304,8 +323,44 @@ function handleDelete(row) {
function handleExport() {
proxy.download('dryMatterCorrection/dryMatterCorrection/export', {
...queryParams.value
- }, `dryMatterCorrection_${new Date().getTime()}.xlsx`)
+ }, `干物质校正数据_${new Date().getTime()}.xlsx`)
}
getList()
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/views/parityCorrection/parityCorrection/index.vue b/src/views/parityCorrection/parityCorrection/index.vue
new file mode 100644
index 0000000..846c373
--- /dev/null
+++ b/src/views/parityCorrection/parityCorrection/index.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/weightCorrection/weightCorrection/index.vue b/src/views/weightCorrection/weightCorrection/index.vue
new file mode 100644
index 0000000..13d7acc
--- /dev/null
+++ b/src/views/weightCorrection/weightCorrection/index.vue
@@ -0,0 +1,292 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
+
+
+
+
+
+ {{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.coefficient.toFixed(4) }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file