diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/directive/resize/resize.js b/src/directive/resize/resize.js index 1dd8507..eaaf0dd 100644 --- a/src/directive/resize/resize.js +++ b/src/directive/resize/resize.js @@ -8,7 +8,6 @@ function documentHandler() { const bodyHeight = window.innerHeight const bodyWidth = window.innerWidth - console.log('window resize:', bodyHeight, bodyWidth) callback(bodyHeight, bodyWidth) } el.__vueWindowResize__ = documentHandler diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/directive/resize/resize.js b/src/directive/resize/resize.js index 1dd8507..eaaf0dd 100644 --- a/src/directive/resize/resize.js +++ b/src/directive/resize/resize.js @@ -8,7 +8,6 @@ function documentHandler() { const bodyHeight = window.innerHeight const bodyWidth = window.innerWidth - console.log('window resize:', bodyHeight, bodyWidth) callback(bodyHeight, bodyWidth) } el.__vueWindowResize__ = documentHandler diff --git a/src/store/getters.js b/src/store/getters.js index b6442ae..168bba2 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -40,6 +40,8 @@ websocket: state => state.websocket.websocket, // websocket对象 wsStatus: state => state.websocket.wsStatus, // websocket连接状态 needRefresh: state => state.websocket.needRefresh, // 是否需要刷新 - sexList: state => state.dict.sexList // 性别列表 + sexList: state => state.dict.sexList, // 性别列表 + allDeptList: state => state.dict.allDeptList, // 部门列表 + companyList: state => state.dict.companyList // 公司列表 } export default getters diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/directive/resize/resize.js b/src/directive/resize/resize.js index 1dd8507..eaaf0dd 100644 --- a/src/directive/resize/resize.js +++ b/src/directive/resize/resize.js @@ -8,7 +8,6 @@ function documentHandler() { const bodyHeight = window.innerHeight const bodyWidth = window.innerWidth - console.log('window resize:', bodyHeight, bodyWidth) callback(bodyHeight, bodyWidth) } el.__vueWindowResize__ = documentHandler diff --git a/src/store/getters.js b/src/store/getters.js index b6442ae..168bba2 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -40,6 +40,8 @@ websocket: state => state.websocket.websocket, // websocket对象 wsStatus: state => state.websocket.wsStatus, // websocket连接状态 needRefresh: state => state.websocket.needRefresh, // 是否需要刷新 - sexList: state => state.dict.sexList // 性别列表 + sexList: state => state.dict.sexList, // 性别列表 + allDeptList: state => state.dict.allDeptList, // 部门列表 + companyList: state => state.dict.companyList // 公司列表 } export default getters diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index 8f5de49..18a427b 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -1,11 +1,27 @@ +/** + * 字典store + */ const state = { - sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }] + sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }], // 性别列表 + allDeptList: [], // 全部部门列表 + companyList: [] // 公司列表 } const mutations = { + CHANGE_DICT: (state, { key, value }) => { + if (Object.prototype.hasOwnProperty.call(state, 'key')) { + state[key] = value + } + } } const actions = { + changeDict({ commit }, data) { + return new Promise((resolve, reject) => { + commit('CHANGE_DICT', data) + resolve(data) + }) + } } export default { diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/directive/resize/resize.js b/src/directive/resize/resize.js index 1dd8507..eaaf0dd 100644 --- a/src/directive/resize/resize.js +++ b/src/directive/resize/resize.js @@ -8,7 +8,6 @@ function documentHandler() { const bodyHeight = window.innerHeight const bodyWidth = window.innerWidth - console.log('window resize:', bodyHeight, bodyWidth) callback(bodyHeight, bodyWidth) } el.__vueWindowResize__ = documentHandler diff --git a/src/store/getters.js b/src/store/getters.js index b6442ae..168bba2 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -40,6 +40,8 @@ websocket: state => state.websocket.websocket, // websocket对象 wsStatus: state => state.websocket.wsStatus, // websocket连接状态 needRefresh: state => state.websocket.needRefresh, // 是否需要刷新 - sexList: state => state.dict.sexList // 性别列表 + sexList: state => state.dict.sexList, // 性别列表 + allDeptList: state => state.dict.allDeptList, // 部门列表 + companyList: state => state.dict.companyList // 公司列表 } export default getters diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index 8f5de49..18a427b 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -1,11 +1,27 @@ +/** + * 字典store + */ const state = { - sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }] + sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }], // 性别列表 + allDeptList: [], // 全部部门列表 + companyList: [] // 公司列表 } const mutations = { + CHANGE_DICT: (state, { key, value }) => { + if (Object.prototype.hasOwnProperty.call(state, 'key')) { + state[key] = value + } + } } const actions = { + changeDict({ commit }, data) { + return new Promise((resolve, reject) => { + commit('CHANGE_DICT', data) + resolve(data) + }) + } } export default { diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 17cfdb9..ece1818 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -30,12 +30,6 @@ return date.Format(fmt) } -export function getSearchLastWeekTime() { // 默认7天内 - const startTime = getLastWeek().Format('yyyy-MM-dd hh:mm:ss') - const endTime = getToday().Format('yyyy-MM-dd hh:mm:ss') - return [startTime, endTime] -} - // 对Date的扩展,将 Date 转化为指定格式的String // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) @@ -60,3 +54,13 @@ return fmt } +/** + * 获取上周日志范围 + * @returns {*[]} + */ +export function getSearchLastWeekTime() { // 默认7天内 + const startTime = getLastWeek().Format('yyyy-MM-dd hh:mm:ss') + const endTime = getToday('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} + diff --git a/src/api/data/data.js b/src/api/data/data.js index f6a6c14..d6b8f55 100644 --- a/src/api/data/data.js +++ b/src/api/data/data.js @@ -201,3 +201,42 @@ }) } +// 可燃气体外协数据查询 +export function getGasdectorData(params) { + return request({ + url: '/gasdector/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportGasdectorData(params) { + return request({ + url: '/gasdector/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 可燃气体外协数据查询 +export function getPantiltData(params) { + return request({ + url: '/pantilt/listpage', + method: 'get', + params + }) +} + +// 可燃气体外协批量导出燃气数据 +export function batchExportPantiltData(params) { + return request({ + url: '/pantilt/export', + method: 'get', + timeout: 120000, // 120s,2分钟 + params, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} diff --git a/src/components/DeptSelect/index.vue b/src/components/DeptSelect/index.vue index 9fbc62f..f24249e 100644 --- a/src/components/DeptSelect/index.vue +++ b/src/components/DeptSelect/index.vue @@ -16,6 +16,7 @@ import { judgeTree, toTreeList } from '@/utils/structure' import SelectTree from '@/components/SelectTree/singleSelect' import { getDeptTreeList } from '@/api/system/dept' +import { getConfig } from '@/api/login' export default { name: 'DeptSelect', components: { @@ -83,37 +84,55 @@ }, methods: { // 加载父组织树形下拉菜单 - fetchPcode: function() { - let listQuery = {} - if (this.deptType !== '') { - listQuery = { - deptType: this.deptType + fetchPcode() { + // 如果未指定部门类型 + if (!this.deptType) { + if (this.$store.getters.allDeptList.length === 0) { + getDeptTreeList().then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'allDeptList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.allDeptList) + } + } else { + if (this.$store.getters.companyList.length === 0) { + getDeptTreeList({ deptType: this.deptType }).then(response => { + const list = response.data + this.$store.dispatch('dict/changeDict', { key: 'companyList', value: list }).then(() => { + this.refreshList(list) + }) + }) + } else { + this.refreshList(this.$store.getters.companyList) } } - getDeptTreeList(listQuery).then(response => { - const list = response.data - this.originList = [...response.data] - // 如果deptShow 为false 并且 列表的长度小于1 不显示 - if (!this.deptShow && list.length <= 1) { - this.showDeptSelect = false - } else { - // 如果有数据 - if (list) { - // 如果有必要转树,使用selectTree控件 - if (judgeTree(list)) { - this.multiData = true - this.deptTreeList = toTreeList(response.data, '0', this.needTop) - // 如果不需要顶级,将顶级去掉 - if (!this.needTop && this.deptTreeList.length === 1) { - this.deptTreeList = this.deptTreeList[0].children - } - } else { // 否则不需要转树,直接使用el-select控件 - this.deptTreeList = list - this.multiData = false + }, + // 刷新列表 + refreshList(list) { + this.originList = [...list] + // 如果deptShow 为false 并且 列表的长度小于1 不显示 + if (!this.deptShow && list.length <= 1) { + this.showDeptSelect = false + } else { + // 如果有数据 + if (list) { + // 如果有必要转树,使用selectTree控件 + if (judgeTree(list)) { + this.multiData = true + this.deptTreeList = toTreeList(list, '0', this.needTop) + // 如果不需要顶级,将顶级去掉 + if (!this.needTop && this.deptTreeList.length === 1) { + this.deptTreeList = this.deptTreeList[0].children } + } else { // 否则不需要转树,直接使用el-select控件 + this.deptTreeList = list + this.multiData = false } } - }) + } }, // 获取列表 fetchDeptTree() { diff --git a/src/directive/resize/resize.js b/src/directive/resize/resize.js index 1dd8507..eaaf0dd 100644 --- a/src/directive/resize/resize.js +++ b/src/directive/resize/resize.js @@ -8,7 +8,6 @@ function documentHandler() { const bodyHeight = window.innerHeight const bodyWidth = window.innerWidth - console.log('window resize:', bodyHeight, bodyWidth) callback(bodyHeight, bodyWidth) } el.__vueWindowResize__ = documentHandler diff --git a/src/store/getters.js b/src/store/getters.js index b6442ae..168bba2 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -40,6 +40,8 @@ websocket: state => state.websocket.websocket, // websocket对象 wsStatus: state => state.websocket.wsStatus, // websocket连接状态 needRefresh: state => state.websocket.needRefresh, // 是否需要刷新 - sexList: state => state.dict.sexList // 性别列表 + sexList: state => state.dict.sexList, // 性别列表 + allDeptList: state => state.dict.allDeptList, // 部门列表 + companyList: state => state.dict.companyList // 公司列表 } export default getters diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index 8f5de49..18a427b 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -1,11 +1,27 @@ +/** + * 字典store + */ const state = { - sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }] + sexList: [{ label: '男', value: '0' }, { label: '女', value: '1' }], // 性别列表 + allDeptList: [], // 全部部门列表 + companyList: [] // 公司列表 } const mutations = { + CHANGE_DICT: (state, { key, value }) => { + if (Object.prototype.hasOwnProperty.call(state, 'key')) { + state[key] = value + } + } } const actions = { + changeDict({ commit }, data) { + return new Promise((resolve, reject) => { + commit('CHANGE_DICT', data) + resolve(data) + }) + } } export default { diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index 17cfdb9..ece1818 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -30,12 +30,6 @@ return date.Format(fmt) } -export function getSearchLastWeekTime() { // 默认7天内 - const startTime = getLastWeek().Format('yyyy-MM-dd hh:mm:ss') - const endTime = getToday().Format('yyyy-MM-dd hh:mm:ss') - return [startTime, endTime] -} - // 对Date的扩展,将 Date 转化为指定格式的String // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) @@ -60,3 +54,13 @@ return fmt } +/** + * 获取上周日志范围 + * @returns {*[]} + */ +export function getSearchLastWeekTime() { // 默认7天内 + const startTime = getLastWeek().Format('yyyy-MM-dd hh:mm:ss') + const endTime = getToday('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} + diff --git a/src/views/dataManage/dataManage.vue b/src/views/dataManage/dataManage.vue index 5eb6ca7..4971eff 100644 --- a/src/views/dataManage/dataManage.vue +++ b/src/views/dataManage/dataManage.vue @@ -1,35 +1,8 @@