Showing
16 changed files
with
82 additions
and
81 deletions
... | ... | @@ -8,12 +8,12 @@ VITE_PUBLIC_PATH = / |
8 | 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 | 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 | 18 | # 实时数据的ws地址 |
19 | 19 | VITE_WEB_SOCKET = ws://47.99.141.212:8080/api/ws/plugins/telemetry?token= | ... | ... |
... | ... | @@ -36,9 +36,7 @@ export const useBatchDelete = ( |
36 | 36 | await deleteFn([record.id]); |
37 | 37 | createMessage.success('删除成功'); |
38 | 38 | handleSuccess(); |
39 | - } catch (e) { | |
40 | - createMessage.error('删除失败'); | |
41 | - } | |
39 | + } catch (e) {} | |
42 | 40 | } else { |
43 | 41 | try { |
44 | 42 | await deleteFn(selectedRowIds.value); |
... | ... | @@ -46,7 +44,6 @@ export const useBatchDelete = ( |
46 | 44 | selectedRowIds.value = []; |
47 | 45 | handleSuccess(); |
48 | 46 | } catch (e) { |
49 | - createMessage.error('删除失败'); | |
50 | 47 | selectedRowIds.value = []; |
51 | 48 | } |
52 | 49 | } | ... | ... |
... | ... | @@ -145,11 +145,8 @@ const transform: AxiosTransform = { |
145 | 145 | } catch (error: any) { |
146 | 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 | 79 | { |
80 | 80 | title: '名称', |
81 | 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 | 91 | title: '位置', |
86 | 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 | 23 | }} |
24 | 24 | </Tag> |
25 | 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 | 31 | </BasicTable> |
27 | 32 | </div> |
28 | 33 | <BasicModal |
... | ... | @@ -223,7 +228,7 @@ |
223 | 228 | const { longitude, latitude, address } = record.deviceInfo; |
224 | 229 | const point = new BMap.Point(longitude, latitude); |
225 | 230 | let options = { |
226 | - width: 300, // 信息窗口宽度 | |
231 | + width: 330, // 信息窗口宽度 | |
227 | 232 | height: 230, // 信息窗口高度 |
228 | 233 | }; |
229 | 234 | map.centerAndZoom(point, 15); |
... | ... | @@ -438,7 +443,7 @@ |
438 | 443 | } |
439 | 444 | .right-wrap { |
440 | 445 | padding-top: 10px; |
441 | - width: 22%; | |
446 | + width: 28%; | |
442 | 447 | height: 95%; |
443 | 448 | position: absolute; |
444 | 449 | right: 5%; | ... | ... |
... | ... | @@ -57,27 +57,22 @@ |
57 | 57 | }); |
58 | 58 | // 发布通知 |
59 | 59 | const handleSend = async () => { |
60 | - await validate(); | |
60 | + const valid = await validate(); | |
61 | + if (!valid) return; | |
61 | 62 | const field = getFieldsValue(); |
62 | 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 | 66 | const editNotice = { |
72 | 67 | ...field, |
73 | 68 | pointId, |
74 | - id: unref(noticeId), | |
69 | + id: unref(isUpdate) ? unref(noticeId) : undefined, | |
75 | 70 | }; |
76 | 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 | 78 | const handleSaveDraft = async () => { | ... | ... |
... | ... | @@ -93,8 +93,8 @@ export const searchFormSchema: FormSchema[] = [ |
93 | 93 | componentProps: { |
94 | 94 | placeholder: '请选择状态', |
95 | 95 | options: [ |
96 | - { label: '已启用', value: '1' }, | |
97 | - { label: '未启用', value: '0' }, | |
96 | + { label: '启用', value: '1' }, | |
97 | + { label: '禁用', value: '0' }, | |
98 | 98 | ], |
99 | 99 | }, |
100 | 100 | colProps: { span: 6 }, | ... | ... |
... | ... | @@ -111,8 +111,8 @@ export const columns: BasicColumn[] = [ |
111 | 111 | } |
112 | 112 | return h(Switch, { |
113 | 113 | checked: record.status === 1, |
114 | - checkedChildren: '已启用', | |
115 | - unCheckedChildren: '已禁用', | |
114 | + checkedChildren: '启用', | |
115 | + unCheckedChildren: '禁用', | |
116 | 116 | loading: record.pendingStatus, |
117 | 117 | onChange(checked: boolean) { |
118 | 118 | record.pendingStatus = true; |
... | ... | @@ -122,9 +122,9 @@ export const columns: BasicColumn[] = [ |
122 | 122 | .then(() => { |
123 | 123 | record.status = newStatus; |
124 | 124 | if (record.status == 1) { |
125 | - createMessage.success(`已启用`); | |
125 | + createMessage.success(`启用成功`); | |
126 | 126 | } else { |
127 | - createMessage.success('已禁用'); | |
127 | + createMessage.success('禁用成功'); | |
128 | 128 | } |
129 | 129 | }) |
130 | 130 | .finally(() => { |
... | ... | @@ -220,8 +220,8 @@ export const searchFormSchema: FormSchema[] = [ |
220 | 220 | componentProps: { |
221 | 221 | placeholder: '请选择状态', |
222 | 222 | options: [ |
223 | - { label: '已启用', value: '1' }, | |
224 | - { label: '未启用', value: '0' }, | |
223 | + { label: '启用', value: '1' }, | |
224 | + { label: '禁用', value: '0' }, | |
225 | 225 | ], |
226 | 226 | }, |
227 | 227 | colProps: { span: 6 }, | ... | ... |
... | ... | @@ -60,16 +60,10 @@ |
60 | 60 | </ACol> |
61 | 61 | </ARow> |
62 | 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 | 63 | </template> |
70 | 64 | <script lang="ts" setup> |
71 | 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 | 67 | import LoginFormTitle from './LoginFormTitle.vue'; |
74 | 68 | |
75 | 69 | import { useI18n } from '/@/hooks/web/useI18n'; |
... | ... | @@ -78,16 +72,15 @@ |
78 | 72 | import { useUserStore } from '/@/store/modules/user'; |
79 | 73 | import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; |
80 | 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 | 78 | const ACol = Col; |
86 | 79 | const ARow = Row; |
87 | 80 | const FormItem = Form.Item; |
88 | 81 | const InputPassword = Input.Password; |
89 | 82 | const { t } = useI18n(); |
90 | - const { notification, createErrorModal } = useMessage(); | |
83 | + const { notification, createMessage } = useMessage(); | |
91 | 84 | const { prefixCls } = useDesign('login'); |
92 | 85 | const userStore = useUserStore(); |
93 | 86 | |
... | ... | @@ -116,34 +109,33 @@ |
116 | 109 | } else { |
117 | 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 | 115 | password: data.password, |
123 | 116 | username: data.account, |
124 | 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 | 141 | </script> | ... | ... |
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | if (unref(isUpdate)) { |
44 | 44 | //为表单赋值 |
45 | 45 | await setFieldsValue(data.record); |
46 | - const organizationId = Reflect.get(data.record, 'id'); | |
46 | + organizationId = Reflect.get(data.record, 'id'); | |
47 | 47 | // 过滤当前选中的组织, |
48 | 48 | (function filterTransFun(treeData: any[]) { |
49 | 49 | treeData.forEach((item, index, arr) => { |
... | ... | @@ -73,6 +73,7 @@ |
73 | 73 | if (isUpdate.value) { |
74 | 74 | Reflect.set(values, 'id', organizationId); |
75 | 75 | } |
76 | + | |
76 | 77 | await saveOrUpdateOrganization( |
77 | 78 | { ...values, parentId: values.parentId ?? null }, |
78 | 79 | isUpdate.value | ... | ... |
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | import { formSchema } from './role.data'; |
32 | 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
33 | 33 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
34 | - | |
34 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
35 | 35 | const { t } = useI18n(); //加载国际化 |
36 | 36 | // 加载菜单数据 |
37 | 37 | import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; |
... | ... | @@ -111,6 +111,7 @@ |
111 | 111 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
112 | 112 | |
113 | 113 | async function handleSubmit() { |
114 | + const { createMessage } = useMessage(); | |
114 | 115 | try { |
115 | 116 | const values = await validate(); |
116 | 117 | setDrawerProps({ confirmLoading: true }); |
... | ... | @@ -124,6 +125,7 @@ |
124 | 125 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
125 | 126 | closeDrawer(); |
126 | 127 | emit('success'); |
128 | + createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | |
127 | 129 | }); |
128 | 130 | } finally { |
129 | 131 | setDrawerProps({ confirmLoading: false }); | ... | ... |
... | ... | @@ -32,14 +32,13 @@ |
32 | 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
33 | 33 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
34 | 34 | const { t } = useI18n(); //加载国际化 |
35 | - // import { getMenuList } from '/@/api/demo/system'; | |
36 | 35 | // 加载菜单数据 |
37 | 36 | import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; |
38 | 37 | import { useI18n } from '/@/hooks/web/useI18n'; |
39 | 38 | import { RouteItem } from '/@/api/sys/model/menuModel'; |
40 | 39 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; |
41 | 40 | import { RoleEnum } from '/@/enums/roleEnum'; |
42 | - // import useCurrentInstance from '/@/hooks/web/useCurrentInstance'; | |
41 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
43 | 42 | |
44 | 43 | export default defineComponent({ |
45 | 44 | name: 'RoleDrawer', |
... | ... | @@ -112,6 +111,8 @@ |
112 | 111 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
113 | 112 | |
114 | 113 | async function handleSubmit() { |
114 | + const { createMessage } = useMessage(); | |
115 | + | |
115 | 116 | try { |
116 | 117 | const values = await validate(); |
117 | 118 | setDrawerProps({ confirmLoading: true }); |
... | ... | @@ -126,6 +127,7 @@ |
126 | 127 | await saveOrUpdateRoleInfoWithMenu(req); |
127 | 128 | closeDrawer(); |
128 | 129 | emit('success'); |
130 | + createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | |
129 | 131 | } finally { |
130 | 132 | setDrawerProps({ confirmLoading: false }); |
131 | 133 | } | ... | ... |