系统管理

This commit is contained in:
ym1026
2025-09-05 16:40:35 +08:00
parent c778e4a300
commit c1cce63c85
24 changed files with 2220 additions and 411 deletions

View File

@@ -54,7 +54,7 @@ module.exports = {
'no-this-before-super': 0, // 在调用super()之前不能使用this或super 'no-this-before-super': 0, // 在调用super()之前不能使用this或super
'no-undef': 2, // 不能有未定义的变量 'no-undef': 2, // 不能有未定义的变量
'no-use-before-define': 2, // 未定义前不能使用 'no-use-before-define': 2, // 未定义前不能使用
camelcase: 2, // 强制驼峰法命名 camelcase: 'off', // 关闭强制驼峰法命名
'vue/multi-word-component-names': 0, 'vue/multi-word-component-names': 0,
'jsx-quotes': [2, 'prefer-double'], // 强制在JSX属性jsx-quotes中一致使用双引号 'jsx-quotes': [2, 'prefer-double'], // 强制在JSX属性jsx-quotes中一致使用双引号
// 'react/sort-comp': 2, // 强制组件方法顺序 // 'react/sort-comp': 2, // 强制组件方法顺序

View File

@@ -7,119 +7,48 @@ export const columnList = [
dataIndex: 'user_id', dataIndex: 'user_id',
key: 'user_id', key: 'user_id',
ellipsis: true, ellipsis: true,
filterable: true, // filterable: true,
fixed: 'left' fixed: 'left'
}, },
{ {
title: '用户名', title: '用户名',
dataIndex: 'account', dataIndex: 'account',
key: 'account', key: 'account'
filterable: true // filterable: true
}, },
{ {
title: '姓名', title: '姓名',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
ellipsis: true, ellipsis: true
filterable: true // filterable: true
}, },
{ {
title: '性别', title: '性别',
dataIndex: 'gender', dataIndex: 'gender',
key: 'gender', key: 'gender',
filterable: true,
scopedSlots: { customRender: 'gender' } scopedSlots: { customRender: 'gender' }
}, },
{ {
title: '年龄', title: '年龄',
dataIndex: 'age', dataIndex: 'age',
key: 'age', key: 'age'
filterable: true
}, },
{ {
title: '手机号', title: '手机号',
dataIndex: 'phone', dataIndex: 'phone',
key: 'phone', key: 'phone'
filterable: true
}, },
{ {
title: '邮箱', title: '邮箱',
dataIndex: 'email', dataIndex: 'email',
key: 'email', key: 'email'
filterable: true
},
{
title: '角色ID',
dataIndex: 'role_id',
key: 'role_id',
filterable: true
}, },
{ {
title: '角色名称', title: '角色名称',
dataIndex: 'role_name', dataIndex: 'role_name',
key: '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
}, },
{ {
title: '操作', title: '操作',
@@ -133,210 +62,393 @@ export const columnList = [
page: 'role', page: 'role',
columns: [ columns: [
{ {
title: '角色名称', title: '角色ID',
dataIndex: 'name', dataIndex: 'role_id',
key: 'name', key: 'role_id',
ellipsis: true, ellipsis: true,
filterable: true, // filterable: true,
width: 180,
fixed: 'left' fixed: 'left'
}, },
{ {
title: '角色类型', title: '角色名称',
dataIndex: 'type', dataIndex: 'name',
key: 'type', key: 'name'
width: 120, // filterable: true
scopedSlots: { customRender: 'type' }
}, },
{ {
title: '描述', title: '角色描述',
dataIndex: 'desc', dataIndex: 'describe',
align: 'center', key: 'describe',
key: 'desc',
ellipsis: true ellipsis: true
// filterable: true
}, },
{ {
title: '权限名称', title: '关联权限',
dataIndex: 'permissions', dataIndex: 'permission',
align: 'center', key: 'permission',
key: 'permissions', scopedSlots: { customRender: 'permission' }
width: 180, },
{
ellipsis: true, title: '是否启用',
scopedSlots: { customRender: 'permissions' } dataIndex: 'is_open',
key: 'is_open',
scopedSlots: { customRender: 'is_open' }
}, },
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'create_time',
key: 'createTime', key: 'create_time'
align: 'center',
ellipsis: true,
filterable: true,
width: 180
}, },
{ {
title: '更新时间', title: '更新时间',
dataIndex: 'updateTime', dataIndex: 'update_time',
key: 'updateTime', key: 'update_time'
align: 'center',
ellipsis: true,
filterable: true,
width: 180
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
key: 'operate',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
} }
] ]
}, },
{ {
page: 'permission', page: 'station',
columns: [ columns: [
{ {
title: '权限名称', title: '场站ID',
dataIndex: 'station_id',
key: 'station_id',
ellipsis: true,
// filterable: true,
fixed: 'left'
},
{
title: '场站名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name'
ellipsis: true, // filterable: true
filterable: true,
fixed: 'left',
width: 180
}, },
{ {
title: '描述', title: '场站位置',
dataIndex: 'desc', dataIndex: 'address',
key: 'desc' key: 'address'
// filterable: true
}, },
{ {
title: '是否可查询', title: '场站经度',
dataIndex: 'isQuery', dataIndex: 'lon',
key: 'isQuery', width: 50,
align: 'center', key: 'lon'
width: 120, // filterable: true
scopedSlots: { customRender: 'isQuery' }
}, },
{ {
title: '是否可编辑', title: '场站纬度',
dataIndex: 'isControl', dataIndex: 'lat',
align: 'center', width: 50,
key: 'isEdit', key: 'lat'
width: 120, // filterable: true
scopedSlots: { customRender: 'isEdit' }
}, },
{ {
title: '是否可控制', title: '储能容量',
dataIndex: 'isEdit', dataIndex: 'capacity',
align: 'center', key: 'capacity'
key: 'isEdit', // filterable: true
key: 'isControl',
width: 120,
scopedSlots: { customRender: 'isControl' }
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
ellipsis: true,
filterable: true,
width: 180
}, },
{ {
title: '更新时间', title: '场站电话',
dataIndex: 'updateTime', dataIndex: 'tel',
key: 'updateTime', key: 'tel',
align: 'center', ellipsis: true
ellipsis: true, // filterable: true
filterable: true, },
width: 180 {
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: '操作', title: '操作',
dataIndex: 'operate', dataIndex: 'operate',
key: 'operate',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
} }
] ]
} }
] ]
export const options = [ export const userOptions = [
{ {
title: '基础信息', title: '基础信息',
icon: 'icon-xinxi', icon: 'icon-xinxi',
list: [ list: [
{ {
label: '名', label: '用户名',
value: '',
key: 'account',
type: 'input'
},
{
label: '姓名',
value: '', value: '',
key: 'name', key: 'name',
type: 'input' type: 'input'
}, },
{ {
label: '账户类型', label: '性别',
value: undefined, value: undefined,
// dataIndex: 'type', key: 'gender',
key: 'type',
type: 'select', type: 'select',
list: [ list: [
{ {
label: '虚拟账户', label: '',
value: 0 value: '0'
}, },
{ {
label: '卡账户', label: '',
value: 1 value: '1'
} }
] ]
}, },
{ {
label: '账号', label: '年龄',
value: [], value: '',
key: 'code', key: 'age',
type: 'input' 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, value: undefined,
// dataIndex: 'userId', key: 'is_open',
key: 'userId', type: 'switch',
type: 'select', className: 'item-l',
list: []
list: [
{
label: '禁用',
value: '0'
},
{
label: '启用',
value: '1'
}
]
}, },
{ {
label: '余额', label: '角色描述',
value: '', value: '',
key: 'money', key: 'describe',
type: 'input', type: 'textarea'
inputType: 'number' }
],
ruleForm: {}
}
]
export const stationOptions = [
{
title: '基础信息',
icon: 'icon-xinxi',
list: [
{
label: '场站名称',
value: '',
key: 'name',
type: 'input'
}, },
{ {
label: '账户状态', label: '场站位置',
value: '', 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', 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', type: 'select',
list: [ list: [
{ {
label: '正常', label: '最优经济化',
value: 0 value: '1'
}, },
{ {
label: '注销', label: '支撑电网稳定',
value: 1 value: '2'
}, },
{ {
label: '异常', label: '自定义',
value: 9 value: '3'
}
]
},
{
// 0未启用1启用
label: '场站运行策略',
value: undefined,
key: 'policy_id',
type: 'select',
list: [
{
label: '削峰套利',
value: '1'
},
{
label: '需求响应',
value: '2'
},
{
label: '自发自用',
value: '3'
} }
] ]
} }
], ],
ruleForm: { ruleForm: {}
// selectTableData: [],
}
} }
] ]
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: '请输入场站名称'
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -360,8 +360,6 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
} }
//表格样式 //表格样式
:deep(.ant-table-tbody) { :deep(.ant-table-tbody) {
color: var(--theme-text-default) !important;
> tr { > tr {
&:hover { &:hover {
> .ant-table-cell { > .ant-table-cell {

View File

@@ -0,0 +1,720 @@
<!-- item.type:xxxx-unshow:表示不显示 items.displayFlag为false表示不展示卡片 -->
<template>
<div class="card-content">
<a-card
style="margin: 0 0 15px 0; text-align: left"
>
<div :class="['info-title', items.title ? '' : 'title-none']">
<div class="box">
<div >
{{ items.title ? items.title : '基础信息' }}
</div>
<a-tooltip
placement="bottomLeft"
trigger="['hover','click']"
:overlay-style="{ color: '#ccc' }"
v-if="items.tooltip && items.tooltip !== ''"
>
<template #title>
<!-- -->
<span v-html="items.tooltip"></span>
</template>
<ExclamationCircleOutlined
:style="{
fontSize: '18px',
color: 'var(--theme-text3)',
cursor: 'pointer',
position: 'relative',
top: '0',
left: '15px'
}"
/>
</a-tooltip>
</div>
</div>
<div class="info-content">
<a-form
layout="horizontal"
:wrap="true"
ref="formRef"
:rules="props.formRules"
name="info-form"
class="info-form"
label-align="left"
:model="propsInfo.ruleForm.value"
@submit="handleSubmit"
@onFieldsChange="onFieldsChange"
>
<template v-for="item in items.list">
<div
v-if="item.type !== 'unshow'"
:key="item.key"
:class="item.className ? [item.className, 'item-div'] : 'item-div'"
>
<a-form-item
:label="item.label"
:name="item.key"
:class="[item.colStatus || item.type === 'table' ? 'item-width' : 'form-item']"
:tooltip="item.tooltip ? item.tooltip : ''"
>
<a-input-password
v-if="item.type === 'input-password'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请输入' + item.label"
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
/>
<a-input
v-if="item.type === 'input'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:type="item.inputType"
:placeholder="'请输入' + item.label"
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
/>
<a-input-number
v-if="item.type == 'input-number'"
id="inputNumber"
v-model:value="propsInfo.ruleForm.value[item.key]"
:min="item.min || 0"
:max="item.max || 10000000"
:formatter="item.formatter || null"
:addon-before="item.addonBefore"
:disabled="props.disabled"
/>
<a-date-picker
v-if="item.type === 'date-picker'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请输入' + item.label"
:disabled="props.disabled"
value-format="YYYY-MM-DD HH:mm:ss"
/>
<a-date-picker
show-time
v-if="item.type === 'time'"
value-format="YYYY-MM-DD HH:mm:ss"
:disabled="props.disabled"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请输入' + item.label"
/>
<a-range-picker
v-if="item.type === 'date-time'"
v-model:value="propsInfo.ruleForm.value[item.key]"
value-format="YYYY-MM-DD HH:mm:ss"
:disabled="props.disabled"
show-time
/>
<a-time-range-picker
v-if="item.type === 'timeRangePicker'"
v-model:value="propsInfo.ruleForm.value[item.key]"
value-format="HH:mm"
format="HH:mm"
:disabled="props.disabled"
/>
<a-time-picker
v-if="item.type === 'timePicker'"
v-model:value="propsInfo.ruleForm.value[item.key]"
value-format="HH:mm"
format="HH:mm"
:disabled="props.disabled"
/>
<a-textarea
v-if="item.type === 'textarea'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请输入' + item.label"
allow-clear
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
:auto-size="item.autoSize ? item.autoSize : { minRows: 3, maxRows: 10 }"
/>
<a-select
:dropdown-match-select-width="false"
v-if="item.type === 'select'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请选择' + item.label"
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
allow-clear
>
<a-select-option
:value="selectItem.value"
v-for="selectItem in item.list"
:key="selectItem.value"
>
{{ selectItem.label }}
</a-select-option>
</a-select>
<!-- 下拉多选 -->
<a-select
:dropdown-match-select-width="false"
v-if="item.type === 'selectMultiple'"
mode="multiple"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请选择' + item.label"
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
allow-clear
>
<a-select-option
:value="selectItem.value"
v-for="selectItem in item.list"
:key="selectItem.value"
>
{{ selectItem.label }}
</a-select-option>
</a-select>
<!-- 新增时disabled -->
<a-select
:dropdown-match-select-width="false"
v-if="item.type === 'select-disabled'"
v-model:value="propsInfo.ruleForm.value[item.key]"
:placeholder="'请选择' + item.label"
:disabled="!props.disabled ? item.disabled : props.disabled"
allow-clear
>
<a-select-option
:value="selectItem.value"
v-for="selectItem in item.list"
:key="selectItem.value"
>
{{ selectItem.label }}
</a-select-option>
</a-select>
<!-- 下拉展示icon -->
<a-select
v-if="item.type === 'icon-select'"
:get-popup-container="(triggerNode) => triggerNode.parentNode"
v-model:value="propsInfo.ruleForm.value[item.key]"
allow-clear
option-label-prop="children"
>
<a-select-option
v-for="icon in iconList"
:key="icon.icon_id"
:value="`icon-${icon.font_class}`"
>
<i
class="iconfont"
:class="`icon-${icon.font_class}`"
style="margin-right: 8px"
></i>
<span> {{ icon.name }} </span>
</a-select-option>
</a-select>
<a-switch
v-if="item.type === 'switch'"
v-model:checked="propsInfo.ruleForm.value[item.key]"
style="margin-bottom: 5px"
:disabled="!props.disabled && type ? !!item.disabled : props.disabled"
/>
<a-radio-group
name="radioGroup"
v-model:value="propsInfo.ruleForm.value[item.key]"
v-if="item.type === 'radio'"
:disabled="props.disabled"
>
<a-radio
:value="radioItem.value"
v-for="radioItem in item.list"
:key="radioItem.value"
>
{{ radioItem.label }}
</a-radio>
</a-radio-group>
<a-tree-select
:disabled="props.disabled"
v-model:value="propsInfo.ruleForm.value[item.key]"
v-if="item.type === 'tree-radio'"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="item.list"
:placeholder="'请选择' + item.label"
:field-names="
item.replaceFields
? item.replaceFields
: {
children: 'children',
title: 'title',
key: 'key',
value: 'value'
}
"
/>
<a-tree-select
:allow-clear="true"
:disabled="props.disabled"
v-if="item.type === 'tree-check'"
v-model:value="propsInfo.ruleForm.value[item.key]"
style="width: 100%"
:tree-data="item.list"
:tree-checkable="true"
:show-checked-strategy="SHOW_PARENT"
:placeholder="'请选择' + item.label"
:field-names="
item.replaceFields
? item.replaceFields
: {
children: 'children',
title: 'title',
key: 'key',
value: 'value'
}
"
:check="checkTree"
/>
<a-tree-select
:allow-clear="true"
:disabled="props.disabled"
v-if="item.type === 'tree-check-org'"
v-model:value="propsInfo.ruleForm.value[item.key]"
style="width: 100%"
:tree-data="item.list"
allow-clear
multiple
tree-default-expand-all
:placeholder="'请选择' + item.label"
:field-names="
item.replaceFields
? item.replaceFields
: {
children: 'children',
title: 'title',
key: 'key',
value: 'value'
}
"
:check="checkTree"
/>
<a-cascader
:disabled="props.disabled"
v-if="item.type === 'cascader'"
:options="item.list"
:field-names="
item.fieldNames
? item.fieldNames
: { label: 'label', value: 'value', children: 'children' }
"
:show-search="{ filter }"
:placeholder="'请选择' + item.label"
v-model:value="propsInfo.ruleForm.value[item.key]"
change-on-select
>
</a-cascader>
<a-checkbox
v-if="item.type === 'checkbox'"
v-model:checked="propsInfo.ruleForm.value[item.key]"
>
</a-checkbox>
<div v-if="item.type === 'tag'" class="table-css">
<a-tag :color="propsInfo.ruleForm.value[item.key] ? 'green' : 'red'">
{{ item.list[propsInfo.ruleForm.value[item.key]] }}
</a-tag>
</div>
<!-- </a-col>-->
<!-- <a-button v-if="item.type === 'btn'" @click="btnClick(item)">{{ item.title }}</a-button> -->
<div v-if="item.type === 'table'" class="table-css">
<slot :name="item.type" v-bind="item"></slot>
</div>
<div v-if="item.type === 'treetable'" class="table-css">
<slot :name="item.type" v-bind="item"></slot>
</div>
<div v-if="item.type === 'slot'">
<slot
:name="item.slotName"
v-bind="{ ...item, ...propsInfo.ruleForm.value }"
></slot>
</div>
</a-form-item>
</div>
</template>
<!-- <a-form-item
v-for="item in items.list"
:key="item.key"
:label="item.label"
:name="item.key"
:class="[item.colStatus ? 'item-width' : 'form-item']"
> -->
</a-form>
</div>
</a-card>
</div>
</template>
<script setup>
import { UserOutlined, InfoCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue'
import {
ref,
reactive,
defineProps,
defineEmits,
watch,
toRefs,
onMounted,
defineExpose
} from 'vue'
import { TreeSelect } from 'ant-design-vue'
import iconfonts from '../assets/iconfont/iconfont.json'
import validateRulesObj from '../utils/decorator'
const iconList = iconfonts.glyphs
const formRef = ref()
const props = defineProps({
items: {
type: Object,
required: () => []
},
formRules: {
type: Object
},
ruleForm: {
type: Object
},
disabled: {
type: Boolean
},
type: {
type: Boolean,
default: false
}
})
const propsInfo = toRefs(props)
const exposeRuleForm = propsInfo.ruleForm.value
onMounted(() => {})
const emit = defineEmits(['handlerClick'])
const data = reactive({
validateRulesObj,
newRuleForm: {},
// : {},
key: 0,
tableIndex: null,
tableInfo: [],
// tableIndex: 0,
mockData: [{}],
targetKeys: [],
// 单选-树节点
treeRadioValue: null,
treeData: [
{ id: 1, pId: 0, value: '1', title: 'Expand to load' },
{ id: 2, pId: 0, value: '2', title: 'Expand to load' },
{ id: 3, pId: 0, value: '3', title: 'Tree Node', isLeaf: true }
],
treeCheckValue: null,
SHOW_PARENT: TreeSelect.SHOW_PARENT,
loading: false,
imageUrl: ''
})
const extraInformation = ref(
'Cron表达式由6个(或7个)字段组成,分别表示秒、分、小时、月中的日期、月份、星期中的日期(以及可选的年份)。每个字段可以包含以下字符:·星号(*):表示该字段可以接受任何值、·问号(?):通常用于""星期”字段,表示不指定值,即表示“无特定值”。·连字符(-):用于指定范围,如"10-12表示101112·逗号():用于指定多个值MON,WED,FRI表示星期一星期三和星期五·斜杠(/):0/15015·L:""()W:()15W15#:6#3Cron:"0012**?12'
)
watch(
() => props.formRules,
(nVal, o) => {
for (const key in nVal) {
nVal[key].forEach((item) => {
if (item.validatorType) {
item.validator = data.validateRulesObj[item.validatorType]?.rules[0].validator
}
})
}
},
{ deep: true, immediate: true }
)
function checkTree(checkedKeys, e) {}
// 按钮的点击事件
function btnClick(item) {
emit('handlerClick', item)
}
function confirm() {
return new Promise((resolve, reject) => {
if (formRef.value) {
formRef.value
.validate()
.then(() => {
resolve(true)
})
.catch((error) => {
console.log('error', error)
resolve(false)
})
}
})
}
function handleReset() {
if (formRef.value) {
formRef.value.resetFields()
}
}
function switchChange(checked, switchItem) {
propsInfo.ruleForm.value[switchItem.key] = checked
}
function RadioChange(e, radioItem) {
const { value } = e.target
propsInfo.ruleForm.value[radioItem.key] = value
}
function transferChange(targetKeys, transferItem) {
data.targetKeys = targetKeys
propsInfo.ruleForm.value[transferItem.key] = data.targetKeys
}
function transferSearch(dir, value) {}
// 单选-树节点
function genTreeNode(parentId, isLeaf = false) {
const random = Math.random().toString(36).substring(2, 6)
return {
id: random,
pId: parentId,
value: random,
title: isLeaf ? 'Tree Node' : 'Expand to load',
isLeaf
}
}
function onLoadTree(treeNode) {
return new Promise((resolve) => {
const { id } = treeNode.dataRef
setTimeout(() => {
data.treeData = data.treeData.concat([
data.genTreeNode(id, false),
data.genTreeNode(id, true)
])
resolve()
}, 300)
})
}
function treeChange(key, value, node, extra) {
propsInfo.ruleForm.value[key] = value
}
// 级联选择器
function cascaderChange(value, cascaderItem) {
propsInfo.ruleForm.value[cascaderItem.key] = value
}
function filter(inputValue, path) {
return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
}
function avatarUploadChange(info) {
if (info.file.status === 'uploading') {
data.loading = true
return
}
if (info.file.status === 'done') {
getBase64(info.file.originFileObj, (imageUrl) => {
data.imageUrl = imageUrl
data.loading = false
})
}
}
function onFieldsChange() {}
function handleSubmit() {}
function getBase64(img, callback) {
const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img)
}
// 主动暴露方法
defineExpose({
confirm,
handleReset,
ruleForm: exposeRuleForm
})
</script>
<style lang="scss" scoped>
.allHeight {
height: 100%;
}
.card-content:first-child {
margin-top: 0px;
}
.card-content {
margin-top: 15px;
}
:deep(.ant-timeline) {
color: var(--theme-text-default) !important;
.ant-timeline-item-tail {
border-inline-start: 2px solid var(--theme-text-default) !important;
}
}
:deep(.ant-form-item .ant-form-item-label > label) {
color: var(--theme-text-default) !important;
}
.info-title {
font-size: 18px;
font-weight: 530;
color: var(--theme-text-default);
text-align: left;
border-bottom: 1.5px solid var(--theme-bg);
margin-bottom: 20px;
.box {
color:#fff;
width:230px;
display: flex;
align-items: center;
margin-bottom: 10px;
border-bottom: 5px solid transparent;
border-image: url('../assets/boxBottom.png') 0 0 100% 0 stretch;
div:last-child {
height: 25px;
line-height: 25px;
}
}
:deep(.a-tooltip) {
color: var(--theme-text3);
}
:deep(.ant-divider) {
color: var(--theme-bg);
}
}
// :deep(.ant-table-wrapper) {
// :deep(.ant-input) {
// background: red !important;
// }
// }
.title-none {
display: none;
}
:deep(.ant-card){
background-color: transparent;
}
:deep(.ant-card-body) {
padding: 15px;
height: 100%;
border-radius: 8px;
.ant-form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
height: 100%;
.item-l,
.item-div {
height: 100%;
}
}
}
.ant-card-bordered {
border: none;
}
.info-content {
height: calc(100% - 30px);
.info-form {
.item-div {
width:45%;
display: inline-block;
}
.item-l{
width:100%;
}
.form-item {
width:320px!important;
}
}
}
:deep(.ant-form-item-label) {
color:#fff;
font-size: 16px !important;
width:100px;
}
:deep(.ant-form-item-control-wrapper) {
flex: 1;
}
.editable-row-operations a {
margin-right: 8px;
}
// 表格中的按钮
:deep(.ant-table-cell) {
.ant-btn {
height: 24px !important;
color: #fff;
}
.ant-btn-dangerous {
background: var(--theme-btn2) !important;
}
.btn-del {
background: var(--theme-btn2);
}
.btn-add {
background: var(--theme-btn3);
}
.btn-upload,
.btn-downTemplate {
background: var(--theme-btn1);
}
}
:deep(.ant-calendar-picker) {
width: 100% !important;
}
:deep(.ant-picker) {
width: 100% !important;
}
:deep(.ant-form-item.form-item) {
padding: 0px !important;
padding-right: 20px !important;
}
:deep(.ant-checkbox-disabled + span) {
color: var(--theme-text-default) !important;
}
:deep(textarea.ant-input) {
background-color: var(--theme-bg) !important;
border: none !important;
color: var(--theme-text-default) !important;
}
:deep(.ant-checkbox-wrapper) {
color: var(--theme-text-default);
}
</style>

View File

@@ -0,0 +1,373 @@
<template>
<div class="editCom">
<template v-for="(detailInfo, index) in detailInfos" :key="index">
<DetailInfo
:items="detailInfo"
:rule-form="detailInfo.ruleForm"
:form-rules="formRules"
:ref="'detailInfo' + index"
:disabled="disabled"
>
<template #role_id="item">
<a-select
:dropdown-match-select-width="false"
v-model:value="detailInfo.ruleForm[item.key]"
:placeholder="'请选择' + item.label"
:disabled="disabled"
allow-clear
>
<a-select-option
:value="selectItem.role_id"
v-for="selectItem in roleIdList"
:key="selectItem.role_id"
>
{{ selectItem.name }}
</a-select-option>
</a-select>
</template>
<template #treetable="item">
<TreeTable
:columns="item.columns"
:table-data="item.tableData"
ref="treeTable"
:transfer-dialog="transferDialog"
@handleDetailPagesizeChange="handleDetailPagesizeChange"
:table-option="{
checkStrictly: false,
selectTableData: item.selectTableData,
scroll: { y: 500 }
}"
>
<template #isQuery="record">
<a-tag :color="record.isQuery ? 'green' : 'red'">{{
record.isQuery ? '启用' : '禁用'
}}</a-tag>
</template>
<template #isEdit="record">
<a-tag :color="record.isEdit ? 'green' : 'red'">{{
record.isEdit ? '启用' : '禁用'
}}</a-tag>
</template>
<template #isControl="record">
<a-tag :color="record.isControl ? 'green' : 'red'">{{
record.isControl ? '启用' : '禁用'
}}</a-tag>
</template>
</TreeTable>
</template>
</DetailInfo>
</template>
<div style="display: flex; justify-content: center; gap: 20px">
<a-button @click="handleback">取消</a-button>
<a-button @click="handleConfirm" type="primary" :disabled="disabled">确认</a-button>
</div>
</div>
</template>
<script>
import { userOptions, userFormRules,
roleOptions,roleFormRules,
stationOptions,stationFormRules
} from '../../public/config/columnList'
import DetailInfo from './DetailInfo.vue'
import { postReq, getReq } from '@/request/api'
const dictionary = {
menu: '菜单',
file: '文件',
role: '角色',
permission: '权限',
account: '账户',
log: '日志',
server: '服务',
computer: '主机'
}
export default {
name: '',
components: { DetailInfo },
props: {
action: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
record: {
type: Object,
default: () => {}
}
},
data() {
return {
tip: '正在加载...',
roleIdList: [],
transferDialog: false,
detailInfos: [],
disabled: true,
formRules: {},
apiMethods: {
// menu: 'menuConfirm',
// permission: 'permissionConfirm',
user: 'userConfirm',
role: 'roleConfirm',
},
form: {},
ObjInfo: {},
loading: false
}
},
computed: {},
watch: {
action: {
handler(n) {
if (n === 'read') {
this.disabled = true
} else {
this.disabled = false
}
},
immediate: true
},
type: {
async handler(n) {
switch (n) {
case 'user':
this.detailInfos = userOptions
this.formRules = userFormRules
break
case 'menu':
// this.detailInfos = menuOptions
// this.formRules = menuFormRules
break
case 'permission':
// this.detailInfos = permissionOptions
// this.formRules = permissionFormRules
break
case 'role':
this.detailInfos = roleOptions
this.formRules = roleFormRules
break
case 'station':
this.detailInfos = stationOptions
this.formRules = stationFormRules
break
default:
break
}
},
immediate: true
}
},
mounted() {
this.getRoleIdList()
},
methods: {
async getRoleIdList() {
const params = {
page_size: 1000,
page: 1
}
try {
const res = await getReq('/queryRoleList', params)
if (res.errcode === 0) {
this.roleIdList = res.data
} else {
const err = { tip: res.errmsg }
throw err
}
} catch (error) {
this.roleIdList = []
//统一处理报错提示
}
},
handleChange(value) {
this.ip = ''
this.selectComputer = value.option
this.selectComputer.id = value.option.value
this.ipList = this.getIpOptions(this.selectComputer.id)
},
handleDetailPagesizeChange(val) {
this.detailInfos[val[1]].list[0].detailPaginationOption = {
...this.detailInfos[val[1]].list[0].detailPaginationOption,
...val[0]
}
if (this.detailInfos[val[1]].list[0].key === 'servebiaoge') {
// 应用信息中消息模板需要通过接口调用数据
let arr = {
ids: this.clickId,
pageIndex: val[0].current,
pageSize: val[0].pageSize
}
}
},
handleRemove(file) {
const index = this.fileList.indexOf(file)
this.fileList.splice(index, 1)
},
beforeUpload(file, fileList) {
this.fileList = [...this.fileList, file]
return false
},
// 调用子组件的表单的方法
async handleConfirm() {
const result = []
const { length } = this.detailInfos
for (let index = 0; index < length; index++) {
// 校验规则
const res = await this.$refs[`detailInfo${index}`][0].confirm()
result.push(res)
if (!res) {
break
}
}
if (result.every((item) => item == true)) {
this.handleSubmit()
}
},
handleSubmit() {
const { length } = this.detailInfos
let form = {}
for (let index = 0; index < length; index++) {
if (this.$refs[`detailInfo${index}`][0].ruleForm) {
form = Object.assign(this.$refs[`detailInfo${index}`][0].ruleForm, form)
} else {
console.log('对象为空')
}
}
this.form = form
eval('this.' + this.apiMethods[this.type] + '()')
},
async userConfirm() {
try {
const menuApi = {
add: '/insertUser',
edit: '/updateUser'
}
const paramsDate = {
...this.form
}
if (this.action == 'edit') {
paramsDate.user_id = this.record.user_id
}
const res = await postReq(menuApi[this.action], paramsDate)
if (res.errcode === 0) {
setTimeout(() => {
this.handleback()
}, 1000)
} else {
throw res
}
} catch (error) {
console.log(error, 'userConfirm')
}
},
async roleConfirm() {
try {
const menuApi = {
add: '/insertRole',
edit: '/deleteRole'
}
const paramsDate = {
...this.form
}
if (this.action == 'edit') {
paramsDate.role_id = this.record.role_id
}
const res = await postReq(menuApi[this.action], paramsDate)
if (res.errcode === 0) {
setTimeout(() => {
this.handleback()
}, 1000)
} else {
throw res
}
} catch (error) {
console.log(error, 'roleConfirm')
}
},
async stationConfirm() {
try {
const menuApi = {
add: '/insertStation',
edit: '/updateStation'
}
const paramsDate = {
...this.form
}
if (this.action == 'edit') {
paramsDate.station_id = this.record.station_id
}
const res = await postReq(menuApi[this.action], paramsDate)
if (res.errcode === 0) {
setTimeout(() => {
this.handleback()
}, 1000)
} else {
throw res
}
} catch (error) {
console.log(error, 'stationConfirm')
}
},
handleback() {
this.$emit('operateForm', 'back')
},
getObjIds(selectKeys) {
const ids = []
for (let i = 0; i < selectKeys.length; i++) {
ids.push({ id: selectKeys[i] })
}
return ids
}
}
}
</script>
<style lang="scss" scoped>
.editCom {
// height:400px;
}
.ant-upload-select-picture-card i {
font-size: 32px;
color: #999;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
.detail-header {
display: flex;
span,
div {
margin: 10px;
}
}
:deep(.ant-picker) {
color: var(--theme-text-default) !important;
}
</style>

View File

@@ -132,7 +132,7 @@ export default {
station_id: this.stationId, station_id: this.stationId,
category: 0 category: 0
} }
const res = await getReq('/api/queryStatTotal', query) const res = await getReq('/queryStatTotal', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.modalInfo.allTotal = res.data this.modalInfo.allTotal = res.data
this.modalInfo.allTotal.runDays = getRunDays(res.data.launch_date) this.modalInfo.allTotal.runDays = getRunDays(res.data.launch_date)
@@ -153,7 +153,7 @@ export default {
const query = { const query = {
station_id: this.stationId, station_id: this.stationId,
} }
const res = await getReq('/api//queryStationInfo', query) const res = await getReq('//queryStationInfo', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.modalInfo.prefabTotal = res.data this.modalInfo.prefabTotal = res.data
} else { } else {
@@ -177,7 +177,7 @@ export default {
end_date: getDateDaysAgo(0) end_date: getDateDaysAgo(0)
} }
const categoryObj = { 1: 'energy' } const categoryObj = { 1: 'energy' }
const res = await getReq('/api/queryStatDayList', query) const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.modalInfo[categoryObj[category]] = res.data.map((item) => { this.modalInfo[categoryObj[category]] = res.data.map((item) => {
const { income_charge: incomeCharge, income_elect: incomeElect } = item const { income_charge: incomeCharge, income_elect: incomeElect } = item

View File

@@ -6,8 +6,9 @@
v-for="item in operateList" v-for="item in operateList"
:key="item.type" :key="item.type"
type="primary" type="primary"
style="margin-right: 5px" size="small"
:class="['operateCol', item.type]" style="margin-right: 10px"
:class="`btn-${item.type}`"
:disabled="item.disabled" :disabled="item.disabled"
@click="munuClick(item.type)" @click="munuClick(item.type)"
>{{ item.label }} >{{ item.label }}
@@ -59,49 +60,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.moreIcon{
color:#fff !important
}
:deep(.ant-btn) {
padding: 0px 7px !important;
height: 24px !important;
font-size: 13px !important;
letter-spacing: -1px;
border-radius: 4px;
& > span + .anticon {
margin-inline-start: 4px;
}
}
:deep(.ant-btn-primary) {
box-shadow: none !important;
background: var(--theme-btn3);
}
:deep(.ant-btn,.ant-btn-primary){
&:hover{
opacity: 0.9;
}
&:disabled{
color: rgba(255,255,255,0.5);
}
}
.operate{
display: flex;
justify-content: center;
}
.operateCol {
background: var(--theme-btn3);
&.more {
background: var(--theme-btn1);
}
&.del {
background: var(--theme-btn2);
}
}
.ant-dropdown .ant-dropdown-menu{
background-color:var(--theme-opert-bg)!important;
}
</style> </style>

View File

@@ -192,6 +192,7 @@ input:-internal-autofill-selected {
color: var(--theme-text-default) !important; color: var(--theme-text-default) !important;
} }
.search { .search {
height:70px;
color: #fff; color: #fff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -10,6 +10,8 @@ import '@/style/index.scss'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { setWidth } from '@/utils/column' import { setWidth } from '@/utils/column'
import { getBtns } from '@/utils/btnList' import { getBtns } from '@/utils/btnList'
import { message } from 'ant-design-vue'
import VueTianditu from 'vue-tianditu' import VueTianditu from 'vue-tianditu'
import SearchBox from '@/components/SearchBox.vue' import SearchBox from '@/components/SearchBox.vue'
import ComTable from '@/components/ComTable.vue' import ComTable from '@/components/ComTable.vue'
@@ -22,5 +24,6 @@ app.component('ComTable', ComTable)
app.config.globalProperties.$echarts = echarts // 挂载到全局属性 app.config.globalProperties.$echarts = echarts // 挂载到全局属性
app.config.globalProperties.$setWidth = setWidth // 挂载到全局属性 app.config.globalProperties.$setWidth = setWidth // 挂载到全局属性
app.config.globalProperties.$getBtns = getBtns app.config.globalProperties.$getBtns = getBtns
app.config.globalProperties.$message = message
app.use(store).use(router).use(Antd).use(VueTianditu).mount('#app') app.use(store).use(router).use(Antd).use(VueTianditu).mount('#app')

View File

@@ -1,53 +1,42 @@
import axios from 'axios' import axios from 'axios'
// import openNotification from "../utils/notification"; import openNotification from '../utils/notification'
// let { config } = window; import { message } from 'ant-design-vue'
// let { baseUrl } = config;
const service = axios.create({ const service = axios.create({
// baseURL: baseUrl,
baseURL: '/api', baseURL: '/api',
timeout: 120000 timeout: 120000
}) })
service.interceptors.request.use((config) => { service.interceptors.request.use((config) => {
const webConfig = config const webConfig = config
// if (!['/login'].includes(config.url)) {
// if (localStorage.getItem('token')) {
// webConfig.headers = {
// token: localStorage.getItem('token')
// }
// }
// }
return webConfig return webConfig
}) })
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (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 const res = response.data
if (res.code !== 200) { if (res.errCode !== 0) {
if (res.code == 401 || res.tip == '校验token过期') { if ((res.ERR_TOKEN = 2 || res.errmsg == '校验token过期')) {
setTimeout(() => { setTimeout(() => {
window.$wujie?.props.jump({ path: '/login' }) // router.push({ path: '/login' })
}, 1000) }, 1000)
} else if (urlFlag.every((item) => item === false)) { } else {
console.log(res.errmsg, 'res.errmsg')
message.error(res.errmsg)
// openNotification({ // openNotification({
// status: "error", // status: 'error',
// desc: res.tip, // desc: res.tip
// }); // })
} }
} else {
console.log(res.errmsg, 'res.errmsg')
message.error(res.errmsg)
} }
return res return res
}, },
(error) => { (error) => {
// console.log(error, 'error 此处添加监控超时处理')
if ( if (
error.name === 'AxiosError' && error.name === 'AxiosError' &&
error.message === 'timeout of 120000ms exceeded' && error.message === 'timeout of 120000ms exceeded' &&

View File

@@ -54,8 +54,8 @@ export const routes = [
{ {
name: 'role', name: 'role',
path: 'role', path: 'role',
title: '角色管理' title: '角色管理',
// component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')s component: () => import(/* webpackChunkName: "system" */ '@/views/system/role.vue')
}, },
{ {
name: 'permission', name: 'permission',
@@ -65,7 +65,8 @@ export const routes = [
{ {
name: 'station', name: 'station',
path: 'station', path: 'station',
title: '场站管理' title: '场站管理',
component: () => import(/* webpackChunkName: "system" */ '@/views/system/station.vue')
}, },
{ {
name: 'service', name: 'service',

View File

@@ -15,6 +15,13 @@ $table-border: #1c797a;
$table-bg: #072e4a; $table-bg: #072e4a;
$page-border: #cad2dd; $page-border: #cad2dd;
//级联器样式,下拉选择器样式输入框等。。。 //级联器样式,下拉选择器样式输入框等。。。
.ant-switch {
background: #00fffb;
}
.ant-switch .ant-switch-handle::before {
background-color: #0a1b2f !important;
}
.ant-select, .ant-select,
.ant-cascader { .ant-cascader {
.ant-select-selector { .ant-select-selector {
@@ -32,17 +39,20 @@ $page-border: #cad2dd;
.ant-input, .ant-input,
.ant-input-affix-wrapper, .ant-input-affix-wrapper,
.ant-picker, .ant-picker,
.ant-input-number .ant-input-number {
{
background: none !important; background: none !important;
border: 1px solid $border-color !important; border: 1px solid $border-color !important;
color: #fff; color: #fff;
} }
:deep(.ant-picker){ .ant-input::placeholder {
.ant-picker-input >input,.ant-picker-separator{ color: #ffffff3b !important;
}
:deep(.ant-picker) {
.ant-picker-input > input,
.ant-picker-separator {
color: #fff !important; color: #fff !important;
} }
.ant-picker-input::placeholder{ .ant-picker-input::placeholder {
color: #ffffff3b !important; color: #ffffff3b !important;
} }
} }
@@ -77,6 +87,11 @@ $page-border: #cad2dd;
&:active { &:active {
background: #0f6f6a; background: #0f6f6a;
} }
&:disabled {
border: none;
color: #fff;
}
} }
.btn-del { .btn-del {
background: $btn-del; background: $btn-del;
@@ -99,6 +114,14 @@ $page-border: #cad2dd;
} }
} }
//modal样式 //modal样式
// 删除弹框
.ant-modal-confirm-title {
color: #fff !important;
}
.ant-modal .ant-modal-close {
color: #fff;
}
.ant-modal .ant-modal-content { .ant-modal .ant-modal-content {
background-image: url('@/assets/images/modalBg.png'); background-image: url('@/assets/images/modalBg.png');
background-size: 100% 100%; background-size: 100% 100%;
@@ -109,30 +132,26 @@ $page-border: #cad2dd;
text-align: center; text-align: center;
} }
//表单中的表格样式 //表单中的表格样式
.ant-form{ .ant-form {
.ant-table-thead { .ant-table-thead {
background: rgba(30, 85, 95, 1) !important; 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;
}
}

View File

@@ -1,36 +1,10 @@
const btnList = [ const btnList = [
{ label: '', type: '', disFlag: '' }, { label: '', type: '', disFlag: '' },
{ label: '新增', type: 'add', disFlag: 'isEdit', icon: 'icon-add' }, { label: '新增', type: 'add', disFlag: 'isEdit', icon: 'icon-add' },
{ label: '更新', type: 'edit', disFlag: 'isEdit' }, { label: '查看', type: 'read', disFlag: 'isQuery' },
{ label: '查看', type: 'detail', disFlag: 'isQuery' }, { label: '修改', type: 'edit', disFlag: 'isEdit' },
{ label: '编辑', type: 'edit', disFlag: 'isEdit' }, { label: '删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }
{ label: '删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }, // { 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' }
] ]
// arr:按钮数组 // arr:按钮数组
@@ -45,7 +19,7 @@ function getBtns(arr) {
const btns = [] const btns = []
btnList.forEach((item) => { btnList.forEach((item) => {
if (arr.includes(item.label)) { if (arr.includes(item.label)) {
item.disabled = !Boolean(permissions[item.disFlag]) // item.disabled = !Boolean(permissions[item.disFlag])
btns.push(item) btns.push(item)
} }
}) })

View File

@@ -69,7 +69,7 @@ const colWidth = [
{ {
label: '操作', label: '操作',
align: 'center', align: 'center',
width: 130, width: 200,
fixed: 'right', fixed: 'right',
resizable: false resizable: false
} }

116
web/src/utils/decorator.js Normal file
View File

@@ -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

View File

@@ -0,0 +1,59 @@
import { notification } from 'ant-design-vue'
import { h } from 'vue'
import {
CheckCircleFilled,
CloseCircleFilled,
ExclamationCircleFilled
} from '@ant-design/icons-vue'
// name:页面名称,角色、人员、系统等
// typeaddeditdeldetail
// statussuccesserrorwarning
// 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

View File

@@ -80,6 +80,7 @@ export default {
}, },
{ {
name: '场站管理', name: '场站管理',
path: '/station',
icon: 'icon-caidanguanli' icon: 'icon-caidanguanli'
}, },
{ {

View File

@@ -515,7 +515,7 @@ export default {
// end_date: getDateDaysAgo(0) // end_date: getDateDaysAgo(0)
} }
try { try {
const res = await getReq('/api/queryStatDayList', query) const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.echartsInfo[this.activeKey].chartData = res.data this.echartsInfo[this.activeKey].chartData = res.data
console.log( console.log(
@@ -539,7 +539,7 @@ export default {
pageNumber: currentInfo.pageOption.page pageNumber: currentInfo.pageOption.page
} }
try { try {
const res = await getReq('/api/queryStatDayList', query) const res = await getReq('/queryStatDayList', query)
if (res.errcode === 0) { if (res.errcode === 0) {
currentInfo.tableData = res.data currentInfo.tableData = res.data
currentInfo.pageOption = { currentInfo.pageOption = {

View File

@@ -130,7 +130,7 @@ export default {
async getOnLineList() { async getOnLineList() {
try { try {
// token: 用户TOKEN // token: 用户TOKEN
const res = await getReq('/api/queryStatSystem') const res = await getReq('/queryStatSystem')
if (res.errcode === 0) { if (res.errcode === 0) {
this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data)) this.deviceInfo.onLine = JSON.parse(JSON.stringify(res.data))
this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date) this.deviceInfo.onLine.runDays = getRunDays(res.data.launch_date)
@@ -155,7 +155,7 @@ export default {
stationId: this.stationId, stationId: this.stationId,
category: 0 category: 0
} }
const res = await getReq('/api/queryStatTotal', query) const res = await getReq('/queryStatTotal', query)
if (res.errcode === 0) { if (res.errcode === 0) {
this.deviceInfo.allTotal = res.data this.deviceInfo.allTotal = res.data
const { income_charge: incomeCharge, income_elect: incomeElect } = const { income_charge: incomeCharge, income_elect: incomeElect } =
@@ -201,7 +201,7 @@ export default {
end_date: getDateDaysAgo(0) end_date: getDateDaysAgo(0)
} }
const arr = { 1: 'energy', 2: 'charge', 3: 'pv' } 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) { if (res.errcode === 0) {
this.list.forEach((item) => { this.list.forEach((item) => {
this.deviceInfo[arr[category]] = res.data this.deviceInfo[arr[category]] = res.data

View File

@@ -133,7 +133,7 @@ export default {
}, },
tableH: '', tableH: '',
formState: {}, formState: {},
formStatus:'add',//表单状态辑状态 add:新增 edit:编辑 formStatus:'add',//c表单状态辑状态 add:新增 edit:编辑
} }
}, },
mounted() { mounted() {

View File

@@ -0,0 +1,228 @@
<template>
<div class="role">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table">
<ComTable
:columns="columns"
:table-data="tableData"
@handlePagesizeChange="handlePagesizeChange"
ref="comTable"
:table-option="tableOption"
:page-option="pageOption"
:table-h="tableH"
>
<template #is_open="record">
<!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span>
</template>
<template #permission="record">
<!-- 0:禁用; 1:启用 -->
<span>{{record.permission.map(item=>item.name).toString() }}</span>
</template>
<template #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template>
</ComTable>
</div>
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
<!-- action:edit add -->
<EditCom
:record="record"
@operateForm="operateForm"
type="role"
:action="formStatus"
></EditCom>
</a-modal>
</div>
</template>
<script>
import { columnList, roleOptions } from '../../../public/config/columnList'
import { getReq, postReq } from '@/request/api.js'
import ComTable from '@/components/ComTable'
import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',
components: {
searchBox,
EditCom,
ComTable,
OperateCom
},
props: {},
data() {
return {
formModal: false,
formState: {},
formStatus: 'add', //表单状态辑状态 add:新增 edit:编辑
pageOption: {
pageSize: 10,
page: 1
},
btnOptionList: [],
paramsDate: {}
}
},
computed: {},
created() {
let info = []
let col = columnList.find((i) => i.page == 'role').columns
if (col.length) {
col.forEach((item) => {
info.push(this.$setWidth(item))
})
}
this.columns = info
},
mounted() {
this.operateList = this.$getBtns(['查看', '修改', '删除'])
this.btnOptionList = this.$getBtns(['新增'])
this.getList()
},
methods: {
async getList() {
this.$refs.comTable.loading = true
const { page, pageSize } = this.pageOption
const params = {
...this.paramsDate,
page_size: pageSize,
page
}
try {
const res = await getReq('/queryRoleList', params)
if (res.errcode === 0) {
this.$refs.comTable.loading = false
this.tableData = res.data
this.pageOption = {
page: res.page,
pageSize: res.page_size,
count: res.count
}
} else {
const err = { tip: res.errmsg }
throw err
}
} catch (error) {
//统一处理报错提示
}
},
operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type
switch (type) {
case 'add':
this.formModal = true
this.formState = {}
this.getRuleFormInfo()
break
case 'edit':
case 'read':
this.formModal = true
this.formState = record
this.getRuleFormInfo(record)
break
case 'del':
this.handleDelete([record.role_id],this.getList)
break
case 'back':
this.formModal = false
this.getList()
break
default:
break
}
},
// 删除操作
async handleDelete(id,callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),
async onOk() {
try {
const res = await getReq('/deleteRole',{role_id:id})
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
callback()
} else {
throw res
}
} catch (error) {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
class: 'test'
})
},
async getRuleFormInfo(record) {
function getInfo(data, url) {
return new Promise((reslove, reject) => {
getReq(data, url).then((res) => {
reslove(res.data)
})
})
}
let row = {}
if (record && record.role_id) {
// row = await getInfo({ id: record.id },'/queryroleList')
this.record = record
row = record
// this.type='edit'
}
roleOptions.forEach((e, index) => {
e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
})
})
},
handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize
this.pageOption.page = pageOption.page
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
.role {
height: 100%;
.content-table {
height: calc(100% - 70px);
padding: 10px;
}
}
</style>

View File

@@ -0,0 +1,228 @@
<template>
<div class="station">
<searchBox
:btn-option-list="btnOptionList"
@onSearch="onSearch"
:search-options="searchOptions"
@operateForm="operateForm"
></searchBox>
<div class="content-table">
<ComTable
:columns="columns"
:table-data="tableData"
@handlePagesizeChange="handlePagesizeChange"
ref="comTable"
:table-option="tableOption"
:page-option="pageOption"
:table-h="tableH"
>
<template #is_open="record">
<!-- 0:禁用; 1:启用 -->
<span>{{ ['禁用', '启用'][record.is_open] }}</span>
</template>
<template #permission="record">
<!-- 0:禁用; 1:启用 -->
<span>{{record.permission.map(item=>item.name).toString() }}</span>
</template>
<template #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template>
</ComTable>
</div>
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
<!-- action:edit add -->
<EditCom
:record="record"
@operateForm="operateForm"
type="station"
:action="formStatus"
></EditCom>
</a-modal>
</div>
</template>
<script>
import { columnList, stationOptions } from '../../../public/config/columnList'
import { getReq, postReq } from '@/request/api.js'
import ComTable from '@/components/ComTable'
import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue'
export default {
name: '',
components: {
searchBox,
EditCom,
ComTable,
OperateCom
},
props: {},
data() {
return {
formModal: false,
formState: {},
formStatus: 'add', //表单状态辑状态 add:新增 edit:编辑
pageOption: {
pageSize: 10,
page: 1
},
btnOptionList: [],
paramsDate: {}
}
},
computed: {},
created() {
let info = []
let col = columnList.find((i) => i.page == 'station').columns
if (col.length) {
col.forEach((item) => {
info.push(this.$setWidth(item))
})
}
this.columns = info
},
mounted() {
this.operateList = this.$getBtns(['查看', '修改', '删除'])
this.btnOptionList = this.$getBtns(['新增'])
this.getList()
},
methods: {
async getList() {
this.$refs.comTable.loading = true
const { page, pageSize } = this.pageOption
const params = {
...this.paramsDate,
page_size: pageSize,
page
}
try {
const res = await getReq('/queryStationList', params)
if (res.errcode === 0) {
this.$refs.comTable.loading = false
this.tableData = res.data
this.pageOption = {
page: res.page,
pageSize: res.page_size,
count: res.count
}
} else {
const err = { tip: res.errmsg }
throw err
}
} catch (error) {
//统一处理报错提示
}
},
operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type
switch (type) {
case 'add':
this.formModal = true
this.formState = {}
this.getRuleFormInfo()
break
case 'edit':
case 'read':
this.formModal = true
this.formState = record
this.getRuleFormInfo(record)
break
case 'del':
this.handleDelete([record.station_id],this.getList)
break
case 'back':
this.formModal = false
this.getList()
break
default:
break
}
},
// 删除操作
async handleDelete(id,callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),
async onOk() {
try {
const res = await getReq('/deleteStation',{station_id:id})
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
callback()
} else {
throw res
}
} catch (error) {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
class: 'test'
})
},
async getRuleFormInfo(record) {
function getInfo(data, url) {
return new Promise((reslove, reject) => {
getReq(data, url).then((res) => {
reslove(res.data)
})
})
}
let row = {}
if (record && record.station_id) {
row = await getInfo({ station_id: record.station_id},'/queryStationInfo')
this.record = record
row = record
// this.type='edit'
}
stationOptions.forEach((e, index) => {
e.list.forEach((i) => {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
})
})
},
handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize
this.pageOption.page = pageOption.page
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
.station {
height: 100%;
.content-table {
height: calc(100% - 70px);
padding: 10px;
}
}
</style>

View File

@@ -17,48 +17,61 @@
:page-option="pageOption" :page-option="pageOption"
:table-h="tableH" :table-h="tableH"
> >
<template #gender="record"> <template #gender="record">
<!-- 0:; 1: --> <!-- 0:; 1: -->
<span>{{ ['女', '男'][record.gender] }}</span> <span>{{ ['女', '男'][record.gender] }}</span>
</template> </template>
<template #action="record"> <template #action="record">
<OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" /> <OperateCom :record="record" :operate-list="operateList" @operateForm="operateForm" />
</template> </template>
</ComTable> </ComTable>
</div>
</div> </div>
<a-modal v-model:open="formModal" width="750px" style="top: 20px" :footer="null">
<!-- action:edit add -->
<EditCom
:record="record"
@operateForm="operateForm"
type="user"
:action="formStatus"
></EditCom>
</a-modal>
</div>
</template> </template>
<script> <script>
import { columnList } from '../../../public/config/columnList' import { columnList, userOptions } from '../../../public/config/columnList'
import { mapState } from 'vuex'
import { getReq, postReq } from '@/request/api.js' import { getReq, postReq } from '@/request/api.js'
import ComTable from '@/components/ComTable' import ComTable from '@/components/ComTable'
import OperateCom from '@/components/OperateCom' import OperateCom from '@/components/OperateCom'
import EditCom from '@/components/EditCom.vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { createVNode } from 'vue'
import { Modal } from 'ant-design-vue'
import searchBox from '@/components/SearchBox.vue' import searchBox from '@/components/SearchBox.vue'
export default { export default {
name: '', name: '',
components: { components: {
searchBox, searchBox,
EditCom,
ComTable, ComTable,
OperateCom OperateCom
}, },
props: {}, props: {},
data() { data() {
return { return {
pageOption:{}, formModal: false,
formState: {},
formStatus: 'add', //表单状态辑状态 add:新增 edit:编辑
pageOption: {
pageSize: 10,
page: 1
},
btnOptionList: [], btnOptionList: [],
paramsDate:{ paramsDate: {}
}
} }
}, },
computed: { computed: {},
...mapState(['page', 'detailType', 'type'])
},
created() { created() {
let info = [] let info = []
let col = columnList.find((i) => i.page == 'user').columns let col = columnList.find((i) => i.page == 'user').columns
@@ -69,10 +82,10 @@ export default {
} }
this.columns = info this.columns = info
}, },
mounted() { mounted() {
this.operateList = this.$getBtns(['查看', '编辑', '删除']) this.operateList = this.$getBtns(['查看', '修改', '删除'])
this.btnOptionList = this.$getBtns(['新增', '批量删除']) this.btnOptionList = this.$getBtns(['新增'])
this.getList() this.getList()
}, },
@@ -89,7 +102,7 @@ export default {
} }
try { try {
const res = await getReq('/api/queryUserList',params) const res = await getReq('/queryUserList', params)
if (res.errcode === 0) { if (res.errcode === 0) {
this.$refs.comTable.loading = false this.$refs.comTable.loading = false
@@ -109,25 +122,29 @@ export default {
} }
}, },
operateForm(type, record = {}) { operateForm(type, record = {}) {
console.log(record,record.id,'rrrrrrrrrr')
this.formStatus = type
switch (type) { switch (type) {
case 'detail': case 'add':
this.$store.commit('updateState', { this.formModal = true
detailType: 'edit', //edit or view this.formState = {}
page: 'detail', this.getRuleFormInfo()
title: '查看',
type: 'user'
})
break
case 'edit':
case 'read':
this.formModal = true
this.formState = record
this.getRuleFormInfo(record) this.getRuleFormInfo(record)
break break
case 'del':
this.handleDelete([record.user_id],this.getList)
break
case 'back': case 'back':
this.$store.commit('updateState', { this.formModal = false
page: 'main'
})
this.isShowFlag = false
this.getList() this.getList()
break break
@@ -135,6 +152,33 @@ export default {
break break
} }
}, },
// 删除操作
async handleDelete(id,callback) {
const that = this
Modal.confirm({
title: '你确认删除数据吗?',
icon: createVNode(ExclamationCircleOutlined),
async onOk() {
try {
const res = await getReq('/deleteUser',{user_id:id})
if (res.errcode === 0) {
this.$message.success(res.errmsg)
this.pageOption.page=1
callback()
} else {
throw res
}
} catch (error) {
callback()
}
},
onCancel() {
// console.log("Cancel");
},
class: 'test'
})
},
async getRuleFormInfo(record) { async getRuleFormInfo(record) {
function getInfo(data, url) { function getInfo(data, url) {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
@@ -145,52 +189,36 @@ export default {
} }
let row = {} let row = {}
if (record.id) { if (record && record.user_id) {
row = await getInfo({ id: record.id }, this.apiMethods[0].get) // row = await getInfo({ id: record.id },'/queryUserList')
this.record = row this.record = record
this.$store.commit('updateState', { row = record
// 配电柜-集中器-查看 // this.type='edit'
title:
(row.cabinetName ? row.cabinetName + '-' : '') +
(row.name.split('集中器')[0] ? row.name.split('集中器')[0] : '') +
'集中器-查看'
})
} }
let connectorType userOptions.forEach((e, index) => {
cabinetOptions.forEach((e, index) => {
e.list.forEach((i) => { e.list.forEach((i) => {
if (index == 1) {
// 集中器状态 e.ruleForm[i.key] = row ? row[i.key] : ''
if (i.key == 'ctrMode' || i.key == 'powerStatus') { e.ruleForm.id = row.id
e.ruleForm[i.key] = row.deviceStatus.lightStatus[i.key]
} else {
e.ruleForm[i.key] = row.deviceStatus[i.key]
}
} else if (i.key == 'connectorType') {
connectorType = row.deviceExtend[i.key]
e.ruleForm[i.key] = row.deviceExtend[i.key]
} else {
e.ruleForm[i.key] = row ? row[i.key] : ''
e.ruleForm.id = row.id
}
}) })
}) })
// C型控制器手自动状态和故障状态显示为“无”
if (connectorType == 1) {
cabinetOptions[1].ruleForm.status = 5
cabinetOptions[1].ruleForm.ctrMode = 5
}
this.isShowFlag = true
}, },
handlePagesizeChange(pageOption) { handlePagesizeChange(pageOption) {
this.pageOption.pageSize = pageOption.pageSize this.pageOption.pageSize = pageOption.pageSize
this.pageOption.page = pageOption.page this.pageOption.page = pageOption.page
this.getList() this.getList()
} }
} }
} }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped>
.user {
height: 100%;
.content-table {
height: calc(100% - 70px);
padding: 10px;
}
}
</style>