diff --git a/web/.eslintrc.js b/web/.eslintrc.js index ca360bb..25961d7 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -54,7 +54,7 @@ module.exports = { 'no-this-before-super': 0, // 在调用super()之前不能使用this或super 'no-undef': 2, // 不能有未定义的变量 'no-use-before-define': 2, // 未定义前不能使用 - camelcase: 2, // 强制驼峰法命名 + camelcase: 'off', // 关闭强制驼峰法命名 'vue/multi-word-component-names': 0, 'jsx-quotes': [2, 'prefer-double'], // 强制在JSX属性(jsx-quotes)中一致使用双引号 // 'react/sort-comp': 2, // 强制组件方法顺序 diff --git a/web/public/config/columnList.js b/web/public/config/columnList.js index 124b3ed..1af2d2b 100644 --- a/web/public/config/columnList.js +++ b/web/public/config/columnList.js @@ -7,119 +7,48 @@ export const columnList = [ dataIndex: 'user_id', key: 'user_id', ellipsis: true, - filterable: true, + // filterable: true, fixed: 'left' }, { title: '用户名', dataIndex: 'account', - key: 'account', - filterable: true + key: 'account' + // filterable: true }, { title: '姓名', dataIndex: 'name', key: 'name', - ellipsis: true, - filterable: true + ellipsis: true + // filterable: true }, { title: '性别', dataIndex: 'gender', key: 'gender', - filterable: true, scopedSlots: { customRender: 'gender' } }, { title: '年龄', dataIndex: 'age', - key: 'age', - filterable: true + key: 'age' }, { title: '手机号', dataIndex: 'phone', - key: 'phone', - filterable: true + key: 'phone' }, { title: '邮箱', dataIndex: 'email', - key: 'email', - filterable: true - }, - { - title: '角色ID', - dataIndex: 'role_id', - key: 'role_id', - filterable: true + key: 'email' }, + { title: '角色名称', dataIndex: 'role_name', - key: 'role_name', - filterable: true - }, - { - title: '操作', - dataIndex: 'operate', - key: 'operate', - scopedSlots: { customRender: 'action' } - } - ] - }, - { - page: 'menu', - columns: [ - { - title: '菜单名称', - dataIndex: 'name', - key: 'name', - ellipsis: true, - filterable: true, - fixed: 'left' - }, - { - title: '菜单路由', - dataIndex: 'route', - key: 'route', - filterable: true - }, - { - title: '顺序', - dataIndex: 'seq', - align: 'center', - key: 'seq', - ellipsis: true, - width: 120, - - filterable: true - }, - { - title: '图标', - dataIndex: 'icon', - align: 'center', - key: 'icon', - width: 120, - scopedSlots: { customRender: 'icon' } - }, - { - title: '创建时间', - dataIndex: 'createTime', - key: 'createTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 - }, - { - title: '更新时间', - dataIndex: 'updateTime', - key: 'updateTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 + key: 'role_name' }, { title: '操作', @@ -133,210 +62,393 @@ export const columnList = [ page: 'role', columns: [ { - title: '角色名称', - dataIndex: 'name', - key: 'name', + title: '角色ID', + dataIndex: 'role_id', + key: 'role_id', ellipsis: true, - filterable: true, - width: 180, - + // filterable: true, fixed: 'left' }, { - title: '角色类型', - dataIndex: 'type', - key: 'type', - width: 120, - - scopedSlots: { customRender: 'type' } + title: '角色名称', + dataIndex: 'name', + key: 'name' + // filterable: true }, { - title: '描述', - dataIndex: 'desc', - align: 'center', - key: 'desc', + title: '角色描述', + dataIndex: 'describe', + key: 'describe', ellipsis: true + // filterable: true }, { - title: '权限名称', - dataIndex: 'permissions', - align: 'center', - key: 'permissions', - width: 180, - - ellipsis: true, - scopedSlots: { customRender: 'permissions' } + title: '关联权限', + dataIndex: 'permission', + key: 'permission', + scopedSlots: { customRender: 'permission' } + }, + { + title: '是否启用', + dataIndex: 'is_open', + key: 'is_open', + scopedSlots: { customRender: 'is_open' } }, { title: '创建时间', - dataIndex: 'createTime', - key: 'createTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 + dataIndex: 'create_time', + key: 'create_time' }, { title: '更新时间', - dataIndex: 'updateTime', - key: 'updateTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 + dataIndex: 'update_time', + key: 'update_time' }, { title: '操作', dataIndex: 'operate', + key: 'operate', scopedSlots: { customRender: 'action' } } ] }, { - page: 'permission', + page: 'station', columns: [ { - title: '权限名称', + title: '场站ID', + dataIndex: 'station_id', + key: 'station_id', + ellipsis: true, + // filterable: true, + fixed: 'left' + }, + { + title: '场站名称', dataIndex: 'name', - key: 'name', - ellipsis: true, - filterable: true, - fixed: 'left', - width: 180 + key: 'name' + // filterable: true }, { - title: '描述', - dataIndex: 'desc', - key: 'desc' + title: '场站位置', + dataIndex: 'address', + key: 'address' + // filterable: true }, { - title: '是否可查询', - dataIndex: 'isQuery', - key: 'isQuery', - align: 'center', - width: 120, - scopedSlots: { customRender: 'isQuery' } + title: '场站经度', + dataIndex: 'lon', + width: 50, + key: 'lon' + // filterable: true }, { - title: '是否可编辑', - dataIndex: 'isControl', - align: 'center', - key: 'isEdit', - width: 120, - scopedSlots: { customRender: 'isEdit' } + title: '场站纬度', + dataIndex: 'lat', + width: 50, + key: 'lat' + // filterable: true }, { - title: '是否可控制', - dataIndex: 'isEdit', - align: 'center', - key: 'isEdit', - key: 'isControl', - width: 120, - scopedSlots: { customRender: 'isControl' } - }, - - { - title: '创建时间', - dataIndex: 'createTime', - key: 'createTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 + title: '储能容量', + dataIndex: 'capacity', + key: 'capacity' + // filterable: true }, { - title: '更新时间', - dataIndex: 'updateTime', - key: 'updateTime', - align: 'center', - ellipsis: true, - filterable: true, - width: 180 + title: '场站电话', + dataIndex: 'tel', + key: 'tel', + ellipsis: true + // filterable: true + }, + { + title: '场站类别', + dataIndex: 'capacity', + key: 'capacity', + scopedSlots: { customRender: 'capacity' } + }, + { + title: '场站状态', + dataIndex: 'status', + key: 'status', + scopedSlots: { customRender: 'status' } + }, + { + title: '场站运行模式', + dataIndex: 'work_mode_id', + key: 'work_mode_id', + scopedSlots: { customRender: 'work_mode_id' } + }, + { + title: '场站运行策略', + dataIndex: 'policy_id', + key: 'policy_id', + scopedSlots: { customRender: 'policy_id' } }, { title: '操作', dataIndex: 'operate', + key: 'operate', scopedSlots: { customRender: 'action' } } ] } ] -export const options = [ +export const userOptions = [ { title: '基础信息', icon: 'icon-xinxi', list: [ { - label: '名称', + label: '用户名', + value: '', + key: 'account', + type: 'input' + }, + { + label: '姓名', value: '', key: 'name', type: 'input' }, { - label: '账户类型', + label: '性别', value: undefined, - // dataIndex: 'type', - key: 'type', + key: 'gender', type: 'select', list: [ { - label: '虚拟账户', - value: 0 + label: '女', + value: '0' }, { - label: '卡账户', - value: 1 + label: '男', + value: '1' } ] }, - { - label: '账号', - value: [], - key: 'code', + label: '年龄', + value: '', + key: 'age', type: 'input' }, { - label: '用户', + label: '手机号', + value: '', + key: 'phone', + type: 'input' + }, + { + label: '邮箱', + value: '', + key: 'email', + type: 'input' + }, + { + label: '角色名称', + value: undefined, //根据角色id回显角色 + key: 'role_id', + type: 'slot', + slotName: 'role_id' + } + ], + ruleForm: {} + } +] +export const roleOptions = [ + { + title: '基础信息', + icon: 'icon-xinxi', + list: [ + { + label: '角色名称', + value: '', + key: 'name', + type: 'input' + }, + + { + label: '关联权限', + value: '', + key: 'permission', + type: 'slot', + slotName: 'permission', + className: 'item-l' + }, + { + // 0:禁用; 1:启用 + label: '是否启用', value: undefined, - // dataIndex: 'userId', - key: 'userId', - type: 'select', - list: [] + key: 'is_open', + type: 'switch', + className: 'item-l', + + list: [ + { + label: '禁用', + value: '0' + }, + { + label: '启用', + value: '1' + } + ] }, { - label: '余额', + label: '角色描述', value: '', - key: 'money', - type: 'input', - inputType: 'number' + key: 'describe', + type: 'textarea' + } + ], + ruleForm: {} + } +] +export const stationOptions = [ + { + title: '基础信息', + icon: 'icon-xinxi', + list: [ + { + label: '场站名称', + value: '', + key: 'name', + type: 'input' }, { - label: '账户状态', + label: '场站位置', value: '', + key: 'address', + type: 'input' + }, + { + label: '场站经度', + value: '', + key: 'lon', + type: 'input' + }, + { + label: '场站纬度', + value: '', + key: 'lat', + type: 'input' + }, + { + label: '储能容量', + value: '', + key: 'capacity', + type: 'input' + }, + { + label: '场站电话', + value: '', + key: 'tel', + type: 'input' + }, + { + // 0:未启用,1:启用 + label: '场站状态', + value: undefined, key: 'status', + type: 'switch', + className: 'item-l', + + list: [ + { + label: '未启用', + value: '0' + }, + { + label: '启用', + value: '1' + } + ] + }, + { + // 0:未启用,1:启用 + + label: '场站运行模式', + value: undefined, + key: 'work_mode_id', type: 'select', list: [ { - label: '正常', - value: 0 + label: '最优经济化', + value: '1' }, { - label: '注销', - value: 1 + label: '支撑电网稳定', + value: '2' }, { - label: '异常', - value: 9 + label: '自定义', + value: '3' + } + ] + }, + { + // 0:未启用,1:启用 + + label: '场站运行策略', + value: undefined, + key: 'policy_id', + type: 'select', + list: [ + { + label: '削峰套利', + value: '1' + }, + { + label: '需求响应', + value: '2' + }, + { + label: '自发自用', + value: '3' } ] } ], - ruleForm: { - // selectTableData: [], - } + ruleForm: {} } ] + +export const userFormRules = { + account: [ + { + trigger: 'blur', + required: true, + message: '请输入用户名' + } + ], + name: [ + { + trigger: 'blur', + required: true, + message: '请输入姓名' + } + ] +} +export const roleFormRules = { + name: [ + { + trigger: 'blur', + required: true, + message: '请输入角色名称' + } + ] +} +export const stationFormRules = { + name: [ + { + trigger: 'blur', + required: true, + message: '请输入场站名称' + } + ] +} diff --git a/web/src/assets/boxBottom.png b/web/src/assets/boxBottom.png new file mode 100644 index 0000000..b0f42db Binary files /dev/null and b/web/src/assets/boxBottom.png differ diff --git a/web/src/components/ComTable.vue b/web/src/components/ComTable.vue index cc316ef..2e68ecd 100644 --- a/web/src/components/ComTable.vue +++ b/web/src/components/ComTable.vue @@ -360,8 +360,6 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll }) } //表格样式 :deep(.ant-table-tbody) { - color: var(--theme-text-default) !important; - > tr { &:hover { > .ant-table-cell { diff --git a/web/src/components/DetailInfo.vue b/web/src/components/DetailInfo.vue new file mode 100644 index 0000000..1780e76 --- /dev/null +++ b/web/src/components/DetailInfo.vue @@ -0,0 +1,720 @@ + + + + + diff --git a/web/src/components/EditCom.vue b/web/src/components/EditCom.vue new file mode 100644 index 0000000..de72d0f --- /dev/null +++ b/web/src/components/EditCom.vue @@ -0,0 +1,373 @@ + + + + diff --git a/web/src/components/Home/Modal.vue b/web/src/components/Home/Modal.vue index fd7f99f..438c2fc 100644 --- a/web/src/components/Home/Modal.vue +++ b/web/src/components/Home/Modal.vue @@ -132,7 +132,7 @@ export default { station_id: this.stationId, category: 0 } - const res = await getReq('/api/queryStatTotal', query) + const res = await getReq('/queryStatTotal', query) if (res.errcode === 0) { this.modalInfo.allTotal = res.data this.modalInfo.allTotal.runDays = getRunDays(res.data.launch_date) @@ -153,7 +153,7 @@ export default { const query = { station_id: this.stationId, } - const res = await getReq('/api//queryStationInfo', query) + const res = await getReq('//queryStationInfo', query) if (res.errcode === 0) { this.modalInfo.prefabTotal = res.data } else { @@ -177,7 +177,7 @@ export default { end_date: getDateDaysAgo(0) } const categoryObj = { 1: 'energy' } - const res = await getReq('/api/queryStatDayList', query) + const res = await getReq('/queryStatDayList', query) if (res.errcode === 0) { this.modalInfo[categoryObj[category]] = res.data.map((item) => { const { income_charge: incomeCharge, income_elect: incomeElect } = item diff --git a/web/src/components/OperateCom.vue b/web/src/components/OperateCom.vue index 05670d9..dcded15 100644 --- a/web/src/components/OperateCom.vue +++ b/web/src/components/OperateCom.vue @@ -6,8 +6,9 @@ v-for="item in operateList" :key="item.type" type="primary" - style="margin-right: 5px" - :class="['operateCol', item.type]" + size="small" + style="margin-right: 10px" + :class="`btn-${item.type}`" :disabled="item.disabled" @click="munuClick(item.type)" >{{ item.label }} @@ -59,49 +60,7 @@ export default { diff --git a/web/src/components/SearchBox.vue b/web/src/components/SearchBox.vue index 1be2a28..f7bb7f1 100644 --- a/web/src/components/SearchBox.vue +++ b/web/src/components/SearchBox.vue @@ -192,6 +192,7 @@ input:-internal-autofill-selected { color: var(--theme-text-default) !important; } .search { + height:70px; color: #fff; display: flex; flex-direction: column; diff --git a/web/src/main.js b/web/src/main.js index 79445cc..b5a94a2 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -10,6 +10,8 @@ import '@/style/index.scss' import * as echarts from 'echarts' import { setWidth } from '@/utils/column' import { getBtns } from '@/utils/btnList' +import { message } from 'ant-design-vue' + import VueTianditu from 'vue-tianditu' import SearchBox from '@/components/SearchBox.vue' import ComTable from '@/components/ComTable.vue' @@ -22,5 +24,6 @@ app.component('ComTable', ComTable) app.config.globalProperties.$echarts = echarts // 挂载到全局属性 app.config.globalProperties.$setWidth = setWidth // 挂载到全局属性 app.config.globalProperties.$getBtns = getBtns +app.config.globalProperties.$message = message app.use(store).use(router).use(Antd).use(VueTianditu).mount('#app') diff --git a/web/src/request/index.js b/web/src/request/index.js index 0516f59..ae8a733 100644 --- a/web/src/request/index.js +++ b/web/src/request/index.js @@ -1,53 +1,42 @@ import axios from 'axios' -// import openNotification from "../utils/notification"; -// let { config } = window; -// let { baseUrl } = config; +import openNotification from '../utils/notification' +import { message } from 'ant-design-vue' const service = axios.create({ - // baseURL: baseUrl, baseURL: '/api', timeout: 120000 }) service.interceptors.request.use((config) => { const webConfig = config - // if (!['/login'].includes(config.url)) { - // if (localStorage.getItem('token')) { - // webConfig.headers = { - // token: localStorage.getItem('token') - // } - // } - // } return webConfig }) service.interceptors.response.use( (response) => { - // 排除以下接口的错误提示 - const { url } = response.config - const urls = ['/light/', '/serve/delete', '/user/checkRandom'] - const urlFlag = urls.map((item) => { - return url.includes(item) - }) - const res = response.data - if (res.code !== 200) { - if (res.code == 401 || res.tip == '校验token过期') { + if (res.errCode !== 0) { + if ((res.ERR_TOKEN = 2 || res.errmsg == '校验token过期')) { setTimeout(() => { - window.$wujie?.props.jump({ path: '/login' }) + // router.push({ path: '/login' }) }, 1000) - } else if (urlFlag.every((item) => item === false)) { + } else { + console.log(res.errmsg, 'res.errmsg') + message.error(res.errmsg) // openNotification({ - // status: "error", - // desc: res.tip, - // }); + // status: 'error', + // desc: res.tip + // }) } + } else { + console.log(res.errmsg, 'res.errmsg') + + message.error(res.errmsg) } return res }, (error) => { - // console.log(error, 'error 此处添加监控超时处理') if ( error.name === 'AxiosError' && error.message === 'timeout of 120000ms exceeded' && diff --git a/web/src/router/index.js b/web/src/router/index.js index d3bfe95..b6da209 100644 --- a/web/src/router/index.js +++ b/web/src/router/index.js @@ -54,8 +54,8 @@ export const routes = [ { name: 'role', path: 'role', - title: '角色管理' - // component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')s + title: '角色管理', + component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue') }, { name: 'permission', @@ -65,7 +65,8 @@ export const routes = [ { name: 'station', path: 'station', - title: '场站管理' + title: '场站管理', + component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue') }, { name: 'service', diff --git a/web/src/style/antd.scss b/web/src/style/antd.scss index 6bc2912..8f23dea 100644 --- a/web/src/style/antd.scss +++ b/web/src/style/antd.scss @@ -15,6 +15,13 @@ $table-border: #1c797a; $table-bg: #072e4a; $page-border: #cad2dd; //级联器样式,下拉选择器样式输入框等。。。 +.ant-switch { + background: #00fffb; +} + +.ant-switch .ant-switch-handle::before { + background-color: #0a1b2f !important; +} .ant-select, .ant-cascader { .ant-select-selector { @@ -32,17 +39,20 @@ $page-border: #cad2dd; .ant-input, .ant-input-affix-wrapper, .ant-picker, -.ant-input-number - { +.ant-input-number { background: none !important; border: 1px solid $border-color !important; color: #fff; } -:deep(.ant-picker){ - .ant-picker-input >input,.ant-picker-separator{ +.ant-input::placeholder { + color: #ffffff3b !important; +} +:deep(.ant-picker) { + .ant-picker-input > input, + .ant-picker-separator { color: #fff !important; } - .ant-picker-input::placeholder{ + .ant-picker-input::placeholder { color: #ffffff3b !important; } } @@ -77,6 +87,11 @@ $page-border: #cad2dd; &:active { background: #0f6f6a; } + + &:disabled { + border: none; + color: #fff; + } } .btn-del { background: $btn-del; @@ -99,6 +114,14 @@ $page-border: #cad2dd; } } //modal样式 +// 删除弹框 +.ant-modal-confirm-title { + color: #fff !important; +} + +.ant-modal .ant-modal-close { + color: #fff; +} .ant-modal .ant-modal-content { background-image: url('@/assets/images/modalBg.png'); background-size: 100% 100%; @@ -109,30 +132,26 @@ $page-border: #cad2dd; text-align: center; } //表单中的表格样式 -.ant-form{ -.ant-table-thead { - background: rgba(30, 85, 95, 1) !important; +.ant-form { + .ant-table-thead { + background: rgba(30, 85, 95, 1) !important; + } + :deep(.ant-table-thead > tr > th) { + border-inline: 1px solid transparent !important; + background: transparent; + color: #fff !important; + border-bottom: none !important; /* 可选:去除底部边框 */ + } + :deep(.ant-table-tbody) { + color: #fff; + background: $table-bg; + border: 1px solid $table-border !important; + border-radius: 0px 0px 20px 20px; + } + :deep(.ant-table-wrapper .ant-table-tbody > tr.ant-table-placeholder:hover > td) { + background: transparent !important; + } + :deep(.ant-empty-description) { + color: #fff !important; + } } -:deep(.ant-table-thead > tr > th) { - border-inline: 1px solid transparent !important; - background: transparent; - color: #fff !important; - border-bottom: none !important; /* 可选:去除底部边框 */ -} -:deep(.ant-table-tbody){ - color: #fff; - background: $table-bg ; - border: 1px solid $table-border !important; - border-radius: 0px 0px 20px 20px; - -} -:deep(.ant-table-wrapper .ant-table-tbody>tr.ant-table-placeholder:hover>td){ - background: transparent !important; -} -:deep(.ant-empty-description){ - color: #fff !important; -} - -} - - diff --git a/web/src/utils/btnList.js b/web/src/utils/btnList.js index 2d4440c..b79a84d 100644 --- a/web/src/utils/btnList.js +++ b/web/src/utils/btnList.js @@ -1,36 +1,10 @@ const btnList = [ { label: '', type: '', disFlag: '' }, { label: '新增', type: 'add', disFlag: 'isEdit', icon: 'icon-add' }, - { label: '更新', type: 'edit', disFlag: 'isEdit' }, - { label: '查看', type: 'detail', disFlag: 'isQuery' }, - { label: '编辑', type: 'edit', disFlag: 'isEdit' }, - { label: '删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }, - { label: '批量删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }, - { label: '导入', type: 'upload', disFlag: 'isEdit', icon: 'icon-import' }, - { label: '导出', type: 'download', disFlag: 'isEdit', icon: 'icon-export' }, - { label: '上传', type: 'upload', disFlag: 'isEdit', icon: 'icon-upload' }, - { label: '下载', type: 'download', disFlag: 'isEdit', icon: 'icon-download' }, - { label: '下发', type: 'xf', disFlag: 'isControl' }, - { label: '批量下载', type: 'download', disFlag: 'isEdit', icon: 'icon-download' }, - { label: '下载模版', type: 'downTemplate', disFlag: 'isControl', icon: 'icon-download' }, - { label: '重置密码', type: 'reset', disFlag: 'isEdit' }, - { label: '派发', type: 'distribute', disFlag: 'isControl' }, - { label: '处理', type: 'dealWith', disFlag: 'isControl' }, - { label: '审核', type: 'audit', disFlag: 'isControl' }, - { label: '标记为已读', type: 'setTagR', disFlag: 'isControl', icon: 'icon-chulizhuangtai' }, - { label: '标记为已处理', type: 'setTagD', disFlag: 'isControl' }, - { label: '启动', type: 'start', disFlag: 'isControl' }, - { label: '停止', type: 'stop', disFlag: 'isControl' }, - { label: '重启', type: 'restart', disFlag: 'isControl' }, - { label: '批量启动', type: 'start', disFlag: 'isControl' }, - { label: '批量停止', type: 'stop', disFlag: 'isControl' }, - { label: '批量重启', type: 'restart', disFlag: 'isControl' }, - { label: '监控日志', type: 'log', disFlag: 'isControl' }, - { label: '新建备份', type: 'backups', disFlag: 'isEdit', icon: 'icon-add' }, - { label: '导入备份', type: 'importBackups', disFlag: 'isEdit', icon: 'icon-import' }, - { label: '还原', type: 'restore', disFlag: 'isEdit' }, - { label: '批量启用', type: 'enable', disFlag: 'isControl', icon: 'icon-a-qiyong' }, - { label: '批量禁用', type: 'disable', disFlag: 'isControl', icon: 'icon-a-jinyong' } + { label: '查看', type: 'read', disFlag: 'isQuery' }, + { label: '修改', type: 'edit', disFlag: 'isEdit' }, + { label: '删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' } + // { label: '批量删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' } ] // arr:按钮数组 @@ -45,7 +19,7 @@ function getBtns(arr) { const btns = [] btnList.forEach((item) => { if (arr.includes(item.label)) { - item.disabled = !Boolean(permissions[item.disFlag]) + // item.disabled = !Boolean(permissions[item.disFlag]) btns.push(item) } }) diff --git a/web/src/utils/column.js b/web/src/utils/column.js index d5afe8b..de36cb7 100644 --- a/web/src/utils/column.js +++ b/web/src/utils/column.js @@ -69,7 +69,7 @@ const colWidth = [ { label: '操作', align: 'center', - width: 130, + width: 200, fixed: 'right', resizable: false } diff --git a/web/src/utils/decorator.js b/web/src/utils/decorator.js new file mode 100644 index 0000000..4c5a890 --- /dev/null +++ b/web/src/utils/decorator.js @@ -0,0 +1,116 @@ +let validateRulesObj = { + phone: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/ + if (value === '') { + return Promise.resolve() + } else if (!reg.test(value)) { + return Promise.reject(new Error('请输入正确的手机号码')) + } + return Promise.resolve() + } + } + ] + }, + email: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = + /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/ + if (!reg.test(value)) { + return Promise.reject(new Error('请输入正确的邮箱')) + } + return Promise.resolve() + } + } + ] + }, + + pwd: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,20}$/ + if (!reg.test(value)) { + return Promise.reject(new Error('请输入密码,密码由6-20位字母、字符或数字组成')) + } + return Promise.resolve() + } + } + ] + }, + + // 新密码与旧密码是否一致校验 + checkOpwd: { + rules: [ + { + validator: (rule, value, callback) => { + // 获取旧密码 + let opwd = this.props.form.getFieldValue('oldPsd') + if (!(opwd && opwd !== value)) { + return Promise.reject(new Error('旧密码与新密码一致')) + } else { + return Promise.resolve() + } + } + } + ] + }, + + gphone: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = /^([0-9]{3,4}-)?[0-9]{7,8}$/ + if (!reg.test(value)) { + return Promise.reject(new Error('请输入正确的固定电话')) + } else { + return Promise.resolve() + } + } + } + ] + }, + + lng: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = + /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,6})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,6}|180)$/ + if (value !== '' && value !== null && value !== undefined) { + if (!reg.test(value)) { + return Promise.reject(new Error('经度整数部分为-180 至 180,小数部分为0到6位!')) + } else { + return Promise.resolve() + } + } else { + return Promise.resolve() + } + } + } + ] + }, + lat: { + rules: [ + { + validator: (rule, value, callback) => { + const reg = /^(\-|\+)?([0-8]?\d{1}\.\d{0,6}|90\.0{0,6}|[0-8]?\d{1}|90)$/ + if (value !== '' && value !== null && value !== undefined) { + if (!reg.test(value)) { + return Promise.reject(new Error('纬度整数部分为-90 至 90,小数部分为0到6位!')) + } else { + return Promise.resolve() + } + } else { + return Promise.resolve() + } + } + } + ] + } +} +export default validateRulesObj diff --git a/web/src/utils/notification.js b/web/src/utils/notification.js new file mode 100644 index 0000000..66d6a97 --- /dev/null +++ b/web/src/utils/notification.js @@ -0,0 +1,59 @@ +import { notification } from 'ant-design-vue' +import { h } from 'vue' +import { + CheckCircleFilled, + CloseCircleFilled, + ExclamationCircleFilled +} from '@ant-design/icons-vue' + +// name:页面名称,角色、人员、系统等 +// type:add,edit,del,detail +// status:success,error,warning +// desc: 描述 +const option = { + names: { + user: '用户管理' + }, + types: { + // isDealWith: '标记为已处理', + // isRead: '标记为已读' + }, + status: { success: '成功', error: '失败', warning: '警告' } +} +const notiInfo = { + success: { + iconMessage: '成功通知', + icon: CheckCircleFilled, + iconColor: 'color:#065758', + iconClass: 'notification-success-class' + }, + error: { + iconMessage: '失败通知', + icon: CloseCircleFilled, + iconColor: 'color:#ca4d2a', + iconClass: 'notification-error-class' + }, + warning: { + iconMessage: '警告通知', + icon: ExclamationCircleFilled, + iconColor: 'color:#FF921B', + iconClass: 'notification-warning-class' + } +} +const openNotification = ({ name, type, status, desc = '' }) => { + notification[status]({ + placement: 'bottomRight', + message: notiInfo[status].iconMessage, + description: desc || option.names[name] + option.types[type] + option.status[status], + icon: () => + h(notiInfo[status].icon, { + style: notiInfo[status].iconColor + }), + style: { + minWidth: '400px' + }, + class: notiInfo[status].iconClass, + duration: 2 + }) +} +export default openNotification diff --git a/web/src/views/MainView.vue b/web/src/views/MainView.vue index 1b02fc3..0e0e3d1 100644 --- a/web/src/views/MainView.vue +++ b/web/src/views/MainView.vue @@ -80,6 +80,7 @@ export default { }, { name: '场站管理', + path: '/station', icon: 'icon-caidanguanli' }, { diff --git a/web/src/views/statisticalAnalysis.vue b/web/src/views/statisticalAnalysis.vue index a08001f..d14a697 100644 --- a/web/src/views/statisticalAnalysis.vue +++ b/web/src/views/statisticalAnalysis.vue @@ -515,7 +515,7 @@ export default { // end_date: getDateDaysAgo(0) } try { - const res = await getReq('/api/queryStatDayList', query) + const res = await getReq('/queryStatDayList', query) if (res.errcode === 0) { this.echartsInfo[this.activeKey].chartData = res.data console.log( @@ -539,7 +539,7 @@ export default { pageNumber: currentInfo.pageOption.page } try { - const res = await getReq('/api/queryStatDayList', query) + const res = await getReq('/queryStatDayList', query) if (res.errcode === 0) { currentInfo.tableData = res.data currentInfo.pageOption = { diff --git a/web/src/views/sub/Home.vue b/web/src/views/sub/Home.vue index 29a1e54..4c8cd55 100644 --- a/web/src/views/sub/Home.vue +++ b/web/src/views/sub/Home.vue @@ -130,7 +130,7 @@ export default { async getOnLineList() { try { // token: 用户TOKEN - const res = await getReq('/api/queryStatSystem') + const res = await getReq('/queryStatSystem') if (res.errcode === 0) { this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data)) this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date) @@ -155,7 +155,7 @@ export default { stationId: this.stationId, category: 0 } - const res = await getReq('/api/queryStatTotal', query) + const res = await getReq('/queryStatTotal', query) if (res.errcode === 0) { this.deviceInfo.allTotal = res.data const { income_charge: incomeCharge, income_elect: incomeElect } = @@ -201,7 +201,7 @@ export default { end_date: getDateDaysAgo(0) } const arr = { 1: 'energy', 2: 'charge', 3: 'pv' } - const res = await getReq('/api/queryStatDayList', query) + const res = await getReq('/queryStatDayList', query) if (res.errcode === 0) { this.list.forEach((item) => { this.deviceInfo[arr[category]] = res.data diff --git a/web/src/views/system/policy.vue b/web/src/views/system/policy.vue index ce55a0d..3dd429a 100644 --- a/web/src/views/system/policy.vue +++ b/web/src/views/system/policy.vue @@ -133,7 +133,7 @@ export default { }, tableH: '', formState: {}, - formStatus:'add',//表单状态辑状态 add:新增 edit:编辑 + formStatus:'add',//c表单状态辑状态 add:新增 edit:编辑 } }, mounted() { diff --git a/web/src/views/system/role.vue b/web/src/views/system/role.vue new file mode 100644 index 0000000..a2ac19b --- /dev/null +++ b/web/src/views/system/role.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/web/src/views/system/station.vue b/web/src/views/system/station.vue new file mode 100644 index 0000000..907815c --- /dev/null +++ b/web/src/views/system/station.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/web/src/views/system/user.vue b/web/src/views/system/user.vue index 3a951fe..d78695d 100644 --- a/web/src/views/system/user.vue +++ b/web/src/views/system/user.vue @@ -17,48 +17,61 @@ :page-option="pageOption" :table-h="tableH" > - - +