From c7afec3ad75b22bc8b96d8129956913c2b473d9b Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 19 六月 2025 16:11:36 +0800
Subject: [PATCH] 优化生产管理接口及表格字段
---
src/views/procureMent/index.vue | 45 ++++----------
src/views/production/components/ProductionDetailsTable.vue | 23 ++++---
src/views/archiveManagement/mould/archiveDialog.vue | 20 +++---
src/api/production/index.js | 10 +++
src/views/production/index.vue | 1
src/views/archiveManagement/index.vue | 2
src/views/production/components/useCoalData.js | 14 ++--
src/views/production/components/useTableData.js | 8 --
src/utils/production.js | 3
src/views/production/components/ProductionDialog.vue | 2
10 files changed, 59 insertions(+), 69 deletions(-)
diff --git a/src/api/production/index.js b/src/api/production/index.js
index eb6faaf..d4ec8b7 100644
--- a/src/api/production/index.js
+++ b/src/api/production/index.js
@@ -67,4 +67,14 @@
method: 'delete',
data: data
})
+}
+
+// /coalInfo/coalInfoList
+// 鏌ヨ鐓ょ鍒楄〃
+export function getCoalInfoList(query) {
+ return request({
+ url: '/coalInfo/coalInfoList',
+ method: 'get',
+ params: query
+ })
}
\ No newline at end of file
diff --git a/src/utils/production.js b/src/utils/production.js
index ce5fbdc..35e00e5 100644
--- a/src/utils/production.js
+++ b/src/utils/production.js
@@ -61,6 +61,7 @@
}
for (let i = 0; i < data.length; i++) {
+ console.log(data[i])
const item = data[i];
for (const field of requiredFields) {
if (item[field] === '' || item[field] === null || item[field] === undefined) {
@@ -128,7 +129,7 @@
*/
export function createDefaultProductionRow(userData = {}, extraData = {}) {
return {
- coal: "",
+ coalId: "",
productionQuantity: "",
laborCost: "",
energyConsumptionCost: "",
diff --git a/src/views/archiveManagement/index.vue b/src/views/archiveManagement/index.vue
index 58d41d2..7e7c65d 100644
--- a/src/views/archiveManagement/index.vue
+++ b/src/views/archiveManagement/index.vue
@@ -176,7 +176,7 @@
selectedRows.splice(0, selectedRows.length, ...selection);
};
const queryParams = reactive({
- searchText: "",
+ searchAll: "",
current: 1,
pageSize: 10, // 鍥哄畾姣忛〉10鏉�
treeId: null, // 褰撳墠鏍戣妭鐐笽D
diff --git a/src/views/archiveManagement/mould/archiveDialog.vue b/src/views/archiveManagement/mould/archiveDialog.vue
index 5406cc2..793d222 100644
--- a/src/views/archiveManagement/mould/archiveDialog.vue
+++ b/src/views/archiveManagement/mould/archiveDialog.vue
@@ -36,11 +36,12 @@
</el-row>
</template>
<fileUpload
- ref="fileUploadRef"
- :fileSize="1024"
- :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']"
- :limit="10"
- v-model:modelValue="modelValue"
+ ref="fileUploadRef"
+ :fileSize="1024"
+ :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']"
+ :limit="10"
+ :drag="false"
+ v-model:modelValue="modelValue"
/>
</el-dialog>
</template>
@@ -98,14 +99,13 @@
};
const fileUploadRef = ref(null);
const initForm = () => {
- ruleForm.value = {}
- fileUploadRef.value.init()
+ ruleForm.value = {};
+ fileUploadRef.value.init();
};
const editForm = (val) => {
ruleForm.value = copyForm.value;
nextTick(() => {
- fileUploadRef.value.editInit(val);
-
+ fileUploadRef.value.editInit(val);
});
};
defineExpose({
@@ -145,7 +145,7 @@
return;
}
// 鍙戦�� emit 浜嬩欢
-
+
// 鍏抽棴瀵硅瘽妗�
centerDialogVisible.value = false;
} catch (error) {
diff --git a/src/views/procureMent/index.vue b/src/views/procureMent/index.vue
index ba02734..644b3a8 100644
--- a/src/views/procureMent/index.vue
+++ b/src/views/procureMent/index.vue
@@ -3,32 +3,8 @@
<el-form :inline="true" :model="queryParams" class="search-form">
<el-form-item label="鎼滅储">
<el-input
- v-model="queryParams.searchText"
- placeholder="璇疯緭鍏ュ叧閿瘝"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="渚涘簲鍟嗗悕绉�">
- <el-input
- v-model="queryParams.supplierName"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="缁熶竴浜鸿瘑鍒彿">
- <el-input
- v-model="queryParams.identifyNumber"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="缁忚惀鍦板潃">
- <el-input
- v-model="queryParams.address"
- placeholder="璇疯緭鍏�"
+ v-model="queryParams.searchAll"
+ placeholder="璇疯緭鍏ヤ緵搴斿晢/鐓ょ"
clearable
:style="{ width: '100%' }"
/>
@@ -56,6 +32,7 @@
:columns="columns"
@selection-change="handleSelectionChange"
@edit="handleEdit"
+ :showOverflowTooltip="false"
@delete="handleDeleteSuccess"
:show-selection="true"
:border="true"
@@ -105,7 +82,7 @@
const copyForm = ref({});
// 鏌ヨ鍙傛暟
const queryParams = reactive({
- searchText: "",
+ searchAll: "",
supplierName: "",
identifyNumber: "",
address: "",
@@ -154,11 +131,15 @@
// 閲嶇疆鏌ヨ
const resetQuery = () => {
- Object.keys(queryParams).forEach((key) => {
- if (key !== "current" && key !== "pageSize") {
- queryParams[key] = "";
- }
- });
+ queryParams.searchAll = "";
+ queryParams.supplierName = "";
+ queryParams.identifyNumber = "";
+ queryParams.address = "";
+ current.value = 1;
+ pageSize.value = 10;
+ queryParams.current = current.value;
+ queryParams.pageSize = pageSize.value;
+ getList();
};
// 鏂板
const handleAdd = () => {
diff --git a/src/views/production/components/ProductionDetailsTable.vue b/src/views/production/components/ProductionDetailsTable.vue
index eb4091b..7a87b17 100644
--- a/src/views/production/components/ProductionDetailsTable.vue
+++ b/src/views/production/components/ProductionDetailsTable.vue
@@ -4,11 +4,11 @@
<template #default="{ row, $index }">
<el-select
clearable
- :model-value="getCoalNameById(row.coal) || row.coal"
+ :model-value="getCoalNameById(row.coalId) || row.coalId"
placeholder="璇烽�夋嫨鐓ょ"
@change="(value) => handleCoalSelectChange(row, value)"
filterable
- :key="`coal-select-${$index}-${weekList.length}`"
+ :key="`coalId-select-${$index}-${weekList.length}`"
>
<el-option
v-for="(item, index) of weekList"
@@ -149,6 +149,7 @@
import { ref, computed, watch, onMounted, nextTick } from "vue";
import { Delete } from "@element-plus/icons-vue";
import { getCoalFieldList } from "@/api/basicInformation/coalQualityMaintenance";
+import { getCoalInfoList } from "@/api/production";
import { userListAll } from "@/api/publicApi";
const props = defineProps({
modelValue: {
@@ -233,16 +234,16 @@
// 鏍规嵁閫夋嫨鐨勫悕绉版壘鍒板搴旂殑ID
const coalItem = weekList.value.find(item => item.value === selectedName);
if (coalItem) {
- row.coal = coalItem.key; // 璁剧疆涓篒D
+ row.coalId = coalItem.key; // 璁剧疆涓篒D
} else {
- row.coal = ''; // 濡傛灉娌℃壘鍒帮紝娓呯┖
+ row.coalId = ''; // 濡傛灉娌℃壘鍒帮紝娓呯┖
}
};
// 鏍规嵁ID鑾峰彇鐓ょ鍚嶇О锛堢敤浜庢樉绀猴級
const getCoalNameById = (id) => {
- const coal = weekList.value.find(item => item.key == id);
- return coal ? coal.value : id;
+ const coalId = weekList.value.find(item => item.key == id);
+ return coalId ? coalId.value : id;
};
const weekList = ref([]);
@@ -268,10 +269,11 @@
}, { deep: true });
onMounted(async()=>{
- let res = await getCoalFieldList()
+ let res = await getCoalInfoList()
+ console.log(res);
res.data.forEach(item => {
let obj = {};
- obj.value = item.fieldName;
+ obj.value = item.coal;
obj.key = item.id;
weekList.value.push(obj);
});
@@ -292,7 +294,7 @@
let res = await getCoalFieldList();
if (res.code === 200) {
dropdownList.value = res.data.map((item) => ({
- value: item.fieldName,
+ value: item.coal,
key: item.id,
}));
} else {
@@ -348,11 +350,12 @@
defineExpose({
calculateTotalCost,
getDropdownData,
+ getUserList,
getCoalNameById, // 鏆撮湶鑾峰彇鐓ょ鍚嶇О鐨勬柟娉�
weekList, // 鏆撮湶weekList璁╃埗缁勪欢鍙互璁块棶
addRow: (rowData = {}) => {
const defaultRow = {
- coal: "",
+ coalId: "",
calorificValue: "",
productionQuantity: "",
laborCost: "",
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 7733da7..0cd330e 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -347,7 +347,7 @@
const handleSubmit = async () => {
// 楠岃瘉鐢熶骇鏄庣粏鏁版嵁
const detailsValidation = validateFormData(detailsTableData.value, [
- "coal",
+ "coalId",
"productionQuantity",
"laborCost",
"energyConsumptionCost",
diff --git a/src/views/production/components/useCoalData.js b/src/views/production/components/useCoalData.js
index 61179b4..37b2245 100644
--- a/src/views/production/components/useCoalData.js
+++ b/src/views/production/components/useCoalData.js
@@ -3,7 +3,7 @@
* 鎻愪緵鐓ょ鏁版嵁鐨勮幏鍙栥�佺紦瀛樸�佽浆鎹㈢瓑鍔熻兘
*/
import { ref, computed, watch } from 'vue';
-import { getCoalFieldList } from '@/api/basicInformation/coalQualityMaintenance';
+import { getCoalInfoList } from "@/api/production";
import { ElMessage } from 'element-plus';
// 鍏ㄥ眬鐓ょ鏁版嵁缂撳瓨
@@ -33,7 +33,7 @@
isLoading.value = true;
try {
- const res = await getCoalFieldList();
+ const res = await getCoalInfoList();
if (res.code === 200) {
coalData.value = res.data;
isLoaded.value = true;
@@ -55,21 +55,21 @@
const getCoalNameById = (id) => {
if (!id || coalData.value.length === 0) return id;
const coal = coalData.value.find(item => item.id == id);
- return coal ? coal.fieldName : id;
+ return coal ? coal.coal : id;
};
// 鏍规嵁鍚嶇О鑾峰彇鐓ょID
const getCoalIdByName = (name) => {
if (!name || coalData.value.length === 0) return '';
- const coal = coalData.value.find(item => item.fieldName === name);
+ const coal = coalData.value.find(item => item.coal === name);
return coal ? coal.id : '';
};
// 鐢熸垚涓嬫媺閫夐」
const coalOptions = computed(() => {
return coalData.value.map(item => ({
- label: item.fieldName,
- value: item.fieldName,
+ label: item.coal,
+ value: item.coal,
key: item.id
}));
});
@@ -78,7 +78,7 @@
const coalMap = computed(() => {
const map = {};
coalData.value.forEach(item => {
- map[item.id] = item.fieldName;
+ map[item.id] = item.coal;
});
return map;
});
diff --git a/src/views/production/components/useTableData.js b/src/views/production/components/useTableData.js
index fe2ea50..ccdd846 100644
--- a/src/views/production/components/useTableData.js
+++ b/src/views/production/components/useTableData.js
@@ -32,13 +32,8 @@
[searchField]: queryParams[searchField],
current: queryParams.current,
size: queryParams.size,
- page: queryParams.current,
- pageSize: queryParams.size,
- pageNum: queryParams.current,
- limit: queryParams.size,
- offset: (queryParams.current - 1) * queryParams.size
};
-
+ console.log('鏌ヨ鍙傛暟:', params);
const res = await apiFunction(params);
tableData.value = res.data.records || [];
total.value = res.data.total || 0;
@@ -59,6 +54,7 @@
// 閲嶇疆鎼滅储
const handleReset = () => {
queryParams[searchField] = '';
+ console.log('閲嶇疆鎼滅储鍙傛暟:', queryParams);
handleSearch();
};
diff --git a/src/views/production/index.vue b/src/views/production/index.vue
index 4827925..8ab5e23 100644
--- a/src/views/production/index.vue
+++ b/src/views/production/index.vue
@@ -89,7 +89,6 @@
{ prop: "energyConsumptionCost", label: "鑳借�楁垚鏈�", minWidth: 120 },
{ prop: "equipmentDepreciation", label: "璁惧鎶樻棫", minWidth: 143 },
{ prop: "totalCost", label: "鎬绘垚鏈�", minWidth: 150 },
- { prop: "producer", label: "鐢熶骇浜�", minWidth: 150 },
];
// 浣跨敤琛ㄦ牸鏁版嵁缁勫悎寮忓嚱鏁�
--
Gitblit v1.9.3