From e0206a228b2039afaa1f92962523448e4c4b2eca Mon Sep 17 00:00:00 2001
From: xuziqiang <1344691446@qq.com>
Date: Fri, 12 Jul 2024 17:17:32 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=86=E7=BB=84=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=86=E7=BB=84=EF=BC=8C=E5=85=AC=E5=BC=8F?=
=?UTF-8?q?=E7=BC=96=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hx-ai-intelligent/src/api/deviceManage.ts | 11 +
.../src/view/equipmentManage/group/config.ts | 199 ++++++------
.../src/view/equipmentManage/group/edit.vue | 28 +-
.../src/view/equipmentManage/group/editCal.vue | 123 ++++++++
.../src/view/equipmentManage/group/editFormula.vue | 157 ++++++----
.../src/view/equipmentManage/group/editGroup.vue | 344 ++++++++++++++-------
.../src/view/equipmentManage/group/index.vue | 26 +-
lib/component/form/form/form-item.vue | 4 +-
lib/saas/theme/global-antd.less | 1 +
9 files changed, 618 insertions(+), 275 deletions(-)
create mode 100644 hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
diff --git a/hx-ai-intelligent/src/api/deviceManage.ts b/hx-ai-intelligent/src/api/deviceManage.ts
index 7ae63d2..878ab00 100644
--- a/hx-ai-intelligent/src/api/deviceManage.ts
+++ b/hx-ai-intelligent/src/api/deviceManage.ts
@@ -15,4 +15,15 @@ export enum group {
queryGroupPage = `${BASE_URL}/deviceGroup/queryGroupPage`, // 分组列表
saveGroupList = `${BASE_URL}/deviceGroup/saveGroupList`, // 分组保存
delGroupList = `${BASE_URL}/deviceGroup/delGroupList`, // 分组删除
+ queryGroupInfoPage = `${BASE_URL}/deviceGroup/queryGroupInfoPage`, // 计算列表
+ queryEditCompute = `${BASE_URL}/deviceGroup/queryEditCompute`, // 计算树
+ saveComputeList = `${BASE_URL}/deviceGroup/saveComputeList`, // 计算保存
+ delComputeList = `${BASE_URL}/deviceGroup/delComputeList`, // 计算删除
+ queryComputeGroup = `${BASE_URL}/deviceGroup/queryComputeGroup`, // 计算分组列表
+ saveComputeGroup = `${BASE_URL}/deviceGroup/saveComputeGroup`, // 计算分组新增
+ saveComputeGroupInfo = `${BASE_URL}/deviceGroup/saveComputeGroupInfo`, // 批量分组
+ delComputeGroup = `${BASE_URL}/deviceGroup/delComputeGroup`, // 分组删除
+ computeGroupNum = `${BASE_URL}/deviceGroup/computeGroupNum`, // 分组删除
+ formula = `${BASE_URL}/deviceGroup/formula`, // 编辑公式
+ queryFormula = `${BASE_URL}/deviceGroup/queryFormula`, // 公式查询
}
diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/config.ts b/hx-ai-intelligent/src/view/equipmentManage/group/config.ts
index 4a51f89..4b9fff1 100644
--- a/hx-ai-intelligent/src/view/equipmentManage/group/config.ts
+++ b/hx-ai-intelligent/src/view/equipmentManage/group/config.ts
@@ -8,29 +8,32 @@ import { origanizemanage } from '/@/api/origanizemanage';
const tableCalKeyMap = [
{
title: '来源企业',
- dataIndex: 'orgName',
- // textEllipsis: true,
- // textNumber: 4,
+ dataIndex: 'linkOrgName',
+ textEllipsis: true,
+ textNumber: 10,
},
{
title: '设备id',
+ textNumber: 10,
dataIndex: 'deviceCode',
+ textEllipsis: true,
},
{
title: '设备编号',
- dataIndex: 'deviceName',
- textNumber: 8,
- textEllipsis: true,
+ dataIndex: 'deviceNum',
},
{
+ textNumber: 10,
title: '分组名称',
- dataIndex: 'position',
+ dataIndex: 'groupName',
},
{
title: '设备品牌/型号',
- dataIndex: 'position',
+ textNumber: 10,
+ dataIndex: 'deviceNameType',
},
{
+ textNumber: 10,
title: '设备状态',
dataIndex: 'position',
},
@@ -146,6 +149,26 @@ export const editTreeConfig = (orgId) => ({
],
},
});
+export const editCalTreeConfig = (orgId) => ({
+ selectedKeys: ['0-0'],
+ defaultExpandAll: true,
+ api: group.queryEditCompute,
+ params: { orgId },
+ resultField: 'data.orgInfos',
+ fieldNames: { title: 'orgName', key: 'orgId' },
+ formConfig: {
+ schemas: [
+ {
+ field: 'orgName',
+ component: 'NsInput',
+ autoSubmit: true,
+ componentProps: {
+ placeholder: '请输入企业名称',
+ },
+ },
+ ],
+ },
+});
export const treeConfig = (orgId) => {
return {
defaultExpandAll: true,
@@ -211,9 +234,11 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
dynamicDisabled: (data: any) => {
return data.list.length === 0;
},
- handle: () => {
- mockData.value.splice(0, 2);
- },
+ dynamicParams: { linkIds: 'linkId[]' },
+ confirm: true,
+ isClearCheck: true,
+ isReload: true,
+ api: group.delGroupList,
},
{
label: '批量导出',
@@ -254,23 +279,6 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
},
},
-
- {
- label: '批量分组',
- name: 'groupBatGroup',
- type: 'primary',
- handle: () => {
- elGroup.value.toggle();
- },
- },
- {
- label: '公式编辑',
- name: 'groupFormulaEdit',
- type: 'primary',
- handle: () => {
- elFormula.value.toggle();
- },
- },
],
columns: tableKeyMap,
columnActions: {
@@ -279,11 +287,11 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
{
label: '删除',
name: 'groupDelete',
- dynamicParams: ['uuid', 'appealType'],
+ dynamicParams: { linkIds: 'linkId[]' },
confirm: true,
- handle: () => {
- mockData.value.splice(0, 1);
- },
+ isClearCheck: true,
+ isReload: true,
+ api: group.delGroupList,
},
],
},
@@ -291,60 +299,17 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
formConfig: {
schemas: [
{
- field: 'name',
- label: '设备名称',
+ field: 'orgName',
component: 'NsInput',
componentProps: {
- placeholder: '请输入',
+ placeholder: '请选择公司',
},
},
{
- field: 'provider',
- label: '设备厂商',
+ field: 'pointNum',
component: 'NsInput',
componentProps: {
- placeholder: '请输入',
- },
- },
- {
- field: 'payWay',
- label: '设备区域',
- component: 'NsSelect',
- componentProps: {
- placeholder: '请选择',
- options: [
- {
- label: '全部',
- value: '',
- },
- ],
- },
- },
- {
- field: 'createTime',
- label: '生产日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
- },
- },
- {
- field: 'createTime1',
- label: '采购日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
- },
- },
- {
- field: 'createTime2',
- label: '启用日期',
- component: 'NsRangePicker',
- fieldMap: ['queryStartDate', 'queryEndDate'],
- componentProps: {
- valueFormat: 'YYYY-MM-DD',
+ placeholder: '请输入节点编号',
},
},
],
@@ -355,13 +320,11 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
};
export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
- // 分组节点
+ // 计算节点
return {
title: '点位信息',
- // api: '/carbon_emission/device/getDeviceList',
- value: mockData.value,
- params: defaultParams,
-
+ api: group.queryGroupInfoPage,
+ params: defaultParams.value,
headerActions: [
{
label: '编辑',
@@ -378,9 +341,11 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
dynamicDisabled: (data: any) => {
return data.list.length === 0;
},
- handle: () => {
- mockData.value.splice(0, 2);
- },
+ dynamicParams: { ids: 'id[]' },
+ confirm: true,
+ isReload: true,
+ isClearCheck: true,
+ api: group.delComputeList,
},
{
label: '批量导出',
@@ -421,7 +386,31 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
},
},
+
+ {
+ label: '批量分组',
+ name: 'groupBatGroup',
+ type: 'primary',
+ dynamicDisabled: (data: any) => {
+ return data.list.length === 0;
+ },
+ handle: ({ list }) => {
+ const ids = list.map(({ id }) => id);
+
+ defaultParams.value['saveDeviceInfoIds'] = ids;
+ elGroup.value.toggle();
+ },
+ },
+ {
+ label: '公式编辑',
+ name: 'groupFormulaEdit',
+ type: 'primary',
+ handle: () => {
+ elFormula.value.toggle();
+ },
+ },
],
+ scroll: { x: 1400 },
columns: tableCalKeyMap,
columnActions: {
title: '操作',
@@ -429,11 +418,11 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
{
label: '删除',
name: 'groupDelete',
- dynamicParams: 'id',
+ dynamicParams: { ids: 'id[]' },
confirm: true,
isReload: true,
isClearCheck: true,
- api: group.delGroupList,
+ api: group.delComputeList,
},
],
},
@@ -442,17 +431,45 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
schemas: [
{
field: 'name',
- label: '设备名称',
+ label: '公司',
component: 'NsInput',
componentProps: {
placeholder: '请选择公司',
},
},
{
+ field: 'deviceCode',
+ component: 'NsInput',
+ componentProps: {
+ placeholder: '请输入设备id',
+ },
+ },
+ {
+ field: 'deviceNum',
+ component: 'NsInput',
+ componentProps: {
+ placeholder: '请输入设备编号',
+ },
+ },
+ {
field: 'provider',
component: 'NsInput',
componentProps: {
- placeholder: '请输入节点编号',
+ placeholder: '请输入设备状态',
+ },
+ },
+ {
+ field: 'deviceNameType',
+ component: 'NsInput',
+ componentProps: {
+ placeholder: '请输入设备型号',
+ },
+ },
+ {
+ field: 'provider',
+ component: 'NsInput',
+ componentProps: {
+ placeholder: '请输入分组名称',
},
},
],
diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/edit.vue b/hx-ai-intelligent/src/view/equipmentManage/group/edit.vue
index d43c189..78cd18b 100644
--- a/hx-ai-intelligent/src/view/equipmentManage/group/edit.vue
+++ b/hx-ai-intelligent/src/view/equipmentManage/group/edit.vue
@@ -14,12 +14,10 @@
v-model:target-keys="targetKeys"
:data-source="dataSource"
style="height: 100%; width: 66%"
- oneWay
:listStyle="listStyle"
show-search
:render="(item) => item.title"
- :filter-option="filterOption"
- @change="handleChange" />
+ :filter-option="filterOption" />
@@ -29,12 +27,13 @@
import { editTreeConfig } from './config';
import { group } from '/@/api/deviceManage';
import { http } from '/nerv-lib/util/http';
+ const emit = defineEmits(['sure']);
const props = defineProps({ params: Object });
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
const config = computed(() => {
return editTreeConfig(result);
});
- const visible = ref(true);
+ const visible = ref(false);
const dataSource = ref([]);
const listStyle = {
height: '100%',
@@ -42,14 +41,19 @@
};
const targetKeys = ref([]);
const currentId = ref('');
+
+ const clearData = () => {
+ dataSource.value = [];
+ targetKeys.value = [];
+ };
const toggle = () => {
visible.value = !visible.value;
+ clearData();
};
- const handleChange = (nextTargetKeys: string[], direction: string, moveKeys: string[]) => {
- console.log('targetKeys: ', nextTargetKeys);
- console.log('direction: ', direction);
- console.log('moveKeys: ', moveKeys);
- };
+
+ onMounted(() => {
+ getData(currentId.value);
+ });
const filterOption = (inputValue: string, option: any) => {
return option?.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
@@ -65,7 +69,9 @@
saveGroupIds: targetKeys.value,
})
.then(() => {
+ emit('sure');
NsMessage.success('操作成功');
+ toggle();
});
};
function treeSelect(
@@ -98,8 +104,8 @@
item['key'] = item.id.toString();
return item;
});
- targetKeys.value = res.data.linkGroups.map((item) => {
- return item.id;
+ targetKeys.value = res.data.linkGroups?.map((item) => {
+ return item.id.toString();
});
});
};
diff --git a/hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue b/hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
new file mode 100644
index 0000000..9301f50
--- /dev/null
+++ b/hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
@@ -0,0 +1,123 @@
+
+