feat: 分组管理批量分组,公式编辑
This commit is contained in:
@@ -15,4 +15,15 @@ export enum group {
|
|||||||
queryGroupPage = `${BASE_URL}/deviceGroup/queryGroupPage`, // 分组列表
|
queryGroupPage = `${BASE_URL}/deviceGroup/queryGroupPage`, // 分组列表
|
||||||
saveGroupList = `${BASE_URL}/deviceGroup/saveGroupList`, // 分组保存
|
saveGroupList = `${BASE_URL}/deviceGroup/saveGroupList`, // 分组保存
|
||||||
delGroupList = `${BASE_URL}/deviceGroup/delGroupList`, // 分组删除
|
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`, // 公式查询
|
||||||
}
|
}
|
||||||
|
@@ -8,29 +8,32 @@ import { origanizemanage } from '/@/api/origanizemanage';
|
|||||||
const tableCalKeyMap = [
|
const tableCalKeyMap = [
|
||||||
{
|
{
|
||||||
title: '来源企业',
|
title: '来源企业',
|
||||||
dataIndex: 'orgName',
|
dataIndex: 'linkOrgName',
|
||||||
// textEllipsis: true,
|
textEllipsis: true,
|
||||||
// textNumber: 4,
|
textNumber: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备id',
|
title: '设备id',
|
||||||
|
textNumber: 10,
|
||||||
dataIndex: 'deviceCode',
|
dataIndex: 'deviceCode',
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '设备编号',
|
|
||||||
dataIndex: 'deviceName',
|
|
||||||
textNumber: 8,
|
|
||||||
textEllipsis: true,
|
textEllipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
title: '设备编号',
|
||||||
|
dataIndex: 'deviceNum',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
textNumber: 10,
|
||||||
title: '分组名称',
|
title: '分组名称',
|
||||||
dataIndex: 'position',
|
dataIndex: 'groupName',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备品牌/型号',
|
title: '设备品牌/型号',
|
||||||
dataIndex: 'position',
|
textNumber: 10,
|
||||||
|
dataIndex: 'deviceNameType',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
textNumber: 10,
|
||||||
title: '设备状态',
|
title: '设备状态',
|
||||||
dataIndex: 'position',
|
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) => {
|
export const treeConfig = (orgId) => {
|
||||||
return {
|
return {
|
||||||
defaultExpandAll: true,
|
defaultExpandAll: true,
|
||||||
@@ -211,9 +234,118 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
|
|||||||
dynamicDisabled: (data: any) => {
|
dynamicDisabled: (data: any) => {
|
||||||
return data.list.length === 0;
|
return data.list.length === 0;
|
||||||
},
|
},
|
||||||
handle: () => {
|
dynamicParams: { linkIds: 'linkId[]' },
|
||||||
mockData.value.splice(0, 2);
|
confirm: true,
|
||||||
|
isClearCheck: true,
|
||||||
|
isReload: true,
|
||||||
|
api: group.delGroupList,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '批量导出',
|
||||||
|
name: 'groupExports',
|
||||||
|
type: 'primary',
|
||||||
|
dynamicDisabled: (data: any) => {
|
||||||
|
return data.list.length === 0;
|
||||||
|
},
|
||||||
|
extra: {
|
||||||
|
xlsxMap: tableKeyMap,
|
||||||
|
xlsxName: '分组信息YYYY-MM-DD',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: () => {
|
||||||
|
// http.get('/asset/file/whiteListUser.xlsx');
|
||||||
|
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columns: tableKeyMap,
|
||||||
|
columnActions: {
|
||||||
|
title: '操作',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
name: 'groupDelete',
|
||||||
|
dynamicParams: { linkIds: 'linkId[]' },
|
||||||
|
confirm: true,
|
||||||
|
isClearCheck: true,
|
||||||
|
isReload: true,
|
||||||
|
api: group.delGroupList,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
formConfig: {
|
||||||
|
schemas: [
|
||||||
|
{
|
||||||
|
field: 'orgName',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择公司',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'pointNum',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入节点编号',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// pagination: { pageSizeOptions: false },
|
||||||
|
rowKey: 'id',
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
|
||||||
|
// 计算节点
|
||||||
|
return {
|
||||||
|
title: '点位信息',
|
||||||
|
api: group.queryGroupInfoPage,
|
||||||
|
params: defaultParams.value,
|
||||||
|
headerActions: [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
name: 'groupEdit',
|
||||||
|
type: 'primary',
|
||||||
|
handle: (a, b) => {
|
||||||
|
el.value.toggle();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '批量删除',
|
||||||
|
name: 'groupTemDownload',
|
||||||
|
type: 'primary',
|
||||||
|
dynamicDisabled: (data: any) => {
|
||||||
|
return data.list.length === 0;
|
||||||
|
},
|
||||||
|
dynamicParams: { ids: 'id[]' },
|
||||||
|
confirm: true,
|
||||||
|
isReload: true,
|
||||||
|
isClearCheck: true,
|
||||||
|
api: group.delComputeList,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '批量导出',
|
label: '批量导出',
|
||||||
@@ -259,7 +391,13 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
|
|||||||
label: '批量分组',
|
label: '批量分组',
|
||||||
name: 'groupBatGroup',
|
name: 'groupBatGroup',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handle: () => {
|
dynamicDisabled: (data: any) => {
|
||||||
|
return data.list.length === 0;
|
||||||
|
},
|
||||||
|
handle: ({ list }) => {
|
||||||
|
const ids = list.map(({ id }) => id);
|
||||||
|
|
||||||
|
defaultParams.value['saveDeviceInfoIds'] = ids;
|
||||||
elGroup.value.toggle();
|
elGroup.value.toggle();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -272,156 +410,7 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
columns: tableKeyMap,
|
scroll: { x: 1400 },
|
||||||
columnActions: {
|
|
||||||
title: '操作',
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
name: 'groupDelete',
|
|
||||||
dynamicParams: ['uuid', 'appealType'],
|
|
||||||
confirm: true,
|
|
||||||
handle: () => {
|
|
||||||
mockData.value.splice(0, 1);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
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: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
// pagination: { pageSizeOptions: false },
|
|
||||||
rowKey: 'id',
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
|
|
||||||
// 分组节点
|
|
||||||
return {
|
|
||||||
title: '点位信息',
|
|
||||||
// api: '/carbon_emission/device/getDeviceList',
|
|
||||||
value: mockData.value,
|
|
||||||
params: defaultParams,
|
|
||||||
|
|
||||||
headerActions: [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
name: 'groupEdit',
|
|
||||||
type: 'primary',
|
|
||||||
handle: (a, b) => {
|
|
||||||
el.value.toggle();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '批量删除',
|
|
||||||
name: 'groupTemDownload',
|
|
||||||
type: 'primary',
|
|
||||||
dynamicDisabled: (data: any) => {
|
|
||||||
return data.list.length === 0;
|
|
||||||
},
|
|
||||||
handle: () => {
|
|
||||||
mockData.value.splice(0, 2);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '批量导出',
|
|
||||||
name: 'groupExports',
|
|
||||||
type: 'primary',
|
|
||||||
dynamicDisabled: (data: any) => {
|
|
||||||
return data.list.length === 0;
|
|
||||||
},
|
|
||||||
extra: {
|
|
||||||
xlsxMap: tableKeyMap,
|
|
||||||
xlsxName: '分组信息YYYY-MM-DD',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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: () => {
|
|
||||||
// http.get('/asset/file/whiteListUser.xlsx');
|
|
||||||
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
columns: tableCalKeyMap,
|
columns: tableCalKeyMap,
|
||||||
columnActions: {
|
columnActions: {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@@ -429,11 +418,11 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
|
|||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
name: 'groupDelete',
|
name: 'groupDelete',
|
||||||
dynamicParams: 'id',
|
dynamicParams: { ids: 'id[]' },
|
||||||
confirm: true,
|
confirm: true,
|
||||||
isReload: true,
|
isReload: true,
|
||||||
isClearCheck: true,
|
isClearCheck: true,
|
||||||
api: group.delGroupList,
|
api: group.delComputeList,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -442,17 +431,45 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
|
|||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
label: '设备名称',
|
label: '公司',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择公司',
|
placeholder: '请选择公司',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'deviceCode',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入设备id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'deviceNum',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入设备编号',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'provider',
|
field: 'provider',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入节点编号',
|
placeholder: '请输入设备状态',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'deviceNameType',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入设备型号',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'provider',
|
||||||
|
component: 'NsInput',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入分组名称',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -14,12 +14,10 @@
|
|||||||
v-model:target-keys="targetKeys"
|
v-model:target-keys="targetKeys"
|
||||||
:data-source="dataSource"
|
:data-source="dataSource"
|
||||||
style="height: 100%; width: 66%"
|
style="height: 100%; width: 66%"
|
||||||
oneWay
|
|
||||||
:listStyle="listStyle"
|
:listStyle="listStyle"
|
||||||
show-search
|
show-search
|
||||||
:render="(item) => item.title"
|
:render="(item) => item.title"
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption" />
|
||||||
@change="handleChange" />
|
|
||||||
</div>
|
</div>
|
||||||
</ns-drawer>
|
</ns-drawer>
|
||||||
</template>
|
</template>
|
||||||
@@ -29,12 +27,13 @@
|
|||||||
import { editTreeConfig } from './config';
|
import { editTreeConfig } from './config';
|
||||||
import { group } from '/@/api/deviceManage';
|
import { group } from '/@/api/deviceManage';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
|
const emit = defineEmits(['sure']);
|
||||||
const props = defineProps({ params: Object });
|
const props = defineProps({ params: Object });
|
||||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||||
const config = computed(() => {
|
const config = computed(() => {
|
||||||
return editTreeConfig(result);
|
return editTreeConfig(result);
|
||||||
});
|
});
|
||||||
const visible = ref(true);
|
const visible = ref(false);
|
||||||
const dataSource = ref([]);
|
const dataSource = ref([]);
|
||||||
const listStyle = {
|
const listStyle = {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@@ -42,14 +41,19 @@
|
|||||||
};
|
};
|
||||||
const targetKeys = ref([]);
|
const targetKeys = ref([]);
|
||||||
const currentId = ref('');
|
const currentId = ref('');
|
||||||
|
|
||||||
|
const clearData = () => {
|
||||||
|
dataSource.value = [];
|
||||||
|
targetKeys.value = [];
|
||||||
|
};
|
||||||
const toggle = () => {
|
const toggle = () => {
|
||||||
visible.value = !visible.value;
|
visible.value = !visible.value;
|
||||||
|
clearData();
|
||||||
};
|
};
|
||||||
const handleChange = (nextTargetKeys: string[], direction: string, moveKeys: string[]) => {
|
|
||||||
console.log('targetKeys: ', nextTargetKeys);
|
onMounted(() => {
|
||||||
console.log('direction: ', direction);
|
getData(currentId.value);
|
||||||
console.log('moveKeys: ', moveKeys);
|
});
|
||||||
};
|
|
||||||
|
|
||||||
const filterOption = (inputValue: string, option: any) => {
|
const filterOption = (inputValue: string, option: any) => {
|
||||||
return option?.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
return option?.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
||||||
@@ -65,7 +69,9 @@
|
|||||||
saveGroupIds: targetKeys.value,
|
saveGroupIds: targetKeys.value,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
emit('sure');
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
|
toggle();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
function treeSelect(
|
function treeSelect(
|
||||||
@@ -98,8 +104,8 @@
|
|||||||
item['key'] = item.id.toString();
|
item['key'] = item.id.toString();
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
targetKeys.value = res.data.linkGroups.map((item) => {
|
targetKeys.value = res.data.linkGroups?.map((item) => {
|
||||||
return item.id;
|
return item.id.toString();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
123
hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
Normal file
123
hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
Normal file
@@ -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>
|
@@ -7,29 +7,67 @@
|
|||||||
:cancel="() => (visible = false)"
|
:cancel="() => (visible = false)"
|
||||||
placement="right">
|
placement="right">
|
||||||
<ns-form :schemas="schemas" :model="model" formLayout="vertical" />
|
<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>
|
</ns-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { NsMessage } from '/nerv-lib/component';
|
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 visible = ref(false);
|
||||||
const model = ref({});
|
const model = ref({});
|
||||||
const toggle = () => {
|
const toggle = () => {
|
||||||
visible.value = !visible.value;
|
visible.value = !visible.value;
|
||||||
|
visible.value && getTableData();
|
||||||
|
visible.value && getFormula();
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockDataSource = ref([
|
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: [
|
||||||
{
|
{
|
||||||
groupName: '1号厂区',
|
title: '分组编号',
|
||||||
|
dataIndex: 'groupNum',
|
||||||
|
// customRender: ({ index }) => index + 1,
|
||||||
|
width: 80,
|
||||||
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
groupName: '2号厂区',
|
title: '分组名称',
|
||||||
|
dataIndex: 'groupName',
|
||||||
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
groupName: '3号厂区',
|
});
|
||||||
},
|
|
||||||
]);
|
|
||||||
const schemas = [
|
const schemas = [
|
||||||
{
|
{
|
||||||
field: 'basicInfo',
|
field: 'basicInfo',
|
||||||
@@ -44,7 +82,6 @@
|
|||||||
label: '',
|
label: '',
|
||||||
field: 'formula',
|
field: 'formula',
|
||||||
component: 'NsTextarea',
|
component: 'NsTextarea',
|
||||||
defaultValue: '(A+B)*2',
|
|
||||||
formItemProps: {
|
formItemProps: {
|
||||||
wrapperCol: { span: 24 },
|
wrapperCol: { span: 24 },
|
||||||
},
|
},
|
||||||
@@ -59,52 +96,60 @@
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
field: 'list',
|
// field: 'list',
|
||||||
label: '',
|
// label: '',
|
||||||
displayFormItem: false,
|
// displayFormItem: false,
|
||||||
class: 'ns-form-item-full',
|
// class: 'ns-form-item-full',
|
||||||
component: 'NsChildForm',
|
// component: 'NsChildForm',
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
title: '分组列表',
|
// title: '分组列表',
|
||||||
schemas: [
|
// schemas: [
|
||||||
{
|
// {
|
||||||
label: '',
|
// label: '',
|
||||||
field: 'NsBasicTable',
|
// field: 'NsBasicTable',
|
||||||
component: 'NsBasicTable',
|
// component: 'NsBasicTable',
|
||||||
formItemProps: {
|
// formItemProps: {
|
||||||
wrapperCol: { span: 24 },
|
// wrapperCol: { span: 24 },
|
||||||
},
|
// },
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
disabled: true,
|
// disabled: true,
|
||||||
placeholder: '请输入',
|
// placeholder: '请输入',
|
||||||
dataSource: mockDataSource.value,
|
// dataSource: mockDataSource.value,
|
||||||
pagination: false,
|
// pagination: false,
|
||||||
rowKey: (record) => record.groupName,
|
// rowKey: (record) => record.groupName,
|
||||||
columns: [
|
// columns: [
|
||||||
{
|
// {
|
||||||
title: '序号',
|
// title: '序号',
|
||||||
dataIndex: 'name',
|
// dataIndex: 'name',
|
||||||
customRender: ({ index }) => index + 1,
|
// customRender: ({ index }) => index + 1,
|
||||||
width: 80,
|
// width: 80,
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
title: '分组名称',
|
// title: '分组名称',
|
||||||
dataIndex: 'groupName',
|
// dataIndex: 'groupName',
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
const btnClick = () => {
|
const btnClick = () => {
|
||||||
visible.value = false;
|
http
|
||||||
|
.post(group.formula, {
|
||||||
|
...props.params,
|
||||||
|
...model.value,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
emit('sure');
|
||||||
|
toggle();
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
@@ -2,106 +2,125 @@
|
|||||||
<ns-drawer
|
<ns-drawer
|
||||||
v-model:visible="visible"
|
v-model:visible="visible"
|
||||||
width="520"
|
width="520"
|
||||||
title="分组编辑"
|
title=" "
|
||||||
:ok="btnClick"
|
:ok="btnClick"
|
||||||
:cancel="() => (visible = false)"
|
:cancel="() => (visible = false)"
|
||||||
placement="right">
|
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>
|
</ns-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, onMounted, ref, unref } from 'vue';
|
import { createVNode, onMounted, ref, unref } from 'vue';
|
||||||
import { NsMessage } from '/nerv-lib/component';
|
import { NsMessage } from '/nerv-lib/component';
|
||||||
import { DeleteOutlined } from '@ant-design/icons-vue';
|
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 visible = ref(false);
|
||||||
const model = ref({});
|
const model = ref({});
|
||||||
|
const inputDisabled = ref(true);
|
||||||
|
const selectedRowKeys = ref([]);
|
||||||
|
let opType = true; // true新增false编辑
|
||||||
const toggle = () => {
|
const toggle = () => {
|
||||||
visible.value = !visible.value;
|
visible.value = !visible.value;
|
||||||
|
visible.value && getTableData();
|
||||||
};
|
};
|
||||||
const deleteRow = (index) => {
|
|
||||||
console.log(index);
|
const startCararcter = 65;
|
||||||
mockDataSource.value.splice(index, 1);
|
const addGroup = () => {
|
||||||
|
opType = true;
|
||||||
|
getCode();
|
||||||
|
const code = startCararcter + mockDataSource.value?.length;
|
||||||
|
inputDisabled.value = false;
|
||||||
|
model.value = { groupName: '' };
|
||||||
|
// if(mockDataSource.value.length)
|
||||||
};
|
};
|
||||||
const addRow = () => {
|
const op = () => {
|
||||||
console.log(model);
|
inputDisabled.value = !inputDisabled.value;
|
||||||
if (model.value?.groupName) mockDataSource.value.push(unref(model) as any);
|
add();
|
||||||
};
|
};
|
||||||
const mockDataSource = ref([
|
//新增
|
||||||
{
|
const add = () => {
|
||||||
groupName: '1号厂区',
|
const finalParams = { ...props.params, ...model.value };
|
||||||
},
|
if (opType) {
|
||||||
{
|
delete finalParams.id;
|
||||||
groupName: '2号厂区',
|
}
|
||||||
},
|
http.post(group.saveComputeGroup, finalParams).then(() => {
|
||||||
{
|
getTableData();
|
||||||
groupName: '3号厂区',
|
NsMessage.success('操作成功');
|
||||||
},
|
});
|
||||||
]);
|
};
|
||||||
const schemas = [
|
|
||||||
{
|
const delGroup = (id) => {
|
||||||
field: 'basicInfo',
|
http.post(group.delComputeGroup, { id }).then(() => {
|
||||||
label: '',
|
getTableData();
|
||||||
displayFormItem: false,
|
NsMessage.success('操作成功');
|
||||||
class: 'ns-form-item-full',
|
});
|
||||||
component: 'NsChildForm',
|
};
|
||||||
componentProps: {
|
const rowSelectChange = (selected, selectedRows) => {
|
||||||
title: '分组信息',
|
opType = false;
|
||||||
schemas: [
|
console.log(selectedRowKeys, selectedRows);
|
||||||
{
|
selectedRowKeys.value = selected;
|
||||||
label: '分组编号',
|
model.value = { ...selectedRows[0] };
|
||||||
field: 'groupCode',
|
};
|
||||||
component: 'NsInput',
|
const mockDataSource = ref([]);
|
||||||
defaultValue: 'WDIFHSUNGNDOR',
|
const getTableData = () => {
|
||||||
componentProps: {
|
http.post(group.queryComputeGroup, props.params).then((res) => {
|
||||||
disabled: true,
|
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: '请输入',
|
placeholder: '请输入',
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '分组名称',
|
|
||||||
field: 'groupName',
|
|
||||||
component: 'NsInput',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入',
|
|
||||||
addonAfter: createVNode(
|
|
||||||
'div',
|
|
||||||
{ style: { cursor: 'pointer' }, onclick: addRow },
|
|
||||||
'新增',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
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: {
|
|
||||||
disabled: true,
|
|
||||||
placeholder: '请输入',
|
|
||||||
dataSource: mockDataSource.value,
|
|
||||||
rowSelection: { type: 'radio' },
|
|
||||||
pagination: false,
|
pagination: false,
|
||||||
rowKey: (record) => record.groupName,
|
rowKey: (record) => record.id,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '序号',
|
title: '分组编号',
|
||||||
dataIndex: 'name',
|
dataIndex: 'groupNum',
|
||||||
customRender: ({ index }) => index + 1,
|
// customRender: ({ index }) => index + 1,
|
||||||
width: 80,
|
width: 80,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
@@ -115,23 +134,128 @@
|
|||||||
dataIndex: 'delete',
|
dataIndex: 'delete',
|
||||||
width: 80,
|
width: 80,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ index }) =>
|
customRender: ({ record }) =>
|
||||||
|
createVNode(
|
||||||
|
Popconfirm,
|
||||||
|
{ title: '确定删除吗?', placement: 'leftTop', onConfirm: () => delGroup(record.id) },
|
||||||
|
() => [
|
||||||
createVNode(DeleteOutlined, {
|
createVNode(DeleteOutlined, {
|
||||||
style: { color: 'red', cursor: 'pointer' },
|
style: { color: 'red', cursor: 'pointer' },
|
||||||
onClick: () => deleteRow(index),
|
// 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: '请输入',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 = () => {
|
const btnClick = () => {
|
||||||
visible.value = false;
|
http
|
||||||
|
.post(group.saveComputeGroupInfo, {
|
||||||
|
...props.params,
|
||||||
|
groupListId: selectedRowKeys.value[0],
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
emit('sure');
|
||||||
|
toggle();
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
@@ -144,4 +268,8 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
.iconOP {
|
||||||
|
cursor: pointer;
|
||||||
|
color: @primary-color;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<editDrawer ref="editDrawerRef" :params="defaultParams" />
|
<!-- 分组编辑按钮 -->
|
||||||
<editGroup ref="editGroupRef" />
|
<editDrawer ref="editDrawerRef" :params="defaultParams" @sure="handleOk" />
|
||||||
<editFormula ref="editFormulaRef" />
|
<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-modal ref="modalRef" title="新增" v-model:visible="visible">
|
||||||
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="formVertical" />
|
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="formVertical" />
|
||||||
@@ -22,7 +24,6 @@
|
|||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu>
|
<a-menu>
|
||||||
<template v-for="(item, index) in filterAction(actionList, data)" :key="index">
|
<template v-for="(item, index) in filterAction(actionList, data)" :key="index">
|
||||||
<!-- 全部节点只需要新增子节点 -->
|
|
||||||
<a-menu-item @click="item.func(data)">
|
<a-menu-item @click="item.func(data)">
|
||||||
<span>{{ item.title }}</span>
|
<span>{{ item.title }}</span>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
@@ -34,8 +35,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</ns-tree-api>
|
</ns-tree-api>
|
||||||
</div>
|
</div>
|
||||||
<ns-view-list-table v-if="defaultType" class="table" v-bind="config" ref="tableRef" />
|
<ns-view-list-table v-show="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="configCal" ref="tableCalRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
import { tableConfig, treeConfig, tableConfigCal, formSchema } from './config';
|
import { tableConfig, treeConfig, tableConfigCal, formSchema } from './config';
|
||||||
import { useParams } from '/nerv-lib/use';
|
import { useParams } from '/nerv-lib/use';
|
||||||
import editDrawer from './edit.vue';
|
import editDrawer from './edit.vue';
|
||||||
|
import editCalDrawer from './editCal.vue';
|
||||||
import editGroup from './editGroup.vue';
|
import editGroup from './editGroup.vue';
|
||||||
import editFormula from './editFormula.vue';
|
import editFormula from './editFormula.vue';
|
||||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||||
@@ -56,15 +58,16 @@
|
|||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const tableCalRef = ref();
|
const tableCalRef = ref();
|
||||||
const editDrawerRef = ref();
|
const editDrawerRef = ref();
|
||||||
|
const editDrawerCalRef = ref();
|
||||||
const editGroupRef = ref();
|
const editGroupRef = ref();
|
||||||
const editFormulaRef = ref();
|
const editFormulaRef = ref();
|
||||||
const treeRef = ref();
|
const treeRef = ref();
|
||||||
const defaultType = ref(true);
|
const defaultType = ref(true);
|
||||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
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 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 tConfig = treeConfig(result);
|
||||||
const nsModalFormConfig = ref({
|
const nsModalFormConfig = ref({
|
||||||
api: group.creatOrUpdate,
|
api: group.creatOrUpdate,
|
||||||
@@ -161,11 +164,18 @@
|
|||||||
} = record;
|
} = record;
|
||||||
defaultParams.value.energyType = energyType;
|
defaultParams.value.energyType = energyType;
|
||||||
defaultParams.value.id = id;
|
defaultParams.value.id = id;
|
||||||
|
defaultParams.value.hxDeviceGroupId = id;
|
||||||
defaultType.value = pointType === '分组节点';
|
defaultType.value = pointType === '分组节点';
|
||||||
defaultType.value
|
defaultType.value
|
||||||
? tableRef.value?.nsTableRef.reload()
|
? tableRef.value?.nsTableRef.reload()
|
||||||
: tableCalRef.value?.nsTableRef.reload();
|
: tableCalRef.value?.nsTableRef.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleOk = () => {
|
||||||
|
defaultType.value
|
||||||
|
? tableRef.value?.nsTableRef.reload()
|
||||||
|
: tableCalRef.value?.nsTableRef.reload();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.groupContainer {
|
.groupContainer {
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<component :is="schema.component" v-bind="formProps">
|
<component :is="schema.component" v-bind="formProps">
|
||||||
<template #[item]="data" v-for="item in Object.keys($slots)">
|
<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>
|
</template>
|
||||||
</component>
|
</component>
|
||||||
<!-- <div class="ns-tips">-->
|
<!-- <div class="ns-tips">-->
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
mapKeys,
|
mapKeys,
|
||||||
upperFirst,
|
upperFirst,
|
||||||
get,
|
get,
|
||||||
|
cloneDeep,
|
||||||
} from 'lodash-es';
|
} from 'lodash-es';
|
||||||
import { isInputType } from '/nerv-lib/component/form/form-util';
|
import { isInputType } from '/nerv-lib/component/form/form-util';
|
||||||
import { useParams } from '/nerv-lib/use/use-params';
|
import { useParams } from '/nerv-lib/use/use-params';
|
||||||
@@ -332,6 +333,7 @@
|
|||||||
getFormItemClass,
|
getFormItemClass,
|
||||||
getSlots,
|
getSlots,
|
||||||
formLayout,
|
formLayout,
|
||||||
|
cloneDeep,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
|
@@ -275,6 +275,7 @@
|
|||||||
|
|
||||||
.ant-empty-description {
|
.ant-empty-description {
|
||||||
color: rgba(0, 0, 0, 0.3);
|
color: rgba(0, 0, 0, 0.3);
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表头加粗
|
// 表头加粗
|
||||||
|
Reference in New Issue
Block a user