zhaohy 4 months ago
parent
commit
1401d3611f
  1. 11
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  2. 2
      hx-ai-intelligent/src/config/app.config.ts
  3. 241
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  4. 42
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  5. 1
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  6. 401
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index copy.vue
  7. 180
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  8. 2
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  9. 6
      hx-ai-intelligent/src/view/equipmentManage/group/edit.vue
  10. 6
      hx-ai-intelligent/src/view/equipmentManage/group/editCal.vue
  11. 6
      hx-ai-intelligent/src/view/equipmentManage/group/editFormula.vue
  12. 9
      hx-ai-intelligent/src/view/equipmentManage/group/editGroup.vue
  13. 4
      hx-ai-intelligent/src/view/equipmentManage/group/index.vue
  14. 48
      hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue
  15. 160
      hx-ai-intelligent/src/view/monitor/environmentMonitor/aggregateData/index.vue
  16. 4
      hx-op/src/config/app.config.ts
  17. 16
      lib/saas/view/service/updatePassWord.vue
  18. 12
      lib/saas/view/system/login.vue

11
hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts

@ -11,6 +11,9 @@ export enum carbonEmissionFactorLibrary {
// 单位管理 // 单位管理
dictionaryUnitManagement = '/carbon-smart/api/carbon/emission/factor/dictionaryUnitManagement', dictionaryUnitManagement = '/carbon-smart/api/carbon/emission/factor/dictionaryUnitManagement',
findOutermost = '/carbon-smart/api/carbon/emission/factor/findOutermost', findOutermost = '/carbon-smart/api/carbon/emission/factor/findOutermost',
createDictionary = '/carbon-smart/api/carbon/emission/factor/createDictionary',
updateDictionary = '/carbon-smart/api/carbon/emission/factor/updateDictionary',
delDictionary = '/carbon-smart/api/carbon/emission/factor/delDictionary',
} }
// 碳排管理-碳排统计接口 // 碳排管理-碳排统计接口
export enum energyConsumption { export enum energyConsumption {
@ -21,3 +24,11 @@ export enum energyConsumption {
update = '/carbon-smart/api/carbon/stats/update', update = '/carbon-smart/api/carbon/stats/update',
del = '/carbon-smart/api/carbon/stats/del', del = '/carbon-smart/api/carbon/stats/del',
} }
// 碳排管理-碳排速算接口
export enum quickCalculation {
carbonQuickTree = '/carbon-smart/api/carbon/energy/correlation/carbonQuickTree',
queryCarbonEmissionPage = '/carbon-smart/api/carbon/energy/correlation/queryCarbonEmissionPage',
creat = '/carbon-smart/api/carbon/energy/correlation/creat',
update = '/carbon-smart/api/carbon/energy/correlation/update',
del = '/carbon-smart/api/carbon/energy/correlation/del',
}

2
hx-ai-intelligent/src/config/app.config.ts

@ -103,7 +103,7 @@ export const appConfig = {
updatePassWordInfo: { updatePassWordInfo: {
title: '修改密码', title: '修改密码',
subtitle: 'huaxing平台', subtitle: 'huaxing平台',
api: '/carbon-smart/api/user/password', api: '/carbon-smart/api/user/update/password',
}, },
// headerBellInfo: { // headerBellInfo: {
// isShow: true, // isShow: true,

241
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue

@ -46,18 +46,18 @@
</span> </span>
<span v-else>{{ data.emissionName }}</span> <span v-else>{{ data.emissionName }}</span>
</div> </div>
<a-popover placement="rightTop" trigger="focus"> <a-dropdown>
<template #content> <ns-icon name="actionMore" size="14" class="actionMore" />
<div style="display: flex;flex-direction: column;"> <template #overlay>
<a-button type="text" @click="editTreeNodeData">编辑</a-button> <a-menu>
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button> <a-menu-item @click="editTreeNodeData">编辑</a-menu-item>
<a-button type="text">上移</a-button> <a-menu-item @click="addTreeNodeData">新增子节点</a-menu-item>
<a-button type="text">下移</a-button> <a-menu-item>上移</a-menu-item>
<a-button type="text" @click="deleteTreeNode">删除</a-button> <a-menu-item>下移</a-menu-item>
</div> <a-menu-item @click="deleteTreeNode">删除</a-menu-item>
</a-menu>
</template> </template>
<MoreOutlined class="actionMore" /> </a-dropdown>
</a-popover>
</div> </div>
</template> </template>
</a-tree> </a-tree>
@ -107,61 +107,89 @@
title="单位管理" title="单位管理"
@close="closeUnitManag"> @close="closeUnitManag">
<div class="addButton"> <div class="addButton">
<a-button type="primary">新增分组</a-button> <a-button type="primary" @click="addGroup">新增分组</a-button>
<a-button type="primary">新增单位</a-button> <a-button type="primary" @click="addUnit">新增单位</a-button>
</div> </div>
<div class="treePart"> <div class="treePart">
<div style="width: 100%;height: 7%;display: flex;justify-content: center;align-items: center;"> <div style="width: 100%;height: 7%;display: flex;justify-content: center;align-items: center;">
<a-select <a-select
ref="select" ref="select"
:value="unitTreeParams.cnValue" :value="unitTreeParams.id"
allowClear
style="width: 96%" style="width: 96%"
placeholder="选择分组" placeholder="选择分组"
@change="handleChange" @change="handleChange"
> >
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.cnValue"> <a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id">
{{ item.cnValue }} {{ item.cnValue }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</div> </div>
<a-tree <a-tree
:expandedKeys="unitExpandedKeys" :expanded-keys="unitExpandedKeys"
:selectedKeys="unitSelectedKeys" :selectedKeys="unitSelectedKeys"
:tree-data="unitTreeData" :tree-data="unitTreeData"
v-if="unitTreeData && unitTreeData.length > 0" v-if="unitTreeData && unitTreeData.length > 0"
> class="draggable-tree"
block-node>
<template #title="data"> <template #title="data">
<div class="treeRow"> <div class="treeRow">
<div> <div>
<span>{{ data.cnValue }}</span> <span>{{ data.cnValue }}</span>
</div> </div>
<a-popover placement="rightTop" trigger="focus"> <div class="actionMore">
<template #content> <EditOutlined v-if="!data.parentId" @click="editGroup(data)" />
<div style="display: flex;flex-direction: column;"> <EditOutlined v-else @click="editUnit(data)" />
<a-button type="text" @click="editTreeNodeData">编辑</a-button> <MinusCircleOutlined style="margin-left: 6px;" @click="delUnit(data)" />
<a-button type="text" @click="addTreeNodeData">新增子节点</a-button> <PlusCircleOutlined v-if="!data.parentId" style="margin-left: 6px;" @click="addUnit(data)" />
<a-button type="text">上移</a-button>
<a-button type="text">下移</a-button>
<a-button type="text" @click="deleteTreeNode">删除</a-button>
</div> </div>
</template>
<MoreOutlined class="actionMore" />
</a-popover>
</div> </div>
</template> </template>
</a-tree> </a-tree>
</div> </div>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="closeUnitManag">取消</a-button> <a-button style="margin-right: 8px" @click="closeUnitManag">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
</template> </template>
</a-drawer> </a-drawer>
<!-- 新增分组管理 -->
<ns-modal :visible="addGroupManage" :title="addGroupTitle" @ok="unitOrGroupOk" @cancel="groupCancel">
<a-form
ref="unitFormRef"
:model="formState"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="分组名称" name="cnValue" :required="true">
<a-input v-model:value="formState.cnValue" placeholder="请输入分组名称" />
</a-form-item>
</a-form>
</ns-modal>
<!-- 新增单位 -->
<ns-modal :visible="addUnitManage" :title="addUnitTitle" @ok="unitOrGroupOk" @cancel="unitCancel">
<a-form
ref="unitFormRef"
:model="formState"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="单位名称" name="cnValue" :required="true">
<a-input v-model:value="formState.cnValue" placeholder="请输入单位名称" />
</a-form-item>
<a-form-item label="选择分组" name="parentId" :required="true">
<a-select v-model:value="formState.parentId" placeholder="请选择所属分组" :disabled="canSelect">
<a-select-option v-for="(item, index) in groupData" :key="index" :value="item.id">
{{ item.cnValue }}
</a-select-option>
</a-select>
</a-form-item>
</a-form>
</ns-modal>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { MoreOutlined,ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { MoreOutlined,ExclamationCircleOutlined,EditOutlined,PlusCircleOutlined,MinusCircleOutlined } from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue'; import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch,toRaw } from 'vue';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { NsMessage, NsModal } from '/nerv-lib/component'; import { NsMessage, NsModal } from '/nerv-lib/component';
import { formConfig, formConfig2 } from './config'; import { formConfig, formConfig2 } from './config';
@ -215,7 +243,7 @@
const y = 2; const y = 2;
const z = 1; const z = 1;
const genData: TreeProps['treeData'] = []; const genData: TreeProps['treeData'] = [];
const checkedTreeNodeKeys = ref<string[]>(['0-0']); const checkedTreeNodeKeys = ref<string[]>();
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => { const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
const preKey = _preKey || '0'; const preKey = _preKey || '0';
@ -423,15 +451,15 @@
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => { fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
gData.value = res.data gData.value = res.data
// //
const selectedNodes = []; // const selectedNodes = [];
checkedTreeNodeKeys.value.forEach(key => { // checkedTreeNodeKeys.value.forEach(key => {
const [parentId, childId] = key.split('-').map(Number); // const [parentId, childId] = key.split('-').map(Number);
if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) { // if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) {
selectedNodes.push(gData.value[parentId]); // selectedNodes.push(gData.value[parentId]);
} // }
}); // });
// id // id
getDefaultIds(selectedNodes) // getDefaultIds(selectedNodes)
}); });
}; };
const defaultIds = ref([]) const defaultIds = ref([])
@ -494,6 +522,9 @@
userAuthList.value.splice(0); userAuthList.value.splice(0);
}; };
const closeUnitManag = () => { const closeUnitManag = () => {
unitTreeParams.value = {
grp: 'MEASUREMENT_UNIT'
}
unitManagement.value = false; unitManagement.value = false;
}; };
const onEdit = () => { const onEdit = () => {
@ -573,9 +604,7 @@
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => { fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => {
groupData.value = res.data groupData.value = res.data
}); });
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => { getUnitTree()
unitTreeData.value = res.data
});
}, },
}, },
], ],
@ -770,10 +799,134 @@
const groupData = ref([]) const groupData = ref([])
const unitTreeData = ref<TreeProps['treeData']>(genData); const unitTreeData = ref<TreeProps['treeData']>(genData);
const handleChange = (value: string) => { const handleChange = (value: string) => {
unitTreeParams.value.cnValue = value unitTreeParams.value.id = value
getUnitTree()
};
const getUnitTree = () => {
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => { fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, unitTreeParams.value).then((res) => {
unitTreeData.value = res.data unitTreeData.value = res.data
}); });
}
//
const labelCol = { span: 5 };
const wrapperCol = { span: 19 };
const unitFormRef = ref();
const addGroupManage = ref(false);
const addUnitManage = ref(false);
const canSelect = ref(false);
const formState = ref({
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
})
const addGroupTitle = ref<string>('新增分组');
const addUnitTitle = ref<string>('新增单位');
const addGroup = () => {
addGroupTitle.value = '新增分组'
addGroupManage.value = true
};
const editGroup = (data) => {
addGroupTitle.value = '编辑分组'
addGroupManage.value = true
formState.value.id = data.id
formState.value.cnValue = data.cnValue
};
const groupCancel = () => {
addGroupManage.value = false
unitFormRef.value.resetFields();
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
}
};
const addUnit = (data) => {
if(data.id){
canSelect.value = true
formState.value.parentId = data.id
}else{
canSelect.value = false
}
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => {
groupData.value = res.data
});
addUnitTitle.value = '新增单位'
addUnitManage.value = true
};
const editUnit = (data) => {
addUnitTitle.value = '编辑单位'
addUnitManage.value = true
canSelect.value = true
formState.value.parentId = data.parentId
formState.value.id = data.id
formState.value.cnValue = data.cnValue
};
const unitCancel = () => {
addUnitManage.value = false
unitFormRef.value.resetFields();
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
}
};
const unitOrGroupOk = () => {
unitFormRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
if(formState.value.id){
fetch(carbonEmissionFactorLibrary.updateDictionary, formState.value).then((res) => {
unitTreeData.value = res.data
if(formState.value.parentId){
addUnitManage.value = false
}else{
addGroupManage.value = false
}
unitFormRef.value.resetFields();
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
}
getUnitTree()
});
}else{
fetch(carbonEmissionFactorLibrary.createDictionary, formState.value).then((res) => {
unitTreeData.value = res.data
if(formState.value.parentId){
addUnitManage.value = false
}else{
addGroupManage.value = false
}
unitFormRef.value.resetFields();
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
}
getUnitTree()
});
}
})
.catch(error => {
console.log('error', error);
});
};
//
const delUnit = (data) => {
formState.value.id = data.id
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(carbonEmissionFactorLibrary.delDictionary , formState.value).then((res) => {
message.success('操作成功!');
getUnitTree()
});
},
onCancel() {
console.log('Cancel');
},
});
}; };
</script> </script>

42
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts

@ -87,32 +87,32 @@ export const columns = [
}, },
{ {
title: '因子值', title: '因子值',
dataIndex: 'energyType', dataIndex: 'emissionFactors',
}, },
{ {
title: '计量单位', title: '计量单位',
className: 'unit', className: 'carbonEmissionSuffix',
dataIndex: 'unit', dataIndex: 'carbonEmissionSuffix',
}, },
{ {
title: '更新时间', title: '更新时间',
className: 'unit', className: 'updateTime',
dataIndex: 'unit', dataIndex: 'updateTime',
}, },
{ {
title: '启用时间', title: '启用时间',
className: 'unit', className: 'startTime ',
dataIndex: 'unit', dataIndex: 'startTime ',
}, },
{ {
title: '结束时间', title: '结束时间',
className: 'unit', className: 'endTime',
dataIndex: 'unit', dataIndex: 'endTime',
}, },
{ {
title: '数据来源', title: '数据来源',
className: 'unit', className: 'dataSources',
dataIndex: 'unit', dataIndex: 'dataSources',
}, },
{ {
title: '操作', title: '操作',
@ -120,3 +120,23 @@ export const columns = [
width: 130 width: 130
}, },
]; ];
export const drawerColumns = [
{
title: '名称',
dataIndex: 'emissionSources',
},
{
title: '因子值',
dataIndex: 'emissionFactors',
},
{
title: '排放环节',
className: 'emissionProcess',
dataIndex: 'emissionProcess',
},
{
title: '数据来源',
className: 'dataSources',
dataIndex: 'dataSources',
},
];

1
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -181,6 +181,7 @@
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orgId: orgId.value,
}) })
const isRequired = ref(false); const isRequired = ref(false);
const visible = ref(false); const visible = ref(false);

401
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index copy.vue

@ -1,401 +0,0 @@
<!-- @format -->
<template>
<div class="main">
<div class="left">
<div class="top">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><span>排放分类</span></div>
<div style="padding: 0 16px !important;width: 100%;">
<a-row>
<a-col :span="24" style="margin-bottom: 16px;">
<a-input-search
v-model:value="selectTreeDataValue"
placeholder="请输入关键词"
@search="onSearchTreeData"
/>
</a-col>
</a-row>
</div>
</a-form>
<a-tree
v-if="gData && gData.length > 0"
class="draggable-tree"
style="padding: 0 16px !important;"
show-line
block-node
:tree-data="gData"
:checkedKeys="checkedTreeNodeKeys"
:selectedKeys="selectedKeys"
@check="checkTreeNode"
@select="onSelect"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
@expand="onExpand">
<template #title="{ emissionName }">
<span v-if="emissionName && selectTreeDataValue && emissionName.indexOf(selectTreeDataValue) > -1">
{{ emissionName.substring(0, emissionName.indexOf(selectTreeDataValue)) }}
<span style="color: #f50">{{ selectTreeDataValue }}</span>
{{ emissionName.substring(emissionName.indexOf(selectTreeDataValue) + selectTreeDataValue.length) }}
</span>
<span v-else>{{ emissionName }}</span>
</template>
</a-tree>
</div>
</div>
<div class="right">
<a-table :columns="columns" :data-source="tableData" bordered :pagination="false">
<template #bodyCell="{ column, text }">
<template v-if="column.dataIndex === 'name'">
<a>{{ text }}</a>
</template>
</template>
<template #title>Header</template>
</a-table>
</div>
<!-- 新增树节点 -->
<ns-modal :visible="treeNodeAdd" :title="operationTree" @ok="handleOk" @cancel="handleCancel">
<ns-input
v-model:value="addTreeNode"
class="input"
placeholder="请输入排放类型"/>
</ns-modal>
<!-- 新增数据库数据 -->
<a-drawer
:width="500"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<ns-form
ref="formRef"
:model="formData"
class="form"
:wrapperCol="{ span: 20 }"
formLayout="vertical" />
<template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
</template>
</a-drawer>
</div>
</template>
<script lang="ts" setup>
import { Modal } from 'ant-design-vue';
import { computed, createVNode, defineComponent, reactive, ref, watchEffect,watch } from 'vue';
import { http } from '/nerv-lib/util/http';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
import type {
AntTreeNodeDragEnterEvent,
AntTreeNodeDropEvent,
TreeProps,
} from 'ant-design-vue/es/tree';
import { log } from 'node:console';
defineOptions({ name: 'QuickCalculation' });
const selectTreeDataValue = ref<string>('');
const data = reactive({});
let formData = ref({});
const formRef = ref();
const visible = ref(false);
const searchValue = ref<string>('');
const searchValue2 = ref<string>('');
const disabled = ref(false);
const treeNodeAdd = ref<boolean>(false);
const operationTree = ref<string>('新增');
const opMap: any = ref({
type: 'add',
fuc: () => {},
record: {},
});
watchEffect(() => {
disabled.value = opMap.value.type === 'edit';
});
const casData = ref([]);
const treeData = ref([]);
const userAuthList = ref([]);
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const dynamicDisabled = computed(() => {
return formRef.value?.validateResult && userAuthList.value?.length;
});
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
//
const x = 3;
const y = 2;
const z = 1;
const genData: TreeProps['treeData'] = [];
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
const preKey = _preKey || '0';
const tns = _tns || genData;
const children = [];
for (let i = 0; i < x; i++) {
const key = `${preKey}-${i}`;
tns.push({ title: key, key });
if (i < y) {
children.push(key);
}
}
if (_level < 0) {
return tns;
}
const level = _level - 1;
children.forEach((key, index) => {
tns[index].children = [];
return generateData(level, key, tns[index].children);
});
};
generateData(z);
type TreeDataItem = TreeProps['treeData'][number];
const gData = ref<TreeProps['treeData']>(genData);
const dataList: TreeProps['treeData'] = [];
const generateList = (data: TreeProps['treeData']) => {
for (let i = 0; i < data.length; i++) {
const node = data[i];
const key = node.key;
dataList.push({ key, title: key });
if (node.children) {
generateList(node.children);
}
}
};
generateList(genData);
const getParentKey = (
key: string | number,
tree: TreeProps['treeData'],
): string | number | undefined => {
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.children) {
if (node.children.some(item => item.key === key)) {
parentKey = node.key;
} else if (getParentKey(key, node.children)) {
parentKey = getParentKey(key, node.children);
}
}
}
return parentKey;
};
const expandedKeys = ref<(string | number)[]>([]);
const autoExpandParent = ref<boolean>(true);
const onExpand = (keys: string[]) => {
expandedKeys.value = keys;
autoExpandParent.value = false;
};
watch(selectTreeDataValue, value => {
const expanded = dataList
.map((item: TreeProps['treeData'][number]) => {
if (item.title.indexOf(value) > -1) {
return getParentKey(item.key, gData.value);
}
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
expandedKeys.value = expanded;
selectTreeDataValue.value = value;
autoExpandParent.value = true;
});
//
const onSearchTreeData = (selectTreeDataValue: string) => {
console.log('use value', selectTreeDataValue);
console.log('or use this.value', value.value);
};
//
const checkedIds = ref([])
const emissionType = ref()
const checkTreeNode = (checkedKeys, info) => {
checkedIds.value = []
info.checkedNodes.forEach(item=>{
checkedIds.value.push(item.id)
})
sessionStorage.setItem('checkedTreeNode', checkedIds.value);
emissionType.value = checkedIds.value.join(',')
}
// /
const addTreeNode =ref()
const handleOk = (e: MouseEvent) => {
editTreeNode.value.emissionName = addTreeNode.value
http.post(carbonEmissionFactorLibrary.creat,editTreeNode.value).then(() => {
getOrgTree()
NsMessage.success('操作成功');
addTreeNode.value = ''
treeNodeAdd.value = false;
});
};
const handleCancel = () => {
addTreeNode.value = ''
treeNodeAdd.value = false;
};
//
const getOrgTree = (params?) => {
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
gData.value = res.data
//
const selectedNodes = [];
checkedTreeNodeKeys.value.forEach(key => {
const [parentId, childId] = key.split('-').map(Number);
if (parentId >= 0 && childId >= 0 && gData.value[parentId]?.children?.[childId]) {
selectedNodes.push(gData.value[parentId]);
}
});
});
};
getOrgTree();
//
const editTreeNode = ref({})
const onSelect = (selectedKeys: string[], info: any) => {
if(info.selected){
editTreeNode.value = {
id:info.selectedNodes[0].id,
level:info.selectedNodes[0].level,
dataNumber:info.selectedNodes[0].dataNumber,
sortNumber:info.selectedNodes[0].sortNumber,
parentEmissionId:info.selectedNodes[0].parentEmissionId,
}
}
};
const onSearch = () => {
console.log(searchValue.value);
getOrgTree({ orgName: searchValue.value, orgId });
};
const tableFetch = (params) => {
console.log(params, 'sdfasfasdfasdfasdf');
setTimeout(() => {
mainRef.value?.nsTableRef.reload();
}, 100);
};
const handleSelect = (selectedKeys: any, info: any) => {
fetch(carbonEmissionFactorLibrary.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
treeData2.value = res.data;
});
tableFetch({ orgId: info.node?.orgInfo.orgId });
};
const columns = [
{
title: 'Name',
dataIndex: 'name',
},
{
title: 'Cash Assets',
className: 'column-money',
dataIndex: 'money',
},
{
title: 'Address',
dataIndex: 'address',
},
];
const tableData = [
{
key: '1',
name: 'John Brown',
money: '¥300,000.00',
address: 'New York No. 1 Lake Park',
},
{
key: '2',
name: 'Jim Green',
money: '¥1,256,000.00',
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
money: '¥120,000.00',
address: 'Sidney No. 1 Lake Park',
},
];
const onClose = () => {
visible.value = false;
formData.value = {};
userAuthList.value.splice(0);
};
const onEdit = () => {
formRef.value?.triggerSubmit().then(() => {
console.log(formData.value, 'formData.value');
// if (!userAuthList.value.length) {
// NsMessage.error('');
// return;
// }
opMap.value.fuc &&
opMap.value.fuc({ ...formData.value });
});
};
</script>
<style lang="less" scoped>
.main {
background-color: @ns-content-bg;
display: flex;
height: 100%;
}
.left {
width: 300px;
// max-height: calc(100vh - 96px);
margin-right: @ns-gap;
min-width: fit-content;
> div {
background-color: @white;
// box-shadow: @ns-content-box-shadow;
flex: 1;
}
display: flex;
flex-direction: column;
.top{
position: relative;
.addTreeNode{
width: 100%;
padding: 16px;
position: absolute;
bottom: 0;
}
}
}
.right {
flex: 1;
min-width: 0;
}
::v-deep .ant-table-container{
padding: 0px 16px;
}
.top {
overflow: auto;
// height: 50%;
// border-bottom: 5px solid rgb(229, 235, 240);
// overflow-y: auto;
}
.ns-form-title{
font-weight: bold;
user-select: text;
padding: 16px;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
</style>
<style scoped>
th.column-money,
td.column-money {
text-align: right !important;
}
</style>

180
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -17,19 +17,22 @@
</div> </div>
</a-form> </a-form>
<a-tree <a-tree
v-if="gData && gData.length > 0"
:expanded-keys="expandedKeys" :expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent" :auto-expand-parent="autoExpandParent"
:tree-data="gData" :tree-data="gData"
show-line
@expand="onExpand" @expand="onExpand"
@select="onSelect"
style="padding: 0 16px !important;" style="padding: 0 16px !important;"
> >
<template #title="{ title }"> <template #title="data">
<span v-if="title.indexOf(searchValue) > -1"> <span v-if="data.energyType && searchValue && data.energyType.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }} {{ data.energyType.substring(0, data.energyType.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span> <span style="color: #f50">{{ searchValue }}</span>
{{ title.substring(title.indexOf(searchValue) + searchValue.length) }} {{ data.energyType.substring(data.energyType.indexOf(searchValue) + searchValue.length) }}
</span> </span>
<span v-else>{{ title }}</span> <span v-else>{{ data.energyType }}</span>
</template> </template>
</a-tree> </a-tree>
</div> </div>
@ -66,7 +69,7 @@
@change="onChange" /> @change="onChange" />
<!-- 新增/编辑 --> <!-- 新增/编辑 -->
<a-drawer <a-drawer
:width="500" :width="700"
:visible="visible" :visible="visible"
:body-style="{ paddingBottom: '80px' }" :body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }" :footer-style="{ textAlign: 'right' }"
@ -79,35 +82,34 @@
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol"
> >
<a-row>
<a-col :span="12">
<a-form-item ref="name" label="能源种类" name="energyType"> <a-form-item ref="name" label="能源种类" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" /> <a-range-picker v-model:value="formState.energyType" picker="month" style="width:200px;" />
</a-form-item>
<a-form-item label="计量单位" name="unit">
<a-cascader v-model:value="formState.unit" :options="options" />
</a-form-item>
<a-form-item label="自动采集节点" name="collectionNode">
<a-tree-select
v-model:value="formState.collectionNode"
:tree-line="true"
:tree-data="treeData"
tree-node-filter-prop="title"
>
</a-tree-select>
</a-form-item> </a-form-item>
<a-form-item label="计算碳排" name="isComputeCarbon"> </a-col>
<a-radio-group v-model:value="formState.isComputeCarbon" @change="changeRadio"> <a-col :span="12">
<a-radio :value="0"></a-radio> <a-form-item ref="name" label="排放因子" name="energyType">
<a-radio :value="1"></a-radio> <ns-input v-model:value="formState.emissionFactors" disabled />
</a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="排放类型" name="emissionType"> </a-col>
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型"> </a-row>
<a-select-option v-for="(item, index) in emissionTypeDic" :key="index" :value="item.cnValue"> <a-row>
{{ item.cnValue }} <a-col :span="12">
</a-select-option> <a-form-item ref="name" label="关键词">
</a-select> <ns-input v-model:value="selectData" />
</a-form-item> </a-form-item>
</a-col>
</a-row>
</a-form> </a-form>
<a-table
:columns="drawerColumns"
:data-source="newTableData"
bordered
rowKey="id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectionChange, type: 'radio' }"
:pagination="false">
</a-table>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> <a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">确定</a-button> <a-button type="primary" @click="onSubmit">确定</a-button>
@ -118,11 +120,12 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from 'vue'; import { ref, watch, toRaw } from 'vue';
import type { TreeProps } from 'ant-design-vue'; import type { TreeProps } from 'ant-design-vue';
import { Pagination } from 'ant-design-vue'; import { Pagination,Modal } from 'ant-design-vue';
import { columns } from '../config'; import { columns,drawerColumns } from '../config';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { quickCalculation,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({ defineOptions({
energyType: 'quickCalculation', // name energyType: 'quickCalculation', // name
components: { components: {
@ -203,6 +206,13 @@
expandedKeys.value = keys; expandedKeys.value = keys;
autoExpandParent.value = false; autoExpandParent.value = false;
}; };
//
const onSelect = (selectedKeys: string[], info: any) => {
if(info.selected){
queryParams.value.energyType = info.node.id
getTableList()
}
};
watch(searchValue, value => { watch(searchValue, value => {
const expanded = dataList const expanded = dataList
@ -217,57 +227,113 @@
searchValue.value = value; searchValue.value = value;
autoExpandParent.value = true; autoExpandParent.value = true;
}); });
//
const onSearchTreeData = () => {
};
//
const getTreeData = () => {
fetch(quickCalculation.carbonQuickTree).then((res) => {
gData.value = res.data
});
};
getTreeData()
// //
const total = ref<number>() const total = ref<number>()
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orgId: orgId.value,
}) })
const tableData = [ const tableData = ref([]);
{ //
key: '1', const getTableList = () => {
name: 'John Brown', fetch(quickCalculation.queryCarbonEmissionPage,queryParams.value).then((res) => {
money: '¥300,000.00', tableData.value = res.data.records
address: 'New York No. 1 Lake Park', total.value = res.data.total
}, });
{ };
key: '2', getTableList()
name: 'Jim Green',
money: '¥1,256,000.00',
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
money: '¥120,000.00',
address: 'Sidney No. 1 Lake Park',
},
];
// //
const onChange = (pageNumber: number,size: number) => { const onChange = (pageNumber: number,size: number) => {
queryParams.value.pageNum = pageNumber; queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size; queryParams.value.pageSize = size;
// getTableList() getTableList()
}; };
// / // /
const formRef = ref(); const formRef = ref();
const labelCol = { span: 5 }; const labelCol = { span: 6 };
const wrapperCol = { span: 19 }; const wrapperCol = { span: 18 };
const formState = ref({}) const formState = ref({})
const visible = ref(false); const visible = ref(false);
// form // form
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }], energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }] };
//
const addNewData = () => {
visible.value = true
getNewTable()
};
//
const selectedRowKeys = ref([]);
const onSelectionChange = (selectedKeys, selectedRows) => {
selectedRowKeys.value = selectedKeys;
formState.value.emissionFactors = selectedRows[0].emissionFactors
};
const queryData = ref({
orgId: orgId.value,
pageNum: 1,
pageSize: 999
})
const newTableData = ref([])
const getNewTable = () => {
fetch(carbonEmissionFactorLibrary.getTableList,queryData.value).then((res) => {
newTableData.value = res.data.records
});
}; };
// //
const editData = (record) =>{ const editData = (record) =>{
visible.value = true visible.value = true
}; };
//
const onSubmit = () => {
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
fetch(quickCalculation.creat,formState.value).then((res) => {
console.log(res);
});
})
.catch(error => {
console.log('error', error);
});
};
//
const delData = (record) => {
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(quickCalculation.del , {id : record.id }).then((res) => {
message.success('操作成功!');
getTableList()
});
},
onCancel() {
console.log('Cancel');
},
});
};
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
selectedRowKeys.value = [];
formRef.value.resetFields(); formRef.value.resetFields();
}; };
</script> </script>

2
hx-ai-intelligent/src/view/equipmentManage/group/config.ts

@ -227,6 +227,7 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
label: '编辑', label: '编辑',
name: 'groupEdit', name: 'groupEdit',
type: 'primary', type: 'primary',
dynamicDisabled: () => !defaultParams.value?.id,
handle: (a, b) => { handle: (a, b) => {
el.value.toggle(); el.value.toggle();
}, },
@ -497,7 +498,6 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
defaultParams: defaultParams.value, defaultParams: defaultParams.value,
componentProps: { componentProps: {
placeholder: '请选择设备型号', placeholder: '请选择设备型号',
mode: 'multiple',
api: (params: any) => { api: (params: any) => {
return http.post(group.dropGroupInfoFilter, params).then((res: any) => { return http.post(group.dropGroupInfoFilter, params).then((res: any) => {
const result = [...new Set(res.data)]; const result = [...new Set(res.data)];

6
hx-ai-intelligent/src/view/equipmentManage/group/edit.vue

@ -45,6 +45,7 @@
const clearData = () => { const clearData = () => {
dataSource.value = []; dataSource.value = [];
targetKeys.value = []; targetKeys.value = [];
currentId.value = '';
}; };
const toggle = () => { const toggle = () => {
visible.value = !visible.value; visible.value = !visible.value;
@ -58,7 +59,10 @@
const btnClick = () => { const btnClick = () => {
// visible.value = false; // visible.value = false;
if (!currentId.value) {
NsMessage.warn('请先选择公司');
return;
}
http http
.post(group.saveGroupList, { .post(group.saveGroupList, {
...props.params, ...props.params,

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

@ -45,6 +45,7 @@
const clearData = () => { const clearData = () => {
dataSource.value = []; dataSource.value = [];
targetKeys.value = []; targetKeys.value = [];
currentId.value = '';
}; };
const toggle = () => { const toggle = () => {
visible.value = !visible.value; visible.value = !visible.value;
@ -59,7 +60,10 @@
}; };
const btnClick = () => { const btnClick = () => {
// visible.value = false; if (!currentId.value) {
NsMessage.warn('请先选择公司');
return;
}
http http
.post(group.saveComputeList, { .post(group.saveComputeList, {

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

@ -2,7 +2,7 @@
<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">
@ -140,6 +140,10 @@
]; ];
const btnClick = () => { const btnClick = () => {
if (!model.value?.formula) {
NsMessage.warn('请填写公式');
return;
}
http http
.post(group.formula, { .post(group.formula, {
...props.params, ...props.params,

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

@ -16,8 +16,8 @@
<template #addonAfter="data"> <template #addonAfter="data">
<template v-if="data.field === 'groupName'"> <template v-if="data.field === 'groupName'">
<div class="iconOP"> <div class="iconOP">
<EditOutlined v-if="inputDisabled" @click="editGroup" /> <EditOutlined title="编辑" v-if="inputDisabled" @click="editGroup" />
<CheckOutlined v-else @click="add" /> <CheckOutlined title="保存" v-else @click="add" />
</div> </div>
</template> </template>
</template> </template>
@ -161,6 +161,7 @@
() => [ () => [
createVNode(DeleteOutlined, { createVNode(DeleteOutlined, {
style: { color: 'red', cursor: 'pointer' }, style: { color: 'red', cursor: 'pointer' },
title: '删除',
// onClick: () => delGroup(record.id), // onClick: () => delGroup(record.id),
}), }),
], ],
@ -266,6 +267,10 @@
}; };
const btnClick = () => { const btnClick = () => {
if (!selectedRowKeys.value[0]) {
NsMessage.warn('请选择分组');
return;
}
http http
.post(group.saveComputeGroupInfo, { .post(group.saveComputeGroupInfo, {
...props.params, ...props.params,

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

@ -5,10 +5,6 @@
<editGroup ref="editGroupRef" :params="defaultParams" @sure="handleOk" /> <editGroup ref="editGroupRef" :params="defaultParams" @sure="handleOk" />
<editFormula ref="editFormulaRef" :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" />
</ns-modal> -->
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" /> <NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" />
<div class="groupContainer"> <div class="groupContainer">
<div class="tree"> <div class="tree">

48
hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue

@ -40,18 +40,22 @@
<div class="fixed-bottom"> <div class="fixed-bottom">
<a-divider /> <a-divider />
<a-select <a-select
v-model:value="frequencyValue" v-model:value="dateTypeValue"
placeholder="请选择采集频率" placeholder="请选择日期类型"
style="width: 100%; margin-bottom: 10px" style="width: 100%; margin-bottom: 10px"
:options="options2" /> :options="options2" />
<a-range-picker <a-date-picker
style="width: 100%; margin-bottom: 10px"
v-model:value="dateValue"
:picker="dateTypeValue" />
<!-- <a-range-picker
:value="hackValue || dateRange" :value="hackValue || dateRange"
:disabled-date="disabledDate" :disabled-date="disabledDate"
@change="onChange" @change="onChange"
@openChange="onOpenChange" @openChange="onOpenChange"
@calendarChange="onCalendarChange" @calendarChange="onCalendarChange"
style="width: 100%; margin-bottom: 10px" style="width: 100%; margin-bottom: 10px"
:placeholder="['请选择日期', '请选择日期']" /> :placeholder="['请选择日期', '请选择日期']" /> -->
<a-button type="primary" style="width: 100%; margin-bottom: 10px" @click="getSelect"> <a-button type="primary" style="width: 100%; margin-bottom: 10px" @click="getSelect">
查询 查询
</a-button> </a-button>
@ -89,15 +93,15 @@
// list // list
const options1 = ref<SelectProps['options']>([]); const options1 = ref<SelectProps['options']>([]);
// list // list
const options2 = ref<SelectProps['options']>([]); const options2 = ref<SelectProps['options']>([]);
const mode = ref<String>('1'); const mode = ref<String>('1');
// //
const selectedValue = ref<string | number | null | undefined>(); const selectedValue = ref<string | number | null | undefined>();
// //
const frequencyValue = ref<string | undefined>(); const dateTypeValue = ref<string | undefined>();
// //
const dateRange = ref<[Dayjs, Dayjs] | undefined>(); const dateValue = ref<[Dayjs, Dayjs] | undefined>();
// //
const getOptionsList = async () => { const getOptionsList = async () => {
@ -115,20 +119,12 @@
} }
options2.value = [ options2.value = [
{ {
value: '1', value: 'month',
label: '5分钟', label: '月',
},
{
value: '2',
label: '10分钟',
}, },
{ {
value: '3', value: 'year',
label: '30分钟', label: '年',
},
{
value: '4',
label: '1小时',
}, },
]; ];
}; };
@ -691,9 +687,9 @@
} }
}; };
const onChange = (val: RangeValue) => { // const onChange = (val: RangeValue) => {
dateRange.value = val; // dateRange.value = val;
}; // };
const onCalendarChange = (val: RangeValue) => { const onCalendarChange = (val: RangeValue) => {
dates.value = val; dates.value = val;
@ -716,8 +712,8 @@
options2, options2,
mode, mode,
selectedValue, selectedValue,
frequencyValue, dateTypeValue,
dateRange, dateValue,
getOptionsList, getOptionsList,
getSelect, getSelect,
getSelect11, getSelect11,
@ -725,7 +721,7 @@
disabledDate, disabledDate,
onCalendarChange, onCalendarChange,
onOpenChange, onOpenChange,
onChange, // onChange,
hackValue, hackValue,
treeLoading, treeLoading,
changeEnergyType, changeEnergyType,

160
hx-ai-intelligent/src/view/monitor/environmentMonitor/aggregateData/index.vue

File diff suppressed because one or more lines are too long

4
hx-op/src/config/app.config.ts

@ -89,8 +89,8 @@ export const appConfig = {
// 修改密码配置 // 修改密码配置
updatePassWordInfo: { updatePassWordInfo: {
title: '修改密码', title: '修改密码',
subtitle: 'huaxing平台', subtitle: 'huaxing管理平台',
api: '/api/web/objs/User/changePassword', api: '/carbon-smart/api/user/update/password',
}, },
// headerBellInfo: { // headerBellInfo: {
// isShow: true, // isShow: true,

16
lib/saas/view/service/updatePassWord.vue

@ -19,7 +19,7 @@
<ns-form <ns-form
style="width: 100%; margin: auto" style="width: 100%; margin: auto"
ref="formOneRef" ref="formOneRef"
formLayout="修改" formLayout="vertical"
:schemas="formSchema" :schemas="formSchema"
:model="data" /> :model="data" />
<div class="step-box"> <div class="step-box">
@ -32,8 +32,6 @@
</div> </div>
</div> </div>
</a-layout-content> </a-layout-content>
<a class="toLogin" @click="toLogin" v-show="step === 0">登录已有豪恩账号 ></a>
<!-- <a-layout-footer>Copyright 2021 xu科技 All Rights Reserved</a-layout-footer> -->
</a-layout> </a-layout>
</div> </div>
</template> </template>
@ -69,7 +67,7 @@
const { navigateBackV2: navigateBack } = useNavigate(); const { navigateBackV2: navigateBack } = useNavigate();
const formSchema = reactive([ const formSchema = reactive([
{ {
field: 'oldPassword', field: 'originPassword',
label: '原密码', label: '原密码',
component: 'NsInputPassword', component: 'NsInputPassword',
componentProps: { componentProps: {
@ -86,7 +84,7 @@
}, },
{ {
field: 'newPassword', field: 'password',
label: '新密码', label: '新密码',
component: 'NsInputPassword', component: 'NsInputPassword',
componentProps: { componentProps: {
@ -147,7 +145,7 @@
if (!value) { if (!value) {
return; return;
} }
if (value !== data.newPassword) { if (value !== data.password) {
return Promise.reject('两次密码不一致'); return Promise.reject('两次密码不一致');
} }
}, },
@ -166,14 +164,14 @@
async function update() { async function update() {
try { try {
const res = await http.post(configStore.updatePassWordInfo?.api, data); const res = await http.post(configStore.updatePassWordInfo?.api, data);
if (res.success) { // if (res.success) {
NsMessage.success('修改成功,需重新登陆', 1, () => { NsMessage.success('修改成功,需重新登陆', 1, () => {
Cookies.remove(`${import.meta.env.VITE_PUBLIC_PATH}-nervsid`); Cookies.remove(`${import.meta.env.VITE_PUBLIC_PATH}-nervsid`);
sessionStorage.clear(); sessionStorage.clear();
router.push('/login'); router.replace('/login');
authorizationStore.clearAuthorization(); authorizationStore.clearAuthorization();
}); });
} // }
loading.value = false; loading.value = false;
} catch (err) { } catch (err) {
loading.value = false; loading.value = false;

12
lib/saas/view/system/login.vue

@ -131,6 +131,8 @@
}); });
validator(null, value?.code) validator(null, value?.code)
.then(() => { .then(() => {
console.log('登录');
// //
rememberFunc(data); rememberFunc(data);
loading.value = true; loading.value = true;
@ -257,13 +259,13 @@
created() { created() {
const _this = this; const _this = this;
window.sessionStorage.clear(); window.sessionStorage.clear();
document.onkeydown = function (e) { // document.onkeydown = function (e) {
const key = window.event === undefined ? e.keyCode : window.event.keyCode; // const key = window.event === undefined ? e.keyCode : window.event.keyCode;
key === 13 ? _this.submit() : ''; // key === 13 ? _this.submit() : '';
}; // };
}, },
beforeUnmount() { beforeUnmount() {
document.onkeydown = function (e) {}; // document.onkeydown = function (e) {};
}, },
mounted() { mounted() {

Loading…
Cancel
Save