diff --git a/src/views/simulationScene/database/jcsjk.vue b/src/views/simulationScene/database/jcsjk.vue index 49ecaea..f2ec52d 100644 --- a/src/views/simulationScene/database/jcsjk.vue +++ b/src/views/simulationScene/database/jcsjk.vue @@ -1,86 +1,33 @@ @@ -89,148 +36,60 @@ export default { name: 'Jcsjk', data() { return { - listLoading: false, - scenarioList: [], - - queryParam: { id: '' }, - columns: [ - { - title: '#', - dataIndex: 'index', - customRender: (_, record, $index) => $index + 1, - align: 'center', - width: 80, + xd: { + loading: false, + listData: [], + selectedKeys: [], + }, + jc: { + queryConfig: false, + tableConfig: { + table: {}, + immediate: false, + query: () => + this.$http({ + url: '/baseData/scenario/taskList', + method: 'get', + params: { id: this.xd.selectedKeys[0] }, + }).then((res) => ({ + data: res.data.map(([a, b, c], index) => ({ id: index, 0: a, 1: b, 2: c })), + })), + columns: [ + { dataIndex: 'serial' }, + { title: '任务进程名称', dataIndex: '0', width: 'auto', minWidth: 150 }, + { title: '开始时间', dataIndex: '1', width: 'auto', minWidth: 150 }, + { title: '失效时间', dataIndex: '2', width: 'auto', minWidth: 150 }, + ], }, - { - title: '任务进程名称', - dataIndex: '0', - align: 'left', - }, - { - title: '开始时间', - width: 160, - dataIndex: '1', - align: 'center', - }, - { - title: '失效时间', - width: 160, - dataIndex: '2', - align: 'center', - }, - ], - loadData: [], // 加载数据方法 必须为 Promise 对象 - loadingTable: false, - - 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 } }, + pageConfig: false, + showTool: false, }, } }, 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 + if (this.xd.selectedKeys.length === 0) { + this.xd.selectedKeys = [this.xd.listData[0].id] + this.handleChangeXdSelected() + } } catch (error) { console.log(error) } finally { - this.listLoading = false + this.xd.loading = false } }, - handleClickScenario(item) { - this.queryParam.id = item.id - this.getList() - }, - resetList() { - this.getList() - }, - async getList(parameter = {}) { - try { - this.loadingTable = true - const res = await this.$http({ - url: '/baseData/scenario/taskList', - method: 'get', - params: { ...parameter, ...this.queryParam }, - }) - this.loadData = res.data - } catch (error) { - console.log(error) - } finally { - this.loadingTable = false - } - }, - 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.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.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('删除角色失败') - } + handleChangeXdSelected() { + this.$refs['jc-table'].commitAction('query') }, }, }