运行记录数据库

This commit is contained in:
liaoboping 2025-08-27 16:16:59 +08:00
parent fcd68267bd
commit f16575c315
2 changed files with 50 additions and 206 deletions

View File

@ -1,222 +1,67 @@
<template> <template>
<page-header-wrapper> <page-header-wrapper>
<a-card :bordered="false"> <Grid>
<div class="table-page-search-wrapper"> <a-card class="my-card">
<a-form layout="inline"> <AntQueryTable
<a-row :gutter="48"> height="100%"
<a-col :xl="8" :lg="8"> ref="xd-table"
<a-form-item label="想定名称"> :queryConfig="yxjlTable.queryConfig"
<a-input placeholder="请输入" v-model="queryParam.name" /> :tableConfig="yxjlTable.tableConfig"
</a-form-item> :pageConfig="yxjlTable.pageConfig"
</a-col> :showTool="yxjlTable.showTool"
<a-col :xl="8" :lg="8">
<span class="table-page-search-submitButtons">
<a-button type="primary" @click="getList">查询</a-button>
<a-button style="margin-left: 8px" @click="resetList">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<a-table
bordered
rowKey="id"
size="small"
:columns="columns"
:dataSource="loadData"
:pagination="paginationProps"
:loading="loadingTable"
@change="handleTableChange"
>
</a-table>
</a-card>
<h-modal
:title="AEModal.title"
:width="640"
:visible="AEModal.visible"
:destroyOnClose="true"
@cancel="() => this.handleClose()"
@ok="() => this.handleOk()"
switch-fullscreen
:fullscreen.sync="AEModal.fullscreen"
>
<a-spin :spinning="AEModal.spinning">
<a-form-model
ref="form"
:model="AEModal.form"
:rules="AEModal.rules"
:label-col="AEModal.labelCol"
:wrapper-col="AEModal.wrapperCol"
> >
<a-form-model-item label="想定名称" prop="name"> </AntQueryTable>
<a-input v-model="AEModal.form.name" /> </a-card>
</a-form-model-item> </Grid>
</a-form-model>
</a-spin>
</h-modal>
</page-header-wrapper> </page-header-wrapper>
</template> </template>
<script> <script>
export default { export default {
name: 'Xdsjk', name: 'Yxjlsjk',
data() { data() {
return { return {
queryParam: {}, // yxjlTable: {
columns: [ queryConfig: {
{ items: [{ label: '想定名称', prop: 'name' }],
title: '#',
dataIndex: 'id',
align: 'center',
width: 80,
}, },
{ tableConfig: {
title: '想定名称', query: (params) =>
align: 'left', this.$http({
dataIndex: 'name', url: '/scenarioHistory/list',
ellipsis: true, method: 'get',
params: params,
}),
columns: [
{ dataIndex: 'serial' },
{ title: '#', align: 'center', dataIndex: 'id', width: 80 },
{ title: '想定名称', align: 'left', dataIndex: 'name', ellipsis: true, width: 'auto' },
{ title: '作者', dataIndex: 'author', align: 'left', width: 'auto' },
{
title: '运行状态',
dataIndex: 'finalStatus',
customRender: (t) => ({ 1: '中止', 2: '推演结束' }[t]),
align: 'center',
},
{
title: '开始时间',
dataIndex: 'scenarioStartRunTime',
customRender: (t) => t?.replace('T', ' '),
align: 'center',
},
{
title: '结束时间',
dataIndex: 'scenarioEndRunTime',
customRender: (t) => t?.replace('T', ' '),
align: 'center',
},
],
}, },
{ pageConfig: true,
title: '作者', showTool: false,
dataIndex: 'author',
align: 'left',
},
{
title: '运行状态',
dataIndex: 'finalStatus',
customRender: (t) => ({ 1: '中止', 2: '推演结束' }[t]),
align: 'center',
},
{
title: '开始时间',
dataIndex: 'scenarioStartRunTime',
customRender: (t) => t?.replace('T', ' '),
align: 'center',
},
{
title: '结束时间',
dataIndex: 'scenarioEndRunTime',
customRender: (t) => t?.replace('T', ' '),
align: 'center',
},
],
loadData: [], // Promise
loadingTable: false,
selectedRowKeys: [],
selectedRows: [],
paginationProps: {
defaultPageSize: 10,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (total) => {
return `${total}`
},
total: 0,
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize),
},
AEModal: {
title: '',
visible: false,
editStatus: false,
fullscreen: false,
spinning: false,
form: {},
rules: {
name: [{ required: true, message: '请输入想定名称!', trigger: 'blur' }],
},
labelCol: { xs: { span: 24 }, sm: { span: 7 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 13 } },
}, },
} }
}, },
created() {
this.getList()
},
methods: {
resetList() {
this.queryParam = {}
this.getList()
},
async getList(parameter = {}) {
try {
this.loadingTable = true
const res = await this.$http({
url: '/scenarioHistory/list',
method: 'get',
params: { ...parameter, ...this.queryParam },
})
this.loadData = res.data.data
this.paginationProps.total = res.data.totalCount
} catch (error) {
console.log(error)
} finally {
this.loadingTable = false
}
},
handleTableChange(pagination) {
const parameter = {}
parameter.pageSize = pagination.pageSize
parameter.pageNum = pagination.current
this.getList(parameter)
},
handleAdd() {
this.AEModal.title = '添加想定'
this.AEModal.editStatus = false
this.AEModal.visible = true
},
async handleEdit(record) {
try {
const res = await this.$http({
url: `/baseData/scenario/${record.id}`,
method: 'get',
})
this.AEModal.form = res.data
this.AEModal.title = '编辑想定'
this.AEModal.editStatus = true
this.AEModal.visible = true
} catch (error) {
console.log(error)
this.$message.error('未知错误,请重试')
}
},
handleClose() {
this.AEModal.visible = false
this.AEModal.form = {}
},
async handleOk() {
try {
await this.$refs.form.validate()
const params = { ...this.AEModal.form }
await this.$http({
url: `/baseData/scenario/save`,
method: 'post',
data: params,
})
this.$message.success(`${this.AEModal.title}成功`)
this.getList()
this.handleClose()
} catch (error) {
console.log(error)
}
},
async handleDelete(record) {
try {
await this.$http({
url: `/baseData/scenario/remove/${record.id}`,
method: 'get',
})
this.$message.success('删除角色成功')
this.getList()
} catch (error) {
console.log(error)
this.$message.error('删除角色失败')
}
},
},
} }
</script> </script>

View File

@ -43,8 +43,7 @@
</a-card> </a-card>
<a-card title="装备管理" class="my-card my-card-has-title" :bordered="false"> <a-card title="装备管理" class="my-card my-card-has-title" :bordered="false">
<template #extra> <template #extra>
<a-button type="primary">新增</a-button> <a-icon type="sync" style="font-size: 30px" @click="$refs['zb-table'].commitAction('query')" />
<a-icon type="sync" style="font-size: 30px" />
</template> </template>
<AntQueryTable <AntQueryTable
ref="zb-table" ref="zb-table"