diff --git a/src/views/system/Department/device/index.vue b/src/views/system/Department/device/index.vue index 6927ba59..5b90ce26 100644 --- a/src/views/system/Department/device/index.vue +++ b/src/views/system/Department/device/index.vue @@ -1,16 +1,19 @@ + + + +
(); -const query = { - columns: [ - { - title: 'ID', - dataIndex: 'id', - key: 'id', - ellipsis: true, - fixed: 'left', - search: { - type: 'string', - }, +const columns = [ + { + title: 'ID', + dataIndex: 'id', + key: 'id', + ellipsis: true, + fixed: 'left', + search: { + type: 'string', }, - { - title: '名称', - dataIndex: 'name', - key: 'name', - ellipsis: true, - fixed: 'left', - search: { - type: 'string', - }, - }, - { - title: '所属产品', - dataIndex: 'productId$product-info', - key: 'productId$product-info', - ellipsis: true, - fixed: 'left', - search: { - type: 'select', - options: () => - new Promise((resolve) => { - const params = { - paging: false, - 'sorts[0].name': 'createTime', - 'sorts[0].order': 'desc', - }; - getDeviceProduct_api(params).then((resp: any) => { - const result = resp.result.map((item: any) => ({ - label: item.name, - value: item.id, - })); - resolve(result); - }); - }), - }, - }, - { - title: '注册时间', - dataIndex: 'registryTime', - key: 'registryTime', - ellipsis: true, - fixed: 'left', - search: { - type: 'date', - }, - }, - { - title: '状态', - dataIndex: 'state', - key: 'state', - ellipsis: true, - fixed: 'left', - search: { - type: 'select', - options: [ - { - label: '在线', - value: 'online', - }, - { - label: '离线', - value: 'offline', - }, - { - label: '禁用', - value: 'notActive', - }, - ], - }, - }, - ], - params: ref({}), - search: (params: any) => { - query.params.value = params; }, -}; + { + title: '名称', + dataIndex: 'name', + key: 'name', + ellipsis: true, + search: { + type: 'string', + }, + }, + { + title: '所属产品', + dataIndex: 'productName', + key: 'productName', + ellipsis: true, + search: { + rename: 'productId$product-info', + type: 'select', + options: () => + new Promise((resolve) => { + const params = { + paging: false, + 'sorts[0].name': 'createTime', + 'sorts[0].order': 'desc', + }; + getDeviceProduct_api(params).then((resp: any) => { + const result = resp.result.map((item: any) => ({ + label: item.name, + value: item.id, + })); + resolve(result); + }); + }), + }, + }, + { + title: '资产权限', + dataIndex: 'permission', + key: 'permission', + ellipsis: true, + scopedSlots: true, + }, + { + title: '注册时间', + dataIndex: 'registryTime', + key: 'registryTime', + ellipsis: true, + search: { + type: 'date', + }, + }, + { + title: '状态', + dataIndex: 'state', + key: 'state', + ellipsis: true, + search: { + type: 'select', + options: [ + { + label: '正常', + value: 1, + }, + { + label: '禁用', + value: 0, + }, + ], + }, + scopedSlots: true, + }, + + { + title: '操作', + dataIndex: 'action', + key: 'action', + fixed: 'right', + scopedSlots: true, + }, +]; +const queryParams = ref({}); const tableRef = ref(); const table = { @@ -285,6 +325,32 @@ const table = { ); }, + getActions: ( + data: Partial>, + type: 'card' | 'table', + ) => { + if (!data) return []; + else + return [ + { + permission: true, + key: 'edit', + tooltip: { title: '编辑' }, + icon: 'EditOutlined', + onClick: () => table.clickEdit(data), + }, + { + permission: true, + key: 'unbind', + tooltip: { title: '解除绑定' }, + popConfirm: { + title: `是否解除绑定`, + onConfirm: () => table.clickUnBind(data), + }, + icon: 'DisconnectOutlined', + }, + ]; + }, // 获取权限数据字典 getPermissionDict: () => { getPermissionDict_api().then((resp: any) => { diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue index c7ba80d5..a2916425 100644 --- a/src/views/system/Department/product/index.vue +++ b/src/views/system/Department/product/index.vue @@ -1,11 +1,14 @@