Showing
10 changed files
with
33 additions
and
32 deletions
| @@ -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= |
| @@ -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 | } |
| @@ -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 }, |
| @@ -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 }, |
| @@ -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 | } |