From fcd68267bdd496aca30e0ed1657510119a8f178c Mon Sep 17 00:00:00 2001 From: liaoboping <344114999@qq.com> Date: Wed, 27 Aug 2025 15:19:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E3=80=81=E6=83=B3=E5=AE=9A=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/xdsjk.vue | 256 ++++++------------- src/views/simulationScene/database/zbsjk.vue | 224 +++++++++++++--- 2 files changed, 271 insertions(+), 209 deletions(-) diff --git a/src/views/simulationScene/database/xdsjk.vue b/src/views/simulationScene/database/xdsjk.vue index e7e281a..faf6899 100644 --- a/src/views/simulationScene/database/xdsjk.vue +++ b/src/views/simulationScene/database/xdsjk.vue @@ -1,71 +1,42 @@ @@ -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('删除想定失败') } }, }, diff --git a/src/views/simulationScene/database/zbsjk.vue b/src/views/simulationScene/database/zbsjk.vue index c1b8d86..4c60221 100644 --- a/src/views/simulationScene/database/zbsjk.vue +++ b/src/views/simulationScene/database/zbsjk.vue @@ -1,15 +1,15 @@ + + + +