修改bug,过鱼倒数修改,添加过鱼设施
This commit is contained in:
parent
34502b7ed2
commit
f150c29d46
@ -167,3 +167,20 @@ export function getMonitorDataWaterTempVerticalHour(data: any) {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 在线监测数据
|
||||||
|
export function getMonitorDataOnline(data: any) {
|
||||||
|
return request({
|
||||||
|
url: '/fp/fpssTable/qgc/GetKendoListCust',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 运行状态
|
||||||
|
export function getRunState(data: any) {
|
||||||
|
return request({
|
||||||
|
url: '/wmp-env-server/env/fp/query/qgc/sdfpssr/GetKendoListCust',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -0,0 +1,248 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="mb-2">
|
||||||
|
时间:
|
||||||
|
<a-range-picker
|
||||||
|
v-model:value="searchParams"
|
||||||
|
type="daterange"
|
||||||
|
:allow-clear="false"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
/>
|
||||||
|
<a-button class="ml-2" type="primary" @click="initData">查询</a-button>
|
||||||
|
</div>
|
||||||
|
<BasicTable
|
||||||
|
ref="tableRef"
|
||||||
|
:scrollY="500"
|
||||||
|
:columns="columns"
|
||||||
|
:list-url="getMonitorDataOnline"
|
||||||
|
/>
|
||||||
|
<!-- 图片预览弹框 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:open="imagePreviewVisible"
|
||||||
|
title="图片预览"
|
||||||
|
:footer="null"
|
||||||
|
width="800px"
|
||||||
|
>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<img :src="previewImageUrl" style="width: 100%; height: 600px" />
|
||||||
|
</div>
|
||||||
|
</a-modal>
|
||||||
|
<!-- 视频预览弹框 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:open="videoPreviewVisible"
|
||||||
|
title="视频预览"
|
||||||
|
:footer="null"
|
||||||
|
width="800px"
|
||||||
|
>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<video
|
||||||
|
:src="previewVideoUrl"
|
||||||
|
controls
|
||||||
|
style="width: 100%; height: 600px"
|
||||||
|
></video>
|
||||||
|
</div>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, watch, computed, h } from 'vue';
|
||||||
|
import { Button } from 'ant-design-vue';
|
||||||
|
import BasicTable from '@/components/BasicTable/index.vue';
|
||||||
|
import { getMonitorDataOnline } from '@/api/mapModal';
|
||||||
|
import { useModelStore } from '@/store/modules/model';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const modelStore = useModelStore();
|
||||||
|
const hasLoaded = ref(false);
|
||||||
|
const tableRef = ref();
|
||||||
|
const searchParams = ref([
|
||||||
|
dayjs().subtract(5, 'year').format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 图片预览
|
||||||
|
const imagePreviewVisible = ref(false);
|
||||||
|
const previewImageUrl = ref('');
|
||||||
|
// 视频预览
|
||||||
|
const videoPreviewVisible = ref(false);
|
||||||
|
const previewVideoUrl = ref('');
|
||||||
|
|
||||||
|
const openImagePreview = (url: string) => {
|
||||||
|
previewImageUrl.value = url;
|
||||||
|
imagePreviewVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const openVideoPreview = (url: string) => {
|
||||||
|
previewVideoUrl.value = url;
|
||||||
|
videoPreviewVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
isActive: { type: Boolean, default: false }
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '测站名称',
|
||||||
|
dataIndex: 'stnm',
|
||||||
|
width: 240,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间',
|
||||||
|
dataIndex: 'tm',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }: any) =>
|
||||||
|
text ? dayjs(text).format('YYYY-MM-DD') : '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '鱼种类',
|
||||||
|
dataIndex: 'ftp',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '鱼长度(cm)',
|
||||||
|
dataIndex: 'length',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '鱼宽度(cm)',
|
||||||
|
dataIndex: 'width',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '鱼速度(m/s)',
|
||||||
|
dataIndex: 'fishspeed',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => (text ? Number(text).toFixed(2) : '-')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '鱼游向',
|
||||||
|
dataIndex: 'directionName',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '水温(℃)',
|
||||||
|
dataIndex: 'temperature',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => {
|
||||||
|
const num = parseFloat(text);
|
||||||
|
return isNaN(num) ? '-' : num.toFixed(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '流速(m/s)',
|
||||||
|
dataIndex: 'speed',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => {
|
||||||
|
const num = parseFloat(text);
|
||||||
|
return isNaN(num) ? '-' : num.toFixed(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '轮廓图',
|
||||||
|
dataIndex: 'firstimgurl',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => {
|
||||||
|
const hasValidUrl =
|
||||||
|
text &&
|
||||||
|
text !== '-' &&
|
||||||
|
text.trim() !== '' &&
|
||||||
|
text !== 'null' &&
|
||||||
|
text !== 'undefined';
|
||||||
|
return h(
|
||||||
|
Button,
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
disabled: !hasValidUrl,
|
||||||
|
style: {
|
||||||
|
color: !hasValidUrl ? '#ccc' : '#1890ff',
|
||||||
|
cursor: !hasValidUrl ? 'not-allowed' : 'pointer'
|
||||||
|
},
|
||||||
|
onClick: () => {
|
||||||
|
if (hasValidUrl) {
|
||||||
|
openImagePreview(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
() => '查看图片'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '短视频',
|
||||||
|
dataIndex: 'videourl',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => {
|
||||||
|
console.log(text);
|
||||||
|
const hasValidUrl =
|
||||||
|
text &&
|
||||||
|
text !== '-' &&
|
||||||
|
text.trim() !== '' &&
|
||||||
|
text !== 'null' &&
|
||||||
|
text !== 'undefined';
|
||||||
|
return h(
|
||||||
|
Button,
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
disabled: !hasValidUrl,
|
||||||
|
style: {
|
||||||
|
color: !hasValidUrl ? '#ccc' : '#1890ff',
|
||||||
|
cursor: !hasValidUrl ? 'not-allowed' : 'pointer'
|
||||||
|
},
|
||||||
|
onClick: () => {
|
||||||
|
if (hasValidUrl) {
|
||||||
|
openVideoPreview(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
() => '查看视频'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const initData = async () => {
|
||||||
|
const filter = {
|
||||||
|
logic: 'and',
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
field: 'tm',
|
||||||
|
operator: 'gte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: searchParams.value[0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'tm',
|
||||||
|
operator: 'lte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: searchParams.value[1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'stcd',
|
||||||
|
operator: 'in',
|
||||||
|
dataType: 'string',
|
||||||
|
value: ['008640203900001049', '008640203900011009']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
tableRef.value?.getList(filter);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.isActive,
|
||||||
|
active => {
|
||||||
|
if (active) {
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.fish-facility-monitor-data {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,226 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="mb-2">
|
||||||
|
时间:
|
||||||
|
<a-date-picker v-model:value="searchParams.tm" picker="year" />
|
||||||
|
<span class="ml-2"> 鱼类:</span>
|
||||||
|
<a-select
|
||||||
|
v-model:value="searchParams.ftp"
|
||||||
|
placeholder="请选择"
|
||||||
|
class="w-[160px]"
|
||||||
|
:loading="loadFtp"
|
||||||
|
allowClear
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="item in ftpList"
|
||||||
|
:key="item.id"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<span class="ml-2"> 游向:</span>
|
||||||
|
<a-select
|
||||||
|
v-model:value="searchParams.direction"
|
||||||
|
placeholder="请选择游向"
|
||||||
|
class="w-[120px]"
|
||||||
|
allowClear
|
||||||
|
:loading="loadDirection"
|
||||||
|
>
|
||||||
|
<a-select-option
|
||||||
|
v-for="item in direction"
|
||||||
|
:key="item.itemCode"
|
||||||
|
:value="item.itemCode"
|
||||||
|
>{{ item.dictName }}</a-select-option
|
||||||
|
>
|
||||||
|
</a-select>
|
||||||
|
<span class="ml-2"> 过鱼目标:</span>
|
||||||
|
<a-tooltip title="暂无数据" placement="top">
|
||||||
|
<a-button size="small"><i class="iconfont icon-yulei"></i></a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-button class="ml-2" type="primary" @click="initData">查询</a-button>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-around mt-[20px] mb-[10px]">
|
||||||
|
<div>计划开始运行时间:暂无数据</div>
|
||||||
|
<div>计划结束运行时间:暂无数据</div>
|
||||||
|
<div>计划运行频率次:暂无数据</div>
|
||||||
|
<div>计划全年运行次数:暂无数据</div>
|
||||||
|
</div>
|
||||||
|
<BasicTable
|
||||||
|
ref="tableRef"
|
||||||
|
:scrollY="500"
|
||||||
|
:columns="columns"
|
||||||
|
:list-url="getRunState"
|
||||||
|
/>
|
||||||
|
<!-- 图片预览弹框 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:open="imagePreviewVisible"
|
||||||
|
title="图片预览"
|
||||||
|
:footer="null"
|
||||||
|
width="800px"
|
||||||
|
>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<img :src="previewImageUrl" style="width: 100%; height: 600px" />
|
||||||
|
</div>
|
||||||
|
</a-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, watch, computed, h } from 'vue';
|
||||||
|
import { Button } from 'ant-design-vue';
|
||||||
|
import BasicTable from '@/components/BasicTable/index.vue';
|
||||||
|
import { getRunState } from '@/api/mapModal';
|
||||||
|
import { getDictItemsByCode } from '@/api/dict';
|
||||||
|
import { getFishDictoryDropdown } from '@/api/select';
|
||||||
|
import { useModelStore } from '@/store/modules/model';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const modelStore = useModelStore();
|
||||||
|
const hasLoaded = ref(false);
|
||||||
|
const tableRef = ref();
|
||||||
|
const searchParams = ref({
|
||||||
|
tm: dayjs(),
|
||||||
|
direction: null,
|
||||||
|
ftp: null
|
||||||
|
});
|
||||||
|
// 游向
|
||||||
|
const loadDirection = ref(false);
|
||||||
|
const direction = ref([]);
|
||||||
|
// 鱼类
|
||||||
|
const loadFtp = ref(false);
|
||||||
|
const ftpList = ref([]);
|
||||||
|
|
||||||
|
// 图片预览
|
||||||
|
const imagePreviewVisible = ref(false);
|
||||||
|
const previewImageUrl = ref('');
|
||||||
|
const openImagePreview = (url: string) => {
|
||||||
|
previewImageUrl.value = url;
|
||||||
|
imagePreviewVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
isActive: { type: Boolean, default: false }
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '鱼类',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '过鱼数量(尾)',
|
||||||
|
dataIndex: 'fcnt',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '游向',
|
||||||
|
dataIndex: 'direction',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => (text ? text : '-')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '开始时间',
|
||||||
|
dataIndex: 'strdt',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }: any) =>
|
||||||
|
text ? dayjs(text).format('YYYY-MM-DD') : '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结束时间',
|
||||||
|
dataIndex: 'enddt',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }: any) =>
|
||||||
|
text ? dayjs(text).format('YYYY-MM-DD') : '-'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '附件',
|
||||||
|
dataIndex: 'firstimgurl',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
customRender: ({ text }: any) => {
|
||||||
|
const hasValidUrl =
|
||||||
|
text &&
|
||||||
|
text !== '-' &&
|
||||||
|
text.trim() !== '' &&
|
||||||
|
text !== 'null' &&
|
||||||
|
text !== 'undefined';
|
||||||
|
return h(
|
||||||
|
Button,
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
disabled: !hasValidUrl,
|
||||||
|
style: {
|
||||||
|
color: !hasValidUrl ? '#ccc' : '#1890ff',
|
||||||
|
cursor: !hasValidUrl ? 'not-allowed' : 'pointer'
|
||||||
|
},
|
||||||
|
onClick: () => {
|
||||||
|
if (hasValidUrl) {
|
||||||
|
openImagePreview(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
() => '查看附件'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const initData = async () => {
|
||||||
|
const filter = {
|
||||||
|
logic: 'and',
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
field: 'strdt',
|
||||||
|
operator: 'gte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: dayjs(searchParams.value.tm)
|
||||||
|
.startOf('year')
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'strdt',
|
||||||
|
operator: 'lte',
|
||||||
|
dataType: 'date',
|
||||||
|
value: dayjs(searchParams.value.tm)
|
||||||
|
.endOf('year')
|
||||||
|
.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'stcd',
|
||||||
|
operator: 'in',
|
||||||
|
dataType: 'string',
|
||||||
|
value: ['008640203900011010']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
tableRef.value?.getList(filter);
|
||||||
|
};
|
||||||
|
const getOptions = async () => {
|
||||||
|
loadDirection.value = true;
|
||||||
|
getDictItemsByCode({ dictCode: 'direction' }).then(res => {
|
||||||
|
direction.value = res.data || [];
|
||||||
|
loadDirection.value = false;
|
||||||
|
});
|
||||||
|
loadFtp.value = true;
|
||||||
|
getFishDictoryDropdown().then(res => {
|
||||||
|
ftpList.value = res.data || [];
|
||||||
|
loadFtp.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.isActive,
|
||||||
|
active => {
|
||||||
|
if (active) {
|
||||||
|
getOptions();
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.fish-facility-monitor-data {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
11
frontend/src/components/MapModal/components/FishZHFX.vue
Normal file
11
frontend/src/components/MapModal/components/FishZHFX.vue
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h2>综合分析</h2>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
<style scoped>
|
||||||
|
.fish-facility-monitor-data {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -119,6 +119,21 @@
|
|||||||
: ''
|
: ''
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
<!-- 在线监测数据 -->
|
||||||
|
<FishFacilityMonitorData
|
||||||
|
v-show="currentActiveKey === 'FishFacilityMonitorData'"
|
||||||
|
:is-active="currentActiveKey === 'FishFacilityMonitorData'"
|
||||||
|
/>
|
||||||
|
<!-- 运行情况 -->
|
||||||
|
<FishFacilityRunState
|
||||||
|
v-show="currentActiveKey === 'FishFacilityRunState'"
|
||||||
|
:is-active="currentActiveKey === 'FishFacilityRunState'"
|
||||||
|
/>
|
||||||
|
<!-- 综合分析 -->
|
||||||
|
<FishZHFX
|
||||||
|
v-show="currentActiveKey === 'FishZHFX'"
|
||||||
|
:is-active="currentActiveKey === 'FishZHFX'"
|
||||||
|
/>
|
||||||
<!-- 预警提示 -->
|
<!-- 预警提示 -->
|
||||||
<EarlyWarningAlert
|
<EarlyWarningAlert
|
||||||
v-show="currentActiveKey === 'tableTabs'"
|
v-show="currentActiveKey === 'tableTabs'"
|
||||||
@ -168,6 +183,9 @@ import VerticalWaterTemperature from './components/VerticalWaterTemperature.vue'
|
|||||||
import WaterQuality from './components/WaterQuality.vue'; // 水质
|
import WaterQuality from './components/WaterQuality.vue'; // 水质
|
||||||
import EarlyWarningAlert from './components/EarlyWarningAlert.vue'; // 预警提示
|
import EarlyWarningAlert from './components/EarlyWarningAlert.vue'; // 预警提示
|
||||||
import FlowMeasure from './components/FlowMeasure.vue'; // 流量监测
|
import FlowMeasure from './components/FlowMeasure.vue'; // 流量监测
|
||||||
|
import FishFacilityMonitorData from './components/FishFacilityMonitorData.vue'; // 在线监测数据
|
||||||
|
import FishFacilityRunState from './components/FishFacilityRunState.vue'; // 运行情况
|
||||||
|
import FishZHFX from './components/FishZHFX.vue'; // 鱼类繁殖适宜性分析
|
||||||
import EcologicalFlow from './components/EcologicalFlow.vue'; // 生态流量
|
import EcologicalFlow from './components/EcologicalFlow.vue'; // 生态流量
|
||||||
import Attachment from './components/Attachment.vue'; // 查看报告/批复文件
|
import Attachment from './components/Attachment.vue'; // 查看报告/批复文件
|
||||||
import WaterTemperatureRep from './components/WaterTemperatureRep.vue'; // 水温对比数据
|
import WaterTemperatureRep from './components/WaterTemperatureRep.vue'; // 水温对比数据
|
||||||
|
|||||||
@ -25,9 +25,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, onMounted, watch } from "vue";
|
import moment from 'moment';
|
||||||
import BasicSearch from "@/components/BasicSearch/index.vue";
|
|
||||||
import { useShuJuTianBaoStore } from "@/store/modules/shuJuTianBao";
|
import { ref, computed, onMounted, watch } from 'vue';
|
||||||
|
import BasicSearch from '@/components/BasicSearch/index.vue';
|
||||||
|
import { useShuJuTianBaoStore } from '@/store/modules/shuJuTianBao';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
batchData: any[];
|
batchData: any[];
|
||||||
@ -36,8 +38,8 @@ interface Props {
|
|||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "reset", values: any): void;
|
(e: 'reset', values: any): void;
|
||||||
(e: "search-finish", values: any): void;
|
(e: 'search-finish', values: any): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const shuJuTianBaoStore = useShuJuTianBaoStore();
|
const shuJuTianBaoStore = useShuJuTianBaoStore();
|
||||||
@ -46,33 +48,46 @@ const basicSearchRef = ref<any>();
|
|||||||
const btnLoading = ref<boolean>(false);
|
const btnLoading = ref<boolean>(false);
|
||||||
|
|
||||||
const initSearchData = {
|
const initSearchData = {
|
||||||
rvcd: "all",
|
rvcd: 'all',
|
||||||
stcd: null,
|
stcd: null,
|
||||||
|
reportMonth: moment().subtract(1, 'month').format('YYYY-MM')
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchData = ref<any>({ ...initSearchData });
|
const searchData = ref<any>({ ...initSearchData });
|
||||||
|
|
||||||
const searchList: any = computed(() => [
|
const searchList: any = computed(() => [
|
||||||
{
|
{
|
||||||
type: "waterStation",
|
type: 'waterStation',
|
||||||
name: "rvcd",
|
name: 'rvcd',
|
||||||
label: "流域",
|
label: '流域',
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
allowClear: true,
|
allowClear: true
|
||||||
},
|
},
|
||||||
options: [],
|
options: []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'DataPicker',
|
||||||
|
name: 'reportMonth',
|
||||||
|
label: '月份',
|
||||||
|
picker: 'month',
|
||||||
|
fieldProps: {
|
||||||
|
allowClear: false,
|
||||||
|
format: 'YYYY-MM',
|
||||||
|
valueFormat: 'YYYY-MM'
|
||||||
|
},
|
||||||
|
options: []
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSearchFinish = (values: any) => {
|
const onSearchFinish = (values: any) => {
|
||||||
emit("search-finish", values);
|
emit('search-finish', values);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onValuesChange = (changedValues: any, allValues: any) => {
|
const onValuesChange = (changedValues: any, allValues: any) => {
|
||||||
searchData.value = { ...searchData.value, ...allValues };
|
searchData.value = { ...searchData.value, ...allValues };
|
||||||
if (
|
if (
|
||||||
Object.keys(changedValues)[0] == "rstcd" ||
|
Object.keys(changedValues)[0] == 'rstcd' ||
|
||||||
Object.keys(changedValues)[0] == "rvcd"
|
Object.keys(changedValues)[0] == 'rvcd'
|
||||||
) {
|
) {
|
||||||
const formInstance = basicSearchRef.value?.formData;
|
const formInstance = basicSearchRef.value?.formData;
|
||||||
formInstance.stcd = null;
|
formInstance.stcd = null;
|
||||||
@ -81,15 +96,16 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
|||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
localTypeDate.value = null;
|
localTypeDate.value = null;
|
||||||
emit("reset", initSearchData);
|
emit('reset', initSearchData);
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
btnLoading,
|
btnLoading,
|
||||||
|
searchData
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emit("search-finish", initSearchData);
|
emit('search-finish', initSearchData);
|
||||||
shuJuTianBaoStore.getFpssOption("", "");
|
shuJuTianBaoStore.getFpssOption('', '');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -27,14 +27,36 @@
|
|||||||
<!-- 其他列保持默认(必须写 fallback,否则其他列表头会消失) -->
|
<!-- 其他列保持默认(必须写 fallback,否则其他列表头会消失) -->
|
||||||
<span v-else>{{ column.title }}</span>
|
<span v-else>{{ column.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
a-text
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
|
<Modal
|
||||||
|
v-model:open="urgeModalVisible"
|
||||||
|
title="是否催促选择的用户?"
|
||||||
|
@ok="handleUrgeOk"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
将对选中的
|
||||||
|
<span style="color: #ff4d4f; font-weight: bold"
|
||||||
|
>{{ batchData.length }} 位用户</span
|
||||||
|
>
|
||||||
|
发送【<span style="color: #ff4d4f">过鱼数据填报催促通知</span>】
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 16px">
|
||||||
|
<div style="margin-bottom: 8px">催促内容:</div>
|
||||||
|
<Textarea
|
||||||
|
v-model:value="urgeContent"
|
||||||
|
placeholder="请输入催促内容"
|
||||||
|
:rows="4"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ref, onMounted, h, computed } from 'vue';
|
import { ref, onMounted, h, computed } from 'vue';
|
||||||
import { Checkbox, Tooltip, message, Modal } from 'ant-design-vue';
|
import { Checkbox, Tooltip, message, Modal, Textarea } from 'ant-design-vue';
|
||||||
import BasicTable from '@/components/BasicTable/index.vue';
|
import BasicTable from '@/components/BasicTable/index.vue';
|
||||||
import GuoYuDaoShuTongJiSearch from './guoYuDaoShuTongJiSearch.vue';
|
import GuoYuDaoShuTongJiSearch from './guoYuDaoShuTongJiSearch.vue';
|
||||||
import { statistics, batchUrgeContent } from '@/api/guoYuSheShiShuJuTianBao';
|
import { statistics, batchUrgeContent } from '@/api/guoYuSheShiShuJuTianBao';
|
||||||
@ -44,6 +66,8 @@ const detailTableRef = ref();
|
|||||||
|
|
||||||
const batchData = ref([]);
|
const batchData = ref([]);
|
||||||
const tableDataList = ref<any[]>([]); // 用于存储当前表格数据,方便查找
|
const tableDataList = ref<any[]>([]); // 用于存储当前表格数据,方便查找
|
||||||
|
const urgeModalVisible = ref(false);
|
||||||
|
const urgeContent = ref('');
|
||||||
|
|
||||||
// ✅ 1. 定义获取唯一 Key 的方法 (请根据实际数据字段调整,比如 id, stcd 等)
|
// ✅ 1. 定义获取唯一 Key 的方法 (请根据实际数据字段调整,比如 id, stcd 等)
|
||||||
const getUniqueKey = (item: any) =>
|
const getUniqueKey = (item: any) =>
|
||||||
@ -135,16 +159,9 @@ let columns = ref([
|
|||||||
key: 'selection',
|
key: 'selection',
|
||||||
width: 60,
|
width: 60,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
// ✅ 合并选择列
|
|
||||||
customCell: record => {
|
|
||||||
return {
|
|
||||||
rowSpan: record._selectionRowSpan || 0
|
|
||||||
};
|
|
||||||
},
|
|
||||||
// ✅ 使用 h 函数渲染 Checkbox
|
// ✅ 使用 h 函数渲染 Checkbox
|
||||||
customRender: ({ record }) => {
|
customRender: ({ record }) => {
|
||||||
// 只有合并组的第一行才渲染 Checkbox
|
// 只有合并组的第一行才渲染 Checkbox
|
||||||
if (record._selectionRowSpan && record._selectionRowSpan > 0) {
|
|
||||||
const groupKeys = getGroupKeys(record);
|
const groupKeys = getGroupKeys(record);
|
||||||
|
|
||||||
// 判断状态
|
// 判断状态
|
||||||
@ -161,7 +178,6 @@ let columns = ref([
|
|||||||
indeterminate: isPartiallySelected && !isAllSelected,
|
indeterminate: isPartiallySelected && !isAllSelected,
|
||||||
onChange: (e: any) => handleGroupSelect(e.target.checked, groupKeys)
|
onChange: (e: any) => handleGroupSelect(e.target.checked, groupKeys)
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return null; // 其他行不渲染
|
return null; // 其他行不渲染
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -170,11 +186,6 @@ let columns = ref([
|
|||||||
key: 'basinNames',
|
key: 'basinNames',
|
||||||
title: '流域',
|
title: '流域',
|
||||||
width: 160,
|
width: 160,
|
||||||
customCell: (record, index) => {
|
|
||||||
return {
|
|
||||||
rowSpan: record._basinRowSpan || 0
|
|
||||||
};
|
|
||||||
},
|
|
||||||
customRender: ({ text }: any) => {
|
customRender: ({ text }: any) => {
|
||||||
if (!text) return '-';
|
if (!text) return '-';
|
||||||
|
|
||||||
@ -206,11 +217,6 @@ let columns = ref([
|
|||||||
key: 'stationNames',
|
key: 'stationNames',
|
||||||
title: '电站名称',
|
title: '电站名称',
|
||||||
width: 160,
|
width: 160,
|
||||||
customCell: (record, index) => {
|
|
||||||
return {
|
|
||||||
rowSpan: record._stationRowSpan || 0
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
customRender: ({ text }: any) => {
|
customRender: ({ text }: any) => {
|
||||||
if (!text) return '-';
|
if (!text) return '-';
|
||||||
@ -347,24 +353,31 @@ const handleDetailSearchFinish = (values: any) => {
|
|||||||
dataType: 'date',
|
dataType: 'date',
|
||||||
value: values.strdt[1] + ' 23:59:59'
|
value: values.strdt[1] + ' 23:59:59'
|
||||||
},
|
},
|
||||||
values.rvcd !== "all" && {
|
values.rvcd !== 'all' && {
|
||||||
field: "basinCode",
|
field: 'basinCode',
|
||||||
operator: "eq",
|
operator: 'eq',
|
||||||
dataType: "string",
|
dataType: 'string',
|
||||||
value: values.rvcd,
|
value: values.rvcd
|
||||||
},
|
},
|
||||||
values.rstcd && {
|
values.rstcd && {
|
||||||
field: 'stationCode',
|
field: 'stationCode',
|
||||||
operator: 'eq',
|
operator: 'eq',
|
||||||
dataType: 'string',
|
dataType: 'string',
|
||||||
value: values.rstcd
|
value: values.rstcd
|
||||||
|
},
|
||||||
|
values.reportMonth && {
|
||||||
|
field: 'reportMonth',
|
||||||
|
operator: 'eq',
|
||||||
|
dataType: 'string',
|
||||||
|
value: values.reportMonth
|
||||||
}
|
}
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
logic: 'and',
|
logic: 'and',
|
||||||
filters: filters
|
filters: filters
|
||||||
};
|
};
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
batchData.value = [];
|
||||||
detailTableRef.value?.getList(filter);
|
detailTableRef.value?.getList(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -373,39 +386,35 @@ const handleDetailReset = (values: any) => {
|
|||||||
handleDetailSearchFinish(values);
|
handleDetailSearchFinish(values);
|
||||||
};
|
};
|
||||||
const urgeBtn = async () => {
|
const urgeBtn = async () => {
|
||||||
Modal.confirm({
|
const monthStr = searchRef.value.searchData.reportMonth;
|
||||||
title: '是否催促选择的用户?',
|
const [year, month] = monthStr.split('-');
|
||||||
content: h('div', {}, [
|
urgeContent.value = `根据生态环境部要求,请贵电站尽快完成${year}年${parseInt(
|
||||||
'将对选中的 ',
|
month
|
||||||
h(
|
)}月份过鱼数据的报送工作,感谢支持。`;
|
||||||
'span',
|
urgeModalVisible.value = true;
|
||||||
{ style: { color: '#ff4d4f', fontWeight: 'bold' } },
|
};
|
||||||
batchData.value.length + ' 位用户'
|
|
||||||
),
|
const handleUrgeOk = async () => {
|
||||||
'发送【',
|
|
||||||
h('span', { style: { color: '#ff4d4f' } }, '过鱼数据填报催促通知'),
|
|
||||||
'】'
|
|
||||||
]),
|
|
||||||
onOk: async () => {
|
|
||||||
let ids = [];
|
let ids = [];
|
||||||
searchRef.value.btnLoading = true;
|
searchRef.value.btnLoading = true;
|
||||||
detailTableRef.value.loading = true;
|
detailTableRef.value.loading = true;
|
||||||
batchData.value.forEach((item: any) => {
|
batchData.value.forEach((item: any) => {
|
||||||
ids.push(item.userId);
|
ids.push(item.userId);
|
||||||
});
|
});
|
||||||
|
let res: any = await batchUrgeContent({
|
||||||
let res: any = await batchUrgeContent({ userIds: ids });
|
userIds: ids,
|
||||||
|
content: urgeContent.value
|
||||||
|
});
|
||||||
if (res && res?.code == 0) {
|
if (res && res?.code == 0) {
|
||||||
message.success('催促成功');
|
message.success('催促成功');
|
||||||
detailTableRef.value.loading = false;
|
detailTableRef.value.loading = false;
|
||||||
searchRef.value.btnLoading = false;
|
searchRef.value.btnLoading = false;
|
||||||
|
urgeModalVisible.value = false;
|
||||||
} else {
|
} else {
|
||||||
message.error('催促失败');
|
message.error('催促失败');
|
||||||
detailTableRef.value.loading = false;
|
detailTableRef.value.loading = false;
|
||||||
searchRef.value.btnLoading = false;
|
searchRef.value.btnLoading = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// 初始化
|
// 初始化
|
||||||
onMounted(() => {});
|
onMounted(() => {});
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "user",
|
name: 'user'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, nextTick, watch } from "vue";
|
import { ref, onMounted, nextTick, watch } from 'vue';
|
||||||
import {
|
import {
|
||||||
getTreelist,
|
getTreelist,
|
||||||
gettableData,
|
gettableData,
|
||||||
@ -18,13 +18,13 @@ import {
|
|||||||
delChoise,
|
delChoise,
|
||||||
getFishtree,
|
getFishtree,
|
||||||
saveFishqvan,
|
saveFishqvan,
|
||||||
getuserdata,
|
getuserdata
|
||||||
} from "@/api/user";
|
} from '@/api/user';
|
||||||
import { getDictItemsByCode } from "@/api/dict";
|
import { getDictItemsByCode } from '@/api/dict';
|
||||||
import { ElMessageBox, ElMessage } from "element-plus";
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { useAppStore } from "@/store/modules/app";
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import Page from "@/components/Pagination/page.vue";
|
import Page from '@/components/Pagination/page.vue';
|
||||||
import { Search } from "@element-plus/icons-vue";
|
import { Search } from '@element-plus/icons-vue';
|
||||||
// import { constant } from "lodash";
|
// import { constant } from "lodash";
|
||||||
//左侧树形控件
|
//左侧树形控件
|
||||||
interface Tree {
|
interface Tree {
|
||||||
@ -38,7 +38,7 @@ const loading = ref(false);
|
|||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
querystr: "",
|
querystr: ''
|
||||||
});
|
});
|
||||||
//分页 总条数
|
//分页 总条数
|
||||||
const total = ref();
|
const total = ref();
|
||||||
@ -51,7 +51,7 @@ const infoForm = ref();
|
|||||||
const treeloading = ref(true);
|
const treeloading = ref(true);
|
||||||
function getTree() {
|
function getTree() {
|
||||||
const params = {
|
const params = {
|
||||||
parentid: "0",
|
parentid: '0'
|
||||||
};
|
};
|
||||||
getTreelist(params)
|
getTreelist(params)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
@ -67,7 +67,7 @@ function getTree() {
|
|||||||
treeloading.value = false;
|
treeloading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const currentNodeKey = ref("");
|
const currentNodeKey = ref('');
|
||||||
function handleNodeClick(data: Tree, node: any) {
|
function handleNodeClick(data: Tree, node: any) {
|
||||||
if (data.childList.length == 0) {
|
if (data.childList.length == 0) {
|
||||||
orgId.value = data.id;
|
orgId.value = data.id;
|
||||||
@ -75,7 +75,7 @@ function handleNodeClick(data: Tree, node: any) {
|
|||||||
getdata();
|
getdata();
|
||||||
} else {
|
} else {
|
||||||
node.isCurrent = false;
|
node.isCurrent = false;
|
||||||
currentNodeKey.value = "";
|
currentNodeKey.value = '';
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
currentNodeKey.value = orgId.value;
|
currentNodeKey.value = orgId.value;
|
||||||
});
|
});
|
||||||
@ -83,47 +83,53 @@ function handleNodeClick(data: Tree, node: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: "childList",
|
children: 'childList',
|
||||||
label: "orgname",
|
label: 'orgname'
|
||||||
};
|
};
|
||||||
|
|
||||||
//新建
|
//新建
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const title = ref("");
|
const title = ref('');
|
||||||
function addClick() {
|
function addClick() {
|
||||||
title.value = "新增用户";
|
title.value = '新增用户';
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
info.value = {
|
info.value = {
|
||||||
id: "",
|
id: '',
|
||||||
username: "",
|
username: '',
|
||||||
nickname: "",
|
nickname: '',
|
||||||
email: "",
|
email: '',
|
||||||
phone: "",
|
phone: '',
|
||||||
roleinfo: [],
|
roleinfo: []
|
||||||
};
|
};
|
||||||
getrole();
|
getrole();
|
||||||
}
|
}
|
||||||
//用户列表
|
//用户列表
|
||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const orgId = ref("");
|
const orgId = ref('');
|
||||||
|
const originalStatusMap = ref<Map<string, any>>(new Map());
|
||||||
//获取用户列表信息
|
//获取用户列表信息
|
||||||
function getdata() {
|
function getdata() {
|
||||||
const params = {
|
const params = {
|
||||||
current: queryParams.value.current,
|
current: queryParams.value.current,
|
||||||
size: queryParams.value.size,
|
size: queryParams.value.size,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value,
|
||||||
username: queryParams.value.querystr,
|
username: queryParams.value.querystr
|
||||||
};
|
};
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
gettableData(params)
|
gettableData(params)
|
||||||
.then((res) => {
|
.then(res => {
|
||||||
total.value = res.data.total;
|
total.value = res.data.total;
|
||||||
tableData.value = res.data.records;
|
tableData.value = res.data.records;
|
||||||
queryParams.value.size = res.data.size;
|
queryParams.value.size = res.data.size;
|
||||||
queryParams.value.current = res.data.current;
|
queryParams.value.current = res.data.current;
|
||||||
dialog.value = true;
|
dialog.value = true;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
// 记录每条数据的初始状态
|
||||||
|
originalStatusMap.value = new Map();
|
||||||
|
res.data.records.forEach((item: any) => {
|
||||||
|
originalStatusMap.value.set(item.id, item.status);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -132,27 +138,32 @@ function getdata() {
|
|||||||
|
|
||||||
//禁用启用
|
//禁用启用
|
||||||
function switchChange(row: any) {
|
function switchChange(row: any) {
|
||||||
const elmassage = ref("");
|
const originalStatus = originalStatusMap.value.get(row.id);
|
||||||
if (row.status == "0") {
|
// 如果当前状态和初始状态一致,说明是初始化触发的,不处理
|
||||||
elmassage.value = "确定停用该账号吗?";
|
if (row.status == originalStatus) return;
|
||||||
} else if (row.status == "1") {
|
|
||||||
elmassage.value = "确定启用该账号吗?";
|
const elmassage = ref('');
|
||||||
|
console.log('row', row);
|
||||||
|
if (row.status == '0') {
|
||||||
|
elmassage.value = '确定停用该账号吗?';
|
||||||
|
} else if (row.status == '1') {
|
||||||
|
elmassage.value = '确定启用该账号吗?';
|
||||||
}
|
}
|
||||||
ElMessageBox.confirm(elmassage.value, "提示信息", {
|
ElMessageBox.confirm(elmassage.value, '提示信息', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let params = {
|
let params = {
|
||||||
status: row.status,
|
status: row.status,
|
||||||
id: row.id,
|
id: row.id
|
||||||
};
|
};
|
||||||
DataStatus(params).then(() => {
|
DataStatus(params).then(() => {
|
||||||
getdata();
|
getdata();
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "改变成功",
|
message: '改变成功'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -162,12 +173,12 @@ function switchChange(row: any) {
|
|||||||
}
|
}
|
||||||
//新建用户弹窗
|
//新建用户弹窗
|
||||||
const info = ref({
|
const info = ref({
|
||||||
id: "",
|
id: '',
|
||||||
username: "",
|
username: '',
|
||||||
nickname: "",
|
nickname: '',
|
||||||
email: "",
|
email: '',
|
||||||
phone: "",
|
phone: '',
|
||||||
roleinfo: [] as any[],
|
roleinfo: [] as any[]
|
||||||
});
|
});
|
||||||
//修改-用户
|
//修改-用户
|
||||||
function editdepartment(row: any) {
|
function editdepartment(row: any) {
|
||||||
@ -178,7 +189,7 @@ function editdepartment(row: any) {
|
|||||||
info.value = JSON.parse(JSON.stringify(row));
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
info.value.roleinfo = selectID;
|
info.value.roleinfo = selectID;
|
||||||
rolesdata.value = row.roles;
|
rolesdata.value = row.roles;
|
||||||
title.value = "修改用户";
|
title.value = '修改用户';
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
|
||||||
getrole();
|
getrole();
|
||||||
@ -196,15 +207,15 @@ function confirmClick(formEl: any) {
|
|||||||
nickname: info.value.nickname,
|
nickname: info.value.nickname,
|
||||||
email: info.value.email,
|
email: info.value.email,
|
||||||
phone: info.value.phone,
|
phone: info.value.phone,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value
|
||||||
};
|
};
|
||||||
const roleids = String(info.value.roleinfo);
|
const roleids = String(info.value.roleinfo);
|
||||||
updataUser(params, roleids).then(() => {
|
updataUser(params, roleids).then(() => {
|
||||||
getdata();
|
getdata();
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "修改成功",
|
message: '修改成功'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -213,15 +224,15 @@ function confirmClick(formEl: any) {
|
|||||||
nickname: info.value.nickname,
|
nickname: info.value.nickname,
|
||||||
email: info.value.email,
|
email: info.value.email,
|
||||||
phone: info.value.phone,
|
phone: info.value.phone,
|
||||||
orgid: orgId.value,
|
orgid: orgId.value
|
||||||
};
|
};
|
||||||
const roleids = info.value.roleinfo;
|
const roleids = info.value.roleinfo;
|
||||||
addUsers(params, roleids).then((res) => {
|
addUsers(params, roleids).then(res => {
|
||||||
getdata();
|
getdata();
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: res.data.msg,
|
message: res.data.msg
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -230,8 +241,8 @@ function confirmClick(formEl: any) {
|
|||||||
}
|
}
|
||||||
//用户弹窗规则定义
|
//用户弹窗规则定义
|
||||||
const moderules = ref({
|
const moderules = ref({
|
||||||
username: [{ required: true, message: "请输入用户账号", trigger: "blur" }],
|
username: [{ required: true, message: '请输入用户账号', trigger: 'blur' }],
|
||||||
nickname: [{ required: true, message: "请输入用户名称", trigger: "blur" }],
|
nickname: [{ required: true, message: '请输入用户名称', trigger: 'blur' }]
|
||||||
});
|
});
|
||||||
|
|
||||||
//弹窗关闭
|
//弹窗关闭
|
||||||
@ -241,17 +252,17 @@ function handleClose() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//重置密码
|
//重置密码
|
||||||
const userid = ref("");
|
const userid = ref('');
|
||||||
const resultPawss = ref(false);
|
const resultPawss = ref(false);
|
||||||
const msgText = ref("");
|
const msgText = ref('');
|
||||||
function setpassword(row: any) {
|
function setpassword(row: any) {
|
||||||
ElMessageBox.confirm("确定要重置此账号密码吗?", "重置密码", {
|
ElMessageBox.confirm('确定要重置此账号密码吗?', '重置密码', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const params = {
|
const params = {
|
||||||
id: userid.value,
|
id: userid.value
|
||||||
};
|
};
|
||||||
setpass(params).then((res: any) => {
|
setpass(params).then((res: any) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
@ -272,7 +283,7 @@ function closeResult() {
|
|||||||
|
|
||||||
//过去设施权限维护
|
//过去设施权限维护
|
||||||
const fishway = ref(false);
|
const fishway = ref(false);
|
||||||
const userId = ref("");
|
const userId = ref('');
|
||||||
// 回显的权限ID数组
|
// 回显的权限ID数组
|
||||||
const fishhui = ref<any[]>([]);
|
const fishhui = ref<any[]>([]);
|
||||||
const fishTreeDialog = ref(false);
|
const fishTreeDialog = ref(false);
|
||||||
@ -281,7 +292,7 @@ const fishTreeDialog = ref(false);
|
|||||||
const isFishDataLoaded = ref(false);
|
const isFishDataLoaded = ref(false);
|
||||||
|
|
||||||
async function openFishway(row: any) {
|
async function openFishway(row: any) {
|
||||||
treeInput.value = "";
|
treeInput.value = '';
|
||||||
fishway.value = true;
|
fishway.value = true;
|
||||||
userId.value = row.id;
|
userId.value = row.id;
|
||||||
|
|
||||||
@ -295,7 +306,7 @@ async function openFishway(row: any) {
|
|||||||
await Promise.all([
|
await Promise.all([
|
||||||
getFishTree(), // 获取树形数据
|
getFishTree(), // 获取树形数据
|
||||||
getuserdata({ userId: userId.value }).then((res: any) => {
|
getuserdata({ userId: userId.value }).then((res: any) => {
|
||||||
console.log("用户权限数据:", res);
|
console.log('用户权限数据:', res);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
fishhui.value.push(item.orgId);
|
fishhui.value.push(item.orgId);
|
||||||
@ -308,19 +319,19 @@ async function openFishway(row: any) {
|
|||||||
userId: item.userId,
|
userId: item.userId,
|
||||||
parentId: item.parentId,
|
parentId: item.parentId,
|
||||||
orgLevel: item.orgLevel,
|
orgLevel: item.orgLevel,
|
||||||
permissionType: item.permissionType,
|
permissionType: item.permissionType
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 两个请求都完成后,标记数据已加载
|
// 两个请求都完成后,标记数据已加载
|
||||||
isFishDataLoaded.value = true;
|
isFishDataLoaded.value = true;
|
||||||
console.log("所有数据加载完成,准备回显");
|
console.log('所有数据加载完成,准备回显');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("加载数据失败:", error);
|
console.error('加载数据失败:', error);
|
||||||
ElMessage.error("加载数据失败,请重试");
|
ElMessage.error('加载数据失败,请重试');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,9 +339,9 @@ async function openFishway(row: any) {
|
|||||||
watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
||||||
if (newFishway && newDataLoaded) {
|
if (newFishway && newDataLoaded) {
|
||||||
// 确保两个数据都已加载完成后再执行回显
|
// 确保两个数据都已加载完成后再执行回显
|
||||||
console.log("开始回显, fishTreeRef:", fishTreeRef.value);
|
console.log('开始回显, fishTreeRef:', fishTreeRef.value);
|
||||||
console.log("回显ID:", fishhui.value);
|
console.log('回显ID:', fishhui.value);
|
||||||
console.log("树数据:", fishData.value);
|
console.log('树数据:', fishData.value);
|
||||||
|
|
||||||
// 使用 nextTick 确保 DOM 已更新
|
// 使用 nextTick 确保 DOM 已更新
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@ -346,7 +357,7 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
|||||||
fishhui.value,
|
fishhui.value,
|
||||||
fishData.value
|
fishData.value
|
||||||
);
|
);
|
||||||
console.log("需要展开的父节点codes:", parentCodesToExpand);
|
console.log('需要展开的父节点codes:', parentCodesToExpand);
|
||||||
|
|
||||||
// 控制展开/折叠状态
|
// 控制展开/折叠状态
|
||||||
setTreeExpandState(parentCodesToExpand);
|
setTreeExpandState(parentCodesToExpand);
|
||||||
@ -354,8 +365,8 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
|||||||
// 验证回显结果
|
// 验证回显结果
|
||||||
const checkedKeys = fishTreeRef.value.getCheckedKeys();
|
const checkedKeys = fishTreeRef.value.getCheckedKeys();
|
||||||
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
||||||
console.log("回显完成 - 全选节点:", checkedKeys);
|
console.log('回显完成 - 全选节点:', checkedKeys);
|
||||||
console.log("回显完成 - 半选节点:", halfCheckedKeys);
|
console.log('回显完成 - 半选节点:', halfCheckedKeys);
|
||||||
|
|
||||||
// 同步表格数据
|
// 同步表格数据
|
||||||
fishTableData.value = tableDatafish.value;
|
fishTableData.value = tableDatafish.value;
|
||||||
@ -370,7 +381,7 @@ watch([fishway, isFishDataLoaded], ([newFishway, newDataLoaded]) => {
|
|||||||
});
|
});
|
||||||
} else if (!newFishway) {
|
} else if (!newFishway) {
|
||||||
// 关闭时清空回显数据
|
// 关闭时清空回显数据
|
||||||
console.log("关闭对话框,清理数据");
|
console.log('关闭对话框,清理数据');
|
||||||
fishhui.value = [];
|
fishhui.value = [];
|
||||||
isFishDataLoaded.value = false;
|
isFishDataLoaded.value = false;
|
||||||
// 清除tree选中状态
|
// 清除tree选中状态
|
||||||
@ -416,12 +427,12 @@ function fishHandleClose() {
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
//获取过鱼设施权限
|
//获取过鱼设施权限
|
||||||
const treeInput = ref("");
|
const treeInput = ref('');
|
||||||
const fishProps = {
|
const fishProps = {
|
||||||
children: "children",
|
children: 'children',
|
||||||
label: "name",
|
label: 'name'
|
||||||
};
|
};
|
||||||
watch(treeInput, (val) => {
|
watch(treeInput, val => {
|
||||||
fishTreeRef.value!.filter(val);
|
fishTreeRef.value!.filter(val);
|
||||||
});
|
});
|
||||||
function filterNode(value: string, data: any) {
|
function filterNode(value: string, data: any) {
|
||||||
@ -437,7 +448,7 @@ function getFishTree() {
|
|||||||
fishTreeDialog.value = true;
|
fishTreeDialog.value = true;
|
||||||
const params = {
|
const params = {
|
||||||
// type:'1',
|
// type:'1',
|
||||||
engName: treeInput.value,
|
engName: treeInput.value
|
||||||
};
|
};
|
||||||
return getFishtree(params)
|
return getFishtree(params)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
@ -466,13 +477,16 @@ function getAllChildrenIds(node: any): number[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 过鱼设施权限维护 - 检查父节点下所有子节点是否都被选中
|
// 过鱼设施权限维护 - 检查父节点下所有子节点是否都被选中
|
||||||
function areAllChildrenChecked(parentNode: any, checkedKeysArray: any[]): boolean {
|
function areAllChildrenChecked(
|
||||||
|
parentNode: any,
|
||||||
|
checkedKeysArray: any[]
|
||||||
|
): boolean {
|
||||||
const allChildrenIds = getAllChildrenIds(parentNode);
|
const allChildrenIds = getAllChildrenIds(parentNode);
|
||||||
if (allChildrenIds.length === 0) {
|
if (allChildrenIds.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 检查所有子节点ID是否都在已选中的keys中
|
// 检查所有子节点ID是否都在已选中的keys中
|
||||||
return allChildrenIds.every((code) => checkedKeysArray.includes(code));
|
return allChildrenIds.every(code => checkedKeysArray.includes(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过鱼设施权限维护 - 检查节点是否被其他父节点包含
|
// 过鱼设施权限维护 - 检查节点是否被其他父节点包含
|
||||||
@ -496,7 +510,10 @@ function isNodeContainedByOtherParent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 统一处理选中IDs的过滤逻辑:如果父节点的所有子节点都被选中,只保留父节点ID
|
// 统一处理选中IDs的过滤逻辑:如果父节点的所有子节点都被选中,只保留父节点ID
|
||||||
function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]): number[] {
|
function filterSelectedIds(
|
||||||
|
checkedKeysArray: number[],
|
||||||
|
allCheckedNodes: any[]
|
||||||
|
): number[] {
|
||||||
const resultIds: number[] = [];
|
const resultIds: number[] = [];
|
||||||
const fullySelectedParentIds: number[] = [];
|
const fullySelectedParentIds: number[] = [];
|
||||||
const filteredNodeIds = new Set<number>();
|
const filteredNodeIds = new Set<number>();
|
||||||
@ -507,7 +524,7 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
|||||||
if (areAllChildrenChecked(node, checkedKeysArray)) {
|
if (areAllChildrenChecked(node, checkedKeysArray)) {
|
||||||
fullySelectedParentIds.push(node.code);
|
fullySelectedParentIds.push(node.code);
|
||||||
const childrenIds = getAllChildrenIds(node);
|
const childrenIds = getAllChildrenIds(node);
|
||||||
childrenIds.forEach((childId) => {
|
childrenIds.forEach(childId => {
|
||||||
filteredNodeIds.add(childId);
|
filteredNodeIds.add(childId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -516,9 +533,13 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
|||||||
|
|
||||||
// 第二阶段:添加结果
|
// 第二阶段:添加结果
|
||||||
// 1. 先添加所有"全选"的父节点(但要排除被其他父节点包含的)
|
// 1. 先添加所有"全选"的父节点(但要排除被其他父节点包含的)
|
||||||
fullySelectedParentIds.forEach((parentId) => {
|
fullySelectedParentIds.forEach(parentId => {
|
||||||
if (
|
if (
|
||||||
!isNodeContainedByOtherParent(parentId, fullySelectedParentIds, allCheckedNodes)
|
!isNodeContainedByOtherParent(
|
||||||
|
parentId,
|
||||||
|
fullySelectedParentIds,
|
||||||
|
allCheckedNodes
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
resultIds.push(parentId);
|
resultIds.push(parentId);
|
||||||
}
|
}
|
||||||
@ -528,14 +549,18 @@ function filterSelectedIds(checkedKeysArray: number[], allCheckedNodes: any[]):
|
|||||||
allCheckedNodes.forEach((node: any) => {
|
allCheckedNodes.forEach((node: any) => {
|
||||||
if (!filteredNodeIds.has(node.code) && !resultIds.includes(node.code)) {
|
if (!filteredNodeIds.has(node.code) && !resultIds.includes(node.code)) {
|
||||||
if (
|
if (
|
||||||
!isNodeContainedByOtherParent(node.code, fullySelectedParentIds, allCheckedNodes)
|
!isNodeContainedByOtherParent(
|
||||||
|
node.code,
|
||||||
|
fullySelectedParentIds,
|
||||||
|
allCheckedNodes
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
resultIds.push(node.code);
|
resultIds.push(node.code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("过滤后的IDs:", resultIds);
|
console.log('过滤后的IDs:', resultIds);
|
||||||
return resultIds;
|
return resultIds;
|
||||||
}
|
}
|
||||||
// 查找选中节点的所有父节点code(用于控制展开状态)
|
// 查找选中节点的所有父节点code(用于控制展开状态)
|
||||||
@ -590,7 +615,7 @@ function handleFishCheckChange(checkedNode: any, checkedInfo: any) {
|
|||||||
// 使用统一的过滤逻辑处理IDs
|
// 使用统一的过滤逻辑处理IDs
|
||||||
const resultIds = filterSelectedIds(checkedKeysArray, allCheckedNodes);
|
const resultIds = filterSelectedIds(checkedKeysArray, allCheckedNodes);
|
||||||
|
|
||||||
console.log("最终获取的IDs:", resultIds);
|
console.log('最终获取的IDs:', resultIds);
|
||||||
|
|
||||||
// 更新表格数据
|
// 更新表格数据
|
||||||
getFishTableData(resultIds);
|
getFishTableData(resultIds);
|
||||||
@ -618,7 +643,7 @@ function getFishTableData(ids: any[]) {
|
|||||||
userId: userId.value,
|
userId: userId.value,
|
||||||
parentId: node.parentId,
|
parentId: node.parentId,
|
||||||
orgLevel: node.orgLevel,
|
orgLevel: node.orgLevel,
|
||||||
permissionType: "READ", // 默认选择读权限
|
permissionType: 'READ' // 默认选择读权限
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,16 +661,16 @@ function getFishTableData(ids: any[]) {
|
|||||||
const tableids: any = ref([]);
|
const tableids: any = ref([]);
|
||||||
//选中的过鱼权限
|
//选中的过鱼权限
|
||||||
function fishDataHandleSelectionChange(val: any) {
|
function fishDataHandleSelectionChange(val: any) {
|
||||||
console.log("选中的行数据:", val);
|
console.log('选中的行数据:', val);
|
||||||
fishTableSelection.value = val;
|
fishTableSelection.value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
//移除权限
|
//移除权限
|
||||||
function delFishTable() {
|
function delFishTable() {
|
||||||
ElMessageBox.confirm("确定移除选中权限吗?", "删除提示", {
|
ElMessageBox.confirm('确定移除选中权限吗?', '删除提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// 获取选中的ID数组
|
// 获取选中的ID数组
|
||||||
@ -678,8 +703,8 @@ function delFishTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "删除成功",
|
message: '删除成功'
|
||||||
});
|
});
|
||||||
|
|
||||||
// 清空选中状态
|
// 清空选中状态
|
||||||
@ -721,34 +746,36 @@ function fishSure() {
|
|||||||
parentId: item.parentId,
|
parentId: item.parentId,
|
||||||
orgLevel: item.orgLevel,
|
orgLevel: item.orgLevel,
|
||||||
path: item.path,
|
path: item.path,
|
||||||
permissionType: item.permissionType,
|
permissionType: item.permissionType
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
saveFishqvan({ userId: userId.value, dataScopeList: params }).then((res: any) => {
|
saveFishqvan({ userId: userId.value, dataScopeList: params }).then(
|
||||||
|
(res: any) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "保存成功",
|
message: '保存成功',
|
||||||
type: "success",
|
type: 'success'
|
||||||
});
|
});
|
||||||
fishHandleClose();
|
fishHandleClose();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
//删除用户
|
//删除用户
|
||||||
function delclick(row: any) {
|
function delclick(row: any) {
|
||||||
ElMessageBox.confirm("确定删除此用户吗?", "删除提示", {
|
ElMessageBox.confirm('确定删除此用户吗?', '删除提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const params = {
|
const params = {
|
||||||
id: row.id,
|
id: row.id
|
||||||
};
|
};
|
||||||
deltableData(params).then(() => {
|
deltableData(params).then(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "删除成功",
|
message: '删除成功'
|
||||||
});
|
});
|
||||||
getdata();
|
getdata();
|
||||||
});
|
});
|
||||||
@ -757,9 +784,9 @@ function delclick(row: any) {
|
|||||||
//获取角色
|
//获取角色
|
||||||
function getrole() {
|
function getrole() {
|
||||||
const params = {
|
const params = {
|
||||||
rolename: "",
|
rolename: ''
|
||||||
};
|
};
|
||||||
getRole(params).then((res) => {
|
getRole(params).then(res => {
|
||||||
rolesdata.value = res;
|
rolesdata.value = res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -775,18 +802,18 @@ function delchoice() {
|
|||||||
ids.value.forEach((item: any) => {
|
ids.value.forEach((item: any) => {
|
||||||
choice.push(item.id);
|
choice.push(item.id);
|
||||||
});
|
});
|
||||||
ElMessageBox.confirm("确定删除此用户吗?", "删除提示", {
|
ElMessageBox.confirm('确定删除此用户吗?', '删除提示', {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "warning",
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const params = {
|
const params = {
|
||||||
id: String(choice),
|
id: String(choice)
|
||||||
};
|
};
|
||||||
delChoise(params).then(() => {
|
delChoise(params).then(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "删除成功",
|
message: '删除成功'
|
||||||
});
|
});
|
||||||
getdata();
|
getdata();
|
||||||
});
|
});
|
||||||
@ -799,14 +826,32 @@ function dateFormat(row: any) {
|
|||||||
var date = new Date(daterc);
|
var date = new Date(daterc);
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
var month =
|
var month =
|
||||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
date.getMonth() + 1 < 10
|
||||||
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
? '0' + (date.getMonth() + 1)
|
||||||
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
: date.getMonth() + 1;
|
||||||
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
date.getMonth() + 1 < 10
|
||||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
? '0' + (date.getMonth() + 1)
|
||||||
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
: date.getMonth() + 1;
|
||||||
|
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||||||
|
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||||
|
var minutes =
|
||||||
|
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||||
|
var seconds =
|
||||||
|
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||||
// 拼接
|
// 拼接
|
||||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
return (
|
||||||
|
year +
|
||||||
|
'-' +
|
||||||
|
month +
|
||||||
|
'-' +
|
||||||
|
day +
|
||||||
|
' ' +
|
||||||
|
hours +
|
||||||
|
':' +
|
||||||
|
minutes +
|
||||||
|
':' +
|
||||||
|
seconds
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,11 +859,11 @@ function dateFormat(row: any) {
|
|||||||
//分类名字
|
//分类名字
|
||||||
function getName(arr: any[], type: any): string {
|
function getName(arr: any[], type: any): string {
|
||||||
if (!arr || !Array.isArray(arr) || type === undefined || type === null) {
|
if (!arr || !Array.isArray(arr) || type === undefined || type === null) {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const item = arr.find((item: any) => item?.itemCode === type);
|
const item = arr.find((item: any) => item?.itemCode === type);
|
||||||
return item?.dictName || "";
|
return item?.dictName || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -827,7 +872,7 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
const dictData = ref([]);
|
const dictData = ref([]);
|
||||||
function getdictdata() {
|
function getdictdata() {
|
||||||
getDictItemsByCode({ dictCode: "resourceType" }).then((res) => {
|
getDictItemsByCode({ dictCode: 'resourceType' }).then(res => {
|
||||||
dictData.value = res.data;
|
dictData.value = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -835,18 +880,18 @@ const vMove = {
|
|||||||
mounted(el: any) {
|
mounted(el: any) {
|
||||||
el.onmousedown = function (e: any) {
|
el.onmousedown = function (e: any) {
|
||||||
var init = e.clientX;
|
var init = e.clientX;
|
||||||
var parent: any = document.getElementById("silderLeft");
|
var parent: any = document.getElementById('silderLeft');
|
||||||
const initWidth: any = parent.offsetWidth;
|
const initWidth: any = parent.offsetWidth;
|
||||||
document.onmousemove = function (e) {
|
document.onmousemove = function (e) {
|
||||||
var end = e.clientX;
|
var end = e.clientX;
|
||||||
var newWidth = end - init + initWidth;
|
var newWidth = end - init + initWidth;
|
||||||
parent.style.width = newWidth + "px";
|
parent.style.width = newWidth + 'px';
|
||||||
};
|
};
|
||||||
document.onmouseup = function () {
|
document.onmouseup = function () {
|
||||||
document.onmousemove = document.onmouseup = null;
|
document.onmousemove = document.onmouseup = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
// 递归获取树形数据中所有节点的code
|
// 递归获取树形数据中所有节点的code
|
||||||
function getAllNodeCodes(nodes: any[]): number[] {
|
function getAllNodeCodes(nodes: any[]): number[] {
|
||||||
@ -863,11 +908,11 @@ function getAllNodeCodes(nodes: any[]): number[] {
|
|||||||
// 全选:选中树中所有节点
|
// 全选:选中树中所有节点
|
||||||
function handleSelectAll() {
|
function handleSelectAll() {
|
||||||
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
||||||
ElMessage.warning("暂无数据可全选");
|
ElMessage.warning('暂无数据可全选');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const allCodes = getAllNodeCodes(fishData.value);
|
const allCodes = getAllNodeCodes(fishData.value);
|
||||||
console.log("全选 - 所有节点codes:", allCodes);
|
console.log('全选 - 所有节点codes:', allCodes);
|
||||||
fishTreeRef.value.setCheckedKeys(allCodes, true);
|
fishTreeRef.value.setCheckedKeys(allCodes, true);
|
||||||
|
|
||||||
// 手动更新表格数据(使用统一过滤逻辑)
|
// 手动更新表格数据(使用统一过滤逻辑)
|
||||||
@ -881,16 +926,16 @@ function handleSelectAll() {
|
|||||||
|
|
||||||
getFishTableData(filteredIds);
|
getFishTableData(filteredIds);
|
||||||
tableids.value = filteredIds;
|
tableids.value = filteredIds;
|
||||||
console.log("全选 - 表格数据已更新,过滤后IDs:", filteredIds);
|
console.log('全选 - 表格数据已更新,过滤后IDs:', filteredIds);
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
ElMessage.success("已全选所有节点");
|
ElMessage.success('已全选所有节点');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 反选:反转当前选中状态
|
// 反选:反转当前选中状态
|
||||||
function handleInvertSelection() {
|
function handleInvertSelection() {
|
||||||
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
if (!fishTreeRef.value || !fishData.value || fishData.value.length === 0) {
|
||||||
ElMessage.warning("暂无数据可操作");
|
ElMessage.warning('暂无数据可操作');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,19 +944,23 @@ function handleInvertSelection() {
|
|||||||
// 获取当前半选的节点keys(父节点部分子节点被选中)
|
// 获取当前半选的节点keys(父节点部分子节点被选中)
|
||||||
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
const halfCheckedKeys = fishTreeRef.value.getHalfCheckedKeys();
|
||||||
|
|
||||||
console.log("反选前 - 已选中codes:", checkedKeys);
|
console.log('反选前 - 已选中codes:', checkedKeys);
|
||||||
console.log("反选前 - 半选codes:", halfCheckedKeys);
|
console.log('反选前 - 半选codes:', halfCheckedKeys);
|
||||||
|
|
||||||
// 合并完全选中和半选的节点,这些是需要取消选中的
|
// 合并完全选中和半选的节点,这些是需要取消选中的
|
||||||
const currentSelectedKeys = [...new Set([...checkedKeys, ...halfCheckedKeys])];
|
const currentSelectedKeys = [
|
||||||
console.log("反选前 - 当前有效选中状态:", currentSelectedKeys);
|
...new Set([...checkedKeys, ...halfCheckedKeys])
|
||||||
|
];
|
||||||
|
console.log('反选前 - 当前有效选中状态:', currentSelectedKeys);
|
||||||
|
|
||||||
// 获取所有节点codes
|
// 获取所有节点codes
|
||||||
const allCodes = getAllNodeCodes(fishData.value);
|
const allCodes = getAllNodeCodes(fishData.value);
|
||||||
|
|
||||||
// 计算需要选中的节点:所有节点 - 当前有效选中状态
|
// 计算需要选中的节点:所有节点 - 当前有效选中状态
|
||||||
const invertedCodes = allCodes.filter((code) => !currentSelectedKeys.includes(code));
|
const invertedCodes = allCodes.filter(
|
||||||
console.log("反选后 - 新的选中codes:", invertedCodes);
|
code => !currentSelectedKeys.includes(code)
|
||||||
|
);
|
||||||
|
console.log('反选后 - 新的选中codes:', invertedCodes);
|
||||||
|
|
||||||
// 先清空所有选中状态,避免级联影响
|
// 先清空所有选中状态,避免级联影响
|
||||||
fishTreeRef.value.setCheckedKeys([], false);
|
fishTreeRef.value.setCheckedKeys([], false);
|
||||||
@ -931,11 +980,11 @@ function handleInvertSelection() {
|
|||||||
|
|
||||||
getFishTableData(filteredIds);
|
getFishTableData(filteredIds);
|
||||||
tableids.value = filteredIds;
|
tableids.value = filteredIds;
|
||||||
console.log("反选 - 表格数据已更新,过滤后IDs:", filteredIds);
|
console.log('反选 - 表格数据已更新,过滤后IDs:', filteredIds);
|
||||||
}, 100);
|
}, 100);
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
ElMessage.success("已反选操作");
|
ElMessage.success('已反选操作');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消选中:清空所有选中状态
|
// 取消选中:清空所有选中状态
|
||||||
@ -943,17 +992,17 @@ function handleClearSelection() {
|
|||||||
if (!fishTreeRef.value) {
|
if (!fishTreeRef.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("取消选中 - 清空所有选中");
|
console.log('取消选中 - 清空所有选中');
|
||||||
fishTreeRef.value.setCheckedKeys([], true);
|
fishTreeRef.value.setCheckedKeys([], true);
|
||||||
|
|
||||||
// 手动清空表格数据
|
// 手动清空表格数据
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getFishTableData([]);
|
getFishTableData([]);
|
||||||
tableids.value = [];
|
tableids.value = [];
|
||||||
console.log("取消选中 - 表格数据已清空");
|
console.log('取消选中 - 表格数据已清空');
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
ElMessage.success("已取消所有选中");
|
ElMessage.success('已取消所有选中');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -963,7 +1012,9 @@ function handleClearSelection() {
|
|||||||
<el-tree
|
<el-tree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
:class="
|
:class="
|
||||||
useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'
|
useAppStore().size === 'default'
|
||||||
|
? 'silderLeft-large'
|
||||||
|
: 'silderLeft-default'
|
||||||
"
|
"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
:data="treedata"
|
:data="treedata"
|
||||||
@ -1000,12 +1051,19 @@ function handleClearSelection() {
|
|||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
@keyup.enter="getdata"
|
@keyup.enter="getdata"
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" style="margin-left: 10px" @click="getdata"
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="margin-left: 10px"
|
||||||
|
@click="getdata"
|
||||||
>搜索</el-button
|
>搜索</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button v-hasPerm="['add:user']" type="primary" @click="addClick">
|
<el-button
|
||||||
|
v-hasPerm="['add:user']"
|
||||||
|
type="primary"
|
||||||
|
@click="addClick"
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
src="@/assets/MenuIcon/jscz_xz.png"
|
src="@/assets/MenuIcon/jscz_xz.png"
|
||||||
alt=""
|
alt=""
|
||||||
@ -1018,8 +1076,7 @@ function handleClearSelection() {
|
|||||||
@click="delchoice"
|
@click="delchoice"
|
||||||
:disabled="multipleSelection.length <= 0"
|
:disabled="multipleSelection.length <= 0"
|
||||||
:type="multipleSelection.length > 0 ? 'primary' : ''"
|
:type="multipleSelection.length > 0 ? 'primary' : ''"
|
||||||
><el-icon style="margin-right: 5px">
|
><el-icon style="margin-right: 5px"> <Delete /> </el-icon
|
||||||
<Delete /> </el-icon
|
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -1038,16 +1095,28 @@ function handleClearSelection() {
|
|||||||
:header-cell-style="{
|
:header-cell-style="{
|
||||||
background: 'rgb(250 250 250)',
|
background: 'rgb(250 250 250)',
|
||||||
color: ' #383838',
|
color: ' #383838',
|
||||||
height: '50px',
|
height: '50px'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||||
<el-table-column prop="nickname" label="用户姓名" width="140"></el-table-column>
|
<el-table-column
|
||||||
|
prop="nickname"
|
||||||
|
label="用户姓名"
|
||||||
|
width="140"
|
||||||
|
></el-table-column>
|
||||||
<!-- <el-table-column prop="avatar" label="头像"></el-table-column> -->
|
<!-- <el-table-column prop="avatar" label="头像"></el-table-column> -->
|
||||||
<el-table-column prop="email" label="邮箱"></el-table-column>
|
<el-table-column prop="email" label="邮箱"></el-table-column>
|
||||||
<el-table-column prop="phone" label="手机号" min-width="90"></el-table-column>
|
<el-table-column
|
||||||
<el-table-column prop="username" label="登录账号" width="120"></el-table-column>
|
prop="phone"
|
||||||
|
label="手机号"
|
||||||
|
min-width="90"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="username"
|
||||||
|
label="登录账号"
|
||||||
|
width="120"
|
||||||
|
></el-table-column>
|
||||||
<!-- <el-table-column prop="custom1" label="登录账号"></el-table-column> -->
|
<!-- <el-table-column prop="custom1" label="登录账号"></el-table-column> -->
|
||||||
<el-table-column prop="rolename" label="所属角色" width="120">
|
<el-table-column prop="rolename" label="所属角色" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -1056,7 +1125,12 @@ function handleClearSelection() {
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="status" label="账号状态" align="center" width="120">
|
<el-table-column
|
||||||
|
prop="status"
|
||||||
|
label="账号状态"
|
||||||
|
align="center"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.status"
|
v-model="scope.row.status"
|
||||||
@ -1065,7 +1139,9 @@ function handleClearSelection() {
|
|||||||
@change="switchChange(scope.row)"
|
@change="switchChange(scope.row)"
|
||||||
style="margin-right: 4px"
|
style="margin-right: 4px"
|
||||||
></el-switch>
|
></el-switch>
|
||||||
<span v-if="scope.row.status == 1" style="color: #0099ff">启用</span>
|
<span v-if="scope.row.status == 1" style="color: #0099ff"
|
||||||
|
>启用</span
|
||||||
|
>
|
||||||
<span v-else style="color: #d7d7d7">停用</span>
|
<span v-else style="color: #d7d7d7">停用</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -1140,7 +1216,12 @@ function handleClearSelection() {
|
|||||||
width="620px"
|
width="620px"
|
||||||
draggable
|
draggable
|
||||||
>
|
>
|
||||||
<el-form ref="infoForm" :model="info" :rules="moderules" label-width="90px">
|
<el-form
|
||||||
|
ref="infoForm"
|
||||||
|
:model="info"
|
||||||
|
:rules="moderules"
|
||||||
|
label-width="90px"
|
||||||
|
>
|
||||||
<el-form-item label="用户姓名" prop="nickname">
|
<el-form-item label="用户姓名" prop="nickname">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="info.nickname"
|
v-model="info.nickname"
|
||||||
@ -1170,7 +1251,12 @@ function handleClearSelection() {
|
|||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属角色">
|
<el-form-item label="所属角色">
|
||||||
<el-select v-model="info.roleinfo" placeholder=" " style="width: 100%" multiple>
|
<el-select
|
||||||
|
v-model="info.roleinfo"
|
||||||
|
placeholder=" "
|
||||||
|
style="width: 100%"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in rolesdata"
|
v-for="item in rolesdata"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@ -1190,7 +1276,9 @@ function handleClearSelection() {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
<el-button type="primary" @click="confirmClick(infoForm)">保存</el-button>
|
<el-button type="primary" @click="confirmClick(infoForm)"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 过鱼设施权限维护 -->
|
<!-- 过鱼设施权限维护 -->
|
||||||
@ -1223,9 +1311,15 @@ function handleClearSelection() {
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="button_div">
|
<div class="button_div">
|
||||||
<el-button type="primary" @click="handleSelectAll">全选</el-button>
|
<el-button type="primary" @click="handleSelectAll"
|
||||||
<el-button type="primary" @click="handleInvertSelection">反选</el-button>
|
>全选</el-button
|
||||||
<el-button type="primary" @click="handleClearSelection">取消选中</el-button>
|
>
|
||||||
|
<el-button type="primary" @click="handleInvertSelection"
|
||||||
|
>反选</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="handleClearSelection"
|
||||||
|
>取消选中</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1265,13 +1359,23 @@ function handleClearSelection() {
|
|||||||
:header-cell-style="{
|
:header-cell-style="{
|
||||||
background: 'rgb(250 250 250)',
|
background: 'rgb(250 250 250)',
|
||||||
color: ' #383838',
|
color: ' #383838',
|
||||||
height: '50px',
|
height: '50px'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
label="序号"
|
||||||
|
width="70"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
<el-table-column prop="name" label="名称"></el-table-column>
|
<el-table-column prop="name" label="名称"></el-table-column>
|
||||||
<el-table-column prop="type" label="类型" width="200" align="center">
|
<el-table-column
|
||||||
|
prop="type"
|
||||||
|
label="类型"
|
||||||
|
width="200"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ getName(dictData, scope.row.type) }}</span>
|
<span>{{ getName(dictData, scope.row.type) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -1310,7 +1414,9 @@ function handleClearSelection() {
|
|||||||
append-to-body
|
append-to-body
|
||||||
:before-close="closeResult"
|
:before-close="closeResult"
|
||||||
>
|
>
|
||||||
已将密码重置为:<span style="color: #409eff; font-size: 16px">{{ msgText }}</span>
|
已将密码重置为:<span style="color: #409eff; font-size: 16px">{{
|
||||||
|
msgText
|
||||||
|
}}</span>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="closeResult">取消</el-button>
|
<el-button @click="closeResult">取消</el-button>
|
||||||
@ -1345,6 +1451,7 @@ function handleClearSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fishTable {
|
.fishTable {
|
||||||
|
flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user