From 31479608c05e08bd3598851a0599b3c5b88e72d6 Mon Sep 17 00:00:00 2001 From: xuziqiang <1344691446@qq.com> Date: Fri, 31 May 2024 09:54:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=83=BD=E8=80=97=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hx-ai-intelligent/src/api/user.ts | 5 +- hx-ai-intelligent/src/router/equipmentManage.ts | 19 ++ .../view/equipmentManage/energyMapping/config.ts | 232 +++++++++++++++++++++ .../equipmentManage/energyMapping/fileDown.vue | 116 +++++++++++ .../view/equipmentManage/energyMapping/index.vue | 28 +++ .../view/equipmentManage/energyMapping/mock.json | 10 + .../src/view/equipmentManage/energyMapping/op.vue | 135 ++++++++++++ lib/component/form/form/props.ts | 2 +- lib/saas/view/service/list-table.vue | 6 +- 9 files changed, 545 insertions(+), 8 deletions(-) create mode 100644 hx-ai-intelligent/src/view/equipmentManage/energyMapping/config.ts create mode 100644 hx-ai-intelligent/src/view/equipmentManage/energyMapping/fileDown.vue create mode 100644 hx-ai-intelligent/src/view/equipmentManage/energyMapping/index.vue create mode 100644 hx-ai-intelligent/src/view/equipmentManage/energyMapping/mock.json create mode 100644 hx-ai-intelligent/src/view/equipmentManage/energyMapping/op.vue diff --git a/hx-ai-intelligent/src/api/user.ts b/hx-ai-intelligent/src/api/user.ts index 8310f7f..4a4edf5 100644 --- a/hx-ai-intelligent/src/api/user.ts +++ b/hx-ai-intelligent/src/api/user.ts @@ -8,13 +8,10 @@ enum Api { USER_INFO = 'api/web/objs/CurrentUser', //获取用户信息 USER_RESOURCE = '/api/community/objs/User/Resource', //获取用户资源 } -export const userLogin = (data: RoomListModel) => http.post(Api.USER_LOGIN, data); +export const userLogin = (data) => http.post(Api.USER_LOGIN, data); export const userInfo = () => http.get(Api.USER_INFO); export const userResource = () => http.get(Api.USER_RESOURCE); /** * @description 用户登录 * @property `[fatherRegionUuid]` 父级区域唯一标识 */ -interface RoomListModel { - data: string; -} diff --git a/hx-ai-intelligent/src/router/equipmentManage.ts b/hx-ai-intelligent/src/router/equipmentManage.ts index cd52e10..8d53251 100644 --- a/hx-ai-intelligent/src/router/equipmentManage.ts +++ b/hx-ai-intelligent/src/router/equipmentManage.ts @@ -43,6 +43,25 @@ const equipment = { }, ], }, + { + path: 'energyMapping', + name: 'EnergyMapping', + meta: { title: '能耗映射', hideChildren: true, icon: 'dicizhishou' }, + component: Base, + redirect: { name: 'EnergyMappingIndex' }, + children: [ + { + path: 'index', + name: 'EnergyMappingIndex', + component: () => import('/@/view/equipmentManage/energyMapping/index.vue'), + meta: { + title: '能耗映射', + keepAlive: true, + backApi: [], + }, + }, + ], + }, ], }; export default equipment; diff --git a/hx-ai-intelligent/src/view/equipmentManage/energyMapping/config.ts b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/config.ts new file mode 100644 index 0000000..9415cf4 --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/config.ts @@ -0,0 +1,232 @@ +import { dateUtil } from '/nerv-lib/util/date-util'; +import data from './mock.json'; +import { cloneDeep } from 'lodash-es'; +import { ref } from 'vue'; +const columns = [ + { + title: '能源种类', + dataIndex: '能源种类', + }, + { + title: '计量单位', + dataIndex: '计量单位', + }, + { + title: '速算系数', + dataIndex: '速算系数', + }, + { + title: '全年', + dataIndex: '全年', + }, + { + title: '1月', + dataIndex: '1月', + }, + { + title: '2月', + dataIndex: '2月', + }, + { + title: '3月', + dataIndex: '3月', + }, + { + title: '4月', + dataIndex: '4月', + }, + { + title: '5月', + dataIndex: '5月', + }, + { + title: '6月', + dataIndex: '6月', + }, + { + title: '7月', + dataIndex: '7月', + }, + { + title: '8月', + dataIndex: '8月', + }, + { + title: '9月', + dataIndex: '9月', + }, + { + title: '10月', + dataIndex: '10月', + }, + { + title: '11月', + dataIndex: '11月', + }, + { + title: '12月', + dataIndex: '12月', + }, +]; +const formConfig = { + schemas: [ + { + field: 'time', + label: '年份', + component: 'NsDatePicker', + componentProps: { + picker: 'year', + valueFormat: 'YYYY-MM-DD', + }, + }, + ], + params: {}, +}; + +const mockData = ref(cloneDeep(data.dataSource)); + +const doWnload = (url) => { + const a = document.createElement('a'); + document.body.appendChild(a); + a.href = encodeURI(url); + //设置下载的文件名 + // a.download = fileName.value; + //触发a标签的点击事件,进行下载 + a.click(); +}; +export const tableConfig1 = (el, fileDownRef) => { + return { + title: '能耗', + value: mockData.value, + rowSelection: null, + columns, + formConfig, + headerActions: [ + { + label: '新增', + name: 'groupEdit', + type: 'primary', + handle: (a, b) => { + el.value.toggle(); + }, + }, + { + label: '导入', + name: 'groupImport', + type: 'primary', + extra: { + // api: props.postImportApi, // 导入接口名 + title: '设备信息', // 弹窗title + templateName: 'whiteListUser', // 所使用的文件名称 + indexName: '设备id', // 匹配类型字段 + message: [ + { label: '1、若必填项未填写,则不能进行导入操作' }, + { label: `2、当重复时,则更新数据。` }, + { label: '3、数据将从模版的第五行进行导入。' }, + { label: '4、文件导入勿超过5MB。' }, + ], + }, + }, + { + label: '导出', + name: 'groupExports', + type: 'primary', + handle: () => { + doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx'); + }, + }, + + { + label: '模板下载', + name: 'groupTemDownload', + type: 'primary', + handle: () => { + // http.get('/asset/file/whiteListUser.xlsx'); + doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx'); + }, + }, + { + label: '上传凭证', + name: 'groupImport', + type: 'primary', + extra: { + // api: props.postImportApi, // 导入接口名 + title: '设备信息', // 弹窗title + templateName: 'whiteListUser', // 所使用的文件名称 + indexName: '设备id', // 匹配类型字段 + message: [ + { label: '1、若必填项未填写,则不能进行导入操作' }, + { label: `2、当重复时,则更新数据。` }, + { label: '3、数据将从模版的第五行进行导入。' }, + { label: '4、文件导入勿超过5MB。' }, + ], + }, + }, + { + label: '凭证下载', + name: 'groupTemDownload', + type: 'primary', + handle: () => { + fileDownRef.value.toggle(); + }, + }, + ], + columnActions: { + title: '操作', + actions: [ + { + label: '编辑', + name: 'edit', + handle: () => { + mockData.value.splice(0, 1); + }, + }, + { + label: '删除', + name: 'FeedBackDetail', + dynamicParams: ['uuid', 'appealType'], + confirm: true, + handle: () => { + mockData.value.splice(0, 1); + }, + }, + ], + }, + }; +}; +export const tableConfig2 = { + title: '碳排', + value: data.dataSource, + rowSelection: null, + columns, + formConfig, + headerActions: [ + { + label: '导出', + name: 'groupTemDownload', + type: 'primary', + handle: () => { + // http.get('/asset/file/whiteListUser.xlsx'); + doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx'); + }, + }, + ], +}; +export const tableConfig3 = { + title: '标煤', + value: data.dataSource, + rowSelection: null, + columns, + formConfig, + headerActions: [ + { + label: '导出', + name: 'groupTemDownload', + type: 'primary', + handle: () => { + // http.get('/asset/file/whiteListUser.xlsx'); + doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx'); + }, + }, + ], +}; diff --git a/hx-ai-intelligent/src/view/equipmentManage/energyMapping/fileDown.vue b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/fileDown.vue new file mode 100644 index 0000000..4a6d69d --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/fileDown.vue @@ -0,0 +1,116 @@ + + + diff --git a/hx-ai-intelligent/src/view/equipmentManage/energyMapping/index.vue b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/index.vue new file mode 100644 index 0000000..05b3ff2 --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/index.vue @@ -0,0 +1,28 @@ + + + diff --git a/hx-ai-intelligent/src/view/equipmentManage/energyMapping/mock.json b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/mock.json new file mode 100644 index 0000000..c90aa5a --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/mock.json @@ -0,0 +1,10 @@ +{ + "dataSource":[ + {"序号": "1", "能源种类": "电力", "计量单位": "tce", "速算系数": "0.5tce/kWh", "全年": "19900", "1月": "10000", "2月": "9900", "3月": "", "4月": "", "5月": "", "6月": "", "7月": "", "8月": "", "9月": "", "10月": "", "11月": "", "12月": ""}, + {"序号": "2", "能源种类": "水", "计量单位": "tce", "速算系数": "0.5tce/t", "全年": "16500", "1月": "8000", "2月": "8500", "3月": "", "4月": "", "5月": "", "6月": "", "7月": "", "8月": "", "9月": "", "10月": "", "11月": "", "12月": ""}, + {"序号": "3", "能源种类": "天然气", "计量单位": "tce", "速算系数": "0.5tce/𝑚3/m3", "全年": "590", "1月": "300", "2月": "290", "3月": "", "4月": "", "5月": "", "6月": "", "7月": "", "8月": "", "9月": "", "10月": "", "11月": "", "12月": ""}, + {"序号": "4", "能源种类": "汽油", "计量单位": "tce", "速算系数": "0.5tce/𝑚3/m3", "全年": "330", "1月": "150", "2月": "180", "3月": "", "4月": "", "5月": "", "6月": "", "7月": "", "8月": "", "9月": "", "10月": "", "11月": "", "12月": ""}, + {"序号": "5", "能源种类": "煤油", "计量单位": "tce", "速算系数": "0.5tce/t", "全年": "43", "1月": "20", "2月": "23", "3月": "", "4月": "", "5月": "", "6月": "", "7月": "", "8月": "", "9月": "", "10月": "", "11月": "", "12月": ""} + ] + +} \ No newline at end of file diff --git a/hx-ai-intelligent/src/view/equipmentManage/energyMapping/op.vue b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/op.vue new file mode 100644 index 0000000..aaf1a43 --- /dev/null +++ b/hx-ai-intelligent/src/view/equipmentManage/energyMapping/op.vue @@ -0,0 +1,135 @@ + + + diff --git a/lib/component/form/form/props.ts b/lib/component/form/form/props.ts index e239a60..84e00ba 100644 --- a/lib/component/form/form/props.ts +++ b/lib/component/form/form/props.ts @@ -12,7 +12,7 @@ export const formProps = { }, model: PropTypes.object.def(() => reactive({})), loading: PropTypes.bool.def(false), - formLayout: PropTypes.string.def('flexVertical'), + formLayout: PropTypes.string.def('flex'), expand: PropTypes.bool.def(true), showExpand: PropTypes.bool.def(false), }; diff --git a/lib/saas/view/service/list-table.vue b/lib/saas/view/service/list-table.vue index 906e467..9eaf302 100644 --- a/lib/saas/view/service/list-table.vue +++ b/lib/saas/view/service/list-table.vue @@ -65,9 +65,9 @@ const getFormConfig = computed(() => { const formConfig = cloneDeep(props.formConfig); - if (formConfig) { - formConfig['formLayout'] = 'flexv2'; - } + // if (formConfig) { + // formConfig['formLayout'] = 'flexv2'; + // } return formConfig; }); const getBindValue = computed(() => ({