装备数据库、想定数据库

This commit is contained in:
liaoboping 2025-08-27 15:19:10 +08:00
parent a93db081dc
commit fcd68267bd
2 changed files with 271 additions and 209 deletions

View File

@ -1,71 +1,42 @@
<template>
<page-header-wrapper>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :xl="8" :lg="8">
<a-form-item label="想定名称">
<a-input placeholder="请输入" v-model="queryParam.name" />
</a-form-item>
</a-col>
<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-col :xl="8" :lg="8">
<a-button type="primary" icon="plus" style="float: right" @click="handleAdd">新建</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
bordered
rowKey="id"
size="small"
:columns="columns"
:dataSource="loadData"
:pagination="paginationProps"
:loading="loadingTable"
@change="handleTableChange"
>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)"> <a-icon type="form" /></a>
<a-divider type="vertical" />
<a-popconfirm title="确定要删除该想定吗?" ok-text="确定" cancel-text="取消" @confirm="handleDelete(record)">
<a href="javascript:;"><a-icon type="delete" /></a>
</a-popconfirm>
</span>
</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"
<Grid>
<a-card class="my-card">
<AntQueryTable
height="100%"
ref="xd-table"
:queryConfig="xdTable.queryConfig"
:tableConfig="xdTable.tableConfig"
:pageConfig="xdTable.pageConfig"
:showTool="xdTable.showTool"
>
<a-form-model-item label="想定名称" prop="name">
<a-input v-model="AEModal.form.name" />
</a-form-model-item>
</a-form-model>
</a-spin>
</h-modal>
<template #toolbar-left>
<a-button type="primary" icon="plus" @click="handleOpenAddModal">新增</a-button>
</template>
<template #tablecell-action="{ record }">
<a-button type="text-primary" icon="form" @click="handleOpenEditModal(record)"></a-button>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除该想定吗?"
ok-text="确定"
cancel-text="取消"
@confirm="handleDelete(record)"
>
<a-button type="text-primary" icon="delete"></a-button>
</a-popconfirm>
</template>
</AntQueryTable>
</a-card>
</Grid>
<AntFormModal
:visible.sync="AEModal.visible"
:title="AEModal.title"
:formItems="AEModal.formItems"
:formRules="AEModal.formRules"
:formData="AEModal.formData"
:onSubmit="handleSubmitAE"
@success="handleSubmitAESuccess"
></AntFormModal>
</page-header-wrapper>
</template>
@ -74,138 +45,73 @@ export default {
name: 'Xdsjk',
data() {
return {
queryParam: {}, //
columns: [
{
title: '#',
dataIndex: 'id',
align: 'center',
width: 80,
xdTable: {
queryConfig: {
items: [{ label: '想定名称', prop: 'name' }],
},
{
title: '想定名称',
align: 'left',
dataIndex: 'name',
ellipsis: true,
tableConfig: {
query: (params) =>
this.$http({
url: '/baseData/scenario/list',
method: 'get',
params: params,
}),
columns: [
{ dataIndex: 'serial' },
{ title: '想定名称', align: 'left', dataIndex: 'name', ellipsis: true, width: 'auto' },
{ title: '作者', dataIndex: 'author', align: 'left', width: 'auto' },
{
title: '创建时间',
dataIndex: 'createTime',
customRender: (t) => t?.replace('T', ' '),
align: 'left',
width: 'auto',
},
{ dataIndex: 'action' },
],
},
{
title: '作者',
dataIndex: 'author',
align: 'left',
},
{
title: '创建时间',
dataIndex: 'createTime',
customRender: (t) => t?.replace('T', ' '),
align: 'left',
},
{
title: '操作',
width: 140,
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
},
],
loadData: [], // Promise
loadingTable: false,
selectedRowKeys: [],
selectedRows: [],
paginationProps: {
defaultPageSize: 10,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (total) => {
return `${total}`
},
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize),
pageConfig: true,
showTool: true,
},
AEModal: {
title: '',
visible: false,
editStatus: false,
fullscreen: false,
spinning: false,
form: {},
rules: {
title: '新增想定',
formItems: [{ label: '想定名称', prop: 'name' }],
formRules: {
name: [{ required: true, message: '请输入想定名称!', trigger: 'blur' }],
},
labelCol: { xs: { span: 24 }, sm: { span: 7 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 13 } },
formData: {},
},
}
},
created() {
this.getList()
},
methods: {
resetList() {
this.queryParam = {}
this.getList()
},
async getList(parameter = {}) {
try {
this.loadingTable = true
const res = await this.$http({
url: '/baseData/scenario/list',
method: 'get',
params: { ...parameter, ...this.queryParam },
})
this.loadData = res.data.data
} 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
handleOpenAddModal() {
this.AEModal.formData = {}
this.AEModal.title = '新增想定'
this.AEModal.visible = true
},
async handleEdit(record) {
async handleOpenEditModal(record) {
try {
const res = await this.$http({
url: `/baseData/scenario/${record.id}`,
method: 'get',
})
this.AEModal.form = res.data
this.AEModal.formData = 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 = {}
handleSubmitAE(formData) {
return this.$http({
url: `/baseData/scenario/save`,
method: 'post',
data: formData,
})
},
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)
}
handleSubmitAESuccess() {
this.$refs['xd-table'].commitAction('query')
},
async handleDelete(record) {
try {
@ -213,11 +119,11 @@ export default {
url: `/baseData/scenario/remove/${record.id}`,
method: 'get',
})
this.$message.success('删除角色成功')
this.getList()
this.$message.success('删除想定成功')
this.$refs['xd-table'].commitAction('query')
} catch (error) {
console.log(error)
this.$message.error('删除角色失败')
this.$message.error('删除想定失败')
}
},
},

View File

@ -1,15 +1,15 @@
<template>
<page-header-wrapper>
<Grid :columns="['400px', 1]">
<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>
<a-button type="primary" icon="plus" shape="circle" title="新增" @click="handleOpenAddZbglModal()"></a-button>
<a-button type="primary" icon="plus" shape="circle" title="新增" @click="handleOpenAddZbflModal()"></a-button>
</template>
<a-tree
:treeData="zbgl.treeData"
:selectedKeys.sync="zbgl.selectedKeys"
:expandedKeys.sync="zbgl.expandedKeys"
@select="handleChangeZbglSelected"
:treeData="zbfl.treeData"
:selectedKeys.sync="zbfl.selectedKeys"
:expandedKeys.sync="zbfl.expandedKeys"
@select="(_, event) => handleChangeZbflSelected(event.node.dataRef.data)"
>
<template #title="scope">
<a-dropdown :trigger="['contextmenu']">
@ -21,19 +21,19 @@
type="text-primary"
icon="edit"
title="编辑"
@click="handleOpenEditZbglModal(scope.key)"
@click="handleOpenEditZbflModal(scope.key)"
></a-button>
<a-button
type="text-primary"
icon="plus"
title="新增子项"
@click="handleOpenAddZbglModal(scope.key)"
@click="handleOpenAddZbflModal(scope.key)"
></a-button>
<a-button
type="text-danger"
icon="delete"
title="删除"
@click="handleDeleteZbgl(scope.key, scope.title)"
@click="handleDeleteZbfl(scope.key, scope.title)"
></a-button>
</Flex>
</template>
@ -41,34 +41,168 @@
</template>
</a-tree>
</a-card>
<a-card title="装备管理" class="my-card my-card-has-title" :bordered="false">
<template #extra>
<a-button type="primary">新增</a-button>
<a-icon type="sync" style="font-size: 30px" />
</template>
<AntQueryTable
ref="zb-table"
:queryConfig="zb.queryConfig"
:showTool="zb.showTool"
:tableConfig="zb.tableConfig"
></AntQueryTable>
</a-card>
</Grid>
</page-header-wrapper>
</template>
<script>
const listGridInfo = {
Aircraft: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类型', dataIndex: 'type' },
{ title: '国家', dataIndex: 'operatorCountry' },
{ title: '军种', dataIndex: 'operatorService' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '服役年', dataIndex: 'yearCommissioned' },
{ title: '退役年', dataIndex: 'yearDecommissioned' },
],
Ship: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类别', dataIndex: 'category' },
{ title: '所属国', dataIndex: 'operatorCountry' },
{ title: '所属军种', dataIndex: 'operatorService' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '服役年', dataIndex: 'yearCommissioned' },
{ title: '退役年', dataIndex: 'yearDecommissioned' },
{ title: '注释', dataIndex: 'comments' },
{ title: '类型', dataIndex: 'type' },
],
Submarine: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类别', dataIndex: 'category' },
{ title: '所属国', dataIndex: 'operatorCountry' },
{ title: '所属军种', dataIndex: 'operatorService' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '服役年', dataIndex: 'yearCommissioned' },
{ title: '退役年', dataIndex: 'yearDecommissioned' },
{ title: '注释', dataIndex: 'comments' },
{ title: '类型', dataIndex: 'type' },
],
Weapon: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '生产年代', dataIndex: 'generation' },
{ title: '所属国', dataIndex: 'operatorCountry' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '注释', dataIndex: 'comments' },
{ title: '类型', dataIndex: 'type' },
],
Facility: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类别', dataIndex: 'category' },
{ title: '所属国', dataIndex: 'operatorCountry' },
{ title: '所属军种', dataIndex: 'operatorService' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '服役年', dataIndex: 'yearCommissioned' },
{ title: '退役年', dataIndex: 'yearDecommissioned' },
{ title: '注释', dataIndex: 'comments' },
{ title: '类型', dataIndex: 'type' },
],
Satellite: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类别', dataIndex: 'category' },
{ title: '所属国', dataIndex: 'operatorCountry' },
{ title: '所属军种', dataIndex: 'operatorService' },
{ title: '造价(百万,¥)', dataIndex: 'cost' },
{ title: '服役年', dataIndex: 'yearCommissioned' },
{ title: '退役年', dataIndex: 'yearDecommissioned' },
{ title: '注释', dataIndex: 'comments' },
{ title: '类型', dataIndex: 'type' },
],
Comm: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类型', dataIndex: 'type' },
{ title: '注释', dataIndex: 'comments' },
],
Sensor: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类型', dataIndex: 'type' },
{ title: '注释', dataIndex: 'comments' },
{ title: '最大作用距离(公里)', dataIndex: 'rangeMax' },
],
Loadout: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '挂载方案的作用', dataIndex: 'loadoutRole' },
{ title: '注释', dataIndex: 'comments' },
],
Magazine: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '装甲', dataIndex: 'armorGeneral' },
{ title: '补给间隔时间(秒)', dataIndex: 'rof' },
{ title: '容量', dataIndex: 'capacity' },
{ title: '注释', dataIndex: 'comments' },
],
Mount: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '注释', dataIndex: 'comments' },
],
Propulsion: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类型', dataIndex: 'type' },
{ title: '注释', dataIndex: 'comments' },
],
Warhead: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '炸药类型', dataIndex: 'explosivesType' },
{ title: '类型', dataIndex: 'type' },
{ title: '注释', dataIndex: 'comments' },
],
Laser: [
{ title: '#DBID', dataIndex: 'id', width: 80 },
{ title: '名称', dataIndex: 'name', width: 200, ellipsis: true },
{ title: '类型', dataIndex: 'type' },
{ title: '所属国', dataIndex: 'operatorCountry' },
],
}
export default {
name: 'Zbsjk',
data() {
return {
zbgl: {
zbfl: {
treeData: [],
selectedKeys: [],
expandedKeys: [],
},
zbglModal: {
zbflModal: {
visible: false,
title: '',
mode: '',
formItems: [
{
label: '上级装备',
label: '上级装备分类',
prop: 'parentId',
component: 'AntOriginTreeSelect',
options: {
dataSource: () =>
this.$http({
url: '/tree/armament',
url: '/basedata/entity/getTreeNode',
method: 'get',
params: { parentId: '-1' },
}).then((res) => ({ data: [{ key: 0, title: '根组织' }].concat(res.data) })),
valueKey: 'key',
},
@ -78,16 +212,32 @@ export default {
prop: 'codeName',
},
{
label: '装备名称',
label: '装备分类名称',
prop: 'name',
},
],
formRules: {
codeName: [{ required: true, message: '请输入标识编码!', trigger: 'blur' }],
name: [{ required: true, message: '请输入装备名称!', trigger: 'blur' }],
name: [{ required: true, message: '请输入装备分类名称!', trigger: 'blur' }],
},
formData: {},
},
zb: {
entityType: '',
parentId: '',
queryConfig: false,
showTool: false,
tableConfig: {
query: (params) =>
this.$http({
url: '/basedata/' + this.zb.entityType.toLowerCase() + '/getList',
method: 'post',
data: { ...params, parentId: this.zb.parentId },
}),
columns: [{ dataIndex: 'serial' }, { dataIndex: 'action' }],
immediate: false,
},
},
}
},
created() {
@ -101,51 +251,57 @@ export default {
async getZzTree() {
try {
const res = await this.$http({
url: `/tree/armament`,
url: '/basedata/entity/getTreeNode',
method: 'get',
params: { parentId: '-1' },
})
this.zbgl.treeData = res.data
this.zbgl.selectedKeys = [this.zbgl.treeData[0].key]
this.handleChangeZbglSelected()
this.zbfl.treeData = res.data
this.zbfl.selectedKeys = [this.zbfl.treeData[0].key]
this.handleChangeZbflSelected(this.zbfl.treeData[0].data)
} catch (error) {
console.log(error)
}
},
handleChangeZbglSelected() {},
handleOpenAddZbglModal(parentId) {
this.zbglModal.title = '新建装备管理'
this.zbglModal.mode = 'add'
this.zbglModal.formData = { parentId }
this.zbglModal.visible = true
handleChangeZbflSelected(data) {
this.zb.entityType = data.entityType
this.zb.parentId = data.id
this.zb.tableConfig.columns = listGridInfo[data.entityType] || []
this.$refs['zb-table'].commitAction('query')
},
async handleOpenEditZbglModal(id) {
handleOpenAddZbflModal(parentId) {
this.zbflModal.title = '新建装备分类'
this.zbflModal.mode = 'add'
this.zbflModal.formData = { parentId }
this.zbflModal.visible = true
},
async handleOpenEditZbflModal(id) {
try {
const res = await this.$http({
url: `/baseData/fightPowerHierarchy/${id}`,
method: 'get',
})
this.zbglModal.title = '编辑装备管理'
this.zbglModal.mode = 'edit'
this.zbglModal.formData = res.data
this.zbglModal.visible = true
this.zbflModal.title = '编辑装备分类'
this.zbflModal.mode = 'edit'
this.zbflModal.formData = res.data
this.zbflModal.visible = true
} catch (error) {
console.log(error)
this.$message.error('未知错误,请重试')
}
},
handleSubmitZbgl(formData) {
handleSubmitZbfl(formData) {
return this.$http({
url: `/baseData/fightPowerHierarchy/save`,
method: 'post',
data: formData,
})
},
handleSubmitZbglSuccess() {
handleSubmitZbflSuccess() {
this.getZzTree()
},
async handleDeleteZbgl(id, title) {
async handleDeleteZbfl(id, title) {
try {
await this.$confirm({ content: `确定删除装备管理-${title}` })
await this.$confirm({ content: `确定删除装备分类-${title}` })
await this.$http({
url: `/baseData/fightPowerHierarchy/remove/${id}`,
method: 'get',