From cff720e8bb410adb2392d913a13d82be3951301a Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 02 二月 2026 11:14:23 +0800
Subject: [PATCH] 危险源选择时加上勾选款,确定按钮位置调整
---
src/views/safeProduction/hazardousMaterialsControl/index.vue | 67 ++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/src/views/safeProduction/hazardousMaterialsControl/index.vue b/src/views/safeProduction/hazardousMaterialsControl/index.vue
index 5be4bdc..da995c2 100644
--- a/src/views/safeProduction/hazardousMaterialsControl/index.vue
+++ b/src/views/safeProduction/hazardousMaterialsControl/index.vue
@@ -162,7 +162,9 @@
<span>{{ form.name }}</span>
</el-descriptions-item>
<el-descriptions-item label="鍗遍櫓婧愮被鍨�">
- <span>{{ getTypeLabel(form.type) }}</span>
+ <el-tag type="info">
+ {{ getTypeLabel(form.type) }}
+ </el-tag>
</el-descriptions-item>
<el-descriptions-item label="鎵�鍦ㄤ綅缃�">
<span>{{ form.location }}</span>
@@ -242,9 +244,9 @@
</el-form>
<template #footer>
<span class="dialog-footer">
- <el-button @click="dialogVisible = false">鍙栨秷</el-button>
<el-button type="primary"
@click="submitForm">纭畾</el-button>
+ <el-button @click="dialogVisible = false">鍙栨秷</el-button>
</span>
</template>
</el-dialog>
@@ -256,9 +258,13 @@
<div>
<el-table :data="safeHazardList"
border
+ ref="safeHazardTableRef"
v-loading="safeHazardLoading"
- style="width: 100%"
- @row-click="handleSafeHazardSelect">
+ :selection="selectedSafeHazardIds"
+ @selection-change="handleSafeHazardSelectionChange"
+ style="width: 100%">
+ <el-table-column type="selection"
+ width="55" />
<el-table-column prop="code"
label="鍗遍櫓婧愮紪鐮�"
width="180"
@@ -300,6 +306,8 @@
</div>
<template #footer>
<span class="dialog-footer">
+ <el-button type="primary"
+ @click="handleSafeHazardSelect">纭畾</el-button>
<el-button @click="safeHazardSelectVisible = false">鍙栨秷</el-button>
</span>
</template>
@@ -414,6 +422,12 @@
// 琛ㄦ牸鍒楅厤缃�
const tableColumn = ref([
{
+ label: "棰嗙敤鍗曞彿",
+ prop: "materialRecordCode",
+ width: 130,
+ showOverflowTooltip: true,
+ },
+ {
label: "鍗遍櫓婧愮紪鐮�",
prop: "code",
showOverflowTooltip: true,
@@ -482,16 +496,11 @@
showOverflowTooltip: true,
},
{
- label: "鍗曞彿",
- prop: "materialRecordCode",
- showOverflowTooltip: true,
- },
- {
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 200,
+ width: 130,
operation: [
{
name: "褰掕繕",
@@ -543,6 +552,7 @@
form.value.applyQty = "";
}
};
+ const selectedSafeHazardIds = ref([]);
// 寮�濮嬭嚜鍔ㄥ埛鏂�
const startAutoRefresh = () => {
@@ -589,12 +599,31 @@
});
};
- const handleSafeHazardSelect = item => {
+ const handleSafeHazardSelectionChange = selection => {
+ // 鍙繚鐣欐渶鍚庝竴涓�変腑鐨勯」
+ if (selection.length > 1) {
+ const lastSelected = selection[selection.length - 1];
+ selectedSafeHazardIds.value = [lastSelected];
+ proxy.$refs.safeHazardTableRef.clearSelection();
+ proxy.$refs.safeHazardTableRef.toggleRowSelection(lastSelected, true);
+ } else if (selection.length === 1) {
+ selectedSafeHazardIds.value = [selection[0]];
+ } else {
+ selectedSafeHazardIds.value = [];
+ }
+ };
+
+ const handleSafeHazardSelect = () => {
+ if (!selectedSafeHazardIds.value.length) {
+ ElMessage.error("璇烽�夋嫨涓�涓嵄闄╂簮");
+ return;
+ }
+
valueItem.value = {
- ...item,
+ ...selectedSafeHazardIds.value[0],
};
valueItem.value.type = getTypeLabel(valueItem.value.type);
- form.value.safeHazardId = item.id;
+ form.value.safeHazardId = selectedSafeHazardIds.value[0].id;
safeHazardSelectVisible.value = false;
};
@@ -608,12 +637,20 @@
const pagination1 = obj => {
page.value.current = obj.page;
page.value.size = obj.limit;
- handleQuery();
+ getList();
};
// 閫夋嫨鍙樺寲澶勭悊
const handleSelectionChange = selection => {
- selectedIds.value = selection.map(item => item.id);
+ // 涓昏〃鏍间篃鍙繚鐣欐渶鍚庝竴涓�変腑鐨勯」
+ if (selection.length > 1) {
+ const lastSelected = selection[selection.length - 1];
+ selectedIds.value = [lastSelected.id];
+ } else if (selection.length === 1) {
+ selectedIds.value = [selection[0].id];
+ } else {
+ selectedIds.value = [];
+ }
};
// 鎵撳紑琛ㄥ崟
--
Gitblit v1.9.3