From 66e88145c7a9981ab9cd6f5dc04980d34f7c0548 Mon Sep 17 00:00:00 2001 From: easy <1358086367@qq.com> Date: Tue, 17 Jan 2023 11:38:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E8=A7=92=E8=89=B2=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/role.ts | 3 + src/components/Search/Search.vue | 2 +- src/router/menu.ts | 5 +- .../system/Role/components/AddDialog.vue | 27 ++++ src/views/system/Role/index.vue | 124 ++++++++++++++++++ 5 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 src/api/system/role.ts create mode 100644 src/views/system/Role/components/AddDialog.vue create mode 100644 src/views/system/Role/index.vue diff --git a/src/api/system/role.ts b/src/api/system/role.ts new file mode 100644 index 00000000..f5764379 --- /dev/null +++ b/src/api/system/role.ts @@ -0,0 +1,3 @@ +import server from '@/utils/request'; + +export const getRoleList_api = (data: any): Promise => server.post(`/role/_query/`, data); \ No newline at end of file diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 90992988..cc0bf08b 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -71,7 +71,7 @@ - + + + diff --git a/src/views/system/Role/index.vue b/src/views/system/Role/index.vue new file mode 100644 index 00000000..e5ebeb01 --- /dev/null +++ b/src/views/system/Role/index.vue @@ -0,0 +1,124 @@ + + + + + From 5e5087602ce69919b11ea3da65add2cea973636f Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Tue, 17 Jan 2023 18:04:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/comm.ts | 5 +- src/api/device/instance.ts | 26 +++++ src/components/AIcon/index.tsx | 3 +- src/components/CardBox/index.vue | 4 + src/components/FileFormat/index.vue | 36 ++++++ src/components/JUpload/index.vue | 70 ++++++++++++ src/components/NormalUpload/index.vue | 116 ++++++++++++++++++++ src/components/Table/index.tsx | 8 +- src/components/index.ts | 6 + src/views/device/Instance/Export/index.vue | 12 +- src/views/device/Instance/Import/index.vue | 63 ++++++++++- src/views/device/Instance/Process/index.vue | 63 +++++++++-- src/views/device/Instance/Save/index.vue | 70 ++++++++++++ src/views/device/Instance/index.vue | 45 +++++--- 14 files changed, 481 insertions(+), 46 deletions(-) create mode 100644 src/components/FileFormat/index.vue create mode 100644 src/components/JUpload/index.vue create mode 100644 src/components/NormalUpload/index.vue create mode 100644 src/views/device/Instance/Save/index.vue diff --git a/src/api/comm.ts b/src/api/comm.ts index 8e987884..a61cd32c 100644 --- a/src/api/comm.ts +++ b/src/api/comm.ts @@ -1,3 +1,6 @@ import { BASE_API_PATH } from "@/utils/variable"; -export const FILE_UPLOAD = `${BASE_API_PATH}/file/static`; +/** + * 上传文件 + */ +export const FILE_UPLOAD = `${BASE_API_PATH}/file/static`; \ No newline at end of file diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index fb34ebd1..9f051caf 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -1,4 +1,5 @@ import server from '@/utils/request' +import { BASE_API_PATH } from '@/utils/variable' import { DeviceInstance } from '@/views/device/instance/typings' /** @@ -73,3 +74,28 @@ export const batchUndeployDevice = (data: string[]) => server.put(`/device-insta * @returns */ export const batchDeleteDevice = (data: string[]) => server.put(`/device-instance/batch/_delete`, data) + +/** + * 下载设备模板 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ + export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` + + /** + * 设备导入 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ + export const deviceImport = (productId: string, fileUrl: string, autoDeploy: boolean) => `${BASE_API_PATH}/device-instance/${productId}/import?fileUrl=${fileUrl}&autoDeploy=${autoDeploy}&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` + + /** + * 设备导出 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ + export const deviceExport = (productId: string, type: string) => `${BASE_API_PATH}/device-instance${!!productId ? '/' + productId : ''}/export.${type}` + diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index bcc04f86..02e6d8a2 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -25,7 +25,8 @@ const iconKeys = [ 'ImportOutlined', 'ExportOutlined', 'SyncOutlined', - 'ExclamationCircleOutlined' + 'ExclamationCircleOutlined', + 'UploadOutlined' ] const Icon = (props: {type: string}) => { diff --git a/src/components/CardBox/index.vue b/src/components/CardBox/index.vue index 9c0ac3a3..b3449223 100644 --- a/src/components/CardBox/index.vue +++ b/src/components/CardBox/index.vue @@ -228,6 +228,10 @@ const handleClick = () => { transform: skewX(-45deg); } } + + :deep(.card-item-content-title) { + cursor: pointer; + } } .card-mask { diff --git a/src/components/FileFormat/index.vue b/src/components/FileFormat/index.vue new file mode 100644 index 00000000..dd63b90d --- /dev/null +++ b/src/components/FileFormat/index.vue @@ -0,0 +1,36 @@ + + + \ No newline at end of file diff --git a/src/components/JUpload/index.vue b/src/components/JUpload/index.vue new file mode 100644 index 00000000..c7f612de --- /dev/null +++ b/src/components/JUpload/index.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/src/components/NormalUpload/index.vue b/src/components/NormalUpload/index.vue new file mode 100644 index 00000000..6eb48c6d --- /dev/null +++ b/src/components/NormalUpload/index.vue @@ -0,0 +1,116 @@ + + + \ No newline at end of file diff --git a/src/components/Table/index.tsx b/src/components/Table/index.tsx index 9e76e074..92069199 100644 --- a/src/components/Table/index.tsx +++ b/src/components/Table/index.tsx @@ -174,8 +174,14 @@ const JTable = defineComponent({ loading.value = true if(props.request) { const resp = await props.request({ + pageIndex: 0, + pageSize: 12, ...props.defaultParams, - ..._params + ..._params, + terms: [ + ...(props.defaultParams?.terms || []), + ...(_params?.terms || []) + ] }) if(resp.status === 200){ if(props.type === 'PAGE'){ diff --git a/src/components/index.ts b/src/components/index.ts index 1c14b417..ed95c26d 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -6,6 +6,9 @@ import TitleComponent from "./TitleComponent/index.vue"; import Form from './Form'; import CardBox from './CardBox/index.vue'; import Search from './Search' +import NormalUpload from './NormalUpload/index.vue' +import FileFormat from './FileFormat/index.vue' +import JUpload from './JUpload/index.vue' export default { install(app: App) { @@ -16,5 +19,8 @@ export default { .component('Form', Form) .component('CardBox', CardBox) .component('Search', Search) + .component('NormalUpload', NormalUpload) + .component('FileFormat', FileFormat) + .component('JUpload', JUpload) } } diff --git a/src/views/device/Instance/Export/index.vue b/src/views/device/Instance/Export/index.vue index 8db0d050..9f49c011 100644 --- a/src/views/device/Instance/Export/index.vue +++ b/src/views/device/Instance/Export/index.vue @@ -29,6 +29,7 @@ import { queryNoPagingPost } from '@/api/device/product' import { downloadFile } from '@/utils/utils' import encodeQuery from '@/utils/encodeQuery' import { BASE_API_PATH } from '@/utils/variable' +import { deviceExport } from '@/api/device/instance' const emit = defineEmits(['close']) const props = defineProps({ @@ -58,15 +59,8 @@ watch( const handleOk = () => { const params = encodeQuery(props.data); - if(modelRef.product){ - downloadFile( - `${BASE_API_PATH}/device/instance/${modelRef.product}/export.${modelRef.fileType}`, - params - ); - } else { - downloadFile(`${BASE_API_PATH}/device/instance/export.${modelRef.fileType}`, params); - } - emit('close') + downloadFile(deviceExport(modelRef.product || "", modelRef.fileType),params); + emit('close') } const handleCancel = () => { diff --git a/src/views/device/Instance/Import/index.vue b/src/views/device/Instance/Import/index.vue index f3e68440..899cdb61 100644 --- a/src/views/device/Instance/Import/index.vue +++ b/src/views/device/Instance/Import/index.vue @@ -1,14 +1,67 @@ \ No newline at end of file diff --git a/src/views/device/Instance/Process/index.vue b/src/views/device/Instance/Process/index.vue index 972da530..7dda3761 100644 --- a/src/views/device/Instance/Process/index.vue +++ b/src/views/device/Instance/Process/index.vue @@ -1,16 +1,16 @@ \ No newline at end of file diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue index 447a2053..2e1d2544 100644 --- a/src/views/device/Instance/index.vue +++ b/src/views/device/Instance/index.vue @@ -73,7 +73,7 @@