From 69cd211afb1491343d3fe7bbacefc4d2601b6475 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Tue, 23 May 2023 16:30:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8ClogManage=E5=B7=A6=E4=BE=A7=E6=A0=91?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=94=B9=E4=B8=BA=E5=8A=A0=E8=BD=BDjson?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TreeWithLine/index.vue | 5 +- src/style.less | 18 ++- src/views/logManage/index.vue | 98 ++++++--------- src/views/logManage/tree.json | 170 ++++++++++++++++++++++++++ src/views/system/DataBase.vue | 17 ++- src/views/system/DetectorInfo.vue | 99 +++++++++------ src/views/system/NuclearFacility.vue | 134 +++++++++++++------- src/views/system/stationList.vue | 113 +++++++++++------ 8 files changed, 472 insertions(+), 182 deletions(-) create mode 100644 src/views/logManage/tree.json diff --git a/src/components/TreeWithLine/index.vue b/src/components/TreeWithLine/index.vue index 4c1b525..f79f0ae 100644 --- a/src/components/TreeWithLine/index.vue +++ b/src/components/TreeWithLine/index.vue @@ -1,6 +1,6 @@ - +
@@ -47,7 +47,7 @@
- 这里是Log内容 + 这里是Log内容 @@ -55,6 +55,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import TreeWithLine from '@/components/TreeWithLine/index.vue' import { downloadFile, getAction } from '../../api/manage' +import TreeJson from './tree.json' const columns = [ { @@ -94,64 +95,18 @@ export default { list: '/test' }, isGettingTreeData: false, // 正在获取左侧树信息 - treeData: [ + treeData: [], + selectedKeys: [], + expandedKeys: [], + dataSource: [ { - title: 'Db', - key: '1', - children: [ - { - title: '2022', - key: '1-1', - children: [ - { - title: '04', - key: '1-1-1' - }, - { - title: '05', - key: '1-1-2' - } - ] - }, - { - title: '2023', - key: '1-2', - children: [ - { - title: '04', - key: '1-2-1' - }, - { - title: '05', - key: '1-2-2' - } - ] - } - ] - }, - { - title: 'Error', - key: '2', - children: [ - { - title: '2022', - key: '2-1', - children: [ - { - title: '04', - key: '2-1-1' - }, - { - title: '05', - key: '2-1-2' - } - ] - } - ] + id: 1, + name: 'DEX33_002-20220512_0723_S_FULL_9011.9.log', + date: '2022-05-13', + size: '105KB', + fileName: 'test.txt' } ], - selectedKeys: [], - dataSource: [{ id: 1, name: 'DEX33_002-20220512_0723_S_FULL_9011.9.log', date: '2022-05-13', size: '105KB', fileName: 'test.txt' }], visible: false } }, @@ -159,7 +114,7 @@ export default { this.getTreeData() }, methods: { - async getTreeData () { + async getTreeData() { try { this.isGettingTreeData = true const res = await getAction('/logManage/findFtpFolders') @@ -167,13 +122,36 @@ export default { } catch (error) { console.error(error) this.$message.error('Get Tree Data Failed') - this.selectedKeys = ['1-1-2'] + this.treeData = this.buildTreeData(TreeJson) + console.log('%c [ this.treeData ]-125', 'font-size:13px; background:pink; color:#bf2c9f;', this.treeData) + const firstNode = this.treeData[0] + this.selectedKeys = [firstNode.key] + this.expandedKeys = [firstNode.key] this.onSelect() } finally { this.isGettingTreeData = false } }, - onSelect () { + + /** + * @param {Array} treeJson + */ + buildTreeData(treeJson) { + const tree = [] + treeJson.forEach(item => { + const treeNode = { + title: item.name, + key: item.path, + children: [] + } + if (item.children && item.children.length) { + treeNode.children.push(...this.buildTreeData(item.children)) + } + tree.push(treeNode) + }) + return tree + }, + onSelect() { this.queryParam.query = this.selectedKeys[0] this.loadData() }, diff --git a/src/views/logManage/tree.json b/src/views/logManage/tree.json new file mode 100644 index 0000000..56469f8 --- /dev/null +++ b/src/views/logManage/tree.json @@ -0,0 +1,170 @@ +[ + { + "name": "Alert", + "path": "/log/Alert/", + "orderNum": 1, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "AlertLog1", + "path": "/log/Alert/AlertLog1/", + "orderNum": 1, + "parentNum": 1, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "AlertLog2", + "path": "/log/Alert/AlertLog2/", + "orderNum": 2, + "parentNum": 1, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + }, + { + "name": "Error", + "path": "/log/Error/", + "orderNum": 2, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "ErrorLog1", + "path": "/log/Error/ErrorLog1/", + "orderNum": 1, + "parentNum": 2, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "ErrorLog2", + "path": "/log/Error/ErrorLog2/", + "orderNum": 2, + "parentNum": 2, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + }, + { + "name": "Mail", + "path": "/log/Mail/", + "orderNum": 3, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "MailLog1", + "path": "/log/Mail/MailLog1/", + "orderNum": 1, + "parentNum": 3, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "MailLog2", + "path": "/log/Mail/MailLog2/", + "orderNum": 2, + "parentNum": 3, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + }, + { + "name": "Met", + "path": "/log/Met/", + "orderNum": 4, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "MetLog1", + "path": "/log/Met/MetLog1/", + "orderNum": 1, + "parentNum": 4, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "MetLog2", + "path": "/log/Met/MetLog2/", + "orderNum": 2, + "parentNum": 4, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + }, + { + "name": "Soh", + "path": "/log/Soh/", + "orderNum": 5, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "SohLog1", + "path": "/log/Soh/SohLog1/", + "orderNum": 1, + "parentNum": 5, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "SohLog2", + "path": "/log/Soh/SohLog2/", + "orderNum": 2, + "parentNum": 5, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + }, + { + "name": "Spectrum", + "path": "/log/Spectrum/", + "orderNum": 6, + "parentNum": 0, + "hashParent": false, + "hashChild": true, + "children": [ + { + "name": "SpectrumLog1", + "path": "/log/Spectrum/SpectrumLog1/", + "orderNum": 1, + "parentNum": 6, + "hashParent": true, + "hashChild": false, + "children": null + }, + { + "name": "SpectrumLog2", + "path": "/log/Spectrum/SpectrumLog2/", + "orderNum": 2, + "parentNum": 6, + "hashParent": true, + "hashChild": false, + "children": null + } + ] + } +] \ No newline at end of file diff --git a/src/views/system/DataBase.vue b/src/views/system/DataBase.vue index fbc1166..81fda6d 100644 --- a/src/views/system/DataBase.vue +++ b/src/views/system/DataBase.vue @@ -222,9 +222,12 @@ export default { { label: 'SampleID', type: 'a-input', - name: 'sampleID', + name: 'sampleId', style: { width: '19%' + }, + props: { + allowClear: true } }, { @@ -240,7 +243,8 @@ export default { ...this.stationList ], showSearch: true, - filterOption: this.filterOption + filterOption: this.filterOption, + allowClear: true }, style: { width: '19%' @@ -259,7 +263,8 @@ export default { ...this.detectorList ], showSearch: true, - filterOption: this.filterOption + filterOption: this.filterOption, + allowClear: true }, style: { width: '19%' @@ -268,10 +273,11 @@ export default { { label: 'From', type: 'a-date-picker', - name: 'from', + name: 'collectStart', props: { showTime: { format: 'HH:mm' }, format: 'YYYY-MM-DD HH:mm', + valueFormat: 'YYYY-MM-DD HH:mm:ss', style: { minWidth: 'auto' } @@ -283,10 +289,11 @@ export default { { label: 'To', type: 'a-date-picker', - name: 'to', + name: 'collectStop', props: { showTime: { format: 'HH:mm' }, format: 'YYYY-MM-DD HH:mm', + valueFormat: 'YYYY-MM-DD HH:mm:ss', style: { minWidth: 'auto' } diff --git a/src/views/system/DetectorInfo.vue b/src/views/system/DetectorInfo.vue index 2236535..f79bc37 100644 --- a/src/views/system/DetectorInfo.vue +++ b/src/views/system/DetectorInfo.vue @@ -100,39 +100,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import FormMixin from '@/mixins/FormMixin' import { cloneDeep } from 'lodash' import moment from 'moment' - -const formItems = [ - { - label: 'Detector Code', - type: 'a-input', - name: 'detectorCode', - style: { - width: '310px' - } - }, - { - label: 'Type', - type: 'a-input', - name: 'type', - style: { - width: '310px' - } - }, - { - label: 'Status', - type: 'j-dict-select-tag', - name: 'status', - props: { - dictCode: 'STATION_STATUS', - getPopupContainer: () => { - return document.body - } - }, - style: { - width: '310px' - } - } -] +import { getAction } from '../../api/manage' const columns = [ { @@ -213,7 +181,6 @@ const columns = [ export default { mixins: [JeecgListMixin, FormMixin], data() { - this.formItems = formItems this.columns = columns const validateDetectorCode = (_, value, callback) => { if (!value) { @@ -239,10 +206,27 @@ export default { delete: '/gardsDetectors/deleteById', add: '/gardsDetectors/create', edit: '/gardsDetectors/update' - } + }, + typeList: [] } }, + created() { + this.getTypeList() + }, methods: { + async getTypeList() { + try { + const res = await getAction('/gardsDetectors/findType') + this.typeList = res.filter(item => item).map(item => ({ label: item, value: item })) + } catch (error) { + console.error(error) + } + }, + + filterOption(input, option) { + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onAdd() { this.isAdd = true this.model = {} @@ -276,6 +260,51 @@ export default { beforeSubmit() { this.model.moddate = moment(this.model.moddate).format('yyyy-MM-DD HH:mm:ss') } + }, + computed: { + formItems() { + return [ + { + label: 'Detector Code', + type: 'a-input', + name: 'detectorCode', + props: { + allowClear: true + }, + style: { + width: '310px' + } + }, + { + label: 'Type', + type: 'custom-select', + name: 'type', + props: { + options: this.typeList, + allowClear: true, + showSearch: true, + filterOption: this.filterOption + }, + style: { + width: '310px' + } + }, + { + label: 'Status', + type: 'j-dict-select-tag', + name: 'status', + props: { + dictCode: 'STATION_STATUS', + getPopupContainer: () => { + return document.body + } + }, + style: { + width: '310px' + } + } + ] + } } } diff --git a/src/views/system/NuclearFacility.vue b/src/views/system/NuclearFacility.vue index a068b22..a2428e3 100644 --- a/src/views/system/NuclearFacility.vue +++ b/src/views/system/NuclearFacility.vue @@ -2,7 +2,7 @@ - + Add @@ -84,47 +84,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import FormMixin from '@/mixins/FormMixin' import { cloneDeep } from 'lodash' - -const formItems = [ - { - label: 'Name', - type: 'a-input', - name: 'facilityName', - style: { - width: '300px' - } - }, - { - label: 'Type', - type: 'a-input', - name: 'type', - style: { - width: '300px' - } - }, - { - label: 'Location', - type: 'a-input', - name: 'location', - style: { - width: '300px' - } - }, - { - label: 'Status', - type: 'j-dict-select-tag', - name: 'status', - props: { - getPopupContainer: () => { - return document.body - }, - dictCode: 'NUCLEARFACILITY_STATUS' - }, - style: { - width: '300px' - } - } -] +import { getAction } from '../../api/manage' const columns = [ { @@ -182,7 +142,6 @@ const columns = [ export default { mixins: [JeecgListMixin, FormMixin], data() { - this.formItems = formItems this.columns = columns return { queryParam: {}, @@ -195,10 +154,38 @@ export default { delete: '/gardsNuclearfacility/deleteById', add: '/gardsNuclearfacility/create', edit: '/gardsNuclearfacility/update' - } + }, + typeList: [], + locationList: [] } }, + created() { + this.getTypeList() + this.getLocationList() + }, methods: { + async getTypeList() { + try { + const res = await getAction('/gardsNuclearfacility/findType') + this.typeList = res.filter(item => item).map(item => ({ label: item, value: item })) + } catch (error) { + console.error(error) + } + }, + + async getLocationList() { + try { + const res = await getAction('/gardsNuclearfacility/findLocation') + this.locationList = res.filter(item => item).map(item => ({ label: item, value: item })) + } catch (error) { + console.error(error) + } + }, + + filterOption(input, option) { + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onAdd() { this.isAdd = true this.model = {} @@ -228,6 +215,65 @@ export default { this.$message.warn('Please Select An Item To Delete') } } + }, + computed: { + formItems() { + return [ + { + label: 'Name', + type: 'a-input', + name: 'facilityName', + props: { + allowClear: true + }, + style: { + width: '300px' + } + }, + { + label: 'Type', + type: 'custom-select', + name: 'type', + props: { + options: this.typeList, + allowClear: true, + showSearch: true, + filterOption: this.filterOption + }, + style: { + width: '300px' + } + }, + { + label: 'Location', + type: 'custom-select', + name: 'location', + props: { + options: this.locationList, + allowClear: true, + showSearch: true, + filterOption: this.filterOption + }, + style: { + width: '300px' + } + }, + { + label: 'Status', + type: 'j-dict-select-tag', + name: 'status', + props: { + getPopupContainer: () => { + return document.body + }, + dictCode: 'NUCLEARFACILITY_STATUS' + }, + style: { + width: '300px' + } + } + ] + } } } diff --git a/src/views/system/stationList.vue b/src/views/system/stationList.vue index b292986..dfc4823 100644 --- a/src/views/system/stationList.vue +++ b/src/views/system/stationList.vue @@ -91,39 +91,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import FormMixin from '@/mixins/FormMixin' import { cloneDeep } from 'lodash' - -const formItems = [ - { - label: 'Country Code', - type: 'a-input', - name: 'countryCode', - style: { - width: '310px' - } - }, - { - label: 'Type', - type: 'a-input', - name: 'type', - style: { - width: '310px' - } - }, - { - label: 'Status', - type: 'j-dict-select-tag', - name: 'status', - props: { - dictCode: 'STATION_STATUS', - getPopupContainer: () => { - return document.body - } - }, - style: { - width: '310px' - } - } -] +import { getAction } from '../../api/manage' const columns = [ { @@ -191,7 +159,6 @@ const columns = [ export default { mixins: [JeecgListMixin, FormMixin], data() { - this.formItems = formItems this.columns = columns const validateStationCode = (_, value, callback) => { if (!value) { @@ -224,10 +191,38 @@ export default { delete: '/gardsStations/deleteById', add: '/gardsStations/create', edit: '/gardsStations/update' - } + }, + countryCodeList: [], + typeList: [] } }, + created() { + this.getTypeList() + this.getCountryCodeList() + }, methods: { + async getTypeList() { + try { + const res = await getAction('/gardsStations/findType') + this.typeList = res.filter(item => item).map(item => ({ label: item, value: item })) + } catch (error) { + console.error(error) + } + }, + + async getCountryCodeList() { + try { + const res = await getAction('/gardsStations/findCountryCode') + this.countryCodeList = res.filter(item => item).map(item => ({ label: item, value: item })) + } catch (error) { + console.error(error) + } + }, + + filterOption(input, option) { + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onAdd() { this.isAdd = true this.model = {} @@ -257,6 +252,54 @@ export default { this.$message.warn('Please Select An Item To Delete') } } + }, + computed: { + formItems() { + return [ + { + label: 'Country Code', + type: 'custom-select', + name: 'countryCode', + props: { + options: this.countryCodeList, + allowClear: true, + showSearch: true, + filterOption: this.filterOption + }, + style: { + width: '310px' + } + }, + { + label: 'Type', + type: 'custom-select', + name: 'type', + props: { + options: this.typeList, + allowClear: true, + showSearch: true, + filterOption: this.filterOption + }, + style: { + width: '310px' + } + }, + { + label: 'Status', + type: 'j-dict-select-tag', + name: 'status', + props: { + dictCode: 'STATION_STATUS', + getPopupContainer: () => { + return document.body + } + }, + style: { + width: '310px' + } + } + ] + } } }