Browse Source

feat: 分组管理

main
xuziqiang 6 months ago
parent
commit
c4d7573cbb
  1. 19
      hx-ai-intelligent/src/router/equipmentManage.ts
  2. 209
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  3. 7
      hx-ai-intelligent/src/view/equipmentManage/group/index.vue
  4. 90
      hx-ai-intelligent/src/view/equipmentManage/group/mock.json
  5. 6
      hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts

19
hx-ai-intelligent/src/router/equipmentManage.ts

@ -24,6 +24,25 @@ const equipment = {
},
],
},
{
path: 'group',
name: 'Group',
meta: { title: '分组管理', hideChildren: true, icon: 'dicizhishou' },
component: Base,
redirect: { name: 'GroupIndex' },
children: [
{
path: 'index',
name: 'GroupIndex',
component: () => import('/@/view/equipmentManage/group/index.vue'),
meta: {
title: '分组管理',
keepAlive: true,
backApi: [],
},
},
],
},
],
};
export default equipment;

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

@ -0,0 +1,209 @@
import { dateUtil } from '/nerv-lib/util/date-util';
import data from './mock.json';
import { http } from '/nerv-lib/util';
import { ref } from 'vue';
const tableKeyMap = [
{
title: '来源企业',
dataIndex: 'id',
},
{
title: '设备id',
dataIndex: 'deviceCode',
},
{
title: '设备编号',
dataIndex: 'deviceName',
textNumber: 8,
textEllipsis: true,
},
{
title: '分组名称',
dataIndex: 'position',
},
{
title: '设备品牌/型号',
dataIndex: 'position',
},
{
title: '设备状态',
dataIndex: 'position',
},
];
const doWnload = (url) => {
const a = document.createElement('a');
document.body.appendChild(a);
a.href = encodeURI(url);
//设置下载的文件名
// a.download = fileName.value;
//触发a标签的点击事件,进行下载
a.click();
};
const mockData = ref(data.listData);
export const tableConfig = {
title: '设备台账',
// api: '/carbon_emission/device/getDeviceList',
value: mockData.value,
treeConfig: {
defaultExpandAll: true,
api: () => {
return Promise.resolve(data);
},
},
rowSelection: () => {
return {
columnWidth: 30,
};
},
headerActions: [
{
label: '编辑',
name: 'groupEdit',
type: 'primary',
handle: (a, b) => {
console.log(a, b);
},
},
{
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');
},
},
{
label: '批量分组',
name: 'groupTemDownload',
type: 'primary',
},
{
label: '公式编辑',
name: 'groupTemDownload',
type: 'primary',
},
],
columns: tableKeyMap,
columnActions: {
title: '操作',
actions: [
{
label: '删除',
name: 'FeedBackDetail',
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',
};

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

@ -0,0 +1,7 @@
<template>
<ns-view-list-table v-bind="tableConfig" />
</template>
<script lang="ts" setup>
import { tableConfig } from './config';
</script>
<style lang="less" scoped></style>

90
hx-ai-intelligent/src/view/equipmentManage/group/mock.json

@ -0,0 +1,90 @@
{
"data":[
{
"title": "1号楼",
"key": "A001",
"children": [
{
"title": "1号楼空调用电",
"key": "A002"
},
{
"title": "1号楼照明用电",
"key": "A003"
}
]
},
{
"title": "2号楼(A005)",
"key": "A004",
"children": [
{
"title": "2号楼空调用电(A007)",
"key": "A006"
}
]
},
{
"title": "3号楼",
"key": "A008",
"children": [
{
"title": "3号楼空调用电",
"key": "A009"
},
{
"title": "3号楼照明用电",
"key": "A010"
}
]
}
],
"listData":[
{
"id": "d4",
"isDel": "0",
"officesId": "84",
"deviceCode": "37430200143",
"deviceName": "地听测试电表",
"category": "1",
"type": "1001",
"energyCount": "1",
"serialNumber": "69",
"pidCode": null,
"brand": "",
"types": "",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": "84566",
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "cupidatat nisi ea ad",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": null,
"children": null,
"devicePointList": null,
"insertUser": null
}
]
}

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

@ -1,11 +1,9 @@
import { dateUtil } from '/nerv-lib/util/date-util';
import { data } from './mock.json';
import { origanizemanage } from '/@/api/origanizemanage';
import data from './mock.json';
export const tableConfig = {
title: '设备台账',
// api: '/carbon_emission/device/getDeviceList',
api: origanizemanage.list,
api: '/carbon_emission/device/getDeviceList',
treeConfig: {
defaultExpandAll: true,
api: () => {

Loading…
Cancel
Save