diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 25961d7..b2cb0da 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { }, plugins: ['react', '@typescript-eslint', 'prettier'], // 添加 prettier 插件 rules: { + camelcase: 'off', 'vue/require-explicit-emits': 'off', // 关闭 emits 声明检查 'vue/v-on-event-hyphenation': 'off', 'prettier/prettier': 'off', diff --git a/web/public/config/columnList.js b/web/public/config/columnList.js index 1af2d2b..e1fcec5 100644 --- a/web/public/config/columnList.js +++ b/web/public/config/columnList.js @@ -1,3 +1,4 @@ +import { deviceTypeList, logTypes } from '@/utils/config' export const columnList = [ { page: 'user', @@ -113,6 +114,46 @@ export const columnList = [ } ] }, + { + page: 'permission', + columns: [ + { + title: '权限ID', + dataIndex: 'permission_id', + key: 'permission_id', + ellipsis: true, + // filterable: true, + fixed: 'left' + }, + { + title: '权限名称', + dataIndex: 'name', + key: 'name' + // filterable: true + }, + { + title: '权限描述', + dataIndex: 'describe', + key: 'describe', + ellipsis: true + // filterable: true + }, + + { + title: '是否启用', + dataIndex: 'is_open', + key: 'is_open', + scopedSlots: { customRender: 'is_open' } + } + + // { + // title: '操作', + // dataIndex: 'operate', + // key: 'operate', + // scopedSlots: { customRender: 'action' } + // } + ] + }, { page: 'station', columns: [ @@ -139,16 +180,12 @@ export const columnList = [ { title: '场站经度', dataIndex: 'lon', - width: 50, key: 'lon' - // filterable: true }, { title: '场站纬度', dataIndex: 'lat', - width: 50, key: 'lat' - // filterable: true }, { title: '储能容量', @@ -164,10 +201,9 @@ export const columnList = [ // filterable: true }, { - title: '场站类别', + title: '储能容量', dataIndex: 'capacity', - key: 'capacity', - scopedSlots: { customRender: 'capacity' } + key: 'capacity' }, { title: '场站状态', @@ -177,9 +213,9 @@ export const columnList = [ }, { title: '场站运行模式', - dataIndex: 'work_mode_id', - key: 'work_mode_id', - scopedSlots: { customRender: 'work_mode_id' } + dataIndex: 'work_mode', + key: 'work_mode', + scopedSlots: { customRender: 'work_mode' } }, { title: '场站运行策略', @@ -188,6 +224,229 @@ export const columnList = [ scopedSlots: { customRender: 'policy_id' } }, + { + title: '操作', + dataIndex: 'operate', + key: 'operate', + scopedSlots: { customRender: 'action' } + } + ] + }, + { + page: 'device', + columns: [ + { + title: '设备ID', + dataIndex: 'device_id', + key: 'device_id', + ellipsis: true, + fixed: 'left' + }, + { + title: '所属场站', + dataIndex: 'station_id', + key: 'station_id' + // filterable: true + }, + { + title: '设备类型', + dataIndex: 'type', + key: 'type', + type: 'slot', + scopedSlots: { customRender: 'type' } + }, + { + title: '设备名称', + dataIndex: 'name' + }, + { + title: '设备编号', + dataIndex: 'code' + }, + + { + title: '厂家信息', + dataIndex: 'factory' + }, + { + title: '厂家电话', + dataIndex: 'factory_tel' + }, + { + title: '是否启用', + dataIndex: 'is_open', + key: 'is_open', + align: 'center', + scopedSlots: { customRender: 'isEnable' } + }, + + { + title: '属性参数', + dataIndex: 'attrs' + }, + { + title: '操作', + dataIndex: 'operate', + key: 'operate', + scopedSlots: { customRender: 'action' } + } + ] + }, + { + page: 'alarmLog', + columns: [ + { + title: '日志ID', + dataIndex: 'log_id' + }, + + { + title: '日志类型', + dataIndex: 'type', + key: 'type', + width: 120, + scopedSlots: { customRender: 'type' } + }, + { + title: '操作用户', + dataIndex: 'user_id', + key: 'user_id', + width: 120 + }, + { + title: '设备ID', + dataIndex: 'device_id', + key: 'device_id' + }, + { + title: '日志内容', + dataIndex: 'content', + key: 'content', + ellipsis: true + }, + { + title: '记录时间', + dataIndex: 'create_time', + key: 'create_time', + align: 'center', + ellipsis: true, + width: 180 + }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + ellipsis: true, + scopedSlots: { customRender: 'status' }, + width: 80, + align: 'center' + }, + { + title: '操作', + dataIndex: 'operate', + key: 'operate', + scopedSlots: { customRender: 'action' } + } + ] + }, + { + page: 'log', + columns: [ + { + title: '用户', + dataIndex: 'userName', + width: 180 + }, + + { + title: '日志类型', + dataIndex: 'type', + key: 'type', + width: 120, + + scopedSlots: { customRender: 'type' } + }, + { + title: '操作类型', + dataIndex: 'opType', + key: 'opType', + width: 120, + + scopedSlots: { customRender: 'opType' } + }, + { + title: 'ip', + dataIndex: 'ip', + key: 'ip' + }, + { + title: '内容', + dataIndex: 'msg', + key: 'msg', + ellipsis: true + }, + { + title: '生成时间', + dataIndex: 'createTime', + key: 'createTime', + align: 'center', + ellipsis: true, + width: 180 + }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + ellipsis: true, + scopedSlots: { customRender: 'status' }, + width: 80, + align: 'center' + }, + { + title: '操作', + dataIndex: 'operate', + key: 'operate', + width: 80, + scopedSlots: { customRender: 'action' } + } + ] + }, + { + page: 'serviceApi', + columns: [ + { + title: '接口ID', + dataIndex: 'api_id', + key: 'api_id', + ellipsis: true, + // filterable: true, + fixed: 'left' + }, + { + title: '接口名称', + dataIndex: 'name', + key: 'name' + // filterable: true + }, + { + title: '接口描述', + dataIndex: 'describe', + key: 'describe' + // filterable: true + }, + { + title: '接口参数', + dataIndex: 'params', + key: 'params' + }, + + { + title: '是否启用', + dataIndex: 'is_open', + key: 'is_open', + scopedSlots: { customRender: 'is_open' } + }, + { title: '操作', dataIndex: 'operate', @@ -277,8 +536,54 @@ export const roleOptions = [ value: '', key: 'permission', type: 'slot', - slotName: 'permission', - className: 'item-l' + slotName: 'treetable', + className: 'item-l', + tableData: [], + selectTableData: [], + columns: [ + { + title: '名称', + dataIndex: 'name', + key: 'name', + ellipsis: true, + filterable: true, + fixed: 'left' + }, + { + title: '页面路径', + dataIndex: 'route', + key: 'route' + // filterable: true + }, + { + title: '是否允许新增操作', + dataIndex: 'is_add', + key: 'is_add', + align: 'center', + scopedSlots: { customRender: 'is_add' } + }, + { + title: '是否允许删除操作', + dataIndex: 'is_del', + key: 'is_del', + align: 'center', + scopedSlots: { customRender: 'is_del' } + }, + { + title: '是否允许编辑操作', + dataIndex: 'is_edit', + key: 'is_edit', + align: 'center', + scopedSlots: { customRender: 'is_edit' } + }, + { + title: '是否允许查看操作', + dataIndex: 'is_view', + key: 'is_view', + align: 'center', + scopedSlots: { customRender: 'isQuery' } + } + ] }, { // 0:禁用; 1:启用 @@ -374,7 +679,7 @@ export const stationOptions = [ label: '场站运行模式', value: undefined, - key: 'work_mode_id', + key: 'work_mode', type: 'select', list: [ { @@ -417,6 +722,210 @@ export const stationOptions = [ ruleForm: {} } ] +export const deviceOptions = [ + { + title: '基础信息', + icon: 'icon-xinxi', + list: [ + { + label: '编号', + value: '', + key: 'code', + type: 'input' + }, + { + label: '名称', + value: '', + key: 'name', + type: 'input' + }, + { + label: '类型', + value: '', + key: 'type', + type: 'select', + list: deviceTypeList, + options: { + label: 'label', + value: 'value' + } + }, + + { + label: '所属场站', + value: undefined, + key: 'station_id', + type: 'select', + list: [], + options: { + label: 'name', + value: 'station_id' + } + // slotName: 'searchSelect' + }, + { + label: '厂家', + value: '', + key: 'factory', + type: 'input' + }, + { + label: '厂家电话', + value: '', + key: 'factory_tel', + type: 'input' + }, + { + label: '是否启用', + value: '', + key: 'is_open', + type: 'switch' + } + ], + ruleForm: {} + }, + { + title: '设备属性参数', + icon: 'icon-xinxi', + list: [ + { + label: '额定电压', + value: '', + key: 'rated_voltage', + type: 'input-number' + }, + { + label: '额定电流', + value: '', + key: 'rated_current', + type: 'input-number' + }, + { + label: '额定功率', + value: '', + key: 'reted_power', + type: 'input-number' + }, + + { + label: '额定容量', + value: undefined, + key: 'rated_capacity', + type: 'input-number' + } + ], + ruleForm: {} + } +] +// log +export const alarmlogOptions = [ + { + title: '基础信息', + icon: 'icon-xinxi', + list: [ + { + label: '日志ID', + value: '', + key: 'log_id', + type: 'input' + }, + { + label: '日志类型', + value: '', + key: 'type', + type: 'select', + list: logTypes, + disabled: true + }, + { + label: '操作用户ID', + value: '', + key: 'user_id', + type: 'input', + disabled: true + }, + { + label: '设备ID', + value: '', + key: 'device_id', + type: 'input', + disabled: true + }, + { + label: '日志内容', + value: '', + key: 'content', + type: 'textarea', + disabled: true, + className: 'item-l', + rows: 8 + }, + { + label: '记录时间', + value: '', + key: 'create_time', + type: 'input' + }, + + { + label: '状态', + type: 'select', + list: [ + { value: 0, label: '异常' }, + { value: 1, label: '正常' } + ], + value: [], + key: 'status' + } + ], + ruleForm: {} + } +] +export const serviceApiOptions = [ + { + title: '基础信息', + icon: 'icon-xinxi', + list: [ + { + label: '接口名称', + value: '', + key: 'name', + type: 'input' + }, + { + label: '接口参数', + value: '', + key: 'params', + type: 'input' + }, + { + label: '接口描述', + value: '', + key: 'describe', + type: 'textarea' + }, + + { + label: '是否启用', + value: '', + key: 'is_open', + type: 'switch', + className: 'item-l', + list: [ + { + label: '禁用', + value: '0' + }, + { + label: '启用', + value: '1' + } + ] + } + ], + ruleForm: {} + } +] export const userFormRules = { account: [ @@ -452,3 +961,43 @@ export const stationFormRules = { } ] } +export const deviceFormRules = { + name: [ + { + trigger: 'blur', + required: true, + message: '请输入设备名称' + } + ], + code: [ + { + trigger: 'blur', + required: true, + message: '请输入设备编号' + } + ], + type: [ + { + trigger: 'change', + required: true, + message: '请选择设备类型' + } + ], + station_id: [ + { + trigger: 'change', + required: true, + message: '请选择场站名称' + } + ] +} + +export const serviceApiFormRules = { + name: [ + { + trigger: 'blur', + required: true, + message: '请输入接口名称' + } + ] +} diff --git a/web/public/index.html b/web/public/index.html index 11a9498..c6133d9 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -6,7 +6,7 @@ <%= htmlWebpackPlugin.options.title %> - +