Compare commits
1 Commits
main
...
a16b26370f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a16b26370f |
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/projectIcon.svg" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="referrer" content="never" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!-- <script type="text/javascript">
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
||||
<g id="组_23402" data-name="组 23402" transform="translate(-959.12 -738.12)">
|
||||
<rect id="矩形_16530" data-name="矩形 16530" width="36" height="36" transform="translate(959.12 738.12)" fill="none"/>
|
||||
<g id="组_23400" data-name="组 23400" transform="translate(960.956 739.956)">
|
||||
<path id="路径_30576" data-name="路径 30576" d="M207.674,163.872v-9.284a2.553,2.553,0,0,0-1.179-2.063l-8.056-4.634a2.417,2.417,0,0,0-2.358,0l-8.023,4.65a2.38,2.38,0,0,0-1.179,2.063v9.333A2.553,2.553,0,0,0,188.059,166l8.056,4.585a2.417,2.417,0,0,0,2.358,0l8.056-4.634A2.331,2.331,0,0,0,207.674,163.872Z" transform="translate(-181.117 -142.881)" fill="#4388fb" opacity="0.2"/>
|
||||
<path id="路径_30577" data-name="路径 30577" d="M265.893,314.283h-2.718l-.884-2.653h-4.224l-.884,2.653h-2.718l4.224-11.625h2.9Zm-4.093-4.617-1.326-4.044a9.365,9.365,0,0,1-.2-1.015h-.065a5.831,5.831,0,0,1-.2,1.015l-1.326,4.044Zm8.072-7.073v11.625h-2.456V302.592Z" transform="translate(-246.539 -292.932)" fill="#4388fb"/>
|
||||
<path id="路径_30578" data-name="路径 30578" d="M36.685,20.095a.9.9,0,0,0-.884.884v2.472a1.535,1.535,0,0,1-.77,1.294L23.7,31.262a1.422,1.422,0,0,1-1.523,0l-11.33-6.517a1.456,1.456,0,0,1-.77-1.294V20.177a2.409,2.409,0,0,0-1-4.6,2.425,2.425,0,0,0-2.423,2.407,2.391,2.391,0,0,0,1.637,2.276v3.176a3.268,3.268,0,0,0,1.637,2.816l11.33,6.582a3.244,3.244,0,0,0,1.637.409,3.471,3.471,0,0,0,1.637-.475l11.281-6.517a3.268,3.268,0,0,0,1.637-2.816V20.963A.76.76,0,0,0,36.685,20.095Zm.884-6.942V10.287a3.268,3.268,0,0,0-1.637-2.816L24.585.954a3.284,3.284,0,0,0-3.291,0L9.947,7.471A3.268,3.268,0,0,0,8.31,10.287v2.227a.884.884,0,1,0,1.768,0V10.287a1.535,1.535,0,0,1,.77-1.294l11.33-6.517a1.422,1.422,0,0,1,1.523,0L34.982,9.059a1.456,1.456,0,0,1,.77,1.294v2.734a2.4,2.4,0,1,0,1.817.065Z" transform="translate(-6.656 -0.512)" fill="#4388fb"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,11 +1,10 @@
|
||||
import { BASE_URL } from './index';
|
||||
const BASE_URL = '/carbon-smart';
|
||||
export enum device {
|
||||
queryDeviceTree = `${BASE_URL}/deviceInfo/queryDeviceTree`, // 左侧树
|
||||
queryDevicePage = `${BASE_URL}/deviceInfo/queryDevicePage`, // 列表
|
||||
dropArea = `${BASE_URL}/deviceInfo/dropArea`, // 查询下拉区域
|
||||
queryDeviceTree = `${BASE_URL}/deviceInfo/queryDeviceTree`,
|
||||
queryDevicePage = `${BASE_URL}/deviceInfo/queryDevicePage`,
|
||||
dropArea = `${BASE_URL}/deviceInfo/dropArea`,
|
||||
}
|
||||
|
||||
export enum group {
|
||||
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`, // 左侧树
|
||||
creatOrUpdate = `${BASE_URL}/deviceGroup/creatOrUpdate`, // 左侧树节点新增编辑
|
||||
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`,
|
||||
}
|
||||
|
||||
@@ -4,6 +4,3 @@
|
||||
export const apiModule = {
|
||||
parking: ['User', 'CurrentUser', 'Organizational'],
|
||||
};
|
||||
|
||||
export const BASE_URL = '/carbon-smart';
|
||||
export const dict = `${BASE_URL}/client/dict/listByKey`;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { BASE_URL } from './index';
|
||||
|
||||
const BASE_URL = '/carbon-smart';
|
||||
export enum permission {
|
||||
add = `${BASE_URL}/admin/permission/save`,
|
||||
queryOrgPermission = `${BASE_URL}/api/dept/queryOrgPermission`,
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<template>
|
||||
<ns-modal
|
||||
ref="modalRef"
|
||||
v-bind="extraModalConfig"
|
||||
destroyOnClose
|
||||
v-model:visible="visible"
|
||||
:title="title"
|
||||
:okButtonProps="buttonProps"
|
||||
@ok="handleOk">
|
||||
<ns-form ref="formRef" :schemas="schemas" :model="formData" formLayout="formVertical" />
|
||||
</ns-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, toRefs, watch } from 'vue';
|
||||
import { HttpRequestConfig, NsMessage, useApi } from '/nerv-lib/saas';
|
||||
import { useRoute } from 'vue-router';
|
||||
type Props = {
|
||||
title?: string;
|
||||
schemas: Array<any>;
|
||||
api: string | object | Function;
|
||||
data?: object;
|
||||
extraModalConfig?: object;
|
||||
};
|
||||
const route = useRoute();
|
||||
const { httpRequest } = useApi();
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
title: '新增',
|
||||
});
|
||||
const { schemas } = toRefs(props);
|
||||
const formData = ref();
|
||||
watch(
|
||||
() => props?.data,
|
||||
(val) => {
|
||||
formData.value = val;
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const modalRef = ref();
|
||||
const formRef = ref();
|
||||
const visible = ref(false);
|
||||
const validateResult = computed(() => {
|
||||
return !formRef.value?.validateResult;
|
||||
});
|
||||
const toggle = () => {
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
|
||||
const setLoading = (loading = true) => {
|
||||
buttonProps.value.loading = loading;
|
||||
};
|
||||
|
||||
const handleOk = () => {
|
||||
setLoading(true);
|
||||
formRef.value
|
||||
.triggerSubmit()
|
||||
.then((data: any) => {
|
||||
const { api } = props;
|
||||
const requestConfig: HttpRequestConfig = { method: 'POST' };
|
||||
const { params } = route;
|
||||
|
||||
httpRequest({ api, params: data, pathParams: params, requestConfig })
|
||||
.then(() => {
|
||||
NsMessage.success('操作成功', 1, () => {
|
||||
toggle();
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const buttonProps = ref({
|
||||
disabled: validateResult,
|
||||
loading: false,
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
toggle,
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
12
hx-ai-intelligent/src/icon/gaojingguanli.svg
Normal file
12
hx-ai-intelligent/src/icon/gaojingguanli.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36px" height="36px" viewBox="0 0 36 36" enable-background="new 0 0 36 36" xml:space="preserve"> <image id="image0" width="36" height="36" x="0" y="0"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
|
||||
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAASUExURQAAAI2Vo46Wo4uXo42Wo////3MrvScAAAAEdFJO
|
||||
UwCAv0BHJ479AAAAAWJLR0QF+G/pxwAAAAd0SU1FB+gHBAISL9sg4ewAAABSSURBVCjPY2CgCxBU
|
||||
cVJGFRFxAQIUMUYXMBBAV+Ti4ogQYXZxQVfGBBNygAuZwIQQOlXwCDnBhVzgAL+QA8vQFcIELi4Y
|
||||
nsQUcnHBEMMiREsAALpDPLVxCYzSAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTA3LTA0VDAyOjE4
|
||||
OjQ3KzAwOjAwPdooNQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0wNy0wNFQwMjoxODo0NyswMDow
|
||||
MEyHkIkAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMDctMDRUMDI6MTg6NDcrMDA6MDAbkrFW
|
||||
AAAAAElFTkSuQmCC" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
50
hx-ai-intelligent/src/router/alarmManagement.ts
Normal file
50
hx-ai-intelligent/src/router/alarmManagement.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
const Base = () => import('/nerv-lib/saas/view/system/layout/content.vue');
|
||||
const alarmManagement = {
|
||||
path: '/alarmManagement',
|
||||
name: 'AlarmManagement',
|
||||
meta: { title: '告警管理', icon: 'gaojingguanli', index: 4 },
|
||||
redirect: { name: 'alarmManagement' },
|
||||
children: [
|
||||
{
|
||||
path: 'alarmOverview',
|
||||
name: 'AlarmOverview',
|
||||
meta: { title: '告警总览', hideChildren: true, icon: 'gaojingguanli' },
|
||||
component: Base,
|
||||
redirect: { name: 'alarmOverviewIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'alarmOverviewIndex',
|
||||
// component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
|
||||
component: () => import('/@/view/alarmManagement/alarmOverview/index.vue'),
|
||||
meta: {
|
||||
title: '告警总览',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'alarmSettings',
|
||||
name: 'AlarmSettings',
|
||||
meta: { title: '告警设置', hideChildren: true, icon: 'gaojingguanli' },
|
||||
component: Base,
|
||||
redirect: { name: 'alarmSettingsIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'alarmSettingsIndex',
|
||||
// component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
|
||||
component: () => import('/@/view/alarmManagement/alarmSettings/index.vue'),
|
||||
meta: {
|
||||
title: '告警设置',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
export default alarmManagement;
|
||||
@@ -19,6 +19,7 @@ const organizationManage = {
|
||||
meta: {
|
||||
title: '用户管理',
|
||||
keepAlive: true,
|
||||
isCheck: false,
|
||||
operates: [
|
||||
{ title: '新增', code: 'userAdd' },
|
||||
{ title: '导入', code: 'userImport' },
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="box-top">
|
||||
<div v-for="index in 3" :key="index" class="box-top-item">
|
||||
<div class="item-box">
|
||||
<div class="item-box-left">
|
||||
<div class="item-box-left-title">设备告警 (今日处理 / 总数) </div>
|
||||
<div class="iem-box-left-number">
|
||||
10 / 13
|
||||
<span
|
||||
style="
|
||||
color: #04d919;
|
||||
font-size: 14px;
|
||||
margin-left: 5px;
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
"
|
||||
>+10%</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-box-right">
|
||||
<img width="54px" height="54px" src="../../../../src/icon/gaojingguanli.svg" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="flex: 4; width: 100%">2</div>
|
||||
<div style="flex: 4; width: 100%">3</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted } from 'vue'; // 从 Vue 中导入 ref、onMounted 和 watchEffect
|
||||
|
||||
defineOptions({
|
||||
name: 'alarmOverview', // 与页面路由name一致缓存才可生效
|
||||
});
|
||||
|
||||
const info = ref({});
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// border: 1px solid red;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
background-color: #f0f1f4;
|
||||
box-sizing: border-box;
|
||||
.box-top {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 5px;
|
||||
.box-top-item {
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
gap: 5px;
|
||||
background-color: white;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
.item-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
.item-box-left {
|
||||
flex: 9;
|
||||
height: 100%;
|
||||
padding: 0px !important;
|
||||
.item-box-left-title {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
color: #aaaaaa;
|
||||
font-kerning: normal;
|
||||
font-family: '微软雅黑', sans-serif;
|
||||
}
|
||||
.iem-box-left-number {
|
||||
color: #000000;
|
||||
font-weight: 700;
|
||||
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
|
||||
font-style: normal;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
.item-box-right {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<a-form class="ns-form">
|
||||
<div class="ns-form-title ns-title-extra-box">
|
||||
<span>查询</span>
|
||||
<a-button type="link" class="ns-operate-expand" @click="expandAll = !expandAll">
|
||||
<template v-if="expandAll">
|
||||
收起筛选
|
||||
<UpOutlined />
|
||||
</template>
|
||||
<template v-else>
|
||||
展开筛选
|
||||
<DownOutlined />
|
||||
</template>
|
||||
</a-button>
|
||||
</div>
|
||||
<template v-if="expandAll">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="6">
|
||||
<a-select v-model:value="select.yx" style="width: 100%" placeholder="请选择告警优先级">
|
||||
<a-select-option v-for="(val, index) in 60" :key="index" :value="index">{{
|
||||
index
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-input v-model:value="select.tilte" placeholder="请输入告警标题关键字" />
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-input v-model:value="select.tilte" placeholder="请输入告警标题关键字" />
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-select
|
||||
v-model:value="select.yx"
|
||||
style="width: 100%"
|
||||
:autoClearSearchValue="true"
|
||||
placeholder="请选择启用状态">
|
||||
<a-select-option :key="1" :value="1"> 启用 </a-select-option>
|
||||
<a-select-option :key="0" :value="0"> 关闭 </a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :span="24">
|
||||
<a-col :span="24" class="ns-operate">
|
||||
<a-button @click="reset">重置</a-button>
|
||||
<a-button type="primary" @click="search">搜索</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</a-form>
|
||||
<div class="ns-table-header">
|
||||
<div class="ns-table-title ns-title-extra-box">告警规则</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, nextTick, provide, ref, toRefs, watch } from 'vue';
|
||||
import { DownOutlined, UpOutlined } from '@ant-design/icons-vue';
|
||||
export default {
|
||||
components: { DownOutlined, UpOutlined },
|
||||
setup() {
|
||||
const expandAll = ref(true);
|
||||
const loading = ref(false);
|
||||
const select = ref({
|
||||
title: '',
|
||||
yx: null,
|
||||
});
|
||||
const reset = () => {
|
||||
console.log(select);
|
||||
};
|
||||
const search = () => {
|
||||
console.log(select);
|
||||
};
|
||||
return {
|
||||
expandAll,
|
||||
select,
|
||||
loading,
|
||||
search,
|
||||
reset,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
@gap: 16px;
|
||||
.ns-form {
|
||||
padding: 16px;
|
||||
background-color: white;
|
||||
// border-radius: 8px;
|
||||
border-bottom-left-radius: 12px;
|
||||
border-bottom-right-radius: 12px;
|
||||
.ant-row {
|
||||
flex: 1;
|
||||
}
|
||||
.ns-operate {
|
||||
text-align: right;
|
||||
margin-left: auto;
|
||||
margin-top: 16px;
|
||||
|
||||
.ns-operate-expand {
|
||||
display: inline-block;
|
||||
padding: 4px 2px;
|
||||
border: unset !important;
|
||||
.anticon {
|
||||
margin-left: 4px;
|
||||
}
|
||||
&:hover {
|
||||
border: unset !important;
|
||||
}
|
||||
&:focus {
|
||||
border: unset !important;
|
||||
}
|
||||
}
|
||||
.ant-btn {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
.ns-form-title {
|
||||
text-align: left;
|
||||
height: 22px;
|
||||
// line-height: 32px;
|
||||
//font-size: 16px;
|
||||
font-weight: bold;
|
||||
user-select: text;
|
||||
margin-bottom: calc(@gap - 0px);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
:deep(.ant-btn) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ns-table-header {
|
||||
min-width: fit-content;
|
||||
user-select: none;
|
||||
// padding: 16px 0;
|
||||
padding-top: 16px;
|
||||
text-align: right;
|
||||
position: relative;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
padding: 0 16px;
|
||||
display: flex;
|
||||
.ns-table-header::before {
|
||||
position: absolute;
|
||||
top: -20px; /* 与 margin-top 的值相反,以覆盖 margin-top 的区域 */
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 20px; /* 与 margin-top 的值相同 */
|
||||
background-color: gray; /* 设置灰色背景 */
|
||||
}
|
||||
.ns-table-title {
|
||||
text-align: left;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
//font-size: 16px;
|
||||
font-weight: bold;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.ant-btn {
|
||||
margin-left: 6px;
|
||||
}
|
||||
:first-child.ant-btn {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,224 @@
|
||||
<!-- 配置设备告警 -->
|
||||
<template>
|
||||
<ns-view-list-table v-if="show" class="table" v-bind="tableConfig" />
|
||||
<!-- 新增or编辑界面 -->
|
||||
<editConfigureDeviceAlarm ref="editConfigureDeviceAlarms" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import editConfigureDeviceAlarm from '../equipmentAlarm/editConfigureDeviceAlarm.vue';
|
||||
|
||||
export default {
|
||||
components: { editConfigureDeviceAlarm },
|
||||
|
||||
setup() {
|
||||
//设备告警数据
|
||||
const configureDeviceAlarmsData = ref({});
|
||||
const show = ref(false);
|
||||
const tableConfig = ref({});
|
||||
const editConfigureDeviceAlarms = ref({});
|
||||
const mockData = ref(data.listData);
|
||||
const doWnload = (url) => {
|
||||
const a = document.createElement('a');
|
||||
document.body.appendChild(a);
|
||||
a.href = encodeURI(url);
|
||||
//设置下载的文件名
|
||||
// a.download = fileName.value;
|
||||
//触发a标签的点击事件,进行下载
|
||||
a.click();
|
||||
};
|
||||
const setconfigureDeviceAlarmsData = (value: any) => {
|
||||
configureDeviceAlarmsData.value = value;
|
||||
show.value = true;
|
||||
tableConfig.value = {
|
||||
title: '告警规则',
|
||||
// api: '/carbon_emission/device/getDeviceList',
|
||||
value: mockData.value,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'RoleTypeAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
console.log('新增xxxxxxx');
|
||||
editConfigureDeviceAlarms.value.toggle();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
name: 'groupImport',
|
||||
type: 'primary',
|
||||
extra: {
|
||||
// api: props.postImportApi, // 导入接口名
|
||||
title: '设备信息', // 弹窗title
|
||||
templateName: 'whiteListUser', // 所使用的文件名称
|
||||
indexName: '设备id', // 匹配类型字段
|
||||
message: [
|
||||
{ label: '1、若必填项未填写,则不能进行导入操作' },
|
||||
{ label: `2、当重复时,则更新数据。` },
|
||||
{ label: '3、数据将从模版的第五行进行导入。' },
|
||||
{ label: '4、文件导入勿超过5MB。' },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
name: 'groupExports',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
type: 'primary',
|
||||
name: 'userBatchDel',
|
||||
dynamicDisabled: (data: any) => {
|
||||
return data.list.length === 0;
|
||||
},
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
isClearCheck: true,
|
||||
// api: origanizemanage.batchDel,
|
||||
dynamicParams: { userIds: 'userId[]' },
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '规则id',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '设备信息',
|
||||
dataIndex: 'deviceCode',
|
||||
},
|
||||
{
|
||||
title: '告警点位',
|
||||
dataIndex: 'deviceName',
|
||||
},
|
||||
{
|
||||
title: '判断条件',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '取值类型',
|
||||
dataIndex: 'position',
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '异常描述',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
dataIndex: 'isUse',
|
||||
},
|
||||
],
|
||||
params: {
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
},
|
||||
// rowSelection: null, 选择按钮
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
console.log(data, 'xxxxxxx');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
console.log(data, 'xxxxxxx');
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
formConfig: {
|
||||
title: value.position,
|
||||
schemas: [
|
||||
{
|
||||
field: 'provider',
|
||||
label: '设备名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入设备名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '设备点位',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择告警优先级',
|
||||
options: [
|
||||
{
|
||||
label: '电流',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '电压',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择启用状态',
|
||||
options: [
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '异常描述',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入异常描述关键字',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
||||
return {
|
||||
configureDeviceAlarmsData,
|
||||
show,
|
||||
doWnload,
|
||||
tableConfig,
|
||||
editConfigureDeviceAlarms,
|
||||
setconfigureDeviceAlarmsData,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,339 @@
|
||||
<template>
|
||||
<ns-drawer
|
||||
v-model:visible="visible"
|
||||
width="520"
|
||||
:title="infoObject?.id ? '编辑' : '新增'"
|
||||
:ok="btnClick"
|
||||
:cancel="handleClose"
|
||||
placement="right">
|
||||
<div style="padding: 18px">
|
||||
<a-form ref="formRef" :model="infoObject" :rules="rules">
|
||||
<a-form-item ref="name" label="站点" name="name">
|
||||
<a-tree-select
|
||||
v-model:value="infoObject.name"
|
||||
show-search
|
||||
style="width: 100%"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择站点"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="zdTreeData"
|
||||
tree-node-filter-prop="label">
|
||||
<!-- 特殊处理情况 -->
|
||||
<!-- <template #title="{ value: val, label }">
|
||||
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
|
||||
<template v-else>{{ label }}</template>
|
||||
</template> -->
|
||||
</a-tree-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="设备类型" name="sbtype">
|
||||
<a-cascader
|
||||
v-model:value="infoObject.sbtype"
|
||||
:options="sbOptions"
|
||||
:show-search="{ filter }"
|
||||
placeholder="请选择设备类型" />
|
||||
</a-form-item>
|
||||
<a-form-item label="设备名称" name="sbName">
|
||||
<a-select
|
||||
v-model:value="infoObject.sbName"
|
||||
style="width: 100%"
|
||||
:autoClearSearchValue="true"
|
||||
placeholder="请选择设备名称">
|
||||
<a-select-option :key="1" :value="1"> AC001电表 </a-select-option>
|
||||
<a-select-option :key="2" :value="2"> AC002电表 </a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="设备点位" name="sbAdress">
|
||||
<a-select
|
||||
v-model:value="infoObject.sbAdress"
|
||||
show-search
|
||||
placeholder="请选择设备点位"
|
||||
style="width: 100%"
|
||||
:options="dwOptions"
|
||||
:filter-option="filterOption"
|
||||
@focus="handleFocus"
|
||||
@change="handleChange" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用规则" name="delivery">
|
||||
<a-switch
|
||||
v-model:checked="infoObject.delivery"
|
||||
:class="{
|
||||
'blue-background': infoObject.delivery,
|
||||
'grey-background': !infoObject.delivery,
|
||||
}" />
|
||||
</a-form-item>
|
||||
<a-form-item label="取值类型" name="qzType">
|
||||
<a-select
|
||||
v-model:value="infoObject.qzType"
|
||||
show-search
|
||||
placeholder="请选择设备点位"
|
||||
style="width: 100%"
|
||||
:options="qzOptions"
|
||||
:filter-option="filterOption"
|
||||
@change="handleQzChange" />
|
||||
</a-form-item>
|
||||
<a-form-item label="规则类型" name="resource">
|
||||
<a-radio-group v-model:value="infoObject.resource">
|
||||
<a-radio value="1">且(and)</a-radio>
|
||||
<a-radio value="2">或(or)</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="异常描述" name="desc">
|
||||
<a-textarea
|
||||
v-model:value="infoObject.desc"
|
||||
style="height: 32px"
|
||||
:autoSize="{ minRows: 1, maxRows: 1 }"
|
||||
show-count
|
||||
:maxlength="30" />
|
||||
</a-form-item>
|
||||
<template v-for="index in infoObject.alarmList?.length" :key="index">
|
||||
<a-form-item :label="`逻辑${index}`" name="alarm">
|
||||
<a-input style="width: 60px" v-model:value="infoObject.alarmList[index - 1].alarm" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="`数值${index}`" name="number">
|
||||
<a-input
|
||||
style="width: 60px"
|
||||
type="number"
|
||||
v-model:value="infoObject.alarmList[index - 1].number" />
|
||||
</a-form-item>
|
||||
</template>
|
||||
</a-form>
|
||||
</div>
|
||||
</ns-drawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { ref, toRaw } from 'vue';
|
||||
import type { CascaderProps, TreeSelectProps, SelectProps } from 'ant-design-vue';
|
||||
import type { ShowSearchType } from 'ant-design-vue/es/cascader';
|
||||
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
|
||||
const visible = ref(false);
|
||||
//表单数据
|
||||
const infoObject = ref({
|
||||
id: null,
|
||||
name: null,
|
||||
resource: null,
|
||||
desc: null,
|
||||
sbtype: null,
|
||||
delivery: null,
|
||||
alarmList: [{ alarm: null, number: null }],
|
||||
});
|
||||
const formRef = ref();
|
||||
//站点数
|
||||
const zdTreeData = ref<TreeSelectProps['treeData']>([
|
||||
{
|
||||
label: '铁路总局(T01)',
|
||||
value: 'T01',
|
||||
children: [
|
||||
{
|
||||
label: '济阳站(T0101)',
|
||||
value: 'T0101',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
//设备类型树
|
||||
const sbOptions: CascaderProps['options'] = [
|
||||
{
|
||||
value: '3',
|
||||
label: '3.电梯',
|
||||
children: [
|
||||
{
|
||||
value: '301',
|
||||
label: '301.扶梯',
|
||||
},
|
||||
{
|
||||
value: '302',
|
||||
label: '301.直梯',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '4.冷热源',
|
||||
children: [
|
||||
{
|
||||
value: '401',
|
||||
label: '402.冷水机组',
|
||||
},
|
||||
{
|
||||
value: '402',
|
||||
label: '403.热泵机组',
|
||||
},
|
||||
{
|
||||
value: '403',
|
||||
label: '403.锅炉',
|
||||
},
|
||||
{
|
||||
value: '404',
|
||||
label: '404.水处理机组',
|
||||
},
|
||||
{
|
||||
value: '405',
|
||||
label: '405.板式热交换机组',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
//设备点位
|
||||
const dwOptions = ref<SelectProps['options']>([
|
||||
{ value: '电压 (U)', label: '电压 (U)', code: '1' },
|
||||
{ value: '电流 (I)', label: '电流 (I)', code: '2' },
|
||||
{ value: '电流 (I)', label: 'a相电流 (Ia)', code: '3' },
|
||||
]);
|
||||
const filter: ShowSearchType['filter'] = (inputValue: any, path: any) => {
|
||||
return path.some(
|
||||
(option: any) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1,
|
||||
);
|
||||
};
|
||||
//取值类型
|
||||
const qzOptions = ref<SelectProps['options']>([
|
||||
{ value: '实时值', label: '实时值', code: '1' },
|
||||
{ value: '平均值', label: '平均值', code: '2' },
|
||||
]);
|
||||
//设备点位方法
|
||||
const filterOption = (input: string, option: any) => {
|
||||
console.log('搜索', option.value);
|
||||
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
const handleFocus = () => {
|
||||
console.log('点击');
|
||||
};
|
||||
const handleChange = (value: string) => {
|
||||
console.log(`selected ${value}`);
|
||||
console.log('选择', infoObject.value.sbAdress);
|
||||
//获得code
|
||||
dwOptions.value.forEach((item) => {
|
||||
if (item.value === value) {
|
||||
console.log('符合', item.code);
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleQzChange = (value: string) => {
|
||||
//获得code
|
||||
qzOptions.value.forEach((item) => {
|
||||
if (item.value === value) {
|
||||
console.log('符合', item.code);
|
||||
}
|
||||
});
|
||||
};
|
||||
const emit = defineEmits(['editObject']);
|
||||
//父调子 页面显示方法
|
||||
const toggle = (value: any) => {
|
||||
//判断 是新增 还是修改
|
||||
if (value) {
|
||||
infoObject.value = value;
|
||||
} else {
|
||||
infoObject.value = {
|
||||
id: null,
|
||||
name: null,
|
||||
resource: null,
|
||||
desc: null,
|
||||
sbtype: null,
|
||||
delivery: null,
|
||||
alarmList: [{ alarm: null, number: null }],
|
||||
};
|
||||
}
|
||||
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
//表单 判断规格
|
||||
const rules: Record<string, Rule[]> = {
|
||||
name: [{ required: true, message: '请选择站点', trigger: 'change' }],
|
||||
sbtype: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
||||
delivery: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
|
||||
sbName: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
|
||||
sbAdress: [{ required: true, message: '请选择设备点位', trigger: 'change' }],
|
||||
qzType: [{ required: true, message: '请选择取值类型', trigger: 'change' }],
|
||||
resource: [{ required: true, message: '请选择规则类型', trigger: 'change' }],
|
||||
desc: [{ required: true, message: '请输入异常描述', trigger: 'blur' }],
|
||||
alarm: [{ required: true, message: '请选择逻辑', trigger: 'blur' }],
|
||||
number: [{ required: true, message: '请输入数值', trigger: 'blur' }],
|
||||
};
|
||||
// 开关选择
|
||||
const changeSwitch = () => {
|
||||
console.log(infoObject.value.selectSwitch, '开关');
|
||||
};
|
||||
// 确认按钮
|
||||
const btnClick = () => {
|
||||
console.log(infoObject.value, '数据');
|
||||
console.log(dwOptions.value, '点位');
|
||||
dwOptions.value?.forEach;
|
||||
//数据是否验证通过
|
||||
formRef.value.validate().then(() => {
|
||||
console.log('values', infoObject, toRaw(infoObject));
|
||||
});
|
||||
//调用接口
|
||||
// http
|
||||
// .post(props.api, data)
|
||||
// .then(() => {
|
||||
// isLoading.value = false;
|
||||
// NsMessage.success('操作成功', 1, () => {
|
||||
// navigateBack();
|
||||
// });
|
||||
// })
|
||||
// .catch(() => {
|
||||
// isLoading.value = false;
|
||||
// });
|
||||
};
|
||||
//取消按钮
|
||||
const handleClose = () => {
|
||||
// 清楚校验错误信息
|
||||
formRef.value.resetFields();
|
||||
//对象清空
|
||||
infoObject.value = {
|
||||
id: null,
|
||||
name: null,
|
||||
resource: null,
|
||||
desc: null,
|
||||
sbtype: null,
|
||||
delivery: null,
|
||||
alarmList: [{ alarm: null, number: null }],
|
||||
};
|
||||
visible.value = false;
|
||||
NsMessage.success('操作成功');
|
||||
};
|
||||
defineExpose({
|
||||
toggle,
|
||||
handleClose,
|
||||
dwOptions,
|
||||
formRef,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.drawerContainer {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.blue-background.ant-switch-checked {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch {
|
||||
background-color: grey !important;
|
||||
}
|
||||
|
||||
.blue-background.ant-switch-checked .ant-switch-handle {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch .ant-switch-handle {
|
||||
background-color: grey !important;
|
||||
}
|
||||
/deep/ .ant-form-item-label {
|
||||
z-index: 20;
|
||||
text-align: right;
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<ns-drawer
|
||||
v-model:visible="visible"
|
||||
width="520"
|
||||
:title="infoObject?.id ? '编辑' : '新增'"
|
||||
:ok="btnClick"
|
||||
:cancel="handleClose"
|
||||
placement="right">
|
||||
<ns-form ref="formRef" :schemas="schemas" :model="infoObject" formLayout="vertical" />
|
||||
<div style="margin-left: 52px">
|
||||
应用规则:
|
||||
<a-switch
|
||||
v-model:checked="infoObject.isUse"
|
||||
:class="{
|
||||
'blue-background': infoObject.isUse,
|
||||
'grey-background': !infoObject.isUse,
|
||||
}"
|
||||
style="margin-left: 6px"
|
||||
@change="changeSwitch" />
|
||||
</div>
|
||||
</ns-drawer>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
|
||||
const visible = ref(false);
|
||||
//表单数据
|
||||
const infoObject = ref({});
|
||||
const formRef = ref();
|
||||
const emit = defineEmits(['editObject']);
|
||||
const toggle = (value) => {
|
||||
//判断 是新增 还是修改
|
||||
if (value) {
|
||||
infoObject.value = value;
|
||||
} else {
|
||||
infoObject.value = {
|
||||
accountNo: null,
|
||||
};
|
||||
}
|
||||
console.log('xxxx');
|
||||
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
const schemas = [
|
||||
{
|
||||
field: 'basicInfo',
|
||||
label: '',
|
||||
displayFormItem: false,
|
||||
class: 'ns-form-item-full',
|
||||
component: 'NsChildForm',
|
||||
componentProps: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'accountNo',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '告警标题不能为空',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题',
|
||||
maxLength: 20,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'select',
|
||||
label: '重复次数',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '重复次数不能为空',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请选择重复次数',
|
||||
|
||||
options: [
|
||||
{
|
||||
label: '单次',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '重复',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '累计',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'accountNo',
|
||||
label: '检测时长',
|
||||
component: 'NsInputNumber',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rules, value, cbfn) => {
|
||||
if (value && /^[0-9]*$/.test(value)) {
|
||||
cbfn();
|
||||
} else {
|
||||
cbfn('请输入正确的检测时长');
|
||||
}
|
||||
},
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
componentProps: {
|
||||
placeholder: '请输入监测时长',
|
||||
// maxLength: 30,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'danwei',
|
||||
label: '监测时长单位',
|
||||
component: 'NsSelect',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '监测时长单位不能为空',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请选择监测时长单位',
|
||||
options: [
|
||||
{
|
||||
label: '分',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '时',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '天',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'select',
|
||||
label: '优先级',
|
||||
component: 'NsSelect',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '优先级不能为空',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请选择优先级',
|
||||
options: [
|
||||
{
|
||||
label: '紧急',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '重要',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '一般',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
const changeSwitch = () => {
|
||||
console.log(infoObject.value.selectSwitch, '开关');
|
||||
};
|
||||
const btnClick = () => {
|
||||
//表单校验
|
||||
formRef.value.triggerSubmit().then((data: any) => {
|
||||
console.log('校验成功');
|
||||
console.log('data', infoObject.value);
|
||||
visible.value = false;
|
||||
NsMessage.success('操作成功');
|
||||
emit('editObject', null);
|
||||
//调用接口
|
||||
// http
|
||||
// .post(props.api, data)
|
||||
// .then(() => {
|
||||
// isLoading.value = false;
|
||||
// NsMessage.success('操作成功', 1, () => {
|
||||
// navigateBack();
|
||||
// });
|
||||
// })
|
||||
// .catch(() => {
|
||||
// isLoading.value = false;
|
||||
// });
|
||||
});
|
||||
};
|
||||
const handleClose = () => {
|
||||
// 清楚校验错误信息
|
||||
formRef.value.formElRef.clearValidate();
|
||||
console.log(infoObject.value);
|
||||
infoObject.value = {};
|
||||
visible.value = false;
|
||||
NsMessage.success('操作成功');
|
||||
};
|
||||
defineExpose({
|
||||
toggle,
|
||||
handleClose,
|
||||
formRef,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.drawerContainer {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.blue-background.ant-switch-checked {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch {
|
||||
background-color: grey !important;
|
||||
}
|
||||
|
||||
.blue-background.ant-switch-checked .ant-switch-handle {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch .ant-switch-handle {
|
||||
background-color: grey !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<a-tabs default-active-key="1" @change="callback">
|
||||
<a-tab-pane key="1" tab="通知管理">
|
||||
<ns-view-list-table v-bind="notificationConfig" ref="mainRef" @switch="changeUse" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="设备告警" force-render>
|
||||
<ns-view-list-table v-show="equipmentAlarm" class="table" v-bind="equipmentAlarmConfig" />
|
||||
<a-button
|
||||
v-if="!equipmentAlarm"
|
||||
type="primary"
|
||||
style="position: absolute; right: 130px; z-index: 99; top: 75px"
|
||||
@click="backequipmentAlarm"
|
||||
>返回</a-button
|
||||
>
|
||||
<!-- 新增 或 编辑 设备告警 -->
|
||||
<editeEquipmentAlarm ref="editEquipmentAlarm" @editObject="editObject" />
|
||||
<!-- 配置设备告警-->
|
||||
<configureDeviceAlarms v-show="!equipmentAlarm" ref="configureDeviceAlarms" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="能源告警">
|
||||
<energyAlarm class="full-height" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { notificationtableConfig } from './ts/notificationManagementConfig';
|
||||
import { equipmentAlarmTableConfig } from './ts/equipmentAlarmConfig';
|
||||
import { ref } from 'vue';
|
||||
import energyAlarm from './components/energyAlarm.vue';
|
||||
import editeEquipmentAlarm from './equipmentAlarm/editeEquipmentAlarm.vue';
|
||||
import configureDeviceAlarms from './equipmentAlarm/configureDeviceAlarms.vue';
|
||||
export default {
|
||||
name: 'AlarmSettings',
|
||||
components: { energyAlarm, editeEquipmentAlarm, configureDeviceAlarms },
|
||||
setup() {
|
||||
const mainRef = ref();
|
||||
const editEquipmentAlarm = ref();
|
||||
const configureDeviceAlarms = ref();
|
||||
const equipmentAlarm = ref(true);
|
||||
const notificationConfig = notificationtableConfig(null, null, null);
|
||||
const equipmentAlarmConfig = equipmentAlarmTableConfig(
|
||||
editEquipmentAlarm,
|
||||
null,
|
||||
equipmentAlarm,
|
||||
configureDeviceAlarms,
|
||||
);
|
||||
const callback = (key: any) => {
|
||||
console.log(key);
|
||||
};
|
||||
//返回设备告警
|
||||
const backequipmentAlarm = () => {
|
||||
equipmentAlarm.value = !equipmentAlarm.value;
|
||||
configureDeviceAlarms.value.show = false;
|
||||
};
|
||||
const changeUse = () => {
|
||||
console.log(mainRef.value);
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
// console.log(newList.value.formFinish, '数据');
|
||||
};
|
||||
// 编辑或添加成功 刷新列表
|
||||
const editObject = () => {
|
||||
console.log('添加成功 刷新列表');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
// console.log(newList.value.formFinish, '数据');
|
||||
};
|
||||
return {
|
||||
callback,
|
||||
notificationConfig,
|
||||
equipmentAlarmConfig,
|
||||
changeUse,
|
||||
editObject,
|
||||
editEquipmentAlarm,
|
||||
configureDeviceAlarms,
|
||||
equipmentAlarm,
|
||||
backequipmentAlarm,
|
||||
mainRef,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/deep/ .ant-tabs-nav {
|
||||
width: 100%;
|
||||
}
|
||||
.box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.full-height {
|
||||
height: 100%; /* 设置高度为父容器高度 */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"listData":[
|
||||
{
|
||||
"id": "d4",
|
||||
"isDel": "0",
|
||||
"officesId": "84",
|
||||
"deviceCode": "37430200143",
|
||||
"deviceName": "地听测试电表",
|
||||
"category": "1",
|
||||
"type": "1001",
|
||||
"energyCount": "1",
|
||||
"serialNumber": "69",
|
||||
"pidCode": null,
|
||||
"brand": "",
|
||||
"types": "",
|
||||
"manufacturer": "elit non in",
|
||||
"contacts": "ad reprehenderit",
|
||||
"phonenumber": "34",
|
||||
"position": "in esse commodo1",
|
||||
"activeState": "1",
|
||||
"measurementDirection": "1",
|
||||
"deviceMagnification": 62,
|
||||
"deviceAccuracy": "89",
|
||||
"frequency": "anim consequat irure",
|
||||
"standardFrequency": "ut elit",
|
||||
"deviceHead": "pariatur ex velit",
|
||||
"constructor": "84566",
|
||||
"voltageType": "cillum aliquip reprehenderit",
|
||||
"pt": 61,
|
||||
"ct": 64,
|
||||
"communicationProtocol": "cupidatat nisi ea ad",
|
||||
"ip": "",
|
||||
"port": "",
|
||||
"com": "",
|
||||
"slaveAddress": "",
|
||||
"dlt": "",
|
||||
"conversionIdentifier": "48",
|
||||
"multiplicationAdjustment": "1",
|
||||
"accessMethod": "1",
|
||||
"replacementFrequency": "0",
|
||||
"dataDetail": "sit",
|
||||
"insertTime": null,
|
||||
"children": null,
|
||||
"devicePointList": null,
|
||||
"insertUser": null,
|
||||
"isUse":true
|
||||
} , {
|
||||
"id": "d5",
|
||||
"isDel": "0",
|
||||
"officesId": "84",
|
||||
"deviceCode": "37430200143",
|
||||
"deviceName": "地听测试电表",
|
||||
"category": "1",
|
||||
"type": "1001",
|
||||
"energyCount": "1",
|
||||
"serialNumber": "69",
|
||||
"pidCode": null,
|
||||
"brand": "",
|
||||
"types": "",
|
||||
"manufacturer": "elit non in",
|
||||
"contacts": "ad reprehenderit",
|
||||
"phonenumber": "34",
|
||||
"position": "in esse commodo2",
|
||||
"activeState": "1",
|
||||
"measurementDirection": "1",
|
||||
"deviceMagnification": 62,
|
||||
"deviceAccuracy": "89",
|
||||
"frequency": "anim consequat irure",
|
||||
"standardFrequency": "ut elit",
|
||||
"deviceHead": "pariatur ex velit",
|
||||
"constructor": "84566",
|
||||
"voltageType": "cillum aliquip reprehenderit",
|
||||
"pt": 61,
|
||||
"ct": 64,
|
||||
"communicationProtocol": "cupidatat nisi ea ad",
|
||||
"ip": "",
|
||||
"port": "",
|
||||
"com": "",
|
||||
"slaveAddress": "",
|
||||
"dlt": "",
|
||||
"conversionIdentifier": "48",
|
||||
"multiplicationAdjustment": "1",
|
||||
"accessMethod": "1",
|
||||
"replacementFrequency": "0",
|
||||
"dataDetail": "sit",
|
||||
"insertTime": null,
|
||||
"children": null,
|
||||
"devicePointList": null,
|
||||
"insertUser": null,
|
||||
"isUse":true
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
const tableKeyMap = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '规则id',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '设备信心',
|
||||
dataIndex: 'deviceCode',
|
||||
},
|
||||
{
|
||||
title: '告警点位',
|
||||
dataIndex: 'deviceName',
|
||||
},
|
||||
{
|
||||
title: '判断条件',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '取值类型',
|
||||
dataIndex: 'position',
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '异常描述',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
dataIndex: 'isUse',
|
||||
},
|
||||
];
|
||||
const mockData = ref(data.listData);
|
||||
const doWnload = (url) => {
|
||||
const a = document.createElement('a');
|
||||
document.body.appendChild(a);
|
||||
a.href = encodeURI(url);
|
||||
//设置下载的文件名
|
||||
// a.download = fileName.value;
|
||||
//触发a标签的点击事件,进行下载
|
||||
a.click();
|
||||
};
|
||||
|
||||
export const configureDeviceAlarms = (editEquipmentAlarm, elFormula, title) => {
|
||||
return {
|
||||
title: '告警规则',
|
||||
// api: '/carbon_emission/device/getDeviceList',
|
||||
value: mockData.value,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'RoleTypeAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
editEquipmentAlarm.value.toggle();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
name: 'groupImport',
|
||||
type: 'primary',
|
||||
extra: {
|
||||
// api: props.postImportApi, // 导入接口名
|
||||
title: '设备信息', // 弹窗title
|
||||
templateName: 'whiteListUser', // 所使用的文件名称
|
||||
indexName: '设备id', // 匹配类型字段
|
||||
message: [
|
||||
{ label: '1、若必填项未填写,则不能进行导入操作' },
|
||||
{ label: `2、当重复时,则更新数据。` },
|
||||
{ label: '3、数据将从模版的第五行进行导入。' },
|
||||
{ label: '4、文件导入勿超过5MB。' },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
name: 'groupExports',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
type: 'primary',
|
||||
name: 'userBatchDel',
|
||||
dynamicDisabled: (data: any) => {
|
||||
return data.list.length === 0;
|
||||
},
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
isClearCheck: true,
|
||||
// api: origanizemanage.batchDel,
|
||||
dynamicParams: { userIds: 'userId[]' },
|
||||
},
|
||||
],
|
||||
columns: tableKeyMap,
|
||||
params: {
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
},
|
||||
// rowSelection: null, 选择按钮
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
editEquipmentAlarm.value.toggle(data);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
formConfig: {
|
||||
title: title,
|
||||
schemas: [
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警优先级',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择告警优先级',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择启用状态',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ref } from 'vue';
|
||||
const tableKeyMap = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '告警类型',
|
||||
dataIndex: 'deviceCode',
|
||||
},
|
||||
{
|
||||
title: '告警标题',
|
||||
dataIndex: 'deviceName',
|
||||
},
|
||||
{
|
||||
title: '错误码',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '重复次数',
|
||||
dataIndex: 'position',
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '监测时长',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
dataIndex: 'isUse',
|
||||
},
|
||||
];
|
||||
const mockData = ref(data.listData);
|
||||
const doWnload = (url) => {
|
||||
const a = document.createElement('a');
|
||||
document.body.appendChild(a);
|
||||
a.href = encodeURI(url);
|
||||
//设置下载的文件名
|
||||
// a.download = fileName.value;
|
||||
//触发a标签的点击事件,进行下载
|
||||
a.click();
|
||||
};
|
||||
|
||||
export const equipmentAlarmTableConfig = (
|
||||
editEquipmentAlarm,
|
||||
elFormula,
|
||||
equipmentAlarm,
|
||||
configureDeviceAlarms,
|
||||
) => {
|
||||
return {
|
||||
title: '告警规则',
|
||||
// api: '/carbon_emission/device/getDeviceList',
|
||||
value: mockData.value,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'RoleTypeAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
editEquipmentAlarm.value.toggle();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导入',
|
||||
name: 'groupImport',
|
||||
type: 'primary',
|
||||
extra: {
|
||||
// api: props.postImportApi, // 导入接口名
|
||||
title: '设备信息', // 弹窗title
|
||||
templateName: 'whiteListUser', // 所使用的文件名称
|
||||
indexName: '设备id', // 匹配类型字段
|
||||
message: [
|
||||
{ label: '1、若必填项未填写,则不能进行导入操作' },
|
||||
{ label: `2、当重复时,则更新数据。` },
|
||||
{ label: '3、数据将从模版的第五行进行导入。' },
|
||||
{ label: '4、文件导入勿超过5MB。' },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '导出',
|
||||
name: 'groupExports',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: tableKeyMap,
|
||||
params: {
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
},
|
||||
// rowSelection: null, 选择按钮
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '编辑',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
editEquipmentAlarm.value.toggle(data);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '配置',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
equipmentAlarm.value = !equipmentAlarm.value;
|
||||
configureDeviceAlarms.value.setconfigureDeviceAlarmsData(data);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警优先级',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择告警优先级',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择启用状态',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,164 @@
|
||||
import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { ref } from 'vue';
|
||||
const tableKeyMap = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'address',
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '告警类型',
|
||||
dataIndex: 'deviceCode',
|
||||
},
|
||||
{
|
||||
title: '告警标题',
|
||||
dataIndex: 'deviceName',
|
||||
},
|
||||
{
|
||||
title: '错误码',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '通知名单',
|
||||
dataIndex: 'position',
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '通知方式',
|
||||
dataIndex: 'position',
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
dataIndex: 'isUse',
|
||||
},
|
||||
];
|
||||
const mockData = ref(data.listData);
|
||||
export const notificationtableConfig = (el, elGroup, elFormula) => {
|
||||
return {
|
||||
title: '告警规则',
|
||||
// api: '/carbon_emission/device/getDeviceList',
|
||||
value: mockData.value,
|
||||
headerActions: [{}],
|
||||
columns: tableKeyMap,
|
||||
params: {
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
},
|
||||
// rowSelection: null, 选择按钮
|
||||
columnActions: {
|
||||
title: '操作',
|
||||
actions: [
|
||||
{
|
||||
label: '联系方式',
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
console.log(data, '联系方式');
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: '删除',
|
||||
// name: 'FeedBackDetail',
|
||||
// dynamicParams: ['uuid', 'appealType'],
|
||||
// confirm: true,
|
||||
// handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
// },
|
||||
// },
|
||||
],
|
||||
},
|
||||
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'name',
|
||||
label: '告警类型',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选告警类型',
|
||||
options: [
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警优先级',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择告警优先级',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '告警标题',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入告警标题关键字',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择启用状态',
|
||||
options: [
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
};
|
||||
@@ -2,8 +2,6 @@ import { dateUtil } from '/nerv-lib/util/date-util';
|
||||
import data from './mock.json';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { ref } from 'vue';
|
||||
import { group } from '/@/api/deviceManage';
|
||||
import { dict } from '/@/api';
|
||||
const tableKeyMap = [
|
||||
{
|
||||
title: '来源企业',
|
||||
@@ -59,105 +57,49 @@ const doWnload = (url) => {
|
||||
};
|
||||
|
||||
const mockData = ref(data.listData);
|
||||
export const formSchema = [
|
||||
{
|
||||
field: 'isCreate',
|
||||
component: 'NsInput',
|
||||
show: false,
|
||||
export const treeConfig = {
|
||||
defaultExpandAll: true,
|
||||
header: {
|
||||
icon: 'orgLink',
|
||||
title: '能耗分组',
|
||||
},
|
||||
{
|
||||
field: 'orgId',
|
||||
component: 'NsInput',
|
||||
show: false,
|
||||
|
||||
api: () => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(data);
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
{
|
||||
field: 'isCreatSon',
|
||||
component: 'NsInput',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: '节点名称',
|
||||
field: 'pointName',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入节点名称(必填)',
|
||||
},
|
||||
rules: [
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入节点名称',
|
||||
field: 'type',
|
||||
label: '',
|
||||
component: 'NsSelect',
|
||||
autoSubmit: true,
|
||||
defaultValue: 1,
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '碳排', value: 1 },
|
||||
{ label: '用电量', value: 2 },
|
||||
{ label: '用水量', value: 3 },
|
||||
{ label: '燃气量', value: 4 },
|
||||
{ label: '供热量', value: 5 },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '',
|
||||
component: 'NsInput',
|
||||
autoSubmit: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '节点类型',
|
||||
field: 'pointType',
|
||||
component: 'NsSelectApi',
|
||||
componentProps: {
|
||||
placeholder: '请选择节点类型(必填)',
|
||||
api: dict,
|
||||
params: { dicKey: 'COUNT_POINT' },
|
||||
immediate: true,
|
||||
resultField: 'data.COUNT_POINT',
|
||||
labelField: 'cnValue',
|
||||
valueField: 'cnValue',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入节点类型',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
export const treeConfig = (orgId) => {
|
||||
return {
|
||||
defaultExpandAll: true,
|
||||
header: {
|
||||
icon: 'orgLink',
|
||||
title: '能耗分组',
|
||||
},
|
||||
params: { orgId },
|
||||
api: group.queryDeviceGroupTree,
|
||||
// api: () => {
|
||||
// return new Promise((resolve) => {
|
||||
// setTimeout(() => {
|
||||
// resolve({ data: [{ title: '全部', key: 'all', children: data.data }] });
|
||||
// }, 100);
|
||||
// });
|
||||
// },
|
||||
transform: (data) => {
|
||||
return [{ title: '全部', key: 'all', selectable: false, children: data }];
|
||||
},
|
||||
formConfig: {
|
||||
schemas: [
|
||||
{
|
||||
field: 'energyType',
|
||||
label: '',
|
||||
component: 'NsSelectApi',
|
||||
autoSubmit: true,
|
||||
componentProps: {
|
||||
api: dict,
|
||||
params: { dicKey: 'ENERGY_TYPE' },
|
||||
immediate: true,
|
||||
resultField: 'data.ENERGY_TYPE',
|
||||
labelField: 'cnValue',
|
||||
valueField: 'cnValue',
|
||||
placeholder: '请选择能耗种类',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'pointName',
|
||||
label: '',
|
||||
component: 'NsInput',
|
||||
autoSubmit: true,
|
||||
componentProps: {
|
||||
placeholder: '请输入节点名称',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
};
|
||||
export const tableConfig = (el, elGroup, elFormula) => {
|
||||
return {
|
||||
|
||||
@@ -2,113 +2,29 @@
|
||||
<editDrawer ref="editDrawerRef" />
|
||||
<editGroup ref="editGroupRef" />
|
||||
<editFormula ref="editFormulaRef" />
|
||||
|
||||
<!-- <ns-modal ref="modalRef" title="新增" v-model:visible="visible">
|
||||
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="formVertical" />
|
||||
</ns-modal> -->
|
||||
|
||||
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" />
|
||||
<div class="groupContainer">
|
||||
<div class="tree">
|
||||
<ns-tree-api v-bind="tConfig" @select="handleSelect">
|
||||
<template #title="data">
|
||||
<div class="treeRow">
|
||||
<span>{{ data.title }}</span>
|
||||
<a-dropdown>
|
||||
<ns-icon name="actionMore" size="14" class="actionMore" />
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
v-for="(item, index) in actionList"
|
||||
:key="index"
|
||||
@click="item.func(data)">
|
||||
<span>{{ item.title }}</span>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</ns-tree-api>
|
||||
<ns-tree-api v-bind="treeConfig" @select="handleSelect" />
|
||||
</div>
|
||||
<ns-view-list-table v-show="defaultType" class="table" v-bind="config" />
|
||||
<ns-view-list-table v-show="!defaultType" class="table" v-bind="configCal" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, nextTick, onMounted, ref } from 'vue';
|
||||
import { tableConfig, treeConfig, tableConfigCal, formSchema } from './config';
|
||||
import { createVNode, onMounted, ref } from 'vue';
|
||||
import { tableConfig, treeConfig, tableConfigCal } from './config';
|
||||
import { useParams } from '/nerv-lib/use';
|
||||
import editDrawer from './edit.vue';
|
||||
import editGroup from './editGroup.vue';
|
||||
import editFormula from './editFormula.vue';
|
||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||
import NsModalFrom from '/@/components/ns-modal-form.vue';
|
||||
import { group } from '/@/api/deviceManage';
|
||||
|
||||
type opType = 'up' | 'down';
|
||||
const { getParams } = useParams();
|
||||
const modalFormRef = ref();
|
||||
const editDrawerRef = ref();
|
||||
const editGroupRef = ref();
|
||||
const editFormulaRef = ref();
|
||||
const defaultType = ref(true);
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
const config = tableConfig(editDrawerRef, editGroupRef, editFormulaRef);
|
||||
const configCal = tableConfigCal(editDrawerRef, editGroupRef, editFormulaRef);
|
||||
const tConfig = treeConfig(result);
|
||||
const nsModalFormConfig = ref({
|
||||
api: group.creatOrUpdate,
|
||||
data: {},
|
||||
title: '新增',
|
||||
schemas: formSchema,
|
||||
extraModalConfig: {
|
||||
bodyStyle: { paddingBottom: 0 },
|
||||
},
|
||||
});
|
||||
nextTick(() => {
|
||||
console.log(modalFormRef.value, 'modal');
|
||||
});
|
||||
|
||||
const addNodeSon = (data) => {
|
||||
console.log(data);
|
||||
nsModalFormConfig.value.title = '新增';
|
||||
nsModalFormConfig.value.data = {
|
||||
pointName: '新增',
|
||||
isCreate: true,
|
||||
isCreatSon: false,
|
||||
orgId: result,
|
||||
};
|
||||
modalFormRef.value?.toggle();
|
||||
};
|
||||
const editNode = (data) => {
|
||||
console.log(data);
|
||||
nsModalFormConfig.value.title = '编辑';
|
||||
nsModalFormConfig.value.data = { pointName: 123 };
|
||||
modalFormRef.value?.toggle();
|
||||
|
||||
data.value = { pointName: 'qwe' };
|
||||
};
|
||||
const moveNode = (data, type: opType) => {
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
const deleteNode = (a) => {
|
||||
NsModal.confirm({
|
||||
content: '确定删除吗?',
|
||||
onOk: () => {
|
||||
console.log(a);
|
||||
},
|
||||
});
|
||||
};
|
||||
const filterAction = (data) => {};
|
||||
const actionList = [
|
||||
{ title: '新增子节点', key: 'addNodeSon', func: (data) => addNodeSon(data) },
|
||||
{ title: '编辑', key: 'editNode', func: (data) => editNode(data) },
|
||||
{ title: '上移', key: 'moveUp', func: (data) => moveNode(data, 'up') },
|
||||
{ title: '下移', key: 'moveDown', func: (data) => moveNode(data, 'down') },
|
||||
{ title: '删除', key: 'deleteNode', func: (data) => deleteNode(data) },
|
||||
];
|
||||
const handleSelect = () => {
|
||||
defaultType.value = !defaultType.value;
|
||||
};
|
||||
@@ -139,21 +55,4 @@
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.actionMore {
|
||||
display: none;
|
||||
}
|
||||
:deep(.ant-tree-node-content-wrapper) {
|
||||
&:hover {
|
||||
.actionMore {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.treeRow {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -131,7 +131,6 @@ export const formConfig2 = (disabled2: Boolean) => {
|
||||
label: '是否部门领导',
|
||||
field: 'isLeader',
|
||||
component: 'NsRadioGroup',
|
||||
defaultValue: 1,
|
||||
componentProps: {
|
||||
disabled: disabled2,
|
||||
radioType: 'radio',
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
</a-tabs>
|
||||
<a-space v-if="activeKey === 1 || deptPermissionTreeData?.length">
|
||||
<ns-button type="primary" @click="CancelApartment">取消 </ns-button>
|
||||
<ns-button v-if="disabled" type="primary" @click="pipe(deptEdit, true, false)">
|
||||
<ns-button v-show="disabled" type="primary" @click="pipe(deptEdit, true, false)">
|
||||
编辑
|
||||
</ns-button>
|
||||
<ns-button v-else type="primary" @click="deptSure">确定</ns-button>
|
||||
<ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -79,11 +79,11 @@
|
||||
<a-row>
|
||||
<a-col :span="8" class="tree">
|
||||
<a-space wrap style="margin-bottom: 16px; justify-content: flex-start">
|
||||
<!-- <ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
|
||||
<ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
|
||||
新增角色
|
||||
</ns-button>
|
||||
<ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
|
||||
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button> -->
|
||||
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button>
|
||||
</a-space>
|
||||
<a-tree
|
||||
v-if="roleTreeData.length"
|
||||
@@ -95,19 +95,19 @@
|
||||
<template #title="data">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span> {{ data.zhName }}</span>
|
||||
<a-dropdown>
|
||||
<!-- <a-dropdown>
|
||||
<ns-icon name="actionMore" size="14" class="actionMore" />
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
v-for="(action, index) in filterAction(data, dropRoleActions, 'addUser')"
|
||||
v-for="(action, index) in dropRoleActions"
|
||||
:key="index"
|
||||
@click="action.func(data)">
|
||||
<span>{{ action.title }}</span>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</a-dropdown> -->
|
||||
</div>
|
||||
</template>
|
||||
</a-tree>
|
||||
@@ -139,16 +139,20 @@
|
||||
<a-empty style="margin-top: 120px" v-else />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<a-space v-if="roleActiveKey === 1 || rolePermissionTreeData?.length">
|
||||
<a-space>
|
||||
<ns-button type="primary" @click="CancelUser">取消</ns-button>
|
||||
<ns-button
|
||||
v-if="roleDisabled"
|
||||
v-show="roleDisabled"
|
||||
:disabled="!roleTreeData?.length"
|
||||
type="primary"
|
||||
@click="rolePipe(roleEdit, false, false)">
|
||||
编辑
|
||||
</ns-button>
|
||||
<ns-button v-else :disabled="!roleTreeData?.length" type="primary" @click="roleSure">
|
||||
<ns-button
|
||||
v-show="!roleDisabled"
|
||||
:disabled="!roleTreeData?.length"
|
||||
type="primary"
|
||||
@click="roleSure">
|
||||
确定
|
||||
</ns-button>
|
||||
</a-space>
|
||||
@@ -163,7 +167,7 @@
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { cloneDeep, get, isEmpty } from 'lodash-es';
|
||||
import { cloneDeep, get } from 'lodash-es';
|
||||
import { formConfig, formConfig2 } from './config';
|
||||
import { department } from '/@/api/origanizemanage';
|
||||
import { permission } from '/@/api/origanizemanage';
|
||||
@@ -176,7 +180,7 @@
|
||||
const formRef = ref();
|
||||
const formRoleRef = ref();
|
||||
let formData = ref({});
|
||||
let roleFormData = ref({ isLeader: 1 });
|
||||
let roleFormData = ref({});
|
||||
const activeKey = ref(1);
|
||||
const roleActiveKey = ref(1);
|
||||
const disabled = ref(true);
|
||||
@@ -220,7 +224,7 @@
|
||||
|
||||
/**操作拦截 */
|
||||
const pipe = (func: Function, flag = false, toggle = true) => {
|
||||
// if (toggle) activeKey.value = 1;
|
||||
if (toggle) activeKey.value = 1;
|
||||
if (flag) {
|
||||
// 只有部门的操作
|
||||
if (selectRef.value?.hasOwnProperty('orgInfo') || !selectRef.value?.deptInfo) {
|
||||
@@ -239,15 +243,13 @@
|
||||
|
||||
const rolePipe = (func: Function, linkDept = false, toggle = true) => {
|
||||
console.log(selectRoleRef.value);
|
||||
// if (toggle) roleActiveKey.value = 1;
|
||||
if (toggle) roleActiveKey.value = 1;
|
||||
// 需要先选择部门
|
||||
if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) {
|
||||
NsMessage.error('请先选择相关部门');
|
||||
return;
|
||||
}
|
||||
console.log(123);
|
||||
|
||||
if (!linkDept && isEmpty(selectRoleRef.value)) {
|
||||
if (!linkDept && !selectRoleRef.value) {
|
||||
NsMessage.error('请先选择相关角色');
|
||||
return;
|
||||
}
|
||||
@@ -300,7 +302,6 @@
|
||||
item['deptInfo'] = item.orgInfo;
|
||||
item['deptInfo']['deptName'] = item?.orgInfo?.orgName;
|
||||
item['own'] = !index;
|
||||
item['selectable'] = false;
|
||||
item['children'] = item.deptTrees;
|
||||
return item;
|
||||
});
|
||||
@@ -324,7 +325,7 @@
|
||||
// 获取角色树
|
||||
const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => {
|
||||
return http.post(department.queryRoleTree, params).then((res) => {
|
||||
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: res.data }];
|
||||
roleTreeData.value = res.data;
|
||||
});
|
||||
};
|
||||
// 根据依赖刷新角色树
|
||||
@@ -333,12 +334,12 @@
|
||||
getUserTree().then(() => {
|
||||
if (!roleTreeData.value?.length) {
|
||||
selectRoleRef.value = {};
|
||||
roleFormData.value = { isLeader: 1 };
|
||||
roleFormData.value = {};
|
||||
}
|
||||
const info = {
|
||||
node: { key: '0-0-0', dataRef: { ...roleTreeData.value[0].children[0] } },
|
||||
node: { key: '0-0', dataRef: { ...roleTreeData.value[0] } },
|
||||
};
|
||||
SelectUserTree([''], info);
|
||||
SelectUserTree(['0-0'], info);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -350,10 +351,8 @@
|
||||
callback: null,
|
||||
};
|
||||
|
||||
// 添加部门
|
||||
const addApartment = (data) => {
|
||||
const { deptInfo } = data;
|
||||
activeKey.value = 1;
|
||||
|
||||
disabled.value = false;
|
||||
opMap.type = 'addDept';
|
||||
@@ -370,17 +369,23 @@
|
||||
orgId: deptInfo?.orgId,
|
||||
sourceOrgId,
|
||||
projectId,
|
||||
pdeptId: deptInfo.pdeptId || '',
|
||||
orgName,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// 添加子部门
|
||||
const getParent = (data) => {
|
||||
if (data?.parent) {
|
||||
getParent(data.parent);
|
||||
} else {
|
||||
data;
|
||||
}
|
||||
};
|
||||
|
||||
const addApartmentSon = (data) => {
|
||||
const { deptInfo } = data;
|
||||
activeKey.value = 1;
|
||||
|
||||
disabled.value = false;
|
||||
opMap.type = 'addson';
|
||||
formData.value = {};
|
||||
@@ -402,11 +407,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
const addUser = (data) => {
|
||||
const addUser = () => {
|
||||
roleDisabled.value = false;
|
||||
opMap.type = 'addUser';
|
||||
roleFormData.value = { isLeader: 1 };
|
||||
roleActiveKey.value = 1;
|
||||
roleFormData.value = {};
|
||||
opMap.fuc = (params) => {
|
||||
delete params.roleId;
|
||||
return formRoleRef.value.triggerSubmit().then(() => {
|
||||
@@ -414,7 +418,6 @@
|
||||
...params,
|
||||
orgId,
|
||||
projectId,
|
||||
proleId: data.proleId || '',
|
||||
deptId: selectRef.value.deptInfo.deptId,
|
||||
deptName: selectRef.value.deptInfo.deptName,
|
||||
});
|
||||
@@ -422,11 +425,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
const addUserSon = (data) => {
|
||||
const addUserSon = () => {
|
||||
roleDisabled.value = false;
|
||||
opMap.type = 'addUserSon';
|
||||
roleActiveKey.value = 1;
|
||||
roleFormData.value = { isLeader: 1 };
|
||||
roleFormData.value = {};
|
||||
opMap.fuc = (params) => {
|
||||
delete params.roleId;
|
||||
return formRoleRef.value.triggerSubmit().then(() => {
|
||||
@@ -434,7 +436,7 @@
|
||||
...params,
|
||||
orgId,
|
||||
projectId,
|
||||
proleId: data.roleId,
|
||||
proleId: selectRoleRef.value.roleId,
|
||||
deptId: selectRef.value.deptInfo.deptId,
|
||||
deptName: selectRef.value.deptInfo.deptName,
|
||||
});
|
||||
@@ -442,6 +444,8 @@
|
||||
};
|
||||
};
|
||||
const deleteDept = (data) => {
|
||||
console.log(data);
|
||||
|
||||
// 删除逻辑
|
||||
Modal.confirm({
|
||||
title: '是否确认删除',
|
||||
@@ -454,7 +458,6 @@
|
||||
// 删除选中的数据需要清空
|
||||
deptTreeSelectedKeys.value = [];
|
||||
selectRef.value = '';
|
||||
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: [] }];
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -464,20 +467,16 @@
|
||||
});
|
||||
};
|
||||
|
||||
const deleteUser = (data) => {
|
||||
const deleteUser = () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除',
|
||||
onOk() {
|
||||
http.post(department.delRole, { roleId: data.roleId }).then(() => {
|
||||
http.post(department.delRole, { roleId: selectRoleRef.value.roleId }).then(() => {
|
||||
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
|
||||
clearRoleData();
|
||||
// 清空select树
|
||||
if (data.selected) {
|
||||
// 删除选中的数据需要清空
|
||||
roleTreeSelectedKeys.value = [];
|
||||
selectRoleRef.value = '';
|
||||
}
|
||||
|
||||
roleTreeSelectedKeys.value = [];
|
||||
selectRoleRef.value = '';
|
||||
NsMessage.success('操作成功');
|
||||
});
|
||||
},
|
||||
@@ -555,7 +554,6 @@
|
||||
};
|
||||
// 保存角色权限
|
||||
const rolePermission = () => {
|
||||
if (!roleTotalCheckedKeys.value?.length) return;
|
||||
http
|
||||
.post(department.addRolePermission, {
|
||||
// deptId: selectRef.value?.deptInfo.deptId,
|
||||
@@ -647,7 +645,6 @@
|
||||
rolePermissionTreeData.value = [];
|
||||
roleCheckedKeys.value = [];
|
||||
roleTreeSelectedKeys.value = [];
|
||||
roleDisabled.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -742,10 +739,10 @@
|
||||
// { title: '新增角色', func: addUser, key: 'addUser' },
|
||||
]);
|
||||
|
||||
const filterAction = (data, actions, keyV = 'addDept') => {
|
||||
const filterAction = (data, actions) => {
|
||||
if (data.hasOwnProperty('orgInfo')) {
|
||||
// 企业节点
|
||||
return actions.filter(({ key }) => key === keyV);
|
||||
return actions.filter(({ key }) => key === 'addDept');
|
||||
}
|
||||
return actions;
|
||||
};
|
||||
|
||||
@@ -44,7 +44,6 @@ export const formConfig = (disabled) => {
|
||||
label: '性别',
|
||||
field: 'sex',
|
||||
component: 'NsRadioGroup',
|
||||
defaultValue: '男',
|
||||
componentProps: {
|
||||
radioType: 'radio',
|
||||
options: [
|
||||
|
||||
@@ -4,17 +4,30 @@
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
<div class="top">
|
||||
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect" v-model:treeData="treeData">
|
||||
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect">
|
||||
<template #title="data">
|
||||
{{ data.orgInfo?.orgName }}
|
||||
</template>
|
||||
</ns-tree-api>
|
||||
</div>
|
||||
<div class="top">
|
||||
<ns-tree-api
|
||||
v-bind="deptTreeConfig"
|
||||
@select="handleSelect2"
|
||||
v-model:treeData="treeDataDept">
|
||||
<!-- <div class="ns-table-title">关联部门</div>
|
||||
|
||||
<a-input-search
|
||||
v-model:value="searchValue2"
|
||||
style="margin-bottom: 8px"
|
||||
placeholder="请输入关联部门"
|
||||
@search="onSearch2" />
|
||||
<a-tree
|
||||
v-if="treeData2?.length"
|
||||
:tree-data="treeData2"
|
||||
defaultExpandAll
|
||||
@select="handleSelect2">
|
||||
<template #title="data">
|
||||
{{ data.deptInfo?.deptName }}
|
||||
</template>
|
||||
</a-tree> -->
|
||||
<ns-tree-api v-bind="deptTreeConfig" @select="handleSelect2">
|
||||
<template #title="data">
|
||||
{{ data.deptInfo?.deptName }}
|
||||
</template>
|
||||
@@ -74,7 +87,7 @@
|
||||
import { formConfig, formConfig2 } from './config';
|
||||
import { origanizemanage } from '/@/api/origanizemanage';
|
||||
|
||||
defineOptions({ name: 'UserManageIndex' });
|
||||
defineOptions({ name: 'OrderListIndex' });
|
||||
|
||||
const mainRef = ref();
|
||||
const data = reactive({});
|
||||
@@ -100,21 +113,19 @@
|
||||
const casData = ref([]);
|
||||
const formSchema2 = formConfig2(casData);
|
||||
const treeData = ref([]);
|
||||
const treeDataDept = ref([]);
|
||||
const treeData2 = ref([]);
|
||||
const userAuthList = ref([]);
|
||||
// const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||
const orgId = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||
const orgTreeConfig = ref({
|
||||
selectedKeys: ['0-0'],
|
||||
defaultExpandAll: true,
|
||||
api: origanizemanage.queryOrgTree,
|
||||
params: { orgId },
|
||||
defaultParams: { orgId },
|
||||
transform: (data) => {
|
||||
const otherOrg = data[0]?.listOrg;
|
||||
const otherOrg = data[0].listOrg;
|
||||
let treeData = [];
|
||||
// 特殊处理
|
||||
if (data[0]?.orgInfo) {
|
||||
if (data[0].orgInfo) {
|
||||
treeData = data;
|
||||
}
|
||||
otherOrg?.map((item) => {
|
||||
@@ -142,7 +153,7 @@
|
||||
const deptTreeConfig = ref({
|
||||
defaultExpandAll: true,
|
||||
api: origanizemanage.queryDeptTree,
|
||||
params: { orgId },
|
||||
defaultParams: { orgId },
|
||||
|
||||
header: {
|
||||
title: '关联部门',
|
||||
@@ -181,11 +192,11 @@
|
||||
});
|
||||
});
|
||||
};
|
||||
// getOrgTree();
|
||||
getOrgTree();
|
||||
// 部门树
|
||||
// fetch(origanizemanage.queryDeptTree).then((res) => {
|
||||
// treeData2.value = res.data;
|
||||
// });
|
||||
fetch(origanizemanage.queryDeptTree).then((res) => {
|
||||
treeData2.value = res.data;
|
||||
});
|
||||
|
||||
const onSearch = () => {
|
||||
console.log(searchValue.value);
|
||||
@@ -214,10 +225,8 @@
|
||||
};
|
||||
|
||||
const handleSelect = (selectedKeys: any, info: any) => {
|
||||
console.log(info);
|
||||
|
||||
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
||||
treeDataDept.value = res.data;
|
||||
treeData2.value = res.data;
|
||||
});
|
||||
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
||||
};
|
||||
@@ -289,7 +298,6 @@
|
||||
opMap.value.type = 'add';
|
||||
setTimeout(() => {
|
||||
formData.value = {
|
||||
sex: '男',
|
||||
orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
|
||||
};
|
||||
userAuthList.value.splice(0);
|
||||
@@ -342,23 +350,30 @@
|
||||
customRender: (text: any) => {
|
||||
return text.index + 1;
|
||||
},
|
||||
sorter: true,
|
||||
sorter: {
|
||||
compare: (a, b) => a.address - b.address,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'accountNo',
|
||||
sorter: true,
|
||||
sorter: {
|
||||
compare: (a, b) => a.accountNo - b.accountNo,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'realName',
|
||||
sorter: true,
|
||||
sorter: {
|
||||
compare: (a, b) => a.realName - b.realName,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'sex',
|
||||
sorter: true,
|
||||
textNumber: 4,
|
||||
sorter: {
|
||||
compare: (a, b) => a.name - b.name,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
@@ -366,15 +381,11 @@
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
textNumber: 5,
|
||||
textEllipsis: true,
|
||||
dataIndex: 'email',
|
||||
},
|
||||
{
|
||||
title: '组织关系',
|
||||
dataIndex: 'orgName',
|
||||
// textNumber: 9,
|
||||
// textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '部门/角色',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/projectIcon.svg" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="referrer" content="never" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!-- <script type="text/javascript">
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
||||
<g id="组_23402" data-name="组 23402" transform="translate(-959.12 -738.12)">
|
||||
<rect id="矩形_16530" data-name="矩形 16530" width="36" height="36" transform="translate(959.12 738.12)" fill="none"/>
|
||||
<g id="组_23400" data-name="组 23400" transform="translate(960.956 739.956)">
|
||||
<path id="路径_30576" data-name="路径 30576" d="M207.674,163.872v-9.284a2.553,2.553,0,0,0-1.179-2.063l-8.056-4.634a2.417,2.417,0,0,0-2.358,0l-8.023,4.65a2.38,2.38,0,0,0-1.179,2.063v9.333A2.553,2.553,0,0,0,188.059,166l8.056,4.585a2.417,2.417,0,0,0,2.358,0l8.056-4.634A2.331,2.331,0,0,0,207.674,163.872Z" transform="translate(-181.117 -142.881)" fill="#4388fb" opacity="0.2"/>
|
||||
<path id="路径_30577" data-name="路径 30577" d="M265.893,314.283h-2.718l-.884-2.653h-4.224l-.884,2.653h-2.718l4.224-11.625h2.9Zm-4.093-4.617-1.326-4.044a9.365,9.365,0,0,1-.2-1.015h-.065a5.831,5.831,0,0,1-.2,1.015l-1.326,4.044Zm8.072-7.073v11.625h-2.456V302.592Z" transform="translate(-246.539 -292.932)" fill="#4388fb"/>
|
||||
<path id="路径_30578" data-name="路径 30578" d="M36.685,20.095a.9.9,0,0,0-.884.884v2.472a1.535,1.535,0,0,1-.77,1.294L23.7,31.262a1.422,1.422,0,0,1-1.523,0l-11.33-6.517a1.456,1.456,0,0,1-.77-1.294V20.177a2.409,2.409,0,0,0-1-4.6,2.425,2.425,0,0,0-2.423,2.407,2.391,2.391,0,0,0,1.637,2.276v3.176a3.268,3.268,0,0,0,1.637,2.816l11.33,6.582a3.244,3.244,0,0,0,1.637.409,3.471,3.471,0,0,0,1.637-.475l11.281-6.517a3.268,3.268,0,0,0,1.637-2.816V20.963A.76.76,0,0,0,36.685,20.095Zm.884-6.942V10.287a3.268,3.268,0,0,0-1.637-2.816L24.585.954a3.284,3.284,0,0,0-3.291,0L9.947,7.471A3.268,3.268,0,0,0,8.31,10.287v2.227a.884.884,0,1,0,1.768,0V10.287a1.535,1.535,0,0,1,.77-1.294l11.33-6.517a1.422,1.422,0,0,1,1.523,0L34.982,9.059a1.456,1.456,0,0,1,.77,1.294v2.734a2.4,2.4,0,1,0,1.817.065Z" transform="translate(-6.656 -0.512)" fill="#4388fb"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -6,14 +6,23 @@ const home = {
|
||||
redirect: { name: 'homeIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'homeIndex',
|
||||
component: () => import('/@/view/developing.vue'),
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
path: 'homeModule',
|
||||
name: 'HomeModule',
|
||||
meta: { title: '首页', hideChildren: true, icon: 'dicizhishou' },
|
||||
component: Base,
|
||||
redirect: { name: 'homeIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'homeIndex',
|
||||
component: () => import('/@/view/developing.vue'),
|
||||
meta: {
|
||||
title: '首页',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
const Base = () => import('/nerv-lib/saas/view/system/layout/content.vue');
|
||||
const organizationManage = {
|
||||
path: '/organizationManage',
|
||||
name: 'EnterpriseManage',
|
||||
name: 'organizationManage',
|
||||
meta: { title: '企业管理', icon: 'dicizhishou', index: 99, hideChildren: true },
|
||||
redirect: { name: 'EnterpriseManageIndex' },
|
||||
redirect: { name: 'EnterpriseManage' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'EnterpriseManageIndex',
|
||||
component: () => import('/@/view/organizationManage/enterpriseManage/index.vue'),
|
||||
meta: {
|
||||
title: '企业管理',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
path: 'enterpriseManage',
|
||||
name: 'EnterpriseManage',
|
||||
meta: { title: '企业管理', hideChildren: true, icon: 'dicizhishou' },
|
||||
component: Base,
|
||||
redirect: { name: 'EnterpriseManageIndex' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'EnterpriseManageIndex',
|
||||
component: () => import('/@/view/organizationManage/enterpriseManage/index.vue'),
|
||||
meta: {
|
||||
title: '企业管理',
|
||||
keepAlive: true,
|
||||
// backApi: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
// .ant-menu-dark.ant-menu-horizontal>.ant-menu-item:hover {
|
||||
// background-color: #43BB79 !important;
|
||||
// }
|
||||
|
||||
|
||||
.ant-menu-inline .ant-menu-item,
|
||||
.ant-menu-inline .ant-menu-submenu-title {
|
||||
max-width: 100% !important;
|
||||
transition: none !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.ns-basic-table .ant-btn:hover {
|
||||
@@ -47,17 +46,17 @@
|
||||
}
|
||||
|
||||
// header菜单字体样式
|
||||
// .ant-menu-dark.ant-menu-horizontal>.ant-menu-item,
|
||||
// .ant-menu-dark.ant-menu-horizontal>.ant-menu-submenu {
|
||||
// color: #fff;
|
||||
// }
|
||||
.ant-menu-dark.ant-menu-horizontal>.ant-menu-item,
|
||||
.ant-menu-dark.ant-menu-horizontal>.ant-menu-submenu {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
// .ant-menu-dark .ant-menu-item,
|
||||
// .ant-menu-dark .ant-menu-item-group-title,
|
||||
// .ant-menu-dark .ant-menu-item>a,
|
||||
// .ant-menu-dark .ant-menu-item>span>a {
|
||||
// color: #fff;
|
||||
// }
|
||||
.ant-menu-dark .ant-menu-item,
|
||||
.ant-menu-dark .ant-menu-item-group-title,
|
||||
.ant-menu-dark .ant-menu-item>a,
|
||||
.ant-menu-dark .ant-menu-item>span>a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
/*给字体命名*/
|
||||
@@ -112,13 +111,13 @@
|
||||
|
||||
.ant-menu-title-content {
|
||||
svg {
|
||||
// color: #A1ABC2;
|
||||
color: #A1ABC2;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-menu-item-selected {
|
||||
svg {
|
||||
// color: #D0DBF5;
|
||||
color: #D0DBF5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +181,3 @@
|
||||
background-color: #AEAEAE;
|
||||
}
|
||||
}
|
||||
|
||||
#app {
|
||||
min-width: 1200px;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
ref="formElRef"
|
||||
:model="formModel">
|
||||
<div v-if="showAction && showExpandAll" class="ns-form-title ns-title-extra-box">
|
||||
<span>查询</span>
|
||||
<span> {{ title ? title : '查询' }}</span>
|
||||
<a-button type="link" class="ns-operate-expand" @click="expandAll = !expandAll">
|
||||
<template v-if="expandAll">
|
||||
收起筛选
|
||||
@@ -107,6 +107,7 @@
|
||||
const isInitDefaultValueRef = ref(false);
|
||||
const expandRef = ref(props.expand);
|
||||
const expandAll = ref(props.expandAll);
|
||||
const title = ref(props.title);
|
||||
const formModel = computed(() => {
|
||||
return props.model;
|
||||
});
|
||||
@@ -120,8 +121,14 @@
|
||||
provide('addChildForm', addChildForm);
|
||||
|
||||
const getFormClass = computed(() => {
|
||||
if (props.formLayout) {
|
||||
return formConfig.formLayout[props.formLayout as keyof typeof formConfig.formLayout];
|
||||
if (props.formLayout === 'flexVertical') {
|
||||
return formConfig.formLayout.flexVertical;
|
||||
}
|
||||
if (props.formLayout === 'flex') {
|
||||
return formConfig.formLayout.flex;
|
||||
}
|
||||
if (props.formLayout === 'flexv2') {
|
||||
return formConfig.formLayout.flexv2;
|
||||
}
|
||||
return formConfig.formLayout.vertical;
|
||||
});
|
||||
@@ -315,6 +322,7 @@
|
||||
splitNumber,
|
||||
finish,
|
||||
expandAll,
|
||||
title,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -18,4 +18,5 @@ export const formProps = {
|
||||
// 收起全部
|
||||
expandAll: PropTypes.bool.def(true), // 默认是否全部展开
|
||||
showExpandAll: PropTypes.bool.def(true), // 是否展示右上角的全部收起展开
|
||||
title: PropTypes.bool.def(false), // 是否展示右上角的全部收起展开
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
:expand="expand"
|
||||
:showExpand="showExpand"
|
||||
:expandAll="expandAll"
|
||||
:title="formConfig.title"
|
||||
:showExpandAll="showExpandAll"
|
||||
:model="formModel"
|
||||
@finish="formFinish" />
|
||||
@@ -140,6 +141,16 @@
|
||||
<span class="text-ellipsis" v-else> - </span>
|
||||
</span>
|
||||
</template>
|
||||
<!-- 添加关闭按钮 -->
|
||||
<template v-if="data.column.dataIndex === 'isUse'">
|
||||
<a-switch
|
||||
v-model:checked="data.record.isUse"
|
||||
:class="{
|
||||
'blue-background': data.record.isUse,
|
||||
'grey-background': !data.record.isUse,
|
||||
}"
|
||||
@click="clickSwitch({ isUse: data.record.isUse, record: data.record })" />
|
||||
</template>
|
||||
<template v-if="data.column.dataIndex === 'tableAction'">
|
||||
<ns-table-action
|
||||
:data="data.record"
|
||||
@@ -349,6 +360,10 @@
|
||||
page: 1,
|
||||
});
|
||||
}, 300);
|
||||
/* 点击开关按钮 */
|
||||
const clickSwitch = (data: object) => {
|
||||
emit('switch', data);
|
||||
};
|
||||
|
||||
function setLoading(loading: boolean) {
|
||||
tableState.loading = loading;
|
||||
@@ -632,6 +647,7 @@
|
||||
tableState,
|
||||
isEmpty,
|
||||
formFinish,
|
||||
clickSwitch,
|
||||
tableChangeEvent,
|
||||
treeSelect,
|
||||
getTreeBindValue,
|
||||
@@ -746,4 +762,27 @@
|
||||
word-break: break-word;
|
||||
width: 100%;
|
||||
}
|
||||
.blue-background.ant-switch-checked {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch {
|
||||
background-color: grey !important;
|
||||
}
|
||||
|
||||
.blue-background.ant-switch-checked .ant-switch-handle {
|
||||
background-color: linear-gradient(
|
||||
180deg,
|
||||
rgba(1, 206, 255, 1) 0%,
|
||||
rgba(0, 150, 229, 1) 100%
|
||||
) !important;
|
||||
}
|
||||
|
||||
.grey-background.ant-switch .ant-switch-handle {
|
||||
background-color: grey !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,6 @@ export const treeProps = {
|
||||
type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
|
||||
default: undefined,
|
||||
},
|
||||
treeData: PropTypes.array.def([]),
|
||||
params: PropTypes.object.def(() => ({})),
|
||||
dynamicParams: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="min-height: 300px; overflow-y: scroll">
|
||||
<div style="min-height: 300px">
|
||||
<ns-tree v-if="treeData?.length" v-bind="getBindValue" v-model:selectedKeys="selectedKeys">
|
||||
<template #[item]="data" v-for="(item, index) in Object.keys($slots)" :key="index">
|
||||
<slot :name="item" v-bind="{ ...data, formModel } || {}"></slot>
|
||||
<slot :name="item" v-bind="data || {}"></slot>
|
||||
</template>
|
||||
</ns-tree>
|
||||
<!-- <a-empty v-if="!treeData?.length" /> -->
|
||||
@@ -21,7 +21,7 @@
|
||||
</a-spin>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, reactive, ref, unref, useAttrs, watch } from 'vue';
|
||||
import { computed, nextTick, reactive, ref, unref, useAttrs } from 'vue';
|
||||
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
|
||||
import { useApi } from '/nerv-lib/use/use-api';
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
@@ -33,28 +33,16 @@
|
||||
defineOptions({
|
||||
name: 'NsTreeApi',
|
||||
});
|
||||
const emit = defineEmits(['update:treeData']);
|
||||
// const model = defineModel('treeData');
|
||||
|
||||
const formElRef = ref();
|
||||
const props = defineProps(treeProps);
|
||||
|
||||
const treeData = ref(props.treeData);
|
||||
const treeData = ref<TreeDataItem[]>([]);
|
||||
const selectedKeys = ref(props.selectedKeys || []);
|
||||
const { httpRequest } = useApi();
|
||||
const requestConfig: AxiosRequestConfig = { method: 'get' };
|
||||
const route = useRoute();
|
||||
const attrs = useAttrs();
|
||||
const formModel = reactive({});
|
||||
watch(
|
||||
() => props.treeData,
|
||||
(val) => {
|
||||
treeData.value = val;
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const treeState = reactive({
|
||||
loading: false,
|
||||
});
|
||||
@@ -68,7 +56,6 @@
|
||||
return props.isSticky ? 'sticky' : 'static';
|
||||
});
|
||||
const formFinish = debounce((data: object) => {
|
||||
selectedKeys.value = [];
|
||||
getData(data);
|
||||
}, 200);
|
||||
const getBindValue = computed(() => ({
|
||||
@@ -96,8 +83,6 @@
|
||||
})
|
||||
.then((res) => {
|
||||
treeData.value = transform(get(res, resultField));
|
||||
emit('update:treeData', treeData.value);
|
||||
// model.value = treeData.value;
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
|
||||
@@ -11,17 +11,6 @@ export const formConfig = {
|
||||
gutter: [0, 0],
|
||||
justify: 'space-around',
|
||||
},
|
||||
formVertical: {
|
||||
layout: 'horizontal',
|
||||
class: 'ns-vertical-form',
|
||||
wrapperCol: { span: 24 },
|
||||
labelCol: { span: 0 },
|
||||
span: 24,
|
||||
sm: null, //≥576px <=768
|
||||
lg: null, //>= 768
|
||||
gutter: [0, 0],
|
||||
justify: 'space-around',
|
||||
},
|
||||
flex: {
|
||||
// layout: 'horizontal',
|
||||
class: 'ns-flex-form ns-flex-form-horizontal',
|
||||
|
||||
@@ -19,51 +19,33 @@
|
||||
<h1 class="lg_card_title">{{ configStore.projectName }}</h1>
|
||||
<p v-show="!errorShow" style="height: 8px"></p>
|
||||
<p v-show="errorShow" class="lg_card_error">{{ errorMsg }}</p>
|
||||
<a-form name="basic" :model="formState" @finish="submit">
|
||||
<a-form-item name="userName" :rules="[{ required: true, message: '请输入用户名' }]">
|
||||
<!-- <p class="lg_card_tip">用户名/手机号</p> -->
|
||||
<a-input class="loginInfo" placeholder="用户名" v-model:value="userName">
|
||||
<template #prefix>
|
||||
<ns-icon class="loginIcon" name="userName" size="19" style="margin-right: 20px" />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<!-- <p class="lg_card_tip">用户名/手机号</p> -->
|
||||
<a-input class="loginInfo" placeholder="用户名" v-model:value="userName">
|
||||
<template #prefix>
|
||||
<ns-icon class="loginIcon" name="userName" size="19" style="margin-right: 20px" />
|
||||
</template>
|
||||
</a-input>
|
||||
<!-- <p class="lg_card_tip">密码</p> -->
|
||||
<a-input-password class="loginInfo" placeholder="密码" v-model:value="password">
|
||||
<template #prefix>
|
||||
<ns-icon class="loginIcon" name="passWord" size="19" style="margin-right: 20px" />
|
||||
</template>
|
||||
</a-input-password>
|
||||
<!-- 验证码 -->
|
||||
|
||||
<a-form-item name="password" :rules="[{ required: true, message: '请输入密码' }]">
|
||||
<!-- <p class="lg_card_tip">密码</p> -->
|
||||
<a-input-password class="loginInfo" placeholder="密码" v-model:value="password">
|
||||
<template #prefix>
|
||||
<ns-icon class="loginIcon" name="passWord" size="19" style="margin-right: 20px" />
|
||||
</template>
|
||||
</a-input-password>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item name="code" :rules="[{ validator }]">
|
||||
<!-- 验证码 -->
|
||||
<a-input v-model:value="code" placeholder="验证码" class="loginInfo">
|
||||
<template #prefix>
|
||||
<ns-icon
|
||||
class="loginIcon"
|
||||
name="verifyIcon"
|
||||
size="19"
|
||||
style="margin-right: 20px" />
|
||||
</template>
|
||||
<template #addonAfter>
|
||||
<ns-verify @get-code="onGetCode" />
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item name="remember"> -->
|
||||
<!-- 记住密码 -->
|
||||
<a-checkbox v-model:checked="isRemember" class="loginInfo">记住密码</a-checkbox>
|
||||
<!-- </a-form-item> -->
|
||||
|
||||
<a-form-item>
|
||||
<a-button html-type="submit" :loading="loading" type="primary" class="loginInfo">
|
||||
登录
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<a-input v-model:value="code" placeholder="验证码" class="loginInfo">
|
||||
<template #prefix>
|
||||
<ns-icon class="loginIcon" name="verifyIcon" size="19" style="margin-right: 20px" />
|
||||
</template>
|
||||
<template #addonAfter>
|
||||
<ns-verify @get-code="onGetCode" />
|
||||
</template>
|
||||
</a-input>
|
||||
<!-- 记住密码 -->
|
||||
<a-checkbox v-model:checked="isRemember" class="loginInfo">记住密码</a-checkbox>
|
||||
<a-button @click="submit" :loading="loading" type="primary" class="loginInfo"
|
||||
>登录</a-button
|
||||
>
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<!-- <a-layout-footer>Copyright 2021 xu科技 All Rights Reserved</a-layout-footer> -->
|
||||
@@ -72,7 +54,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config';
|
||||
import { authorizationService } from '/nerv-base/store/modules/authorization-service';
|
||||
@@ -99,12 +81,11 @@
|
||||
// title.value = appConfig.title ? appConfig.title : '账号登录';
|
||||
const loading = ref<boolean>(false);
|
||||
const configStore = appConfigStore();
|
||||
const formState = reactive({ userName, password, code });
|
||||
console.log(configStore);
|
||||
|
||||
const { getThemeConfig: themeConfig, projectName } = storeToRefs(configStore);
|
||||
|
||||
const useAuthorization = authorizationService();
|
||||
|
||||
const rememberFunc = (data) => {
|
||||
console.log(isRemember.value);
|
||||
if (!isRemember.value) return;
|
||||
@@ -116,26 +97,22 @@
|
||||
const { accountNo, password: pwd } = JSON.parse(data);
|
||||
userName.value = accountNo;
|
||||
password.value = pwd;
|
||||
formState.userName = userName.value;
|
||||
formState.password = password.value;
|
||||
}
|
||||
});
|
||||
const submit = (value): void => {
|
||||
console.log(value);
|
||||
|
||||
// if (password.value === '') {
|
||||
// errorMsg.value = '请输入密码';
|
||||
// errorShow.value = true;
|
||||
// return;
|
||||
// }
|
||||
// if (userName.value === '') {
|
||||
// errorMsg.value = '请输入账号';
|
||||
// errorShow.value = true;
|
||||
// return;
|
||||
// }
|
||||
const submit = (): void => {
|
||||
if (password.value === '') {
|
||||
errorMsg.value = '请输入密码';
|
||||
errorShow.value = true;
|
||||
return;
|
||||
}
|
||||
if (userName.value === '') {
|
||||
errorMsg.value = '请输入账号';
|
||||
errorShow.value = true;
|
||||
return;
|
||||
}
|
||||
// if (!code.value) {
|
||||
// // errorMsg.value = '请输入验证码';
|
||||
// // errorShow.value = true;
|
||||
// errorMsg.value = '请输入验证码';
|
||||
// errorShow.value = true;
|
||||
// return;
|
||||
// }
|
||||
// if (code.value.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase()) {
|
||||
@@ -231,15 +208,7 @@
|
||||
const onGetCode = (res) => {
|
||||
verifyCode.value = res;
|
||||
};
|
||||
|
||||
const validator = async (rule, value) => {
|
||||
if (!value) return Promise.reject('请输入验证码');
|
||||
if (value?.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase())
|
||||
return Promise.reject('请输入正确的验证码');
|
||||
};
|
||||
return {
|
||||
validator,
|
||||
formState,
|
||||
projectName,
|
||||
onGetCode,
|
||||
code,
|
||||
@@ -354,7 +323,7 @@
|
||||
.loginInfo {
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
// margin-bottom: 24px;
|
||||
margin-bottom: 24px;
|
||||
font-size: 16px !important;
|
||||
|
||||
:deep(.ant-input) {
|
||||
@@ -371,12 +340,10 @@
|
||||
}
|
||||
}
|
||||
.loginInfo:last-child {
|
||||
// margin-bottom: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.loginInfo:nth-child(4) {
|
||||
width: fit-content;
|
||||
// margin-bottom: 0px;
|
||||
// height: 20px !important;
|
||||
.loginInfo:nth-child(5n + 2) {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user