Commit 37f43cae3961224e5dc0b2556f597e04dbbb5bd1
1 parent
f0e317ed
wip:联调场景联动接口完成 feat:站内通知前端页面完成,接口调了4个
Showing
23 changed files
with
2216 additions
and
689 deletions
Too many changes to show.
To preserve performance only 23 of 24 files are displayed.
... | ... | @@ -38,6 +38,7 @@ module.exports = defineConfig({ |
38 | 38 | '@typescript-eslint/ban-types': 'off', |
39 | 39 | '@typescript-eslint/no-non-null-assertion': 'off', |
40 | 40 | '@typescript-eslint/explicit-module-boundary-types': 'off', |
41 | + ' @typescript-eslint/no-inferrable-types': 'off', | |
41 | 42 | '@typescript-eslint/no-unused-vars': [ |
42 | 43 | 'error', |
43 | 44 | { | ... | ... |
1 | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
2 | 2 | |
3 | -export type ScreenLinkPageTableQueryParam = BasicPageParams & ScreenParam; | |
3 | +export type ScreenLinkPageQueryParam = BasicPageParams & ScreenParams; | |
4 | 4 | |
5 | -export type ScreenParam = { | |
5 | +export type ScreenParams = { | |
6 | + organizationId?: string; | |
7 | + status?: string; | |
6 | 8 | name?: string; |
7 | - other?: string; | |
9 | + sceneLinkageId?: string; | |
8 | 10 | }; |
11 | + | |
12 | +export type ScreenByDeptIdParams = { | |
13 | + organizationId: string; | |
14 | + // organizationId: '2f5c8f2a-196c-4941-8771-290f9da76219'; | |
15 | +}; | |
16 | + | |
9 | 17 | export interface ScreenAddModel { |
10 | - createTime?: '2021-11-29T09:13:38.810Z'; | |
11 | - creator?: 'string'; | |
12 | - defaultConfig?: 'string'; | |
13 | - description?: 'string'; | |
18 | + createTime?: string; | |
19 | + creator?: string; | |
20 | + defaultConfig?: string; | |
21 | + description?: string; | |
14 | 22 | doAction?: [ |
15 | 23 | { |
16 | - command: 'string'; | |
17 | - createTime: '2021-11-29T09:13:38.810Z'; | |
18 | - creator: 'string'; | |
19 | - defaultConfig: 'string'; | |
20 | - description: 'string'; | |
21 | - deviceId: 'string'; | |
24 | + command: string; | |
25 | + createTime: string; | |
26 | + creator: string; | |
27 | + defaultConfig: string; | |
28 | + description: string; | |
29 | + deviceId: string; | |
22 | 30 | enabled: true; |
23 | - icon: 'string'; | |
24 | - id: 'string'; | |
25 | - name: 'string'; | |
26 | - outPut: 'string'; | |
27 | - outTarget: 'string'; | |
28 | - roleIds: ['string']; | |
29 | - tenantCode: 'string'; | |
30 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
31 | - tenantId: 'string'; | |
31 | + icon: string; | |
32 | + id: string; | |
33 | + name: string; | |
34 | + outPut: string; | |
35 | + outTarget: string; | |
36 | + roleIds: []; | |
37 | + tenantCode: string; | |
38 | + tenantExpireTime: string; | |
39 | + tenantId: string; | |
32 | 40 | tenantStatus: 'DISABLED'; |
33 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
34 | - updater: 'string'; | |
41 | + updateTime: string; | |
42 | + updater: string; | |
35 | 43 | } |
36 | 44 | ]; |
37 | 45 | doCondition?: [ |
38 | 46 | { |
39 | 47 | compare: 0; |
40 | - createTime: '2021-11-29T09:13:38.811Z'; | |
41 | - creator: 'string'; | |
42 | - defaultConfig: 'string'; | |
43 | - description: 'string'; | |
44 | - deviceId: 'string'; | |
48 | + createTime: string; | |
49 | + creator: string; | |
50 | + defaultConfig: string; | |
51 | + description: string; | |
52 | + deviceId: string; | |
45 | 53 | enabled: true; |
46 | - icon: 'string'; | |
47 | - id: 'string'; | |
48 | - name: 'string'; | |
49 | - property: 'string'; | |
50 | - roleIds: ['string']; | |
51 | - status: 'string'; | |
52 | - tenantCode: 'string'; | |
53 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
54 | - tenantId: 'string'; | |
54 | + icon: string; | |
55 | + id: string; | |
56 | + name: string; | |
57 | + property: string; | |
58 | + roleIds: []; | |
59 | + status: string; | |
60 | + tenantCode: string; | |
61 | + tenantExpireTime: string; | |
62 | + tenantId: string; | |
55 | 63 | tenantStatus: 'DISABLED'; |
56 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
57 | - updater: 'string'; | |
58 | - value: 'string'; | |
64 | + updateTime: string; | |
65 | + updater: string; | |
66 | + value: string; | |
59 | 67 | } |
60 | 68 | ]; |
61 | 69 | enabled?: true; |
62 | - icon?: 'string'; | |
63 | - id?: 'string'; | |
64 | - name?: 'string'; | |
65 | - organizationId?: 'string'; | |
66 | - roleIds?: ['string']; | |
67 | - status?: 'string'; | |
68 | - tenantCode?: 'string'; | |
69 | - tenantExpireTime?: '2021-11-29T09:13:38.811Z'; | |
70 | - tenantId?: 'string'; | |
70 | + icon?: string; | |
71 | + id?: string; | |
72 | + name?: string; | |
73 | + organizationId?: string; | |
74 | + roleIds?: [string]; | |
75 | + status?: string; | |
76 | + tenantCode?: string; | |
77 | + tenantExpireTime?: string; | |
78 | + tenantId?: string; | |
71 | 79 | tenantStatus?: 'DISABLED'; |
72 | 80 | triggers?: [ |
73 | 81 | { |
74 | - attributeChoose: 'string'; | |
75 | - compare: 0; | |
76 | - createTime: '2021-11-29T09:13:38.811Z'; | |
77 | - creator: 'string'; | |
78 | - defaultConfig: 'string'; | |
79 | - description: 'string'; | |
80 | - deviceId: 'string'; | |
81 | - enabled: true; | |
82 | - icon: 'string'; | |
83 | - id: 'string'; | |
84 | - name: 'string'; | |
85 | - roleIds: ['string']; | |
86 | - tenantCode: 'string'; | |
87 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
88 | - tenantId: 'string'; | |
89 | - tenantStatus: 'DISABLED'; | |
90 | - tiggerEvent: 'string'; | |
91 | - touchWay: 'string'; | |
92 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
93 | - updater: 'string'; | |
94 | - value: 'string'; | |
82 | + attributeChoose?: string; | |
83 | + compare?: 0; | |
84 | + createTime?: string; | |
85 | + creator?: string; | |
86 | + defaultConfig?: string; | |
87 | + description?: string; | |
88 | + deviceId?: string; | |
89 | + enabled?: true; | |
90 | + icon?: string; | |
91 | + id?: string; | |
92 | + name?: string; | |
93 | + roleIds?: []; | |
94 | + tenantCode?: string; | |
95 | + tenantExpireTime?: string; | |
96 | + tenantId?: string; | |
97 | + tenantStatus?: 'DISABLED'; | |
98 | + tiggerEvent?: string; | |
99 | + touchWay?: string; | |
100 | + updateTime?: string; | |
101 | + updater?: string; | |
102 | + value?: string; | |
95 | 103 | } |
96 | 104 | ]; |
97 | - updateTime?: '2021-11-29T09:13:38.811Z'; | |
98 | - updater?: 'string'; | |
105 | + updateTime?: string; | |
106 | + updater?: string; | |
99 | 107 | } |
100 | - | |
101 | 108 | export interface ScreenUpdateModel { |
102 | - createTime?: '2021-11-29T09:13:38.810Z'; | |
103 | - creator?: 'string'; | |
104 | - defaultConfig?: 'string'; | |
105 | - description?: 'string'; | |
109 | + createTime?: string; | |
110 | + creator?: string; | |
111 | + defaultConfig?: string; | |
112 | + description?: string; | |
106 | 113 | doAction?: [ |
107 | 114 | { |
108 | - command: 'string'; | |
109 | - createTime: '2021-11-29T09:13:38.810Z'; | |
110 | - creator: 'string'; | |
111 | - defaultConfig: 'string'; | |
112 | - description: 'string'; | |
113 | - deviceId: 'string'; | |
115 | + command: string; | |
116 | + createTime: string; | |
117 | + creator: string; | |
118 | + defaultConfig: string; | |
119 | + description: string; | |
120 | + deviceId: string; | |
114 | 121 | enabled: true; |
115 | - icon: 'string'; | |
116 | - id: 'string'; | |
117 | - name: 'string'; | |
118 | - outPut: 'string'; | |
119 | - outTarget: 'string'; | |
120 | - roleIds: ['string']; | |
121 | - tenantCode: 'string'; | |
122 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
123 | - tenantId: 'string'; | |
122 | + icon: string; | |
123 | + id: string; | |
124 | + name: string; | |
125 | + outPut: string; | |
126 | + outTarget: string; | |
127 | + roleIds: []; | |
128 | + tenantCode: string; | |
129 | + tenantExpireTime: string; | |
130 | + tenantId: string; | |
124 | 131 | tenantStatus: 'DISABLED'; |
125 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
126 | - updater: 'string'; | |
132 | + updateTime: string; | |
133 | + updater: string; | |
127 | 134 | } |
128 | 135 | ]; |
129 | 136 | doCondition?: [ |
130 | 137 | { |
131 | 138 | compare: 0; |
132 | - createTime: '2021-11-29T09:13:38.811Z'; | |
133 | - creator: 'string'; | |
134 | - defaultConfig: 'string'; | |
135 | - description: 'string'; | |
136 | - deviceId: 'string'; | |
139 | + createTime: string; | |
140 | + creator: string; | |
141 | + defaultConfig: string; | |
142 | + description: string; | |
143 | + deviceId: string; | |
137 | 144 | enabled: true; |
138 | - icon: 'string'; | |
139 | - id: 'string'; | |
140 | - name: 'string'; | |
141 | - property: 'string'; | |
142 | - roleIds: ['string']; | |
143 | - status: 'string'; | |
144 | - tenantCode: 'string'; | |
145 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
146 | - tenantId: 'string'; | |
145 | + icon: string; | |
146 | + id: string; | |
147 | + name: string; | |
148 | + property: string; | |
149 | + roleIds: []; | |
150 | + status: string; | |
151 | + tenantCode: string; | |
152 | + tenantExpireTime: string; | |
153 | + tenantId: string; | |
147 | 154 | tenantStatus: 'DISABLED'; |
148 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
149 | - updater: 'string'; | |
150 | - value: 'string'; | |
155 | + updateTime: string; | |
156 | + updater: string; | |
157 | + value: string; | |
151 | 158 | } |
152 | 159 | ]; |
153 | 160 | enabled?: true; |
154 | - icon?: 'string'; | |
155 | - id?: 'string'; | |
156 | - name?: 'string'; | |
157 | - organizationId?: 'string'; | |
158 | - roleIds?: ['string']; | |
159 | - status?: 'string'; | |
160 | - tenantCode?: 'string'; | |
161 | - tenantExpireTime?: '2021-11-29T09:13:38.811Z'; | |
162 | - tenantId?: 'string'; | |
161 | + icon?: string; | |
162 | + id?: string; | |
163 | + name?: string; | |
164 | + organizationId?: string; | |
165 | + roleIds?: [string]; | |
166 | + status?: string; | |
167 | + tenantCode?: string; | |
168 | + tenantExpireTime?: string; | |
169 | + tenantId?: string; | |
163 | 170 | tenantStatus?: 'DISABLED'; |
164 | 171 | triggers?: [ |
165 | 172 | { |
166 | - attributeChoose: 'string'; | |
167 | - compare: 0; | |
168 | - createTime: '2021-11-29T09:13:38.811Z'; | |
169 | - creator: 'string'; | |
170 | - defaultConfig: 'string'; | |
171 | - description: 'string'; | |
172 | - deviceId: 'string'; | |
173 | - enabled: true; | |
174 | - icon: 'string'; | |
175 | - id: 'string'; | |
176 | - name: 'string'; | |
177 | - roleIds: ['string']; | |
178 | - tenantCode: 'string'; | |
179 | - tenantExpireTime: '2021-11-29T09:13:38.811Z'; | |
180 | - tenantId: 'string'; | |
181 | - tenantStatus: 'DISABLED'; | |
182 | - tiggerEvent: 'string'; | |
183 | - touchWay: 'string'; | |
184 | - updateTime: '2021-11-29T09:13:38.811Z'; | |
185 | - updater: 'string'; | |
186 | - value: 'string'; | |
173 | + attributeChoose?: string; | |
174 | + compare?: 0; | |
175 | + createTime?: string; | |
176 | + creator?: string; | |
177 | + defaultConfig?: string; | |
178 | + description?: string; | |
179 | + deviceId?: string; | |
180 | + enabled?: true; | |
181 | + icon?: string; | |
182 | + id?: string; | |
183 | + name?: string; | |
184 | + roleIds?: []; | |
185 | + tenantCode?: string; | |
186 | + tenantExpireTime?: string; | |
187 | + tenantId?: string; | |
188 | + tenantStatus?: 'DISABLED'; | |
189 | + tiggerEvent?: string; | |
190 | + touchWay?: string; | |
191 | + updateTime?: string; | |
192 | + updater?: string; | |
193 | + value?: string; | |
187 | 194 | } |
188 | 195 | ]; |
189 | - updateTime?: '2021-11-29T09:13:38.811Z'; | |
190 | - updater?: 'string'; | |
196 | + updateTime?: string; | |
197 | + updater?: string; | |
191 | 198 | } | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | import { |
3 | - ScreenLinkPageTableQueryParam, | |
3 | + // ScreenParamModel, | |
4 | 4 | ScreenAddModel, |
5 | 5 | ScreenUpdateModel, |
6 | + ScreenLinkPageQueryParam, | |
7 | + ScreenByDeptIdParams, | |
6 | 8 | } from '/@/api/ruleengine/model/ruleengineModel'; |
7 | 9 | |
8 | 10 | enum ScreenManagerApi { |
... | ... | @@ -13,15 +15,29 @@ enum ScreenManagerApi { |
13 | 15 | SCREEN_ADD_URL = '/sceneLinkage', |
14 | 16 | SCREEN_DELETE_URL = '/sceneLinkage', |
15 | 17 | SCREEN_UPDATE_URL = '/sceneLinkage/update', |
18 | + SCREEN_ORGANIZATION_URL = '/organization/me/organizations', | |
19 | + SCREEN_CHANGE_STATUS = '/sceneLinkage/updateSceneStatus', | |
20 | + SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', | |
16 | 21 | } |
17 | 22 | |
18 | 23 | /** |
24 | + * 获取部门id | |
25 | + * @param 无参数 | |
26 | + */ | |
27 | +export const screenLinkOrganizationGetApi = () => { | |
28 | + return defHttp.get({ | |
29 | + url: ScreenManagerApi.SCREEN_ORGANIZATION_URL, | |
30 | + }); | |
31 | +}; | |
32 | + | |
33 | +/** | |
19 | 34 | * 分页查询场景联动表格页面 |
20 | 35 | * @param params pageSize page name |
21 | 36 | */ |
22 | -export const screenLinkPageGetApi = () => { | |
23 | - return defHttp.get<ScreenLinkPageTableQueryParam>({ | |
37 | +export const screenLinkPageGetApi = (params?: ScreenLinkPageQueryParam) => { | |
38 | + return defHttp.get({ | |
24 | 39 | url: ScreenManagerApi.SCREEN_GET_URL, |
40 | + params, | |
25 | 41 | }); |
26 | 42 | }; |
27 | 43 | |
... | ... | @@ -30,7 +46,7 @@ export const screenLinkPageGetApi = () => { |
30 | 46 | * @param params pageSize page name |
31 | 47 | */ |
32 | 48 | export const screenLinkPageAddApi = (params: ScreenAddModel) => { |
33 | - return defHttp.post<ScreenLinkPageTableQueryParam>({ | |
49 | + return defHttp.post<ScreenAddModel>({ | |
34 | 50 | url: ScreenManagerApi.SCREEN_ADD_URL, |
35 | 51 | params, |
36 | 52 | }); |
... | ... | @@ -41,7 +57,7 @@ export const screenLinkPageAddApi = (params: ScreenAddModel) => { |
41 | 57 | * @param params pageSize page name |
42 | 58 | */ |
43 | 59 | export const screenLinkPageUpdateApi = (params: ScreenUpdateModel) => { |
44 | - return defHttp.post<ScreenLinkPageTableQueryParam>({ | |
60 | + return defHttp.post<ScreenUpdateModel>({ | |
45 | 61 | url: ScreenManagerApi.SCREEN_UPDATE_URL, |
46 | 62 | params, |
47 | 63 | }); |
... | ... | @@ -59,3 +75,20 @@ export const screenLinkPageDeleteApi = (ids: string[]) => { |
59 | 75 | }, |
60 | 76 | }); |
61 | 77 | }; |
78 | + | |
79 | +/** | |
80 | + * 改变场景联动状态 | |
81 | + * @param params sceneLinkageId status | |
82 | + */ | |
83 | +export const screenLinkPagePutApi = (sceneLinkageId: string, status: number) => | |
84 | + defHttp.put({ url: ScreenManagerApi.SCREEN_CHANGE_STATUS + '/' + sceneLinkageId + '/' + status }); | |
85 | + | |
86 | +/** | |
87 | + * 根据部门id获取设备列表 | |
88 | + */ | |
89 | +export const screenLinkPageByDeptIdGetDevice = (params: ScreenByDeptIdParams) => { | |
90 | + return defHttp.get({ | |
91 | + url: ScreenManagerApi.SCREEN_GET_BY_DEPTID, | |
92 | + params, | |
93 | + }); | |
94 | +}; | ... | ... |
1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | |
2 | + | |
3 | +export type NoticeQueryParam = BasicPageParams & NoticeParams; | |
4 | + | |
5 | +export type NoticeParams = { | |
6 | + orderFiled?: string; | |
7 | + id?: string; | |
8 | +}; | |
9 | + | |
10 | +export type NoticeByIdParams = { | |
11 | + id: string; | |
12 | +}; | |
13 | + | |
14 | +//保存草稿 | |
15 | +export interface NotifyAddDraftModel { | |
16 | + content: string; | |
17 | + createTime: '2021-12-07T03:19:45.394Z'; | |
18 | + creator: string; | |
19 | + id: string; | |
20 | + pointId: []; | |
21 | + receiverType: string; | |
22 | + receiverTypeIds: string; | |
23 | + senderDate: string; | |
24 | + senderName: string; | |
25 | + status: string; | |
26 | + title: string; | |
27 | + type: 'MEETING'; | |
28 | + updateTime: string; | |
29 | + updater: string; | |
30 | +} | |
31 | +export interface NotifyAddreLeaseModel { | |
32 | + content: string; | |
33 | + createTime: string; | |
34 | + creator: string; | |
35 | + id: string; | |
36 | + pointId: []; | |
37 | + receiverType: string; | |
38 | + receiverTypeIds: string; | |
39 | + senderDate: string; | |
40 | + senderName: string; | |
41 | + status: string; | |
42 | + title: string; | |
43 | + type: 'MEETING'; | |
44 | + updateTime: string; | |
45 | + updater: string; | |
46 | +} | ... | ... |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { | |
3 | + NoticeByIdParams, | |
4 | + NoticeQueryParam, | |
5 | + NotifyAddDraftModel, | |
6 | + NotifyAddreLeaseModel, | |
7 | +} from '/@/api/stationnotification/model/stationnotifyModel'; | |
8 | + | |
9 | +enum NotifyManagerApi { | |
10 | + /** | |
11 | + * 场景URL | |
12 | + */ | |
13 | + NOTICE_GET_URL = '/notice/page', | |
14 | + NOTICE_GET_DETAIL_URL = '/notice', | |
15 | + NOTICE_ADD_DRAFT_URL = '/notice/save', | |
16 | + NOTICE_ADD_LEASE_URL = '/notice/send', | |
17 | + NOTICE_DELETE_URL = '/notice/delete', | |
18 | + NOTICE_GET_MYDETAIL_URL = '/noticeUser', | |
19 | + NOTICE_GET_PAGE_URL = '/noticeUser/page', | |
20 | + NOTICE_GET_READ_URL = '/noticeUser/read', | |
21 | +} | |
22 | + | |
23 | +// /** | |
24 | +// * 获取详情 | |
25 | +// * @param | |
26 | +// */ | |
27 | +export const screenLinkPageByDeptIdGetDevice = (params: NoticeByIdParams) => { | |
28 | + return defHttp.get({ | |
29 | + url: NotifyManagerApi.NOTICE_GET_DETAIL_URL, | |
30 | + params, | |
31 | + }); | |
32 | +}; | |
33 | + | |
34 | +/** | |
35 | + * 分页查询通知表格页面 | |
36 | + * @param params pageSize page name | |
37 | + */ | |
38 | +export const notifyGetTableApi = (params?: NoticeQueryParam) => { | |
39 | + return defHttp.get({ | |
40 | + url: NotifyManagerApi.NOTICE_GET_URL, | |
41 | + params, | |
42 | + }); | |
43 | +}; | |
44 | + | |
45 | +/** | |
46 | + * 新增草稿 | |
47 | + * @param params pageSize page name | |
48 | + */ | |
49 | +export const notifyAddDraftApi = (params: NotifyAddDraftModel) => { | |
50 | + return defHttp.post<NotifyAddDraftModel>({ | |
51 | + url: NotifyManagerApi.NOTICE_ADD_DRAFT_URL, | |
52 | + params, | |
53 | + }); | |
54 | +}; | |
55 | + | |
56 | +/** | |
57 | + * 新增通知 | |
58 | + * @param params pageSize page name | |
59 | + */ | |
60 | +export const notifyAddLeaseApi = (params: NotifyAddreLeaseModel) => { | |
61 | + return defHttp.post<NotifyAddreLeaseModel>({ | |
62 | + url: NotifyManagerApi.NOTICE_ADD_LEASE_URL, | |
63 | + params, | |
64 | + }); | |
65 | +}; | |
66 | + | |
67 | +/** | |
68 | + * 批量删除 | |
69 | + * @param params pageSize page name | |
70 | + */ | |
71 | +export const notifyDeleteApi = (ids: string) => { | |
72 | + return defHttp.delete({ | |
73 | + url: `${NotifyManagerApi.NOTICE_DELETE_URL}?ids=${ids}`, | |
74 | + }); | |
75 | +}; | |
76 | + | |
77 | +/** | |
78 | + * 查询我的通知详情 | |
79 | + * @param params pageSize page name | |
80 | + */ | |
81 | +export const notifyMyGetDetailApi = (id: string) => { | |
82 | + return defHttp.get({ | |
83 | + url: `${NotifyManagerApi.NOTICE_GET_MYDETAIL_URL}/${id}`, | |
84 | + }); | |
85 | +}; | |
86 | + | |
87 | +/** | |
88 | + * 查询我的通知表格 | |
89 | + * @param params pageSize page name | |
90 | + */ | |
91 | +export const notifyMyGetrPageApi = (params?: NoticeQueryParam) => { | |
92 | + return defHttp.get({ | |
93 | + url: NotifyManagerApi.NOTICE_GET_PAGE_URL, | |
94 | + params, | |
95 | + }); | |
96 | +}; | |
97 | + | |
98 | +/** | |
99 | + * 查询人员阅读情况分页 | |
100 | + * @param params pageSize page name | |
101 | + */ | |
102 | +export const notifyMyGetrReadApi = (params?: NoticeQueryParam) => { | |
103 | + return defHttp.get({ | |
104 | + url: NotifyManagerApi.NOTICE_GET_READ_URL, | |
105 | + params, | |
106 | + }); | |
107 | +}; | ... | ... |
... | ... | @@ -10,16 +10,31 @@ import { useGlobSetting } from '/@/hooks/setting'; |
10 | 10 | import { useMessage } from '/@/hooks/web/useMessage'; |
11 | 11 | import { RequestEnum, ContentTypeEnum } from '/@/enums/httpEnum'; |
12 | 12 | import { isString } from '/@/utils/is'; |
13 | -import { getJwtToken } from '/@/utils/auth'; | |
13 | +import { getJwtToken, getAuthCache } from '/@/utils/auth'; | |
14 | 14 | import { setObjToUrlParams, deepMerge } from '/@/utils'; |
15 | 15 | import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; |
16 | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
17 | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
18 | +// import { PageEnum } from '/@/enums/pageEnum'; | |
19 | +import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, PROJ_CFG_KEY } from '/@/enums/cacheEnum'; | |
20 | +import { router } from '/@/router'; | |
21 | +// import { useUserStore } from '/@/store/modules/user'; | |
22 | +// const userStore = useUserStore(); | |
23 | +// console.log(userStore.userInfo); | |
18 | 24 | |
25 | +// YUNTENG IOT__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__ | |
19 | 26 | const globSetting = useGlobSetting(); |
20 | 27 | const urlPrefix = globSetting.urlPrefix; |
21 | 28 | const { createMessage, createErrorModal } = useMessage(); |
22 | 29 | |
30 | +const getJwtTokenInfo = getAuthCache(REFRESH_TOKEN_KEY); | |
31 | +const getRefreshTokenInfo = getAuthCache(JWT_TOKEN_KEY); | |
32 | +console.log(getJwtTokenInfo); | |
33 | +console.log(getRefreshTokenInfo); | |
34 | +const getRefreshTokenInfo1 = getAuthCache(PROJ_CFG_KEY); | |
35 | + | |
36 | +console.log(getRefreshTokenInfo1); | |
37 | + | |
23 | 38 | /** |
24 | 39 | * @description: 数据处理,方便区分多种处理方式 |
25 | 40 | */ |
... | ... | @@ -121,6 +136,21 @@ const transform: AxiosTransform = { |
121 | 136 | let errMessage = ''; |
122 | 137 | |
123 | 138 | try { |
139 | + if (response.data.code === '401' || response.data.msg === 'tenant has expired') { | |
140 | + createMessage.error('token已过期,退回登录'); | |
141 | + // router.push(PageEnum.BASE_LOGIN); | |
142 | + router.beforeEach((to, from, next) => { | |
143 | + if (getJwtTokenInfo) { | |
144 | + if (to.path === '/login' || to.path !== '/login') { | |
145 | + // doRefresh(); | |
146 | + next({ path: '/' }); | |
147 | + } | |
148 | + } | |
149 | + }); | |
150 | + } else { | |
151 | + // doRefresh(); | |
152 | + } | |
153 | + | |
124 | 154 | if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { |
125 | 155 | errMessage = t('sys.api.apiTimeoutMessage'); |
126 | 156 | } | ... | ... |
... | ... | @@ -5,6 +5,7 @@ import { findDictItemByCode } from '/@/api/system/dict'; |
5 | 5 | export const columns: BasicColumn[] = [ |
6 | 6 | { |
7 | 7 | title: '场景联动名称', |
8 | + dataIndex: 'name', | |
8 | 9 | }, |
9 | 10 | { |
10 | 11 | title: '触发方式', |
... | ... | @@ -13,15 +14,13 @@ export const columns: BasicColumn[] = [ |
13 | 14 | }, |
14 | 15 | { |
15 | 16 | title: '状态', |
16 | - // dataIndex: 'deviceType', | |
17 | + dataIndex: 'status', | |
17 | 18 | width: 200, |
18 | - // slots: { customRender: 'deviceType' }, | |
19 | 19 | }, |
20 | 20 | { |
21 | 21 | title: '描述', |
22 | - // dataIndex: 'deviceProfile.name', | |
22 | + dataIndex: 'description', | |
23 | 23 | width: 180, |
24 | - // slots: { customRender: 'deviceProfile' }, | |
25 | 24 | }, |
26 | 25 | ]; |
27 | 26 | ... | ... |
1 | 1 | <template> |
2 | - <CollapseContainer title="执行条件" style="background-color: #eeeeee"> | |
3 | - <BasicForm | |
4 | - style="display: inline-block" | |
5 | - layout="inline" | |
6 | - :actionColOptions="{ span: 24 }" | |
7 | - :labelWidth="100" | |
8 | - :showResetButton="false" | |
9 | - :showSubmitButton="false" | |
10 | - autoFocusFirstItem | |
11 | - labelAlign="left" | |
12 | - @register="register" | |
13 | - > | |
14 | - <template #add="{ field }"> | |
15 | - <br /> | |
16 | - <Button | |
17 | - style="margin-left: -575px; margin-top: 15px" | |
18 | - v-if="Number(field) === 0" | |
19 | - @click="add" | |
20 | - type="primary" | |
21 | - >+新增执行条件</Button | |
22 | - > | |
23 | - <Button | |
24 | - style="margin-left: 10px" | |
25 | - v-if="Number(field) === 0" | |
26 | - @click="handleSubmit" | |
27 | - type="primary" | |
28 | - >保存</Button | |
29 | - > | |
30 | - <br /> | |
31 | - <Button | |
32 | - style="margin-left: -415px; margin-top: -15px" | |
33 | - v-if="field > 0" | |
34 | - @click="add" | |
35 | - type="primary" | |
36 | - >+新增执行条件</Button | |
37 | - > | |
38 | - <Button style="margin-left: 10px" v-if="field > 0" @click="handleSubmit" type="primary" | |
39 | - >保存</Button | |
40 | - > | |
41 | - <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
42 | - >删除</Button | |
43 | - > | |
44 | - <br /> | |
45 | - </template> | |
46 | - </BasicForm> | |
2 | + <CollapseContainer title="执行条件1" style="background-color: #eeeeee"> | |
3 | + <div style="position: relative"> | |
4 | + <BasicForm | |
5 | + :labelWidth="100" | |
6 | + :emptySpan="10" | |
7 | + :showResetButton="false" | |
8 | + :showSubmitButton="false" | |
9 | + @register="registerCondition" | |
10 | + > | |
11 | + <template #add="{ field }"> | |
12 | + <Button | |
13 | + style="margin-left: -99px; margin-top: 0px; display: inline-block" | |
14 | + v-if="Number(field) === 0" | |
15 | + @click="add" | |
16 | + type="primary" | |
17 | + >+新增执行条件</Button | |
18 | + > | |
19 | + <Button | |
20 | + @click="del(field)" | |
21 | + style="margin-left: 10px" | |
22 | + v-if="Number(field) === 0" | |
23 | + type="primary" | |
24 | + >删除</Button | |
25 | + > | |
26 | + <Button | |
27 | + style="margin-left: -95px; margin-top: 20px" | |
28 | + v-if="field > 0" | |
29 | + @click="add" | |
30 | + type="primary" | |
31 | + >+新增执行条件</Button | |
32 | + > | |
33 | + <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
34 | + >删除</Button | |
35 | + > | |
36 | + </template> | |
37 | + </BasicForm> | |
38 | + </div> | |
47 | 39 | </CollapseContainer> |
48 | 40 | </template> |
49 | 41 | <script lang="ts"> |
50 | - import { defineComponent, ref } from 'vue'; | |
42 | + import { defineComponent, ref, reactive, watch } from 'vue'; | |
51 | 43 | import { CollapseContainer } from '/@/components/Container/index'; |
52 | 44 | import { BasicForm, useForm } from '/@/components/Form/index'; |
53 | 45 | import { Input } from 'ant-design-vue'; |
54 | 46 | import { Button } from '/@/components/Button'; |
55 | - import { useConditionDrawerSchema } from '../config.d'; | |
47 | + import { useConditionDrawerSchema, isShiDu, isTimeAll } from '../config.d'; | |
48 | + import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
56 | 49 | |
57 | 50 | export default defineComponent({ |
58 | 51 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
59 | - setup(_, { emit }) { | |
60 | - let formData = ref({}); | |
61 | - const [register, { appendSchemaByField, removeSchemaByFiled, getFieldsValue }] = useForm({ | |
52 | + props: ['deviceInfo1'], | |
53 | + setup(props, { emit }) { | |
54 | + let formData = reactive({}); | |
55 | + const [ | |
56 | + registerCondition, | |
57 | + { resetFields, updateSchema, appendSchemaByField, removeSchemaByFiled, getFieldsValue }, | |
58 | + ] = useForm({ | |
62 | 59 | labelWidth: 100, |
63 | 60 | schemas: useConditionDrawerSchema, |
64 | 61 | actionColOptions: { span: 24 }, |
65 | 62 | }); |
66 | - emits: ['get-conditiondata']; | |
67 | - async function handleSubmit() { | |
63 | + let isJudge = ref(1); | |
64 | + if (isJudge.value == 1) { | |
65 | + resetFields(); | |
66 | + } | |
67 | + watch( | |
68 | + () => props.deviceInfo1, | |
69 | + async (newV) => { | |
70 | + const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
71 | + options.items.forEach((v) => { | |
72 | + return (v.value = v.id); | |
73 | + }); | |
74 | + updateSchema({ | |
75 | + field: 'deviceId', | |
76 | + componentProps: { | |
77 | + options: options.items, | |
78 | + }, | |
79 | + }); | |
80 | + } | |
81 | + ); | |
82 | + // async function handleSubmit() { | |
83 | + // try { | |
84 | + // let data = getFieldsValue(); | |
85 | + // formData = data; | |
86 | + // emit('get-conditiondata', formData); | |
87 | + // isJudge.value++; | |
88 | + // } catch (e) { | |
89 | + // console.log(e); | |
90 | + // } | |
91 | + // } | |
92 | + const n = ref(1); | |
93 | + function add() { | |
68 | 94 | try { |
69 | - const data = await getFieldsValue(); | |
70 | - formData.value = data; | |
71 | - emit('get-conditiondata', formData.value); | |
95 | + let data = getFieldsValue(); | |
96 | + formData = data; | |
97 | + emit('get-conditiondata', formData); | |
98 | + isJudge.value++; | |
72 | 99 | } catch (e) { |
73 | 100 | console.log(e); |
74 | 101 | } |
75 | - } | |
76 | - const n = ref(1); | |
77 | - function add() { | |
78 | 102 | appendSchemaByField( |
79 | 103 | { |
80 | - field: `field${n.value}a`, | |
81 | - component: 'ApiSelect', | |
104 | + field: `kong${n.value}`, | |
105 | + label: `执行条件${n.value + 1 + `.........`}`, | |
106 | + component: 'Slider', | |
107 | + colProps: { span: 24 }, | |
108 | + }, | |
109 | + '' | |
110 | + ); | |
111 | + appendSchemaByField( | |
112 | + { | |
113 | + field: `status${n.value}`, | |
82 | 114 | label: '', |
115 | + component: 'Select', | |
83 | 116 | componentProps: { |
84 | - placeholder: '请选择', | |
117 | + placeholder: '设备状态', | |
118 | + options: [ | |
119 | + { label: '设备触发', value: 'DEVICE_STATUS' }, | |
120 | + { label: '时间范围', value: 'TIME_ALL' }, | |
121 | + ], | |
85 | 122 | }, |
123 | + colProps: { span: 12 }, | |
124 | + }, | |
125 | + '' | |
126 | + ); | |
127 | + appendSchemaByField( | |
128 | + { | |
129 | + field: `deviceId${n.value}`, | |
130 | + label: '', | |
131 | + component: 'Select', | |
132 | + componentProps: { | |
133 | + placeholder: '请选择设备', | |
134 | + }, | |
135 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | |
86 | 136 | colProps: { |
87 | - span: 8, | |
88 | - offset: 1, | |
137 | + span: 12, | |
89 | 138 | }, |
90 | - required: true, | |
91 | 139 | }, |
92 | 140 | '' |
93 | 141 | ); |
94 | 142 | appendSchemaByField( |
95 | 143 | { |
96 | - field: `field${n.value}b`, | |
97 | - component: 'Input', | |
144 | + field: `createTime${n.value}`, | |
98 | 145 | label: '', |
146 | + component: 'DatePicker', | |
99 | 147 | componentProps: { |
100 | - placeholder: '请输入', | |
148 | + placeholder: '请选择起始时间', | |
101 | 149 | }, |
102 | 150 | colProps: { |
103 | - span: 8, | |
104 | - offset: 1, | |
151 | + span: 12, | |
105 | 152 | }, |
106 | - required: true, | |
153 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | |
107 | 154 | }, |
108 | 155 | '' |
109 | 156 | ); |
110 | 157 | appendSchemaByField( |
111 | 158 | { |
112 | - field: `field${n.value}c`, | |
113 | - component: 'ApiSelect', | |
159 | + field: `updateTime${n.value}`, | |
114 | 160 | label: '', |
161 | + component: 'DatePicker', | |
115 | 162 | componentProps: { |
116 | - placeholder: '请选择', | |
163 | + placeholder: '请选择结束时间', | |
117 | 164 | }, |
118 | 165 | colProps: { |
119 | - span: 8, | |
166 | + span: 12, | |
120 | 167 | }, |
121 | - required: true, | |
168 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | |
122 | 169 | }, |
123 | 170 | '' |
124 | 171 | ); |
125 | 172 | appendSchemaByField( |
126 | 173 | { |
127 | - field: `field${n.value}d`, | |
128 | - component: 'ApiSelect', | |
174 | + field: `property${n.value}`, | |
129 | 175 | label: '', |
176 | + component: 'Select', | |
130 | 177 | componentProps: { |
131 | - placeholder: '请选择', | |
178 | + placeholder: '请选择或者输入属性', | |
179 | + options: [ | |
180 | + { label: 'shidu', value: 'SHINDU' }, | |
181 | + { label: 'wendu', value: 'WENDU' }, | |
182 | + ], | |
132 | 183 | }, |
133 | - colProps: { | |
134 | - span: 8, | |
184 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | |
185 | + colProps: { span: 12 }, | |
186 | + }, | |
187 | + '' | |
188 | + ); | |
189 | + appendSchemaByField( | |
190 | + { | |
191 | + field: `wu${n.value}`, | |
192 | + label: '', | |
193 | + component: 'Input', | |
194 | + componentProps: { | |
195 | + placeholder: '无', | |
196 | + style: { | |
197 | + visibility: 'hidden', | |
198 | + }, | |
199 | + }, | |
200 | + colProps: { span: 12 }, | |
201 | + }, | |
202 | + '' | |
203 | + ); | |
204 | + appendSchemaByField( | |
205 | + { | |
206 | + field: `compare${n.value}`, | |
207 | + label: '', | |
208 | + component: 'Select', | |
209 | + componentProps: { | |
210 | + placeholder: '', | |
211 | + options: [ | |
212 | + { label: '=', value: '0' }, | |
213 | + { label: '<', value: '1' }, | |
214 | + { label: '>', value: '2' }, | |
215 | + { label: '<=', value: '3' }, | |
216 | + { label: '>=', value: '4' }, | |
217 | + ], | |
135 | 218 | }, |
136 | - required: true, | |
219 | + ifShow: ({ values }) => | |
220 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
221 | + colProps: { span: 12 }, | |
137 | 222 | }, |
138 | 223 | '' |
139 | 224 | ); |
140 | 225 | appendSchemaByField( |
141 | 226 | { |
142 | - field: `field${n.value}e`, | |
143 | - component: 'ApiSelect', | |
227 | + field: `value${n.value}`, | |
228 | + component: 'Input', | |
144 | 229 | label: '', |
145 | 230 | componentProps: { |
146 | - placeholder: '请选择', | |
231 | + placeholder: '请输入比较值', | |
147 | 232 | }, |
233 | + ifShow: ({ values }) => | |
234 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
148 | 235 | colProps: { |
149 | - span: 8, | |
236 | + span: 12, | |
150 | 237 | }, |
151 | - required: true, | |
152 | 238 | }, |
153 | 239 | '' |
154 | 240 | ); |
241 | + | |
155 | 242 | appendSchemaByField( |
156 | 243 | { |
157 | - field: `field${n.value}f`, | |
244 | + field: `compare${n.value}`, | |
245 | + label: '', | |
246 | + component: 'Select', | |
247 | + componentProps: { | |
248 | + placeholder: '', | |
249 | + options: [ | |
250 | + { label: '=', value: '0' }, | |
251 | + { label: '<', value: '1' }, | |
252 | + { label: '>', value: '2' }, | |
253 | + { label: '<=', value: '3' }, | |
254 | + { label: '>=', value: '4' }, | |
255 | + ], | |
256 | + }, | |
257 | + ifShow: ({ values }) => | |
258 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
259 | + colProps: { span: 12 }, | |
260 | + }, | |
261 | + '' | |
262 | + ); | |
263 | + appendSchemaByField( | |
264 | + { | |
265 | + field: `value${n.value}`, | |
158 | 266 | component: 'Input', |
159 | 267 | label: '', |
160 | 268 | componentProps: { |
161 | - placeholder: '请输入', | |
269 | + placeholder: '请输入比较值', | |
162 | 270 | }, |
271 | + ifShow: ({ values }) => | |
272 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
163 | 273 | colProps: { |
164 | - span: 8, | |
274 | + span: 12, | |
165 | 275 | }, |
166 | - required: true, | |
167 | 276 | }, |
168 | 277 | '' |
169 | 278 | ); |
279 | + | |
170 | 280 | appendSchemaByField( |
171 | 281 | { |
172 | 282 | field: `${n.value}`, |
173 | - component: 'ApiSelect', | |
283 | + component: 'Input', | |
174 | 284 | label: ' ', |
175 | 285 | colProps: { |
176 | - span: 8, | |
177 | - offset: 1, | |
286 | + span: 12, | |
178 | 287 | }, |
179 | 288 | slot: 'add', |
180 | 289 | }, |
... | ... | @@ -182,23 +291,24 @@ |
182 | 291 | ); |
183 | 292 | n.value++; |
184 | 293 | } |
185 | - | |
186 | 294 | function del(field) { |
187 | 295 | removeSchemaByFiled([ |
188 | - `field${field}a`, | |
189 | - `field${field}b`, | |
190 | - `field${field}c`, | |
191 | - `field${field}d`, | |
192 | - `field${field}e`, | |
193 | - `field${field}f`, | |
194 | - `field${field}g`, | |
195 | - `field${field}h`, | |
296 | + `kong${field}`, | |
297 | + `status${field}`, | |
298 | + `deviceId${field}`, | |
299 | + `createTime${field}`, | |
300 | + `updateTime${field}`, | |
301 | + `property${field}`, | |
302 | + `wu${field}`, | |
303 | + `compare${field}`, | |
304 | + `value${field}`, | |
305 | + `compare${field}`, | |
306 | + `value${field}`, | |
196 | 307 | `${field}`, |
197 | 308 | ]); |
198 | 309 | n.value--; |
199 | 310 | } |
200 | - | |
201 | - return { register, handleSubmit, add, del, formData }; | |
311 | + return { registerCondition, add, del }; | |
202 | 312 | }, |
203 | 313 | }); |
204 | 314 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <CollapseContainer title="执行动作" style="background-color: #eeeeee"> | |
3 | - <BasicForm | |
4 | - style="display: inline-block" | |
5 | - layout="inline" | |
6 | - :actionColOptions="{ span: 24 }" | |
7 | - :labelWidth="100" | |
8 | - :showResetButton="false" | |
9 | - :showSubmitButton="false" | |
10 | - autoFocusFirstItem | |
11 | - labelAlign="left" | |
12 | - @register="register" | |
13 | - > | |
14 | - <template #add="{ field }"> | |
15 | - <br /> | |
16 | - <Button | |
17 | - style="margin-left: -575px; margin-top: 15px" | |
18 | - v-if="Number(field) === 0" | |
19 | - @click="add" | |
20 | - type="primary" | |
21 | - >+新增执行动作</Button | |
22 | - > | |
23 | - <Button | |
24 | - style="margin-left: 10px" | |
25 | - v-if="Number(field) === 0" | |
26 | - @click="handleSubmit" | |
27 | - type="primary" | |
28 | - >保存</Button | |
29 | - > | |
30 | - <br /> | |
31 | - <Button | |
32 | - style="margin-left: -415px; margin-top: -15px" | |
33 | - v-if="field > 0" | |
34 | - @click="add" | |
35 | - type="primary" | |
36 | - >+新增执行动作</Button | |
37 | - > | |
38 | - <Button style="margin-left: 10px" v-if="field > 0" @click="handleSubmit" type="primary" | |
39 | - >保存</Button | |
40 | - > | |
41 | - <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
42 | - >删除</Button | |
43 | - > | |
44 | - <br /> | |
45 | - </template> | |
46 | - </BasicForm> | |
2 | + <CollapseContainer title="执行动作1" style="background-color: #eeeeee"> | |
3 | + <div style="position: relative"> | |
4 | + <BasicForm | |
5 | + :labelWidth="100" | |
6 | + :showResetButton="false" | |
7 | + :showSubmitButton="false" | |
8 | + :emptySpan="10" | |
9 | + @register="registerAction" | |
10 | + > | |
11 | + <template #add="{ field }"> | |
12 | + <Button | |
13 | + style="margin-left: -99px; margin-top: 30px; display: inline-block" | |
14 | + v-if="Number(field) === 0" | |
15 | + @click="add" | |
16 | + type="primary" | |
17 | + >+新增执行动作</Button | |
18 | + > | |
19 | + <Button | |
20 | + style="margin-left: 10px" | |
21 | + v-if="Number(field) === 0" | |
22 | + @click="handleSubmit" | |
23 | + type="primary" | |
24 | + >保存</Button | |
25 | + > | |
26 | + <br /> | |
27 | + <Button | |
28 | + style="margin-left: -98px; margin-top: -15px" | |
29 | + v-if="field > 0" | |
30 | + @click="add" | |
31 | + type="primary" | |
32 | + >+新增执行动作</Button | |
33 | + > | |
34 | + <Button style="margin-left: 10px" v-if="field > 0" @click="handleSubmit" type="primary" | |
35 | + >保存</Button | |
36 | + > | |
37 | + <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
38 | + >删除</Button | |
39 | + > | |
40 | + </template> | |
41 | + </BasicForm> | |
42 | + </div> | |
47 | 43 | </CollapseContainer> |
48 | 44 | </template> |
49 | 45 | <script lang="ts"> |
50 | - import { defineComponent, ref } from 'vue'; | |
46 | + import { defineComponent, ref, reactive, watch } from 'vue'; | |
51 | 47 | import { CollapseContainer } from '/@/components/Container/index'; |
52 | 48 | import { BasicForm, useForm } from '/@/components/Form/index'; |
53 | 49 | import { Input } from 'ant-design-vue'; |
54 | 50 | import { Button } from '/@/components/Button'; |
55 | - import { useActionDrawerSchema } from '../config.d'; | |
51 | + import { useActionDrawerSchema, isMsg, isScene } from '../config.d'; | |
52 | + import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
56 | 53 | |
57 | 54 | export default defineComponent({ |
58 | 55 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
59 | - setup(_, { emit }) { | |
60 | - let formData = ref({}); | |
61 | - const [register, { appendSchemaByField, getFieldsValue, removeSchemaByFiled }] = useForm({ | |
56 | + props: ['deviceInfo2'], | |
57 | + setup(props, { emit }) { | |
58 | + let formData = reactive({}); | |
59 | + const [ | |
60 | + registerAction, | |
61 | + { resetFields, updateSchema, appendSchemaByField, getFieldsValue, removeSchemaByFiled }, | |
62 | + ] = useForm({ | |
62 | 63 | labelWidth: 100, |
63 | 64 | schemas: useActionDrawerSchema, |
64 | 65 | actionColOptions: { span: 24 }, |
65 | 66 | }); |
66 | - emits: ['get-actiondata']; | |
67 | + let isJudge = ref(1); | |
68 | + if (isJudge.value == 1) { | |
69 | + resetFields(); | |
70 | + } | |
71 | + watch( | |
72 | + () => props.deviceInfo2, | |
73 | + async (newV) => { | |
74 | + const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
75 | + options.items.forEach((v) => { | |
76 | + return (v.value = v.id); | |
77 | + }); | |
78 | + updateSchema({ | |
79 | + field: 'deviceId', | |
80 | + componentProps: { | |
81 | + options: options.items, | |
82 | + }, | |
83 | + }); | |
84 | + } | |
85 | + ); | |
67 | 86 | async function handleSubmit() { |
68 | 87 | try { |
69 | - const data = await getFieldsValue(); | |
70 | - formData.value = data; | |
71 | - emit('get-actiondata', formData.value); | |
88 | + let data = getFieldsValue(); | |
89 | + formData = data; | |
90 | + emit('get-actiondata', formData); | |
91 | + isJudge.value++; | |
72 | 92 | } catch (e) { |
73 | 93 | console.log(e); |
74 | 94 | } |
... | ... | @@ -77,104 +97,123 @@ |
77 | 97 | function add() { |
78 | 98 | appendSchemaByField( |
79 | 99 | { |
80 | - field: `field${n.value}a`, | |
81 | - component: 'ApiSelect', | |
100 | + field: `kong${n.value}`, | |
101 | + label: `执行动作${n.value + 1 + `.......`}`, | |
102 | + component: 'Slider', | |
103 | + colProps: { span: 24 }, | |
104 | + }, | |
105 | + '' | |
106 | + ); | |
107 | + appendSchemaByField( | |
108 | + { | |
109 | + field: `outTarget${n.value}`, | |
82 | 110 | label: '', |
111 | + component: 'Select', | |
83 | 112 | componentProps: { |
84 | - placeholder: '请选择', | |
85 | - }, | |
86 | - colProps: { | |
87 | - span: 8, | |
88 | - offset: 1, | |
113 | + placeholder: '设备输出', | |
114 | + options: [ | |
115 | + { label: '设备输出', value: 'DEVICE_OUT' }, | |
116 | + { label: '消息通知', value: 'MSG_NOTIFY' }, | |
117 | + { label: '场景联动', value: 'SCENE_ACT' }, | |
118 | + ], | |
89 | 119 | }, |
90 | - required: true, | |
120 | + colProps: { span: 12 }, | |
91 | 121 | }, |
92 | 122 | '' |
93 | 123 | ); |
94 | 124 | appendSchemaByField( |
95 | 125 | { |
96 | - field: `field${n.value}b`, | |
97 | - component: 'Input', | |
126 | + field: `deviceId${n.value}`, | |
98 | 127 | label: '', |
128 | + component: 'Select', | |
99 | 129 | componentProps: { |
100 | - placeholder: '请输入', | |
130 | + placeholder: '请选择设备', | |
101 | 131 | }, |
132 | + ifShow: ({ values }) => | |
133 | + !isScene(Reflect.get(values, 'outTarget')) && | |
134 | + !isMsg(Reflect.get(values, 'outTarget')), | |
102 | 135 | colProps: { |
103 | - span: 8, | |
104 | - offset: 1, | |
136 | + span: 12, | |
105 | 137 | }, |
106 | - required: true, | |
107 | 138 | }, |
108 | 139 | '' |
109 | 140 | ); |
110 | 141 | appendSchemaByField( |
111 | 142 | { |
112 | - field: `field${n.value}c`, | |
113 | - component: 'ApiSelect', | |
143 | + field: `command${n.value}`, | |
144 | + component: 'Input', | |
114 | 145 | label: '', |
115 | 146 | componentProps: { |
116 | - placeholder: '请选择', | |
147 | + placeholder: '请输入下发指定', | |
117 | 148 | }, |
149 | + ifShow: ({ values }) => | |
150 | + !isScene(Reflect.get(values, 'outTarget')) && | |
151 | + !isMsg(Reflect.get(values, 'outTarget')), | |
118 | 152 | colProps: { |
119 | - span: 8, | |
153 | + span: 12, | |
120 | 154 | }, |
121 | - required: true, | |
122 | 155 | }, |
123 | 156 | '' |
124 | 157 | ); |
125 | 158 | appendSchemaByField( |
126 | 159 | { |
127 | - field: `field${n.value}d`, | |
128 | - component: 'ApiSelect', | |
160 | + field: `wu1${n.value}`, | |
129 | 161 | label: '', |
162 | + component: 'Input', | |
130 | 163 | componentProps: { |
131 | - placeholder: '请选择', | |
132 | - }, | |
133 | - colProps: { | |
134 | - span: 8, | |
164 | + placeholder: '无', | |
165 | + style: { | |
166 | + visibility: 'hidden', | |
167 | + }, | |
135 | 168 | }, |
136 | - required: true, | |
169 | + colProps: { span: 12 }, | |
137 | 170 | }, |
138 | 171 | '' |
139 | 172 | ); |
140 | 173 | appendSchemaByField( |
141 | 174 | { |
142 | - field: `field${n.value}e`, | |
143 | - component: 'ApiSelect', | |
175 | + field: `wu2${n.value}`, | |
176 | + component: 'Input', | |
144 | 177 | label: '', |
145 | 178 | componentProps: { |
146 | - placeholder: '请选择', | |
179 | + placeholder: '暂不实现', | |
147 | 180 | }, |
148 | 181 | colProps: { |
149 | - span: 8, | |
182 | + span: 12, | |
150 | 183 | }, |
151 | - required: true, | |
184 | + ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), | |
152 | 185 | }, |
153 | 186 | '' |
154 | 187 | ); |
155 | 188 | appendSchemaByField( |
156 | 189 | { |
157 | - field: `field${n.value}f`, | |
158 | - component: 'Input', | |
190 | + field: `sceneLinkageId${n.value}`, | |
159 | 191 | label: '', |
160 | - componentProps: { | |
161 | - placeholder: '请输入', | |
162 | - }, | |
192 | + component: 'ApiSelect', | |
163 | 193 | colProps: { |
164 | - span: 8, | |
194 | + span: 12, | |
195 | + }, | |
196 | + componentProps: { | |
197 | + placeholder: '请选择场景触发器', | |
198 | + options: [ | |
199 | + { label: '场景触发器1', value: '1' }, | |
200 | + { label: '场景触发器2', value: '2' }, | |
201 | + { label: '场景触发器3', value: '3' }, | |
202 | + { label: '场景触发器4', value: '4' }, | |
203 | + ], | |
165 | 204 | }, |
166 | - required: true, | |
205 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | |
167 | 206 | }, |
168 | 207 | '' |
169 | 208 | ); |
209 | + | |
170 | 210 | appendSchemaByField( |
171 | 211 | { |
172 | 212 | field: `${n.value}`, |
173 | - component: 'ApiSelect', | |
213 | + component: 'Input', | |
174 | 214 | label: ' ', |
175 | 215 | colProps: { |
176 | - span: 8, | |
177 | - offset: 1, | |
216 | + span: 12, | |
178 | 217 | }, |
179 | 218 | slot: 'add', |
180 | 219 | }, |
... | ... | @@ -185,20 +224,19 @@ |
185 | 224 | |
186 | 225 | function del(field) { |
187 | 226 | removeSchemaByFiled([ |
188 | - `field${field}a`, | |
189 | - `field${field}b`, | |
190 | - `field${field}c`, | |
191 | - `field${field}d`, | |
192 | - `field${field}e`, | |
193 | - `field${field}f`, | |
194 | - `field${field}g`, | |
195 | - `field${field}h`, | |
227 | + `kong${field}`, | |
228 | + `outTarget${field}`, | |
229 | + `deviceId${field}`, | |
230 | + `command${field}`, | |
231 | + `wu1${field}`, | |
232 | + `wu2${field}`, | |
233 | + `sceneLinkageId${field}`, | |
196 | 234 | `${field}`, |
197 | 235 | ]); |
198 | 236 | n.value--; |
199 | 237 | } |
200 | 238 | |
201 | - return { register, handleSubmit, add, del, formData }; | |
239 | + return { registerAction, handleSubmit, add, del }; | |
202 | 240 | }, |
203 | 241 | }); |
204 | 242 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <CollapseContainer title="触发器" style="background-color: #eeeeee"> | |
3 | - <BasicForm | |
4 | - style="margin-top: 15px" | |
5 | - layout="inline" | |
6 | - :actionColOptions="{ span: 24 }" | |
7 | - :labelWidth="100" | |
8 | - :showResetButton="false" | |
9 | - :showSubmitButton="false" | |
10 | - autoFocusFirstItem | |
11 | - labelAlign="left" | |
12 | - @register="register" | |
13 | - > | |
14 | - <template #add="{ field }"> | |
15 | - <Button | |
16 | - style="margin-left: -575px; margin-top: 40px" | |
17 | - v-if="Number(field) === 0" | |
18 | - @click="add" | |
19 | - type="primary" | |
20 | - >+新增触发器</Button | |
2 | + <div> | |
3 | + <CollapseContainer title="触发器1" style="background-color: #eeeeee"> | |
4 | + <div style="position: relative"> | |
5 | + <BasicForm | |
6 | + :labelWidth="100" | |
7 | + :showResetButton="false" | |
8 | + :showSubmitButton="false" | |
9 | + :emptySpan="10" | |
10 | + @register="registerTrigger" | |
21 | 11 | > |
22 | - <Button | |
23 | - style="margin-left: 10px" | |
24 | - v-if="Number(field) === 0" | |
25 | - @click="handleSubmit" | |
26 | - type="primary" | |
27 | - >保存</Button | |
28 | - > | |
29 | - <br /> | |
30 | - <Button | |
31 | - style="margin-left: -456px; margin-top: 20px" | |
32 | - v-if="field > 0" | |
33 | - @click="add" | |
34 | - type="primary" | |
35 | - >+新增触发器</Button | |
36 | - > | |
37 | - <Button style="margin-left: 10px" v-if="field > 0" @click="handleSubmit" type="primary" | |
38 | - >保存</Button | |
39 | - > | |
40 | - <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
41 | - >删除</Button | |
42 | - > | |
43 | - <br /> | |
44 | - </template> | |
45 | - </BasicForm> | |
46 | - </CollapseContainer> | |
12 | + <template #add="{ field }"> | |
13 | + <Button | |
14 | + style="margin-left: -99px; margin-top: 0px; display: inline-block" | |
15 | + v-if="Number(field) === 0" | |
16 | + @click="add" | |
17 | + type="primary" | |
18 | + >+新增触发器</Button | |
19 | + > | |
20 | + <Button | |
21 | + style="margin-left: 20px; margin-top: -60px" | |
22 | + v-if="Number(field) === 0" | |
23 | + type="primary" | |
24 | + @click="del(field)" | |
25 | + >删除</Button | |
26 | + > | |
27 | + <Button | |
28 | + style="margin-left: 5px; margin-top: 35px" | |
29 | + v-if="field > 0" | |
30 | + @click="add" | |
31 | + type="primary" | |
32 | + >+新增触发器</Button | |
33 | + > | |
34 | + <Button style="margin-left: 10px" v-if="field > 0" @click="del(field)" type="primary" | |
35 | + >删除</Button | |
36 | + > | |
37 | + </template> | |
38 | + </BasicForm> | |
39 | + </div> | |
40 | + </CollapseContainer> | |
41 | + </div> | |
47 | 42 | </template> |
48 | 43 | <script lang="ts"> |
49 | - import { defineComponent, ref } from 'vue'; | |
44 | + import { defineComponent, reactive, ref, watch } from 'vue'; | |
50 | 45 | import { CollapseContainer } from '/@/components/Container/index'; |
51 | 46 | import { BasicForm, useForm } from '/@/components/Form/index'; |
52 | 47 | import { Input } from 'ant-design-vue'; |
53 | 48 | import { Button } from '/@/components/Button'; |
54 | - import { useTriggerDrawerSchema } from '../config.d'; | |
49 | + import { | |
50 | + useTriggerDrawerSchema, | |
51 | + isTime, | |
52 | + isUpAndDown, | |
53 | + isWenDu, | |
54 | + isScene, | |
55 | + isHand, | |
56 | + } from '../config.d'; | |
57 | + import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
55 | 58 | |
56 | 59 | export default defineComponent({ |
57 | 60 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
58 | - setup(_, { emit }) { | |
59 | - const [register, { appendSchemaByField, removeSchemaByFiled, getFieldsValue }] = useForm({ | |
61 | + props: ['deviceInfo'], | |
62 | + setup(props, { emit }) { | |
63 | + const [ | |
64 | + registerTrigger, | |
65 | + { resetFields, appendSchemaByField, removeSchemaByFiled, getFieldsValue, updateSchema }, | |
66 | + ] = useForm({ | |
60 | 67 | labelWidth: 100, |
61 | 68 | schemas: useTriggerDrawerSchema, |
62 | 69 | actionColOptions: { span: 24 }, |
63 | 70 | }); |
64 | - let formData = ref({}); | |
65 | - emits: ['get-triggerdata']; | |
66 | - async function handleSubmit() { | |
71 | + let formData = reactive({}); | |
72 | + let isJudge = ref(1); | |
73 | + if (isJudge.value == 1) { | |
74 | + resetFields(); | |
75 | + } | |
76 | + watch( | |
77 | + () => props.deviceInfo, | |
78 | + async (newV) => { | |
79 | + const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
80 | + options.items.forEach((v) => { | |
81 | + return (v.value = v.id); | |
82 | + }); | |
83 | + updateSchema({ | |
84 | + field: 'deviceId', | |
85 | + componentProps: { | |
86 | + options: options.items, | |
87 | + }, | |
88 | + }); | |
89 | + } | |
90 | + ); | |
91 | + | |
92 | + // async function handleSubmit() { | |
93 | + // try { | |
94 | + // formData = getFieldsValue(); | |
95 | + // console.log(formData); | |
96 | + // emit('get-triggerdata', formData); | |
97 | + // isJudge.value++; | |
98 | + // } catch (e) { | |
99 | + // console.log(e); | |
100 | + // } | |
101 | + // } | |
102 | + const n = ref(1); | |
103 | + function add() { | |
67 | 104 | try { |
68 | - const data = await getFieldsValue(); | |
69 | - formData.value = data; | |
70 | - emit('get-triggerdata', formData.value); | |
105 | + formData = getFieldsValue(); | |
106 | + console.log(formData); | |
107 | + emit('get-triggerdata', formData); | |
108 | + isJudge.value++; | |
71 | 109 | } catch (e) { |
72 | 110 | console.log(e); |
73 | 111 | } |
74 | - } | |
75 | - const n = ref(1); | |
76 | - function add() { | |
112 | + | |
77 | 113 | appendSchemaByField( |
78 | 114 | { |
79 | - field: `field${n.value}a`, | |
80 | - component: 'ApiSelect', | |
115 | + field: `kong${n.value}`, | |
116 | + label: `触发器${n.value + 1 + `...........`}`, | |
117 | + component: 'Slider', | |
118 | + colProps: { span: 24 }, | |
119 | + }, | |
120 | + '' | |
121 | + ); | |
122 | + appendSchemaByField( | |
123 | + { | |
124 | + field: `tiggerEvent${n.value}`, | |
125 | + label: '', | |
126 | + component: 'Select', | |
127 | + componentProps: { | |
128 | + placeholder: '设备触发', | |
129 | + options: [ | |
130 | + { label: '设备触发', value: 'DEVICE_ACT' }, | |
131 | + { label: '定时触发', value: 'TIME_ACT' }, | |
132 | + { label: '场景触发', value: 'SCENE_ACT' }, | |
133 | + { label: '手动触发', value: 'HAND_ACT' }, | |
134 | + ], | |
135 | + }, | |
136 | + colProps: { span: 12 }, | |
137 | + }, | |
138 | + '' | |
139 | + ); | |
140 | + appendSchemaByField( | |
141 | + { | |
142 | + field: `deviceId${n.value}`, | |
81 | 143 | label: '', |
144 | + component: 'Select', | |
82 | 145 | componentProps: { |
83 | - placeholder: '请选择', | |
146 | + placeholder: '请选择设备', | |
84 | 147 | }, |
148 | + ifShow: ({ values }) => | |
149 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
150 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
151 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
85 | 152 | colProps: { |
86 | - span: 8, | |
87 | - offset: 1, | |
153 | + span: 12, | |
88 | 154 | }, |
89 | - required: true, | |
90 | 155 | }, |
91 | 156 | '' |
92 | 157 | ); |
93 | 158 | appendSchemaByField( |
94 | 159 | { |
95 | - field: `field${n.value}b`, | |
160 | + field: `${n.value}no1`, | |
96 | 161 | component: 'Input', |
97 | 162 | label: '', |
98 | 163 | componentProps: { |
99 | - placeholder: '请输入', | |
164 | + placeholder: '请输入Cron表达式', | |
100 | 165 | }, |
101 | 166 | colProps: { |
102 | - span: 8, | |
103 | - offset: 1, | |
167 | + span: 12, | |
104 | 168 | }, |
105 | - required: true, | |
169 | + ifShow: ({ values }) => isTime(Reflect.get(values, `tiggerEvent${n.value}`)), | |
106 | 170 | }, |
107 | 171 | '' |
108 | 172 | ); |
109 | 173 | appendSchemaByField( |
110 | 174 | { |
111 | - field: `field${n.value}c`, | |
112 | - component: 'ApiSelect', | |
175 | + field: `touchWay${n.value}`, | |
113 | 176 | label: '', |
177 | + component: 'Select', | |
114 | 178 | componentProps: { |
115 | - placeholder: '请选择', | |
179 | + placeholder: '属性触发', | |
180 | + options: [ | |
181 | + { label: '属性触发', value: 'ATTRIBUTE_ACT' }, | |
182 | + { label: '上下线触发', value: 'UP_DOWN_ACT' }, | |
183 | + ], | |
116 | 184 | }, |
117 | - colProps: { | |
118 | - span: 8, | |
185 | + ifShow: ({ values }) => | |
186 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
187 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
188 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
189 | + colProps: { span: 12 }, | |
190 | + }, | |
191 | + '' | |
192 | + ); | |
193 | + appendSchemaByField( | |
194 | + { | |
195 | + field: `${n.value}no2`, | |
196 | + label: '', | |
197 | + component: 'Select', | |
198 | + componentProps: { | |
199 | + placeholder: '请选择上下线', | |
200 | + options: [ | |
201 | + { label: '上下线', value: '1' }, | |
202 | + { label: '上线', value: '2' }, | |
203 | + { label: '下线', value: '3' }, | |
204 | + ], | |
119 | 205 | }, |
120 | - required: true, | |
206 | + colProps: { span: 12 }, | |
207 | + ifShow: ({ values }) => | |
208 | + isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | |
209 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
210 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
211 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
121 | 212 | }, |
122 | 213 | '' |
123 | 214 | ); |
124 | 215 | appendSchemaByField( |
125 | 216 | { |
126 | - field: `field${n.value}d`, | |
127 | - component: 'ApiSelect', | |
217 | + field: `attributeChoose${n.value}`, | |
128 | 218 | label: '', |
219 | + component: 'Select', | |
129 | 220 | componentProps: { |
130 | - placeholder: '请选择', | |
221 | + placeholder: '全部属性', | |
222 | + options: [ | |
223 | + { label: '全部属性', value: 'All_ATTR' }, | |
224 | + { label: 'wendu', value: 'WENDU' }, | |
225 | + ], | |
131 | 226 | }, |
132 | - colProps: { | |
133 | - span: 8, | |
227 | + colProps: { span: 12 }, | |
228 | + ifShow: ({ values }) => | |
229 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
230 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
231 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
232 | + !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)), | |
233 | + }, | |
234 | + '' | |
235 | + ); | |
236 | + appendSchemaByField( | |
237 | + { | |
238 | + field: `compare${n.value}`, | |
239 | + label: '', | |
240 | + component: 'Select', | |
241 | + componentProps: { | |
242 | + placeholder: '', | |
243 | + options: [ | |
244 | + { label: '=', value: '0' }, | |
245 | + { label: '<', value: '1' }, | |
246 | + { label: '>', value: '2' }, | |
247 | + { label: '<=', value: '3' }, | |
248 | + { label: '>=', value: '4' }, | |
249 | + ], | |
134 | 250 | }, |
135 | - required: true, | |
251 | + ifShow: ({ values }) => | |
252 | + isWenDu(Reflect.get(values, 'attributeChoose')) && | |
253 | + !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | |
254 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
255 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
256 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
257 | + colProps: { span: 12 }, | |
136 | 258 | }, |
137 | 259 | '' |
138 | 260 | ); |
139 | 261 | appendSchemaByField( |
140 | 262 | { |
141 | - field: `field${n.value}e`, | |
142 | - component: 'ApiSelect', | |
263 | + field: `value${n.value}`, | |
264 | + component: 'Input', | |
143 | 265 | label: '', |
144 | 266 | componentProps: { |
145 | - placeholder: '请选择', | |
267 | + placeholder: '请输入比较值', | |
146 | 268 | }, |
269 | + ifShow: ({ values }) => | |
270 | + isWenDu(Reflect.get(values, 'attributeChoose')) && | |
271 | + !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | |
272 | + !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
273 | + !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | |
274 | + !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
147 | 275 | colProps: { |
148 | - span: 8, | |
276 | + span: 12, | |
149 | 277 | }, |
150 | - required: true, | |
151 | 278 | }, |
152 | 279 | '' |
153 | 280 | ); |
154 | 281 | appendSchemaByField( |
155 | 282 | { |
156 | - field: `field${n.value}f`, | |
157 | - component: 'Input', | |
283 | + field: `sceneLinkageId${n.value}`, | |
158 | 284 | label: '', |
285 | + component: 'Select', | |
286 | + colProps: { | |
287 | + span: 12, | |
288 | + }, | |
289 | + ifShow: ({ values }) => isScene(Reflect.get(values, `tiggerEvent${n.value}`)), | |
159 | 290 | componentProps: { |
160 | - placeholder: '请输入', | |
291 | + placeholder: '请输入场景触发器', | |
292 | + options: [ | |
293 | + { label: '场景触发器1', value: '1' }, | |
294 | + { label: '场景触发器2', value: '2' }, | |
295 | + { label: '场景触发器3', value: '3' }, | |
296 | + ], | |
161 | 297 | }, |
298 | + }, | |
299 | + '' | |
300 | + ); | |
301 | + appendSchemaByField( | |
302 | + { | |
303 | + field: `${n.value}no3`, | |
304 | + label: '', | |
305 | + component: 'ApiSelect', | |
162 | 306 | colProps: { |
163 | - span: 8, | |
307 | + span: 12, | |
308 | + }, | |
309 | + componentProps: { | |
310 | + placeholder: '暂不实现', | |
164 | 311 | }, |
165 | - required: true, | |
312 | + ifShow: ({ values }) => isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | |
166 | 313 | }, |
167 | 314 | '' |
168 | 315 | ); |
169 | 316 | appendSchemaByField( |
170 | 317 | { |
171 | 318 | field: `${n.value}`, |
172 | - component: 'ApiSelect', | |
173 | - label: ' ', | |
319 | + component: 'Input', | |
320 | + label: '', | |
174 | 321 | colProps: { |
175 | - span: 8, | |
176 | - offset: 1, | |
322 | + span: 12, | |
177 | 323 | }, |
178 | 324 | slot: 'add', |
179 | 325 | }, |
... | ... | @@ -181,21 +327,31 @@ |
181 | 327 | ); |
182 | 328 | n.value++; |
183 | 329 | } |
330 | + | |
184 | 331 | function del(field) { |
185 | 332 | removeSchemaByFiled([ |
186 | - `field${field}a`, | |
187 | - `field${field}b`, | |
188 | - `field${field}c`, | |
189 | - `field${field}d`, | |
190 | - `field${field}e`, | |
191 | - `field${field}f`, | |
192 | - `field${field}g`, | |
193 | - `field${field}h`, | |
333 | + `kong${field}`, | |
334 | + `tiggerEvent${field}`, | |
335 | + `deviceId${field}`, | |
336 | + `${field}no1`, | |
337 | + `touchWay${field}`, | |
338 | + `${field}no2`, | |
339 | + `attributeChoose${field}`, | |
340 | + `compare${field}`, | |
341 | + `value${field}`, | |
342 | + `sceneLinkageId${field}`, | |
343 | + `${field}no3`, | |
194 | 344 | `${field}`, |
195 | 345 | ]); |
196 | 346 | n.value--; |
197 | 347 | } |
198 | - return { register, handleSubmit, add, del, formData }; | |
348 | + return { registerTrigger, add, del }; | |
199 | 349 | }, |
200 | 350 | }); |
201 | 351 | </script> |
352 | + | |
353 | +<style> | |
354 | + .ant-slider-handle { | |
355 | + display: none !important; | |
356 | + } | |
357 | +</style> | ... | ... |
1 | -import { BasicColumn } from '/@/components/Table'; | |
2 | -import { FormSchema } from '/@/components/Table'; | |
3 | -import { findDictItemByCode } from '/@/api/system/dict'; | |
1 | +import { BasicColumn, FormSchema } from '/@/components/Table'; | |
2 | +import { ref } from 'vue'; | |
3 | +import { | |
4 | + screenLinkOrganizationGetApi, | |
5 | + screenLinkPagePutApi, | |
6 | +} from '/@/api/ruleengine/ruleengineApi'; | |
7 | +import { h } from 'vue'; | |
8 | +import { Switch } from 'ant-design-vue'; | |
9 | +import { useMessage } from '/@/hooks/web/useMessage'; | |
10 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
11 | + | |
12 | +/** | |
13 | + * 所使用的枚举值 | |
14 | + */ | |
15 | + | |
16 | +export enum TriggerEnum { | |
17 | + IS_DEVICE_ACT = 'DEVICE_ACT', | |
18 | + IS_TIME_ACT = 'TIME_ACT', | |
19 | + IS_SCENE_ACT = 'SCENE_ACT', | |
20 | + IS_HAND_ACT = 'HAND_ACT', | |
21 | + IS_MSG_NOTIFY = 'MSG_NOTIFY', | |
22 | + IS_DEVICE_STATUS = 'DEVICE_STATUS', | |
23 | + IS_TIME_ALL = 'TIME_ALL', | |
24 | +} | |
25 | + | |
26 | +export enum AttributeActionEnum { | |
27 | + IS_ATTRIBUTE_ACT = 'ATTRIBUTE_ACT', | |
28 | + IS_UP_DOWN_ACT = 'UP_DOWN_ACT', | |
29 | +} | |
30 | + | |
31 | +export enum AttrAndWenDuEnum { | |
32 | + IS_ALL_ATTR = 'ALL_ATTR', | |
33 | + IS_WENDU_ACT = 'WENDU', | |
34 | + IS_SHIDU = 'SHINDU', | |
35 | +} | |
36 | + | |
37 | +export const isShiDu = (type: string) => { | |
38 | + return type === AttrAndWenDuEnum.IS_SHIDU; | |
39 | +}; | |
40 | +export const isWenDu = (type: string) => { | |
41 | + return type === AttrAndWenDuEnum.IS_WENDU_ACT; | |
42 | +}; | |
43 | + | |
44 | +export const isTimeAll = (type: string) => { | |
45 | + return type === TriggerEnum.IS_TIME_ALL; | |
46 | +}; | |
47 | + | |
48 | +export const isMsg = (type: string) => { | |
49 | + return type === TriggerEnum.IS_MSG_NOTIFY; | |
50 | +}; | |
51 | + | |
52 | +export const isUpAndDown = (type: string) => { | |
53 | + return type === AttributeActionEnum.IS_UP_DOWN_ACT; | |
54 | +}; | |
55 | + | |
56 | +export const isDevice = (type: string) => { | |
57 | + return type === TriggerEnum.IS_DEVICE_ACT; | |
58 | +}; | |
59 | + | |
60 | +export const isTime = (type: string) => { | |
61 | + return type === TriggerEnum.IS_TIME_ACT; | |
62 | +}; | |
63 | + | |
64 | +export const isScene = (type: string) => { | |
65 | + return type === TriggerEnum.IS_SCENE_ACT; | |
66 | +}; | |
67 | + | |
68 | +export const isHand = (type: string) => { | |
69 | + return type === TriggerEnum.IS_HAND_ACT; | |
70 | +}; | |
4 | 71 | |
5 | 72 | export const columns: BasicColumn[] = [ |
6 | 73 | { |
... | ... | @@ -10,20 +77,52 @@ export const columns: BasicColumn[] = [ |
10 | 77 | }, |
11 | 78 | { |
12 | 79 | title: '触发方式', |
13 | - dataIndex: 'act', | |
80 | + dataIndex: 'triggerEvent', | |
81 | + format: (text: string, record: Recordable) => { | |
82 | + return record.triggers[0]?.triggerEvent == 'DEVICE_ACT' | |
83 | + ? '设备触发' | |
84 | + : record.triggers[0]?.triggerEvent == 'TIME_ACT' | |
85 | + ? '定时触发' | |
86 | + : record.triggers[0]?.triggerEvent == 'SCENE_ACT' | |
87 | + ? '场景触发' | |
88 | + : '手动触发'; | |
89 | + }, | |
14 | 90 | width: 200, |
15 | 91 | }, |
16 | 92 | { |
17 | 93 | title: '状态', |
18 | 94 | dataIndex: 'status', |
19 | - width: 200, | |
20 | - component: 'RadioButtonGroup', | |
21 | - defaultValue: 0, | |
22 | - componentProps: { | |
23 | - options: [ | |
24 | - { label: '启用', value: 1 }, | |
25 | - { label: '停用', value: 0 }, | |
26 | - ], | |
95 | + width: 120, | |
96 | + customRender: ({ record }) => { | |
97 | + if (!Reflect.has(record, 'pendingStatus')) { | |
98 | + record.pendingStatus = false; | |
99 | + } | |
100 | + return h(Switch, { | |
101 | + checked: record.status === 1, | |
102 | + checkedChildren: '已启用', | |
103 | + unCheckedChildren: '已禁用', | |
104 | + loading: record.pendingStatus, | |
105 | + onChange(checked: boolean) { | |
106 | + record.pendingStatus = true; | |
107 | + const newStatus = checked ? 1 : 0; | |
108 | + const { createMessage } = useMessage(); | |
109 | + screenLinkPagePutApi(record.id, newStatus) | |
110 | + .then(() => { | |
111 | + record.status = newStatus; | |
112 | + if (record.status == 1) { | |
113 | + createMessage.success(`已启用`); | |
114 | + } else { | |
115 | + createMessage.error('已禁用'); | |
116 | + } | |
117 | + }) | |
118 | + .catch(() => { | |
119 | + createMessage.error('已禁用'); | |
120 | + }) | |
121 | + .finally(() => { | |
122 | + record.pendingStatus = false; | |
123 | + }); | |
124 | + }, | |
125 | + }); | |
27 | 126 | }, |
28 | 127 | }, |
29 | 128 | { |
... | ... | @@ -38,11 +137,13 @@ export const columns: BasicColumn[] = [ |
38 | 137 | }, |
39 | 138 | ]; |
40 | 139 | |
140 | +export const getData = ref(null); | |
141 | + | |
41 | 142 | export const formSchema: FormSchema[] = [ |
42 | 143 | { |
43 | 144 | field: 'name', |
44 | 145 | label: '场景联动名称', |
45 | - colProps: { span: 20 }, | |
146 | + colProps: { span: 12 }, | |
46 | 147 | required: true, |
47 | 148 | component: 'Input', |
48 | 149 | componentProps: { |
... | ... | @@ -50,24 +151,40 @@ export const formSchema: FormSchema[] = [ |
50 | 151 | }, |
51 | 152 | }, |
52 | 153 | { |
154 | + required: true, | |
53 | 155 | field: 'organizationId', |
54 | 156 | label: '所属组织', |
55 | - required: true, | |
56 | - colProps: { span: 20 }, | |
57 | - component: 'ApiSelect', | |
58 | - componentProps: { | |
59 | - api: findDictItemByCode, | |
60 | - params: { | |
61 | - dictCode: 'message_type', | |
62 | - }, | |
63 | - labelField: 'itemText', | |
64 | - valueField: 'itemValue', | |
157 | + colProps: { span: 12 }, | |
158 | + component: 'ApiTreeSelect', | |
159 | + componentProps: ({ formModel, formActionType }) => { | |
160 | + return { | |
161 | + api: async () => { | |
162 | + const data = await screenLinkOrganizationGetApi(); | |
163 | + copyTransFun(data as any as any[]); | |
164 | + return data; | |
165 | + }, | |
166 | + onChange: async (v) => { | |
167 | + console.log(v); | |
168 | + if (v == undefined) { | |
169 | + formModel.deviceId = undefined; | |
170 | + const { updateSchema } = formActionType; | |
171 | + updateSchema({ | |
172 | + field: 'deviceId', | |
173 | + componentProps: { | |
174 | + options: undefined, | |
175 | + }, | |
176 | + }); | |
177 | + } else { | |
178 | + getData.value = v; | |
179 | + } | |
180 | + }, | |
181 | + }; | |
65 | 182 | }, |
66 | 183 | }, |
67 | 184 | { |
68 | 185 | field: 'description', |
69 | 186 | label: '描述', |
70 | - // colProps: { span: 20 }, | |
187 | + colProps: { span: 12 }, | |
71 | 188 | component: 'InputTextArea', |
72 | 189 | componentProps: { |
73 | 190 | placeholder: '请输入描述', |
... | ... | @@ -79,11 +196,15 @@ export const searchFormSchema: FormSchema[] = [ |
79 | 196 | { |
80 | 197 | field: 'organizationId', |
81 | 198 | label: '所属组织', |
199 | + colProps: { span: 8 }, | |
82 | 200 | component: 'ApiTreeSelect', |
83 | 201 | componentProps: { |
84 | - placeholder: '请输入所属组织', | |
202 | + api: async () => { | |
203 | + const data = await screenLinkOrganizationGetApi(); | |
204 | + copyTransFun(data as any as any[]); | |
205 | + return data; | |
206 | + }, | |
85 | 207 | }, |
86 | - colProps: { span: 7 }, | |
87 | 208 | }, |
88 | 209 | { |
89 | 210 | field: 'name', |
... | ... | @@ -96,10 +217,14 @@ export const searchFormSchema: FormSchema[] = [ |
96 | 217 | }, |
97 | 218 | { |
98 | 219 | field: 'status', |
99 | - label: '状态', | |
100 | - component: 'ApiSelect', | |
220 | + label: '设备状态', | |
221 | + component: 'Select', | |
101 | 222 | componentProps: { |
102 | 223 | placeholder: '请选择状态', |
224 | + options: [ | |
225 | + { label: '已启用', value: '1' }, | |
226 | + { label: '未启用', value: '0' }, | |
227 | + ], | |
103 | 228 | }, |
104 | 229 | colProps: { span: 4 }, |
105 | 230 | }, |
... | ... | @@ -107,96 +232,177 @@ export const searchFormSchema: FormSchema[] = [ |
107 | 232 | |
108 | 233 | export const useTriggerDrawerSchema: FormSchema[] = [ |
109 | 234 | { |
110 | - field: 'field0a', | |
235 | + field: 'triggerEvent', | |
111 | 236 | label: '', |
112 | - component: 'ApiSelect', | |
237 | + component: 'Select', | |
113 | 238 | componentProps: { |
114 | - api: findDictItemByCode, | |
115 | - params: { | |
116 | - dictCode: 'message_type', | |
117 | - }, | |
118 | - labelField: 'itemText', | |
119 | - valueField: 'itemValue', | |
120 | - }, | |
121 | - colProps: { | |
122 | - span: 6, | |
239 | + placeholder: '设备触发', | |
240 | + options: [ | |
241 | + { label: '设备触发', value: 'DEVICE_ACT' }, | |
242 | + { label: '定时触发', value: 'TIME_ACT' }, | |
243 | + { label: '场景触发', value: 'SCENE_ACT' }, | |
244 | + { label: '手动触发', value: 'HAND_ACT' }, | |
245 | + ], | |
123 | 246 | }, |
124 | - required: true, | |
247 | + colProps: { span: 12 }, | |
125 | 248 | }, |
126 | 249 | { |
127 | - field: 'field0b', | |
250 | + field: 'deviceId', | |
128 | 251 | label: '', |
129 | - component: 'Input', | |
252 | + component: 'Select', | |
130 | 253 | componentProps: { |
131 | - placeholder: '请输入', | |
132 | - }, | |
133 | - onChange: (e: any) => { | |
134 | - console.log(e); | |
254 | + placeholder: '请选择设备', | |
135 | 255 | }, |
256 | + ifShow: ({ values }) => | |
257 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
258 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
259 | + !isHand(Reflect.get(values, 'triggerEvent')), | |
136 | 260 | colProps: { |
137 | - span: 6, | |
261 | + span: 12, | |
138 | 262 | }, |
139 | - required: true, | |
140 | 263 | }, |
141 | 264 | { |
142 | - field: 'field0c', | |
265 | + field: '', | |
266 | + component: 'Input', | |
143 | 267 | label: '', |
144 | - component: 'ApiSelect', | |
145 | 268 | componentProps: { |
146 | - api: findDictItemByCode, | |
147 | - params: { | |
148 | - dictCode: 'message_type', | |
149 | - }, | |
150 | - labelField: 'itemText', | |
151 | - valueField: 'itemValue', | |
269 | + placeholder: '请输入Cron表达式', | |
152 | 270 | }, |
153 | 271 | colProps: { |
154 | - span: 6, | |
272 | + span: 12, | |
155 | 273 | }, |
156 | - required: true, | |
274 | + ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerEvent')), | |
157 | 275 | }, |
158 | 276 | { |
159 | - field: 'field0d', | |
160 | - component: 'ApiSelect', | |
277 | + field: 'touchWay', | |
161 | 278 | label: '', |
279 | + component: 'Select', | |
162 | 280 | componentProps: { |
163 | - placeholder: '请选择', | |
281 | + placeholder: '属性触发', | |
282 | + options: [ | |
283 | + { label: '属性触发', value: 'ATTRIBUTE_ACT' }, | |
284 | + { label: '上下线触发', value: 'UP_DOWN_ACT' }, | |
285 | + ], | |
164 | 286 | }, |
165 | - colProps: { | |
166 | - span: 6, | |
287 | + ifShow: ({ values }) => | |
288 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
289 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
290 | + !isHand(Reflect.get(values, 'triggerEvent')), | |
291 | + colProps: { span: 12 }, | |
292 | + }, | |
293 | + { | |
294 | + field: '', | |
295 | + label: '', | |
296 | + component: 'Select', | |
297 | + componentProps: { | |
298 | + placeholder: '请选择上下线', | |
299 | + options: [ | |
300 | + { label: '上下线', value: '1' }, | |
301 | + { label: '上线', value: '2' }, | |
302 | + { label: '下线', value: '3' }, | |
303 | + ], | |
167 | 304 | }, |
168 | - required: true, | |
305 | + colProps: { span: 12 }, | |
306 | + ifShow: ({ values }) => | |
307 | + isUpAndDown(Reflect.get(values, 'touchWay')) && | |
308 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
309 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
310 | + !isHand(Reflect.get(values, 'triggerEvent')), | |
169 | 311 | }, |
170 | 312 | { |
171 | - field: 'field0e', | |
172 | - component: 'ApiSelect', | |
313 | + field: 'attributeChoose', | |
173 | 314 | label: '', |
315 | + component: 'Select', | |
174 | 316 | componentProps: { |
175 | - placeholder: '请选择', | |
317 | + placeholder: '全部属性', | |
318 | + options: [ | |
319 | + { label: '全部属性', value: 'All_ATTR' }, | |
320 | + { label: 'wendu', value: 'WENDU' }, | |
321 | + ], | |
176 | 322 | }, |
177 | - colProps: { | |
178 | - span: 6, | |
323 | + ifShow: ({ values }) => | |
324 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
325 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
326 | + !isHand(Reflect.get(values, 'triggerEvent')) && | |
327 | + !isUpAndDown(Reflect.get(values, 'touchWay')), | |
328 | + colProps: { span: 12 }, | |
329 | + }, | |
330 | + { | |
331 | + field: 'compare', | |
332 | + label: '', | |
333 | + component: 'Select', | |
334 | + componentProps: { | |
335 | + placeholder: '', | |
336 | + options: [ | |
337 | + { label: '=', value: '0' }, | |
338 | + { label: '<', value: '1' }, | |
339 | + { label: '>', value: '2' }, | |
340 | + { label: '<=', value: '3' }, | |
341 | + { label: '>=', value: '4' }, | |
342 | + ], | |
179 | 343 | }, |
180 | - required: true, | |
344 | + ifShow: ({ values }) => | |
345 | + isWenDu(Reflect.get(values, 'attributeChoose')) && | |
346 | + !isUpAndDown(Reflect.get(values, 'touchWay')) && | |
347 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
348 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
349 | + !isHand(Reflect.get(values, 'triggerEvent')), | |
350 | + colProps: { span: 12 }, | |
181 | 351 | }, |
182 | 352 | { |
183 | - field: 'field0f', | |
353 | + field: 'value', | |
184 | 354 | component: 'Input', |
185 | 355 | label: '', |
186 | 356 | componentProps: { |
187 | - placeholder: '请输入', | |
357 | + placeholder: '请输入比较值', | |
358 | + }, | |
359 | + ifShow: ({ values }) => | |
360 | + isWenDu(Reflect.get(values, 'attributeChoose')) && | |
361 | + !isUpAndDown(Reflect.get(values, 'touchWay')) && | |
362 | + !isTime(Reflect.get(values, 'triggerEvent')) && | |
363 | + !isScene(Reflect.get(values, 'triggerEvent')) && | |
364 | + !isHand(Reflect.get(values, 'triggerEvent')), | |
365 | + colProps: { | |
366 | + span: 12, | |
188 | 367 | }, |
368 | + }, | |
369 | + | |
370 | + { | |
371 | + field: 'sceneLinkageId', | |
372 | + label: '', | |
373 | + component: 'Select', | |
189 | 374 | colProps: { |
190 | - span: 6, | |
375 | + span: 12, | |
191 | 376 | }, |
192 | - required: true, | |
377 | + componentProps: { | |
378 | + placeholder: '请输入场景触发器', | |
379 | + options: [ | |
380 | + { label: '场景触发器1', value: '1' }, | |
381 | + { label: '场景触发器2', value: '2' }, | |
382 | + { label: '场景触发器3', value: '3' }, | |
383 | + ], | |
384 | + }, | |
385 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerEvent')), | |
193 | 386 | }, |
387 | + | |
194 | 388 | { |
195 | - field: '0', | |
389 | + field: '', | |
390 | + label: '', | |
196 | 391 | component: 'ApiSelect', |
392 | + colProps: { | |
393 | + span: 12, | |
394 | + }, | |
395 | + componentProps: { | |
396 | + placeholder: '暂不实现', | |
397 | + }, | |
398 | + ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerEvent')), | |
399 | + }, | |
400 | + { | |
401 | + field: '0', | |
402 | + component: 'Input', | |
197 | 403 | label: ' ', |
198 | 404 | colProps: { |
199 | - span: 6, | |
405 | + span: 12, | |
200 | 406 | }, |
201 | 407 | slot: 'add', |
202 | 408 | }, |
... | ... | @@ -204,86 +410,147 @@ export const useTriggerDrawerSchema: FormSchema[] = [ |
204 | 410 | |
205 | 411 | export const useConditionDrawerSchema: FormSchema[] = [ |
206 | 412 | { |
207 | - field: 'field0a', | |
208 | - component: 'ApiSelect', | |
413 | + field: 'status', | |
209 | 414 | label: '', |
415 | + component: 'Select', | |
210 | 416 | componentProps: { |
211 | - placeholder: '请选择', | |
212 | - }, | |
213 | - colProps: { | |
214 | - span: 6, | |
417 | + placeholder: '设备状态', | |
418 | + options: [ | |
419 | + { label: '设备触发', value: 'DEVICE_STATUS' }, | |
420 | + { label: '时间范围', value: 'TIME_ALL' }, | |
421 | + ], | |
215 | 422 | }, |
216 | - required: true, | |
423 | + colProps: { span: 12 }, | |
217 | 424 | }, |
218 | 425 | { |
219 | - field: 'field0b', | |
220 | - component: 'Input', | |
426 | + field: 'deviceId', | |
221 | 427 | label: '', |
428 | + component: 'Select', | |
222 | 429 | componentProps: { |
223 | - placeholder: '请输入', | |
430 | + placeholder: '请选择设备', | |
431 | + }, | |
432 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | |
433 | + colProps: { | |
434 | + span: 12, | |
224 | 435 | }, |
225 | - onChange: (e: any) => { | |
226 | - console.log(e); | |
436 | + }, | |
437 | + { | |
438 | + field: 'createTime', | |
439 | + component: 'DatePicker', | |
440 | + componentProps: { | |
441 | + placeholder: '请选择起始时间', | |
227 | 442 | }, |
228 | 443 | colProps: { |
229 | - span: 6, | |
444 | + span: 12, | |
230 | 445 | }, |
231 | - required: true, | |
446 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | |
232 | 447 | }, |
233 | 448 | { |
234 | - field: 'field0c', | |
235 | - component: 'ApiSelect', | |
236 | - label: '', | |
449 | + field: 'updateTime', | |
450 | + component: 'DatePicker', | |
237 | 451 | componentProps: { |
238 | - placeholder: '请选择', | |
452 | + placeholder: '请选择结束时间', | |
239 | 453 | }, |
240 | 454 | colProps: { |
241 | - span: 6, | |
455 | + span: 12, | |
242 | 456 | }, |
243 | - required: true, | |
457 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | |
244 | 458 | }, |
245 | 459 | { |
246 | - field: 'field0d', | |
247 | - component: 'ApiSelect', | |
460 | + field: 'property', | |
248 | 461 | label: '', |
462 | + component: 'Select', | |
249 | 463 | componentProps: { |
250 | - placeholder: '请选择', | |
464 | + placeholder: '请选择或者输入属性', | |
465 | + options: [ | |
466 | + { label: 'shidu', value: 'SHINDU' }, | |
467 | + { label: 'wendu', value: 'WENDU' }, | |
468 | + ], | |
251 | 469 | }, |
252 | - colProps: { | |
253 | - span: 6, | |
470 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | |
471 | + colProps: { span: 12 }, | |
472 | + }, | |
473 | + { | |
474 | + field: '', | |
475 | + label: '', | |
476 | + component: 'Input', | |
477 | + componentProps: { | |
478 | + placeholder: '无', | |
479 | + style: { | |
480 | + visibility: 'hidden', | |
481 | + }, | |
254 | 482 | }, |
255 | - required: true, | |
483 | + colProps: { span: 12 }, | |
256 | 484 | }, |
257 | 485 | { |
258 | - field: 'field0e', | |
259 | - component: 'ApiSelect', | |
486 | + field: 'compare', | |
487 | + label: '', | |
488 | + component: 'Select', | |
489 | + componentProps: { | |
490 | + placeholder: '', | |
491 | + options: [ | |
492 | + { label: '=', value: '0' }, | |
493 | + { label: '<', value: '1' }, | |
494 | + { label: '>', value: '2' }, | |
495 | + { label: '<=', value: '3' }, | |
496 | + { label: '>=', value: '4' }, | |
497 | + ], | |
498 | + }, | |
499 | + ifShow: ({ values }) => | |
500 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
501 | + colProps: { span: 12 }, | |
502 | + }, | |
503 | + { | |
504 | + field: 'value', | |
505 | + component: 'Input', | |
260 | 506 | label: '', |
261 | 507 | componentProps: { |
262 | - placeholder: '请选择', | |
508 | + placeholder: '请输入比较值', | |
263 | 509 | }, |
510 | + ifShow: ({ values }) => | |
511 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
264 | 512 | colProps: { |
265 | - span: 6, | |
513 | + span: 12, | |
266 | 514 | }, |
267 | - required: true, | |
268 | 515 | }, |
516 | + | |
269 | 517 | { |
270 | - field: 'field0f', | |
518 | + field: 'compare', | |
519 | + label: '', | |
520 | + component: 'Select', | |
521 | + componentProps: { | |
522 | + placeholder: '', | |
523 | + options: [ | |
524 | + { label: '=', value: '0' }, | |
525 | + { label: '<', value: '1' }, | |
526 | + { label: '>', value: '2' }, | |
527 | + { label: '<=', value: '3' }, | |
528 | + { label: '>=', value: '4' }, | |
529 | + ], | |
530 | + }, | |
531 | + ifShow: ({ values }) => | |
532 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
533 | + colProps: { span: 12 }, | |
534 | + }, | |
535 | + { | |
536 | + field: 'value', | |
271 | 537 | component: 'Input', |
272 | 538 | label: '', |
273 | 539 | componentProps: { |
274 | - placeholder: '请输入', | |
540 | + placeholder: '请输入比较值', | |
275 | 541 | }, |
542 | + ifShow: ({ values }) => | |
543 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | |
276 | 544 | colProps: { |
277 | - span: 6, | |
545 | + span: 12, | |
278 | 546 | }, |
279 | - required: true, | |
280 | 547 | }, |
281 | 548 | { |
282 | 549 | field: '0', |
283 | - component: 'ApiSelect', | |
550 | + component: 'Input', | |
284 | 551 | label: ' ', |
285 | 552 | colProps: { |
286 | - span: 6, | |
553 | + span: 12, | |
287 | 554 | }, |
288 | 555 | slot: 'add', |
289 | 556 | }, |
... | ... | @@ -291,86 +558,119 @@ export const useConditionDrawerSchema: FormSchema[] = [ |
291 | 558 | |
292 | 559 | export const useActionDrawerSchema: FormSchema[] = [ |
293 | 560 | { |
294 | - field: 'field0a', | |
295 | - component: 'ApiSelect', | |
561 | + field: 'outTarget', | |
562 | + label: '', | |
563 | + component: 'Select', | |
564 | + componentProps: { | |
565 | + placeholder: '设备输出', | |
566 | + options: [ | |
567 | + { label: '设备输出', value: 'DEVICE_OUT' }, | |
568 | + { label: '消息通知', value: 'MSG_NOTIFY' }, | |
569 | + { label: '场景联动', value: 'SCENE_ACT' }, | |
570 | + ], | |
571 | + }, | |
572 | + colProps: { span: 12 }, | |
573 | + }, | |
574 | + { | |
575 | + field: 'deviceId', | |
296 | 576 | label: '', |
577 | + component: 'Select', | |
297 | 578 | componentProps: { |
298 | - placeholder: '请选择', | |
579 | + placeholder: '请选择设备', | |
299 | 580 | }, |
581 | + ifShow: ({ values }) => | |
582 | + !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), | |
300 | 583 | colProps: { |
301 | - span: 6, | |
584 | + span: 12, | |
302 | 585 | }, |
303 | - required: true, | |
304 | 586 | }, |
305 | 587 | { |
306 | - field: 'field0b', | |
588 | + field: 'command', | |
307 | 589 | component: 'Input', |
308 | 590 | label: '', |
309 | 591 | componentProps: { |
310 | - placeholder: '请输入', | |
311 | - }, | |
312 | - onChange: (e: any) => { | |
313 | - console.log(e); | |
592 | + placeholder: '请输入下发指定', | |
314 | 593 | }, |
594 | + ifShow: ({ values }) => | |
595 | + !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), | |
315 | 596 | colProps: { |
316 | - span: 6, | |
597 | + span: 12, | |
317 | 598 | }, |
318 | - required: true, | |
319 | 599 | }, |
320 | 600 | { |
321 | - field: 'field0c', | |
322 | - component: 'ApiSelect', | |
601 | + field: '', | |
323 | 602 | label: '', |
603 | + component: 'Input', | |
324 | 604 | componentProps: { |
325 | - placeholder: '请选择', | |
326 | - }, | |
327 | - colProps: { | |
328 | - span: 6, | |
605 | + placeholder: '无', | |
606 | + style: { | |
607 | + visibility: 'hidden', | |
608 | + }, | |
329 | 609 | }, |
330 | - required: true, | |
610 | + colProps: { span: 12 }, | |
331 | 611 | }, |
332 | 612 | { |
333 | - field: 'field0d', | |
334 | - component: 'ApiSelect', | |
613 | + field: '', | |
614 | + component: 'Input', | |
335 | 615 | label: '', |
336 | 616 | componentProps: { |
337 | - placeholder: '请选择', | |
617 | + placeholder: '暂不实现', | |
338 | 618 | }, |
339 | 619 | colProps: { |
340 | - span: 6, | |
620 | + span: 12, | |
341 | 621 | }, |
342 | - required: true, | |
622 | + ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), | |
343 | 623 | }, |
344 | 624 | { |
345 | - field: 'field0e', | |
346 | - component: 'ApiSelect', | |
625 | + field: '', | |
347 | 626 | label: '', |
627 | + component: 'Input', | |
348 | 628 | componentProps: { |
349 | - placeholder: '请选择', | |
629 | + placeholder: '无', | |
630 | + style: { | |
631 | + visibility: 'hidden', | |
632 | + }, | |
350 | 633 | }, |
634 | + colProps: { span: 12 }, | |
635 | + ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), | |
636 | + }, | |
637 | + { | |
638 | + field: 'sceneLinkageId', | |
639 | + label: '', | |
640 | + component: 'Select', | |
351 | 641 | colProps: { |
352 | - span: 6, | |
642 | + span: 12, | |
353 | 643 | }, |
354 | - required: true, | |
644 | + componentProps: { | |
645 | + placeholder: '请选择场景触发器', | |
646 | + options: [ | |
647 | + { label: '场景触发器1', value: '1' }, | |
648 | + { label: '场景触发器2', value: '2' }, | |
649 | + { label: '场景触发器3', value: '3' }, | |
650 | + { label: '场景触发器4', value: '4' }, | |
651 | + ], | |
652 | + }, | |
653 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | |
355 | 654 | }, |
356 | 655 | { |
357 | - field: 'field0f', | |
358 | - component: 'Input', | |
656 | + field: '', | |
359 | 657 | label: '', |
658 | + component: 'Input', | |
360 | 659 | componentProps: { |
361 | - placeholder: '请输入', | |
362 | - }, | |
363 | - colProps: { | |
364 | - span: 6, | |
660 | + placeholder: '无', | |
661 | + style: { | |
662 | + visibility: 'hidden', | |
663 | + }, | |
365 | 664 | }, |
366 | - required: true, | |
665 | + colProps: { span: 12 }, | |
666 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | |
367 | 667 | }, |
368 | 668 | { |
369 | 669 | field: '0', |
370 | - component: 'ApiSelect', | |
670 | + component: 'Input', | |
371 | 671 | label: ' ', |
372 | 672 | colProps: { |
373 | - span: 6, | |
673 | + span: 12, | |
374 | 674 | }, |
375 | 675 | slot: 'add', |
376 | 676 | }, | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <BasicTable :clickToRowSelect="true" @register="registerTable"> | |
3 | + <BasicTable | |
4 | + :rowSelection="{ type: 'checkbox' }" | |
5 | + @selection-change="useSelectionChange" | |
6 | + @register="registerTable" | |
7 | + > | |
4 | 8 | <template #toolbar> |
5 | 9 | <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> |
6 | 10 | <a-button type="error" @click="handleToolbarDel"> 删除 </a-button> |
... | ... | @@ -34,42 +38,39 @@ |
34 | 38 | </div> |
35 | 39 | </template> |
36 | 40 | <script lang="ts"> |
37 | - import { defineComponent, ref, provide, watchEffect } from 'vue'; | |
38 | - import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | |
41 | + import { defineComponent, reactive } from 'vue'; | |
39 | 42 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
40 | 43 | import { useDrawer } from '/@/components/Drawer'; |
41 | 44 | import SceneLinkAgeDrawer from './useDrawer.vue'; |
42 | 45 | import { columns, searchFormSchema } from './config.d'; |
43 | 46 | import { useMessage } from '/@/hooks/web/useMessage'; |
44 | - import { | |
45 | - screenLinkPageGetApi, | |
46 | - screenLinkPageAddApi, | |
47 | - screenLinkPageUpdateApi, | |
48 | - screenLinkPageDeleteApi, | |
49 | - } from '/@/api/ruleengine/ruleengineApi'; | |
47 | + import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | |
50 | 48 | |
51 | 49 | export default defineComponent({ |
52 | - name: 'DeviceManagement', | |
50 | + name: 'index', | |
53 | 51 | components: { BasicTable, SceneLinkAgeDrawer, TableAction }, |
54 | 52 | setup() { |
55 | - let echoEditData = ref({}); | |
53 | + let selectedRowKeys: Array<string> = []; | |
54 | + let echoEditData = reactive({}); | |
56 | 55 | const [registerDrawer, { openDrawer }] = useDrawer(); |
57 | 56 | const { createMessage } = useMessage(); |
58 | - const [registerTable, { reload }] = useTable({ | |
57 | + const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
59 | 58 | title: '', |
59 | + clickToRowSelect: false, | |
60 | 60 | api: screenLinkPageGetApi, |
61 | 61 | columns, |
62 | 62 | formConfig: { |
63 | 63 | labelWidth: 120, |
64 | 64 | schemas: searchFormSchema, |
65 | 65 | }, |
66 | + filterFn: (registerTable) => { | |
67 | + return registerTable; | |
68 | + }, | |
69 | + rowKey: 'id', | |
66 | 70 | useSearchForm: true, |
67 | 71 | showTableSetting: true, |
68 | 72 | bordered: true, |
69 | 73 | showIndexColumn: false, |
70 | - rowSelection: { | |
71 | - type: 'checkbox', | |
72 | - }, | |
73 | 74 | actionColumn: { |
74 | 75 | width: 180, |
75 | 76 | title: '操作', |
... | ... | @@ -84,32 +85,35 @@ |
84 | 85 | isUpdate: false, |
85 | 86 | }); |
86 | 87 | } |
87 | - function handleToolbarDel() { | |
88 | + | |
89 | + const useSelectionChange = () => { | |
90 | + selectedRowKeys = getSelectRowKeys(); | |
91 | + }; | |
92 | + | |
93 | + async function handleToolbarDel() { | |
94 | + await screenLinkPageDeleteApi(selectedRowKeys); | |
88 | 95 | createMessage.success('删除成功'); |
96 | + reload(); | |
89 | 97 | } |
90 | - console.log(echoEditData.value); | |
91 | 98 | |
92 | 99 | function handleEdit(record: Recordable) { |
93 | 100 | openDrawer(true, { |
94 | 101 | record, |
95 | 102 | isUpdate: true, |
96 | 103 | }); |
97 | - echoEditData.value = record; | |
104 | + echoEditData = record; | |
98 | 105 | } |
99 | - // watchEffect(() => { | |
100 | - // console.log(echoEditData.value); | |
101 | - // provide('getEchoData', echoEditData.value); | |
102 | - // }); | |
103 | - function handleDelete(record: Recordable) { | |
106 | + async function handleDelete(record: Recordable) { | |
104 | 107 | let ids = [record.id]; |
105 | - console.log(ids); | |
108 | + await screenLinkPageDeleteApi(ids); | |
106 | 109 | createMessage.success('删除成功'); |
110 | + reload(); | |
107 | 111 | } |
108 | - | |
109 | 112 | function handleSuccess() { |
110 | 113 | reload(); |
111 | 114 | } |
112 | 115 | return { |
116 | + useSelectionChange, | |
113 | 117 | echoEditData, |
114 | 118 | registerTable, |
115 | 119 | registerDrawer, |
... | ... | @@ -118,8 +122,6 @@ |
118 | 122 | handleEdit, |
119 | 123 | handleDelete, |
120 | 124 | handleSuccess, |
121 | - DeviceTypeEnum, | |
122 | - DeviceState, | |
123 | 125 | }; |
124 | 126 | }, |
125 | 127 | }); | ... | ... |
... | ... | @@ -8,18 +8,18 @@ |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | 10 | <BasicForm @register="registerForm" /> |
11 | - <AddTriggerForm @get-triggerdata="getTriggerData" /> | |
12 | - <AddConditiForm @get-conditiondata="getFormConditiData" /> | |
13 | - <AddActionForm @get-actiondata="getFormActionData" /> | |
11 | + <AddTriggerForm :deviceInfo="getDeviceInfo" @get-triggerdata="getTriggerData" /> | |
12 | + <AddConditiForm :deviceInfo1="getDeviceInfo1" @get-conditiondata="getFormConditiData" /> | |
13 | + <AddActionForm :deviceInfo2="getDeviceInfo2" @get-actiondata="getFormActionData" /> | |
14 | 14 | </BasicDrawer> |
15 | 15 | </template> |
16 | 16 | <script lang="ts"> |
17 | - import { defineComponent, ref, computed, unref, inject, reactive, defineProps } from 'vue'; | |
17 | + import { defineComponent, ref, computed, unref, reactive, watch } from 'vue'; | |
18 | 18 | import { BasicForm, useForm } from '/@/components/Form'; |
19 | - import { formSchema } from './config.d'; | |
19 | + import { formSchema, getData } from './config.d'; | |
20 | 20 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
21 | - // import { saveOrEditMessageConfig } from '/@/api/message/config'; | |
22 | - // import { useMessage } from '/@/hooks/web/useMessage'; | |
21 | + import { screenLinkPageAddApi, screenLinkPageUpdateApi } from '/@/api/ruleengine/ruleengineApi'; | |
22 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
23 | 23 | import AddTriggerForm from './addForm/trigger.vue'; |
24 | 24 | import AddActionForm from './addForm/doaction.vue'; |
25 | 25 | import AddConditiForm from './addForm/condition.vue'; |
... | ... | @@ -28,57 +28,110 @@ |
28 | 28 | name: 'ConfigDrawer', |
29 | 29 | components: { BasicDrawer, BasicForm, AddTriggerForm, AddActionForm, AddConditiForm }, |
30 | 30 | emits: ['success', 'register'], |
31 | - setup() { | |
32 | - const props = defineProps({ | |
33 | - getChildrenData: Object, | |
34 | - }); | |
35 | - console.log(props); | |
36 | - const getParentEchoData = reactive({}); | |
31 | + setup(_, { emit }) { | |
32 | + const { createMessage } = useMessage(); | |
37 | 33 | const isUpdate = ref(true); |
38 | - const getAllFormData = ref({}); | |
39 | - const getTriggerFormData = ref({}); | |
40 | - const getConditionFormData = ref({}); | |
41 | - const getActionFormData = ref({}); | |
42 | - const [registerForm, { resetFields, validateFields, getFieldsValue }] = useForm({ | |
43 | - labelWidth: 120, | |
44 | - schemas: formSchema, | |
45 | - showActionButtonGroup: false, | |
34 | + let triggersArray: any[] = reactive([]); | |
35 | + let doConditionsArray: any[] = reactive([]); | |
36 | + let doActionsArray: any[] = reactive([]); | |
37 | + let getAllFormData: any = reactive({}); | |
38 | + let getValuesFormData: any = reactive({}); | |
39 | + let getId = ref(''); | |
40 | + let getTriggerFormData: any = reactive({}); | |
41 | + let getConditionFormData: any = reactive({}); | |
42 | + let getActionFormData: any = reactive({}); | |
43 | + let getDeviceInfo = ref(null); | |
44 | + let getDeviceInfo1 = ref(null); | |
45 | + let getDeviceInfo2 = ref(null); | |
46 | + | |
47 | + const [registerForm, { resetFields, setFieldsValue, validateFields, getFieldsValue }] = | |
48 | + useForm({ | |
49 | + labelWidth: 120, | |
50 | + schemas: formSchema, | |
51 | + showActionButtonGroup: false, | |
52 | + }); | |
53 | + | |
54 | + watch(getData, (newV) => { | |
55 | + getDeviceInfo.value = newV; | |
56 | + getDeviceInfo1.value = newV; | |
57 | + getDeviceInfo2.value = newV; | |
46 | 58 | }); |
47 | 59 | |
48 | - const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => { | |
60 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | |
49 | 61 | await resetFields(); |
50 | 62 | setDrawerProps({ confirmLoading: false }); |
51 | 63 | isUpdate.value = !!data?.isUpdate; |
64 | + //编辑 | |
65 | + if (unref(isUpdate)) { | |
66 | + getId.value = data.record.id; | |
67 | + await setFieldsValue({ | |
68 | + ...data.record, | |
69 | + }); | |
70 | + } else { | |
71 | + await resetFields(); | |
72 | + } | |
52 | 73 | }); |
74 | + // function trimNumber(str) { | |
75 | + // return str.replace(/\d+/g, ''); | |
76 | + // } | |
77 | + | |
53 | 78 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
54 | - const getTriggerData = (v) => { | |
55 | - getTriggerFormData.value = v; | |
79 | + let getTriggerData = (v) => { | |
80 | + getTriggerFormData = v; | |
81 | + triggersArray.push(getTriggerFormData); | |
82 | + // let retuArray = triggersArray.map((m) => { | |
83 | + // let getArrayKeys = Object.keys(m); | |
84 | + // let getArrayKeysReturn = null; | |
85 | + // getArrayKeys.forEach((f) => { | |
86 | + // getArrayKeysReturn = trimNumber(f); | |
87 | + // }); | |
88 | + // return getArrayKeysReturn; | |
89 | + // }); | |
90 | + // console.log(retuArray); | |
56 | 91 | }; |
57 | - const getFormConditiData = (v) => { | |
58 | - getConditionFormData.value = v; | |
92 | + let getFormConditiData = (v) => { | |
93 | + getConditionFormData = v; | |
94 | + doConditionsArray.push(getConditionFormData); | |
59 | 95 | }; |
60 | - const getFormActionData = (v) => { | |
61 | - getActionFormData.value = v; | |
96 | + let getFormActionData = (v) => { | |
97 | + getActionFormData = v; | |
98 | + doActionsArray.push(getActionFormData); | |
62 | 99 | }; |
63 | 100 | async function handleSubmit() { |
64 | - const res = await validateFields(); | |
65 | - if (!res) return; | |
66 | - const values = await getFieldsValue(); | |
67 | - Object.assign( | |
68 | - getAllFormData.value, | |
69 | - values, | |
70 | - getTriggerFormData.value, | |
71 | - getConditionFormData.value, | |
72 | - getActionFormData.value | |
73 | - ); | |
74 | - //所有的表单值 | |
75 | - console.log('收集所有表单值', getAllFormData.value); | |
101 | + if (!unref(isUpdate)) { | |
102 | + let res = validateFields(); | |
103 | + if (!res) return; | |
104 | + getValuesFormData = getFieldsValue(); | |
105 | + Object.assign(getAllFormData, getValuesFormData); | |
106 | + getAllFormData.triggers = triggersArray; | |
107 | + getAllFormData.doConditions = doConditionsArray; | |
108 | + getAllFormData.doActions = doActionsArray; | |
109 | + //所有的表单值 | |
110 | + console.log('提交的值', getAllFormData); | |
111 | + await screenLinkPageAddApi(getAllFormData); | |
112 | + createMessage.success('场景联动新增成功'); | |
113 | + closeDrawer(); | |
114 | + emit('success'); | |
115 | + } | |
116 | + if (unref(isUpdate)) { | |
117 | + getValuesFormData = getFieldsValue(); | |
118 | + getValuesFormData.id = getId.value; | |
119 | + Object.assign(getAllFormData, getValuesFormData); | |
120 | + getAllFormData.triggers = triggersArray; | |
121 | + getAllFormData.doConditions = doConditionsArray; | |
122 | + getAllFormData.doActions = doActionsArray; | |
123 | + console.log('编辑的值', getAllFormData); | |
124 | + await screenLinkPageUpdateApi(getAllFormData); | |
125 | + createMessage.success('场景联动编辑成功'); | |
126 | + closeDrawer(); | |
127 | + emit('success'); | |
128 | + } | |
76 | 129 | } |
77 | - console.log('拿到注入的数据', inject('getEchoData')); | |
78 | - // getParentEchoData = inject('getEchoData'); | |
79 | - // console.log(getParentEchoData); | |
80 | 130 | return { |
81 | - getParentEchoData, | |
131 | + getDeviceInfo, | |
132 | + getDeviceInfo1, | |
133 | + getDeviceInfo2, | |
134 | + getAllFormData, | |
82 | 135 | getTriggerData, |
83 | 136 | getFormConditiData, |
84 | 137 | getFormActionData, | ... | ... |
1 | +<template> | |
2 | + <PageWrapper title="我的通知详情"> | |
3 | + <Description @register="register1" class="mt-4" /> | |
4 | + </PageWrapper> | |
5 | +</template> | |
6 | +<script lang="ts"> | |
7 | + import { defineComponent, watch, ref } from 'vue'; | |
8 | + import { Description, DescItem, useDescription } from '/@/components/Description/index'; | |
9 | + import { PageWrapper } from '/@/components/Page'; | |
10 | + | |
11 | + const schema: DescItem[] = [ | |
12 | + { | |
13 | + field: 'title', | |
14 | + label: '标题', | |
15 | + }, | |
16 | + { | |
17 | + field: 'content', | |
18 | + label: '内容', | |
19 | + }, | |
20 | + { | |
21 | + field: 'creator', | |
22 | + label: '发送者', | |
23 | + }, | |
24 | + { | |
25 | + field: 'readDate', | |
26 | + label: '发送时间', | |
27 | + }, | |
28 | + { | |
29 | + field: 'type', | |
30 | + label: '类型', | |
31 | + render: (_, data) => { | |
32 | + return data.type === 'MEETING' | |
33 | + ? '公告' | |
34 | + : data.type === 'MEETING1' | |
35 | + ? '会议' | |
36 | + : data.type === 'MEETING2' | |
37 | + ? '其他' | |
38 | + : ''; | |
39 | + }, | |
40 | + }, | |
41 | + ]; | |
42 | + export default defineComponent({ | |
43 | + components: { Description, PageWrapper }, | |
44 | + props: { | |
45 | + emitChildData: { | |
46 | + type: Object, | |
47 | + }, | |
48 | + }, | |
49 | + setup(props) { | |
50 | + let useDescriptionData: any = ref(null); | |
51 | + watch( | |
52 | + () => props.emitChildData, | |
53 | + async (newV) => { | |
54 | + useDescriptionData.value = newV; | |
55 | + } | |
56 | + ); | |
57 | + const [register1] = useDescription({ | |
58 | + title: '详情', | |
59 | + bordered: false, | |
60 | + data: useDescriptionData, | |
61 | + schema: schema, | |
62 | + }); | |
63 | + | |
64 | + return { register1 }; | |
65 | + }, | |
66 | + }); | |
67 | +</script> | ... | ... |
1 | +import { BasicColumn, FormSchema } from '/@/components/Table'; | |
2 | + | |
3 | +export const columns: BasicColumn[] = [ | |
4 | + { | |
5 | + title: '标题', | |
6 | + dataIndex: 'title', | |
7 | + width: 200, | |
8 | + }, | |
9 | + { | |
10 | + title: '类型', | |
11 | + dataIndex: 'type', | |
12 | + width: 200, | |
13 | + format: (text: string, record: Recordable) => { | |
14 | + return record.type === 'MEETING' | |
15 | + ? '公告' | |
16 | + : record.type === 'MEETING1' | |
17 | + ? '会议' | |
18 | + : record.type === 'MEETING2' | |
19 | + ? '其他' | |
20 | + : ''; | |
21 | + }, | |
22 | + }, | |
23 | + { | |
24 | + title: '发送者', | |
25 | + dataIndex: 'receiverId', | |
26 | + width: 200, | |
27 | + }, | |
28 | + { | |
29 | + title: '发送时间', | |
30 | + dataIndex: 'readDate', | |
31 | + width: 200, | |
32 | + }, | |
33 | + { | |
34 | + title: '阅读状态', | |
35 | + dataIndex: 'readStatus', | |
36 | + width: 200, | |
37 | + format: (text: string, record: Recordable) => { | |
38 | + return record.readStatus == 0 | |
39 | + ? '未读' | |
40 | + : record.type == 1 | |
41 | + ? '已读' | |
42 | + : record.type == 2 | |
43 | + ? '其他' | |
44 | + : '其他'; | |
45 | + }, | |
46 | + }, | |
47 | +]; | |
48 | + | |
49 | +export const searchFormSchema: FormSchema[] = [ | |
50 | + { | |
51 | + field: 'orderField', | |
52 | + label: '', | |
53 | + colProps: { span: 8 }, | |
54 | + component: 'ApiTreeSelect', | |
55 | + componentProps: { | |
56 | + // api: async () => { | |
57 | + // const data = await screenLinkOrganizationGetApi(); | |
58 | + // copyTransFun(data as any as any[]); | |
59 | + // return data; | |
60 | + // }, | |
61 | + }, | |
62 | + }, | |
63 | +]; | ... | ... |
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable | |
4 | + :rowSelection="{ type: 'checkbox' }" | |
5 | + @selection-change="useSelectionChange" | |
6 | + @register="registerTable" | |
7 | + > | |
8 | + <template #action="{ record }"> | |
9 | + <TableAction | |
10 | + :actions="[ | |
11 | + { | |
12 | + label: '查看', | |
13 | + icon: 'clarity:note-edit-line', | |
14 | + onClick: handleView.bind(null, record), | |
15 | + }, | |
16 | + ]" | |
17 | + /> | |
18 | + </template> | |
19 | + </BasicTable> | |
20 | + <NotifyDetailDrawer @register="registerDrawer" @success="handleSuccess" /> | |
21 | + </div> | |
22 | +</template> | |
23 | +<script lang="ts"> | |
24 | + import { defineComponent } from 'vue'; | |
25 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
26 | + import { useDrawer } from '/@/components/Drawer'; | |
27 | + import NotifyDetailDrawer from './useDrawer.vue'; | |
28 | + import { columns, searchFormSchema } from './config.d'; | |
29 | + // import { useMessage } from '/@/hooks/web/useMessage'; | |
30 | + // ,notifyMyGetDetailApi,notifyMyGetrPageApi,notifyMyGetrReadApi | |
31 | + import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; | |
32 | + | |
33 | + export default defineComponent({ | |
34 | + name: 'index', | |
35 | + components: { BasicTable, NotifyDetailDrawer, TableAction }, | |
36 | + setup() { | |
37 | + let selectedRowKeys: Array<string> = []; | |
38 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
39 | + const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
40 | + title: '', | |
41 | + clickToRowSelect: false, | |
42 | + api: notifyMyGetrPageApi, | |
43 | + columns, | |
44 | + formConfig: { | |
45 | + labelWidth: 120, | |
46 | + schemas: searchFormSchema, | |
47 | + }, | |
48 | + rowKey: 'id', | |
49 | + useSearchForm: true, | |
50 | + showTableSetting: true, | |
51 | + bordered: true, | |
52 | + showIndexColumn: false, | |
53 | + actionColumn: { | |
54 | + width: 180, | |
55 | + title: '操作', | |
56 | + dataIndex: 'action', | |
57 | + slots: { customRender: 'action' }, | |
58 | + fixed: undefined, | |
59 | + }, | |
60 | + }); | |
61 | + | |
62 | + const useSelectionChange = () => { | |
63 | + selectedRowKeys = getSelectRowKeys(); | |
64 | + console.log(selectedRowKeys); | |
65 | + }; | |
66 | + | |
67 | + function handleView(record: Recordable) { | |
68 | + openDrawer(true, { | |
69 | + record, | |
70 | + isUpdate: true, | |
71 | + }); | |
72 | + } | |
73 | + | |
74 | + function handleSuccess() { | |
75 | + reload(); | |
76 | + } | |
77 | + return { | |
78 | + useSelectionChange, | |
79 | + registerTable, | |
80 | + registerDrawer, | |
81 | + handleView, | |
82 | + handleSuccess, | |
83 | + }; | |
84 | + }, | |
85 | + }); | |
86 | +</script> | ... | ... |
1 | +<template> | |
2 | + <BasicDrawer | |
3 | + v-bind="$attrs" | |
4 | + @register="registerDrawer" | |
5 | + :showFooter="false" | |
6 | + :title="getTitle" | |
7 | + width="800px" | |
8 | + > | |
9 | + <DetailChild :emitChildData="childData" /> | |
10 | + </BasicDrawer> | |
11 | +</template> | |
12 | +<script lang="ts"> | |
13 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
14 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
15 | + import DetailChild from './child/index.vue'; | |
16 | + import { notifyMyGetDetailApi } from '/@/api/stationnotification/stationnotifyApi'; | |
17 | + | |
18 | + // import { useMessage } from '/@/hooks/web/useMessage'; | |
19 | + | |
20 | + export default defineComponent({ | |
21 | + name: 'ConfigDrawer', | |
22 | + components: { BasicDrawer, DetailChild }, | |
23 | + emits: ['success', 'register'], | |
24 | + setup() { | |
25 | + // const { createMessage } = useMessage(); | |
26 | + const isUpdate = ref(true); | |
27 | + let childData: any = ref(null); | |
28 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | |
29 | + setDrawerProps({ confirmLoading: false }); | |
30 | + isUpdate.value = !!data?.isUpdate; | |
31 | + console.log(data.record); | |
32 | + if (data.record) { | |
33 | + // console.log(data.record.id); | |
34 | + let getData = await notifyMyGetDetailApi(data.record.id); | |
35 | + childData.value = getData; | |
36 | + // createMessage.success() | |
37 | + } | |
38 | + //编辑 | |
39 | + if (unref(isUpdate)) { | |
40 | + } else { | |
41 | + } | |
42 | + }); | |
43 | + | |
44 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '查看通知')); | |
45 | + const handleCancel = () => { | |
46 | + closeDrawer(); | |
47 | + }; | |
48 | + | |
49 | + return { | |
50 | + childData, | |
51 | + handleCancel, | |
52 | + getTitle, | |
53 | + registerDrawer, | |
54 | + }; | |
55 | + }, | |
56 | + }); | |
57 | +</script> | ... | ... |
1 | +import { BasicColumn, FormSchema } from '/@/components/Table'; | |
2 | +import { Tinymce } from '/@/components/Tinymce/index'; | |
3 | +import { h } from 'vue'; | |
4 | + | |
5 | +export const columns: BasicColumn[] = [ | |
6 | + { | |
7 | + title: '类型', | |
8 | + dataIndex: 'type', | |
9 | + width: 200, | |
10 | + format: (text: string, record: Recordable) => { | |
11 | + return record.type === 'MEETING' | |
12 | + ? '公告' | |
13 | + : record.type === 'MEETING1' | |
14 | + ? '会议' | |
15 | + : record.type === 'MEETING2' | |
16 | + ? '其他' | |
17 | + : ''; | |
18 | + }, | |
19 | + }, | |
20 | + { | |
21 | + title: '标题', | |
22 | + dataIndex: 'title', | |
23 | + width: 200, | |
24 | + }, | |
25 | + { | |
26 | + title: '内容', | |
27 | + dataIndex: 'content', | |
28 | + width: 120, | |
29 | + }, | |
30 | + { | |
31 | + title: '发送者', | |
32 | + dataIndex: 'senderName', | |
33 | + width: 200, | |
34 | + }, | |
35 | + { | |
36 | + title: '状态', | |
37 | + dataIndex: 'status', | |
38 | + width: 200, | |
39 | + format: (text: string, record: Recordable) => { | |
40 | + return record.status == 0 | |
41 | + ? '草稿' | |
42 | + : record.type == 1 | |
43 | + ? '已发' | |
44 | + : record.type == 2 | |
45 | + ? '其他' | |
46 | + : '其他'; | |
47 | + }, | |
48 | + }, | |
49 | +]; | |
50 | + | |
51 | +export const formSchema: FormSchema[] = [ | |
52 | + { | |
53 | + field: 'type', | |
54 | + label: '类型', | |
55 | + colProps: { span: 24 }, | |
56 | + required: true, | |
57 | + component: 'RadioGroup', | |
58 | + componentProps: { | |
59 | + options: [ | |
60 | + { | |
61 | + label: '公告', | |
62 | + value: '1', | |
63 | + }, | |
64 | + { | |
65 | + label: '会议', | |
66 | + value: '2', | |
67 | + }, | |
68 | + { | |
69 | + label: '其他', | |
70 | + value: '3', | |
71 | + }, | |
72 | + ], | |
73 | + }, | |
74 | + }, | |
75 | + { | |
76 | + field: 'title', | |
77 | + label: '标题', | |
78 | + required: true, | |
79 | + colProps: { span: 24 }, | |
80 | + component: 'Input', | |
81 | + componentProps: { | |
82 | + placeholder: '请输入标题', | |
83 | + }, | |
84 | + }, | |
85 | + { | |
86 | + field: 'content', | |
87 | + component: 'Input', | |
88 | + colProps: { span: 24 }, | |
89 | + label: '内容', | |
90 | + defaultValue: '请输入内容', | |
91 | + rules: [{ required: true }], | |
92 | + render: ({ model, field }) => { | |
93 | + return h(Tinymce, { | |
94 | + value: model[field], | |
95 | + onChange: (value: string) => { | |
96 | + model[field] = value; | |
97 | + }, | |
98 | + }); | |
99 | + }, | |
100 | + }, | |
101 | + { | |
102 | + field: 'receiverTypeIds', | |
103 | + label: '接收者', | |
104 | + colProps: { span: 24 }, | |
105 | + component: 'RadioGroup', | |
106 | + componentProps: { | |
107 | + options: [ | |
108 | + { | |
109 | + label: '全部', | |
110 | + value: '1', | |
111 | + }, | |
112 | + { | |
113 | + label: '部门', | |
114 | + value: '2', | |
115 | + }, | |
116 | + ], | |
117 | + }, | |
118 | + }, | |
119 | + { | |
120 | + field: '', | |
121 | + component: 'Input', | |
122 | + label: '', | |
123 | + colProps: { | |
124 | + span: 12, | |
125 | + }, | |
126 | + slot: 'add', | |
127 | + }, | |
128 | +]; | |
129 | + | |
130 | +export const searchFormSchema: FormSchema[] = [ | |
131 | + { | |
132 | + field: 'orderField', | |
133 | + label: '', | |
134 | + colProps: { span: 8 }, | |
135 | + component: 'ApiSelect', | |
136 | + componentProps: { | |
137 | + // api: async () => { | |
138 | + // const data = await screenLinkOrganizationGetApi(); | |
139 | + // copyTransFun(data as any as any[]); | |
140 | + // return data; | |
141 | + // }, | |
142 | + }, | |
143 | + }, | |
144 | +]; | ... | ... |
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable | |
4 | + :rowSelection="{ type: 'checkbox' }" | |
5 | + @selection-change="useSelectionChange" | |
6 | + @register="registerTable" | |
7 | + > | |
8 | + <template #toolbar> | |
9 | + <a-button type="primary" @click="handleAdd"> 新增 </a-button> | |
10 | + <a-button type="error" @click="handleToolbarDel"> 删除 </a-button> | |
11 | + </template> | |
12 | + <template #action="{ record }"> | |
13 | + <TableAction | |
14 | + :actions="[ | |
15 | + { | |
16 | + label: '编辑', | |
17 | + icon: 'clarity:note-edit-line', | |
18 | + onClick: handleEdit.bind(null, record), | |
19 | + }, | |
20 | + { | |
21 | + label: '删除', | |
22 | + icon: 'ant-design:delete-outlined', | |
23 | + color: 'error', | |
24 | + popConfirm: { | |
25 | + title: '是否确认删除', | |
26 | + confirm: handleDelete.bind(null, record), | |
27 | + }, | |
28 | + }, | |
29 | + ]" | |
30 | + /> | |
31 | + </template> | |
32 | + </BasicTable> | |
33 | + <NotifyManagerDrawer | |
34 | + :getChildrenData="echoEditData" | |
35 | + @register="registerDrawer" | |
36 | + @success="handleSuccess" | |
37 | + /> | |
38 | + </div> | |
39 | +</template> | |
40 | +<script lang="ts"> | |
41 | + import { defineComponent, reactive } from 'vue'; | |
42 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
43 | + import { useDrawer } from '/@/components/Drawer'; | |
44 | + import NotifyManagerDrawer from './useDrawer.vue'; | |
45 | + import { columns, searchFormSchema } from './config.d'; | |
46 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
47 | + import { notifyGetTableApi, notifyDeleteApi } from '/@/api/stationnotification/stationnotifyApi'; | |
48 | + | |
49 | + export default defineComponent({ | |
50 | + name: 'index', | |
51 | + components: { BasicTable, NotifyManagerDrawer, TableAction }, | |
52 | + setup() { | |
53 | + let selectedRowKeys: Array<string> = []; | |
54 | + let echoEditData = reactive({}); | |
55 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
56 | + const { createMessage } = useMessage(); | |
57 | + const [registerTable, { reload, getSelectRowKeys }] = useTable({ | |
58 | + title: '', | |
59 | + clickToRowSelect: false, | |
60 | + api: notifyGetTableApi, | |
61 | + columns, | |
62 | + formConfig: { | |
63 | + labelWidth: 120, | |
64 | + schemas: searchFormSchema, | |
65 | + }, | |
66 | + rowKey: 'id', | |
67 | + useSearchForm: true, | |
68 | + showTableSetting: true, | |
69 | + bordered: true, | |
70 | + showIndexColumn: false, | |
71 | + actionColumn: { | |
72 | + width: 180, | |
73 | + title: '操作', | |
74 | + dataIndex: 'action', | |
75 | + slots: { customRender: 'action' }, | |
76 | + fixed: undefined, | |
77 | + }, | |
78 | + }); | |
79 | + | |
80 | + function handleAdd() { | |
81 | + openDrawer(true, { | |
82 | + isUpdate: false, | |
83 | + }); | |
84 | + } | |
85 | + | |
86 | + const useSelectionChange = () => { | |
87 | + selectedRowKeys = getSelectRowKeys(); | |
88 | + selectedRowKeys.join(','); | |
89 | + }; | |
90 | + | |
91 | + async function handleToolbarDel() { | |
92 | + await notifyDeleteApi(selectedRowKeys); | |
93 | + createMessage.success('删除成功'); | |
94 | + reload(); | |
95 | + } | |
96 | + | |
97 | + function handleEdit(record: Recordable) { | |
98 | + openDrawer(true, { | |
99 | + record, | |
100 | + isUpdate: true, | |
101 | + }); | |
102 | + } | |
103 | + async function handleDelete(record: Recordable) { | |
104 | + console.log(record.id); | |
105 | + let ids = '1'; | |
106 | + await notifyDeleteApi(ids); | |
107 | + createMessage.success('删除成功'); | |
108 | + reload(); | |
109 | + } | |
110 | + function handleSuccess() { | |
111 | + reload(); | |
112 | + } | |
113 | + return { | |
114 | + useSelectionChange, | |
115 | + echoEditData, | |
116 | + registerTable, | |
117 | + registerDrawer, | |
118 | + handleAdd, | |
119 | + handleToolbarDel, | |
120 | + handleEdit, | |
121 | + handleDelete, | |
122 | + handleSuccess, | |
123 | + }; | |
124 | + }, | |
125 | + }); | |
126 | +</script> | ... | ... |
1 | +<template> | |
2 | + <BasicDrawer | |
3 | + v-bind="$attrs" | |
4 | + @register="registerDrawer" | |
5 | + :showFooter="false" | |
6 | + :title="getTitle" | |
7 | + width="800px" | |
8 | + > | |
9 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm"> | |
10 | + <template #add> | |
11 | + <Button style="margin-left: 30px; margin-top: 80px" type="primary" @click="handleCancel" | |
12 | + >取消</Button | |
13 | + > | |
14 | + <Button style="margin-left: 30px" type="primary" @click="handleSubmit">保存草稿</Button> | |
15 | + <Button style="margin-left: 30px" type="primary" @click="handleSend">发布通知</Button> | |
16 | + </template> | |
17 | + </BasicForm> | |
18 | + </BasicDrawer> | |
19 | +</template> | |
20 | +<script lang="ts"> | |
21 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
22 | + import { Button } from '/@/components/Button'; | |
23 | + import { BasicForm, useForm } from '/@/components/Form'; | |
24 | + import { formSchema } from './config.d'; | |
25 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
26 | + import { | |
27 | + notifyAddDraftApi, | |
28 | + notifyAddLeaseApi, | |
29 | + } from '/@/api/stationnotification/stationnotifyApi'; | |
30 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
31 | + | |
32 | + export default defineComponent({ | |
33 | + name: 'ConfigDrawer', | |
34 | + components: { BasicDrawer, BasicForm, Button }, | |
35 | + emits: ['success', 'register'], | |
36 | + setup() { | |
37 | + const { createMessage } = useMessage(); | |
38 | + const isUpdate = ref(true); | |
39 | + const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | |
40 | + labelWidth: 120, | |
41 | + schemas: formSchema, | |
42 | + showActionButtonGroup: false, | |
43 | + }); | |
44 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | |
45 | + await resetFields(); | |
46 | + setDrawerProps({ confirmLoading: false }); | |
47 | + isUpdate.value = !!data?.isUpdate; | |
48 | + //编辑 | |
49 | + if (unref(isUpdate)) { | |
50 | + await setFieldsValue({ | |
51 | + ...data.record, | |
52 | + }); | |
53 | + } else { | |
54 | + } | |
55 | + }); | |
56 | + | |
57 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | |
58 | + const handleCancel = () => { | |
59 | + closeDrawer(); | |
60 | + }; | |
61 | + | |
62 | + async function handleSend() { | |
63 | + if (!unref(isUpdate)) { | |
64 | + const values = await validate(); | |
65 | + // saveForm = getFieldsValue(); | |
66 | + await notifyAddLeaseApi(values); | |
67 | + createMessage.success('新增成功'); | |
68 | + } | |
69 | + if (unref(isUpdate)) { | |
70 | + const values = await validate(); | |
71 | + // saveForm = getFieldsValue(); | |
72 | + await notifyAddLeaseApi(values); | |
73 | + createMessage.success('编辑成功'); | |
74 | + } | |
75 | + } | |
76 | + async function handleSubmit() { | |
77 | + if (!unref(isUpdate)) { | |
78 | + const values = await validate(); | |
79 | + // saveForm = getFieldsValue(); | |
80 | + await notifyAddDraftApi(values); | |
81 | + createMessage.success('新增成功'); | |
82 | + } | |
83 | + if (unref(isUpdate)) { | |
84 | + const values = await validate(); | |
85 | + // saveForm = getFieldsValue(); | |
86 | + await notifyAddDraftApi(values); | |
87 | + createMessage.success('编辑成功'); | |
88 | + } | |
89 | + } | |
90 | + return { | |
91 | + handleSend, | |
92 | + handleCancel, | |
93 | + getTitle, | |
94 | + handleSubmit, | |
95 | + registerForm, | |
96 | + registerDrawer, | |
97 | + }; | |
98 | + }, | |
99 | + }); | |
100 | +</script> | ... | ... |
... | ... | @@ -74,6 +74,7 @@ |
74 | 74 | |
75 | 75 | if (unref(isUpdate)) { |
76 | 76 | rowId.value = data.record.id; |
77 | + console.log(data.record); | |
77 | 78 | const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); |
78 | 79 | findCurrentUserRelation(roleParams).then((result) => { |
79 | 80 | Reflect.set(data.record, 'roleIds', result); | ... | ... |