Browse Source

feat: 设备台账联调

main
xuziqiang 3 months ago
parent
commit
e5cd75c845
  1. 10
      hx-ai-intelligent/src/api/deviceManage.ts
  2. 3
      hx-ai-intelligent/src/config/app.config.ts
  3. 2
      hx-ai-intelligent/src/router/organizationManage.ts
  4. 153
      hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts
  5. 8
      hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue
  6. 4
      lib/component/table/table-header.vue
  7. 2
      lib/component/tree/tree-api.vue
  8. 2
      lib/saas/view/system/layout/header.vue

10
hx-ai-intelligent/src/api/deviceManage.ts

@ -0,0 +1,10 @@
const BASE_URL = '/carbon-smart';
export enum device {
queryDeviceTree = `${BASE_URL}/deviceInfo/queryDeviceTree`,
queryDevicePage = `${BASE_URL}/deviceInfo/queryDevicePage`,
dropArea = `${BASE_URL}/deviceInfo/dropArea`,
}
export enum group {
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`,
}

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

@ -19,7 +19,7 @@ export const appConfig = {
projectType: 'web', projectType: 'web',
baseApi: '/api', baseApi: '/api',
projectName: '济阳站_AI智能BAS系统', projectName: '济阳站_AI智能BAS系统',
enablePermissions: true, enablePermissions: false,
// themeColor: '#eee', // themeColor: '#eee',
siderPosition: 'left', siderPosition: 'left',
baseHeader: '/parkingManage', baseHeader: '/parkingManage',
@ -92,6 +92,7 @@ export const appConfig = {
permissionVos: 'permissionVos', permissionVos: 'permissionVos',
}); });
sessionStorage.setItem('ORGID', info.orgId); sessionStorage.setItem('ORGID', info.orgId);
selectDefaultValue.value = info.orgId;
return { data: { ...trD } }; return { data: { ...trD } };
}); });
}, },

2
hx-ai-intelligent/src/router/organizationManage.ts

@ -10,7 +10,7 @@ const organizationManage = {
name: 'UserManage', name: 'UserManage',
meta: { title: '用户管理', hideChildren: true, icon: 'zuzhiguanli' }, meta: { title: '用户管理', hideChildren: true, icon: 'zuzhiguanli' },
component: Base, component: Base,
redirect: { name: 'userManageIndex' }, redirect: { name: 'UserManageIndex' },
children: [ children: [
{ {
path: 'index', path: 'index',

153
hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts

@ -1,142 +1,191 @@
import { dateUtil } from '/nerv-lib/util/date-util'; import { dateUtil } from '/nerv-lib/util/date-util';
import data from './mock.json'; import { device } from '/@/api/deviceManage';
export const tableConfig = { import { ref } from 'vue';
title: '设备台账', import { http } from '/nerv-lib/util';
// api: '/carbon_emission/device/getDeviceList',
value: data.dataSource, export const tableConfig = (orgId) => {
return ref({
title: '设备信息',
api: device.queryDevicePage,
params: { orgId },
treeConfig: { treeConfig: {
header: { header: {
icon: 'orgLink', icon: 'orgLink',
title: '设备类别', title: '设备类别',
}, },
params: { orgId },
dynamicParams: 'code',
defaultExpandAll: true, defaultExpandAll: true,
api: () => { api: device.queryDeviceTree,
return new Promise((resolve) => { fieldNames: { title: 'deviceType', key: 'code' },
setTimeout(() => {
resolve(data);
}, 100);
});
},
formConfig: { formConfig: {
schemas: [ schemas: [
{ {
field: 'name', field: 'deviceType',
label: '设备名称', label: '设备名称',
component: 'NsInput', component: 'NsInput',
autoSubmit: true, autoSubmit: true,
componentProps: { componentProps: {
placeholder: '请输入', placeholder: '请输入设备类型',
}, },
}, },
], ],
}, },
}, },
params: {
page: 0,
pageSize: 10,
},
rowSelection: null, rowSelection: null,
columns: [ columns: [
{ {
title: '设备名称', title: '设备名称',
dataIndex: 'id', dataIndex: 'deviceName',
}, },
{ {
title: '设备型号', title: '设备型号',
dataIndex: 'deviceCode', dataIndex: 'deviceModel',
}, },
{ {
title: 'SN码', title: 'SN码',
dataIndex: 'deviceName', dataIndex: 'snCode',
textNumber: 8, textNumber: 5,
textEllipsis: true, textEllipsis: true,
}, },
{ {
title: '设备一级区域', title: '设备一级区域',
dataIndex: 'position', dataIndex: 'device1Area',
textNumber: 5,
textEllipsis: true,
}, },
{ {
title: '设备二级区域', title: '设备二级区域',
dataIndex: 'position', dataIndex: 'device2Area',
textNumber: 5,
textEllipsis: true,
}, },
{ {
title: '设备详细位置', title: '设备详细位置',
dataIndex: 'position', dataIndex: 'deviceAddress',
textNumber: 5,
textEllipsis: true,
}, },
{ {
title: '设备规格', title: '设备规格',
dataIndex: 'position', dataIndex: 'deviceTp',
}, },
{ {
title: '设备厂商纳税人识别号', title: '设备厂商纳税人识别号',
dataIndex: 'position', dataIndex: 'deviceRatepay',
},
{
title: '设备厂商',
dataIndex: 'manufacturer',
}, },
{ {
title: '厂商联系人', title: '厂商联系人',
dataIndex: 'position', dataIndex: 'contactPerson',
}, },
{ {
title: '设备描述', title: '设备描述',
dataIndex: 'position', dataIndex: 'deviceDesc',
textNumber: 5,
textEllipsis: true,
}, },
{ {
title: 'IP地址', title: 'IP地址',
dataIndex: 'position', dataIndex: 'ipAddress',
}, },
{ {
title: '生产日期', title: '生产日期',
dataIndex: 'position', dataIndex: 'manufactureDate',
}, },
{ {
title: '采购日期', title: '采购日期',
dataIndex: 'position', dataIndex: 'purchaseDate',
}, },
{ {
title: '启用日期', title: '启用日期',
dataIndex: 'position', dataIndex: 'startDate',
}, },
{ {
title: '设备成本(元)', title: '设备成本(元)',
dataIndex: 'position', dataIndex: 'equipmentCost',
textNumber: 6,
}, },
{ {
title: '使用期限', title: '使用期限',
dataIndex: 'position', dataIndex: 'usagePeriod',
textNumber: 4,
customRender: ({ value }) => `${value}`,
}, },
{ {
title: '额定功率', title: '额定功率',
dataIndex: 'position', dataIndex: 'ratedPower',
textNumber: 5,
// customRender: ({ value }) => `${value}年`,
}, },
{ {
title: '特殊参数', title: '特殊参数',
dataIndex: 'position', textNumber: 5,
dataIndex: 'specialParameters',
}, },
], ],
formConfig: { formConfig: {
schemas: [ schemas: [
{ {
field: 'name', field: 'deviceName',
label: '设备名称', label: '设备名称',
component: 'NsInput', component: 'NsInput',
componentProps: { componentProps: {
placeholder: '请输入', placeholder: '请输入设备名称',
}, },
}, },
{ {
field: 'provider', field: 'areas',
label: '设备厂商', label: '设备区域',
component: 'NsInput', component: 'NsCascader',
format: (record) => {
console.log(record);
return record?.reduce(
(pre, cur) => {
const len = cur?.length - 1;
pre[len].push(cur[len]);
return pre;
},
[[], []],
);
},
fieldMap: ['area1', 'area2'],
componentProps: { componentProps: {
placeholder: '请输入', placeholder: '请选择设备区域',
multiple: true,
loadData: (selectedOptions, options) => {
const targetOption = selectedOptions[selectedOptions.length - 1];
if (!selectedOptions.length) {
http.post(device.dropArea, { orgId }).then((res) => {
options.value = res.data?.map((item) => {
return { label: item, value: item, children: [], isLeaf: false };
});
});
}
const value = targetOption?.value;
if (targetOption) {
targetOption.loading = true;
http.post(device.dropArea, { device1Area: value, orgId }).then((res) => {
targetOption.loading = false;
targetOption.children = res.data?.map((item) => {
return { label: item, value: item, children: [], isLeaf: true };
});
});
}
},
}, },
}, },
{ {
field: 'payWay', field: 'manufacturer',
label: '设备区域', label: '设备厂商',
component: 'NsSelect', component: 'NsInput',
componentProps: { componentProps: {
placeholder: '请选择', placeholder: '请输入设备厂商',
options: [ options: [
{ {
label: '全部', label: '全部',
@ -149,27 +198,30 @@ export const tableConfig = {
field: 'createTime', field: 'createTime',
label: '生产日期', label: '生产日期',
component: 'NsRangePicker', component: 'NsRangePicker',
fieldMap: ['queryStartDate', 'queryEndDate'], fieldMap: ['manufactureBeginDate', 'manufactureEndDate'],
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
placeholder: ['设备生产开始日期', '设备生产结束日期'],
}, },
}, },
{ {
field: 'createTime1', field: 'createTime1',
label: '采购日期', label: '采购日期',
component: 'NsRangePicker', component: 'NsRangePicker',
fieldMap: ['queryStartDate', 'queryEndDate'], fieldMap: ['purchaseBeginDate', 'purchaseEndDate'],
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
placeholder: ['设备采购开始日期', '设备采购结束日期'],
}, },
}, },
{ {
field: 'createTime2', field: 'createTime2',
label: '启用日期', label: '启用日期',
component: 'NsRangePicker', component: 'NsRangePicker',
fieldMap: ['queryStartDate', 'queryEndDate'], fieldMap: ['startBeginDate', 'startEndDate'],
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
placeholder: ['设备启用开始日期', '设备启用结束日期'],
}, },
}, },
], ],
@ -177,4 +229,5 @@ export const tableConfig = {
}, },
// pagination: { pageSizeOptions: false }, // pagination: { pageSizeOptions: false },
rowKey: 'uuid', rowKey: 'uuid',
});
}; };

8
hx-ai-intelligent/src/view/equipmentManage/ledger/index.vue

@ -1,8 +1,14 @@
<template> <template>
<ns-view-list-table v-bind="tableConfig" /> <ns-view-list-table v-bind="config" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { tableConfig } from './config'; import { tableConfig } from './config';
import { computed, nextTick, ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const config = tableConfig(orgId.value);
defineOptions({ defineOptions({
name: 'LedgerIndex', // name name: 'LedgerIndex', // name
}); });

4
lib/component/table/table-header.vue

@ -1,9 +1,9 @@
<!-- @format --> <!-- @format -->
<template> <template>
<div class="ns-table-header" v-if="!isEmpty(getActions)"> <div class="ns-table-header">
<div class="ns-table-title ns-title-extra-box" v-if="tableTitle">{{ tableTitle }}</div> <div class="ns-table-title ns-title-extra-box" v-if="tableTitle">{{ tableTitle }}</div>
<div class="ns-table-header-action"> <div class="ns-table-header-action" v-if="!isEmpty(getActions)">
<slot name="header" :data="data"></slot> <slot name="header" :data="data"></slot>
<template v-for="item in getActions" :key="item.name"> <template v-for="item in getActions" :key="item.name">
<ns-button @click="item.finalHandle()" :disabled="item.dynamicDisabled" :type="item.type"> <ns-button @click="item.finalHandle()" :disabled="item.dynamicDisabled" :type="item.type">

2
lib/component/tree/tree-api.vue

@ -66,7 +66,7 @@
treeState.loading = loading; treeState.loading = loading;
}; };
const httpPrams = computed(() => { const httpPrams = computed(() => {
return { ...route.params, ...route.query, ...props.defaultParams }; return { ...route.params, ...route.query, ...props.params };
}); });
const getData = (params = {}) => { const getData = (params = {}) => {

2
lib/saas/view/system/layout/header.vue

@ -431,7 +431,7 @@
flex: 1; flex: 1;
.projectTitle { .projectTitle {
font-size: 28px; font-size: 28px;
font-weight: 900; font-weight: 500;
letter-spacing: 2.33px; letter-spacing: 2.33px;
line-height: 40px; line-height: 40px;
color: @primary-color; color: @primary-color;

Loading…
Cancel
Save