保障气象环境

This commit is contained in:
liaoboping 2025-09-28 13:04:14 +08:00
parent 5ad5ba1d24
commit ff935e4155
2 changed files with 195 additions and 28 deletions

View File

@ -38,8 +38,15 @@
:pageConfig="qxhj.pageConfig"
:showTool="qxhj.showTool"
>
<template #tablecell-lastBegTime="{ record }">
{{ record.lastBegTime.replace('T', ' ') }}
</template>
<template #tablecell-lastEndTime="{ record }">
{{ record.lastEndTime.replace('T', ' ') }}
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="edit" @click="handleOpenEditQxhjModal(record)"></a-button>
<a-button type="text-danger" icon="delete" @click="handleDeleteQxhj(record)"></a-button>
</template>
</AntQueryTable>
</a-card>
@ -91,6 +98,7 @@
</template>
<script>
import { getAction, postAction } from '@/api/manage'
export default {
name: 'Bzhjsjk',
data() {
@ -108,17 +116,13 @@ export default {
table: {},
immediate: false,
query: (queryParams) =>
this.$http({
url: `/baseData/weatherResource/list`,
method: 'get',
params: { scenarioId: this.xd.selectedKeys[0], ...queryParams },
}),
getAction(`/baseData/weatherResource/list`, { scenarioId: this.xd.selectedKeys[0], ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '天气类型', dataIndex: 'weatherType' },
{ title: '持续开始时间', dataIndex: 'lastBegTime' },
{ title: '持续结束时间', dataIndex: 'lastEndTime' },
// { dataIndex: 'action', width: 100 },
{ dataIndex: 'action', width: 100 },
],
},
pageConfig: true,
@ -136,8 +140,8 @@ export default {
options: {
dataSource: () => ({
data: [
{ title: 'rain', id: 'rain' },
{ title: 'snow', id: 'snow' },
{ title: '下雨', id: 'rain' },
{ title: '下雪', id: 'snow' },
],
}),
},
@ -164,12 +168,7 @@ export default {
tableConfig: {
table: {},
immediate: false,
query: (queryParams) =>
this.$http({
url: `/environment/ebe/list`,
method: 'get',
params: { id: this.xd.selectedKeys[0], ...queryParams },
}),
query: (queryParams) => getAction(`/environment/ebe/list`, { id: this.xd.selectedKeys[0], ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '电磁强度', dataIndex: 'fieldStrength' },
@ -219,6 +218,14 @@ export default {
}[this.layoutRight]
},
},
watch: {
'qxhjModal.formData': {
handler(v) {
console.log(JSON.parse(JSON.stringify(v)))
},
deep: true,
},
},
created() {
this.getXdListData()
},
@ -226,10 +233,7 @@ export default {
async getXdListData() {
try {
this.xd.loading = true
const res = await this.$http({
url: `/baseData/scenario/all`,
method: 'get',
})
const res = await getAction(`/baseData/scenario/all`)
this.xd.listData = res.data
if (this.xd.selectedKeys.length === 0) {
this.xd.selectedKeys = [this.xd.listData[0].id]
@ -252,22 +256,35 @@ export default {
this.qxhjModal.formData = { scenarioId: this.xd.selectedKeys[0] }
this.qxhjModal.visible = true
},
handleOpenEditQxhjModal(record) {
this.qxhjModal.title = `编辑气象环境`
this.qxhjModal.mode = 'edit'
this.qxhjModal.formData = { ...record }
this.qxhjModal.visible = true
async handleOpenEditQxhjModal(record) {
try {
const res = await getAction('/baseData/weatherResource/getInfo', { id: record.id })
this.qxhjModal.title = `编辑气象环境`
this.qxhjModal.mode = 'edit'
this.qxhjModal.formData = res.data
this.$set(this.qxhjModal.formData, 'lastBegTimeStr', res.data.lastBegTime.replace('T', ' '))
this.$set(this.qxhjModal.formData, 'lastEndTimeStr', res.data.lastEndTime.replace('T', ' '))
this.qxhjModal.visible = true
} catch (error) {
console.log(error)
}
},
handleSubmitQxhj(formData) {
return this.$http({
url: `/baseData/weatherResource/add`,
method: 'post',
data: formData,
})
return postAction(`/baseData/weatherResource/add`, formData)
},
handleSubmitQxhjSuccess() {
this.$refs['qxhj-table'].commitAction('query')
},
async handleDeleteQxhj(record) {
try {
await this.$confirm({ title: '温馨提示', content: '确定要删除该气象吗?' })
const res = await getAction('/baseData/weatherResource/remove/' + record.id)
this.$message.success(res.message)
this.$refs['qxhj-table'].commitAction('query')
} catch (error) {
console.log(error)
}
},
handleOpenAddDchjModal() {
this.dchjModal.title = '新建电磁环境'

View File

@ -30,6 +30,53 @@
<div class="tool_btn" style="grid-area: 1 / 1 / 2 / 4">
<a-menu :selectedKeys="[]" mode="horizontal" theme="dark">
<a-menu-item @click="handleOpenGuaranteeProcessPage()"> 保障流程 </a-menu-item>
<a-menu-item @click="handleOpenGuaranteeWeatherModal()"> 保障气象环境 </a-menu-item>
<a-modal
v-model="guaranteeWeatherModal.visible"
width="900px"
:maskClosable="false"
:destroyOnClose="true"
:footer="null"
>
<template #title>
<span>{{ guaranteeWeatherModal.title }}</span>
<a-button
type="primary"
icon="plus"
style="margin-left: 10px"
shape="circle"
@click="handleOpenAddQxhjModal"
></a-button>
</template>
<AntQueryTable
ref="qxhj-table"
height="100%"
:queryConfig="guaranteeWeatherModal.qxhj.queryConfig"
:tableConfig="guaranteeWeatherModal.qxhj.tableConfig"
:pageConfig="guaranteeWeatherModal.qxhj.pageConfig"
:showTool="guaranteeWeatherModal.qxhj.showTool"
>
<template #tablecell-lastBegTime="{ record }">
{{ record.lastBegTime.replace('T', ' ') }}
</template>
<template #tablecell-lastEndTime="{ record }">
{{ record.lastEndTime.replace('T', ' ') }}
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="edit" @click="handleOpenEditQxhjModal(record)"></a-button>
<a-button type="text-danger" icon="delete" @click="handleDeleteQxhj(record)"></a-button>
</template>
</AntQueryTable>
<AntFormModal
:visible.sync="guaranteeWeatherModal.qxhjModal.visible"
:title="guaranteeWeatherModal.qxhjModal.title"
:formItems="guaranteeWeatherModal.qxhjModal.formItems"
:formRules="guaranteeWeatherModal.qxhjModal.formRules"
:formData="guaranteeWeatherModal.qxhjModal.formData"
:onSubmit="handleSubmitQxhj"
@success="handleSubmitQxhjSuccess"
></AntFormModal>
</a-modal>
</a-menu>
</div>
<div
@ -247,6 +294,63 @@ export default {
actionList: [],
},
childWindow: null,
guaranteeWeatherModal: {
visible: false,
title: '保障气象环境',
qxhj: {
queryConfig: false,
tableConfig: {
table: {},
immediate: true,
query: (queryParams) =>
getAction(`/baseData/weatherResource/list`, { scenarioId: this.scenarioId, ...queryParams }),
columns: [
{ dataIndex: 'serial' },
{ title: '天气类型', dataIndex: 'weatherType' },
{ title: '持续开始时间', dataIndex: 'lastBegTime' },
{ title: '持续结束时间', dataIndex: 'lastEndTime' },
{ dataIndex: 'action', width: 100 },
],
},
pageConfig: true,
showTool: false,
},
qxhjModal: {
visible: false,
title: '',
mode: '',
formItems: [
{
label: '天气类型',
prop: 'weatherType',
component: 'AntOriginSelect',
options: {
dataSource: () => ({
data: [
{ title: '下雨', id: 'rain' },
{ title: '下雪', id: 'snow' },
],
}),
},
},
{
label: '持续开始时间',
prop: 'lastBegTimeStr',
component: 'a-date-picker',
options: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' },
},
{
label: '持续结束时间',
prop: 'lastEndTimeStr',
component: 'a-date-picker',
options: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' },
},
],
formRules: {},
formData: {},
},
},
}
},
computed: {
@ -513,6 +617,52 @@ export default {
',top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no'
)
},
handleOpenGuaranteeWeatherModal() {
this.guaranteeWeatherModal.visible = true
},
handleOpenAddQxhjModal() {
this.guaranteeWeatherModal.qxhjModal.title = '新建气象环境'
this.guaranteeWeatherModal.qxhjModal.mode = 'add'
this.guaranteeWeatherModal.qxhjModal.formData = { scenarioId: this.scenarioId }
this.guaranteeWeatherModal.qxhjModal.visible = true
},
async handleOpenEditQxhjModal(record) {
try {
const res = await getAction('/baseData/weatherResource/getInfo', { id: record.id })
this.guaranteeWeatherModal.qxhjModal.title = `编辑气象环境`
this.guaranteeWeatherModal.qxhjModal.mode = 'edit'
this.guaranteeWeatherModal.qxhjModal.formData = res.data
this.$set(
this.guaranteeWeatherModal.qxhjModal.formData,
'lastBegTimeStr',
res.data.lastBegTime.replace('T', ' ')
)
this.$set(
this.guaranteeWeatherModal.qxhjModal.formData,
'lastEndTimeStr',
res.data.lastEndTime.replace('T', ' ')
)
this.guaranteeWeatherModal.qxhjModal.visible = true
} catch (error) {
console.log(error)
}
},
handleSubmitQxhj(formData) {
return postAction(`/baseData/weatherResource/add`, formData)
},
handleSubmitQxhjSuccess() {
this.$refs['qxhj-table'].commitAction('query')
},
async handleDeleteQxhj(record) {
try {
await this.$confirm({ title: '温馨提示', content: '确定要删除该气象吗?' })
const res = await getAction('/baseData/weatherResource/remove/' + record.id)
this.$message.success(res.message)
this.$refs['qxhj-table'].commitAction('query')
} catch (error) {
console.log(error)
}
},
},
}
</script>