Browse Source

feat: 分组管理批量分组,公式编辑

temp
xuziqiang 5 months ago
parent
commit
e0206a228b
  1. 11
      hx-ai-intelligent/src/api/deviceManage.ts
  2. 199
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  3. 28
      hx-ai-intelligent/src/view/equipmentManage/group/edit.vue
  4. 123
      hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
  5. 157
      hx-ai-intelligent/src/view/equipmentManage/group/editFormula.vue
  6. 344
      hx-ai-intelligent/src/view/equipmentManage/group/editGroup.vue
  7. 26
      hx-ai-intelligent/src/view/equipmentManage/group/index.vue
  8. 4
      lib/component/form/form/form-item.vue
  9. 1
      lib/saas/theme/global-antd.less

11
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`, // 公式查询
}

199
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: '请输入分组名称',
},
},
],

28
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" />
</div>
</ns-drawer>
</template>
@ -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();
});
});
};

123
hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue

@ -0,0 +1,123 @@
<template>
<ns-drawer
v-model:visible="visible"
:width="800"
class="custom-class"
title=" "
destroyOnClose
:ok="btnClick"
:cancel="() => (visible = false)"
placement="right">
<div class="drawerContainer">
<ns-tree-api v-bind="config" @select="treeSelect" />
<a-transfer
v-model:target-keys="targetKeys"
:data-source="dataSource"
style="height: 100%; width: 66%"
:listStyle="listStyle"
show-search
:render="(item) => item.title"
:filter-option="filterOption" />
</div>
</ns-drawer>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { editCalTreeConfig } 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 editCalTreeConfig(result);
});
const visible = ref(false);
const dataSource = ref([]);
const listStyle = {
height: '100%',
width: '100%',
};
const targetKeys = ref([]);
const currentId = ref('');
const clearData = () => {
dataSource.value = [];
targetKeys.value = [];
};
const toggle = () => {
visible.value = !visible.value;
clearData();
};
onMounted(() => {
getData(currentId.value);
});
const filterOption = (inputValue: string, option: any) => {
return option?.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
};
const btnClick = () => {
// visible.value = false;
http
.post(group.saveComputeList, {
...props.params,
groupListId: props.params?.id,
saveOrgId: currentId.value,
saveDeviceInfoIds: targetKeys.value,
})
.then(() => {
emit('sure');
NsMessage.success('操作成功');
toggle();
});
};
function treeSelect(
selectedKeys: never[],
e: {
selected: boolean;
selectedNodes: { props: { dataRef: any } }[];
node: any;
event: any;
},
) {
console.log(selectedKeys, e);
const {
dataRef: { title },
} = e.node;
currentId.value = selectedKeys[0];
getData(currentId.value);
}
const getData = (id) => {
http
.post(group.queryEditCompute, {
orgId: result,
queryOrgId: id,
...props.params,
// energyType: props.params.energyType,
})
.then((res) => {
dataSource.value = res.data.deviceInfos?.map((item) => {
item['title'] = item.deviceName;
item['key'] = item.id.toString();
return item;
});
targetKeys.value = res.data.linkGroups?.map((item) => {
return item.id.toString();
});
});
};
defineExpose({
toggle,
});
</script>
<style scoped lang="less">
.drawerContainer {
height: 100%;
display: flex;
justify-content: space-between;
}
</style>

157
hx-ai-intelligent/src/view/equipmentManage/group/editFormula.vue

@ -7,29 +7,67 @@
:cancel="() => (visible = false)"
placement="right">
<ns-form :schemas="schemas" :model="model" formLayout="vertical" />
<div
style="
font-size: 16px;
font-weight: bold;
line-height: 24px;
padding: 16px 0;
padding-top: 0;
">
分组列表
</div>
<NsBasicTable v-model:dataSource="mockDataSource" v-bind="basicTableConfig" />
</ns-drawer>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { group } from '/@/api/deviceManage';
import { http } from '/nerv-lib/util/http';
const emit = defineEmits(['sure']);
const props = defineProps({ params: Object });
const visible = ref(false);
const model = ref({});
const toggle = () => {
visible.value = !visible.value;
visible.value && getTableData();
visible.value && getFormula();
};
const mockDataSource = ref([
{
groupName: '1号厂区',
},
{
groupName: '2号厂区',
},
{
groupName: '3号厂区',
},
]);
const mockDataSource = ref([]);
const getFormula = () => {
http.post(group.queryFormula, props.params).then((res) => {
model.value.formula = res.data;
});
};
const getTableData = () => {
http.post(group.queryComputeGroup, props.params).then((res) => {
mockDataSource.value = res.data;
});
};
const basicTableConfig = ref({
bordered: true,
placeholder: '请输入',
pagination: false,
rowKey: (record) => record.id,
columns: [
{
title: '分组编号',
dataIndex: 'groupNum',
// customRender: ({ index }) => index + 1,
width: 80,
align: 'center',
},
{
title: '分组名称',
dataIndex: 'groupName',
align: 'center',
},
],
});
const schemas = [
{
field: 'basicInfo',
@ -44,7 +82,6 @@
label: '',
field: 'formula',
component: 'NsTextarea',
defaultValue: '(A+B)*2',
formItemProps: {
wrapperCol: { span: 24 },
},
@ -59,52 +96,60 @@
],
},
},
{
field: 'list',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
title: '分组列表',
schemas: [
{
label: '',
field: 'NsBasicTable',
component: 'NsBasicTable',
formItemProps: {
wrapperCol: { span: 24 },
},
componentProps: {
disabled: true,
placeholder: '请输入',
dataSource: mockDataSource.value,
pagination: false,
rowKey: (record) => record.groupName,
columns: [
{
title: '序号',
dataIndex: 'name',
customRender: ({ index }) => index + 1,
width: 80,
align: 'center',
},
{
title: '分组名称',
dataIndex: 'groupName',
align: 'center',
},
],
},
},
],
},
},
// {
// field: 'list',
// label: '',
// displayFormItem: false,
// class: 'ns-form-item-full',
// component: 'NsChildForm',
// componentProps: {
// title: '',
// schemas: [
// {
// label: '',
// field: 'NsBasicTable',
// component: 'NsBasicTable',
// formItemProps: {
// wrapperCol: { span: 24 },
// },
// componentProps: {
// disabled: true,
// placeholder: '',
// dataSource: mockDataSource.value,
// pagination: false,
// rowKey: (record) => record.groupName,
// columns: [
// {
// title: '',
// dataIndex: 'name',
// customRender: ({ index }) => index + 1,
// width: 80,
// align: 'center',
// },
// {
// title: '',
// dataIndex: 'groupName',
// align: 'center',
// },
// ],
// },
// },
// ],
// },
// },
];
const btnClick = () => {
visible.value = false;
NsMessage.success('操作成功');
http
.post(group.formula, {
...props.params,
...model.value,
})
.then(() => {
emit('sure');
toggle();
NsMessage.success('操作成功');
});
};
defineExpose({

344
hx-ai-intelligent/src/view/equipmentManage/group/editGroup.vue

@ -2,136 +2,260 @@
<ns-drawer
v-model:visible="visible"
width="520"
title="分组编辑"
title=" "
:ok="btnClick"
:cancel="() => (visible = false)"
placement="right">
<ns-form :schemas="schemas" :model="model" formLayout="vertical" />
<ns-form
:schemas="schemas(inputDisabled)"
:model="model"
formLayout="vertical"
:wrapperCol="{ span: 20 }"
:labelCol="{ span: 4 }">
<template #addonAfter="data">
<template v-if="data.field === 'groupName'">
<div class="iconOP">
<EditOutlined v-if="inputDisabled" @click="() => (inputDisabled = false)" />
<CheckOutlined v-else @click="op" />
</div>
</template>
</template>
</ns-form>
<div
style="
font-size: 16px;
font-weight: bold;
line-height: 24px;
padding: 16px 0;
padding-top: 0;
">
分组列表
<ns-button style="margin-left: 10px" type="primary" @click="addGroup">新增</ns-button>
</div>
<NsBasicTable
v-model:dataSource="mockDataSource"
v-bind="basicTableConfig"
:rowSelection="{
type: 'radio',
onChange: rowSelectChange,
selectedRowKeys,
}" />
</ns-drawer>
</template>
<script lang="ts" setup>
import { createVNode, onMounted, ref, unref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { DeleteOutlined } from '@ant-design/icons-vue';
import { group } from '/@/api/deviceManage';
import { http } from '/nerv-lib/util/http';
import { EditOutlined, CheckOutlined } from '@ant-design/icons-vue';
import { Popconfirm } from 'ant-design-vue';
const emit = defineEmits(['sure']);
const props = defineProps({ params: Object });
const visible = ref(false);
const model = ref({});
const inputDisabled = ref(true);
const selectedRowKeys = ref([]);
let opType = true; // truefalse
const toggle = () => {
visible.value = !visible.value;
visible.value && getTableData();
};
const deleteRow = (index) => {
console.log(index);
mockDataSource.value.splice(index, 1);
const startCararcter = 65;
const addGroup = () => {
opType = true;
getCode();
const code = startCararcter + mockDataSource.value?.length;
inputDisabled.value = false;
model.value = { groupName: '' };
// if(mockDataSource.value.length)
};
const addRow = () => {
console.log(model);
if (model.value?.groupName) mockDataSource.value.push(unref(model) as any);
const op = () => {
inputDisabled.value = !inputDisabled.value;
add();
};
const mockDataSource = ref([
{
groupName: '1号厂区',
},
{
groupName: '2号厂区',
},
{
groupName: '3号厂区',
},
]);
const schemas = [
{
field: 'basicInfo',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
title: '分组信息',
schemas: [
{
label: '分组编号',
field: 'groupCode',
component: 'NsInput',
defaultValue: 'WDIFHSUNGNDOR',
componentProps: {
disabled: true,
placeholder: '请输入',
},
},
{
label: '分组名称',
field: 'groupName',
component: 'NsInput',
componentProps: {
placeholder: '请输入',
addonAfter: createVNode(
'div',
{ style: { cursor: 'pointer' }, onclick: addRow },
'新增',
),
},
rules: [{ required: true }],
},
],
//
const add = () => {
const finalParams = { ...props.params, ...model.value };
if (opType) {
delete finalParams.id;
}
http.post(group.saveComputeGroup, finalParams).then(() => {
getTableData();
NsMessage.success('操作成功');
});
};
const delGroup = (id) => {
http.post(group.delComputeGroup, { id }).then(() => {
getTableData();
NsMessage.success('操作成功');
});
};
const rowSelectChange = (selected, selectedRows) => {
opType = false;
console.log(selectedRowKeys, selectedRows);
selectedRowKeys.value = selected;
model.value = { ...selectedRows[0] };
};
const mockDataSource = ref([]);
const getTableData = () => {
http.post(group.queryComputeGroup, props.params).then((res) => {
mockDataSource.value = res.data;
});
};
const getCode = () => {
http.post(group.computeGroupNum, props.params).then((res) => {
model.value.groupNum = res.data;
});
};
const basicTableConfig = ref({
bordered: true,
placeholder: '请输入',
pagination: false,
rowKey: (record) => record.id,
columns: [
{
title: '分组编号',
dataIndex: 'groupNum',
// customRender: ({ index }) => index + 1,
width: 80,
align: 'center',
},
{
title: '分组名称',
dataIndex: 'groupName',
align: 'center',
},
},
{
field: 'list',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
title: '分组列表',
schemas: [
{
label: '',
field: 'NsBasicTable',
component: 'NsBasicTable',
formItemProps: {
wrapperCol: { span: 24 },
{
title: '删除',
dataIndex: 'delete',
width: 80,
align: 'center',
customRender: ({ record }) =>
createVNode(
Popconfirm,
{ title: '确定删除吗?', placement: 'leftTop', onConfirm: () => delGroup(record.id) },
() => [
createVNode(DeleteOutlined, {
style: { color: 'red', cursor: 'pointer' },
// onClick: () => delGroup(record.id),
}),
],
),
},
],
});
const schemas = (val) => {
return [
{
field: 'basicInfo',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
title: '分组信息',
schemas: [
{
label: '分组id',
field: 'id',
component: 'NsInput',
show: false,
},
{
label: '分组编号',
field: 'groupNum',
component: 'NsInput',
componentProps: {
disabled: true,
placeholder: '请输入',
},
},
componentProps: {
disabled: true,
placeholder: '请输入',
dataSource: mockDataSource.value,
rowSelection: { type: 'radio' },
pagination: false,
rowKey: (record) => record.groupName,
columns: [
{
title: '序号',
dataIndex: 'name',
customRender: ({ index }) => index + 1,
width: 80,
align: 'center',
},
{
title: '分组名称',
dataIndex: 'groupName',
align: 'center',
},
{
title: '删除',
dataIndex: 'delete',
width: 80,
align: 'center',
customRender: ({ index }) =>
createVNode(DeleteOutlined, {
style: { color: 'red', cursor: 'pointer' },
onClick: () => deleteRow(index),
}),
},
],
{
label: '分组名称',
field: 'groupName',
component: 'NsInput',
componentProps: {
placeholder: '请输入',
disabled: val,
},
rules: [{ required: true }],
},
},
],
],
},
},
},
];
// {
// field: 'list',
// label: '',
// displayFormItem: false,
// class: 'ns-form-item-full',
// component: 'NsChildForm',
// componentProps: {
// title: '',
// schemas: [
// {
// label: '',
// field: 'NsBasicTable',
// component: 'NsBasicTable',
// formItemProps: {
// wrapperCol: { span: 24 },
// },
// componentProps: {
// bordered: true,
// disabled: true,
// placeholder: '',
// dataSource: mockDataSource.value,
// rowSelection: { type: 'radio', onChange: rowSelectChange },
// pagination: false,
// rowKey: (record) => record.groupName,
// columns: [
// {
// title: '',
// dataIndex: 'name',
// customRender: ({ index }) => index + 1,
// width: 80,
// align: 'center',
// },
// {
// title: '',
// dataIndex: 'groupName',
// align: 'center',
// },
// {
// title: '',
// dataIndex: 'delete',
// width: 80,
// align: 'center',
// customRender: ({ index }) =>
// createVNode(DeleteOutlined, {
// style: { color: 'red', cursor: 'pointer' },
// onClick: () => deleteRow(index),
// }),
// },
// ],
// },
// },
// ],
// },
// },
];
};
const btnClick = () => {
visible.value = false;
NsMessage.success('操作成功');
http
.post(group.saveComputeGroupInfo, {
...props.params,
groupListId: selectedRowKeys.value[0],
})
.then(() => {
emit('sure');
toggle();
NsMessage.success('操作成功');
});
};
defineExpose({
@ -144,4 +268,8 @@
display: flex;
justify-content: space-between;
}
.iconOP {
cursor: pointer;
color: @primary-color;
}
</style>

26
hx-ai-intelligent/src/view/equipmentManage/group/index.vue

@ -1,7 +1,9 @@
<template>
<editDrawer ref="editDrawerRef" :params="defaultParams" />
<editGroup ref="editGroupRef" />
<editFormula ref="editFormulaRef" />
<!-- 分组编辑按钮 -->
<editDrawer ref="editDrawerRef" :params="defaultParams" @sure="handleOk" />
<editCalDrawer ref="editDrawerCalRef" :params="defaultParams" @sure="handleOk" />
<editGroup ref="editGroupRef" :params="defaultParams" @sure="handleOk" />
<editFormula ref="editFormulaRef" :params="defaultParams" @sure="handleOk" />
<!-- <ns-modal ref="modalRef" title="新增" v-model:visible="visible">
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="formVertical" />
@ -22,7 +24,6 @@
<template #overlay>
<a-menu>
<template v-for="(item, index) in filterAction(actionList, data)" :key="index">
<!-- 全部节点只需要新增子节点 -->
<a-menu-item @click="item.func(data)">
<span>{{ item.title }}</span>
</a-menu-item>
@ -34,8 +35,8 @@
</template>
</ns-tree-api>
</div>
<ns-view-list-table v-if="defaultType" class="table" v-bind="config" ref="tableRef" />
<ns-view-list-table v-else class="table" v-bind="configCal" ref="tableCalRef" />
<ns-view-list-table v-show="defaultType" class="table" v-bind="config" ref="tableRef" />
<ns-view-list-table v-show="!defaultType" class="table" v-bind="configCal" ref="tableCalRef" />
</div>
</template>
<script lang="ts" setup>
@ -43,6 +44,7 @@
import { tableConfig, treeConfig, tableConfigCal, formSchema } from './config';
import { useParams } from '/nerv-lib/use';
import editDrawer from './edit.vue';
import editCalDrawer from './editCal.vue';
import editGroup from './editGroup.vue';
import editFormula from './editFormula.vue';
import { NsMessage, NsModal } from '/nerv-lib/component';
@ -56,15 +58,16 @@
const tableRef = ref();
const tableCalRef = ref();
const editDrawerRef = ref();
const editDrawerCalRef = ref();
const editGroupRef = ref();
const editFormulaRef = ref();
const treeRef = ref();
const defaultType = ref(true);
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
const defaultParams = ref({ orgId: result, energyType: '用电量', id: 19 });
const defaultParams = ref({ orgId: result, energyType: '用电量', id: '', hxDeviceGroupId: '' });
const config = tableConfig(editDrawerRef, editGroupRef, editFormulaRef, defaultParams);
const configCal = tableConfigCal(editDrawerRef, editGroupRef, editFormulaRef, defaultParams);
const configCal = tableConfigCal(editDrawerCalRef, editGroupRef, editFormulaRef, defaultParams);
const tConfig = treeConfig(result);
const nsModalFormConfig = ref({
api: group.creatOrUpdate,
@ -161,11 +164,18 @@
} = record;
defaultParams.value.energyType = energyType;
defaultParams.value.id = id;
defaultParams.value.hxDeviceGroupId = id;
defaultType.value = pointType === '分组节点';
defaultType.value
? tableRef.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
};
const handleOk = () => {
defaultType.value
? tableRef.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
};
</script>
<style lang="less" scoped>
.groupContainer {

4
lib/component/form/form/form-item.vue

@ -13,7 +13,7 @@
</template>
<component :is="schema.component" v-bind="formProps">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data || {}"></slot>
<slot :name="item" v-bind="data || {}" :field="schema.field"></slot>
</template>
</component>
<!-- <div class="ns-tips">-->
@ -47,6 +47,7 @@
mapKeys,
upperFirst,
get,
cloneDeep,
} from 'lodash-es';
import { isInputType } from '/nerv-lib/component/form/form-util';
import { useParams } from '/nerv-lib/use/use-params';
@ -332,6 +333,7 @@
getFormItemClass,
getSlots,
formLayout,
cloneDeep,
};
},
beforeCreate() {

1
lib/saas/theme/global-antd.less

@ -275,6 +275,7 @@
.ant-empty-description {
color: rgba(0, 0, 0, 0.3);
margin-bottom: 0;
}
// 表头加粗

Loading…
Cancel
Save