Commit 8a6e1ea46e6bfefc7fe3c651bfe23919d51b5a97
Merge branch 'f-dev' into 'main'
fix:修改Teambition上的问题 See merge request huang/yun-teng-iot-front!236
Showing
30 changed files
with
516 additions
and
193 deletions
@@ -56,16 +56,6 @@ export const screenLinkPageAddApi = (params: ScreenAddModel, isUpdate: boolean) | @@ -56,16 +56,6 @@ export const screenLinkPageAddApi = (params: ScreenAddModel, isUpdate: boolean) | ||
56 | }; | 56 | }; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | - * 获取主设备列表(exclude子设备) | ||
60 | - * @param params organizationId | ||
61 | - */ | ||
62 | -export const byOganizationIdGetMasterDevice = (params) => { | ||
63 | - return defHttp.get({ | ||
64 | - url: ScreenManagerApi.MASTER_GET_DEVICE + '/' + params, | ||
65 | - }); | ||
66 | -}; | ||
67 | - | ||
68 | -/** | ||
69 | * 删除场景联动 | 59 | * 删除场景联动 |
70 | * @param params pageSize page name | 60 | * @param params pageSize page name |
71 | */ | 61 | */ |
@@ -107,6 +97,7 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { | @@ -107,6 +97,7 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { | ||
107 | }); | 97 | }); |
108 | }; | 98 | }; |
109 | 99 | ||
100 | +//TODO-fengtao | ||
110 | /** | 101 | /** |
111 | * 获取设备属性列表 | 102 | * 获取设备属性列表 |
112 | */ | 103 | */ |
@@ -116,3 +107,14 @@ export const getAttribute = (orgId, deviceIds) => { | @@ -116,3 +107,14 @@ export const getAttribute = (orgId, deviceIds) => { | ||
116 | url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, | 107 | url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, |
117 | }); | 108 | }); |
118 | }; | 109 | }; |
110 | + | ||
111 | +/** | ||
112 | + * 获取主设备列表(exclude子设备)---执行动作 | ||
113 | + * @param params organizationId | ||
114 | + */ | ||
115 | +export const byOganizationIdGetMasterDevice = (params) => { | ||
116 | + return defHttp.get({ | ||
117 | + url: ScreenManagerApi.MASTER_GET_DEVICE + '/' + params, | ||
118 | + }); | ||
119 | +}; | ||
120 | +//TODO-fengtao |
@@ -56,6 +56,7 @@ | @@ -56,6 +56,7 @@ | ||
56 | const getTitle = computed(() => (!unref(isUpdate) ? '新增告警配置' : '编辑告警配置')); | 56 | const getTitle = computed(() => (!unref(isUpdate) ? '新增告警配置' : '编辑告警配置')); |
57 | 57 | ||
58 | async function handleSubmit() { | 58 | async function handleSubmit() { |
59 | + setDrawerProps({ confirmLoading: true }); | ||
59 | try { | 60 | try { |
60 | const { createMessage } = useMessage(); | 61 | const { createMessage } = useMessage(); |
61 | const values = await validate(); | 62 | const values = await validate(); |
@@ -77,7 +78,6 @@ | @@ -77,7 +78,6 @@ | ||
77 | if (!unref(isUpdate)) { | 78 | if (!unref(isUpdate)) { |
78 | delete allData.id; | 79 | delete allData.id; |
79 | } | 80 | } |
80 | - setDrawerProps({ confirmLoading: true }); | ||
81 | let saveMessage = '添加成功'; | 81 | let saveMessage = '添加成功'; |
82 | let updateMessage = '修改成功'; | 82 | let updateMessage = '修改成功'; |
83 | await saveOrEditAlarmConfig(allData); | 83 | await saveOrEditAlarmConfig(allData); |
@@ -85,7 +85,9 @@ | @@ -85,7 +85,9 @@ | ||
85 | emit('success'); | 85 | emit('success'); |
86 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 86 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
87 | } finally { | 87 | } finally { |
88 | - setDrawerProps({ confirmLoading: false }); | 88 | + setTimeout(() => { |
89 | + setDrawerProps({ confirmLoading: false }); | ||
90 | + }, 300); | ||
89 | } | 91 | } |
90 | } | 92 | } |
91 | 93 |
@@ -23,7 +23,7 @@ export const columns: BasicColumn[] = [ | @@ -23,7 +23,7 @@ export const columns: BasicColumn[] = [ | ||
23 | slots: { customRender: 'alarmContact' }, | 23 | slots: { customRender: 'alarmContact' }, |
24 | }, | 24 | }, |
25 | { | 25 | { |
26 | - title: '联系方式', | 26 | + title: '通知方式', |
27 | dataIndex: 'messageMode', | 27 | dataIndex: 'messageMode', |
28 | width: 155, | 28 | width: 155, |
29 | slots: { customRender: 'messageMode' }, | 29 | slots: { customRender: 'messageMode' }, |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | </template> | 34 | </template> |
35 | <template #messageMode="{ record }"> | 35 | <template #messageMode="{ record }"> |
36 | <a-button type="link" class="ml-2" @click="showMessageMode(record)"> | 36 | <a-button type="link" class="ml-2" @click="showMessageMode(record)"> |
37 | - 查看联系方式 | 37 | + 查看通知方式 |
38 | </a-button> | 38 | </a-button> |
39 | </template> | 39 | </template> |
40 | <template #status="{ record }"> | 40 | <template #status="{ record }"> |
@@ -48,10 +48,10 @@ | @@ -48,10 +48,10 @@ | ||
48 | const getTitle = computed(() => (!unref(isUpdate) ? '新增联系人配置' : '编辑联系人配置')); | 48 | const getTitle = computed(() => (!unref(isUpdate) ? '新增联系人配置' : '编辑联系人配置')); |
49 | 49 | ||
50 | async function handleSubmit() { | 50 | async function handleSubmit() { |
51 | + setDrawerProps({ confirmLoading: true }); | ||
51 | try { | 52 | try { |
52 | const { createMessage } = useMessage(); | 53 | const { createMessage } = useMessage(); |
53 | const values = await validate(); | 54 | const values = await validate(); |
54 | - setDrawerProps({ confirmLoading: true }); | ||
55 | let saveMessage = '添加成功'; | 55 | let saveMessage = '添加成功'; |
56 | let updateMessage = '修改成功'; | 56 | let updateMessage = '修改成功'; |
57 | await saveOrEditAlarmContact(values, unref(isUpdate)); | 57 | await saveOrEditAlarmContact(values, unref(isUpdate)); |
@@ -59,7 +59,9 @@ | @@ -59,7 +59,9 @@ | ||
59 | emit('success'); | 59 | emit('success'); |
60 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 60 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
61 | } finally { | 61 | } finally { |
62 | - setDrawerProps({ confirmLoading: false }); | 62 | + setTimeout(() => { |
63 | + setDrawerProps({ confirmLoading: false }); | ||
64 | + }, 300); | ||
63 | } | 65 | } |
64 | } | 66 | } |
65 | 67 |
@@ -19,7 +19,8 @@ | @@ -19,7 +19,8 @@ | ||
19 | > | 19 | > |
20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> | 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
21 | <div v-else> | 21 | <div v-else> |
22 | - <plus-outlined /> | 22 | + <loading-outlined v-if="loading"></loading-outlined> |
23 | + <plus-outlined v-else /> | ||
23 | <div class="ant-upload-text">上传</div> | 24 | <div class="ant-upload-text">上传</div> |
24 | </div> | 25 | </div> |
25 | </Upload> | 26 | </Upload> |
@@ -35,15 +36,17 @@ | @@ -35,15 +36,17 @@ | ||
35 | import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; | 36 | import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; |
36 | import { message, Upload } from 'ant-design-vue'; | 37 | import { message, Upload } from 'ant-design-vue'; |
37 | import { useMessage } from '/@/hooks/web/useMessage'; | 38 | import { useMessage } from '/@/hooks/web/useMessage'; |
38 | - import { PlusOutlined } from '@ant-design/icons-vue'; | 39 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
39 | import { upload } from '/@/api/oss/ossFileUploader'; | 40 | import { upload } from '/@/api/oss/ossFileUploader'; |
40 | import { FileItem } from '/@/components/Upload/src/typing'; | 41 | import { FileItem } from '/@/components/Upload/src/typing'; |
41 | 42 | ||
42 | export default defineComponent({ | 43 | export default defineComponent({ |
43 | name: 'ContactDrawer', | 44 | name: 'ContactDrawer', |
44 | - components: { BasicDrawer, BasicForm, Upload, PlusOutlined }, | 45 | + components: { BasicDrawer, BasicForm, Upload, PlusOutlined, LoadingOutlined }, |
45 | emits: ['success', 'register'], | 46 | emits: ['success', 'register'], |
46 | setup(_, { emit }) { | 47 | setup(_, { emit }) { |
48 | + const loading = ref(false); | ||
49 | + | ||
47 | const isUpdate = ref(true); | 50 | const isUpdate = ref(true); |
48 | const editId = ref(''); | 51 | const editId = ref(''); |
49 | const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | 52 | const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
@@ -70,11 +73,14 @@ | @@ -70,11 +73,14 @@ | ||
70 | 73 | ||
71 | async function customUpload({ file }) { | 74 | async function customUpload({ file }) { |
72 | if (beforeUpload(file)) { | 75 | if (beforeUpload(file)) { |
76 | + loading.value = true; | ||
77 | + | ||
73 | const formData = new FormData(); | 78 | const formData = new FormData(); |
74 | formData.append('file', file); | 79 | formData.append('file', file); |
75 | const response = await upload(formData); | 80 | const response = await upload(formData); |
76 | if (response.fileStaticUri) { | 81 | if (response.fileStaticUri) { |
77 | tenantLogo.value = response.fileStaticUri; | 82 | tenantLogo.value = response.fileStaticUri; |
83 | + loading.value = true; | ||
78 | } | 84 | } |
79 | } | 85 | } |
80 | } | 86 | } |
@@ -94,6 +100,7 @@ | @@ -94,6 +100,7 @@ | ||
94 | const getTitle = computed(() => (!unref(isUpdate) ? '新增视频配置' : '编辑视频配置')); | 100 | const getTitle = computed(() => (!unref(isUpdate) ? '新增视频配置' : '编辑视频配置')); |
95 | 101 | ||
96 | async function handleSubmit() { | 102 | async function handleSubmit() { |
103 | + setDrawerProps({ confirmLoading: true }); | ||
97 | try { | 104 | try { |
98 | const { createMessage } = useMessage(); | 105 | const { createMessage } = useMessage(); |
99 | const values = await validate(); | 106 | const values = await validate(); |
@@ -105,7 +112,6 @@ | @@ -105,7 +112,6 @@ | ||
105 | } else { | 112 | } else { |
106 | delete values.id; | 113 | delete values.id; |
107 | } | 114 | } |
108 | - setDrawerProps({ confirmLoading: true }); | ||
109 | let saveMessage = '添加成功'; | 115 | let saveMessage = '添加成功'; |
110 | let updateMessage = '修改成功'; | 116 | let updateMessage = '修改成功'; |
111 | await createOrEditCameraManage(values); | 117 | await createOrEditCameraManage(values); |
@@ -113,7 +119,9 @@ | @@ -113,7 +119,9 @@ | ||
113 | emit('success'); | 119 | emit('success'); |
114 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 120 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
115 | } finally { | 121 | } finally { |
116 | - setDrawerProps({ confirmLoading: false }); | 122 | + setTimeout(() => { |
123 | + setDrawerProps({ confirmLoading: false }); | ||
124 | + }, 300); | ||
117 | } | 125 | } |
118 | } | 126 | } |
119 | 127 | ||
@@ -125,6 +133,7 @@ | @@ -125,6 +133,7 @@ | ||
125 | customUpload, | 133 | customUpload, |
126 | beforeUpload, | 134 | beforeUpload, |
127 | tenantLogo, | 135 | tenantLogo, |
136 | + loading, | ||
128 | }; | 137 | }; |
129 | }, | 138 | }, |
130 | }); | 139 | }); |
@@ -5,15 +5,16 @@ | @@ -5,15 +5,16 @@ | ||
5 | <template #iconSelect> | 5 | <template #iconSelect> |
6 | <Upload | 6 | <Upload |
7 | name="avatar" | 7 | name="avatar" |
8 | + :show-upload-list="false" | ||
8 | list-type="picture-card" | 9 | list-type="picture-card" |
9 | class="avatar-uploader" | 10 | class="avatar-uploader" |
10 | - :show-upload-list="false" | ||
11 | :customRequest="customUpload" | 11 | :customRequest="customUpload" |
12 | :before-upload="beforeUpload" | 12 | :before-upload="beforeUpload" |
13 | > | 13 | > |
14 | <img v-if="devicePic" :src="devicePic" alt="avatar" /> | 14 | <img v-if="devicePic" :src="devicePic" alt="avatar" /> |
15 | <div v-else> | 15 | <div v-else> |
16 | - <PlusOutlined /> | 16 | + <loading-outlined v-if="loading"></loading-outlined> |
17 | + <PlusOutlined v-else /> | ||
17 | <div class="ant-upload-text">图片上传</div> | 18 | <div class="ant-upload-text">图片上传</div> |
18 | </div> | 19 | </div> |
19 | </Upload> | 20 | </Upload> |
@@ -85,7 +86,7 @@ | @@ -85,7 +86,7 @@ | ||
85 | import { step1Schemas } from '../../config/data'; | 86 | import { step1Schemas } from '../../config/data'; |
86 | import { useScript } from '/@/hooks/web/useScript'; | 87 | import { useScript } from '/@/hooks/web/useScript'; |
87 | import { Input, Upload, message, Modal, Form, Row, Col, AutoComplete } from 'ant-design-vue'; | 88 | import { Input, Upload, message, Modal, Form, Row, Col, AutoComplete } from 'ant-design-vue'; |
88 | - import { EnvironmentTwoTone, PlusOutlined } from '@ant-design/icons-vue'; | 89 | + import { EnvironmentTwoTone, PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
89 | import { upload } from '/@/api/oss/ossFileUploader'; | 90 | import { upload } from '/@/api/oss/ossFileUploader'; |
90 | import { FileItem } from '/@/components/Upload/src/typing'; | 91 | import { FileItem } from '/@/components/Upload/src/typing'; |
91 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | 92 | import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; |
@@ -105,6 +106,7 @@ | @@ -105,6 +106,7 @@ | ||
105 | FormItem: Form.Item, | 106 | FormItem: Form.Item, |
106 | Row, | 107 | Row, |
107 | Col, | 108 | Col, |
109 | + LoadingOutlined, | ||
108 | }, | 110 | }, |
109 | props: { | 111 | props: { |
110 | isUpdate: { | 112 | isUpdate: { |
@@ -114,6 +116,7 @@ | @@ -114,6 +116,7 @@ | ||
114 | emits: ['next'], | 116 | emits: ['next'], |
115 | setup(props, { emit }) { | 117 | setup(props, { emit }) { |
116 | const devicePic = ref(''); | 118 | const devicePic = ref(''); |
119 | + const loading = ref(false); | ||
117 | 120 | ||
118 | const [register, { validate, resetFields, setFieldsValue, getFieldsValue, updateSchema }] = | 121 | const [register, { validate, resetFields, setFieldsValue, getFieldsValue, updateSchema }] = |
119 | useForm({ | 122 | useForm({ |
@@ -140,11 +143,13 @@ | @@ -140,11 +143,13 @@ | ||
140 | // 图片上传 | 143 | // 图片上传 |
141 | async function customUpload({ file }) { | 144 | async function customUpload({ file }) { |
142 | if (beforeUpload(file)) { | 145 | if (beforeUpload(file)) { |
146 | + loading.value = true; | ||
143 | const formData = new FormData(); | 147 | const formData = new FormData(); |
144 | formData.append('file', file); | 148 | formData.append('file', file); |
145 | const response = await upload(formData); | 149 | const response = await upload(formData); |
146 | if (response.fileStaticUri) { | 150 | if (response.fileStaticUri) { |
147 | devicePic.value = response.fileStaticUri; | 151 | devicePic.value = response.fileStaticUri; |
152 | + loading.value = false; | ||
148 | } | 153 | } |
149 | } | 154 | } |
150 | } | 155 | } |
@@ -371,6 +376,7 @@ | @@ -371,6 +376,7 @@ | ||
371 | dataSource, | 376 | dataSource, |
372 | debounceSearch, | 377 | debounceSearch, |
373 | generateSN, | 378 | generateSN, |
379 | + loading, | ||
374 | }; | 380 | }; |
375 | }, | 381 | }, |
376 | }); | 382 | }); |
@@ -20,7 +20,8 @@ | @@ -20,7 +20,8 @@ | ||
20 | style="width: 6.25rem; height: 6.25rem" | 20 | style="width: 6.25rem; height: 6.25rem" |
21 | /> | 21 | /> |
22 | <div v-else> | 22 | <div v-else> |
23 | - <PlusOutlined /> | 23 | + <loading-outlined v-if="loading"></loading-outlined> |
24 | + <PlusOutlined v-else /> | ||
24 | <div class="ant-upload-text">图片上传</div> | 25 | <div class="ant-upload-text">图片上传</div> |
25 | </div> | 26 | </div> |
26 | </Upload> | 27 | </Upload> |
@@ -37,7 +38,7 @@ | @@ -37,7 +38,7 @@ | ||
37 | import { Select, Input, Divider } from 'ant-design-vue'; | 38 | import { Select, Input, Divider } from 'ant-design-vue'; |
38 | import { uploadApi } from '/@/api/personal/index'; | 39 | import { uploadApi } from '/@/api/personal/index'; |
39 | import { Upload } from 'ant-design-vue'; | 40 | import { Upload } from 'ant-design-vue'; |
40 | - import { PlusOutlined } from '@ant-design/icons-vue'; | 41 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
41 | import { useMessage } from '/@/hooks/web/useMessage'; | 42 | import { useMessage } from '/@/hooks/web/useMessage'; |
42 | import type { FileItem } from '/@/components/Upload/src/typing'; | 43 | import type { FileItem } from '/@/components/Upload/src/typing'; |
43 | 44 | ||
@@ -50,9 +51,12 @@ | @@ -50,9 +51,12 @@ | ||
50 | [Divider.name]: Divider, | 51 | [Divider.name]: Divider, |
51 | Upload, | 52 | Upload, |
52 | PlusOutlined, | 53 | PlusOutlined, |
54 | + LoadingOutlined, | ||
53 | }, | 55 | }, |
54 | emits: ['next', 'resetFunc', 'register'], | 56 | emits: ['next', 'resetFunc', 'register'], |
55 | setup(_, { emit }) { | 57 | setup(_, { emit }) { |
58 | + const loading = ref(false); | ||
59 | + | ||
56 | const { createMessage } = useMessage(); | 60 | const { createMessage } = useMessage(); |
57 | const peresonalPic = ref(''); | 61 | const peresonalPic = ref(''); |
58 | 62 | ||
@@ -75,11 +79,14 @@ | @@ -75,11 +79,14 @@ | ||
75 | }; | 79 | }; |
76 | const customUploadqrcodePic = async ({ file }) => { | 80 | const customUploadqrcodePic = async ({ file }) => { |
77 | if (beforeUploadqrcodePic(file)) { | 81 | if (beforeUploadqrcodePic(file)) { |
82 | + loading.value = true; | ||
83 | + | ||
78 | const formData = new FormData(); | 84 | const formData = new FormData(); |
79 | formData.append('file', file); | 85 | formData.append('file', file); |
80 | const response = await uploadApi(formData); | 86 | const response = await uploadApi(formData); |
81 | if (response.fileStaticUri) { | 87 | if (response.fileStaticUri) { |
82 | peresonalPic.value = response.fileStaticUri; | 88 | peresonalPic.value = response.fileStaticUri; |
89 | + loading.value = false; | ||
83 | } | 90 | } |
84 | } | 91 | } |
85 | }; | 92 | }; |
@@ -122,6 +129,7 @@ | @@ -122,6 +129,7 @@ | ||
122 | beforeUploadqrcodePic, | 129 | beforeUploadqrcodePic, |
123 | customUploadqrcodePic, | 130 | customUploadqrcodePic, |
124 | getStep1Func, | 131 | getStep1Func, |
132 | + loading, | ||
125 | }; | 133 | }; |
126 | }, | 134 | }, |
127 | }); | 135 | }); |
@@ -49,10 +49,10 @@ | @@ -49,10 +49,10 @@ | ||
49 | const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); | 49 | const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); |
50 | 50 | ||
51 | async function handleSubmit() { | 51 | async function handleSubmit() { |
52 | + setDrawerProps({ confirmLoading: true }); | ||
52 | try { | 53 | try { |
53 | const values = await validate(); | 54 | const values = await validate(); |
54 | const { createMessage } = useMessage(); | 55 | const { createMessage } = useMessage(); |
55 | - setDrawerProps({ confirmLoading: true }); | ||
56 | let config = {}; | 56 | let config = {}; |
57 | if (values.messageType === 'PHONE_MESSAGE') { | 57 | if (values.messageType === 'PHONE_MESSAGE') { |
58 | config = { | 58 | config = { |
@@ -75,7 +75,9 @@ | @@ -75,7 +75,9 @@ | ||
75 | emit('success'); | 75 | emit('success'); |
76 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 76 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
77 | } finally { | 77 | } finally { |
78 | - setDrawerProps({ confirmLoading: false }); | 78 | + setTimeout(() => { |
79 | + setDrawerProps({ confirmLoading: false }); | ||
80 | + }, 300); | ||
79 | } | 81 | } |
80 | } | 82 | } |
81 | 83 |
@@ -103,10 +103,10 @@ | @@ -103,10 +103,10 @@ | ||
103 | const getTitle = computed(() => (!unref(isUpdate) ? '新增模板配置' : '编辑模板配置')); | 103 | const getTitle = computed(() => (!unref(isUpdate) ? '新增模板配置' : '编辑模板配置')); |
104 | 104 | ||
105 | async function handleSubmit() { | 105 | async function handleSubmit() { |
106 | + setDrawerProps({ confirmLoading: true }); | ||
106 | try { | 107 | try { |
107 | const values = await validate(); | 108 | const values = await validate(); |
108 | const { createMessage } = useMessage(); | 109 | const { createMessage } = useMessage(); |
109 | - setDrawerProps({ confirmLoading: true }); | ||
110 | let config = {}; | 110 | let config = {}; |
111 | if (values.messageType === 'PHONE_MESSAGE') { | 111 | if (values.messageType === 'PHONE_MESSAGE') { |
112 | config = { | 112 | config = { |
@@ -129,7 +129,9 @@ | @@ -129,7 +129,9 @@ | ||
129 | emit('success'); | 129 | emit('success'); |
130 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 130 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
131 | } finally { | 131 | } finally { |
132 | - setDrawerProps({ confirmLoading: false }); | 132 | + setTimeout(() => { |
133 | + setDrawerProps({ confirmLoading: false }); | ||
134 | + }, 300); | ||
133 | } | 135 | } |
134 | } | 136 | } |
135 | 137 |
@@ -119,7 +119,9 @@ | @@ -119,7 +119,9 @@ | ||
119 | openDrawerAdd(true, { | 119 | openDrawerAdd(true, { |
120 | isUpdate: false, | 120 | isUpdate: false, |
121 | }); | 121 | }); |
122 | - NotifyManagerDrawerRef.value.setFieldsValue({ content: '' }); | 122 | + nextTick(() => { |
123 | + NotifyManagerDrawerRef.value.setFieldsValue({ content: '' }); | ||
124 | + }); | ||
123 | } | 125 | } |
124 | 126 | ||
125 | const handleView = (record: Recordable) => { | 127 | const handleView = (record: Recordable) => { |
@@ -10,8 +10,8 @@ | @@ -10,8 +10,8 @@ | ||
10 | <BasicForm @register="registerForm" /> | 10 | <BasicForm @register="registerForm" /> |
11 | <template #footer> | 11 | <template #footer> |
12 | <a-button @click="handleCancel">取消</a-button> | 12 | <a-button @click="handleCancel">取消</a-button> |
13 | - <a-button @click="handleSaveDraft">保存草稿</a-button> | ||
14 | - <a-button type="primary" @click="handleSend">发布通知</a-button> | 13 | + <a-button :disabled="draftDisable" @click="handleSaveDraft">保存草稿</a-button> |
14 | + <a-button :disabled="sendDisable" type="primary" @click="handleSend">发布通知</a-button> | ||
15 | </template> | 15 | </template> |
16 | </BasicDrawer> | 16 | </BasicDrawer> |
17 | </div> | 17 | </div> |
@@ -31,6 +31,8 @@ | @@ -31,6 +31,8 @@ | ||
31 | components: { BasicDrawer, BasicForm }, | 31 | components: { BasicDrawer, BasicForm }, |
32 | emits: ['success', 'register'], | 32 | emits: ['success', 'register'], |
33 | setup(_, { emit }) { | 33 | setup(_, { emit }) { |
34 | + const draftDisable = ref(false); | ||
35 | + const sendDisable = ref(false); | ||
34 | const { createMessage } = useMessage(); | 36 | const { createMessage } = useMessage(); |
35 | const isUpdate = ref<Boolean>(); | 37 | const isUpdate = ref<Boolean>(); |
36 | const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | 38 | const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); |
@@ -41,9 +43,9 @@ | @@ -41,9 +43,9 @@ | ||
41 | showActionButtonGroup: false, | 43 | showActionButtonGroup: false, |
42 | }); | 44 | }); |
43 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 45 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
44 | - setDrawerProps({ confirmLoading: false }); | ||
45 | await resetFields(); | 46 | await resetFields(); |
46 | - isUpdate.value = data.isUpdate; | 47 | + setDrawerProps({ confirmLoading: false }); |
48 | + isUpdate.value = !!data.isUpdate; | ||
47 | //编辑 | 49 | //编辑 |
48 | if (data.isUpdate) { | 50 | if (data.isUpdate) { |
49 | noticeId.value = data.record.id; | 51 | noticeId.value = data.record.id; |
@@ -58,13 +60,13 @@ | @@ -58,13 +60,13 @@ | ||
58 | }); | 60 | }); |
59 | // 发布通知 | 61 | // 发布通知 |
60 | const handleSend = async () => { | 62 | const handleSend = async () => { |
61 | - const valid = await validate(); | ||
62 | - if (!valid) return; | ||
63 | - const field = getFieldsValue(); | ||
64 | - const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | ||
65 | - // 新增情况 | ||
66 | try { | 63 | try { |
67 | - setDrawerProps({ confirmLoading: true }); | 64 | + sendDisable.value = true; |
65 | + const valid = await validate(); | ||
66 | + if (!valid) return; | ||
67 | + const field = getFieldsValue(); | ||
68 | + const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | ||
69 | + // 新增情况 | ||
68 | const editNotice = { | 70 | const editNotice = { |
69 | ...field, | 71 | ...field, |
70 | pointId, | 72 | pointId, |
@@ -75,14 +77,17 @@ | @@ -75,14 +77,17 @@ | ||
75 | closeDrawer(); | 77 | closeDrawer(); |
76 | createMessage.success('发布成功'); | 78 | createMessage.success('发布成功'); |
77 | } catch { | 79 | } catch { |
80 | + sendDisable.value = false; | ||
78 | } finally { | 81 | } finally { |
79 | - setDrawerProps({ confirmLoading: false }); | 82 | + setTimeout(() => { |
83 | + sendDisable.value = false; | ||
84 | + }, 300); | ||
80 | } | 85 | } |
81 | }; | 86 | }; |
82 | // 保存草稿 | 87 | // 保存草稿 |
83 | const handleSaveDraft = async () => { | 88 | const handleSaveDraft = async () => { |
89 | + draftDisable.value = true; | ||
84 | try { | 90 | try { |
85 | - setDrawerProps({ confirmLoading: true }); | ||
86 | await validate(); | 91 | await validate(); |
87 | const field = getFieldsValue(); | 92 | const field = getFieldsValue(); |
88 | const pointId = field.receiverType === 1 ? field.organizationId + '' : null; | 93 | const pointId = field.receiverType === 1 ? field.organizationId + '' : null; |
@@ -104,8 +109,11 @@ | @@ -104,8 +109,11 @@ | ||
104 | closeDrawer(); | 109 | closeDrawer(); |
105 | createMessage.success('保存草稿成功'); | 110 | createMessage.success('保存草稿成功'); |
106 | } catch { | 111 | } catch { |
112 | + draftDisable.value = false; | ||
107 | } finally { | 113 | } finally { |
108 | - setDrawerProps({ confirmLoading: false }); | 114 | + setTimeout(() => { |
115 | + draftDisable.value = false; | ||
116 | + }, 300); | ||
109 | } | 117 | } |
110 | }; | 118 | }; |
111 | const handleCancel = () => { | 119 | const handleCancel = () => { |
@@ -113,6 +121,8 @@ | @@ -113,6 +121,8 @@ | ||
113 | closeDrawer(); | 121 | closeDrawer(); |
114 | }; | 122 | }; |
115 | return { | 123 | return { |
124 | + draftDisable, | ||
125 | + sendDisable, | ||
116 | getTitle, | 126 | getTitle, |
117 | handleSend, | 127 | handleSend, |
118 | handleCancel, | 128 | handleCancel, |
@@ -67,7 +67,8 @@ | @@ -67,7 +67,8 @@ | ||
67 | :actionData="actionData" | 67 | :actionData="actionData" |
68 | :triggerData="triggerData" | 68 | :triggerData="triggerData" |
69 | :ref="skipUnwrap.actionItemRefs" | 69 | :ref="skipUnwrap.actionItemRefs" |
70 | - :deviceList="deviceList" | 70 | + :provideOrgid="provideOrgid" |
71 | + :deviceList="getMasterDeviceList" | ||
71 | :arr="arr" | 72 | :arr="arr" |
72 | @deleteAction="deleteAction" | 73 | @deleteAction="deleteAction" |
73 | @getActionFormArr="getActionFormArr" | 74 | @getActionFormArr="getActionFormArr" |
@@ -99,7 +100,6 @@ | @@ -99,7 +100,6 @@ | ||
99 | screenLinkPageByDeptIdGetDevice, | 100 | screenLinkPageByDeptIdGetDevice, |
100 | getOrganizationAlarmConfig, | 101 | getOrganizationAlarmConfig, |
101 | byOganizationIdGetMasterDevice, | 102 | byOganizationIdGetMasterDevice, |
102 | - getAttribute, | ||
103 | } from '/@/api/ruleengine/ruleengineApi'; | 103 | } from '/@/api/ruleengine/ruleengineApi'; |
104 | import TriggerOrCondition from './cpns/Trigger-Condition.vue'; | 104 | import TriggerOrCondition from './cpns/Trigger-Condition.vue'; |
105 | import Action from './cpns/Action.vue'; | 105 | import Action from './cpns/Action.vue'; |
@@ -107,8 +107,8 @@ | @@ -107,8 +107,8 @@ | ||
107 | import { formatToDateTime } from '/@/utils/dateUtil'; | 107 | import { formatToDateTime } from '/@/utils/dateUtil'; |
108 | 108 | ||
109 | const emit = defineEmits(['register', 'success']); | 109 | const emit = defineEmits(['register', 'success']); |
110 | - | ||
111 | const provideOrgid = ref(''); | 110 | const provideOrgid = ref(''); |
111 | + | ||
112 | const { createMessage } = useMessage(); | 112 | const { createMessage } = useMessage(); |
113 | const triggerData = ref([]); | 113 | const triggerData = ref([]); |
114 | const conditionData = ref([]); | 114 | const conditionData = ref([]); |
@@ -125,8 +125,6 @@ | @@ -125,8 +125,6 @@ | ||
125 | let getConditionFormValue = ref([]); | 125 | let getConditionFormValue = ref([]); |
126 | let getActionFormValue = ref([]); | 126 | let getActionFormValue = ref([]); |
127 | const editEntryIdData = ref([]); | 127 | const editEntryIdData = ref([]); |
128 | - const editEntryIdExcludeDoActionData = ref([]); | ||
129 | - let editAttrIdData = []; | ||
130 | const editAlarmConfigData = ref([]); | 128 | const editAlarmConfigData = ref([]); |
131 | const isUpdate = ref(false); | 129 | const isUpdate = ref(false); |
132 | const id = ref(undefined); | 130 | const id = ref(undefined); |
@@ -158,31 +156,24 @@ | @@ -158,31 +156,24 @@ | ||
158 | await setFieldsValue(data.record); | 156 | await setFieldsValue(data.record); |
159 | id.value = recordId; | 157 | id.value = recordId; |
160 | tenantId.value = recordTenantId; | 158 | tenantId.value = recordTenantId; |
159 | + //TODO-fengtao-把组织id传给子组件 | ||
161 | provideOrgid.value = organizationId; | 160 | provideOrgid.value = organizationId; |
161 | + //TODO-fengtao获取当前执行动作下的设备(master那个接口) | ||
162 | + getMasterDeviceList.value = await byOganizationIdGetMasterDevice(organizationId); | ||
163 | + //TODO-fengtao | ||
162 | // 获取当前组织下的设备列表 | 164 | // 获取当前组织下的设备列表 |
163 | - const options = await byOganizationIdGetMasterDevice(organizationId); | ||
164 | - const optionsExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId }); | 165 | + const options = await screenLinkPageByDeptIdGetDevice({ |
166 | + organizationId, | ||
167 | + }); | ||
165 | // 获取当前组织下的告警配置 | 168 | // 获取当前组织下的告警配置 |
166 | const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); | 169 | const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); |
167 | - // 获取当前组织下的属性列表 | ||
168 | - const attrList = await getAttribute( | ||
169 | - organizationId, | ||
170 | - triggers.map((m) => m.entityId).join(',') | ||
171 | - ); | ||
172 | - watchAttrList.value = await getAttribute(organizationId, null); | ||
173 | 170 | ||
174 | // 生成回显时对应得组件数量 | 171 | // 生成回显时对应得组件数量 |
175 | triggerData.value = [...new Array(triggers.length).keys()]; | 172 | triggerData.value = [...new Array(triggers.length).keys()]; |
176 | conditionData.value = [...new Array(doConditions.length).keys()]; | 173 | conditionData.value = [...new Array(doConditions.length).keys()]; |
177 | actionData.value = [...new Array(doActions.length).keys()]; | 174 | actionData.value = [...new Array(doActions.length).keys()]; |
178 | // 回显设备列表 | 175 | // 回显设备列表 |
179 | - editEntryIdData.value = options.map((item) => { | ||
180 | - return { | ||
181 | - value: item.id, | ||
182 | - label: item.name, | ||
183 | - }; | ||
184 | - }); | ||
185 | - editEntryIdExcludeDoActionData.value = optionsExcludeDoAction.items.map((item) => { | 176 | + editEntryIdData.value = options.items.map((item) => { |
186 | return { | 177 | return { |
187 | value: item.tbDeviceId, | 178 | value: item.tbDeviceId, |
188 | label: item.name, | 179 | label: item.name, |
@@ -195,17 +186,11 @@ | @@ -195,17 +186,11 @@ | ||
195 | }; | 186 | }; |
196 | }); | 187 | }); |
197 | deviceList.value = editEntryIdData.value; | 188 | deviceList.value = editEntryIdData.value; |
198 | - deviceExcludeDoAction.value = editEntryIdExcludeDoActionData.value; | ||
199 | - | ||
200 | - //回显属性列表 | ||
201 | - editAttrIdData = attrList; | ||
202 | nextTick(() => { | 189 | nextTick(() => { |
203 | - setEditFields(skipUnwrap.triggerItemRefs, editEntryIdExcludeDoActionData); | ||
204 | - setEditFields(skipUnwrap.conditionItemRefs, editEntryIdExcludeDoActionData); | ||
205 | - setEditFields(skipUnwrap.actionItemRefs, editEntryIdData); | 190 | + setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData); |
191 | + setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData); | ||
192 | + setEditFields(skipUnwrap.actionItemRefs, getMasterDeviceList); | ||
206 | setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); | 193 | setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); |
207 | - setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData); | ||
208 | - setEditAttr(skipUnwrap.conditionItemRefs, editAttrIdData); | ||
209 | }); | 194 | }); |
210 | 195 | ||
211 | const map = { | 196 | const map = { |
@@ -216,6 +201,7 @@ | @@ -216,6 +201,7 @@ | ||
216 | // 回显触发器数据---此处是个闭包! | 201 | // 回显触发器数据---此处是个闭包! |
217 | triggers.forEach((trigger, index) => { | 202 | triggers.forEach((trigger, index) => { |
218 | nextTick(async () => { | 203 | nextTick(async () => { |
204 | + const selectDeviceId = ref(''); | ||
219 | // 回显启用规则 | 205 | // 回显启用规则 |
220 | unref(skipUnwrap.triggerItemRefs)[index].currentIndex = | 206 | unref(skipUnwrap.triggerItemRefs)[index].currentIndex = |
221 | map[trigger.triggerCondition.schedule.type]; | 207 | map[trigger.triggerCondition.schedule.type]; |
@@ -223,15 +209,12 @@ | @@ -223,15 +209,12 @@ | ||
223 | unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true; | 209 | unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true; |
224 | unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData = | 210 | unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData = |
225 | trigger.triggerCondition.schedule; | 211 | trigger.triggerCondition.schedule; |
226 | - const getAttrKeyOption = trigger?.triggerCondition?.condition?.condition?.map( | ||
227 | - (m) => m.key.key | ||
228 | - ); | ||
229 | unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({ | 212 | unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({ |
230 | triggered: trigger?.triggerCondition?.condition?.spec?.type, | 213 | triggered: trigger?.triggerCondition?.condition?.spec?.type, |
231 | device: trigger?.entityType, | 214 | device: trigger?.entityType, |
232 | triggerType: trigger?.triggerType, | 215 | triggerType: trigger?.triggerType, |
233 | type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type, | 216 | type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type, |
234 | - type2: getAttrKeyOption, | 217 | + type2: trigger?.triggerCondition?.condition?.condition[0]?.key?.key, |
235 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, | 218 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, |
236 | detail: trigger?.triggerCondition?.alarmDetails, | 219 | detail: trigger?.triggerCondition?.alarmDetails, |
237 | entityId: trigger?.entityId, | 220 | entityId: trigger?.entityId, |
@@ -239,6 +222,15 @@ | @@ -239,6 +222,15 @@ | ||
239 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 222 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
240 | timeUnit: trigger?.triggerCondition?.condition?.spec?.unit, | 223 | timeUnit: trigger?.triggerCondition?.condition?.spec?.unit, |
241 | }); | 224 | }); |
225 | + if (trigger.entityId != undefined) { | ||
226 | + selectDeviceId.value = trigger?.entityId; | ||
227 | + } | ||
228 | + //fengtao-把设备id回传给子组件 | ||
229 | + unref(skipUnwrap.triggerItemRefs)[index].updateFieldAttributeFunc( | ||
230 | + selectDeviceId.value, | ||
231 | + provideOrgid.value | ||
232 | + ); | ||
233 | + //fengtao | ||
242 | // 设置值operationType | 234 | // 设置值operationType |
243 | unref(skipUnwrap.triggerItemRefs)[index].operationType = | 235 | unref(skipUnwrap.triggerItemRefs)[index].operationType = |
244 | trigger.triggerCondition?.condition.condition[0].valueType; | 236 | trigger.triggerCondition?.condition.condition[0].valueType; |
@@ -290,6 +282,7 @@ | @@ -290,6 +282,7 @@ | ||
290 | 282 | ||
291 | doConditions.forEach((condition, index) => { | 283 | doConditions.forEach((condition, index) => { |
292 | nextTick(async () => { | 284 | nextTick(async () => { |
285 | + const selectDeviceId = ref(''); | ||
293 | // 回显启用规则 | 286 | // 回显启用规则 |
294 | unref(skipUnwrap.conditionItemRefs)[index].currentIndex = | 287 | unref(skipUnwrap.conditionItemRefs)[index].currentIndex = |
295 | map[condition.triggerCondition.schedule.type]; | 288 | map[condition.triggerCondition.schedule.type]; |
@@ -298,15 +291,12 @@ | @@ -298,15 +291,12 @@ | ||
298 | unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true; | 291 | unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true; |
299 | unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData = | 292 | unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData = |
300 | condition.triggerCondition.schedule; | 293 | condition.triggerCondition.schedule; |
301 | - const getAttrKeyOption = condition?.triggerCondition?.condition?.condition?.map( | ||
302 | - (m) => m.key.key | ||
303 | - ); | ||
304 | unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({ | 294 | unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({ |
305 | triggered: condition?.triggerCondition?.condition?.spec?.type, | 295 | triggered: condition?.triggerCondition?.condition?.spec?.type, |
306 | device: condition?.entityType, | 296 | device: condition?.entityType, |
307 | triggerType: condition?.triggerType, | 297 | triggerType: condition?.triggerType, |
308 | type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type, | 298 | type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type, |
309 | - type2: getAttrKeyOption, | 299 | + type2: condition?.triggerCondition?.condition?.condition[0]?.key?.key, |
310 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, | 300 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, |
311 | detail: condition?.triggerCondition?.alarmDetails, | 301 | detail: condition?.triggerCondition?.alarmDetails, |
312 | entityId: condition?.entityId, | 302 | entityId: condition?.entityId, |
@@ -314,6 +304,15 @@ | @@ -314,6 +304,15 @@ | ||
314 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 304 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
315 | timeUnit: condition?.triggerCondition?.condition?.spec?.unit, | 305 | timeUnit: condition?.triggerCondition?.condition?.spec?.unit, |
316 | }); | 306 | }); |
307 | + if (condition?.entityId != undefined) { | ||
308 | + selectDeviceId.value = condition?.entityId; | ||
309 | + } | ||
310 | + //fengtao-把设备id回传给子组件 | ||
311 | + unref(skipUnwrap.conditionItemRefs)[index].updateFieldAttributeFunc( | ||
312 | + selectDeviceId.value, | ||
313 | + provideOrgid.value | ||
314 | + ); | ||
315 | + //fengtao | ||
317 | // 设置值operationType | 316 | // 设置值operationType |
318 | unref(skipUnwrap.conditionItemRefs)[index].operationType = | 317 | unref(skipUnwrap.conditionItemRefs)[index].operationType = |
319 | condition.triggerCondition?.condition.condition[0].valueType; | 318 | condition.triggerCondition?.condition.condition[0].valueType; |
@@ -365,6 +364,7 @@ | @@ -365,6 +364,7 @@ | ||
365 | 364 | ||
366 | doActions.forEach((action, index) => { | 365 | doActions.forEach((action, index) => { |
367 | nextTick(() => { | 366 | nextTick(() => { |
367 | + const selectDeviceId = ref(''); | ||
368 | // 设置执行动作外层值 | 368 | // 设置执行动作外层值 |
369 | unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ | 369 | unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ |
370 | outTarget: action.outTarget, | 370 | outTarget: action.outTarget, |
@@ -419,6 +419,18 @@ | @@ -419,6 +419,18 @@ | ||
419 | timeUnit: | 419 | timeUnit: |
420 | action.doContext.clearRule[index].triggerCondition.condition.spec.unit, | 420 | action.doContext.clearRule[index].triggerCondition.condition.spec.unit, |
421 | }); | 421 | }); |
422 | + if (action.doContext.clearRule[index].entityId != undefined) { | ||
423 | + selectDeviceId.value = action.doContext.clearRule[index].entityId; | ||
424 | + } | ||
425 | + //fengtao-把设备id回传给子组件 | ||
426 | + item.updateFieldAttributeFunc(selectDeviceId.value, provideOrgid.value); | ||
427 | + item.updateFieldDeviceId( | ||
428 | + deviceList.value, | ||
429 | + provideOrgid.value, | ||
430 | + isUpdate.value, | ||
431 | + getMasterDeviceList.value | ||
432 | + ); | ||
433 | + //fengtao | ||
422 | // 单独设置operationType值 操作符类型 NUMERIC|String|Boolean|DATE_TIME | 434 | // 单独设置operationType值 操作符类型 NUMERIC|String|Boolean|DATE_TIME |
423 | item.operationType = | 435 | item.operationType = |
424 | action.doContext.clearRule[ | 436 | action.doContext.clearRule[ |
@@ -444,6 +456,7 @@ | @@ -444,6 +456,7 @@ | ||
444 | nextTick(() => { | 456 | nextTick(() => { |
445 | const richTextList = []; | 457 | const richTextList = []; |
446 | rule.triggerCondition.condition.condition.forEach((item, conditionIndex) => { | 458 | rule.triggerCondition.condition.condition.forEach((item, conditionIndex) => { |
459 | + //TODO-fengtao之前是Number( item.predicate.value.defaultValue)-发现回显是Invalide Time | ||
447 | const formItem = { | 460 | const formItem = { |
448 | operation: item.predicate.operation, | 461 | operation: item.predicate.operation, |
449 | value: | 462 | value: |
@@ -456,18 +469,20 @@ | @@ -456,18 +469,20 @@ | ||
456 | ignoreCase: | 469 | ignoreCase: |
457 | item.valueType === 'STRING' ? item.predicate.ignoreCase : undefined, | 470 | item.valueType === 'STRING' ? item.predicate.ignoreCase : undefined, |
458 | }; | 471 | }; |
472 | + //TODO-fengtao之前是Number( item.predicate.value.defaultValue)-发现回显是Invalide Time | ||
459 | richTextList.push({ | 473 | richTextList.push({ |
460 | // 查询中文操作符 | 474 | // 查询中文操作符 |
461 | operation: findOperation(item.valueType, item.predicate.operation).label, | 475 | operation: findOperation(item.valueType, item.predicate.operation).label, |
462 | value: | 476 | value: |
463 | item.valueType === 'DATE_TIME' | 477 | item.valueType === 'DATE_TIME' |
464 | ? formatToDateTime( | 478 | ? formatToDateTime( |
465 | - Number(item.predicate.value.defaultValue), | 479 | + item.predicate.value.defaultValue, |
466 | 'YYYY-MM-DD HH:mm:ss' | 480 | 'YYYY-MM-DD HH:mm:ss' |
467 | ) | 481 | ) |
468 | : String(item.predicate.value.defaultValue), | 482 | : String(item.predicate.value.defaultValue), |
469 | attribute: item?.key?.key, | 483 | attribute: item?.key?.key, |
470 | }); | 484 | }); |
485 | + //TODO-fengtao之前是Number( item.predicate.value.defaultValue)-发现回显是Invalide Time | ||
471 | ConditionScreeningForm[ruleIndex].value[conditionIndex].setFieldsValue( | 486 | ConditionScreeningForm[ruleIndex].value[conditionIndex].setFieldsValue( |
472 | formItem | 487 | formItem |
473 | ); | 488 | ); |
@@ -493,11 +508,9 @@ | @@ -493,11 +508,9 @@ | ||
493 | // 设置设备的options | 508 | // 设置设备的options |
494 | const setEditFields = (linkAge, deviceList) => { | 509 | const setEditFields = (linkAge, deviceList) => { |
495 | unref(linkAge).map((item) => { | 510 | unref(linkAge).map((item) => { |
496 | - if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') { | ||
497 | - item.updateExcludeActionFieldDeviceId(deviceList); | ||
498 | - } else { | ||
499 | - item.updateFieldDeviceId(deviceList); | ||
500 | - } | 511 | + //TODO-fengtao |
512 | + item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList); | ||
513 | + //TODO-fengtao | ||
501 | }); | 514 | }); |
502 | }; | 515 | }; |
503 | // 设置告警配置options | 516 | // 设置告警配置options |
@@ -506,29 +519,21 @@ | @@ -506,29 +519,21 @@ | ||
506 | item.updateEditFieldAlarmConfig(alarmConfigList); | 519 | item.updateEditFieldAlarmConfig(alarmConfigList); |
507 | }); | 520 | }); |
508 | }; | 521 | }; |
509 | - //设置设备属性的options | ||
510 | - const setEditAttr = (linkAge, attrList) => { | ||
511 | - unref(linkAge).map((item) => { | ||
512 | - item.updateFieldAttr(attrList); | ||
513 | - }); | ||
514 | - }; | ||
515 | - | ||
516 | // 监听组织变化更新设备列表 | 522 | // 监听组织变化更新设备列表 |
517 | const deviceList = ref([]); | 523 | const deviceList = ref([]); |
524 | + const getMasterDeviceList = ref([]); | ||
525 | + const orgId = ref(''); | ||
518 | const alarmConfigList = ref([]); | 526 | const alarmConfigList = ref([]); |
519 | - const watchAttrList = ref([]); | ||
520 | - const deviceExcludeDoAction = ref([]); | ||
521 | watch(organizationId, async (newValue: string) => { | 527 | watch(organizationId, async (newValue: string) => { |
522 | if (!newValue) return; | 528 | if (!newValue) return; |
523 | - provideOrgid.value = newValue; | ||
524 | - const items = await byOganizationIdGetMasterDevice(newValue); | ||
525 | - const itemExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue }); | ||
526 | - deviceExcludeDoAction.value = itemExcludeDoAction.items.map((item) => ({ | ||
527 | - label: item.name, | ||
528 | - value: item.tbDeviceId, | ||
529 | - })); | ||
530 | - deviceList.value = items.map((item) => ({ label: item.name, value: item.id })); | ||
531 | - watchAttrList.value = await getAttribute(newValue, null); | 529 | + const { items } = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue }); |
530 | + //TODO fengtao | ||
531 | + getMasterDeviceList.value = await byOganizationIdGetMasterDevice(newValue); | ||
532 | + //TODO fengtao | ||
533 | + deviceList.value = items.map((item) => ({ label: item.name, value: item.tbDeviceId })); | ||
534 | + //TODO fengtao | ||
535 | + orgId.value = newValue; | ||
536 | + //TODO fengtao | ||
532 | setFields(skipUnwrap.triggerItemRefs, true); | 537 | setFields(skipUnwrap.triggerItemRefs, true); |
533 | setFields(skipUnwrap.conditionItemRefs, true); | 538 | setFields(skipUnwrap.conditionItemRefs, true); |
534 | setFields(skipUnwrap.actionItemRefs, true); | 539 | setFields(skipUnwrap.actionItemRefs, true); |
@@ -541,12 +546,9 @@ | @@ -541,12 +546,9 @@ | ||
541 | function setFields(linkAge, isOrganizationChange = false) { | 546 | function setFields(linkAge, isOrganizationChange = false) { |
542 | unref(linkAge).map((item) => { | 547 | unref(linkAge).map((item) => { |
543 | isOrganizationChange && item.resetFieldsValueFunc(); | 548 | isOrganizationChange && item.resetFieldsValueFunc(); |
544 | - if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') { | ||
545 | - item.updateExcludeActionFieldDeviceId(deviceExcludeDoAction); | ||
546 | - item.updateFieldAttr(watchAttrList); | ||
547 | - } else { | ||
548 | - item.updateFieldDeviceId(deviceList); | ||
549 | - } | 549 | + //TODO fengtao |
550 | + item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList); | ||
551 | + //TODO fengtao | ||
550 | }); | 552 | }); |
551 | } | 553 | } |
552 | function setAlarmConfig(linkAge, isOrganizationChange = false) { | 554 | function setAlarmConfig(linkAge, isOrganizationChange = false) { |
@@ -609,7 +611,21 @@ | @@ -609,7 +611,21 @@ | ||
609 | id: unref(id), | 611 | id: unref(id), |
610 | tenantId: unref(tenantId), | 612 | tenantId: unref(tenantId), |
611 | }; | 613 | }; |
612 | - | 614 | + //TODO fengtao---修改之前如果是新增,如果条件筛选页面打开,但没填值,还是可以新增成功 |
615 | + const typeBoolean = postAddOrEditData?.triggers?.some((f) => { | ||
616 | + let type = false; | ||
617 | + f?.triggerCondition?.condition?.condition?.some((s) => { | ||
618 | + if (s?.predicate?.value?.defaultValue == undefined) { | ||
619 | + type = true; | ||
620 | + } else { | ||
621 | + type = false; | ||
622 | + } | ||
623 | + }); | ||
624 | + return type; | ||
625 | + }); | ||
626 | + if (typeBoolean) return createMessage.error('请填写条件筛选'); | ||
627 | + //TODO 先暂时不加验证--设备-属性-填了加验证 | ||
628 | + //TODO fengtao | ||
613 | await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); | 629 | await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); |
614 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | 630 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); |
615 | closeDrawer(); | 631 | closeDrawer(); |
@@ -659,8 +675,14 @@ | @@ -659,8 +675,14 @@ | ||
659 | </script> | 675 | </script> |
660 | 676 | ||
661 | <style lang="less" scoped> | 677 | <style lang="less" scoped> |
662 | - ///统一下拉选择框宽度,否则超出默认宽度会造成页面样式错乱 | ||
663 | - :deep(.ant-select-selector) { | ||
664 | - max-width: 14.2rem; | 678 | + //TODO-fengtao |
679 | + ///移除选择框默认样式(24px)否则超出默认宽度会造成页面样式错乱 | ||
680 | + ::v-deep(.ant-select-selector) { | ||
681 | + padding-right: 0px !important; | ||
682 | + } | ||
683 | + | ||
684 | + ::v-deep(.ant-select-selection-overflow) { | ||
685 | + max-width: 10vw !important; | ||
665 | } | 686 | } |
687 | + //TODO-fengtao | ||
666 | </style> | 688 | </style> |
@@ -257,7 +257,7 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -257,7 +257,7 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
257 | { | 257 | { |
258 | field: 'type2', | 258 | field: 'type2', |
259 | label: '', | 259 | label: '', |
260 | - component: 'Select', | 260 | + component: 'AutoComplete', |
261 | componentProps: { | 261 | componentProps: { |
262 | placeholder: '请选择属性', | 262 | placeholder: '请选择属性', |
263 | }, | 263 | }, |
@@ -69,6 +69,7 @@ | @@ -69,6 +69,7 @@ | ||
69 | import { Icon } from '/@/components/Icon'; | 69 | import { Icon } from '/@/components/Icon'; |
70 | import AlarmSchedule from './AlarmSchedule.vue'; | 70 | import AlarmSchedule from './AlarmSchedule.vue'; |
71 | import { useModal } from '/@/components/Modal'; | 71 | import { useModal } from '/@/components/Modal'; |
72 | + import { cloneDeep } from 'lodash-es'; | ||
72 | 73 | ||
73 | defineProps({ | 74 | defineProps({ |
74 | index: { | 75 | index: { |
@@ -84,7 +85,9 @@ | @@ -84,7 +85,9 @@ | ||
84 | const isUpdate = ref(false); | 85 | const isUpdate = ref(false); |
85 | const conditionScreeningRef = ref(); | 86 | const conditionScreeningRef = ref(); |
86 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | 87 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ |
87 | - schemas: trigger_condition_schema, | 88 | + //TODO-wenwei-修复 |
89 | + schemas: cloneDeep(trigger_condition_schema), | ||
90 | + //TODO-wenwei-修复 | ||
88 | showActionButtonGroup: false, | 91 | showActionButtonGroup: false, |
89 | }); | 92 | }); |
90 | 93 | ||
@@ -96,14 +99,83 @@ | @@ -96,14 +99,83 @@ | ||
96 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; | 99 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; |
97 | }; | 100 | }; |
98 | 101 | ||
99 | - const updateFieldDeviceId = (deviceList: any[]) => { | 102 | + const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => { |
103 | + if (isUpdate) { | ||
104 | + updateSchema({ | ||
105 | + field: 'entityId', | ||
106 | + componentProps: { | ||
107 | + options: deviceList, | ||
108 | + onChange(e) { | ||
109 | + if (e) { | ||
110 | + if (isUpdate) { | ||
111 | + setFieldsValue({ type2: '' }); | ||
112 | + } | ||
113 | + //fengtao | ||
114 | + updateFieldAttributeFunc(e, orgId); | ||
115 | + //fengtao | ||
116 | + } | ||
117 | + }, | ||
118 | + }, | ||
119 | + }); | ||
120 | + } | ||
121 | + //新增、编辑都会触发onChang事件 | ||
100 | updateSchema({ | 122 | updateSchema({ |
101 | - field: 'entityId', | 123 | + field: 'device', |
102 | componentProps: { | 124 | componentProps: { |
103 | - options: deviceList, | ||
104 | - onChange(e) { | 125 | + options: [ |
126 | + { label: '全部', value: 'ALL' }, | ||
127 | + { label: '部分', value: 'PART' }, | ||
128 | + ], | ||
129 | + async onChange(e) { | ||
130 | + setFieldsValue({ type2: '' }); | ||
131 | + setFieldsValue({ entityId: [] }); | ||
132 | + //部分切换-清空或者重置为初始值 | ||
133 | + updateSchema({ | ||
134 | + field: 'type2', | ||
135 | + componentProps: { | ||
136 | + options: [], | ||
137 | + }, | ||
138 | + }); | ||
105 | if (e) { | 139 | if (e) { |
106 | - updateFieldAttributeFunc(); | 140 | + //fengtao |
141 | + if (e == 'ALL') { | ||
142 | + const data = await getAttribute(orgId, null); | ||
143 | + //fengtao | ||
144 | + const options = data.map((m) => { | ||
145 | + return { | ||
146 | + label: m, | ||
147 | + value: m, | ||
148 | + }; | ||
149 | + }); | ||
150 | + updateSchema({ | ||
151 | + field: 'type2', | ||
152 | + componentProps: { | ||
153 | + placeholder: '请选择属性', | ||
154 | + options, | ||
155 | + }, | ||
156 | + }); | ||
157 | + } else { | ||
158 | + const getT = getFieldsValue(); | ||
159 | + const entityId = getT.entityId; | ||
160 | + if (entityId !== undefined && entityId.length > 0) { | ||
161 | + updateFieldAttributeFunc(entityId, orgId); | ||
162 | + } | ||
163 | + updateSchema({ | ||
164 | + field: 'entityId', | ||
165 | + componentProps: { | ||
166 | + options: deviceList, | ||
167 | + onChange(e) { | ||
168 | + if (e) { | ||
169 | + setFieldsValue({ type2: '' }); | ||
170 | + //fengtao | ||
171 | + updateFieldAttributeFunc(e, orgId); | ||
172 | + //fengtao | ||
173 | + } | ||
174 | + }, | ||
175 | + }, | ||
176 | + }); | ||
177 | + } | ||
178 | + //fengtao | ||
107 | } | 179 | } |
108 | }, | 180 | }, |
109 | }, | 181 | }, |
@@ -115,8 +187,17 @@ | @@ -115,8 +187,17 @@ | ||
115 | const setFieldsFormValueFun = (fieldsValue) => { | 187 | const setFieldsFormValueFun = (fieldsValue) => { |
116 | setFieldsValue(fieldsValue); | 188 | setFieldsValue(fieldsValue); |
117 | }; | 189 | }; |
118 | - const updateFieldAttributeFunc = async () => { | ||
119 | - const data = await getAttribute(); | 190 | + //TODO-fengtao |
191 | + const updateFieldAttributeFunc = async (deviceId, orgId) => { | ||
192 | + //TODO-fengtao | ||
193 | + let data; | ||
194 | + if (deviceId !== undefined && deviceId.length > 0) { | ||
195 | + const joinDeviceIds = deviceId.join(','); | ||
196 | + data = await getAttribute(orgId, joinDeviceIds); | ||
197 | + } else { | ||
198 | + data = await getAttribute(orgId, null); | ||
199 | + } | ||
200 | + //TODO-fengtao | ||
120 | const options = data.map((m) => { | 201 | const options = data.map((m) => { |
121 | return { | 202 | return { |
122 | label: m, | 203 | label: m, |
@@ -127,10 +208,11 @@ | @@ -127,10 +208,11 @@ | ||
127 | field: 'type2', | 208 | field: 'type2', |
128 | componentProps: { | 209 | componentProps: { |
129 | placeholder: '请选择属性', | 210 | placeholder: '请选择属性', |
130 | - options, | 211 | + options: options, |
131 | }, | 212 | }, |
132 | }); | 213 | }); |
133 | }; | 214 | }; |
215 | + //TODO-fengtao | ||
134 | const schedule = ref('ANY_TIME'); | 216 | const schedule = ref('ANY_TIME'); |
135 | const operationType = ref<string>(''); | 217 | const operationType = ref<string>(''); |
136 | provide('operationType', operationType); | 218 | provide('operationType', operationType); |
@@ -196,6 +278,7 @@ | @@ -196,6 +278,7 @@ | ||
196 | scheduleData, | 278 | scheduleData, |
197 | isUpdate, | 279 | isUpdate, |
198 | alarmScheduleRef, | 280 | alarmScheduleRef, |
281 | + updateFieldAttributeFunc, | ||
199 | }); | 282 | }); |
200 | </script> | 283 | </script> |
201 | <style> | 284 | <style> |
@@ -68,6 +68,7 @@ | @@ -68,6 +68,7 @@ | ||
68 | import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts'; | 68 | import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts'; |
69 | import AlarmSchedule from './AlarmSchedule.vue'; | 69 | import AlarmSchedule from './AlarmSchedule.vue'; |
70 | import { useModal } from '/@/components/Modal'; | 70 | import { useModal } from '/@/components/Modal'; |
71 | + import { cloneDeep } from 'lodash-es'; | ||
71 | 72 | ||
72 | const props = defineProps({ | 73 | const props = defineProps({ |
73 | title: { | 74 | title: { |
@@ -87,7 +88,9 @@ | @@ -87,7 +88,9 @@ | ||
87 | const isUpdate = ref(false); | 88 | const isUpdate = ref(false); |
88 | const conditionScreeningRef = ref(); | 89 | const conditionScreeningRef = ref(); |
89 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | 90 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ |
90 | - schemas: trigger_condition_schema, | 91 | + //TODO-wenwei-修复 |
92 | + schemas: cloneDeep(trigger_condition_schema), | ||
93 | + //TODO-wenwei-修复 | ||
91 | showActionButtonGroup: false, | 94 | showActionButtonGroup: false, |
92 | }); | 95 | }); |
93 | 96 | ||
@@ -98,42 +101,107 @@ | @@ -98,42 +101,107 @@ | ||
98 | ); | 101 | ); |
99 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; | 102 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; |
100 | }; | 103 | }; |
101 | - const updateExcludeActionFieldDeviceId = (deviceList: any[]) => { | 104 | + |
105 | + //TODO-fengtao | ||
106 | + const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => { | ||
107 | + //用于编辑回显 | ||
108 | + if (isUpdate.value) { | ||
109 | + updateSchema({ | ||
110 | + field: 'entityId', | ||
111 | + componentProps: { | ||
112 | + options: deviceList, | ||
113 | + onChange(e) { | ||
114 | + if (e) { | ||
115 | + if (isUpdate.value) { | ||
116 | + setFieldsValue({ type2: '' }); | ||
117 | + } | ||
118 | + //fengtao | ||
119 | + updateFieldAttributeFunc(e, orgId.value); | ||
120 | + //fengtao | ||
121 | + } | ||
122 | + }, | ||
123 | + }, | ||
124 | + }); | ||
125 | + } | ||
126 | + //新增、编辑都会触发onChang事件 | ||
102 | updateSchema({ | 127 | updateSchema({ |
103 | - field: 'entityId', | 128 | + field: 'device', |
104 | componentProps: { | 129 | componentProps: { |
105 | - options: deviceList, | ||
106 | - onChange(e) { | 130 | + options: [ |
131 | + { label: '全部', value: 'ALL' }, | ||
132 | + { label: '部分', value: 'PART' }, | ||
133 | + ], | ||
134 | + async onChange(e) { | ||
135 | + setFieldsValue({ type2: '' }); | ||
136 | + setFieldsValue({ entityId: [] }); | ||
137 | + updateSchema({ | ||
138 | + field: 'type2', | ||
139 | + componentProps: { | ||
140 | + options: [], | ||
141 | + }, | ||
142 | + }); | ||
107 | if (e) { | 143 | if (e) { |
108 | - updateFieldAttributeFunc(e); | 144 | + //fengtao |
145 | + if (e == 'ALL') { | ||
146 | + const data = await getAttribute(props.provideOrgid || orgId.value, null); | ||
147 | + //fengtao | ||
148 | + const options = data.map((m) => { | ||
149 | + return { | ||
150 | + label: m, | ||
151 | + value: m, | ||
152 | + }; | ||
153 | + }); | ||
154 | + updateSchema({ | ||
155 | + field: 'type2', | ||
156 | + componentProps: { | ||
157 | + placeholder: '请选择属性', | ||
158 | + options, | ||
159 | + }, | ||
160 | + }); | ||
161 | + } else { | ||
162 | + const getT = getFieldsValue(); | ||
163 | + const entityId = getT.entityId; | ||
164 | + if (entityId !== undefined && entityId.length > 0) { | ||
165 | + updateFieldAttributeFunc(entityId, orgId.value); | ||
166 | + } | ||
167 | + updateSchema({ | ||
168 | + field: 'entityId', | ||
169 | + componentProps: { | ||
170 | + options: deviceList, | ||
171 | + onChange(e) { | ||
172 | + if (e) { | ||
173 | + setFieldsValue({ type2: '' }); | ||
174 | + //fengtao | ||
175 | + updateFieldAttributeFunc(e, orgId.value); | ||
176 | + //fengtao | ||
177 | + } | ||
178 | + }, | ||
179 | + }, | ||
180 | + }); | ||
181 | + } | ||
182 | + //fengtao | ||
109 | } | 183 | } |
110 | }, | 184 | }, |
111 | }, | 185 | }, |
112 | }); | 186 | }); |
113 | }; | 187 | }; |
114 | - const updateFieldAttr = (attrList: any[]) => { | ||
115 | - const attrMapList = attrList.value?.map((m) => { | ||
116 | - return { | ||
117 | - label: m, | ||
118 | - value: m, | ||
119 | - }; | ||
120 | - }); | ||
121 | - updateSchema({ | ||
122 | - field: 'type2', | ||
123 | - componentProps: { | ||
124 | - placeholder: '请选择属性', | ||
125 | - options: attrMapList, | ||
126 | - }, | ||
127 | - }); | ||
128 | - }; | 188 | + //TODO-fengtao |
129 | const resetFieldsValueFunc = () => resetFields(); | 189 | const resetFieldsValueFunc = () => resetFields(); |
130 | // 回显数据函数 | 190 | // 回显数据函数 |
131 | const setFieldsFormValueFun = (fieldsValue) => { | 191 | const setFieldsFormValueFun = (fieldsValue) => { |
132 | setFieldsValue(fieldsValue); | 192 | setFieldsValue(fieldsValue); |
133 | }; | 193 | }; |
134 | - const updateFieldAttributeFunc = async (e) => { | ||
135 | - const joinDeviceIds = e.join(','); | ||
136 | - const data = await getAttribute(props.provideOrgid, joinDeviceIds); | 194 | + //TODO-fengtao |
195 | + const updateFieldAttributeFunc = async (deviceId, orgId) => { | ||
196 | + //TODO-fengtao | ||
197 | + let data; | ||
198 | + if (deviceId !== undefined && deviceId.length > 0) { | ||
199 | + const joinDeviceIds = deviceId.join(','); | ||
200 | + data = await getAttribute(orgId || props.provideOrgid, joinDeviceIds); | ||
201 | + } else { | ||
202 | + data = await getAttribute(orgId || props.provideOrgid, null); | ||
203 | + } | ||
204 | + //TODO-fengtao | ||
137 | const options = data.map((m) => { | 205 | const options = data.map((m) => { |
138 | return { | 206 | return { |
139 | label: m, | 207 | label: m, |
@@ -144,11 +212,11 @@ | @@ -144,11 +212,11 @@ | ||
144 | field: 'type2', | 212 | field: 'type2', |
145 | componentProps: { | 213 | componentProps: { |
146 | placeholder: '请选择属性', | 214 | placeholder: '请选择属性', |
147 | - options, | 215 | + options: options, |
148 | }, | 216 | }, |
149 | }); | 217 | }); |
150 | }; | 218 | }; |
151 | - | 219 | + //TODO-fengtao |
152 | const handleDelete = (params: { index: number; title: string }) => { | 220 | const handleDelete = (params: { index: number; title: string }) => { |
153 | emit('delete', params); | 221 | emit('delete', params); |
154 | }; | 222 | }; |
@@ -195,12 +263,9 @@ | @@ -195,12 +263,9 @@ | ||
195 | currentIndex.value = index; | 263 | currentIndex.value = index; |
196 | }; | 264 | }; |
197 | const scheduleData = ref(null); | 265 | const scheduleData = ref(null); |
198 | - const isTriggerAndConditionFlag = 'isTriggerAndConditionFlag'; | ||
199 | defineExpose({ | 266 | defineExpose({ |
200 | - isTriggerAndConditionFlag, | ||
201 | getFieldsValueFunc, | 267 | getFieldsValueFunc, |
202 | - updateExcludeActionFieldDeviceId, | ||
203 | - updateFieldAttr, | 268 | + updateFieldDeviceId, |
204 | resetFieldsValueFunc, | 269 | resetFieldsValueFunc, |
205 | setFieldsFormValueFun, | 270 | setFieldsFormValueFun, |
206 | childGetFieldsValue, | 271 | childGetFieldsValue, |
@@ -212,9 +277,17 @@ | @@ -212,9 +277,17 @@ | ||
212 | scheduleData, | 277 | scheduleData, |
213 | isUpdate, | 278 | isUpdate, |
214 | alarmScheduleRef, | 279 | alarmScheduleRef, |
280 | + updateFieldAttributeFunc, | ||
215 | }); | 281 | }); |
216 | </script> | 282 | </script> |
217 | 283 | ||
284 | +<style lang="less" scoped> | ||
285 | + ///移除选择框默认样式(24px)否则超出默认宽度会造成页面样式错乱 | ||
286 | + ::v-deep(.ant-select-selector) { | ||
287 | + padding-right: 0px !important; | ||
288 | + } | ||
289 | +</style> | ||
290 | + | ||
218 | <style> | 291 | <style> |
219 | .active { | 292 | .active { |
220 | color: #377dff; | 293 | color: #377dff; |
@@ -90,6 +90,10 @@ | @@ -90,6 +90,10 @@ | ||
90 | type: Array, | 90 | type: Array, |
91 | default: () => [], | 91 | default: () => [], |
92 | }, | 92 | }, |
93 | + provideOrgid: { | ||
94 | + type: String, | ||
95 | + default: '', | ||
96 | + }, | ||
93 | }); | 97 | }); |
94 | const isAddClearRule = computed(() => clearRuleList.value.length < props.triggerData.length); | 98 | const isAddClearRule = computed(() => clearRuleList.value.length < props.triggerData.length); |
95 | const refItem = { | 99 | const refItem = { |
@@ -140,14 +144,34 @@ | @@ -140,14 +144,34 @@ | ||
140 | setFieldsValue(fieldsValue); | 144 | setFieldsValue(fieldsValue); |
141 | }; | 145 | }; |
142 | const resetFieldsValueFunc = () => resetFields(); | 146 | const resetFieldsValueFunc = () => resetFields(); |
143 | - const updateFieldDeviceId = (deviceList) => { | 147 | + |
148 | + const orgIdItem = ref(''); | ||
149 | + const isUpdateItem = ref(''); | ||
150 | + const deviceListItem = ref([]); | ||
151 | + | ||
152 | + //TODO-fengtao | ||
153 | + const updateFieldDeviceId = (deviceList, orgId, isUpdate, getMasterDeviceList) => { | ||
154 | + if (isUpdate.value) { | ||
155 | + orgIdItem.value = orgId.value; | ||
156 | + } | ||
157 | + orgIdItem.value = orgId.value; | ||
158 | + isUpdateItem.value = isUpdate.value; | ||
159 | + const options = getMasterDeviceList.value.map((m) => { | ||
160 | + return { | ||
161 | + value: m.id, | ||
162 | + label: m.name, | ||
163 | + }; | ||
164 | + }); | ||
165 | + deviceListItem.value = deviceList.value; | ||
166 | + console.log(' deviceListItem.value', deviceListItem.value); | ||
144 | updateSchema({ | 167 | updateSchema({ |
145 | field: 'deviceId', | 168 | field: 'deviceId', |
146 | componentProps: { | 169 | componentProps: { |
147 | - options: deviceList, | 170 | + options, |
148 | }, | 171 | }, |
149 | }); | 172 | }); |
150 | }; | 173 | }; |
174 | + //TODO-fengtao | ||
151 | const updateEditFieldAlarmConfig = (alarmConfigList) => { | 175 | const updateEditFieldAlarmConfig = (alarmConfigList) => { |
152 | updateSchema({ | 176 | updateSchema({ |
153 | field: 'alarm_config', | 177 | field: 'alarm_config', |
@@ -191,7 +215,11 @@ | @@ -191,7 +215,11 @@ | ||
191 | 215 | ||
192 | function setFields(refs) { | 216 | function setFields(refs) { |
193 | unref(refs).map((item) => { | 217 | unref(refs).map((item) => { |
194 | - item.updateFieldDeviceId(props.deviceList); | 218 | + item.updateFieldDeviceId( |
219 | + deviceListItem.value, | ||
220 | + props.provideOrgid || orgIdItem.value, | ||
221 | + isUpdateItem.value | ||
222 | + ); | ||
195 | }); | 223 | }); |
196 | } | 224 | } |
197 | const deleteClearRule = (index) => { | 225 | const deleteClearRule = (index) => { |
@@ -84,10 +84,9 @@ | @@ -84,10 +84,9 @@ | ||
84 | emit('isStatus', { status: 1, jsCode }); | 84 | emit('isStatus', { status: 1, jsCode }); |
85 | }; | 85 | }; |
86 | const handleSubmit = async () => { | 86 | const handleSubmit = async () => { |
87 | + setDrawerProps({ confirmLoading: true }); | ||
87 | const fieldsValue = getFieldsValue(); | 88 | const fieldsValue = getFieldsValue(); |
88 | try { | 89 | try { |
89 | - setDrawerProps({ confirmLoading: true }); | ||
90 | - | ||
91 | await createOrEditTransformScriptApi({ | 90 | await createOrEditTransformScriptApi({ |
92 | configuration: { | 91 | configuration: { |
93 | jsScript: aceEditor.value.getValue(), | 92 | jsScript: aceEditor.value.getValue(), |
@@ -103,7 +102,9 @@ | @@ -103,7 +102,9 @@ | ||
103 | const { createMessage } = useMessage(); | 102 | const { createMessage } = useMessage(); |
104 | createMessage.success('保存失败'); | 103 | createMessage.success('保存失败'); |
105 | } finally { | 104 | } finally { |
106 | - setDrawerProps({ confirmLoading: false }); | 105 | + setTimeout(() => { |
106 | + setDrawerProps({ confirmLoading: false }); | ||
107 | + }, 300); | ||
107 | } | 108 | } |
108 | }; | 109 | }; |
109 | const handleFormat = () => { | 110 | const handleFormat = () => { |
@@ -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 | + setModalProps({ confirmLoading: true }); | ||
114 | try { | 115 | try { |
115 | const { createMessage } = useMessage(); | 116 | const { createMessage } = useMessage(); |
116 | if (unref(isUpdate)) { | 117 | if (unref(isUpdate)) { |
@@ -133,7 +134,6 @@ | @@ -133,7 +134,6 @@ | ||
133 | typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null | 134 | typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null |
134 | ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') | 135 | ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') |
135 | : null; | 136 | : null; |
136 | - setModalProps({ confirmLoading: true }); | ||
137 | Object.assign(postData, values); | 137 | Object.assign(postData, values); |
138 | if (unref(isUpdate)) { | 138 | if (unref(isUpdate)) { |
139 | if (values.email == '') { | 139 | if (values.email == '') { |
@@ -149,7 +149,9 @@ | @@ -149,7 +149,9 @@ | ||
149 | emit('success'); | 149 | emit('success'); |
150 | createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); | 150 | createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); |
151 | } finally { | 151 | } finally { |
152 | - setModalProps({ confirmLoading: false }); | 152 | + setTimeout(() => { |
153 | + setModalProps({ confirmLoading: false }); | ||
154 | + }, 300); | ||
153 | } | 155 | } |
154 | } | 156 | } |
155 | return { | 157 | return { |
@@ -45,10 +45,10 @@ | @@ -45,10 +45,10 @@ | ||
45 | const getTitle = computed(() => (!unref(isUpdate) ? '新增字典配置' : '编辑字典配置')); | 45 | const getTitle = computed(() => (!unref(isUpdate) ? '新增字典配置' : '编辑字典配置')); |
46 | 46 | ||
47 | async function handleSubmit() { | 47 | async function handleSubmit() { |
48 | + setDrawerProps({ confirmLoading: true }); | ||
48 | try { | 49 | try { |
49 | const values = await validate(); | 50 | const values = await validate(); |
50 | const { createMessage } = useMessage(); | 51 | const { createMessage } = useMessage(); |
51 | - setDrawerProps({ confirmLoading: true }); | ||
52 | let successMessage = '添加成功'; | 52 | let successMessage = '添加成功'; |
53 | //如果是修改需要传入id | 53 | //如果是修改需要传入id |
54 | if (unref(isUpdate)) { | 54 | if (unref(isUpdate)) { |
@@ -61,7 +61,9 @@ | @@ -61,7 +61,9 @@ | ||
61 | createMessage.success(successMessage); | 61 | createMessage.success(successMessage); |
62 | }); | 62 | }); |
63 | } finally { | 63 | } finally { |
64 | - setDrawerProps({ confirmLoading: false }); | 64 | + setTimeout(() => { |
65 | + setDrawerProps({ confirmLoading: false }); | ||
66 | + }, 300); | ||
65 | } | 67 | } |
66 | } | 68 | } |
67 | 69 |
1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | +import { format } from '../util'; | ||
4 | 5 | ||
5 | //格式化资源类型和操作类型 | 6 | //格式化资源类型和操作类型 |
6 | let formatText; | 7 | let formatText; |
@@ -71,7 +72,7 @@ export const columns: BasicColumn[] = [ | @@ -71,7 +72,7 @@ export const columns: BasicColumn[] = [ | ||
71 | dataIndex: 'createdTime', | 72 | dataIndex: 'createdTime', |
72 | width: 180, | 73 | width: 180, |
73 | format: (_, record) => { | 74 | format: (_, record) => { |
74 | - return moment(record.createdTime).format('YYYY-MM-DD HH:MM:ss'); | 75 | + return format(record.createdTime, 'yyyy-MM-dd HH:mm:ss'); |
75 | }, | 76 | }, |
76 | }, | 77 | }, |
77 | ]; | 78 | ]; |
1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | +import { format } from '../util'; | ||
4 | 5 | ||
5 | //格式化资源类型和操作类型 | 6 | //格式化资源类型和操作类型 |
6 | let formatText; | 7 | let formatText; |
@@ -72,7 +73,7 @@ export const columns: BasicColumn[] = [ | @@ -72,7 +73,7 @@ export const columns: BasicColumn[] = [ | ||
72 | dataIndex: 'createdTime', | 73 | dataIndex: 'createdTime', |
73 | width: 180, | 74 | width: 180, |
74 | format: (_, record) => { | 75 | format: (_, record) => { |
75 | - return moment(record.createdTime).format('YYYY-MM-DD HH:MM:ss'); | 76 | + return format(record.createdTime, 'yyyy-MM-dd HH:mm:ss'); |
76 | }, | 77 | }, |
77 | }, | 78 | }, |
78 | ]; | 79 | ]; |
1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | +import { format } from '../util'; | ||
4 | 5 | ||
5 | // 表格数据 | 6 | // 表格数据 |
6 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
@@ -40,7 +41,7 @@ export const columns: BasicColumn[] = [ | @@ -40,7 +41,7 @@ export const columns: BasicColumn[] = [ | ||
40 | dataIndex: 'createdTime', | 41 | dataIndex: 'createdTime', |
41 | width: 180, | 42 | width: 180, |
42 | format: (_, record) => { | 43 | format: (_, record) => { |
43 | - return moment(record.createdTime).format('YYYY-MM-DD HH:MM:ss'); | 44 | + return format(record.createdTime, 'yyyy-MM-dd HH:mm:ss'); |
44 | }, | 45 | }, |
45 | }, | 46 | }, |
46 | ]; | 47 | ]; |
src/views/system/log/util.ts
0 → 100644
1 | +/** | ||
2 | + * 毫秒时间戳格式化时间 | ||
3 | + */ | ||
4 | +export function format(time, format) { | ||
5 | + const t = new Date(time); | ||
6 | + const tf = function (i) { | ||
7 | + return (i < 10 ? '0' : '') + i; | ||
8 | + }; | ||
9 | + return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) { | ||
10 | + switch (a) { | ||
11 | + case 'yyyy': | ||
12 | + return tf(t.getFullYear()); | ||
13 | + break; | ||
14 | + case 'MM': | ||
15 | + return tf(t.getMonth() + 1); | ||
16 | + break; | ||
17 | + case 'mm': | ||
18 | + return tf(t.getMinutes()); | ||
19 | + break; | ||
20 | + case 'dd': | ||
21 | + return tf(t.getDate()); | ||
22 | + break; | ||
23 | + case 'HH': | ||
24 | + return tf(t.getHours()); | ||
25 | + break; | ||
26 | + case 'ss': | ||
27 | + return tf(t.getSeconds()); | ||
28 | + break; | ||
29 | + } | ||
30 | + }); | ||
31 | +} |
@@ -67,9 +67,9 @@ | @@ -67,9 +67,9 @@ | ||
67 | 67 | ||
68 | //提交按钮 | 68 | //提交按钮 |
69 | async function handleSubmit() { | 69 | async function handleSubmit() { |
70 | + setDrawerProps({ confirmLoading: true }); | ||
70 | try { | 71 | try { |
71 | const values = await validate(); | 72 | const values = await validate(); |
72 | - setDrawerProps({ confirmLoading: true }); | ||
73 | if (isUpdate.value) { | 73 | if (isUpdate.value) { |
74 | Reflect.set(values, 'id', organizationId); | 74 | Reflect.set(values, 'id', organizationId); |
75 | } | 75 | } |
@@ -82,7 +82,9 @@ | @@ -82,7 +82,9 @@ | ||
82 | emit('success'); | 82 | emit('success'); |
83 | } catch { | 83 | } catch { |
84 | } finally { | 84 | } finally { |
85 | - setDrawerProps({ confirmLoading: false }); | 85 | + setTimeout(() => { |
86 | + setDrawerProps({ confirmLoading: false }); | ||
87 | + }, 300); | ||
86 | } | 88 | } |
87 | } | 89 | } |
88 | 90 |
@@ -79,6 +79,8 @@ | @@ -79,6 +79,8 @@ | ||
79 | const originMenus = ref(); | 79 | const originMenus = ref(); |
80 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 80 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
81 | allCheckedKeys.value = []; | 81 | allCheckedKeys.value = []; |
82 | + originMenus.value = []; | ||
83 | + allCheckedKeys.value.length = 0; | ||
82 | resetFields(); | 84 | resetFields(); |
83 | roleId.value = ''; | 85 | roleId.value = ''; |
84 | // 在打开弹窗时清除所有选择的菜单 | 86 | // 在打开弹窗时清除所有选择的菜单 |
@@ -90,6 +92,11 @@ | @@ -90,6 +92,11 @@ | ||
90 | const menuListModel = await getMenuList(); | 92 | const menuListModel = await getMenuList(); |
91 | processChildren(menuListModel); | 93 | processChildren(menuListModel); |
92 | treeData.value = menuListModel; | 94 | treeData.value = menuListModel; |
95 | + //修复角色菜单新增-全部展开问题-只展开第一级即可 | ||
96 | + nextTick(() => { | ||
97 | + const getAllIds = lookForAllId(treeData.value, []); | ||
98 | + treeExpandData.value = getAllIds; | ||
99 | + }); | ||
93 | } | 100 | } |
94 | // 更新 | 101 | // 更新 |
95 | if (unref(isUpdate)) { | 102 | if (unref(isUpdate)) { |
@@ -130,10 +137,10 @@ | @@ -130,10 +137,10 @@ | ||
130 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); | 137 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
131 | 138 | ||
132 | async function handleSubmit() { | 139 | async function handleSubmit() { |
140 | + setDrawerProps({ confirmLoading: true }); | ||
133 | const { createMessage } = useMessage(); | 141 | const { createMessage } = useMessage(); |
134 | try { | 142 | try { |
135 | const values = await validate(); | 143 | const values = await validate(); |
136 | - setDrawerProps({ confirmLoading: true }); | ||
137 | const req = { | 144 | const req = { |
138 | id: roleId.value, | 145 | id: roleId.value, |
139 | name: values.name, | 146 | name: values.name, |
@@ -141,7 +148,6 @@ | @@ -141,7 +148,6 @@ | ||
141 | status: values.status, | 148 | status: values.status, |
142 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, | 149 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, |
143 | }; | 150 | }; |
144 | - if (allCheckedKeys.value.length == 0) return createMessage.error('请勾选权限菜单'); | ||
145 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); | 151 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); |
146 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 152 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
147 | closeDrawer(); | 153 | closeDrawer(); |
@@ -149,7 +155,9 @@ | @@ -149,7 +155,9 @@ | ||
149 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | 155 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); |
150 | }); | 156 | }); |
151 | } finally { | 157 | } finally { |
152 | - setDrawerProps({ confirmLoading: false }); | 158 | + setTimeout(() => { |
159 | + setDrawerProps({ confirmLoading: false }); | ||
160 | + }, 300); | ||
153 | } | 161 | } |
154 | } | 162 | } |
155 | // Tree check事件 | 163 | // Tree check事件 |
@@ -90,8 +90,8 @@ | @@ -90,8 +90,8 @@ | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | async function handleSubmit() { | 92 | async function handleSubmit() { |
93 | + setDrawerProps({ confirmLoading: true }); | ||
93 | try { | 94 | try { |
94 | - setDrawerProps({ confirmLoading: true }); | ||
95 | if (!unref(isUpdate)) { | 95 | if (!unref(isUpdate)) { |
96 | getAllFieldsFunc(); | 96 | getAllFieldsFunc(); |
97 | await saveTenantProfileApi(postAllData); | 97 | await saveTenantProfileApi(postAllData); |
@@ -108,7 +108,9 @@ | @@ -108,7 +108,9 @@ | ||
108 | } | 108 | } |
109 | } catch (e) { | 109 | } catch (e) { |
110 | } finally { | 110 | } finally { |
111 | - setDrawerProps({ confirmLoading: false }); | 111 | + setTimeout(() => { |
112 | + setDrawerProps({ confirmLoading: false }); | ||
113 | + }, 300); | ||
112 | } | 114 | } |
113 | } | 115 | } |
114 | return { | 116 | return { |
@@ -143,6 +143,7 @@ | @@ -143,6 +143,7 @@ | ||
143 | const getTitle = computed(() => (!unref(isUpdate) ? '新增租户管理员' : '编辑租户管理员')); | 143 | const getTitle = computed(() => (!unref(isUpdate) ? '新增租户管理员' : '编辑租户管理员')); |
144 | 144 | ||
145 | async function handleSubmit() { | 145 | async function handleSubmit() { |
146 | + setDrawerProps({ confirmLoading: true }); | ||
146 | try { | 147 | try { |
147 | const values = await validate(); | 148 | const values = await validate(); |
148 | const requestParams = { | 149 | const requestParams = { |
@@ -158,13 +159,14 @@ | @@ -158,13 +159,14 @@ | ||
158 | : null, | 159 | : null, |
159 | tenantId: tenantId.value, | 160 | tenantId: tenantId.value, |
160 | }; | 161 | }; |
161 | - setDrawerProps({ confirmLoading: true }); | ||
162 | saveTenantAdmin(requestParams as any as UserDTO).then(() => { | 162 | saveTenantAdmin(requestParams as any as UserDTO).then(() => { |
163 | closeDrawer(); //关闭侧框 | 163 | closeDrawer(); //关闭侧框 |
164 | emit('success'); | 164 | emit('success'); |
165 | }); | 165 | }); |
166 | } finally { | 166 | } finally { |
167 | - setDrawerProps({ confirmLoading: false }); | 167 | + setTimeout(() => { |
168 | + setDrawerProps({ confirmLoading: false }); | ||
169 | + }, 300); | ||
168 | } | 170 | } |
169 | } | 171 | } |
170 | 172 |
@@ -19,7 +19,8 @@ | @@ -19,7 +19,8 @@ | ||
19 | > | 19 | > |
20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> | 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
21 | <div v-else> | 21 | <div v-else> |
22 | - <plus-outlined /> | 22 | + <loading-outlined v-if="loading"></loading-outlined> |
23 | + <plus-outlined v-else /> | ||
23 | <div class="ant-upload-text">上传</div> | 24 | <div class="ant-upload-text">上传</div> |
24 | </div> | 25 | </div> |
25 | </Upload> | 26 | </Upload> |
@@ -31,7 +32,7 @@ | @@ -31,7 +32,7 @@ | ||
31 | import { defineComponent, ref, computed, unref } from 'vue'; | 32 | import { defineComponent, ref, computed, unref } from 'vue'; |
32 | import { BasicForm, useForm } from '/@/components/Form/index'; | 33 | import { BasicForm, useForm } from '/@/components/Form/index'; |
33 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 34 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
34 | - import { PlusOutlined } from '@ant-design/icons-vue'; | 35 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; |
35 | import { message, Upload } from 'ant-design-vue'; | 36 | import { message, Upload } from 'ant-design-vue'; |
36 | 37 | ||
37 | import { useI18n } from '/@/hooks/web/useI18n'; | 38 | import { useI18n } from '/@/hooks/web/useI18n'; |
@@ -47,19 +48,25 @@ | @@ -47,19 +48,25 @@ | ||
47 | BasicForm, | 48 | BasicForm, |
48 | Upload, | 49 | Upload, |
49 | PlusOutlined, | 50 | PlusOutlined, |
51 | + LoadingOutlined, | ||
50 | }, | 52 | }, |
51 | emits: ['success', 'register'], | 53 | emits: ['success', 'register'], |
52 | setup(_, { emit }) { | 54 | setup(_, { emit }) { |
55 | + const loading = ref(false); | ||
56 | + | ||
53 | const isUpdate = ref(true); | 57 | const isUpdate = ref(true); |
54 | const tenantLogo = ref(''); | 58 | const tenantLogo = ref(''); |
55 | 59 | ||
56 | async function customUpload({ file }) { | 60 | async function customUpload({ file }) { |
57 | if (beforeUpload(file)) { | 61 | if (beforeUpload(file)) { |
62 | + loading.value = true; | ||
63 | + | ||
58 | const formData = new FormData(); | 64 | const formData = new FormData(); |
59 | formData.append('file', file); | 65 | formData.append('file', file); |
60 | const response = await upload(formData); | 66 | const response = await upload(formData); |
61 | if (response.fileStaticUri) { | 67 | if (response.fileStaticUri) { |
62 | tenantLogo.value = response.fileStaticUri; | 68 | tenantLogo.value = response.fileStaticUri; |
69 | + loading.value = false; | ||
63 | } | 70 | } |
64 | } | 71 | } |
65 | } | 72 | } |
@@ -113,9 +120,9 @@ | @@ -113,9 +120,9 @@ | ||
113 | 120 | ||
114 | //提交按钮 | 121 | //提交按钮 |
115 | async function handleSubmit() { | 122 | async function handleSubmit() { |
123 | + setDrawerProps({ confirmLoading: true }); | ||
116 | try { | 124 | try { |
117 | const values = await validate(); | 125 | const values = await validate(); |
118 | - setDrawerProps({ confirmLoading: true }); | ||
119 | const req = { | 126 | const req = { |
120 | id: values.id, | 127 | id: values.id, |
121 | icon: tenantLogo.value, | 128 | icon: tenantLogo.value, |
@@ -133,16 +140,20 @@ | @@ -133,16 +140,20 @@ | ||
133 | entityType: 'TENANT_PROFILE', | 140 | entityType: 'TENANT_PROFILE', |
134 | }, | 141 | }, |
135 | }; | 142 | }; |
136 | - await updateOrCreateTenant(req); | ||
137 | - closeDrawer(); //关闭侧框 | ||
138 | - emit('success'); | 143 | + updateOrCreateTenant(req) |
144 | + .then((res) => { | ||
145 | + closeDrawer(); //关闭侧框 | ||
146 | + emit('success'); | ||
147 | + }) | ||
148 | + .catch((e) => { | ||
149 | + const { createMessage } = useMessage(); | ||
150 | + createMessage.error(`${e.message}`); | ||
151 | + }); | ||
139 | } catch (e) { | 152 | } catch (e) { |
140 | - const { createMessage } = useMessage(); | ||
141 | - createMessage.error("Can't use isolated tenant profiles in monolith setup!"); | ||
142 | } finally { | 153 | } finally { |
143 | - setDrawerProps({ | ||
144 | - confirmLoading: false, | ||
145 | - }); | 154 | + setTimeout(() => { |
155 | + setDrawerProps({ confirmLoading: false }); | ||
156 | + }, 300); | ||
146 | } | 157 | } |
147 | } | 158 | } |
148 | 159 | ||
@@ -154,6 +165,7 @@ | @@ -154,6 +165,7 @@ | ||
154 | tenantLogo, | 165 | tenantLogo, |
155 | beforeUpload, | 166 | beforeUpload, |
156 | customUpload, | 167 | customUpload, |
168 | + loading, | ||
157 | }; | 169 | }; |
158 | }, | 170 | }, |
159 | }); | 171 | }); |
@@ -13,7 +13,6 @@ | @@ -13,7 +13,6 @@ | ||
13 | v-if="treeData.length > 0" | 13 | v-if="treeData.length > 0" |
14 | :treeData="treeData" | 14 | :treeData="treeData" |
15 | :expandedKeys="treeExpandData" | 15 | :expandedKeys="treeExpandData" |
16 | - autoExpandParent | ||
17 | :replaceFields="{ title: 'menuName' }" | 16 | :replaceFields="{ title: 'menuName' }" |
18 | :checkedKeys="roleMenus" | 17 | :checkedKeys="roleMenus" |
19 | @check="handleCheckClick" | 18 | @check="handleCheckClick" |
@@ -85,6 +84,9 @@ | @@ -85,6 +84,9 @@ | ||
85 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 84 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
86 | setDrawerProps({ confirmLoading: false }); | 85 | setDrawerProps({ confirmLoading: false }); |
87 | allCheckedKeys.value = []; | 86 | allCheckedKeys.value = []; |
87 | + originMenus.value = []; | ||
88 | + treeExpandData.value; | ||
89 | + allCheckedKeys.value.length = 0; | ||
88 | resetFields(); | 90 | resetFields(); |
89 | roleId.value = ''; | 91 | roleId.value = ''; |
90 | // 在打开弹窗时清除所有选择的菜单 | 92 | // 在打开弹窗时清除所有选择的菜单 |
@@ -96,6 +98,11 @@ | @@ -96,6 +98,11 @@ | ||
96 | const menuListModel = await getMenuList(); | 98 | const menuListModel = await getMenuList(); |
97 | processChildren(menuListModel); | 99 | processChildren(menuListModel); |
98 | treeData.value = menuListModel; | 100 | treeData.value = menuListModel; |
101 | + //修复角色菜单新增-全部展开问题-只展开第一级即可 | ||
102 | + nextTick(() => { | ||
103 | + const getAllIds = lookForAllId(treeData.value, []); | ||
104 | + treeExpandData.value = getAllIds; | ||
105 | + }); | ||
99 | } | 106 | } |
100 | // 更新 | 107 | // 更新 |
101 | if (unref(isUpdate)) { | 108 | if (unref(isUpdate)) { |
@@ -132,11 +139,10 @@ | @@ -132,11 +139,10 @@ | ||
132 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); | 139 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
133 | 140 | ||
134 | async function handleSubmit() { | 141 | async function handleSubmit() { |
142 | + setDrawerProps({ confirmLoading: true }); | ||
135 | const { createMessage } = useMessage(); | 143 | const { createMessage } = useMessage(); |
136 | - | ||
137 | try { | 144 | try { |
138 | const values = await validate(); | 145 | const values = await validate(); |
139 | - setDrawerProps({ confirmLoading: true }); | ||
140 | const req = { | 146 | const req = { |
141 | id: roleId.value, | 147 | id: roleId.value, |
142 | name: values.name, | 148 | name: values.name, |
@@ -145,7 +151,6 @@ | @@ -145,7 +151,6 @@ | ||
145 | roleType: RoleEnum.TENANT_ADMIN, | 151 | roleType: RoleEnum.TENANT_ADMIN, |
146 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, | 152 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, |
147 | }; | 153 | }; |
148 | - if (allCheckedKeys.value.length == 0) return createMessage.error('请勾选权限菜单'); | ||
149 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); | 154 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); |
150 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 155 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
151 | closeDrawer(); | 156 | closeDrawer(); |
@@ -154,7 +159,9 @@ | @@ -154,7 +159,9 @@ | ||
154 | }); | 159 | }); |
155 | } catch { | 160 | } catch { |
156 | } finally { | 161 | } finally { |
157 | - setDrawerProps({ confirmLoading: false }); | 162 | + setTimeout(() => { |
163 | + setDrawerProps({ confirmLoading: false }); | ||
164 | + }, 300); | ||
158 | } | 165 | } |
159 | } | 166 | } |
160 | // Tree check事件 | 167 | // Tree check事件 |