Commit c715577b2a1cbea71cf1ecb7af763589122dea97

Authored by fengtao
2 parents b2873556 842d11f3

Merge branch 'main' into ft-dev

@@ -8,12 +8,12 @@ VITE_PUBLIC_PATH = / @@ -8,12 +8,12 @@ VITE_PUBLIC_PATH = /
8 # Please note that no line breaks 8 # Please note that no line breaks
9 9
10 # 本地 10 # 本地
11 -# VITE_PROXY = [["/api","http://192.168.10.113:8080/api"]] 11 +VITE_PROXY = [["/api","http://192.168.10.113:8080/api"]]
12 12
13 # 线上演示环境 13 # 线上演示环境
14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] 14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 # 线上测试环境 15 # 线上测试环境
16 -VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]] 16 +# VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]]
17 17
18 # 实时数据的ws地址 18 # 实时数据的ws地址
19 VITE_WEB_SOCKET = ws://47.99.141.212:8080/api/ws/plugins/telemetry?token= 19 VITE_WEB_SOCKET = ws://47.99.141.212:8080/api/ws/plugins/telemetry?token=
@@ -28,6 +28,7 @@ export interface DeviceModel { @@ -28,6 +28,7 @@ export interface DeviceModel {
28 deviceInfo: any; 28 deviceInfo: any;
29 activeTime: string; 29 activeTime: string;
30 deviceState: DeviceState; 30 deviceState: DeviceState;
  31 + alarmStatus: number;
31 profileId: string; 32 profileId: string;
32 label: string; 33 label: string;
33 lastConnectTime: string; 34 lastConnectTime: string;
@@ -36,9 +36,7 @@ export const useBatchDelete = ( @@ -36,9 +36,7 @@ export const useBatchDelete = (
36 await deleteFn([record.id]); 36 await deleteFn([record.id]);
37 createMessage.success('删除成功'); 37 createMessage.success('删除成功');
38 handleSuccess(); 38 handleSuccess();
39 - } catch (e) {  
40 - createMessage.error('删除失败');  
41 - } 39 + } catch (e) {}
42 } else { 40 } else {
43 try { 41 try {
44 await deleteFn(selectedRowIds.value); 42 await deleteFn(selectedRowIds.value);
@@ -46,7 +44,6 @@ export const useBatchDelete = ( @@ -46,7 +44,6 @@ export const useBatchDelete = (
46 selectedRowIds.value = []; 44 selectedRowIds.value = [];
47 handleSuccess(); 45 handleSuccess();
48 } catch (e) { 46 } catch (e) {
49 - createMessage.error('删除失败');  
50 selectedRowIds.value = []; 47 selectedRowIds.value = [];
51 } 48 }
52 } 49 }
@@ -145,11 +145,8 @@ const transform: AxiosTransform = { @@ -145,11 +145,8 @@ const transform: AxiosTransform = {
145 } catch (error: any) { 145 } catch (error: any) {
146 throw new Error(error); 146 throw new Error(error);
147 } 147 }
148 -  
149 - if (!config?.requestOptions?.catchFirst) {  
150 - checkStatus(error?.response?.status, msg, errorMessageMode);  
151 - }  
152 - return Promise.reject(error); 148 + checkStatus(error?.response?.status, msg, errorMessageMode);
  149 + return Promise.reject(response.data);
153 }, 150 },
154 }; 151 };
155 152
@@ -79,18 +79,24 @@ export const columns: BasicColumn[] = [ @@ -79,18 +79,24 @@ export const columns: BasicColumn[] = [
79 { 79 {
80 title: '名称', 80 title: '名称',
81 dataIndex: 'name', 81 dataIndex: 'name',
82 - width: 100, 82 + width: 120,
  83 + },
  84 + {
  85 + title: '设备状态',
  86 + dataIndex: 'deviceState',
  87 + width: 80,
  88 + slots: { customRender: 'deviceState' },
83 }, 89 },
84 { 90 {
85 title: '位置', 91 title: '位置',
86 dataIndex: 'deviceInfo.address', 92 dataIndex: 'deviceInfo.address',
87 - width: 100, 93 + width: 120,
88 }, 94 },
89 { 95 {
90 - title: '状态',  
91 - dataIndex: 'deviceState',  
92 - width: 100,  
93 - slots: { customRender: 'deviceState' }, 96 + title: '告警状态',
  97 + dataIndex: 'alarmStatus',
  98 + width: 80,
  99 + slots: { customRender: 'alarmStatus' },
94 }, 100 },
95 ]; 101 ];
96 102
@@ -23,6 +23,11 @@ @@ -23,6 +23,11 @@
23 }} 23 }}
24 </Tag> 24 </Tag>
25 </template> 25 </template>
  26 + <template #alarmStatus="{ record }">
  27 + <Tag :color="record.alarmStatus == 1 ? 'warning' : 'success'" class="ml-2">
  28 + {{ record.alarmStatus == 1 ? '告警' : '正常' }}
  29 + </Tag>
  30 + </template>
26 </BasicTable> 31 </BasicTable>
27 </div> 32 </div>
28 <BasicModal 33 <BasicModal
@@ -223,7 +228,7 @@ @@ -223,7 +228,7 @@
223 const { longitude, latitude, address } = record.deviceInfo; 228 const { longitude, latitude, address } = record.deviceInfo;
224 const point = new BMap.Point(longitude, latitude); 229 const point = new BMap.Point(longitude, latitude);
225 let options = { 230 let options = {
226 - width: 300, // 信息窗口宽度 231 + width: 330, // 信息窗口宽度
227 height: 230, // 信息窗口高度 232 height: 230, // 信息窗口高度
228 }; 233 };
229 map.centerAndZoom(point, 15); 234 map.centerAndZoom(point, 15);
@@ -438,7 +443,7 @@ @@ -438,7 +443,7 @@
438 } 443 }
439 .right-wrap { 444 .right-wrap {
440 padding-top: 10px; 445 padding-top: 10px;
441 - width: 22%; 446 + width: 28%;
442 height: 95%; 447 height: 95%;
443 position: absolute; 448 position: absolute;
444 right: 5%; 449 right: 5%;
@@ -57,27 +57,22 @@ @@ -57,27 +57,22 @@
57 }); 57 });
58 // 发布通知 58 // 发布通知
59 const handleSend = async () => { 59 const handleSend = async () => {
60 - await validate(); 60 + const valid = await validate();
  61 + if (!valid) return;
61 const field = getFieldsValue(); 62 const field = getFieldsValue();
62 const pointId = field.receiverType === '1' ? field.organizationId + '' : null; 63 const pointId = field.receiverType === '1' ? field.organizationId + '' : null;
63 // 新增情况 64 // 新增情况
64 - if (!unref(isUpdate)) {  
65 - const addNotice = {  
66 - ...field,  
67 - pointId,  
68 - };  
69 - await notifyAddLeaseApi(addNotice);  
70 - } else { 65 + try {
71 const editNotice = { 66 const editNotice = {
72 ...field, 67 ...field,
73 pointId, 68 pointId,
74 - id: unref(noticeId), 69 + id: unref(isUpdate) ? unref(noticeId) : undefined,
75 }; 70 };
76 await notifyAddLeaseApi(editNotice); 71 await notifyAddLeaseApi(editNotice);
77 - }  
78 - emit('success');  
79 - closeDrawer();  
80 - createMessage.success('发布成功'); 72 + emit('success');
  73 + closeDrawer();
  74 + createMessage.success('发布成功');
  75 + } catch {}
81 }; 76 };
82 // 保存草稿 77 // 保存草稿
83 const handleSaveDraft = async () => { 78 const handleSaveDraft = async () => {
@@ -93,8 +93,8 @@ export const searchFormSchema: FormSchema[] = [ @@ -93,8 +93,8 @@ export const searchFormSchema: FormSchema[] = [
93 componentProps: { 93 componentProps: {
94 placeholder: '请选择状态', 94 placeholder: '请选择状态',
95 options: [ 95 options: [
96 - { label: '已启用', value: '1' },  
97 - { label: '未启用', value: '0' }, 96 + { label: '启用', value: '1' },
  97 + { label: '禁用', value: '0' },
98 ], 98 ],
99 }, 99 },
100 colProps: { span: 6 }, 100 colProps: { span: 6 },
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 @register="registerDrawer" 5 @register="registerDrawer"
6 showFooter 6 showFooter
7 @ok="handleSubmit" 7 @ok="handleSubmit"
8 - width="100vw" 8 + width="50vw"
9 @close="handleClose" 9 @close="handleClose"
10 :title="title" 10 :title="title"
11 > 11 >
@@ -111,8 +111,8 @@ export const columns: BasicColumn[] = [ @@ -111,8 +111,8 @@ export const columns: BasicColumn[] = [
111 } 111 }
112 return h(Switch, { 112 return h(Switch, {
113 checked: record.status === 1, 113 checked: record.status === 1,
114 - checkedChildren: '已启用',  
115 - unCheckedChildren: '已禁用', 114 + checkedChildren: '启用',
  115 + unCheckedChildren: '禁用',
116 loading: record.pendingStatus, 116 loading: record.pendingStatus,
117 onChange(checked: boolean) { 117 onChange(checked: boolean) {
118 record.pendingStatus = true; 118 record.pendingStatus = true;
@@ -122,9 +122,9 @@ export const columns: BasicColumn[] = [ @@ -122,9 +122,9 @@ export const columns: BasicColumn[] = [
122 .then(() => { 122 .then(() => {
123 record.status = newStatus; 123 record.status = newStatus;
124 if (record.status == 1) { 124 if (record.status == 1) {
125 - createMessage.success(`已启用`); 125 + createMessage.success(`启用成功`);
126 } else { 126 } else {
127 - createMessage.success('已禁用'); 127 + createMessage.success('禁用成功');
128 } 128 }
129 }) 129 })
130 .finally(() => { 130 .finally(() => {
@@ -220,8 +220,8 @@ export const searchFormSchema: FormSchema[] = [ @@ -220,8 +220,8 @@ export const searchFormSchema: FormSchema[] = [
220 componentProps: { 220 componentProps: {
221 placeholder: '请选择状态', 221 placeholder: '请选择状态',
222 options: [ 222 options: [
223 - { label: '已启用', value: '1' },  
224 - { label: '未启用', value: '0' }, 223 + { label: '启用', value: '1' },
  224 + { label: '禁用', value: '0' },
225 ], 225 ],
226 }, 226 },
227 colProps: { span: 6 }, 227 colProps: { span: 6 },
@@ -60,16 +60,10 @@ @@ -60,16 +60,10 @@
60 </ACol> 60 </ACol>
61 </ARow> 61 </ARow>
62 </Form> 62 </Form>
63 - <Modal v-model:visible="visible" :footer="null" centered>  
64 - <template #title>  
65 - <CloseCircleFilled class="modal-icon-error" /><span class="ml-2">错误提示</span>  
66 - </template>  
67 - <span class="ml-2" style="color: red">用户名或密码不正确</span>  
68 - </Modal>  
69 </template> 63 </template>
70 <script lang="ts" setup> 64 <script lang="ts" setup>
71 import { reactive, ref, unref, computed } from 'vue'; 65 import { reactive, ref, unref, computed } from 'vue';
72 - import { Checkbox, Form, Input, Row, Col, Button, Modal } from 'ant-design-vue'; 66 + import { Checkbox, Form, Input, Row, Col, Button } from 'ant-design-vue';
73 import LoginFormTitle from './LoginFormTitle.vue'; 67 import LoginFormTitle from './LoginFormTitle.vue';
74 68
75 import { useI18n } from '/@/hooks/web/useI18n'; 69 import { useI18n } from '/@/hooks/web/useI18n';
@@ -78,16 +72,15 @@ @@ -78,16 +72,15 @@
78 import { useUserStore } from '/@/store/modules/user'; 72 import { useUserStore } from '/@/store/modules/user';
79 import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; 73 import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
80 import { useDesign } from '/@/hooks/web/useDesign'; 74 import { useDesign } from '/@/hooks/web/useDesign';
81 - import { getPlatForm } from '/@/api/oem/index';  
82 - import { createLocalStorage } from '/@/utils/cache/index';  
83 - import { CloseCircleFilled } from '@ant-design/icons-vue'; 75 + import { getPlatForm } from '/@/api/oem';
  76 + import { createLocalStorage } from '/@/utils/cache';
84 77
85 const ACol = Col; 78 const ACol = Col;
86 const ARow = Row; 79 const ARow = Row;
87 const FormItem = Form.Item; 80 const FormItem = Form.Item;
88 const InputPassword = Input.Password; 81 const InputPassword = Input.Password;
89 const { t } = useI18n(); 82 const { t } = useI18n();
90 - const { notification, createErrorModal } = useMessage(); 83 + const { notification, createMessage } = useMessage();
91 const { prefixCls } = useDesign('login'); 84 const { prefixCls } = useDesign('login');
92 const userStore = useUserStore(); 85 const userStore = useUserStore();
93 86
@@ -116,34 +109,33 @@ @@ -116,34 +109,33 @@
116 } else { 109 } else {
117 storage.set('userInfo', null); 110 storage.set('userInfo', null);
118 } 111 }
119 - try {  
120 - loading.value = true;  
121 - const userInfo = await userStore.login({ 112 + loading.value = true;
  113 + const userInfo = await userStore
  114 + .login({
122 password: data.password, 115 password: data.password,
123 username: data.account, 116 username: data.account,
124 mode: 'modal', //不要默认的错误提示 117 mode: 'modal', //不要默认的错误提示
  118 + })
  119 + .catch((data) => {
  120 + createMessage.error(data.message);
125 }); 121 });
126 - if (userInfo) {  
127 - notification.success({  
128 - message: t('sys.login.loginSuccessTitle'),  
129 - description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,  
130 - duration: 3,  
131 - });  
132 - const res = await getPlatForm();  
133 - storage.set('platformInfo', res);  
134 - userStore.setPlatInfo(res);  
135 - // 设置icon  
136 - let link = (document.querySelector("link[rel*='icon']") ||  
137 - document.createElement('link')) as HTMLLinkElement;  
138 - link.type = 'image/x-icon';  
139 - link.rel = 'shortcut icon';  
140 - link.href = res.icon ?? '/favicon.ico';  
141 - document.getElementsByTagName('head')[0].appendChild(link);  
142 - }  
143 - } catch (error: any) {  
144 - visible.value = true;  
145 - } finally {  
146 - loading.value = false; 122 + if (userInfo) {
  123 + notification.success({
  124 + message: t('sys.login.loginSuccessTitle'),
  125 + description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
  126 + duration: 3,
  127 + });
  128 + const res = await getPlatForm();
  129 + storage.set('platformInfo', res);
  130 + userStore.setPlatInfo(res);
  131 + // 设置icon
  132 + let link = (document.querySelector("link[rel*='icon']") ||
  133 + document.createElement('link')) as HTMLLinkElement;
  134 + link.type = 'image/x-icon';
  135 + link.rel = 'shortcut icon';
  136 + link.href = res.icon ?? '/favicon.ico';
  137 + document.getElementsByTagName('head')[0].appendChild(link);
147 } 138 }
  139 + loading.value = false;
148 } 140 }
149 </script> 141 </script>
@@ -91,6 +91,10 @@ @@ -91,6 +91,10 @@
91 field: 'username', 91 field: 'username',
92 dynamicDisabled: unref(isUpdate), 92 dynamicDisabled: unref(isUpdate),
93 }, 93 },
  94 + {
  95 + field: 'password',
  96 + ifShow: !unref(isUpdate),
  97 + },
94 ]); 98 ]);
95 }); 99 });
96 const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); 100 const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号'));
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 if (unref(isUpdate)) { 43 if (unref(isUpdate)) {
44 //为表单赋值 44 //为表单赋值
45 await setFieldsValue(data.record); 45 await setFieldsValue(data.record);
46 - const organizationId = Reflect.get(data.record, 'id'); 46 + organizationId = Reflect.get(data.record, 'id');
47 // 过滤当前选中的组织, 47 // 过滤当前选中的组织,
48 (function filterTransFun(treeData: any[]) { 48 (function filterTransFun(treeData: any[]) {
49 treeData.forEach((item, index, arr) => { 49 treeData.forEach((item, index, arr) => {
@@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
73 if (isUpdate.value) { 73 if (isUpdate.value) {
74 Reflect.set(values, 'id', organizationId); 74 Reflect.set(values, 'id', organizationId);
75 } 75 }
  76 +
76 await saveOrUpdateOrganization( 77 await saveOrUpdateOrganization(
77 { ...values, parentId: values.parentId ?? null }, 78 { ...values, parentId: values.parentId ?? null },
78 isUpdate.value 79 isUpdate.value
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 import { formSchema } from './role.data'; 31 import { formSchema } from './role.data';
32 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 32 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
33 import { BasicTree, TreeItem } from '/@/components/Tree'; 33 import { BasicTree, TreeItem } from '/@/components/Tree';
34 - 34 + import { useMessage } from '/@/hooks/web/useMessage';
35 const { t } = useI18n(); //加载国际化 35 const { t } = useI18n(); //加载国际化
36 // 加载菜单数据 36 // 加载菜单数据
37 import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; 37 import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu';
@@ -111,6 +111,7 @@ @@ -111,6 +111,7 @@
111 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); 111 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
112 112
113 async function handleSubmit() { 113 async function handleSubmit() {
  114 + const { createMessage } = useMessage();
114 try { 115 try {
115 const values = await validate(); 116 const values = await validate();
116 setDrawerProps({ confirmLoading: true }); 117 setDrawerProps({ confirmLoading: true });
@@ -124,6 +125,7 @@ @@ -124,6 +125,7 @@
124 saveOrUpdateRoleInfoWithMenu(req).then(() => { 125 saveOrUpdateRoleInfoWithMenu(req).then(() => {
125 closeDrawer(); 126 closeDrawer();
126 emit('success'); 127 emit('success');
  128 + createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`);
127 }); 129 });
128 } finally { 130 } finally {
129 setDrawerProps({ confirmLoading: false }); 131 setDrawerProps({ confirmLoading: false });
@@ -32,14 +32,13 @@ @@ -32,14 +32,13 @@
32 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 32 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
33 import { BasicTree, TreeItem } from '/@/components/Tree'; 33 import { BasicTree, TreeItem } from '/@/components/Tree';
34 const { t } = useI18n(); //加载国际化 34 const { t } = useI18n(); //加载国际化
35 - // import { getMenuList } from '/@/api/demo/system';  
36 // 加载菜单数据 35 // 加载菜单数据
37 import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; 36 import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu';
38 import { useI18n } from '/@/hooks/web/useI18n'; 37 import { useI18n } from '/@/hooks/web/useI18n';
39 import { RouteItem } from '/@/api/sys/model/menuModel'; 38 import { RouteItem } from '/@/api/sys/model/menuModel';
40 import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; 39 import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system';
41 import { RoleEnum } from '/@/enums/roleEnum'; 40 import { RoleEnum } from '/@/enums/roleEnum';
42 - // import useCurrentInstance from '/@/hooks/web/useCurrentInstance'; 41 + import { useMessage } from '/@/hooks/web/useMessage';
43 42
44 export default defineComponent({ 43 export default defineComponent({
45 name: 'RoleDrawer', 44 name: 'RoleDrawer',
@@ -112,6 +111,8 @@ @@ -112,6 +111,8 @@
112 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); 111 const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
113 112
114 async function handleSubmit() { 113 async function handleSubmit() {
  114 + const { createMessage } = useMessage();
  115 +
115 try { 116 try {
116 const values = await validate(); 117 const values = await validate();
117 setDrawerProps({ confirmLoading: true }); 118 setDrawerProps({ confirmLoading: true });
@@ -126,6 +127,7 @@ @@ -126,6 +127,7 @@
126 await saveOrUpdateRoleInfoWithMenu(req); 127 await saveOrUpdateRoleInfoWithMenu(req);
127 closeDrawer(); 128 closeDrawer();
128 emit('success'); 129 emit('success');
  130 + createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`);
129 } finally { 131 } finally {
130 setDrawerProps({ confirmLoading: false }); 132 setDrawerProps({ confirmLoading: false });
131 } 133 }
@@ -21,7 +21,6 @@ export interface RequestOptions { @@ -21,7 +21,6 @@ export interface RequestOptions {
21 ignoreCancelToken?: boolean; 21 ignoreCancelToken?: boolean;
22 // Whether to send token in header 22 // Whether to send token in header
23 withToken?: boolean; 23 withToken?: boolean;
24 - catchFirst?: boolean;  
25 } 24 }
26 25
27 export interface Result<T = any> { 26 export interface Result<T = any> {