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