装备数据库、想定数据库

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> <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="xdTable.queryConfig"
<a-input placeholder="请输入" v-model="queryParam.name" /> :tableConfig="xdTable.tableConfig"
</a-form-item> :pageConfig="xdTable.pageConfig"
</a-col> :showTool="xdTable.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-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"> <template #toolbar-left>
<a @click="handleEdit(record)"> <a-icon type="form" /></a> <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-divider type="vertical" />
<a-popconfirm
<a-popconfirm title="确定要删除该想定吗?" ok-text="确定" cancel-text="取消" @confirm="handleDelete(record)"> title="确定要删除该想定吗?"
<a href="javascript:;"><a-icon type="delete" /></a> ok-text="确定"
cancel-text="取消"
@confirm="handleDelete(record)"
>
<a-button type="text-primary" icon="delete"></a-button>
</a-popconfirm> </a-popconfirm>
</span> </template>
</a-table> </AntQueryTable>
</a-card> </a-card>
</Grid>
<h-modal <AntFormModal
:visible.sync="AEModal.visible"
:title="AEModal.title" :title="AEModal.title"
:width="640" :formItems="AEModal.formItems"
:visible="AEModal.visible" :formRules="AEModal.formRules"
:destroyOnClose="true" :formData="AEModal.formData"
@cancel="() => this.handleClose()" :onSubmit="handleSubmitAE"
@ok="() => this.handleOk()" @success="handleSubmitAESuccess"
switch-fullscreen ></AntFormModal>
: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">
<a-input v-model="AEModal.form.name" />
</a-form-model-item>
</a-form-model>
</a-spin>
</h-modal>
</page-header-wrapper> </page-header-wrapper>
</template> </template>
@ -74,138 +45,73 @@ export default {
name: 'Xdsjk', name: 'Xdsjk',
data() { data() {
return { return {
queryParam: {}, // xdTable: {
queryConfig: {
items: [{ label: '想定名称', prop: 'name' }],
},
tableConfig: {
query: (params) =>
this.$http({
url: '/baseData/scenario/list',
method: 'get',
params: params,
}),
columns: [ columns: [
{ { dataIndex: 'serial' },
title: '#', { title: '想定名称', align: 'left', dataIndex: 'name', ellipsis: true, width: 'auto' },
dataIndex: 'id', { title: '作者', dataIndex: 'author', align: 'left', width: 'auto' },
align: 'center',
width: 80,
},
{
title: '想定名称',
align: 'left',
dataIndex: 'name',
ellipsis: true,
},
{
title: '作者',
dataIndex: 'author',
align: 'left',
},
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
customRender: (t) => t?.replace('T', ' '), customRender: (t) => t?.replace('T', ' '),
align: 'left', align: 'left',
width: 'auto',
}, },
{ { dataIndex: 'action' },
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: { AEModal: {
title: '',
visible: false, visible: false,
editStatus: false, title: '新增想定',
fullscreen: false, formItems: [{ label: '想定名称', prop: 'name' }],
spinning: false, formRules: {
form: {},
rules: {
name: [{ required: true, message: '请输入想定名称!', trigger: 'blur' }], name: [{ required: true, message: '请输入想定名称!', trigger: 'blur' }],
}, },
labelCol: { xs: { span: 24 }, sm: { span: 7 } }, formData: {},
wrapperCol: { xs: { span: 24 }, sm: { span: 13 } },
}, },
} }
}, },
created() {
this.getList()
},
methods: { methods: {
resetList() { handleOpenAddModal() {
this.queryParam = {} this.AEModal.formData = {}
this.getList() this.AEModal.title = '新增想定'
},
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
this.AEModal.visible = true this.AEModal.visible = true
}, },
async handleEdit(record) { async handleOpenEditModal(record) {
try { try {
const res = await this.$http({ const res = await this.$http({
url: `/baseData/scenario/${record.id}`, url: `/baseData/scenario/${record.id}`,
method: 'get', method: 'get',
}) })
this.AEModal.form = res.data this.AEModal.formData = res.data
this.AEModal.title = '编辑想定' this.AEModal.title = '编辑想定'
this.AEModal.editStatus = true
this.AEModal.visible = true this.AEModal.visible = true
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.$message.error('未知错误,请重试')
} }
}, },
handleClose() { handleSubmitAE(formData) {
this.AEModal.visible = false return this.$http({
this.AEModal.form = {}
},
async handleOk() {
try {
await this.$refs.form.validate()
const params = { ...this.AEModal.form }
await this.$http({
url: `/baseData/scenario/save`, url: `/baseData/scenario/save`,
method: 'post', method: 'post',
data: params, data: formData,
}) })
this.$message.success(`${this.AEModal.title}成功`) },
this.getList() handleSubmitAESuccess() {
this.handleClose() this.$refs['xd-table'].commitAction('query')
} catch (error) {
console.log(error)
}
}, },
async handleDelete(record) { async handleDelete(record) {
try { try {
@ -213,11 +119,11 @@ export default {
url: `/baseData/scenario/remove/${record.id}`, url: `/baseData/scenario/remove/${record.id}`,
method: 'get', method: 'get',
}) })
this.$message.success('删除角色成功') this.$message.success('删除想定成功')
this.getList() this.$refs['xd-table'].commitAction('query')
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.$message.error('删除角色失败') this.$message.error('删除想定失败')
} }
}, },
}, },

View File

@ -1,15 +1,15 @@
<template> <template>
<page-header-wrapper> <page-header-wrapper>
<Grid :columns="['400px', 1]"> <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> <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> </template>
<a-tree <a-tree
:treeData="zbgl.treeData" :treeData="zbfl.treeData"
:selectedKeys.sync="zbgl.selectedKeys" :selectedKeys.sync="zbfl.selectedKeys"
:expandedKeys.sync="zbgl.expandedKeys" :expandedKeys.sync="zbfl.expandedKeys"
@select="handleChangeZbglSelected" @select="(_, event) => handleChangeZbflSelected(event.node.dataRef.data)"
> >
<template #title="scope"> <template #title="scope">
<a-dropdown :trigger="['contextmenu']"> <a-dropdown :trigger="['contextmenu']">
@ -21,19 +21,19 @@
type="text-primary" type="text-primary"
icon="edit" icon="edit"
title="编辑" title="编辑"
@click="handleOpenEditZbglModal(scope.key)" @click="handleOpenEditZbflModal(scope.key)"
></a-button> ></a-button>
<a-button <a-button
type="text-primary" type="text-primary"
icon="plus" icon="plus"
title="新增子项" title="新增子项"
@click="handleOpenAddZbglModal(scope.key)" @click="handleOpenAddZbflModal(scope.key)"
></a-button> ></a-button>
<a-button <a-button
type="text-danger" type="text-danger"
icon="delete" icon="delete"
title="删除" title="删除"
@click="handleDeleteZbgl(scope.key, scope.title)" @click="handleDeleteZbfl(scope.key, scope.title)"
></a-button> ></a-button>
</Flex> </Flex>
</template> </template>
@ -41,34 +41,168 @@
</template> </template>
</a-tree> </a-tree>
</a-card> </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> </Grid>
</page-header-wrapper> </page-header-wrapper>
</template> </template>
<script> <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 { export default {
name: 'Zbsjk', name: 'Zbsjk',
data() { data() {
return { return {
zbgl: { zbfl: {
treeData: [], treeData: [],
selectedKeys: [], selectedKeys: [],
expandedKeys: [], expandedKeys: [],
}, },
zbglModal: { zbflModal: {
visible: false, visible: false,
title: '', title: '',
mode: '', mode: '',
formItems: [ formItems: [
{ {
label: '上级装备', label: '上级装备分类',
prop: 'parentId', prop: 'parentId',
component: 'AntOriginTreeSelect', component: 'AntOriginTreeSelect',
options: { options: {
dataSource: () => dataSource: () =>
this.$http({ this.$http({
url: '/tree/armament', url: '/basedata/entity/getTreeNode',
method: 'get', method: 'get',
params: { parentId: '-1' },
}).then((res) => ({ data: [{ key: 0, title: '根组织' }].concat(res.data) })), }).then((res) => ({ data: [{ key: 0, title: '根组织' }].concat(res.data) })),
valueKey: 'key', valueKey: 'key',
}, },
@ -78,16 +212,32 @@ export default {
prop: 'codeName', prop: 'codeName',
}, },
{ {
label: '装备名称', label: '装备分类名称',
prop: 'name', prop: 'name',
}, },
], ],
formRules: { formRules: {
codeName: [{ required: true, message: '请输入标识编码!', trigger: 'blur' }], codeName: [{ required: true, message: '请输入标识编码!', trigger: 'blur' }],
name: [{ required: true, message: '请输入装备名称!', trigger: 'blur' }], name: [{ required: true, message: '请输入装备分类名称!', trigger: 'blur' }],
}, },
formData: {}, 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() { created() {
@ -101,51 +251,57 @@ export default {
async getZzTree() { async getZzTree() {
try { try {
const res = await this.$http({ const res = await this.$http({
url: `/tree/armament`, url: '/basedata/entity/getTreeNode',
method: 'get', method: 'get',
params: { parentId: '-1' },
}) })
this.zbgl.treeData = res.data this.zbfl.treeData = res.data
this.zbgl.selectedKeys = [this.zbgl.treeData[0].key] this.zbfl.selectedKeys = [this.zbfl.treeData[0].key]
this.handleChangeZbglSelected() this.handleChangeZbflSelected(this.zbfl.treeData[0].data)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
}, },
handleChangeZbglSelected() {}, handleChangeZbflSelected(data) {
handleOpenAddZbglModal(parentId) { this.zb.entityType = data.entityType
this.zbglModal.title = '新建装备管理' this.zb.parentId = data.id
this.zbglModal.mode = 'add' this.zb.tableConfig.columns = listGridInfo[data.entityType] || []
this.zbglModal.formData = { parentId } this.$refs['zb-table'].commitAction('query')
this.zbglModal.visible = true
}, },
async handleOpenEditZbglModal(id) { handleOpenAddZbflModal(parentId) {
this.zbflModal.title = '新建装备分类'
this.zbflModal.mode = 'add'
this.zbflModal.formData = { parentId }
this.zbflModal.visible = true
},
async handleOpenEditZbflModal(id) {
try { try {
const res = await this.$http({ const res = await this.$http({
url: `/baseData/fightPowerHierarchy/${id}`, url: `/baseData/fightPowerHierarchy/${id}`,
method: 'get', method: 'get',
}) })
this.zbglModal.title = '编辑装备管理' this.zbflModal.title = '编辑装备分类'
this.zbglModal.mode = 'edit' this.zbflModal.mode = 'edit'
this.zbglModal.formData = res.data this.zbflModal.formData = res.data
this.zbglModal.visible = true this.zbflModal.visible = true
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.$message.error('未知错误,请重试') this.$message.error('未知错误,请重试')
} }
}, },
handleSubmitZbgl(formData) { handleSubmitZbfl(formData) {
return this.$http({ return this.$http({
url: `/baseData/fightPowerHierarchy/save`, url: `/baseData/fightPowerHierarchy/save`,
method: 'post', method: 'post',
data: formData, data: formData,
}) })
}, },
handleSubmitZbglSuccess() { handleSubmitZbflSuccess() {
this.getZzTree() this.getZzTree()
}, },
async handleDeleteZbgl(id, title) { async handleDeleteZbfl(id, title) {
try { try {
await this.$confirm({ content: `确定删除装备管理-${title}` }) await this.$confirm({ content: `确定删除装备分类-${title}` })
await this.$http({ await this.$http({
url: `/baseData/fightPowerHierarchy/remove/${id}`, url: `/baseData/fightPowerHierarchy/remove/${id}`,
method: 'get', method: 'get',