Commit a61f579a12358220000968ac6c2fcc2d6902dfaa

Authored by fengwotao
2 parents 199c933e 735c2ff6

Merge branch 'main_dev' into local_dev_ft-send_message

@@ -45,6 +45,7 @@ enum DeviceManagerApi { @@ -45,6 +45,7 @@ enum DeviceManagerApi {
45 DEVICE_PUBLIC = '/customer/public/device', 45 DEVICE_PUBLIC = '/customer/public/device',
46 46
47 DEVICE_PRIVATE = '/customer/device', 47 DEVICE_PRIVATE = '/customer/device',
  48 + DEVICE_COLLECT = '/device/collect ', //收藏
48 49
49 /** 50 /**
50 * @description 通过设备列表获取设备信息 51 * @description 通过设备列表获取设备信息
@@ -61,6 +62,13 @@ export const devicePage = (params: DeviceQueryParam) => { @@ -61,6 +62,13 @@ export const devicePage = (params: DeviceQueryParam) => {
61 }); 62 });
62 }; 63 };
63 64
  65 +export const deviceCollect = (params: Array<any>) => {
  66 + return defHttp.post({
  67 + url: `${DeviceManagerApi.DEVICE_COLLECT}`,
  68 + params,
  69 + });
  70 +};
  71 +
64 /** 72 /**
65 * 分页查询设备配置页面 73 * 分页查询设备配置页面
66 * @param params pageSize page name 74 * @param params pageSize page name
@@ -12,7 +12,7 @@ export const columns: BasicColumn[] = [ @@ -12,7 +12,7 @@ export const columns: BasicColumn[] = [
12 { 12 {
13 title: '状态', 13 title: '状态',
14 dataIndex: 'deviceState', 14 dataIndex: 'deviceState',
15 - width: 80, 15 + width: 110,
16 slots: { customRender: 'deviceState' }, 16 slots: { customRender: 'deviceState' },
17 }, 17 },
18 { 18 {
@@ -167,4 +167,17 @@ export const searchFormSchema: FormSchema[] = [ @@ -167,4 +167,17 @@ export const searchFormSchema: FormSchema[] = [
167 }; 167 };
168 }, 168 },
169 }, 169 },
  170 + {
  171 + field: 'isCollect',
  172 + label: '是否收藏',
  173 + component: 'Select',
  174 + colProps: { span: 6 },
  175 + componentProps: {
  176 + options: [
  177 + { label: '是', value: 1 },
  178 + { label: '否', value: 0 },
  179 + ],
  180 + placeholder: '请选择',
  181 + },
  182 + },
170 ]; 183 ];
@@ -34,6 +34,11 @@ @@ -34,6 +34,11 @@
34 批量分配 34 批量分配
35 </a-button> 35 </a-button>
36 </Authority> 36 </Authority>
  37 + <!-- <Authority>
  38 + <a-button type="primary" @click="handelCollect()" :disabled="!isExistOption">
  39 + 批量收藏
  40 + </a-button>
  41 + </Authority> -->
37 </template> 42 </template>
38 <template #img="{ record }"> 43 <template #img="{ record }">
39 <TableImg 44 <TableImg
@@ -85,7 +90,13 @@ @@ -85,7 +90,13 @@
85 </Tag> 90 </Tag>
86 </template> 91 </template>
87 <template #deviceState="{ record }"> 92 <template #deviceState="{ record }">
  93 + <!-- <HeartOutlined v-if="!record.isCollect" class="mr-1" style="color: red" /> -->
  94 + <Tooltip>
  95 + <template #title> 我的收藏</template>
  96 + <HeartTwoTone v-if="record.isCollect" class="mr-1" twoToneColor="#3B82F6" />
  97 + </Tooltip>
88 <Tag 98 <Tag
  99 + :style="{ marginLeft: !record.isCollect ? '17px' : '' }"
89 :color=" 100 :color="
90 record.deviceState == DeviceState.INACTIVE 101 record.deviceState == DeviceState.INACTIVE
91 ? 'warning' 102 ? 'warning'
@@ -154,6 +165,18 @@ @@ -154,6 +165,18 @@
154 icon: 'ant-design:rise-outlined', 165 icon: 'ant-design:rise-outlined',
155 onClick: handleUpAndDownRecord.bind(null, record), 166 onClick: handleUpAndDownRecord.bind(null, record),
156 }, 167 },
  168 + !record.isCollect
  169 + ? {
  170 + label: '收藏',
  171 + icon: 'ant-design:heart-outlined',
  172 + onClick: handelCollect.bind(null, record),
  173 + }
  174 + : {
  175 + label: '取消收藏',
  176 + auth: 'api:yt:device:online:record',
  177 + icon: 'ant-design:heart-outlined',
  178 + onClick: handelCollect.bind(null, record),
  179 + },
157 { 180 {
158 label: '删除', 181 label: '删除',
159 auth: 'api:yt:device:delete', 182 auth: 'api:yt:device:delete',
@@ -195,10 +218,12 @@ @@ -195,10 +218,12 @@
195 } from '/@/api/device/model/deviceModel'; 218 } from '/@/api/device/model/deviceModel';
196 import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table'; 219 import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table';
197 import { columns, searchFormSchema } from './config/device.data'; 220 import { columns, searchFormSchema } from './config/device.data';
198 - import { Tag, Popover, Popconfirm, Button } from 'ant-design-vue'; 221 + import { Tag, Popover, Popconfirm, Button, Tooltip } from 'ant-design-vue';
  222 + import { HeartTwoTone } from '@ant-design/icons-vue';
199 import { 223 import {
200 deleteDevice, 224 deleteDevice,
201 devicePage, 225 devicePage,
  226 + deviceCollect,
202 cancelDispatchCustomer, 227 cancelDispatchCustomer,
203 getGATEWAY, 228 getGATEWAY,
204 privateDevice, 229 privateDevice,
@@ -244,6 +269,9 @@ @@ -244,6 +269,9 @@
244 Popconfirm, 269 Popconfirm,
245 BatchImportModal, 270 BatchImportModal,
246 Button, 271 Button,
  272 + // HeartOutlined,
  273 + HeartTwoTone,
  274 + Tooltip,
247 }, 275 },
248 setup(_) { 276 setup(_) {
249 const { isCustomer } = useAuthDeviceDetail(); 277 const { isCustomer } = useAuthDeviceDetail();
@@ -462,6 +490,26 @@ @@ -462,6 +490,26 @@
462 } catch (error) {} 490 } catch (error) {}
463 }; 491 };
464 492
  493 + // 收藏 && 批量收藏
  494 + const handelCollect = async (record?: Recordable) => {
  495 + let ids: string[] = [];
  496 + if (record) {
  497 + ids.push(record.id);
  498 + } else {
  499 + ids = await getSelectRowKeys();
  500 + }
  501 + try {
  502 + setLoading(true);
  503 + await deviceCollect(ids);
  504 + createMessage.success('操作成功');
  505 + handleReload();
  506 + } catch (error) {
  507 + throw error;
  508 + } finally {
  509 + setLoading(false);
  510 + }
  511 + };
  512 +
465 onMounted(() => { 513 onMounted(() => {
466 const queryParams = ROUTE.query as Record<'deviceProfileId', undefined | string>; 514 const queryParams = ROUTE.query as Record<'deviceProfileId', undefined | string>;
467 const { setFieldsValue } = getForm(); 515 const { setFieldsValue } = getForm();
@@ -489,6 +537,7 @@ @@ -489,6 +537,7 @@
489 copySN, 537 copySN,
490 isExistOption, 538 isExistOption,
491 handleDelete, 539 handleDelete,
  540 + handelCollect,
492 // hasBatchDelete, 541 // hasBatchDelete,
493 // handleDeleteOrBatchDelete, 542 // handleDeleteOrBatchDelete,
494 handleReload, 543 handleReload,
@@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
50 label: BusinessConvertScriptTextEnum.BUSINESS_EDIT_TEXT.slice(0, 2), 50 label: BusinessConvertScriptTextEnum.BUSINESS_EDIT_TEXT.slice(0, 2),
51 icon: 'clarity:note-edit-line', 51 icon: 'clarity:note-edit-line',
52 auth: PermissionConvertScriptEnum.PERMISSION_UPDATE, 52 auth: PermissionConvertScriptEnum.PERMISSION_UPDATE,
  53 + ifShow: record.status == 0,
53 onClick: handleBusinessModal.bind( 54 onClick: handleBusinessModal.bind(
54 null, 55 null,
55 BusinessConvertScriptTextEnum.BUSINESS_EDIT_TEXT, 56 BusinessConvertScriptTextEnum.BUSINESS_EDIT_TEXT,