联调 【干扰源用户管理】、【敏感及重要用户】需要增加【新增】、【模板下载】、【批量导入】功能,参考内网pms3.0调整
This commit is contained in:
@@ -36,6 +36,16 @@ export const downloadSensitiveUserTemplate = () => {
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 下载干扰源用户台账模板
|
||||
*/
|
||||
export const downloadSensitiveReportTemplate = () => {
|
||||
return createAxios({
|
||||
url: MAPPING_PATH + '/downloadSensitiveReportTemplate',
|
||||
method: 'GET',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入敏感及重要用户数据
|
||||
@@ -48,6 +58,17 @@ export const importSensitiveUserData = (data: any) => {
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 批量导入干扰源用户
|
||||
*/
|
||||
export const importSensitiveReportData = (data: any) => {
|
||||
return createAxios({
|
||||
url: MAPPING_PATH + '/importSensitiveReportData',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close()">取消</el-button>
|
||||
<el-button type="primary" @click="confirmForm(true)">保存</el-button>
|
||||
<el-button type="primary" @click="confirmForm(false)">提交审批</el-button>
|
||||
<el-button type="primary" v-if="control" @click="confirmForm(false)">提交审批</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -536,6 +536,7 @@ const dialogFormVisible = ref(false)
|
||||
// .doc,.docx,.xlsx,.xls,.pdf
|
||||
const acceptType = ''
|
||||
const form: any = ref({})
|
||||
const control: any = ref(true)
|
||||
const ruleFormRef: any = ref(null)
|
||||
//字典获取所在地市
|
||||
const areaOptionList = dictData
|
||||
@@ -554,7 +555,7 @@ const evaluationTypeList = dictData.getBasicData('Evaluation_Type')
|
||||
const evaluationDeptList = dictData.getBasicData('evaluation_dept')
|
||||
|
||||
//用户性质数组
|
||||
const userTypeList = reactive([
|
||||
const userTypeList: any = ref([
|
||||
{
|
||||
label: '新建电网工程',
|
||||
value: 0
|
||||
@@ -948,7 +949,7 @@ const open = async (row: any) => {
|
||||
})
|
||||
} else {
|
||||
resendId.value = ''
|
||||
form.value.userType = 0
|
||||
form.value.userType = userTypeList.value[0].value
|
||||
}
|
||||
}
|
||||
// 处理上传文件回显
|
||||
@@ -965,12 +966,17 @@ const fileRaw = (row: any, key: string) => {
|
||||
'powerQualityReport'
|
||||
]
|
||||
for (let k of list) {
|
||||
if (row[key][k]) {
|
||||
form.value[k] = [
|
||||
if (row[key][k] != null) {
|
||||
form.value[k] =
|
||||
row[key][k].length == 0
|
||||
? []
|
||||
: [
|
||||
{
|
||||
name: row[key][k].split('/')[2]
|
||||
}
|
||||
]
|
||||
} else {
|
||||
form.value[k] = []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -987,7 +993,7 @@ const fileRaw = (row: any, key: string) => {
|
||||
const close = () => {
|
||||
//重置表单内容
|
||||
//取消表单校验状态
|
||||
ruleFormRef.value && ruleFormRef.value.resetFields()
|
||||
ruleFormRef?.value && ruleFormRef?.value.resetFields()
|
||||
dialogFormVisible.value = false
|
||||
emits('onSubmit')
|
||||
resetForm()
|
||||
@@ -1138,7 +1144,7 @@ const confirmForm = (flag: boolean) => {
|
||||
}
|
||||
confirmFormData.saveOrCheckflag = '1'
|
||||
if (title.value != '用户档案录入') confirmFormData.id = resendId.value
|
||||
|
||||
if (!control.value) confirmFormData.dataType = 1
|
||||
submitFormData(confirmFormData).then(res => {
|
||||
ElMessage({
|
||||
message: '保存成功!',
|
||||
@@ -1341,7 +1347,13 @@ const confirmForm = (flag: boolean) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
// 过滤用户
|
||||
const filterUsers = (arr: any) => {
|
||||
control.value = false
|
||||
userTypeList.value = userTypeList.value.filter(item => !arr.includes(item.value))
|
||||
}
|
||||
defineExpose({ open, filterUsers })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-form {
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
<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="请选择所在地市">
|
||||
@@ -17,15 +22,20 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<!-- <el-button icon="el-icon-Download" type="primary">导出</el-button> -->
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate">模板下载</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="importUserData">批量导入</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
|
||||
<el-dialog title="详情" width="80%" v-model="dialogShow"><DetailInfo :id="userId"></DetailInfo></el-dialog>
|
||||
<!-- 批量导入 -->
|
||||
<sensitive-user-popup ref="sensitiveUserPopup" />
|
||||
|
||||
<el-dialog title='详情' width='80%' v-model='dialogShow'><DetailInfo :id='userId'></DetailInfo></el-dialog>
|
||||
<!-- 查看详情 detail 新增/修改 create-->
|
||||
<addForm ref="addForms" @onSubmit="tableStore.index()" openType="create"></addForm>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, nextTick } from 'vue'
|
||||
@@ -33,14 +43,19 @@ import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import addForm from '@/views/pqs/supervise/interfere/components/undocumented/addForm.vue'
|
||||
import SensitiveUserPopup from './sensitiveUserPopup.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { downloadSensitiveReportTemplate } from '@/api/supervision-boot/userReport/form'
|
||||
import DetailInfo from '../../interfere/components/undocumented/detail.vue'
|
||||
|
||||
const addForms = ref()
|
||||
const dictData = useDictData()
|
||||
|
||||
const sensitiveUserPopup = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const areaOptionList = dictData.getBasicData('jibei_area')
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
const tableStore = new TableStore({
|
||||
url: '/supervision-boot/userReport/getInterferenceUserPage',
|
||||
publicHeight: 65,
|
||||
@@ -102,6 +117,23 @@ const tableStore = new TableStore({
|
||||
click: row => {
|
||||
lookInfo(row.id)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.createBy != adminInfo.$state.id || !(row.dataType == 1)
|
||||
},
|
||||
click: row => {
|
||||
addForms.value.filterUsers([6])
|
||||
addForms.value.open({
|
||||
title: '编辑',
|
||||
row: row
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -124,15 +156,22 @@ const dialogShow = ref(false)
|
||||
const lookInfo = (id: string) => {
|
||||
userId.value = id
|
||||
dialogShow.value = true
|
||||
|
||||
}
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
// 新增
|
||||
const addFormModel = () => {
|
||||
addForms.value.filterUsers([6])
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
addForms.value.open({
|
||||
title: '用户档案录入'
|
||||
})
|
||||
})
|
||||
}
|
||||
/**获取用户性质*/
|
||||
const getUserTypeName = (userType: any) => {
|
||||
if (userType === 0) {
|
||||
@@ -142,7 +181,7 @@ const getUserTypeName = (userType: any) => {
|
||||
return '扩建电网工程'
|
||||
}
|
||||
if (userType === 2) {
|
||||
return '新建非线性负荷用户'
|
||||
return ' '
|
||||
}
|
||||
if (userType === 3) {
|
||||
return '扩建非线性负荷用户'
|
||||
@@ -158,4 +197,24 @@ const getUserTypeName = (userType: any) => {
|
||||
}
|
||||
return '新建电网工程'
|
||||
}
|
||||
//导出模板
|
||||
const exportExcelTemplate = () => {
|
||||
downloadSensitiveReportTemplate().then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '干扰源用户台账模板'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
}
|
||||
|
||||
//批量导入用户数据
|
||||
const importUserData = () => {
|
||||
sensitiveUserPopup.value.open('导入干扰源用户')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
draggable
|
||||
class='cn-operate-dialog'
|
||||
v-model='eventDataUploadVisible'
|
||||
:title='title'
|
||||
style='width: 415px;'
|
||||
top='25vh'
|
||||
class="cn-operate-dialog"
|
||||
v-model="eventDataUploadVisible"
|
||||
:title="title"
|
||||
style="width: 415px"
|
||||
top="25vh"
|
||||
>
|
||||
<el-scrollbar>
|
||||
<el-form :inline='false' :model='form' label-width='120px' ref='formRef'>
|
||||
<el-form-item label='用户数据文件'>
|
||||
<el-form :inline="false" :model="form" label-width="120px" ref="formRef">
|
||||
<el-form-item label="用户数据文件">
|
||||
<el-upload
|
||||
v-model:file-list='fileList'
|
||||
ref='uploadEventData'
|
||||
action=''
|
||||
:limit='1'
|
||||
:on-exceed='handleExceed'
|
||||
:auto-upload='false'
|
||||
:on-change='choose'
|
||||
v-model:file-list="fileList"
|
||||
ref="uploadEventData"
|
||||
action=""
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:auto-upload="false"
|
||||
:on-change="choose"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type='primary'>选择数据文件</el-button>
|
||||
<el-button type="primary">选择数据文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<span class='dialog-footer'>
|
||||
<el-button @click='eventDataUploadVisible = false'>取消</el-button>
|
||||
<el-button type='primary' @click='submit'>确认</el-button>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="eventDataUploadVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, inject } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { UploadInstance, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus'
|
||||
import { genFileId } from 'element-plus'
|
||||
import { importSensitiveUserData } from '@/api/supervision-boot/userReport/form'
|
||||
import { importSensitiveUserData, importSensitiveReportData } from '@/api/supervision-boot/userReport/form'
|
||||
|
||||
const fileList = ref<UploadUserFile[]>([])
|
||||
|
||||
@@ -86,7 +86,6 @@ const handleExceed: UploadProps['onExceed'] = files => {
|
||||
fileList.value = [{ name: file.name, url: '' }]
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交用户表单数据
|
||||
*/
|
||||
@@ -96,7 +95,9 @@ const submit = async () => {
|
||||
if (valid) {
|
||||
let data = new FormData()
|
||||
data.append('file', form.file)
|
||||
await importSensitiveUserData(data).then((res: any) => {
|
||||
if (title.value == '导入干扰源用户') {
|
||||
await importSensitiveReportData(data)
|
||||
.then((res: any) => {
|
||||
if (res.type === 'application/json') {
|
||||
// 说明是普通对象数据,读取信息
|
||||
const fileReader = new FileReader()
|
||||
@@ -114,7 +115,6 @@ const submit = async () => {
|
||||
}
|
||||
}
|
||||
fileReader.readAsText(res)
|
||||
|
||||
} else {
|
||||
ElMessage.error('导入失败,请查看下载附件!')
|
||||
let blob = new Blob([res], {
|
||||
@@ -128,12 +128,50 @@ const submit = async () => {
|
||||
link.click()
|
||||
link.remove()
|
||||
}
|
||||
}).finally(
|
||||
() => {
|
||||
})
|
||||
.finally(() => {
|
||||
tableStore.index()
|
||||
eventDataUploadVisible.value = false
|
||||
})
|
||||
} else {
|
||||
await importSensitiveUserData(data)
|
||||
.then((res: any) => {
|
||||
if (res.type === 'application/json') {
|
||||
// 说明是普通对象数据,读取信息
|
||||
const fileReader = new FileReader()
|
||||
fileReader.onloadend = () => {
|
||||
try {
|
||||
const jsonData = JSON.parse(fileReader.result)
|
||||
// 后台信息
|
||||
if (jsonData.code === 'A0000') {
|
||||
ElMessage.success('导入成功')
|
||||
} else {
|
||||
ElMessage.error('导入失败,请查看下载附件!')
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
fileReader.readAsText(res)
|
||||
} else {
|
||||
ElMessage.error('导入失败,请查看下载附件!')
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '敏感及重要用户失败列表'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
tableStore.index()
|
||||
eventDataUploadVisible.value = false
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
<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="请选择所在地市">
|
||||
@@ -17,6 +22,7 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate">模板下载</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="importUserData">批量导入</el-button>
|
||||
</template>
|
||||
@@ -26,6 +32,9 @@
|
||||
<DetailInfo :id="userId"></DetailInfo>
|
||||
</el-dialog>
|
||||
<sensitive-user-popup ref="sensitiveUserPopup" />
|
||||
|
||||
<!-- 查看详情 detail 新增/修改 create-->
|
||||
<addForm ref="addForms" @onSubmit="tableStore.index()" openType="create"></addForm>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -37,13 +46,16 @@ import { useDictData } from '@/stores/dictData'
|
||||
import DetailInfo from '../../interfere/components/undocumented/detail.vue'
|
||||
import { downloadSensitiveUserTemplate } from '@/api/supervision-boot/userReport/form'
|
||||
import SensitiveUserPopup from './sensitiveUserPopup.vue'
|
||||
|
||||
import addForm from '@/views/pqs/supervise/interfere/components/undocumented/addForm.vue'
|
||||
const dictData = useDictData()
|
||||
const sensitiveUserPopup = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const areaOptionList = dictData.getBasicData('jibei_area')
|
||||
const loadLevelOptionList = dictData.getBasicData('load_level')
|
||||
const powerSupplyInfoOptionList = dictData.getBasicData('supply_condition')
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
const tableStore = new TableStore({
|
||||
url: '/supervision-boot/userReport/getSensitiveUserPage',
|
||||
publicHeight: 65,
|
||||
@@ -124,6 +136,23 @@ const tableStore = new TableStore({
|
||||
click: row => {
|
||||
lookInfo(row.id)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.createBy != adminInfo.$state.id || !(row.dataType == 1)
|
||||
},
|
||||
click: row => {
|
||||
addForms.value.filterUsers([5, 4, 3, 2, 1, 0])
|
||||
addForms.value.open({
|
||||
title: '编辑',
|
||||
row: row
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -139,7 +168,7 @@ tableStore.table.params.loadType = ''
|
||||
tableStore.table.params.userName = ''
|
||||
tableStore.table.params.relationUserName = ''
|
||||
tableStore.table.params.aisFileUpload = ''
|
||||
|
||||
const addForms = ref()
|
||||
const userId = ref()
|
||||
const dialogShow = ref(false)
|
||||
|
||||
@@ -152,7 +181,14 @@ provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
// 新增
|
||||
const addFormModel = () => {
|
||||
addForms.value.filterUsers([5, 4, 3, 2, 1, 0])
|
||||
|
||||
addForms.value.open({
|
||||
title: '用户档案录入'
|
||||
})
|
||||
}
|
||||
/**获取用户性质*/
|
||||
const getUserTypeName = (userType: any) => {
|
||||
if (userType === 0) {
|
||||
|
||||
Reference in New Issue
Block a user