数据管理子系统优化
This commit is contained in:
parent
3578d5e963
commit
320e588cab
@ -388,6 +388,33 @@ export function getFishReleaseList(data) {
|
||||
});
|
||||
}
|
||||
|
||||
// 鱼类放鱼 - 详情查询
|
||||
export function getFishReleaseDetailList(data) {
|
||||
return request({
|
||||
url: '/fb/fishrun/qgc/detail/GetKendoListCust',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 鱼类放鱼 - 详情删除
|
||||
export function deleteFishRunQgcDetailData(data) {
|
||||
return request({
|
||||
url: '/fb/fishrun/qgc/removeFishRunQgcDetailData',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 鱼类放鱼 - 详情修改
|
||||
export function updateFishRunQgcDetailData(data) {
|
||||
return request({
|
||||
url: '/fb/fishrun/qgc/updateFishRunQgcDetailData',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 流量站 - 断面
|
||||
export function getFlowStationSectionList(data) {
|
||||
return request({
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -72,4 +72,12 @@ const handleCancel = () => {
|
||||
sourceValue.value = '';
|
||||
emit('cancel');
|
||||
};
|
||||
|
||||
// 每次打开时清空上一次的修改依据,避免缓存残留
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) sourceValue.value = '';
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@ -82,10 +82,16 @@ import { useDraggable } from "@/utils/drag";
|
||||
|
||||
defineOptions({ name: "OperationLogModal" });
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
tableName: string;
|
||||
}>();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
open: boolean;
|
||||
tableName: string;
|
||||
recordNameTitle?: string;
|
||||
}>(),
|
||||
{
|
||||
recordNameTitle: "电站",
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(["update:open"]);
|
||||
|
||||
@ -129,10 +135,10 @@ const searchList: any = [
|
||||
];
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<any[]>([
|
||||
const columns = computed<any[]>(() => [
|
||||
{
|
||||
key: "recordName",
|
||||
title: "电站",
|
||||
title: props.recordNameTitle,
|
||||
dataIndex: "recordName",
|
||||
visible: true,
|
||||
width: 120,
|
||||
@ -151,11 +157,8 @@ const columns = ref<any[]>([
|
||||
dataIndex: "operateTime",
|
||||
visible: true,
|
||||
width: 160,
|
||||
customRender: ({ text }: { text: string }) => {
|
||||
if (!text || text === "-") return "-";
|
||||
const date = dayjs(text);
|
||||
return date.isValid() ? date.format("YYYY-MM-DD") : "-";
|
||||
},
|
||||
sort: true,
|
||||
|
||||
},
|
||||
{
|
||||
key: "source",
|
||||
|
||||
@ -76,6 +76,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="'SD_ENGINFO_B_H'"
|
||||
:record-name-title="'电站'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -123,7 +123,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FISHDICTORY_B'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FISHDICTORY_B'" :record-name-title="'鱼类名称'" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_AIBOX_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_AIBOX_B_H'" :record-name-title="'站名'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_OTTE_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_OTTE_B_H'" :record-name-title="'工程名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_AIMONITOR_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_AIMONITOR_B_H'" :record-name-title="'站名'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteFpFn" :label="'过鱼设施'" title="删除过鱼设施" @success="handleEditSuccess" />
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FPSS_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FPSS_B_H'" :record-name-title="'设施名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -383,7 +383,7 @@ const loadDropdownData = () => {
|
||||
field: 'sttpCode',
|
||||
operator: 'in',
|
||||
dataType: 'string',
|
||||
value: ['TE', 'OTTE']
|
||||
value: ['TE']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ const getBaseList = async () => {
|
||||
"field": "sttpCode",
|
||||
"operator": "in",
|
||||
"dataType": "string",
|
||||
"value": ["TE", "OTTE"]
|
||||
"value": ["TE"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_TE_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_TE_B_H'" :record-name-title="'断面名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FHBT_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FHBT_B_H'" :record-name-title="'栖息地名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</BasicTable>
|
||||
<EditVaModal v-model:open="editVisible" :record="editRecord" :is-add="isAdd" @success="handleEditSuccess" />
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteVaFn" :label="'动物救助站'" title="删除动物救助站" @success="handleEditSuccess" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VA_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VA_B_H'" :record-name-title="'救助站名称'" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteEqFn" :label="'生态流量设施'" title="删除生态流量设施" @success="handleEditSuccess" />
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_EQ_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_EQ_B_H'" :record-name-title="'设施名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteVdFn" :label="'视频监控'" title="删除视频监控点" @success="handleEditSuccess" />
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VDINFO_B'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VDINFO_B'" :record-name-title="'监控点名'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -394,7 +394,7 @@ const loadDropdownData = () => {
|
||||
field: 'sttpCode',
|
||||
operator: 'in',
|
||||
dataType: 'string',
|
||||
value: ['WE', 'OTWE']
|
||||
value: ['WE']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ const getBaseList = async () => {
|
||||
"field": "sttpCode",
|
||||
"operator": "in",
|
||||
"dataType": "string",
|
||||
"value": ["WE", "OTWE"]
|
||||
"value": ["WE"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_WE_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_WE_B_H'" :record-name-title="'断面名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="'SD_WT_B_H'"
|
||||
:record-name-title="'测站'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="'SD_WQ_B_H'"
|
||||
:record-name-title="'测站'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_SONAR_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_SONAR_B_H'" :record-name-title="'站名'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_DW_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_DW_B_H'" :record-name-title="'设施名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
@success="handleEditSuccess"
|
||||
/>
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_OTWE_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_OTWE_B_H'" :record-name-title="'工程名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -303,7 +303,7 @@ const loadEngOptions = async (baseId?: string) => {
|
||||
|
||||
const loadDropdownData = () => {
|
||||
sttpGetKendoList({
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['FB', 'VD_FB', 'VD_FBP'] }] }
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['FB'] }] }
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
|
||||
@ -71,7 +71,7 @@ const getBaseList = async () => {
|
||||
filter: {
|
||||
logic: 'and',
|
||||
filters: [
|
||||
{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['FB', 'VD_FB', 'VD_FBP'] }
|
||||
{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['FB'] }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteFbFn" :label="'鱼类增殖站'" title="删除鱼类增殖站" @success="handleEditSuccess" />
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FBRD_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_FBRD_B_H'" :record-name-title="'增殖站名称'"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -258,7 +258,7 @@ const loadEngOptions = async (baseId?: string) => {
|
||||
|
||||
const loadDropdownData = () => {
|
||||
sttpGetKendoList({
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['VP', 'VD_VP', 'AI_VP_GRAZE', 'AI_VP_WATER'] }] }
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['VP', 'AI_VP_GRAZE', 'AI_VP_WATER'] }] }
|
||||
}).then(res => {
|
||||
sttpOptions.value = (res.data?.data || []).map((item: any) => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
});
|
||||
|
||||
@ -28,7 +28,7 @@ const searchList: any = computed(() => [
|
||||
|
||||
const getBaseList = async () => {
|
||||
const res = await sttpGetKendoList({
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['VP', 'VD_VP', 'AI_VP_GRAZE', 'AI_VP_WATER'] }] }
|
||||
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['VP', 'AI_VP_GRAZE', 'AI_VP_WATER'] }] }
|
||||
});
|
||||
sttpOption.value = res.data.data.map(item => ({ label: item.sttpName, value: item.sttpCode }));
|
||||
};
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<DeleteConfirmModal ref="deleteModalRef" :delete-fn="deleteVpFn" :label="'珍稀植物园'" title="删除珍稀植物园" @success="handleEditSuccess" />
|
||||
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VP_B_H'" />
|
||||
<OperationLogModal v-model:open="operationLogVisible" :table-name="'SD_VP_B_H'" :record-name-title="'植物园名称'" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -192,14 +192,13 @@
|
||||
<div style="display: flex; align-items: center">
|
||||
<a-checkbox value="baseId">基地:</a-checkbox>
|
||||
<a-select
|
||||
v-model:value="formData.rvcd"
|
||||
v-model:value="formData.yearBaseId"
|
||||
placeholder="请选择水电基地"
|
||||
mode="multiple"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
:loading="rvcdLoading"
|
||||
@change="handleRvcdChange"
|
||||
style="width: 200px; margin-right: 10px"
|
||||
:max-tag-count="2"
|
||||
>
|
||||
@ -292,6 +291,7 @@ const formData = reactive({
|
||||
yearStatContent: [] as string[],
|
||||
statYears: [] as string[],
|
||||
yearDimContent: [] as string[],
|
||||
yearBaseId: [] as string[],
|
||||
lyRvcd: [] as string[],
|
||||
dimensionStat: '',
|
||||
content: ''
|
||||
@ -403,6 +403,50 @@ const loadLyOptions = async () => {
|
||||
lyLoading.value = false;
|
||||
}
|
||||
};
|
||||
// 时间维度切换时清理表单缓存,避免残留上次的选择
|
||||
watch(
|
||||
() => formData.timeDimension,
|
||||
(newVal, oldVal) => {
|
||||
if (newVal === oldVal) return;
|
||||
// 清空公共字段(基地/电站/流域)
|
||||
formData.rvcd = [];
|
||||
formData.stations = [];
|
||||
formData.lyRvcd = [];
|
||||
formData.yearBaseId = [];
|
||||
if (newVal === 'year') {
|
||||
// 清理月度/日/时统计字段
|
||||
formData.monitorElements = [];
|
||||
formData.statMonths = [];
|
||||
formData.dataSource = 'true';
|
||||
// 恢复年统计默认值
|
||||
formData.yearStatContent = ['wq', 'qec'];
|
||||
formData.yearDimContent = ['stcd', 'baseId'];
|
||||
formData.statYears = [String(new Date().getFullYear())];
|
||||
// 恢复默认基地/水电站(避免切换后为空)
|
||||
if (rvcdOptions.value.length > 0) {
|
||||
formData.rvcd = [rvcdOptions.value[0].value];
|
||||
formData.yearBaseId = [rvcdOptions.value[0].value];
|
||||
loadStationOptions(formData.rvcd);
|
||||
}
|
||||
loadLyOptions();
|
||||
} else {
|
||||
// 清理年统计字段
|
||||
formData.yearStatContent = [];
|
||||
formData.statYears = [];
|
||||
formData.yearDimContent = [];
|
||||
// 恢复月度统计默认值
|
||||
formData.statMonths = getDefaultStatMonths();
|
||||
if (dataFieldOption.value.length > 0) {
|
||||
formData.monitorElements = dataFieldOption.value.map((item: any) => item.itemCode);
|
||||
}
|
||||
if (rvcdOptions.value.length > 0) {
|
||||
formData.rvcd = [rvcdOptions.value[0].value];
|
||||
loadStationOptions(formData.rvcd);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const getExstatus = async (taskId, exportParams) => {
|
||||
let res1: any = await qgcExportstatus({ taskId: taskId });
|
||||
if (res1.status == 'PROCESSING') {
|
||||
@ -457,8 +501,11 @@ const handleExport = async () => {
|
||||
if (formData.yearDimContent.includes('stcd')) {
|
||||
params.stcd = formData.stations.join(',');
|
||||
}
|
||||
if (formData.yearDimContent.includes('baseId')) {
|
||||
params.baseId = formData.rvcd.join(',');
|
||||
if (
|
||||
formData.yearDimContent.includes('baseId') &&
|
||||
formData.yearBaseId.length > 0
|
||||
) {
|
||||
params.baseId = formData.yearBaseId.join(',');
|
||||
}
|
||||
if (formData.yearDimContent.includes('ly')) {
|
||||
params.hbRvcd = formData.lyRvcd.join(',');
|
||||
|
||||
@ -1,17 +1,66 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:open="visible"
|
||||
title="编辑放鱼数据"
|
||||
width="600px"
|
||||
:footer="null"
|
||||
title="修改放鱼数据"
|
||||
width="60vw"
|
||||
:confirm-loading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-empty description="编辑功能开发中,接口待接入" />
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:label-col="{ span: 8 }"
|
||||
:wrapper-col="{ span: 16 }"
|
||||
:rules="formRules"
|
||||
class="max-h-[70vh] overflow-y-auto pr-4"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="电站名称">
|
||||
<a-input :value="formData.stnm" disabled />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="放鱼时间">
|
||||
<a-input :value="formData.tm" disabled />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="放鱼种类">
|
||||
<a-input :value="formData.ftpName" disabled />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="数量(万尾)" name="fcnt">
|
||||
<a-input-number
|
||||
v-model:value="formData.fcnt"
|
||||
placeholder="请输入数量"
|
||||
:min="0"
|
||||
:precision="4"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<ConfirmModal
|
||||
v-model:open="confirmModalVisible"
|
||||
:diff-list="diffList"
|
||||
:confirm-loading="confirmLoading"
|
||||
@confirm="handleConfirmSubmit"
|
||||
@cancel="handleConfirmCancel"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import ConfirmModal from '@/components/ConfirmModal/index.vue';
|
||||
import { useDraggable } from '@/utils/drag';
|
||||
import { updateFishRunQgcDetailData } from '@/api/DataQueryMenuModule';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
@ -25,4 +74,142 @@ const visible = computed({
|
||||
set: val => emit('update:open', val)
|
||||
});
|
||||
useDraggable(visible, { boundary: true, resetOnOpen: true });
|
||||
|
||||
const formRef = ref();
|
||||
const confirmLoading = ref(false);
|
||||
const confirmModalVisible = ref(false);
|
||||
const formData = ref<any>({});
|
||||
const originalRecord = ref<any>({});
|
||||
|
||||
const formRules = ref<any>({
|
||||
fcnt: [{ required: true, message: '请输入数量', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 按修改顺序记录变更
|
||||
const changeOrder = ref<
|
||||
{ field: string; label: string; oldValue: string; newValue: string }[]
|
||||
>([]);
|
||||
const diffList = changeOrder;
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
newData => {
|
||||
const original = originalRecord.value;
|
||||
for (const key in newData) {
|
||||
const oldVal = original[key];
|
||||
const newVal = newData[key];
|
||||
if (oldVal !== newVal) {
|
||||
const existingIdx = changeOrder.value.findIndex(c => c.field === key);
|
||||
const oldNorm =
|
||||
oldVal === null || oldVal === undefined || oldVal === '-'
|
||||
? null
|
||||
: oldVal;
|
||||
const newNorm = newVal === null || newVal === undefined ? null : newVal;
|
||||
if (oldNorm === newNorm) continue;
|
||||
if (
|
||||
oldNorm !== null &&
|
||||
newNorm !== null &&
|
||||
!isNaN(Number(oldNorm)) &&
|
||||
!isNaN(Number(newNorm)) &&
|
||||
Number(oldNorm) === Number(newNorm)
|
||||
)
|
||||
continue;
|
||||
const entry = {
|
||||
field: key,
|
||||
label: '数量(万尾)',
|
||||
oldValue: oldNorm === null ? '空' : String(oldNorm),
|
||||
newValue: newNorm === null ? '空' : String(newNorm)
|
||||
};
|
||||
if (existingIdx >= 0) {
|
||||
changeOrder.value[existingIdx] = entry;
|
||||
} else {
|
||||
changeOrder.value.push(entry);
|
||||
}
|
||||
} else {
|
||||
changeOrder.value = changeOrder.value.filter(c => c.field !== key);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 监听 record 变化
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
if (!newRecord) {
|
||||
formData.value = {};
|
||||
originalRecord.value = {};
|
||||
changeOrder.value = [];
|
||||
return;
|
||||
}
|
||||
// 表格中数量按 尾 存储,弹窗以 万尾 展示/编辑
|
||||
const fcntWan = Number(newRecord.fcnt) / 10000;
|
||||
formData.value = {
|
||||
stnm: newRecord.stnm,
|
||||
tm: newRecord.tm ?? newRecord.flyr,
|
||||
ftpName: newRecord.ftpName,
|
||||
fcnt: isNaN(fcntWan) ? null : fcntWan
|
||||
};
|
||||
originalRecord.value = { ...formData.value };
|
||||
changeOrder.value = [];
|
||||
confirmModalVisible.value = false;
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
const handleOk = async () => {
|
||||
try {
|
||||
await formRef.value?.validateFields();
|
||||
if (changeOrder.value.length === 0) {
|
||||
message.info('未检测到任何修改');
|
||||
return;
|
||||
}
|
||||
confirmModalVisible.value = true;
|
||||
} catch (error) {
|
||||
console.error('验证失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirmSubmit = async (source: string) => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const updateData: Record<string, any> = {
|
||||
id: props.record?.id,
|
||||
stnm: formData.value.stnm,
|
||||
tm: formData.value.tm,
|
||||
ftpName: formData.value.ftpName,
|
||||
fcnt:
|
||||
formData.value.fcnt === null || formData.value.fcnt === undefined
|
||||
? ''
|
||||
: formData.value.fcnt * 10000
|
||||
};
|
||||
const res = await updateFishRunQgcDetailData({
|
||||
updateData,
|
||||
source: source.trim()
|
||||
});
|
||||
if (res?.code == 0 || res?.success) {
|
||||
message.success('修改成功');
|
||||
confirmModalVisible.value = false;
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
} else {
|
||||
message.error(res?.msg || '修改失败');
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('提交失败,请重试');
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirmCancel = () => {
|
||||
confirmModalVisible.value = false;
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
visible.value = false;
|
||||
confirmModalVisible.value = false;
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -5,84 +5,22 @@
|
||||
width="90vw"
|
||||
:footer="null"
|
||||
>
|
||||
<!-- 查询区:复用页面搜索项 -->
|
||||
<BasicSearch
|
||||
ref="basicSearchRef"
|
||||
:searchList="searchList"
|
||||
:initial-values="initSearchData"
|
||||
:zhujianfujian="'fu'"
|
||||
@reset="handleResetWrapper"
|
||||
@finish="onSearchFinish"
|
||||
@values-change="onValuesChange"
|
||||
>
|
||||
<template #jcdt>
|
||||
<a-date-picker
|
||||
class="w-[160px]"
|
||||
v-model:value="jcdt.min"
|
||||
format="YYYY"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
picker="year"
|
||||
:showTime="timeShowTime"
|
||||
placeholder="起始时间"
|
||||
:showToday="false"
|
||||
>
|
||||
<template #renderExtraFooter>
|
||||
<div class="flex items-center flex-wrap px-2">
|
||||
<span
|
||||
v-for="item in timeDateList"
|
||||
:key="item"
|
||||
@click="handleRangeClick(item)"
|
||||
>
|
||||
<a class="text-[#1890ff] mr-1"> {{ item.label }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</a-date-picker>
|
||||
至
|
||||
<a-form-item-rest>
|
||||
<a-date-picker
|
||||
class="w-[160px]"
|
||||
v-model:value="jcdt.max"
|
||||
format="YYYY"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
picker="year"
|
||||
:showTime="timeShowTime"
|
||||
:disabledDate="disabledEndDate"
|
||||
placeholder="结束时间"
|
||||
:showToday="false"
|
||||
>
|
||||
<template #renderExtraFooter>
|
||||
<div class="flex items-center flex-wrap px-2">
|
||||
<span
|
||||
v-for="item in timeDateList"
|
||||
:key="item"
|
||||
@click="handleRangeClick(item)"
|
||||
>
|
||||
<a class="text-[#1890ff] mr-1"> {{ item.label }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</a-date-picker>
|
||||
</a-form-item-rest>
|
||||
</template>
|
||||
<template #actions>
|
||||
<a-button
|
||||
danger
|
||||
:disabled="!selectedRowKeys.length"
|
||||
@click="handleBatchDelete"
|
||||
>批量删除</a-button
|
||||
>
|
||||
</template>
|
||||
</BasicSearch>
|
||||
<div class="title_xiang">
|
||||
<a-button
|
||||
danger
|
||||
:disabled="!selectedRowKeys.length"
|
||||
@click="handleBatchDelete"
|
||||
>批量删除</a-button
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- 表格(无放流总量列) -->
|
||||
<BasicTable
|
||||
ref="tableRef"
|
||||
:enable-row-selection="true"
|
||||
:row-key="getRowKey"
|
||||
:columns="columns"
|
||||
:list-url="listUrl"
|
||||
:scrollY="500"
|
||||
:scrollY="500"
|
||||
:list-url="getFishReleaseDetailList"
|
||||
:searchParams="{ sort }"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
@ -119,13 +57,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, nextTick } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import BasicSearch from '@/components/BasicSearch/index.vue';
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
import BasicTable from '@/components/BasicTable/index.vue';
|
||||
import EditFishReleaseModal from './EditFishReleaseModal.vue';
|
||||
import DeleteConfirmModal from '@/views/DataQueryMenuModule/components/conventionalHydropower/BasicData/DeleteConfirmModal.vue';
|
||||
import { useTimeScale } from '@/store/composables/useTimeScale';
|
||||
import {
|
||||
getFishReleaseDetailList,
|
||||
deleteFishRunQgcDetailData
|
||||
} from '@/api/DataQueryMenuModule';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { useDraggable } from '@/utils/drag';
|
||||
|
||||
@ -143,92 +82,6 @@ const visible = computed({
|
||||
useDraggable(visible, { boundary: true, resetOnOpen: true });
|
||||
|
||||
const tableRef = ref();
|
||||
const basicSearchRef = ref();
|
||||
|
||||
const initSearchData = {
|
||||
rvcd: 'all',
|
||||
rstcd: null,
|
||||
stcd: null
|
||||
};
|
||||
|
||||
const timeDateList = ref([
|
||||
{
|
||||
label: '一年',
|
||||
value: [dayjs().startOf('year'), dayjs().endOf('year')]
|
||||
},
|
||||
{
|
||||
label: '两年',
|
||||
value: [dayjs().subtract(1, 'year').startOf('year'), dayjs().endOf('year')]
|
||||
},
|
||||
{
|
||||
label: '三年',
|
||||
value: [dayjs().subtract(2, 'year').startOf('year'), dayjs().endOf('year')]
|
||||
},
|
||||
{
|
||||
label: '五年',
|
||||
value: [
|
||||
dayjs().subtract(4, 'year').startOf('year'),
|
||||
dayjs().startOf('year')
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
const {
|
||||
jcdt,
|
||||
currentTimeScale,
|
||||
timeShowTime,
|
||||
handleRangeClick,
|
||||
disabledEndDate,
|
||||
handleSearchFinish,
|
||||
handleValuesChange,
|
||||
init
|
||||
} = useTimeScale({
|
||||
defaultTimeScale: initSearchData.timeScale,
|
||||
onSearchFinish: values => initTable(values),
|
||||
onReset: () => initTable(initSearchData)
|
||||
});
|
||||
|
||||
const searchList: any = computed(() => [
|
||||
{
|
||||
type: 'waterStation',
|
||||
name: 'rvcd',
|
||||
label: '流域',
|
||||
placeholder: '请输入流域名称',
|
||||
fieldProps: {
|
||||
allowClear: true
|
||||
},
|
||||
options: []
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
name: 'jcdt',
|
||||
label: '时间',
|
||||
fieldProps: {
|
||||
allowClear: false
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
const onSearchFinish = (values: any) => {
|
||||
handleSearchFinish(values);
|
||||
};
|
||||
|
||||
const onValuesChange = (changedValues: any, allValues: any) => {
|
||||
handleValuesChange(changedValues, allValues);
|
||||
};
|
||||
|
||||
const handleResetWrapper = () => {
|
||||
currentTimeScale.value = initSearchData.timeScale;
|
||||
const now = dayjs();
|
||||
jcdt.value = {
|
||||
min: `${now
|
||||
.subtract(1, 'year')
|
||||
.startOf('year')
|
||||
.format('YYYY-MM-DD')} 00:00:00`,
|
||||
max: `${now.endOf('year').format('YYYY-MM-DD')} 23:59:59`
|
||||
};
|
||||
handleSearchFinish({ ...initSearchData });
|
||||
};
|
||||
|
||||
const sort = ref<any>([
|
||||
{ field: 'baseStepSort', dir: 'asc' },
|
||||
@ -237,12 +90,6 @@ const sort = ref<any>([
|
||||
{ field: 'flyr', dir: 'asc' }
|
||||
]);
|
||||
|
||||
// TODO: 弹窗查询接口待接入,暂时返回空数据
|
||||
const listUrl = async () => {
|
||||
console.warn('放鱼详情查询接口待接入');
|
||||
return { data: { records: [], total: 0 } };
|
||||
};
|
||||
|
||||
// 表格列(无放流总量)
|
||||
const columns: any[] = [
|
||||
{
|
||||
@ -250,44 +97,26 @@ const columns: any[] = [
|
||||
title: '电站名称',
|
||||
dataIndex: 'stnm',
|
||||
visible: true,
|
||||
width: 200,
|
||||
sort: true,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
key: 'baseName',
|
||||
title: '所属基地',
|
||||
dataIndex: 'baseName',
|
||||
key: 'tm',
|
||||
title: '放鱼时间',
|
||||
dataIndex: 'tm',
|
||||
sort: true,
|
||||
width: 160,
|
||||
mergeDeps: ['stnm']
|
||||
},
|
||||
{
|
||||
key: 'flyr',
|
||||
title: '放鱼年份',
|
||||
dataIndex: 'flyr',
|
||||
sort: true,
|
||||
width: 160,
|
||||
mergeDeps: ['stnm']
|
||||
},
|
||||
{
|
||||
key: 'release',
|
||||
title: '放流来源',
|
||||
dataIndex: 'release',
|
||||
mergeDeps: ['stnm'],
|
||||
width: 250
|
||||
},
|
||||
{
|
||||
key: 'ftpName',
|
||||
title: '放鱼种类',
|
||||
dataIndex: 'ftpName',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
key: 'fcnt',
|
||||
title: '数量(万尾)',
|
||||
dataIndex: 'fcnt',
|
||||
width: 100,
|
||||
sort: true,
|
||||
customRender: ({ record }: any) =>
|
||||
(record.fcnt / 10000).toFixed(4) || '-'
|
||||
},
|
||||
@ -303,12 +132,55 @@ const columns: any[] = [
|
||||
// 多选相关(唯一标识 stcd+ftpName)
|
||||
const selectedRowKeys = ref<string[]>([]);
|
||||
const selectedRows = ref<any[]>([]);
|
||||
const getRowKey = (record: any) => `${record.stcd}_${record.ftpName}`;
|
||||
const handleSelectionChange = (keys: string[], rows: any[]) => {
|
||||
selectedRowKeys.value = keys;
|
||||
selectedRows.value = rows;
|
||||
};
|
||||
|
||||
// 使用当前行记录的 stcd、flyr、ftp 组装过滤条件请求详情
|
||||
const loadDetail = (record: any) => {
|
||||
if (!record) return;
|
||||
const filters = [
|
||||
{
|
||||
field: 'stcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: record.stcd
|
||||
},
|
||||
{
|
||||
field: 'flyr',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: String(record.flyr ?? '')
|
||||
},
|
||||
{
|
||||
field: 'ftp',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: record.ftp
|
||||
}
|
||||
].filter(f => f.value !== undefined && f.value !== null && f.value !== '');
|
||||
tableRef.value?.getList({
|
||||
logic: 'and',
|
||||
filters
|
||||
});
|
||||
};
|
||||
|
||||
// 监听 record 变化,打开时自动查询
|
||||
// 首次打开时弹窗内容尚未挂载,需等 nextTick 后 tableRef 就绪再请求
|
||||
watch(
|
||||
() => props.record,
|
||||
newRecord => {
|
||||
selectedRowKeys.value = [];
|
||||
selectedRows.value = [];
|
||||
nextTick(() => {
|
||||
tableRef.value?.clearSelection();
|
||||
loadDetail(newRecord);
|
||||
});
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
// 编辑
|
||||
const editVisible = ref(false);
|
||||
const editRecord = ref<any>(null);
|
||||
@ -318,68 +190,29 @@ const handleEdit = (record: any) => {
|
||||
};
|
||||
|
||||
const handleEditSuccess = () => {
|
||||
initTable(currentSearchParams.value);
|
||||
};
|
||||
|
||||
const currentSearchParams = ref<any>({});
|
||||
|
||||
const initTable = (values: any) => {
|
||||
currentSearchParams.value = values;
|
||||
const filters = [
|
||||
values.rvcd && values.rvcd !== 'all'
|
||||
? {
|
||||
field: 'rvcd',
|
||||
operator: 'contains',
|
||||
dataType: 'string',
|
||||
value: values.rvcd
|
||||
}
|
||||
: null,
|
||||
values.rstcd
|
||||
? {
|
||||
field: 'rstcd',
|
||||
operator: 'eq',
|
||||
dataType: 'string',
|
||||
value: values.rstcd
|
||||
}
|
||||
: null
|
||||
].filter(Boolean);
|
||||
if (values.jcdt) {
|
||||
filters.push(
|
||||
{
|
||||
field: 'flyr',
|
||||
operator: 'gte',
|
||||
dataType: 'date',
|
||||
value: dayjs(values.jcdt.min).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
{
|
||||
field: 'flyr',
|
||||
operator: 'lte',
|
||||
dataType: 'date',
|
||||
value: dayjs(values.jcdt.max).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
);
|
||||
}
|
||||
tableRef.value?.getList({
|
||||
logic: 'and',
|
||||
filters
|
||||
});
|
||||
loadDetail(props.record);
|
||||
emit('success');
|
||||
};
|
||||
|
||||
// 删除
|
||||
const deleteModalRef = ref();
|
||||
const deleteLabel = '放鱼数据';
|
||||
|
||||
// 删除接口暂未提供,待接入后替换
|
||||
// 删除(兼容单条:record.id;批量:record.ids 数组),传参参考以前页面 id 传参
|
||||
const handleDeleteFn = async (record: any, reason: string) => {
|
||||
message.error('删除接口暂未提供');
|
||||
throw new Error('删除接口暂未提供');
|
||||
const ids = record.ids || [record.id];
|
||||
return deleteFishRunQgcDetailData({
|
||||
ids,
|
||||
source: reason
|
||||
});
|
||||
};
|
||||
|
||||
const refreshAfterDelete = () => {
|
||||
selectedRowKeys.value = [];
|
||||
selectedRows.value = [];
|
||||
tableRef.value?.clearSelection();
|
||||
initTable(currentSearchParams.value);
|
||||
loadDetail(props.record);
|
||||
emit('success');
|
||||
};
|
||||
|
||||
const handleDelete = (record: any) => {
|
||||
@ -396,7 +229,7 @@ const handleBatchDelete = () => {
|
||||
}
|
||||
deleteModalRef.value?.open(
|
||||
{
|
||||
ids: [...selectedRowKeys.value],
|
||||
ids: selectedRows.value.map((r: any) => r.id),
|
||||
stnm: `选中的 ${selectedRowKeys.value.length} 条数据`
|
||||
},
|
||||
() => {
|
||||
@ -404,17 +237,12 @@ const handleBatchDelete = () => {
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
const now = dayjs();
|
||||
jcdt.value = {
|
||||
min: `${now
|
||||
.subtract(1, 'year')
|
||||
.startOf('year')
|
||||
.format('YYYY-MM-DD')} 00:00:00`,
|
||||
max: `${now.endOf('year').format('YYYY-MM-DD')} 23:59:59`
|
||||
};
|
||||
handleSearchFinish({ ...initSearchData });
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.title_xiang{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -35,12 +35,14 @@
|
||||
<FishReleaseDetailModal
|
||||
v-model:open="detailVisible"
|
||||
:record="detailRecord"
|
||||
@success="handleDetailSuccess"
|
||||
/>
|
||||
|
||||
<!-- 操作日志弹框 -->
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="operationTableName"
|
||||
:record-name-title="'电站'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -247,6 +249,11 @@ const handleDetail = (record: any) => {
|
||||
detailVisible.value = true;
|
||||
};
|
||||
|
||||
// 详情弹窗内修改/删除成功后刷新页面表格
|
||||
const handleDetailSuccess = () => {
|
||||
initTable(currentSearchParams.value);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
tableScrollY.value = calcTableScrollY();
|
||||
|
||||
@ -215,6 +215,7 @@ watch(
|
||||
q: null,
|
||||
v: null
|
||||
};
|
||||
sourceValue.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -273,6 +274,7 @@ const handleConfirmSubmit = async () => {
|
||||
if (res?.code == 0 || res?.success) {
|
||||
message.success('编辑成功');
|
||||
confirmModalVisible.value = false;
|
||||
sourceValue.value = '';
|
||||
visible.value = false;
|
||||
emit('success');
|
||||
} else {
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="operationTableName"
|
||||
:record-name-title="'站点'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="operationTableName"
|
||||
:record-name-title="'断面名称'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -104,6 +104,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="operationTableName"
|
||||
:record-name-title="'测站'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
<OperationLogModal
|
||||
v-model:open="operationLogVisible"
|
||||
:table-name="operationTableName"
|
||||
:record-name-title="'测站/断面名称'"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user