Commit bed967574f4bc8aea41f8a03dbb246f3932db5fa

Authored by ww
1 parent 516e7527

perf: 优化大屏设计器发布与取消发布修改为一个按钮

... ... @@ -20,7 +20,7 @@ export enum ConfigurationPermission {
20 20 DESIGN = 'api:yt:dataview:center:get_configuration_info:design',
21 21 PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview',
22 22 PUBLISH = 'api:yt:dataview:center:publish',
23   - CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish',
  23 + // CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish',
24 24 }
25 25
26 26 // 查询字段
... ...
... ... @@ -190,14 +190,9 @@
190 190 }
191 191 };
192 192
193   - const handlePublish = async ({ id }) => {
194   - await bigScreenPublish(id);
195   - createMessage.success('发布成功');
196   - getListData();
197   - };
198   - const handleCancelPublish = async ({ id }) => {
199   - await bigScreenCancelPublish(id);
200   - createMessage.success('取消发布成功');
  193 + const handlePublish = async ({ id, state }) => {
  194 + state === 0 ? await bigScreenPublish(id) : await bigScreenCancelPublish(id);
  195 + createMessage.success(state === 0 ? '发布成功' : '取消发布成功');
201 196 getListData();
202 197 };
203 198 </script>
... ... @@ -310,20 +305,14 @@
310 305 onClick: handleOpenShareModal.bind(null, item),
311 306 },
312 307 {
313   - text: '发布',
  308 + text: item.state == 0 ? '发布' : '取消发布',
314 309 auth: ConfigurationPermission.PUBLISH,
315   - icon: 'ant-design:node-expand-outlined',
  310 + icon:
  311 + item.state == 0
  312 + ? 'ant-design:node-expand-outlined'
  313 + : 'ant-design:node-collapse-outlined',
316 314 event: '',
317 315 onClick: handlePublish.bind(null, item),
318   - disabled: item.state === 0 ? false : true,
319   - },
320   - {
321   - text: '取消发布',
322   - auth: ConfigurationPermission.CANCEL_PUBLISH,
323   - icon: 'ant-design:node-collapse-outlined',
324   - event: '',
325   - onClick: handleCancelPublish.bind(null, item),
326   - disabled: item.state === 1 ? false : true,
327 316 },
328 317 {
329 318 text: '编辑',
... ...