联调 干扰源用户 谐波普测页面

This commit is contained in:
GGJ
2024-03-25 20:29:33 +08:00
parent 7e538fed6b
commit cc1edc0e96
15 changed files with 1247 additions and 534 deletions

View File

@@ -1,11 +1,139 @@
<template>
<div>
<el-button icon="el-icon-Check" type="primary" @click="preserve">保存</el-button>
<el-button icon="el-icon-Grid" type="primary" @click="dialogVisible = true">配置保存年限</el-button>
<div class="mt10" :style="`height: calc(${height} - 43px)`">
<vxe-table
v-bind="defaultAttribute"
height="auto"
ref="tableRef"
:data="tableData"
:tree-config="{ children: 'children' }"
:edit-config="{ trigger: 'click', mode: 'cell' }"
>
<vxe-table-column field="name" align="left" title="部门" tree-node></vxe-table-column>
<div>占比 </div>
<vxe-table-column
field="proportion"
title="占比(%)"
:edit-render="{
name: '$input',
props: { type: 'float', digits: 2, max: 100, min: 0 }
}"
></vxe-table-column>
</vxe-table>
</div>
<el-dialog v-model="dialogVisible" title="年限设置" width="500" :before-close="handleClose">
<el-input-number v-model="num" :min="0" :max="1000" />
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="define">保存</el-button>
<el-button @click="handleClose">取消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang='ts'>
import { ref, reactive } from 'vue'
</script>
<style lang="scss" scoped>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { mainHeight } from '@/utils/layout'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getAreaList } from '@/api/common'
import { addPlanConfig, addPlanCycle, queryPlanConfig } from '@/api/process-boot/generalTest'
const dialogVisible = ref(false)
const num = ref(0)
const tableRef = ref()
const height = mainHeight(80).height
const tableData: any = ref([])
const treeData = ref([])
const treeList: any = ref([])
const info = async () => {
await queryPlanConfig().then(res => {
treeData.value = res.data
})
await getAreaList().then((res: any) => {
tableData.value = circulationTreeData(res.data)
setTimeout(() => {
tableRef.value.setAllTreeExpand(true)
}, 0)
})
}
const circulationTreeData = (rows: any) => {
let children: any = []
</style>
rows.forEach((item: any) => {
let proportion = 0
treeData.value.forEach((val: any) => {
if (val.orgId == item.id) {
proportion = val.proportion
return
}
})
if (item.children && item.children.length > 0) {
children.push({
name: item.name,
id: item.id,
proportion: proportion,
children: circulationTreeData(item.children)
})
} else {
children.push({
name: item.name,
id: item.id,
proportion: proportion
})
}
})
return children
}
const preserve = () => {
treeList.value = []
circulation(tableData.value)
setTimeout(() => {
addPlanConfig(treeList.value).then(res => {
ElMessage.success('保存成功!')
info()
})
}, 0)
}
// 保存配置
const define = () => {
addPlanCycle({
cycleNum: num.value
}).then(res => {
if (res.data.flag == true) {
ElMessage.success('年限设置成功!')
handleClose()
} else {
ElMessage.warning(`本次普测计划周期还未结束,请在 ${res.data.endYear} 后设置!`)
}
})
}
const circulation = (rows: any) => {
let children: any = []
rows.forEach((item: any) => {
treeList.value.push({
orgName: item.name,
orgId: item.id,
proportion: item.proportion
})
if (item.children && item.children.length > 0) {
circulation(item.children)
}
})
return children
}
const handleClose = () => {
dialogVisible.value = false
num.value = 0
}
onMounted(() => {
info()
})
</script>

View File

@@ -1,26 +1,56 @@
<template>
<div>
<div>
<TableHeader area datePicker ref="TableHeaderRef">
<template #select>
<el-form-item label="是否上传">
<el-select v-model="tableStore.table.params.searchState" placeholder="请选择是否上传">
<el-option
v-for="item in uploadData"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Upload" type="primary">上传</el-button>
<el-button icon="el-icon-Download" type="primary">导出</el-button>
</template>
</TableHeader>
<Table ref="tableRef" />
</div>
<TableHeader area datePicker ref="TableHeaderRef">
<template #select>
<el-form-item label="是否上传">
<el-select v-model="tableStore.table.params.isFileUpload" placeholder="请选择是否上传">
<el-option label="未上传" value="0" />
<el-option label="已上传" value="1" />
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Upload" type="primary">上传</el-button>
<el-button icon="el-icon-Download" type="primary">导出</el-button>
</template>
</TableHeader>
<Table ref="tableRef" />
<!-- 上传弹窗 -->
<el-dialog title="上传" v-model="addUpload" width="500px">
<el-upload
multiple
action=""
:auto-upload="false"
:limit="999"
:file-list="fileList"
:on-remove="handleRemove"
:on-change="chooseBatch"
ref="upload"
>
<el-button type="primary" icon="el-icon-Upload">选择文件</el-button>
</el-upload>
<template #footer>
<el-button type="primary" @click="BatchUpload">保存</el-button>
<el-button @click="handleClose">取消</el-button>
</template>
</el-dialog>
<!-- 文件查看 -->
<el-dialog title="文件查看" v-model="dataShow" width="600px">
<vxe-table height="400" auto-resize :data="uploadList" v-bind="defaultAttribute">
<vxe-column field="minFileName" title="文件名称"></vxe-column>
<vxe-column title="操作" width="100">
<template #default="{ row }">
<el-button type="primary" size="small" link @click="downLownFn(row)">下载</el-button>
<!-- <el-popconfirm title="是否确认删除策略!" @confirm="details(row)">
<template #reference>
<el-button type="danger" link>删除</el-button>
</template>
</el-popconfirm> -->
</template>
</vxe-column>
</vxe-table>
</el-dialog>
</div>
</template>
<script setup lang="ts">
@@ -29,61 +59,125 @@ 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 { defaultAttribute } from '@/components/table/defaultAttribute'
import { useDictData } from '@/stores/dictData'
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'
import { MultipartFile, surveyResultDownload } from '@/api/process-boot/generalTest'
const dictData = useDictData()
const uploadData = [
{
id: 0,
label: '未上传'
},
{
id: 1,
label: '已上传'
}
]
const dialogVisible = ref(false)
const addUpload = ref(false)
const dataShow = ref(false)
const TableHeaderRef = ref()
const title = ref('')
const fileList: any = ref([])
const uploadList: any = ref([])
const ruleFormRef = ref()
const planId = ref('')
const tableStore = new TableStore({
url: '/system-boot/area/areaSelect',
url: '/process-boot/rGeneralSurveyPlan/queryPlanResult',
publicHeight: 65,
method: 'POST',
column: [
{ width: '60', type: 'checkbox' },
// { width: '60', type: 'checkbox' },
{ field: 'orgName', title: '责任单位' },
{
field: 'planNo',
title: '普测计划编号'
},
{ field: 'planNo', title: '普测计划编号' },
{ field: 'planName', title: '普测计划名称' },
{ field: 'planStartTime', title: '开始时间' },
{ field: 'planEndTime', title: '结束时间' },
{ field: 'subCount', title: '普测变电站数量' },
{ field: 'isFileUpload', title: '是否上传' },
{
field: 'isFileUpload',
title: '是否上传',
render: 'tag',
custom: {
0: 'warning',
1: 'success'
},
replaceValue: {
0: '否',
1: '是'
}
},
{ field: 'fileCount', title: '上传文件数量' },
{ field: 'uploadTime', title: '上传时间' }
{ field: 'uploadTime', title: '上传时间' },
{
title: '操作文件',
width: '180',
render: 'buttons',
fixed: 'right',
buttons: [
{
title: '上传',
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
planId.value = row.planNo
addUpload.value = true
}
},
{
title: '查看',
type: 'primary',
icon: 'el-icon-EditPen',
disabled: row => {
return row.isFileUpload !== 1
},
render: 'basicButton',
click: row => {
surveyResultDownload({ planNo: row.planNo }).then(res => {
uploadList.value = res.data
dataShow.value = true
})
}
}
]
}
],
loadCallback: () => {
tableStore.table.data = [
{
status: 2
}
]
beforeSearchFun: () => {
tableStore.table.params.planStartTime = tableStore.table.params.searchBeginTime
tableStore.table.params.planEndTime = tableStore.table.params.searchEndTime
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
tableStore.table.params.currentPage = tableStore.table.params.pageNum
}
})
tableStore.table.params.searchState = ''
tableStore.table.params.searchValue = ''
tableStore.table.params.type = ''
tableStore.table.params.isFileUpload = ''
const handleRemove = (e: any) => {
fileList.value = fileList.value.filter((item: any) => item.uid !== e.uid)
}
const chooseBatch = (e: any) => {
fileList.value.push(e)
}
// 上传
const BatchUpload = () => {
let form = new FormData()
form.append('planId', planId.value)
fileList.value.forEach((item: any) => {
form.append('file', item.raw)
})
MultipartFile(form).then((res: any) => {
ElMessage.success('上传成功!')
handleClose()
tableStore.index()
})
}
const handleClose = () => {
fileList.value = []
addUpload.value = false
}
// 下载
const downLownFn = async (row: any) => {
let response = await fetch(row.minFileUrl)
let blob = await response.blob()
let a = document.createElement('a')
a.href = window.URL.createObjectURL(blob)
a.download = row.minFileName
a.click()
a.remove()
}
provide('tableStore', tableStore)
onMounted(() => {