sjtb 页面修改 表格多选修改
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
054adf7672
commit
0817d15258
@ -79,6 +79,7 @@
|
||||
placeholder="请选择"
|
||||
@change="dataDimensionDataChange"
|
||||
show-search
|
||||
:loading="shuJuTianBaoStore.baseLoading"
|
||||
:filter-option="filterOption"
|
||||
style="width: 135px"
|
||||
>
|
||||
@ -96,6 +97,7 @@
|
||||
placeholder="请选择电站"
|
||||
@change="stcdIdChange"
|
||||
show-search
|
||||
:loading="shuJuTianBaoStore.engLoading"
|
||||
:filter-option="filterOption"
|
||||
style="width: 135px"
|
||||
>
|
||||
@ -169,7 +171,6 @@
|
||||
import { ref, computed, reactive, watch, onMounted, nextTick } from "vue";
|
||||
import { useShuJuTianBaoStore } from "@/store/modules/shuJuTianBao";
|
||||
const shuJuTianBaoStore = useShuJuTianBaoStore();
|
||||
// import { nextTick } from "process";
|
||||
|
||||
// --- 类型定义 ---
|
||||
export interface SearchItem {
|
||||
|
||||
@ -33,6 +33,7 @@ interface Props {
|
||||
searchParams?: Record<string, any>;
|
||||
// 默认每页显示数量
|
||||
defaultPageSize?: number;
|
||||
getCheckboxProps?: (record: any) => any;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@ -40,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
rowKey: "id",
|
||||
searchParams: () => ({}),
|
||||
defaultPageSize: 20,
|
||||
getCheckboxProps: undefined
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
@ -66,9 +68,7 @@ const rowSelection = computed(() => ({
|
||||
selectedRows.value = rows;
|
||||
emit("selection-change", keys, rows);
|
||||
},
|
||||
getCheckboxProps: (record: any) => ({
|
||||
// disabled: record.status === 'SUBMITTED'
|
||||
}),
|
||||
getCheckboxProps: props.getCheckboxProps ? props.getCheckboxProps : (record: any) => ({})
|
||||
}));
|
||||
|
||||
// --- Pagination Config ---
|
||||
|
||||
@ -71,7 +71,6 @@
|
||||
import { ref, onMounted, computed, watch } from "vue";
|
||||
import { getFishDictoryDropdown } from "@/api/select";
|
||||
import { useShuJuTianBaoStore } from "@/store/modules/shuJuTianBao";
|
||||
import { init } from "echarts";
|
||||
const shuJuTianBaoStore = useShuJuTianBaoStore();
|
||||
|
||||
// --- Props & Emits ---
|
||||
@ -170,7 +169,7 @@ const handleSelectOption = (opt: any) => {
|
||||
const handleChange = (val: any) => {
|
||||
// 当 a-select 内部触发 change 时(例如删除 Tag)
|
||||
// 在单选模式下,如果用户通过键盘或删除操作改变了值,这里也会捕获
|
||||
emit("update:modelValue", val, opt);
|
||||
emit("update:modelValue", val, '');
|
||||
};
|
||||
|
||||
const getFishNameById = (id: string) => {
|
||||
|
||||
@ -7,6 +7,7 @@ export default {
|
||||
// 登录页面国际化
|
||||
login: {
|
||||
title: '水电水利建设项目全过程环境管理信息平台',
|
||||
titleSjtb: '水电水利建设项目全过程数据填报系统',
|
||||
username: '用户名',
|
||||
rulesUsername: '用户账号/身份证号/手机号 不能为空',
|
||||
password: '密码',
|
||||
|
||||
@ -54,7 +54,9 @@ onBeforeUnmount(() => {
|
||||
href="/"
|
||||
class="h-[50px] min-w-[350px] flex items-center justify-center text-white"
|
||||
>
|
||||
<h1 class="text-blank font-bold text-[16px]">{{ t("login.title") }}</h1></a
|
||||
<!-- <h1 class="text-blank font-bold text-[16px]">{{ t("login.title") }}</h1> -->
|
||||
<h1 class="text-blank font-bold text-[16px]">{{ t("login.titleSjtb") }}</h1>
|
||||
</a
|
||||
>
|
||||
</transition>
|
||||
<Sidebar />
|
||||
|
||||
@ -9,7 +9,7 @@ NProgress.configure({ showSpinner: false });
|
||||
const permissionStore = usePermissionStoreHook();
|
||||
|
||||
// 白名单路由
|
||||
const whiteList = ['/login', '/login-sjtb']; //login
|
||||
const whiteList = ['/login']; //login
|
||||
|
||||
// 查找第一个可用路由
|
||||
function findFirstAvailableRoute(routes: any[]): string | undefined {
|
||||
@ -35,7 +35,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
|
||||
if (userStore.Token) {
|
||||
// 登录成功,跳转到首页
|
||||
if (to.path === '/login-sjtb' || to.path === '/login') {//login
|
||||
if (to.path === '/login') {//login
|
||||
next({ path: '/' });
|
||||
NProgress.done();
|
||||
} else {
|
||||
@ -80,7 +80,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
await userStore.resetToken();
|
||||
to.path === '/login-sjtb' ? next(`/login-sjtb?redirect=${to.path}`) : next(`/login?redirect=${to.path}`);
|
||||
next(`/login?redirect=${to.path}`);
|
||||
NProgress.done();
|
||||
}
|
||||
}
|
||||
@ -91,7 +91,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
next();
|
||||
} else {
|
||||
to.path === '/login-sjtb' ? next(`/login-sjtb?redirect=${to.path}`) : next(`/login?redirect=${to.path}`);
|
||||
next(`/login?redirect=${to.path}`);
|
||||
NProgress.done();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,13 +16,13 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// path: '/login',
|
||||
// component: () => import('@/views/login/index.vue'),
|
||||
// meta: { hidden: true }
|
||||
// },
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: { hidden: true }
|
||||
},
|
||||
{
|
||||
path: '/login-sjtb',
|
||||
component: () => import('@/views/login-sjtb/index.vue'),
|
||||
meta: { hidden: true }
|
||||
},
|
||||
@ -31,11 +31,11 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
component: () => import('@/views/error-page/404.vue'),
|
||||
meta: { hidden: true }
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
component: () => import('@/views/error-page/401.vue'),
|
||||
meta: { hidden: true }
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
component: () => import('@/views/error-page/401.vue'),
|
||||
meta: { hidden: true }
|
||||
}
|
||||
];
|
||||
|
||||
// 创建路由
|
||||
|
||||
@ -6,13 +6,16 @@ import { set } from 'lodash';
|
||||
export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
// 1. 直接使用 ref 定义状态,确保响应式
|
||||
const fpssOption = ref<any[]>([]);
|
||||
const fpssLoading = ref(false);
|
||||
const baseOption = ref<any[]>([]);
|
||||
const baseLoading = ref(false);
|
||||
const engOption = ref<any[]>([]);
|
||||
const engLoading = ref(false);
|
||||
const fishOption = ref([]);
|
||||
|
||||
// 2. 业务逻辑方法
|
||||
// 获取水电基地列表
|
||||
const getBaseOption = async () => {
|
||||
try {
|
||||
baseLoading.value = true;
|
||||
const res = await getBaseDropdown({});
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
const list = [...res.data];
|
||||
@ -25,11 +28,14 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取水电基地列表失败:', error);
|
||||
} finally {
|
||||
baseLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 获取电站列表
|
||||
const getEngOption = async (baseId: string) => {
|
||||
try {
|
||||
engLoading.value = true;
|
||||
const param = baseId === 'all' ? {} : { baseId };
|
||||
const res = await getEngInfoDropdown(param);
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
@ -38,16 +44,20 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取电站列表失败:', error);
|
||||
} finally {
|
||||
engLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 获取过鱼设施列表
|
||||
const getFpssOption = async (baseId: string, rstcd: string) => {
|
||||
try {
|
||||
fpssLoading.value = true;
|
||||
const res = await getFpssDropdown({ baseId, rstcd });
|
||||
fpssOption.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
fpssLoading.value = false;
|
||||
}
|
||||
};
|
||||
const getFishOption = () => {
|
||||
@ -63,6 +73,9 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
||||
baseOption,
|
||||
engOption,
|
||||
fishOption,
|
||||
fpssLoading,
|
||||
baseLoading,
|
||||
engLoading,
|
||||
getBaseOption,
|
||||
getEngOption,
|
||||
getFpssOption,
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<!-- 左侧:背景图区域 -->
|
||||
<div class="left-section">
|
||||
<div class="slogan">
|
||||
<p>采集网站及数据管理子系统</p>
|
||||
<p>{{ $t("login.titleSjtb") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
:list-url="getFishDraftPage"
|
||||
:search-params="{}"
|
||||
:enable-row-selection="true"
|
||||
:get-checkbox-props="getCheckboxProps"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 使用 bodyCell 插槽自定义单元格渲染 -->
|
||||
@ -94,7 +95,6 @@
|
||||
:width="1500"
|
||||
v-model:open="visible"
|
||||
maskClosable="false"
|
||||
@cancel="handleCancel"
|
||||
:confirm-loading="fileLoading"
|
||||
>
|
||||
<GuoYuSheShiShuJuTianBaoTable
|
||||
@ -104,9 +104,6 @@
|
||||
:direction="direction"
|
||||
@update:file-table-data="(val) => fileTableData = val"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<template #footer>
|
||||
<a-button key="back" @click="handleCustomCancel">取消导入</a-button>
|
||||
<a-button
|
||||
@ -475,6 +472,13 @@ const handleReject = (id: any) => {
|
||||
},
|
||||
});
|
||||
};
|
||||
// 多选禁用
|
||||
const getCheckboxProps = (record: any) => {
|
||||
console.log(record)
|
||||
return {
|
||||
disabled: record.status === 'SUBMITTED' || record.status === 'APPROVED',
|
||||
};
|
||||
};
|
||||
// 多选
|
||||
const handleSelectionChange = (keys: any) => {
|
||||
batchData.value = keys;
|
||||
@ -559,24 +563,19 @@ const checkTableDataChanges = () => {
|
||||
const handleModalOk = () => {
|
||||
console.log(orgFileTableData.value)
|
||||
console.log(fileTableData.value)
|
||||
console.log(
|
||||
modalTableRef.value.editingData)
|
||||
console.log(modalTableRef.value.editingData)
|
||||
if (modalTableRef.value.editingData != undefined) {
|
||||
message.warning("请点击保存后提交数据!");
|
||||
return
|
||||
}
|
||||
const { hasChanged, changedCount } = checkTableDataChanges();
|
||||
const { hasChanged, changedCount } = checkTableDataChanges();
|
||||
|
||||
// 3. 如果没有变化,直接返回,不执行后续操作
|
||||
if (!hasChanged) {
|
||||
message.info("数据未发生任何变化,无需提交");
|
||||
return;
|
||||
}
|
||||
console.log(123)
|
||||
// if (warnings.value.length > 0) {
|
||||
// message.warning("请先修复数据");
|
||||
// return;
|
||||
// }
|
||||
console.log(123)
|
||||
// Modal.confirm({
|
||||
// title: "是否提交导入数据?",
|
||||
// onOk: async () => {
|
||||
@ -669,8 +668,10 @@ const importBtn = async () => {
|
||||
let res: any = await checkImportStatus();
|
||||
taskId.value = "";
|
||||
if (res?.code == 0) {
|
||||
const { hasImportingTask ,currentTask} = res?.data || {};
|
||||
taskId.value = currentTask.id;
|
||||
const { hasImportingTask, currentTask} = res?.data || {};
|
||||
if (currentTask) {
|
||||
taskId.value = currentTask.id;
|
||||
}
|
||||
if (hasImportingTask) {
|
||||
visible.value = true;
|
||||
nextTick(async () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user