修改bug,过鱼倒数修改,添加过鱼设施

This commit is contained in:
扈兆增 2026-06-11 09:36:40 +08:00
parent 34502b7ed2
commit f150c29d46
8 changed files with 915 additions and 263 deletions

View File

@ -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
});
}

View File

@ -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>

View File

@ -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>

View 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>

View File

@ -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'; //

View File

@ -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>

View File

@ -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,33 +159,25 @@ 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);
// //
const isAllSelected = const isAllSelected =
groupKeys.length > 0 && groupKeys.length > 0 &&
groupKeys.every(key => selectedRowKeys.value.includes(key)); groupKeys.every(key => selectedRowKeys.value.includes(key));
const isPartiallySelected = groupKeys.some(key => const isPartiallySelected = groupKeys.some(key =>
selectedRowKeys.value.includes(key) selectedRowKeys.value.includes(key)
); );
return h(Checkbox, { return h(Checkbox, {
checked: isAllSelected, checked: isAllSelected,
disabled: record.hasData == 1, disabled: record.hasData == 1,
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 '-';
@ -245,7 +251,7 @@ let columns = ref([
title: '过鱼开始时间', title: '过鱼开始时间',
width: 140, width: 140,
customRender: ({ text }) => { customRender: ({ text }) => {
return text && text!= '-' ? dayjs(text).format('YYYY-MM-DD') : '-'; return text && text != '-' ? dayjs(text).format('YYYY-MM-DD') : '-';
} }
}, },
{ {
@ -254,7 +260,7 @@ let columns = ref([
title: '过鱼结束时间', title: '过鱼结束时间',
width: 140, width: 140,
customRender: ({ text }) => { customRender: ({ text }) => {
return text && text!= '-' ? dayjs(text).format('YYYY-MM-DD') : '-'; return text && text != '-' ? dayjs(text).format('YYYY-MM-DD') : '-';
} }
}, },
{ {
@ -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 + ' 位用户'
),
'发送【',
h('span', { style: { color: '#ff4d4f' } }, '过鱼数据填报催促通知'),
'】'
]),
onOk: async () => {
let ids = [];
searchRef.value.btnLoading = true;
detailTableRef.value.loading = true;
batchData.value.forEach((item: any) => {
ids.push(item.userId);
});
let res: any = await batchUrgeContent({ userIds: ids }); const handleUrgeOk = async () => {
if (res && res?.code == 0) { let ids = [];
message.success('催促成功'); searchRef.value.btnLoading = true;
detailTableRef.value.loading = false; detailTableRef.value.loading = true;
searchRef.value.btnLoading = false; batchData.value.forEach((item: any) => {
} else { ids.push(item.userId);
message.error('催促失败');
detailTableRef.value.loading = false;
searchRef.value.btnLoading = false;
}
}
}); });
let res: any = await batchUrgeContent({
userIds: ids,
content: urgeContent.value
});
if (res && res?.code == 0) {
message.success('催促成功');
detailTableRef.value.loading = false;
searchRef.value.btnLoading = false;
urgeModalVisible.value = false;
} else {
message.error('催促失败');
detailTableRef.value.loading = false;
searchRef.value.btnLoading = false;
}
}; };
// //
onMounted(() => {}); onMounted(() => {});

View File

@ -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;
} }
// IDkeys // IDkeys
return allChildrenIds.every((code) => checkedKeysArray.includes(code)); return allChildrenIds.every(code => checkedKeysArray.includes(code));
} }
// - // -
@ -496,7 +510,10 @@ function isNodeContainedByOtherParent(
} }
// IDsID // IDsID
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(
console.log(res); (res: any) => {
if (res.code == 0) { console.log(res);
ElMessage({ if (res.code == 0) {
message: "保存成功", ElMessage({
type: "success", message: '保存成功',
}); 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%;