From e5cd75c845176379efbb446a86f3790ba78a9cac Mon Sep 17 00:00:00 2001
From: xuziqiang <1344691446@qq.com>
Date: Wed, 3 Jul 2024 17:58:39 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6?=
=?UTF-8?q?=E8=81=94=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hx-ai-intelligent/src/api/deviceManage.ts | 10 +
hx-ai-intelligent/src/config/app.config.ts | 3 +-
hx-ai-intelligent/src/router/organizationManage.ts | 2 +-
.../src/view/equipmentManage/ledger/config.ts | 379 ++++++++++++---------
.../src/view/equipmentManage/ledger/index.vue | 8 +-
lib/component/table/table-header.vue | 4 +-
lib/component/tree/tree-api.vue | 2 +-
lib/saas/view/system/layout/header.vue | 2 +-
8 files changed, 240 insertions(+), 170 deletions(-)
create mode 100644 hx-ai-intelligent/src/api/deviceManage.ts
diff --git a/hx-ai-intelligent/src/api/deviceManage.ts b/hx-ai-intelligent/src/api/deviceManage.ts
new file mode 100644
index 0000000..b044e78
--- /dev/null
+++ b/hx-ai-intelligent/src/api/deviceManage.ts
@@ -0,0 +1,10 @@
+const BASE_URL = '/carbon-smart';
+export enum device {
+ queryDeviceTree = `${BASE_URL}/deviceInfo/queryDeviceTree`,
+ queryDevicePage = `${BASE_URL}/deviceInfo/queryDevicePage`,
+ dropArea = `${BASE_URL}/deviceInfo/dropArea`,
+}
+
+export enum group {
+ queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`,
+}
diff --git a/hx-ai-intelligent/src/config/app.config.ts b/hx-ai-intelligent/src/config/app.config.ts
index 91d483e..5215705 100644
--- a/hx-ai-intelligent/src/config/app.config.ts
+++ b/hx-ai-intelligent/src/config/app.config.ts
@@ -19,7 +19,7 @@ export const appConfig = {
projectType: 'web',
baseApi: '/api',
projectName: '济阳站_AI智能BAS系统',
- enablePermissions: true,
+ enablePermissions: false,
// themeColor: '#eee',
siderPosition: 'left',
baseHeader: '/parkingManage',
@@ -92,6 +92,7 @@ export const appConfig = {
permissionVos: 'permissionVos',
});
sessionStorage.setItem('ORGID', info.orgId);
+ selectDefaultValue.value = info.orgId;
return { data: { ...trD } };
});
},
diff --git a/hx-ai-intelligent/src/router/organizationManage.ts b/hx-ai-intelligent/src/router/organizationManage.ts
index 56f25a9..eb97190 100644
--- a/hx-ai-intelligent/src/router/organizationManage.ts
+++ b/hx-ai-intelligent/src/router/organizationManage.ts
@@ -10,7 +10,7 @@ const organizationManage = {
name: 'UserManage',
meta: { title: '用户管理', hideChildren: true, icon: 'zuzhiguanli' },
component: Base,
- redirect: { name: 'userManageIndex' },
+ redirect: { name: 'UserManageIndex' },
children: [
{
path: 'index',
diff --git a/hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts b/hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts
index 2e0c824..44f60b0 100644
--- a/hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts
+++ b/hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts
@@ -1,180 +1,233 @@
import { dateUtil } from '/nerv-lib/util/date-util';
-import data from './mock.json';
-export const tableConfig = {
- title: '设备台账',
- // api: '/carbon_emission/device/getDeviceList',
- value: data.dataSource,
- treeConfig: {
- header: {
- icon: 'orgLink',
- title: '设备类别',
- },
- defaultExpandAll: true,
- api: () => {
- return new Promise((resolve) => {
- setTimeout(() => {
- resolve(data);
- }, 100);
- });
+import { device } from '/@/api/deviceManage';
+import { ref } from 'vue';
+import { http } from '/nerv-lib/util';
+
+export const tableConfig = (orgId) => {
+ return ref({
+ title: '设备信息',
+ api: device.queryDevicePage,
+ params: { orgId },
+ treeConfig: {
+ header: {
+ icon: 'orgLink',
+ title: '设备类别',
+ },
+ params: { orgId },
+ dynamicParams: 'code',
+ defaultExpandAll: true,
+ api: device.queryDeviceTree,
+ fieldNames: { title: 'deviceType', key: 'code' },
+ formConfig: {
+ schemas: [
+ {
+ field: 'deviceType',
+ label: '设备名称',
+ component: 'NsInput',
+ autoSubmit: true,
+ componentProps: {
+ placeholder: '请输入设备类型',
+ },
+ },
+ ],
+ },
},
+ rowSelection: null,
+ columns: [
+ {
+ title: '设备名称',
+ dataIndex: 'deviceName',
+ },
+ {
+ title: '设备型号',
+ dataIndex: 'deviceModel',
+ },
+ {
+ title: 'SN码',
+ dataIndex: 'snCode',
+ textNumber: 5,
+ textEllipsis: true,
+ },
+ {
+ title: '设备一级区域',
+ dataIndex: 'device1Area',
+ textNumber: 5,
+ textEllipsis: true,
+ },
+ {
+ title: '设备二级区域',
+ dataIndex: 'device2Area',
+ textNumber: 5,
+ textEllipsis: true,
+ },
+ {
+ title: '设备详细位置',
+ dataIndex: 'deviceAddress',
+ textNumber: 5,
+ textEllipsis: true,
+ },
+ {
+ title: '设备规格',
+ dataIndex: 'deviceTp',
+ },
+ {
+ title: '设备厂商纳税人识别号',
+ dataIndex: 'deviceRatepay',
+ },
+ {
+ title: '设备厂商',
+ dataIndex: 'manufacturer',
+ },
+ {
+ title: '厂商联系人',
+ dataIndex: 'contactPerson',
+ },
+ {
+ title: '设备描述',
+ dataIndex: 'deviceDesc',
+ textNumber: 5,
+ textEllipsis: true,
+ },
+ {
+ title: 'IP地址',
+ dataIndex: 'ipAddress',
+ },
+ {
+ title: '生产日期',
+ dataIndex: 'manufactureDate',
+ },
+ {
+ title: '采购日期',
+ dataIndex: 'purchaseDate',
+ },
+ {
+ title: '启用日期',
+ dataIndex: 'startDate',
+ },
+ {
+ title: '设备成本(元)',
+ dataIndex: 'equipmentCost',
+ textNumber: 6,
+ },
+ {
+ title: '使用期限',
+ dataIndex: 'usagePeriod',
+ textNumber: 4,
+ customRender: ({ value }) => `${value}年`,
+ },
+ {
+ title: '额定功率',
+ dataIndex: 'ratedPower',
+ textNumber: 5,
+ // customRender: ({ value }) => `${value}年`,
+ },
+ {
+ title: '特殊参数',
+ textNumber: 5,
+ dataIndex: 'specialParameters',
+ },
+ ],
+
formConfig: {
schemas: [
{
- field: 'name',
+ field: 'deviceName',
label: '设备名称',
component: 'NsInput',
- autoSubmit: true,
componentProps: {
- placeholder: '请输入',
+ placeholder: '请输入设备名称',
},
},
- ],
- },
- },
- params: {
- page: 0,
- pageSize: 10,
- },
- rowSelection: null,
- columns: [
- {
- title: '设备名称',
- dataIndex: 'id',
- },
- {
- title: '设备型号',
- dataIndex: 'deviceCode',
- },
- {
- title: 'SN码',
- dataIndex: 'deviceName',
- textNumber: 8,
- textEllipsis: true,
- },
- {
- title: '设备一级区域',
- dataIndex: 'position',
- },
- {
- title: '设备二级区域',
- dataIndex: 'position',
- },
- {
- title: '设备详细位置',
- dataIndex: 'position',
- },
- {
- title: '设备规格',
- dataIndex: 'position',
- },
- {
- title: '设备厂商纳税人识别号',
- dataIndex: 'position',
- },
- {
- title: '厂商联系人',
- dataIndex: 'position',
- },
- {
- title: '设备描述',
- dataIndex: 'position',
- },
- {
- title: 'IP地址',
- dataIndex: 'position',
- },
- {
- title: '生产日期',
- dataIndex: 'position',
- },
- {
- title: '采购日期',
- dataIndex: 'position',
- },
- {
- title: '启用日期',
- dataIndex: 'position',
- },
- {
- title: '设备成本(元)',
- dataIndex: 'position',
- },
- {
- title: '使用期限',
- dataIndex: 'position',
- },
- {
- title: '额定功率',
- dataIndex: 'position',
- },
- {
- title: '特殊参数',
- dataIndex: 'position',
- },
- ],
+ {
+ field: 'areas',
+ label: '设备区域',
+ component: 'NsCascader',
+ format: (record) => {
+ console.log(record);
- formConfig: {
- schemas: [
- {
- field: 'name',
- label: '设备名称',
- component: 'NsInput',
- componentProps: {
- placeholder: '请输入',
- },
- },
- {
- field: 'provider',
- label: '设备厂商',
- component: 'NsInput',
- componentProps: {
- placeholder: '请输入',
- },
- },
- {
- field: 'payWay',
- label: '设备区域',
- component: 'NsSelect',
- componentProps: {
- placeholder: '请选择',
- options: [
- {
- label: '全部',
- value: '',
+ return record?.reduce(
+ (pre, cur) => {
+ const len = cur?.length - 1;
+ pre[len].push(cur[len]);
+ return pre;
+ },
+ [[], []],
+ );
+ },
+ fieldMap: ['area1', 'area2'],
+ componentProps: {
+ placeholder: '请选择设备区域',
+ multiple: true,
+ loadData: (selectedOptions, options) => {
+ const targetOption = selectedOptions[selectedOptions.length - 1];
+ if (!selectedOptions.length) {
+ http.post(device.dropArea, { orgId }).then((res) => {
+ options.value = res.data?.map((item) => {
+ return { label: item, value: item, children: [], isLeaf: false };
+ });
+ });
+ }
+ const value = targetOption?.value;
+ if (targetOption) {
+ targetOption.loading = true;
+ http.post(device.dropArea, { device1Area: value, orgId }).then((res) => {
+ targetOption.loading = false;
+ targetOption.children = res.data?.map((item) => {
+ return { label: item, value: item, children: [], isLeaf: true };
+ });
+ });
+ }
},
- ],
+ },
},
- },
- {
- field: 'createTime',
- label: '生产日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
+ {
+ field: 'manufacturer',
+ label: '设备厂商',
+ component: 'NsInput',
+ componentProps: {
+ placeholder: '请输入设备厂商',
+ options: [
+ {
+ label: '全部',
+ value: '',
+ },
+ ],
+ },
},
- },
- {
- field: 'createTime1',
- label: '采购日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
+ {
+ field: 'createTime',
+ label: '生产日期',
+ component: 'NsRangePicker',
+ fieldMap: ['manufactureBeginDate', 'manufactureEndDate'],
+ componentProps: {
+ valueFormat: 'YYYY-MM-DD',
+ placeholder: ['设备生产开始日期', '设备生产结束日期'],
+ },
},
- },
- {
- field: 'createTime2',
- label: '启用日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
+ {
+ field: 'createTime1',
+ label: '采购日期',
+ component: 'NsRangePicker',
+ fieldMap: ['purchaseBeginDate', 'purchaseEndDate'],
+ componentProps: {
+ valueFormat: 'YYYY-MM-DD',
+ placeholder: ['设备采购开始日期', '设备采购结束日期'],
+ },
},
- },
- ],
- params: {},
- },
- // pagination: { pageSizeOptions: false },
- rowKey: 'uuid',
+ {
+ field: 'createTime2',
+ label: '启用日期',
+ component: 'NsRangePicker',
+ fieldMap: ['startBeginDate', 'startEndDate'],
+ componentProps: {
+ valueFormat: 'YYYY-MM-DD',
+ placeholder: ['设备启用开始日期', '设备启用结束日期'],
+ },
+ },
+ ],
+ params: {},
+ },
+ // pagination: { pageSizeOptions: false },
+ rowKey: 'uuid',
+ });
};
diff --git a/hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue b/hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue
index df5a00e..4a35850 100644
--- a/hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue
+++ b/hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue
@@ -1,8 +1,14 @@
-
+