数据填报-表格组件改动引起的bug修改
This commit is contained in:
parent
8739128085
commit
c1f3490c2c
@ -1,6 +1,6 @@
|
||||
<!-- SidePanelItem.vue -->
|
||||
<template>
|
||||
<SidePanelItem title="增殖站建设运行情况" :datetimePicker="datetimePicker">
|
||||
<SidePanelItem title="增殖站建设运行情况" :datetimePicker="datetimePicker" >
|
||||
<div class="facility-grid">
|
||||
<div v-for="facility in facilities" :key="facility.name" class="facility-card">
|
||||
<div style="width: 70px;height: 62px;display: flex;align-items: center;justify-content: center;">
|
||||
|
||||
@ -245,7 +245,7 @@ let columns = ref([
|
||||
title: '过鱼开始时间',
|
||||
width: 140,
|
||||
customRender: ({ text }) => {
|
||||
return text ? dayjs(text).format('YYYY-MM-DD') : '';
|
||||
return text && text!= '-' ? dayjs(text).format('YYYY-MM-DD') : '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -254,7 +254,7 @@ let columns = ref([
|
||||
title: '过鱼结束时间',
|
||||
width: 140,
|
||||
customRender: ({ text }) => {
|
||||
return text ? dayjs(text).format('YYYY-MM-DD') : '';
|
||||
return text && text!= '-' ? dayjs(text).format('YYYY-MM-DD') : '-';
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -17,12 +17,22 @@
|
||||
<template v-if="column.key === 'action' || column.dataIndex === 'action'">
|
||||
<div class="flex">
|
||||
<template v-if="editingRowIndex === index">
|
||||
<a-button type="link" size="small" @click="saveEdit(index)">保存</a-button>
|
||||
<a-button type="link" size="small" @click="cancelEdit">取消</a-button>
|
||||
<a-button type="link" size="small" @click="saveEdit(index)"
|
||||
>保存</a-button
|
||||
>
|
||||
<a-button type="link" size="small" @click="cancelEdit"
|
||||
>取消</a-button
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-button type="link" size="small" @click="startEdit(index)">编辑</a-button>
|
||||
<a-button type="link" danger size="small" @click="handlePreviewDelete(index)"
|
||||
<a-button type="link" size="small" @click="startEdit(index)"
|
||||
>编辑</a-button
|
||||
>
|
||||
<a-button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
@click="handlePreviewDelete(index)"
|
||||
>删除</a-button
|
||||
>
|
||||
</template>
|
||||
@ -38,7 +48,9 @@
|
||||
"
|
||||
>
|
||||
<div style="color: red; display: flex; align-items: center">
|
||||
<span v-if="record[column.dataIndex]">{{ record[column.dataIndex] }}</span>
|
||||
<span v-if="record[column.dataIndex]">{{
|
||||
record[column.dataIndex]
|
||||
}}</span>
|
||||
<span v-else> 请添加{{ column.title }}</span>
|
||||
<exclamation-circle-outlined style="margin-left: 4px" />
|
||||
</div>
|
||||
@ -47,7 +59,9 @@
|
||||
<!-- 3. 编辑状态下的单元格 (绑定到 editingData) -->
|
||||
<template
|
||||
v-else-if="
|
||||
isEditing(index) && column.dataIndex != 'picpth' && column.dataIndex != 'vdpth'
|
||||
isEditing(index) &&
|
||||
column.dataIndex != 'picpth' &&
|
||||
column.dataIndex != 'vdpth'
|
||||
"
|
||||
>
|
||||
<!-- 基地 -->
|
||||
@ -82,8 +96,12 @@
|
||||
:filter-option="filterOption"
|
||||
:loading="rowStates[index]?.hbrvcdLoading"
|
||||
style="width: 100%"
|
||||
@change="(val) => handleHbrvcdChange(val, index, 'input')"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto', minWidth: '300px' }"
|
||||
@change="val => handleHbrvcdChange(val, index, 'input')"
|
||||
:dropdown-style="{
|
||||
maxHeight: '400px',
|
||||
overflow: 'auto',
|
||||
minWidth: '300px'
|
||||
}"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="opt in hbrvcdOptions"
|
||||
@ -107,7 +125,7 @@
|
||||
:loading="rowStates[index]?.engLoading"
|
||||
style="width: 100%"
|
||||
:disabled="!editingData.rvcd"
|
||||
@change="(val) => handleEngChange(val, index, 'input')"
|
||||
@change="val => handleEngChange(val, index, 'input')"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="opt in rowStates[index]?.engOptions || []"
|
||||
@ -131,7 +149,7 @@
|
||||
:loading="rowStates[index]?.fpssLoading"
|
||||
style="width: 100%"
|
||||
:disabled="!editingData.rstcd"
|
||||
@change="(val) => handleFpssChange(val, index)"
|
||||
@change="val => handleFpssChange(val, index)"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="opt in rowStates[index]?.fpssOptions || []"
|
||||
@ -151,7 +169,8 @@
|
||||
style="width: 100%"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
@change="(val) => delWarning(val, 'strdtStr')"
|
||||
:allow-clear="false"
|
||||
@change="val => delWarning(val, 'strdtStr')"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -170,7 +189,7 @@
|
||||
v-model:value="editingData.direction"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
@change="(val) => delWarning(val, 'direction')"
|
||||
@change="val => delWarning(val, 'direction')"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in direction"
|
||||
@ -190,7 +209,7 @@
|
||||
:step="1"
|
||||
:precision="0"
|
||||
:min="0"
|
||||
@change="(val) => delWarning(val, column.dataIndex)"
|
||||
@change="val => delWarning(val, column.dataIndex)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="['wt'].includes(column.dataIndex)">
|
||||
@ -204,7 +223,7 @@
|
||||
<template v-else-if="column.dataIndex === 'isfs'">
|
||||
<a-radio-group
|
||||
v-model:value="editingData.isfs"
|
||||
@change="(val) => delWarning(val, 'isfs')"
|
||||
@change="val => delWarning(val, 'isfs')"
|
||||
>
|
||||
<a-radio :value="1">是</a-radio>
|
||||
<a-radio :value="0">否</a-radio>
|
||||
@ -250,7 +269,9 @@
|
||||
<div class="preview" v-for="(item, index) in record.picpthList">
|
||||
<div
|
||||
class="text"
|
||||
:class="{ text_warning: record.picpthsWarnings.includes(item.name) }"
|
||||
:class="{
|
||||
text_warning: record.picpthsWarnings.includes(item.name)
|
||||
}"
|
||||
@click="emit('preview-click', record, 'image', index, 'delete')"
|
||||
>
|
||||
{{ item.name }}
|
||||
@ -275,28 +296,28 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import _ from "lodash";
|
||||
import { ref, reactive, onMounted, h } from "vue";
|
||||
import { message, Tag } from "ant-design-vue";
|
||||
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
||||
import fishSearch from "@/components/fishSearch/index.vue";
|
||||
import _ from 'lodash';
|
||||
import { ref, reactive, onMounted, h } from 'vue';
|
||||
import { message, Tag } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import fishSearch from '@/components/fishSearch/index.vue';
|
||||
import {
|
||||
getSelectForDropdown,
|
||||
getEngInfoDropdown,
|
||||
getFpssDropdown,
|
||||
revalidateAndUpdateRow,
|
||||
deleteRowById,
|
||||
} from "@/api/select";
|
||||
deleteRowById
|
||||
} from '@/api/select';
|
||||
|
||||
const props: any = defineProps({
|
||||
taskId: { type: String, default: "" },
|
||||
taskId: { type: String, default: '' },
|
||||
getFileList: { type: Function, default: () => {} },
|
||||
fileTableData: { type: Array, default: () => [] },
|
||||
fileLoading: { type: Boolean, default: false },
|
||||
direction: { type: Array, default: () => [] },
|
||||
direction: { type: Array, default: () => [] }
|
||||
});
|
||||
|
||||
const emit = defineEmits(["preview-click", "update:fileLoading"]);
|
||||
const emit = defineEmits(['preview-click', 'update:fileLoading']);
|
||||
|
||||
// --- 状态管理 ---
|
||||
const editingRowIndex = ref<number | null>(null);
|
||||
@ -308,91 +329,94 @@ const editingData = ref<any>(null);
|
||||
|
||||
const modalColumns = ref([
|
||||
{
|
||||
dataIndex: "rowIndex",
|
||||
key: "rowIndex",
|
||||
title: "序号",
|
||||
dataIndex: 'rowIndex',
|
||||
key: 'rowIndex',
|
||||
title: '序号',
|
||||
width: 60,
|
||||
dataIndexKey: "rowIndex",
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
dataIndexKey: 'rowIndex',
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
dataIndex: "rvnm",
|
||||
key: "rvnm",
|
||||
dataIndexKey: "rvcd",
|
||||
title: "流域",
|
||||
width: 140,
|
||||
dataIndex: 'rvnm',
|
||||
key: 'rvnm',
|
||||
dataIndexKey: 'rvcd',
|
||||
title: '流域',
|
||||
width: 140
|
||||
},
|
||||
{
|
||||
dataIndex: "ennm",
|
||||
key: "ennm",
|
||||
dataIndexKey: "rstcd",
|
||||
title: "电站名称",
|
||||
width: 140,
|
||||
dataIndex: 'ennm',
|
||||
key: 'ennm',
|
||||
dataIndexKey: 'rstcd',
|
||||
title: '电站名称',
|
||||
width: 140
|
||||
},
|
||||
{
|
||||
dataIndex: "stnm",
|
||||
key: "stnm",
|
||||
dataIndexKey: "stcd",
|
||||
title: "过鱼设施名称",
|
||||
width: 150,
|
||||
dataIndex: 'stnm',
|
||||
key: 'stnm',
|
||||
dataIndexKey: 'stcd',
|
||||
title: '过鱼设施名称',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
dataIndex: "strdtStr",
|
||||
key: "strdtStr",
|
||||
dataIndexKey: "strdtStr",
|
||||
title: "过鱼时间",
|
||||
width: 190,
|
||||
dataIndex: 'strdtStr',
|
||||
key: 'strdtStr',
|
||||
dataIndexKey: 'strdtStr',
|
||||
title: '过鱼时间',
|
||||
width: 190
|
||||
},
|
||||
{
|
||||
dataIndex: "ftpName",
|
||||
key: "ftpName",
|
||||
dataIndexKey: "ftp",
|
||||
title: "鱼种类",
|
||||
width: 120,
|
||||
dataIndex: 'ftpName',
|
||||
key: 'ftpName',
|
||||
dataIndexKey: 'ftp',
|
||||
title: '鱼种类',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
dataIndex: "isfs",
|
||||
key: "isfs",
|
||||
title: "是否鱼苗",
|
||||
dataIndexKey: "isfs",
|
||||
dataIndex: 'isfs',
|
||||
key: 'isfs',
|
||||
title: '是否鱼苗',
|
||||
dataIndexKey: 'isfs',
|
||||
width: 130,
|
||||
customRender: ({ text }: any) => {
|
||||
const isYes = text === 1 || text === "1";
|
||||
return h(Tag, { color: isYes ? "success" : "error", style: { margin: 0 } }, () =>
|
||||
isYes ? "是" : "否"
|
||||
const isYes = text === 1 || text === '1';
|
||||
return h(
|
||||
Tag,
|
||||
{ color: isYes ? 'success' : 'error', style: { margin: 0 } },
|
||||
() => (isYes ? '是' : '否')
|
||||
);
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
dataIndex: "direction",
|
||||
dataIndexKey: "direction",
|
||||
key: "direction",
|
||||
title: "游向",
|
||||
dataIndex: 'direction',
|
||||
dataIndexKey: 'direction',
|
||||
key: 'direction',
|
||||
title: '游向',
|
||||
width: 120,
|
||||
customRender: ({ text }: any) =>
|
||||
props.direction.find((item: any) => item.itemCode === text)?.dictName || "-",
|
||||
props.direction.find((item: any) => item.itemCode === text)?.dictName ||
|
||||
'-'
|
||||
},
|
||||
{
|
||||
dataIndex: "fcnt",
|
||||
key: "fcnt",
|
||||
dataIndexKey: "fcnt",
|
||||
title: "过鱼数量(尾)",
|
||||
width: 120,
|
||||
dataIndex: 'fcnt',
|
||||
key: 'fcnt',
|
||||
dataIndexKey: 'fcnt',
|
||||
title: '过鱼数量(尾)',
|
||||
width: 120
|
||||
},
|
||||
{ dataIndex: "fsz", key: "fsz", title: "体长(cm)", width: 160 },
|
||||
{ dataIndex: "fwet", key: "fwet", title: "平均体重(g)", width: 160 },
|
||||
{ dataIndex: "wt", key: "wt", title: "水温(℃)", width: 80 },
|
||||
{ dataIndex: "picpth", key: "picpth", title: "图片", width: 160 },
|
||||
{ dataIndex: "vdpth", key: "vdpth", title: "视频", width: 160 },
|
||||
{ dataIndex: 'fsz', key: 'fsz', title: '体长(cm)', width: 160 },
|
||||
{ dataIndex: 'fwet', key: 'fwet', title: '平均体重(g)', width: 160 },
|
||||
{ dataIndex: 'wt', key: 'wt', title: '水温(℃)', width: 80 },
|
||||
{ dataIndex: 'picpth', key: 'picpth', title: '图片', width: 160 },
|
||||
{ dataIndex: 'vdpth', key: 'vdpth', title: '视频', width: 160 },
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
dataIndex: "action",
|
||||
fixed: "right",
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
align: "center",
|
||||
},
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// --- 初始化 ---
|
||||
@ -419,11 +443,11 @@ const loadHbrvcdOptions = async () => {
|
||||
const res = await getSelectForDropdown({});
|
||||
let list = res.data || [];
|
||||
if (list && list.length > 0) {
|
||||
list = list.filter((item: any) => item.rvcd !== "all");
|
||||
list = list.filter((item: any) => item.rvcd !== 'all');
|
||||
}
|
||||
hbrvcdOptions.value = list;
|
||||
} catch (e) {
|
||||
console.error("Load rvcd options failed", e);
|
||||
console.error('Load rvcd options failed', e);
|
||||
}
|
||||
};
|
||||
|
||||
@ -435,7 +459,7 @@ const ensureRowState = (index: number) => {
|
||||
baseLoading: false,
|
||||
hbrvcdLoading: false,
|
||||
engLoading: false,
|
||||
fpssLoading: false,
|
||||
fpssLoading: false
|
||||
};
|
||||
}
|
||||
return rowStates[index];
|
||||
@ -474,19 +498,19 @@ const ensureRowState = (index: number) => {
|
||||
const handleHbrvcdChange = async (
|
||||
rvcd: string,
|
||||
index: number,
|
||||
type = "start"
|
||||
type = 'start'
|
||||
) => {
|
||||
const state = ensureRowState(index);
|
||||
editingData.value.rvnm = hbrvcdOptions.value.find(
|
||||
(item: any) => item.rvcd == rvcd
|
||||
)?.rvnm;
|
||||
delWarning(rvcd, "rvcd");
|
||||
delWarning(rvcd, 'rvcd');
|
||||
if (rvcd == null) {
|
||||
delWarning(null, "rvcd");
|
||||
delWarning(null, "stcd");
|
||||
delWarning(null, 'rvcd');
|
||||
delWarning(null, 'stcd');
|
||||
}
|
||||
// 清空后续字段
|
||||
if (type != "start") {
|
||||
if (type != 'start') {
|
||||
editingData.value.rstcd = undefined;
|
||||
editingData.value.stcd = undefined;
|
||||
editingData.value.ennm = undefined;
|
||||
@ -499,23 +523,27 @@ const handleHbrvcdChange = async (
|
||||
const res = await getEngInfoDropdown({ rvcd });
|
||||
state.engOptions = res.data || [];
|
||||
} catch (e) {
|
||||
message.error("获取电站列表失败");
|
||||
message.error('获取电站列表失败');
|
||||
} finally {
|
||||
state.engLoading = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleEngChange = async (rstcd: string, index: number, type = "start") => {
|
||||
const handleEngChange = async (
|
||||
rstcd: string,
|
||||
index: number,
|
||||
type = 'start'
|
||||
) => {
|
||||
const state = ensureRowState(index);
|
||||
editingData.value.ennm = state.engOptions.find(
|
||||
(item: any) => item.stcd === rstcd
|
||||
)?.ennm;
|
||||
delWarning(rstcd, "rstcd");
|
||||
delWarning(rstcd, 'rstcd');
|
||||
if (rstcd == null) {
|
||||
delWarning(null, "stcd");
|
||||
delWarning(null, 'stcd');
|
||||
}
|
||||
// 清空后续字段
|
||||
if (type != "start") {
|
||||
if (type != 'start') {
|
||||
editingData.value.stcd = undefined;
|
||||
editingData.value.stnm = undefined;
|
||||
state.fpssOptions = [];
|
||||
@ -525,14 +553,14 @@ const handleEngChange = async (rstcd: string, index: number, type = "start") =>
|
||||
const res = await getFpssDropdown({ rstcd, rvcd: editingData.value.rvcd });
|
||||
state.fpssOptions = res.data || [];
|
||||
} catch (e) {
|
||||
message.error("获取设施列表失败");
|
||||
message.error('获取设施列表失败');
|
||||
} finally {
|
||||
state.fpssLoading = false;
|
||||
}
|
||||
};
|
||||
const handleFpssChange = (stcd: string, index: number) => {
|
||||
const state = ensureRowState(index);
|
||||
delWarning(stcd, "stcd");
|
||||
delWarning(stcd, 'stcd');
|
||||
editingData.value.stnm = state.fpssOptions.find(
|
||||
(item: any) => item.stcd === stcd
|
||||
)?.stnm;
|
||||
@ -548,7 +576,7 @@ const delWarning = (val: any, key: string) => {
|
||||
const warnings = editingData.value.warnings;
|
||||
const hasWarning = warnings.includes(key);
|
||||
|
||||
if (val !== null && val !== undefined && val !== "") {
|
||||
if (val !== null && val !== undefined && val !== '') {
|
||||
// 1. 如果有值,且存在警告,则移除警告
|
||||
if (hasWarning) {
|
||||
editingData.value.warnings = warnings.filter((w: string) => w !== key);
|
||||
@ -573,35 +601,38 @@ const startEdit = (index: number) => {
|
||||
processStringToMinMax(editingData.value);
|
||||
|
||||
editingRowIndex.value = index;
|
||||
if (editingData.value.warnings.includes("rvcd")) {
|
||||
if (editingData.value.warnings.includes('rvcd')) {
|
||||
editingData.value.rvcd = null;
|
||||
editingData.value.rvnm = null;
|
||||
editingData.value.rstcd = null;
|
||||
editingData.value.stcd = null;
|
||||
delWarning(null, "rstcd");
|
||||
delWarning(null, "stcd");
|
||||
delWarning(null, 'rstcd');
|
||||
delWarning(null, 'stcd');
|
||||
}
|
||||
if (editingData.value.warnings.includes("rstcd")) {
|
||||
if (editingData.value.warnings.includes('rstcd')) {
|
||||
editingData.value.stcd = null;
|
||||
delWarning(null, "stcd");
|
||||
delWarning(null, 'stcd');
|
||||
}
|
||||
if (editingData.value.warnings.includes("strdt")) {
|
||||
if (editingData.value.warnings.includes('strdt')) {
|
||||
editingData.value.strdt = null;
|
||||
delWarning(null, "strdt");
|
||||
delWarning(null, 'strdt');
|
||||
}
|
||||
|
||||
// 3. 预加载下拉选项 (基于 editingData 的值)
|
||||
if (editingData.value.rvcd == "" || editingData.value.rvcd == undefined) {
|
||||
if (editingData.value.rvcd == '' || editingData.value.rvcd == undefined) {
|
||||
if (editingData.value.rstcd) {
|
||||
handleHbrvcdChange("", index, "start").then(() => {
|
||||
handleEngChange(editingData.value.rstcd, index, "start");
|
||||
handleHbrvcdChange('', index, 'start').then(() => {
|
||||
handleEngChange(editingData.value.rstcd, index, 'start');
|
||||
});
|
||||
} else {
|
||||
handleEngChange("", index, "start");
|
||||
handleEngChange('', index, 'start');
|
||||
}
|
||||
} else if (editingData.value.rvcd != "" && editingData.value.rvcd != undefined) {
|
||||
handleHbrvcdChange(editingData.value.rvcd, index, "start").then(() => {
|
||||
handleEngChange(editingData.value.rstcd, index, "start");
|
||||
} else if (
|
||||
editingData.value.rvcd != '' &&
|
||||
editingData.value.rvcd != undefined
|
||||
) {
|
||||
handleHbrvcdChange(editingData.value.rvcd, index, 'start').then(() => {
|
||||
handleEngChange(editingData.value.rstcd, index, 'start');
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -609,45 +640,45 @@ const startEdit = (index: number) => {
|
||||
// 辅助:字符串转 Min/Max
|
||||
const processStringToMinMax = (data: any) => {
|
||||
if (data.fsz) {
|
||||
const sizes = String(data.fsz).split("~");
|
||||
data.bodyLengthMin = sizes[0] || "";
|
||||
data.bodyLengthMax = sizes[1] || sizes[0] || "";
|
||||
const sizes = String(data.fsz).split('~');
|
||||
data.bodyLengthMin = sizes[0] || '';
|
||||
data.bodyLengthMax = sizes[1] || sizes[0] || '';
|
||||
} else {
|
||||
data.bodyLengthMin = "";
|
||||
data.bodyLengthMax = "";
|
||||
data.bodyLengthMin = '';
|
||||
data.bodyLengthMax = '';
|
||||
}
|
||||
if (data.fwet) {
|
||||
const weights = String(data.fwet).split("~");
|
||||
data.weightMin = weights[0] || "";
|
||||
data.weightMax = weights[1] || weights[0] || "";
|
||||
const weights = String(data.fwet).split('~');
|
||||
data.weightMin = weights[0] || '';
|
||||
data.weightMax = weights[1] || weights[0] || '';
|
||||
} else {
|
||||
data.weightMin = "";
|
||||
data.weightMax = "";
|
||||
data.weightMin = '';
|
||||
data.weightMax = '';
|
||||
}
|
||||
};
|
||||
|
||||
// 辅助:Min/Max 转字符串
|
||||
const processMinMaxToString = (data: any) => {
|
||||
// 处理体长
|
||||
if (data.bodyLengthMin !== "" || data.bodyLengthMax !== "") {
|
||||
if (data.bodyLengthMin !== '' || data.bodyLengthMax !== '') {
|
||||
if (data.bodyLengthMin == data.bodyLengthMax) {
|
||||
data.fsz = data.bodyLengthMin;
|
||||
} else {
|
||||
data.fsz = `${data.bodyLengthMin}~${data.bodyLengthMax}`;
|
||||
}
|
||||
} else {
|
||||
data.fsz = "";
|
||||
data.fsz = '';
|
||||
}
|
||||
|
||||
// 处理体重
|
||||
if (data.weightMin !== "" || data.weightMax !== "") {
|
||||
if (data.weightMin !== '' || data.weightMax !== '') {
|
||||
if (data.weightMin == data.weightMax) {
|
||||
data.fwet = data.weightMin;
|
||||
} else {
|
||||
data.fwet = `${data.weightMin}~${data.weightMax}`;
|
||||
}
|
||||
} else {
|
||||
data.fwet = "";
|
||||
data.fwet = '';
|
||||
}
|
||||
|
||||
// 清理临时字段,避免污染原数据
|
||||
@ -661,26 +692,34 @@ const saveEdit = async (index: number) => {
|
||||
// 1. 后处理:将 Min/Max 合并回 fsz/fwet
|
||||
processMinMaxToString(editingData.value);
|
||||
|
||||
// 2. 创建新数组,替换对应索引的数据
|
||||
// 2. 验证 strdtStr 不能为空
|
||||
if (!editingData.value.strdtStr) {
|
||||
message.error('过鱼时间不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 创建新数组,替换对应索引的数据
|
||||
const newData = [...props.fileTableData];
|
||||
newData[index] = { ...editingData.value };
|
||||
newData[index].strdt = newData[index].strdtStr + " 00:00:00";
|
||||
emit("update:fileLoading", true);
|
||||
newData[index].strdt = newData[index].strdtStr
|
||||
? newData[index].strdtStr + ' 00:00:00'
|
||||
: newData[index].strdtStr;
|
||||
emit('update:fileLoading', true);
|
||||
try {
|
||||
const res: any = await revalidateAndUpdateRow({
|
||||
taskId: props.taskId,
|
||||
data: newData[index],
|
||||
data: newData[index]
|
||||
});
|
||||
if (res && res?.code == 0) {
|
||||
message.success("保存成功");
|
||||
message.success('保存成功');
|
||||
props.getFileList();
|
||||
editingRowIndex.value = null;
|
||||
editingData.value = null;
|
||||
}
|
||||
} catch (e) {
|
||||
message.error("保存失败");
|
||||
message.error('保存失败');
|
||||
} finally {
|
||||
emit("update:fileLoading", false);
|
||||
emit('update:fileLoading', false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -692,29 +731,29 @@ const cancelEdit = () => {
|
||||
// 删除按钮点击事件
|
||||
const handlePreviewDelete = async (index: number) => {
|
||||
const newData = [...props.fileTableData];
|
||||
emit("update:fileLoading", true);
|
||||
emit('update:fileLoading', true);
|
||||
try {
|
||||
const res: any = await deleteRowById({
|
||||
taskId: props.taskId,
|
||||
data: newData[index],
|
||||
data: newData[index]
|
||||
});
|
||||
if (res && res?.code == 0) {
|
||||
message.success("删除成功");
|
||||
message.success('删除成功');
|
||||
|
||||
props.getFileList();
|
||||
editingRowIndex.value = null;
|
||||
editingData.value = null;
|
||||
}
|
||||
} catch (e) {
|
||||
message.error("删除失败");
|
||||
message.error('删除失败');
|
||||
} finally {
|
||||
emit("update:fileLoading", false);
|
||||
emit('update:fileLoading', false);
|
||||
}
|
||||
};
|
||||
// 鱼种类编辑 修改名称
|
||||
const handleFtpChange = (val: any, opt: any) => {
|
||||
editingData.value.ftpName = opt.name;
|
||||
delWarning(val, "ftp");
|
||||
delWarning(val, 'ftp');
|
||||
};
|
||||
|
||||
// --- 辅助函数 ---
|
||||
@ -723,7 +762,7 @@ const filterOption = (input: string, option: any) => {
|
||||
};
|
||||
defineExpose({
|
||||
editingRowIndex,
|
||||
editingData,
|
||||
editingData
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -37,7 +37,7 @@ const localTypeDate = ref<string>(null);
|
||||
const basicSearchRef = ref<any>();
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: "rvcd",
|
||||
rvcd: "all",
|
||||
stcd: null,
|
||||
rstcd: null,
|
||||
strdt: [
|
||||
|
||||
@ -19,10 +19,7 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 使用 bodyCell 插槽自定义单元格渲染 -->
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template
|
||||
v-if="column.key === 'action' || column.dataIndex === 'action'"
|
||||
>
|
||||
<template #action="{ column, record }">
|
||||
<div class="flex">
|
||||
<a-button type="link" size="small" @click="handleShowDetail(record)"
|
||||
>详情</a-button
|
||||
@ -36,13 +33,6 @@
|
||||
<!-- <a-button type="link" size="small" @click="handleShowChangeLog(record)">变更详情</a-button> -->
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'bizType'">
|
||||
{{ handName(record.bizType, yeWuType) }}
|
||||
</template>
|
||||
<!-- <template v-if="column.dataIndex === 'status'">
|
||||
{{ handName(record.status, shenStatus) }}
|
||||
</template> -->
|
||||
</template>
|
||||
</BasicTable>
|
||||
|
||||
<!-- 审批操作日志弹框 -->
|
||||
@ -65,11 +55,9 @@
|
||||
:list-url="getApprovalLogList"
|
||||
:scroll-y="500"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<template #action="{ column, record }">
|
||||
{{ handName(record.action, actionTypeDict) }}
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</a-modal>
|
||||
@ -94,19 +82,17 @@
|
||||
:list-url="getApprovalChangeLogList"
|
||||
:scroll-y="500"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'operationType'">
|
||||
<template #operationType="{ column, record }">
|
||||
{{ handName(record.operationType, operationTypeDict) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'bizType'">
|
||||
<template #bizType="{ column, record }">
|
||||
{{ handName(record.bizType, yeWuType) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'changeJson'">
|
||||
<template #changeJson="{ column, record }">
|
||||
<pre style="max-height: 200px; overflow: auto; margin: 0">{{
|
||||
record.changeJson
|
||||
}}</pre>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</a-modal>
|
||||
@ -136,8 +122,7 @@
|
||||
:scroll-y="'500px'"
|
||||
:transform-data="customTransform"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'isfs'">
|
||||
<template #isfs="{ column, record }">
|
||||
<a-tag
|
||||
:color="
|
||||
record.isfs === 1 || record.isfs === '1' ? 'success' : 'error'
|
||||
@ -146,17 +131,14 @@
|
||||
{{ record.isfs === 1 || record.isfs === '1' ? '是' : '否' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'direction'">
|
||||
<template #direction="{ column, record }">
|
||||
{{ handName(record.direction, direction) }}
|
||||
</template>
|
||||
<template
|
||||
v-if="column.key === 'action' || column.dataIndex === 'action'"
|
||||
>
|
||||
<template #action="{ column, record }">
|
||||
<a-button type="link" size="small" @click="handleView(record)"
|
||||
>查看</a-button
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</a-modal>
|
||||
@ -365,7 +347,8 @@ let columns = ref([
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
fixed: 'right'
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' }
|
||||
}
|
||||
]);
|
||||
const tableRef = ref();
|
||||
@ -378,11 +361,11 @@ const handleSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.status
|
||||
},
|
||||
values.rvcd !== "all" && {
|
||||
field: "rvcd",
|
||||
operator: "eq",
|
||||
dataType: "string",
|
||||
value: values.rvcd,
|
||||
values.rvcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
},
|
||||
values.stcd && {
|
||||
field: 'stcd',
|
||||
@ -412,7 +395,8 @@ const approvalLogColumns = ref([
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
slots: { customRender: 'action' }
|
||||
},
|
||||
{
|
||||
title: '操作人',
|
||||
@ -451,14 +435,16 @@ const changeLogColumns = ref([
|
||||
dataIndex: 'bizType',
|
||||
key: 'bizType',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
slots: { customRender: 'bizType' }
|
||||
},
|
||||
{
|
||||
title: '操作类型',
|
||||
dataIndex: 'operationType',
|
||||
key: 'operationType',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
slots: { customRender: 'operationType' }
|
||||
},
|
||||
{
|
||||
title: '操作人',
|
||||
@ -541,13 +527,15 @@ const detailColumns = ref([
|
||||
dataIndex: 'isfs',
|
||||
key: 'isfs',
|
||||
title: '是否鱼苗',
|
||||
width: 74
|
||||
width: 74,
|
||||
slots: { customRender: 'isfs' }
|
||||
},
|
||||
{
|
||||
dataIndex: 'direction',
|
||||
key: 'direction',
|
||||
title: '游向',
|
||||
width: 80
|
||||
width: 80,
|
||||
slots: { customRender: 'direction' }
|
||||
},
|
||||
{ dataIndex: 'fcnt', key: 'fcnt', title: '过鱼数量(尾)', width: 120 },
|
||||
{ dataIndex: 'fsz', key: 'fsz', title: '体长(cm)', width: 110 },
|
||||
@ -560,7 +548,8 @@ const detailColumns = ref([
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
slots: { customRender: 'action' }
|
||||
}
|
||||
]);
|
||||
|
||||
@ -616,11 +605,11 @@ const handleDetailSearchFinish = (values: any) => {
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
},
|
||||
values.rvcd !== "all" && {
|
||||
field: "rvcd",
|
||||
operator: "eq",
|
||||
dataType: "string",
|
||||
value: values.rvcd,
|
||||
values.rvcd !== 'all' && {
|
||||
field: 'rvcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
},
|
||||
approvalId.value && {
|
||||
field: 'approvalId', // 字段名
|
||||
|
||||
Loading…
Reference in New Issue
Block a user