修改部分按钮重复点击

This commit is contained in:
GGJ
2024-10-16 17:54:55 +08:00
parent 89535b6059
commit e470554b7c
18 changed files with 492 additions and 1082 deletions

View File

@@ -3,32 +3,24 @@
<TableHeader ref="TableHeaderRef">
<template #select>
<el-form-item label="项目名称">
<el-input
style="width: 200px"
placeholder="请输入项目名称"
v-model="tableStore.table.params.projectName"
clearable
></el-input>
<el-input style="width: 200px" placeholder="请输入项目名称" v-model="tableStore.table.params.projectName"
clearable></el-input>
</el-form-item>
<el-form-item label="所在地市">
<el-select v-model="tableStore.table.params.city" clearable placeholder="请选择所在地市">
<el-option
v-for="item in areaOptionList"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
<el-option v-for="item in areaOptionList" :key="item.id" :label="item.name"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
<el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate">模板下载</el-button>
<el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate" :loading="loading">模板下载</el-button>
<el-button icon="el-icon-Upload" type="primary" @click="importUserData">批量导入</el-button>
</template>
</TableHeader>
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
<el-dialog title="详情" width="80%" v-model="dialogShow" v-if="dialogShow">
<DetailInfo :id="userId" :openType="'sourcesOfInterference'"></DetailInfo>
@@ -58,6 +50,7 @@ const addForms = ref()
const dictData = useDictData()
const sensitiveUserPopup = ref()
const TableHeaderRef = ref()
const loading = ref(false)
const areaOptionList = dictData.getBasicData('jibei_area')
const { push, options, currentRoute } = useRouter()
import { useAdminInfo } from '@/stores/adminInfo'
@@ -68,7 +61,7 @@ const tableStore = new TableStore({
publicHeight: 65,
method: 'POST',
column: [
{
{
width: '60',
type: 'checkbox'
},
@@ -181,7 +174,7 @@ const tableStore = new TableStore({
click: row => {
addForms.value.filterUsers([6])
addForms.value.open({
title: '编辑',
row: row
@@ -338,8 +331,9 @@ const getUserTypeName = (userType: any) => {
return '新建电网工程'
}
//导出模板
const exportExcelTemplate = () => {
downloadSensitiveReportTemplate().then((res: any) => {
const exportExcelTemplate = async() => {
loading.value = true
await downloadSensitiveReportTemplate().then((res: any) => {
let blob = new Blob([res], {
type: 'application/vnd.ms-excel'
})
@@ -351,6 +345,9 @@ const exportExcelTemplate = () => {
link.click()
link.remove()
})
await setTimeout(() => {
loading.value = false
},0)
}
//批量导入用户数据
@@ -358,21 +355,21 @@ const importUserData = () => {
sensitiveUserPopup.value.open('导入干扰源用户')
}
const props = defineProps({id: {type: String, default: 'null'}})
const props = defineProps({ id: { type: String, default: 'null' } })
watch(() => props.id, async (newValue, oldValue) => {
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
const fullId = newValue.split('@')[0]
let nowTime = Date.now()
const routeTime = Number(newValue.split('@')[1])
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms则不执行
await getUserReportById(fullId).then(res => {
if (res && res.code == 'A0000') {
addForms.value.setcontroFlag()
addForms.value.open({
title: '重新发起',
row: res.data
})
}
})
}, {immediate: true})
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
const fullId = newValue.split('@')[0]
let nowTime = Date.now()
const routeTime = Number(newValue.split('@')[1])
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms则不执行
await getUserReportById(fullId).then(res => {
if (res && res.code == 'A0000') {
addForms.value.setcontroFlag()
addForms.value.open({
title: '重新发起',
row: res.data
})
}
})
}, { immediate: true })
</script>