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