From 0e3937563278e0a9ce9d86eee8e05cbd3fbdf28a Mon Sep 17 00:00:00 2001 From: liaoboping <2824044657@qq.com> Date: Thu, 21 Aug 2025 17:33:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/simulationScene/database/fasjk.vue | 359 ++++++++----------- 1 file changed, 151 insertions(+), 208 deletions(-) diff --git a/src/views/simulationScene/database/fasjk.vue b/src/views/simulationScene/database/fasjk.vue index 92392c3..e131945 100644 --- a/src/views/simulationScene/database/fasjk.vue +++ b/src/views/simulationScene/database/fasjk.vue @@ -1,86 +1,60 @@ @@ -89,173 +63,142 @@ export default { name: 'Fasjk', data() { return { - listLoading: false, - scenarioList: [], - - queryParam: { id: '' }, - columns: [ - { - title: '#', - dataIndex: 'index', - customRender: (_, record, $index) => $index + 1, - align: 'center', - width: 80, - }, - { - title: '分队名称', - dataIndex: '0', - align: 'left', - }, - { - title: '方案名称', - dataIndex: '1', - align: 'left', - }, - { - title: '方案类型', - dataIndex: '2', - align: 'left', - ellipsis: true, - }, - { - title: '开始时间', - width: 160, - dataIndex: '3', - align: 'center', - }, - { - title: '结束时间', - width: 160, - dataIndex: '4', - align: 'center', - }, - { - title: '经度', - width: 120, - dataIndex: 'lat', - customRender: (_, record, $index) => record[5].split(',')[0], - align: 'center', - }, - { - title: '纬度', - width: 120, - dataIndex: 'lon', - customRender: (_, record, $index) => record[5].split(',')[0], - align: 'center', - }, - ], - loadData: [], // 加载数据方法 必须为 Promise 对象 - loadingTable: false, - - AEModal: { - title: '', + xd: { + loading: false, + listData: [], + selectedKeys: [], + }, + zzbzll: { + loading: false, + treeData: [], + selectedKeys: [], + expandedKeys: [], + }, + blbz: { + loading: false, + treeData: [], + selectedKeys: [], + expandedKeys: [], + }, + blbzModal: { 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 } }, + type: 'staff', + queryConfig: false, + pageConfig: false, + showTool: false, }, } }, + computed: { + tableConfig() { + return { + query: () => + this.$http({ + url: `/baseData/fightPowerHierarchy/${this.blbzModal.type}/${this.blbz.selectedKeys[0]}`, + method: 'get', + }), + immediate: false, + table: {}, + columns: { + staff: [ + { dataIndex: 'serial' }, + { title: '岗位', dataIndex: 'name', width: 'auto', minWidth: 150 }, + { title: '岗位数量', dataIndex: 'number', type: 'number', width: 'auto', minWidth: 150 }, + { dataIndex: 'action' }, + ], + weapon: [ + { dataIndex: 'serial' }, + { title: '装备名称', dataIndex: 'name', width: 'auto', minWidth: 150 }, + { title: '装备数量', dataIndex: 'number', type: 'number', width: 'auto', minWidth: 150 }, + { dataIndex: 'action' }, + ], + }[this.blbzModal.type], + } + }, + }, created() { - this.getScenarioList() + this.getXdListData() }, methods: { - async getScenarioList() { + async getXdListData() { try { - this.listLoading = true + this.xd.loading = true const res = await this.$http({ url: `/baseData/scenario/all`, method: 'get', }) - this.scenarioList = res.data - this.queryParam.id = this.scenarioList[0].id - this.getList() + this.xd.listData = res.data } catch (error) { console.log(error) } finally { - this.listLoading = false + this.xd.loading = false } }, - handleClickScenario(item) { - this.queryParam.id = item.id - this.getList() + handleChangeXdSelected() { + this.getZzbzllTreeData() }, - resetList() { - this.getList() - }, - async getList(parameter = {}) { + async getZzbzllTreeData() { try { - this.loadingTable = true + this.zzbzll.loading = true const res = await this.$http({ - url: '/baseData/scenario/schemeList', + url: `/scenario/power/${this.xd.selectedKeys[0]}`, method: 'get', - params: { ...parameter, ...this.queryParam }, }) - this.loadData = res.data + this.zzbzll.treeData = [ + { + id: '1', + name: '红方', + selectable: false, + children: [ + { id: '1-1', name: '作战力量', selectable: false, children: res.data.red.fight }, + { id: '1-2', name: '保障力量', selectable: false, children: res.data.red.guarantee }, + { id: '1-3', name: '指挥力量', selectable: false, children: res.data.red.command }, + ], + }, + { + id: '2', + name: '蓝方', + selectable: false, + children: [ + { id: '2-1', name: '作战力量', selectable: false, children: res.data.blue.fight }, + { id: '2-2', name: '保障力量', selectable: false, children: res.data.blue.guarantee }, + { id: '2-3', name: '指挥力量', selectable: false, children: res.data.blue.command }, + ], + }, + ] + this.zzbzll.expandedKeys = ['1', '1-1', '1-2', '1-3', '2', '2-1', '2-2', '2-3'] } catch (error) { console.log(error) } finally { - this.loadingTable = false + this.zzbzll.loading = false } }, - handleAdd() { - this.AEModal.title = '添加想定' - this.AEModal.editStatus = false - this.AEModal.visible = true + handleChangeZzbzllSelected() { + this.getBlbzTreeData() }, - async handleEdit(record) { + async getBlbzTreeData() { try { + this.blbz.loading = true const res = await this.$http({ - url: `/baseData/scenario/${record.id}`, + url: `/blbz/${this.zzbzll.selectedKeys[0]}`, method: 'get', }) - this.AEModal.form = res.data.data - this.AEModal.title = '编辑想定' - this.AEModal.editStatus = true - this.AEModal.visible = true + this.blbz.treeData = res.data } catch (error) { console.log(error) - this.$message.error('未知错误,请重试') + this.blbz.treeData = [{ title: '123', key: '123' }] + } finally { + this.blbz.loading = false } }, - handleClose() { - this.AEModal.visible = false - this.AEModal.form = {} + handleChangeBlbzSelected() { + this.blbzModal.visible = true + this.$nextTick(() => { + this.$refs['blbz-table'].commitAction('query') + }) }, - 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.editStatus ? '编辑想定成功!' : '添加想定成功!') - 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('删除角色失败') - } + handleChangeBlbzModalType() { + this.$refs['blbz-table'].commitAction('query') }, }, }