Commit cda77963a7c40093ad2b191232c137f1d802c8c2
1 parent
5e5c176e
fix:修复设备配置点击默认新增返回400问题,fix:修改通知管理status为0,1,和添加按钮权限
Showing
11 changed files
with
186 additions
and
29 deletions
@@ -53,9 +53,9 @@ export const columns: BasicColumn[] = [ | @@ -53,9 +53,9 @@ export const columns: BasicColumn[] = [ | ||
53 | .then(() => { | 53 | .then(() => { |
54 | record.status = newStatus; | 54 | record.status = newStatus; |
55 | if (record.status == 1) { | 55 | if (record.status == 1) { |
56 | - createMessage.success(`配置成功`); | 56 | + createMessage.success(`已配置`); |
57 | } else { | 57 | } else { |
58 | - createMessage.error('未配置成功'); | 58 | + createMessage.error('未配置'); |
59 | } | 59 | } |
60 | }) | 60 | }) |
61 | .finally(() => { | 61 | .finally(() => { |
@@ -131,7 +131,7 @@ export const formSchema: FormSchema[] = [ | @@ -131,7 +131,7 @@ export const formSchema: FormSchema[] = [ | ||
131 | field: 'organizationId', | 131 | field: 'organizationId', |
132 | label: '所属组织', | 132 | label: '所属组织', |
133 | component: 'ApiTreeSelect', | 133 | component: 'ApiTreeSelect', |
134 | - // required: true, | 134 | + required: true, |
135 | componentProps: { | 135 | componentProps: { |
136 | api: async () => { | 136 | api: async () => { |
137 | const data = await getOrganizationList(); | 137 | const data = await getOrganizationList(); |
@@ -77,7 +77,7 @@ | @@ -77,7 +77,7 @@ | ||
77 | let transportTypeObj = reactive({ | 77 | let transportTypeObj = reactive({ |
78 | transportType: '', | 78 | transportType: '', |
79 | }); | 79 | }); |
80 | - const profileDataObj = reactive({ | 80 | + let profileDataObj = reactive({ |
81 | profileData: null, | 81 | profileData: null, |
82 | }); | 82 | }); |
83 | 83 | ||
@@ -142,7 +142,8 @@ | @@ -142,7 +142,8 @@ | ||
142 | let getPic = null; | 142 | let getPic = null; |
143 | getStepTwoData = await proxy.$refs.DeviceProfileStep2Ref?.getStep2DataFunc(); | 143 | getStepTwoData = await proxy.$refs.DeviceProfileStep2Ref?.getStep2DataFunc(); |
144 | profileDataObj.profileData = getStepTwoData; | 144 | profileDataObj.profileData = getStepTwoData; |
145 | - transportTypeObj.transportType = getStepTwoData.transportConfiguration.type; | 145 | + transportTypeObj.transportType = getStepTwoData?.transportConfiguration?.transportType; |
146 | + delete profileDataObj?.profileData?.transportConfiguration?.transportType; | ||
146 | //没有点击下一步 | 147 | //没有点击下一步 |
147 | if (!isNextStatus.value) { | 148 | if (!isNextStatus.value) { |
148 | const getStep1Obj = await proxy.$refs.DeviceProfileStep1Ref?.getStep1Func(); | 149 | const getStep1Obj = await proxy.$refs.DeviceProfileStep1Ref?.getStep1Func(); |
@@ -153,6 +154,10 @@ | @@ -153,6 +154,10 @@ | ||
153 | }; | 154 | }; |
154 | } | 155 | } |
155 | const id = isUpdate.value == 1 ? '' : postEditId.value; | 156 | const id = isUpdate.value == 1 ? '' : postEditId.value; |
157 | + | ||
158 | + if (Object.keys(getStepTwoData?.transportConfiguration).length == 0) { | ||
159 | + profileDataObj.profileData = null; | ||
160 | + } | ||
156 | postDeviceConfogData = { | 161 | postDeviceConfogData = { |
157 | ...getStepOneData, | 162 | ...getStepOneData, |
158 | ...profileDataObj, | 163 | ...profileDataObj, |
@@ -162,6 +167,7 @@ | @@ -162,6 +167,7 @@ | ||
162 | if (isUpdate.value == 1) { | 167 | if (isUpdate.value == 1) { |
163 | delete postDeviceConfogData.id; | 168 | delete postDeviceConfogData.id; |
164 | } | 169 | } |
170 | + | ||
165 | await deviceConfigAddOrEdit(postDeviceConfogData); | 171 | await deviceConfigAddOrEdit(postDeviceConfogData); |
166 | createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); | 172 | createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); |
167 | closeModal(); | 173 | closeModal(); |
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | async function customResetFunc() { | 81 | async function customResetFunc() { |
82 | emit('prev'); | 82 | emit('prev'); |
83 | } | 83 | } |
84 | - watch(isChangeType, async (v) => { | 84 | + watch(isChangeType, (v) => { |
85 | isMqttType.value = v; | 85 | isMqttType.value = v; |
86 | }); | 86 | }); |
87 | const getStep2DataFunc = async () => { | 87 | const getStep2DataFunc = async () => { |
@@ -92,6 +92,7 @@ | @@ -92,6 +92,7 @@ | ||
92 | step2Data.transportConfiguration = { | 92 | step2Data.transportConfiguration = { |
93 | ...getMqttVal, | 93 | ...getMqttVal, |
94 | ...getCoapVal, | 94 | ...getCoapVal, |
95 | + ...val, | ||
95 | }; | 96 | }; |
96 | return step2Data; | 97 | return step2Data; |
97 | }; | 98 | }; |
@@ -254,3 +254,51 @@ export const CoapSchemas: FormSchema[] = [ | @@ -254,3 +254,51 @@ export const CoapSchemas: FormSchema[] = [ | ||
254 | isProtobuf(values.transportPayloadType) && !isEfentoNb(values.coapDeviceType), | 254 | isProtobuf(values.transportPayloadType) && !isEfentoNb(values.coapDeviceType), |
255 | }, | 255 | }, |
256 | ]; | 256 | ]; |
257 | + | ||
258 | +export const deviceTelemetryProtoSchemaData = ` | ||
259 | +syntax ="proto3"; | ||
260 | +package telemetry; | ||
261 | + | ||
262 | +message SensorDataReading { | ||
263 | + optional double temperature = 1; | ||
264 | + optional double humidity = 2; | ||
265 | + InnerObject innerObject = 3; | ||
266 | + message InnerObject { | ||
267 | + optional string key1 = 1; | ||
268 | + optional bool key2 = 2; | ||
269 | + optional double key3 = 3; | ||
270 | + optional int32 key4 = 4; | ||
271 | + optional string key5 = 5; | ||
272 | + } | ||
273 | +} | ||
274 | +`; | ||
275 | + | ||
276 | +export const deviceAttributesProtoSchemaData = ` | ||
277 | +syntax ="proto3"; | ||
278 | +package attributes; | ||
279 | + | ||
280 | +message SensorConfiguration { | ||
281 | + optional string firmwareVersion = 1; | ||
282 | + optional string serialNumber = 2; | ||
283 | +} | ||
284 | +`; | ||
285 | + | ||
286 | +export const deviceRpcRequestProtoSchemaData = ` | ||
287 | +syntax ="proto3"; | ||
288 | +package rpc; | ||
289 | + | ||
290 | +message RpcRequestMsg { | ||
291 | + optional string method = 1; | ||
292 | + optional int32 requestId = 2; | ||
293 | + optional string params = 3; | ||
294 | +} | ||
295 | +`; | ||
296 | + | ||
297 | +export const deviceRpcResponseProtoSchemaData = ` | ||
298 | +syntax ="proto3"; | ||
299 | +package rpc; | ||
300 | + | ||
301 | +message RpcResponseMsg { | ||
302 | + optional string payload = 1; | ||
303 | +} | ||
304 | +`; |
@@ -16,7 +16,13 @@ | @@ -16,7 +16,13 @@ | ||
16 | <script lang="ts"> | 16 | <script lang="ts"> |
17 | import { defineComponent, reactive } from 'vue'; | 17 | import { defineComponent, reactive } from 'vue'; |
18 | import { BasicForm, useForm } from '/@/components/Form'; | 18 | import { BasicForm, useForm } from '/@/components/Form'; |
19 | - import { CoapSchemas } from './Coap'; | 19 | + import { |
20 | + CoapSchemas, | ||
21 | + deviceTelemetryProtoSchemaData, | ||
22 | + deviceAttributesProtoSchemaData, | ||
23 | + deviceRpcRequestProtoSchemaData, | ||
24 | + deviceRpcResponseProtoSchemaData, | ||
25 | + } from './Coap'; | ||
20 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; | 26 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
21 | 27 | ||
22 | export default defineComponent({ | 28 | export default defineComponent({ |
@@ -69,16 +75,28 @@ | @@ -69,16 +75,28 @@ | ||
69 | pagingTransmissionWindow: v.clientSettings?.pagingTransmissionWindow, | 75 | pagingTransmissionWindow: v.clientSettings?.pagingTransmissionWindow, |
70 | deviceTelemetryProtoSchema: | 76 | deviceTelemetryProtoSchema: |
71 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | 77 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration |
72 | - ?.deviceTelemetryProtoSchema, | 78 | + ?.deviceTelemetryProtoSchema == null |
79 | + ? deviceTelemetryProtoSchemaData | ||
80 | + : v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | ||
81 | + ?.deviceTelemetryProtoSchema, | ||
73 | deviceAttributesProtoSchema: | 82 | deviceAttributesProtoSchema: |
74 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | 83 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration |
75 | - ?.deviceAttributesProtoSchema, | 84 | + ?.deviceAttributesProtoSchema == null |
85 | + ? deviceAttributesProtoSchemaData | ||
86 | + : v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | ||
87 | + ?.deviceAttributesProtoSchema, | ||
76 | deviceRpcRequestProtoSchema: | 88 | deviceRpcRequestProtoSchema: |
77 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | 89 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration |
78 | - ?.deviceRpcRequestProtoSchema, | 90 | + ?.deviceRpcRequestProtoSchema == null |
91 | + ? deviceRpcRequestProtoSchemaData | ||
92 | + : v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | ||
93 | + ?.deviceRpcRequestProtoSchema, | ||
79 | deviceRpcResponseProtoSchema: | 94 | deviceRpcResponseProtoSchema: |
80 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | 95 | v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration |
81 | - ?.deviceRpcResponseProtoSchema, | 96 | + ?.deviceRpcResponseProtoSchema == null |
97 | + ? deviceRpcResponseProtoSchemaData | ||
98 | + : v?.coapDeviceTypeConfiguration?.transportPayloadTypeConfiguration | ||
99 | + ?.deviceRpcResponseProtoSchema, | ||
82 | }); | 100 | }); |
83 | }; | 101 | }; |
84 | const customClearStepTwoValueFunc = () => { | 102 | const customClearStepTwoValueFunc = () => { |
@@ -57,7 +57,7 @@ export const MqttSchemas: FormSchema[] = [ | @@ -57,7 +57,7 @@ export const MqttSchemas: FormSchema[] = [ | ||
57 | { | 57 | { |
58 | field: 'transportPayloadType', | 58 | field: 'transportPayloadType', |
59 | component: 'Select', | 59 | component: 'Select', |
60 | - label: '设备Payload', | 60 | + label: '设备信息', |
61 | defaultValue: 'JSON', | 61 | defaultValue: 'JSON', |
62 | componentProps: { | 62 | componentProps: { |
63 | options: [ | 63 | options: [ |
@@ -180,3 +180,51 @@ export const MqttSchemas: FormSchema[] = [ | @@ -180,3 +180,51 @@ export const MqttSchemas: FormSchema[] = [ | ||
180 | ifShow: ({ values }) => isProtobuf(values.transportPayloadType), | 180 | ifShow: ({ values }) => isProtobuf(values.transportPayloadType), |
181 | }, | 181 | }, |
182 | ]; | 182 | ]; |
183 | + | ||
184 | +export const deviceTelemetryProtoSchemaData = ` | ||
185 | +syntax ="proto3"; | ||
186 | +package telemetry; | ||
187 | + | ||
188 | +message SensorDataReading { | ||
189 | + optional double temperature = 1; | ||
190 | + optional double humidity = 2; | ||
191 | + InnerObject innerObject = 3; | ||
192 | + message InnerObject { | ||
193 | + optional string key1 = 1; | ||
194 | + optional bool key2 = 2; | ||
195 | + optional double key3 = 3; | ||
196 | + optional int32 key4 = 4; | ||
197 | + optional string key5 = 5; | ||
198 | + } | ||
199 | +} | ||
200 | +`; | ||
201 | + | ||
202 | +export const deviceAttributesProtoSchemaData = ` | ||
203 | +syntax ="proto3"; | ||
204 | +package attributes; | ||
205 | + | ||
206 | +message SensorConfiguration { | ||
207 | + optional string firmwareVersion = 1; | ||
208 | + optional string serialNumber = 2; | ||
209 | +} | ||
210 | +`; | ||
211 | + | ||
212 | +export const deviceRpcRequestProtoSchemaData = ` | ||
213 | +syntax ="proto3"; | ||
214 | +package rpc; | ||
215 | + | ||
216 | +message RpcRequestMsg { | ||
217 | + optional string method = 1; | ||
218 | + optional int32 requestId = 2; | ||
219 | + optional string params = 3; | ||
220 | +} | ||
221 | +`; | ||
222 | + | ||
223 | +export const deviceRpcResponseProtoSchemaData = ` | ||
224 | +syntax ="proto3"; | ||
225 | +package rpc; | ||
226 | + | ||
227 | +message RpcResponseMsg { | ||
228 | + optional string payload = 1; | ||
229 | +} | ||
230 | +`; |
@@ -16,7 +16,13 @@ | @@ -16,7 +16,13 @@ | ||
16 | <script lang="ts"> | 16 | <script lang="ts"> |
17 | import { defineComponent, reactive } from 'vue'; | 17 | import { defineComponent, reactive } from 'vue'; |
18 | import { BasicForm, useForm } from '/@/components/Form'; | 18 | import { BasicForm, useForm } from '/@/components/Form'; |
19 | - import { MqttSchemas } from './Mqtt'; | 19 | + import { |
20 | + MqttSchemas, | ||
21 | + deviceTelemetryProtoSchemaData, | ||
22 | + deviceAttributesProtoSchemaData, | ||
23 | + deviceRpcRequestProtoSchemaData, | ||
24 | + deviceRpcResponseProtoSchemaData, | ||
25 | + } from './Mqtt'; | ||
20 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; | 26 | import { Alert, Divider, Descriptions } from 'ant-design-vue'; |
21 | 27 | ||
22 | export default defineComponent({ | 28 | export default defineComponent({ |
@@ -56,13 +62,21 @@ | @@ -56,13 +62,21 @@ | ||
56 | setFieldsValue({ | 62 | setFieldsValue({ |
57 | transportPayloadType: v?.transportPayloadTypeConfiguration?.transportPayloadType, | 63 | transportPayloadType: v?.transportPayloadTypeConfiguration?.transportPayloadType, |
58 | deviceTelemetryProtoSchema: | 64 | deviceTelemetryProtoSchema: |
59 | - v?.transportPayloadTypeConfiguration?.deviceTelemetryProtoSchema, | 65 | + v?.transportPayloadTypeConfiguration?.deviceTelemetryProtoSchema == null |
66 | + ? deviceTelemetryProtoSchemaData | ||
67 | + : v?.transportPayloadTypeConfiguration?.deviceTelemetryProtoSchema, | ||
60 | deviceAttributesProtoSchema: | 68 | deviceAttributesProtoSchema: |
61 | - v?.transportPayloadTypeConfiguration?.deviceAttributesProtoSchema, | 69 | + v?.transportPayloadTypeConfiguration?.deviceAttributesProtoSchema == null |
70 | + ? deviceAttributesProtoSchemaData | ||
71 | + : v?.transportPayloadTypeConfiguration?.deviceAttributesProtoSchema, | ||
62 | deviceRpcRequestProtoSchema: | 72 | deviceRpcRequestProtoSchema: |
63 | - v?.transportPayloadTypeConfiguration?.deviceRpcRequestProtoSchema, | 73 | + v?.transportPayloadTypeConfiguration?.deviceRpcRequestProtoSchema == null |
74 | + ? deviceRpcRequestProtoSchemaData | ||
75 | + : v?.transportPayloadTypeConfiguration?.deviceRpcRequestProtoSchema, | ||
64 | deviceRpcResponseProtoSchema: | 76 | deviceRpcResponseProtoSchema: |
65 | - v?.transportPayloadTypeConfiguration?.deviceRpcResponseProtoSchema, | 77 | + v?.transportPayloadTypeConfiguration?.deviceRpcResponseProtoSchema == null |
78 | + ? deviceRpcResponseProtoSchemaData | ||
79 | + : v?.transportPayloadTypeConfiguration?.deviceRpcResponseProtoSchema, | ||
66 | enableCompatibilityWithJsonPayloadFormat: | 80 | enableCompatibilityWithJsonPayloadFormat: |
67 | v?.transportPayloadTypeConfiguration?.enableCompatibilityWithJsonPayloadFormat, | 81 | v?.transportPayloadTypeConfiguration?.enableCompatibilityWithJsonPayloadFormat, |
68 | useJsonPayloadFormatForDefaultDownlinkTopics: | 82 | useJsonPayloadFormatForDefaultDownlinkTopics: |
@@ -6,7 +6,7 @@ import { copyTransFun } from '/@/utils/fnUtils'; | @@ -6,7 +6,7 @@ import { copyTransFun } from '/@/utils/fnUtils'; | ||
6 | import { Tag } from 'ant-design-vue'; | 6 | import { Tag } from 'ant-design-vue'; |
7 | 7 | ||
8 | export enum IsOrgEnum { | 8 | export enum IsOrgEnum { |
9 | - IS_ORG_ENUM = '1', | 9 | + IS_ORG_ENUM = 1, |
10 | } | 10 | } |
11 | export const isOrg = (type: string) => { | 11 | export const isOrg = (type: string) => { |
12 | return type === IsOrgEnum.IS_ORG_ENUM; | 12 | return type === IsOrgEnum.IS_ORG_ENUM; |
@@ -46,7 +46,7 @@ export const columns: BasicColumn[] = [ | @@ -46,7 +46,7 @@ export const columns: BasicColumn[] = [ | ||
46 | width: 200, | 46 | width: 200, |
47 | customRender: ({ record }) => { | 47 | customRender: ({ record }) => { |
48 | const status = record.status; | 48 | const status = record.status; |
49 | - const enable = status === '已发布' ? '已发布' : status === '草稿' ? '草稿' : '其他'; | 49 | + const enable = status === 0 ? '已发布' : status === 1 ? '草稿' : '其他'; |
50 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; | 50 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; |
51 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; | 51 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; |
52 | return h(Tag, { color }, () => text); | 52 | return h(Tag, { color }, () => text); |
@@ -113,8 +113,8 @@ export const formSchema: FormSchema[] = [ | @@ -113,8 +113,8 @@ export const formSchema: FormSchema[] = [ | ||
113 | componentProps: { | 113 | componentProps: { |
114 | placeholder: '接收者', | 114 | placeholder: '接收者', |
115 | options: [ | 115 | options: [ |
116 | - { label: '全部', value: '0' }, | ||
117 | - { label: '组织', value: '1' }, | 116 | + { label: '全部', value: 0 }, |
117 | + { label: '组织', value: 1 }, | ||
118 | ], | 118 | ], |
119 | }, | 119 | }, |
120 | }, | 120 | }, |
@@ -15,21 +15,23 @@ | @@ -15,21 +15,23 @@ | ||
15 | icon: 'ant-design:eye-outlined', | 15 | icon: 'ant-design:eye-outlined', |
16 | onClick: handleView.bind(null, record), | 16 | onClick: handleView.bind(null, record), |
17 | ifShow: (_action) => { | 17 | ifShow: (_action) => { |
18 | - return record.status === '已发布'; | 18 | + return record.status === 1 && rolePermission == 'CUSTOMER_USER'; |
19 | }, | 19 | }, |
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | label: '编辑', | 22 | label: '编辑', |
23 | icon: 'clarity:note-edit-line', | 23 | icon: 'clarity:note-edit-line', |
24 | onClick: handleEdit.bind(null, record), | 24 | onClick: handleEdit.bind(null, record), |
25 | + // auth: 'isTenant' || 'isCustomer', | ||
25 | ifShow: (_action) => { | 26 | ifShow: (_action) => { |
26 | - return record.status === '草稿'; | 27 | + return record.status === 0 && record.creator == userId; |
27 | }, | 28 | }, |
28 | }, | 29 | }, |
29 | { | 30 | { |
30 | label: '删除', | 31 | label: '删除', |
31 | icon: 'ant-design:delete-outlined', | 32 | icon: 'ant-design:delete-outlined', |
32 | color: 'error', | 33 | color: 'error', |
34 | + ifShow: record.creator == userId || record.tenantId == tenantId, | ||
33 | popConfirm: { | 35 | popConfirm: { |
34 | title: '是否确认删除', | 36 | title: '是否确认删除', |
35 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 37 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
@@ -48,7 +50,7 @@ | @@ -48,7 +50,7 @@ | ||
48 | </div> | 50 | </div> |
49 | </template> | 51 | </template> |
50 | <script lang="ts"> | 52 | <script lang="ts"> |
51 | - import { defineComponent, ref } from 'vue'; | 53 | + import { defineComponent, ref, computed } from 'vue'; |
52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 54 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
53 | import { useDrawer } from '/@/components/Drawer'; | 55 | import { useDrawer } from '/@/components/Drawer'; |
54 | import NotifyManagerDrawer from './useDrawer.vue'; | 56 | import NotifyManagerDrawer from './useDrawer.vue'; |
@@ -56,13 +58,26 @@ | @@ -56,13 +58,26 @@ | ||
56 | import { columns, searchFormSchema } from './config.d'; | 58 | import { columns, searchFormSchema } from './config.d'; |
57 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; | 59 | import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; |
58 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 60 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
61 | + import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | ||
62 | + import { getAuthCache } from '/@/utils/auth'; | ||
63 | + import { RoleEnum } from '/@/enums/roleEnum'; | ||
64 | + import { usePermission } from '/@/hooks/web/usePermission'; | ||
65 | + import { useUserStore } from '/@/store/modules/user'; | ||
66 | + | ||
59 | export default defineComponent({ | 67 | export default defineComponent({ |
60 | name: 'Notificationmannager', | 68 | name: 'Notificationmannager', |
61 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, | 69 | components: { BasicTable, NotifyManagerDrawer, TableAction, tableViewChild }, |
62 | setup() { | 70 | setup() { |
71 | + const { hasPermission } = usePermission(); | ||
72 | + const userStore = useUserStore(); | ||
73 | + const isTenant = computed(() => userStore.getRoleList.includes(RoleEnum.TENANT_ADMIN)); | ||
74 | + const isCustomer = computed(() => userStore.getRoleList.includes(RoleEnum.CUSTOMER_USER)); | ||
75 | + const userInfo: any = getAuthCache(USER_INFO_KEY); | ||
76 | + const userId = userInfo.userId; | ||
77 | + const tenantId = userInfo.tenantId; | ||
78 | + const rolePermission: string = userInfo.roles[0]; | ||
63 | const [registerDrawer, { openDrawer }] = useDrawer(); | 79 | const [registerDrawer, { openDrawer }] = useDrawer(); |
64 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); | 80 | const [registerAdd, { openDrawer: openDrawerAdd }] = useDrawer(); |
65 | - | ||
66 | // 批量删除 | 81 | // 批量删除 |
67 | const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | 82 | const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
68 | notifyDeleteApi, | 83 | notifyDeleteApi, |
@@ -123,6 +138,12 @@ | @@ -123,6 +138,12 @@ | ||
123 | handleSuccess, | 138 | handleSuccess, |
124 | handleDeleteOrBatchDelete, | 139 | handleDeleteOrBatchDelete, |
125 | NotifyManagerDrawerRef, | 140 | NotifyManagerDrawerRef, |
141 | + rolePermission, | ||
142 | + userId, | ||
143 | + tenantId, | ||
144 | + hasPermission, | ||
145 | + isTenant, | ||
146 | + isCustomer, | ||
126 | }; | 147 | }; |
127 | }, | 148 | }, |
128 | }); | 149 | }); |
@@ -46,8 +46,8 @@ | @@ -46,8 +46,8 @@ | ||
46 | //编辑 | 46 | //编辑 |
47 | if (data.isUpdate) { | 47 | if (data.isUpdate) { |
48 | noticeId.value = data.record.id; | 48 | noticeId.value = data.record.id; |
49 | - Reflect.set(data.record, 'receiverType', data.record.receiverType === '全部' ? '0' : '1'); | ||
50 | - if (data.record.receiverType === '1') { | 49 | + Reflect.set(data.record, 'receiverType', data.record.receiverType === '全部' ? 0 : 1); |
50 | + if (data.record.receiverType === 1) { | ||
51 | if (!data.record.pointId.length) return; | 51 | if (!data.record.pointId.length) return; |
52 | const organizationId = data.record.pointId.split(','); | 52 | const organizationId = data.record.pointId.split(','); |
53 | Reflect.set(data.record, 'organizationId', organizationId); | 53 | Reflect.set(data.record, 'organizationId', organizationId); |
@@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
60 | const valid = await validate(); | 60 | const valid = await validate(); |
61 | if (!valid) return; | 61 | if (!valid) return; |
62 | const field = getFieldsValue(); | 62 | const field = getFieldsValue(); |
63 | - const pointId = field.receiverType === '1' ? field.organizationId + '' : null; | 63 | + const pointId = field.receiverType === 1 ? field.organizationId + '' : null; |
64 | // 新增情况 | 64 | // 新增情况 |
65 | try { | 65 | try { |
66 | const editNotice = { | 66 | const editNotice = { |
@@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
78 | const handleSaveDraft = async () => { | 78 | const handleSaveDraft = async () => { |
79 | await validate(); | 79 | await validate(); |
80 | const field = getFieldsValue(); | 80 | const field = getFieldsValue(); |
81 | - const pointId = field.receiverType === '1' ? field.organizationId + '' : null; | 81 | + const pointId = field.receiverType === 1 ? field.organizationId + '' : null; |
82 | if (!unref(isUpdate)) { | 82 | if (!unref(isUpdate)) { |
83 | const saveDraft = { | 83 | const saveDraft = { |
84 | ...field, | 84 | ...field, |