From 15705f24f4f18b7fc1fd415bec2c207d04c88d44 Mon Sep 17 00:00:00 2001 From: "liupo.wu" Date: Sat, 15 Jul 2023 09:08:50 +0800 Subject: [PATCH 1/7] fix: gen tool --- src/views/tool/gen/index.vue | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/views/tool/gen/index.vue b/src/views/tool/gen/index.vue index 285b7cd..0280809 100644 --- a/src/views/tool/gen/index.vue +++ b/src/views/tool/gen/index.vue @@ -89,12 +89,7 @@ - +  复制 @@ -139,9 +134,9 @@ const queryParams = ref({ dataName: 'master' }) -const preview = ref ({ - data: {}, - activeName: 'domain.java' +const preview = ref({ + data: {} as Record, + activeName: '' }) const dialog = reactive({ visible: false, @@ -206,12 +201,19 @@ const resetQuery = () => { queryFormRef.value.resetFields() handleQuery() } + +const fileNameRegExp = /([\w._-]+)\.vm$/ /** 预览按钮 */ const handlePreview = async (row: TableVO) => { const res = await previewTable(row.tableId) - preview.value.data = res.data + const data: Record = {} + for (const key in res.data) { + // key: vm/java/controller.java.vm => controller.java + data[key.match(fileNameRegExp)?.[1] || key] = res.data[key] + } + preview.value.data = data dialog.visible = true - preview.value.activeName = 'domain.java' + preview.value.activeName = Object.keys(data)[0] } /** 复制代码成功 */ const copyTextSuccess = () => { -- Gitee From 55ae8943848a4d5bcbf51862e705089b7798a5f7 Mon Sep 17 00:00:00 2001 From: "liupo.wu" Date: Sat, 15 Jul 2023 09:32:59 +0800 Subject: [PATCH 2/7] fix: readme for deploy --- README.md | 32 ++++++++++++++++++++++++++++++-- vite.config.ts | 4 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 431de89..1dbe20c 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ npm i pnpm -g pnpm config set registry https://registry.npmmirror.com/ # 安装依赖 -如之前安装老版本,或者使用npm i、yarn、cnpm i安装过node_modules,请先删除在进行安装。 +如之前安装老版本,或者使用 npm i、yarn、cnpm i 安装过 node_modules,请先删除在进行安装。 pnpm install # 启动服务 @@ -83,7 +83,35 @@ pnpm run dev # 构建生产环境 yarn build:prod + # 前端访问地址 -http://localhost:8082[奇特目录.md](..%2F..%2F..%2F%CF%C2%D4%D8%2F%C6%E6%CC%D8%C4%BF%C2%BC.md) +http://localhost:8082 +``` + +## 生产环境配置示例 +- pro 前缀和 `.env.production` 文件中的一致 +- 服务器上静态资源的目录 `/www/wwwroot` 根据实际情况调整 +```nginx +server +{ + listen 80; + server_name your.domain; + index index.html; + root /www/wwwroot; + + location /api/ + { + rewrite /api(.*) $1 break; + proxy_pass http://127.0.0.1:8086/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_http_version 1.1; + } +} +``` diff --git a/vite.config.ts b/vite.config.ts index 80fdec6..78da735 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,9 +26,9 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => { open: true, proxy: { [env.VITE_APP_BASE_API]: { - target: 'http://127.0.0.1:8086', + target: 'http://112.17.190.29:8000', changeOrigin: true, - rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''), + // rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''), }, }, }, -- Gitee From dae9df46a7cab9d4f17bca8f756626a9384d2731 Mon Sep 17 00:00:00 2001 From: "liupo.wu" Date: Sun, 16 Jul 2023 11:41:57 +0800 Subject: [PATCH 3/7] fix: element --- src/components/Map/index.vue | 2 +- src/components/Pagination/index.vue | 6 +- src/components/TreeSelect/index.vue | 2 +- src/components/YtSelect/select-device.vue | 2 +- src/components/YtSelect/select-product.vue | 4 +- src/components/common/yt-table-fun.vue | 2 +- src/components/common/yt-table-search.tsx | 5 +- src/components/common/yt-table.tsx | 1 - src/layout/components/Navbar.vue | 2 +- src/views/demo/demo/index.vue | 12 +- src/views/demo/tree/index.vue | 16 +- src/views/iot/channel/config.vue | 2 +- .../iot/communication/components/index.vue | 80 ++++------ src/views/iot/crudDemo/crudDemo.vue | 6 +- src/views/iot/crudDemo/disperseDemo.vue | 2 +- src/views/iot/equipment/devices/detail.vue | 46 +++--- src/views/iot/equipment/devices/list.vue | 10 +- .../devices/modules/childrenDialog.vue | 2 - .../devices/modules/detail/DeviceLog.vue | 12 +- .../detail/DeviceSimulatorProperties.vue | 2 +- .../devices/modules/detail/MqttClient.vue | 64 ++++---- .../modules/virtualDevices/bindDevices.vue | 2 - .../devices/modules/virtualDevices/log.vue | 2 - .../devices/modules/virtualDevices/script.vue | 2 - src/views/iot/equipment/products/index.vue | 3 +- .../modules/components/PropertyModel.vue | 45 +++--- .../modules/modeuls/functionDetail.vue | 146 +++++++++--------- .../modules/modeuls/modelNumberDetail.vue | 6 +- .../products/modules/objectModel.vue | 16 +- src/views/iot/ota/upgradePack/index.vue | 2 - .../ruleSys/components/DeviceAction.vue | 10 +- .../ruleSys/components/HttpAction.vue | 2 +- .../ruleSys/components/KafkaAction.vue | 6 +- .../ruleSys/components/MqttAction.vue | 8 +- .../ruleSys/components/TcpAction.vue | 4 +- .../ruleEngine/ruleSys/modules/filtera.vue | 12 +- .../ruleEngine/ruleSys/modules/listener.vue | 8 +- src/views/login.vue | 8 +- src/views/monitor/logininfor/index.vue | 10 +- src/views/monitor/online/index.vue | 5 +- src/views/monitor/operlog/index.vue | 10 +- src/views/register.vue | 8 +- src/views/system/config/index.vue | 12 +- src/views/system/dept/index.vue | 15 +- src/views/system/dict/data.vue | 21 +-- src/views/system/dict/index.vue | 14 +- src/views/system/menu/index.vue | 16 +- src/views/system/notice/index.vue | 14 +- src/views/system/oss/config.vue | 12 +- src/views/system/oss/index.vue | 10 +- src/views/system/post/index.vue | 11 +- src/views/system/role/authUser.vue | 11 +- src/views/system/role/index.vue | 24 +-- src/views/system/role/selectUser.vue | 10 +- src/views/system/tenant/index.vue | 12 +- src/views/system/tenantPackage/index.vue | 20 +-- src/views/system/user/authRole.vue | 8 +- src/views/system/user/index.vue | 42 ++--- src/views/system/user/profile/resetPwd.vue | 6 +- src/views/system/user/profile/userInfo.vue | 7 +- src/views/tool/gen/basicInfoForm.vue | 2 +- src/views/tool/gen/editTable.vue | 4 +- src/views/tool/gen/genInfoForm.vue | 10 +- src/views/tool/gen/importTable.vue | 10 +- src/views/tool/gen/index.vue | 8 +- 65 files changed, 419 insertions(+), 475 deletions(-) diff --git a/src/components/Map/index.vue b/src/components/Map/index.vue index cea8fe2..0742067 100644 --- a/src/components/Map/index.vue +++ b/src/components/Map/index.vue @@ -14,7 +14,7 @@ @change="regeoCode" :loading="state.loading" > - + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index 5f4ac5b..aca5610 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -7,7 +7,7 @@ :layout="layout" :page-sizes="customPageSize" :pager-count="pagerCount" - :total="total" + :total="total || 0" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> @@ -27,7 +27,7 @@ import { PropType } from 'vue' const props = defineProps({ total: { - required: true, + required: false, type: Number }, page: { @@ -98,7 +98,7 @@ const pageSize = computed({ } }) function handleSizeChange(val: number) { - if (currentPage.value * val > props.total) { + if (props.total && currentPage.value * val > props.total) { currentPage.value = 1 } emit('pagination', { page: currentPage.value, limit: val }) diff --git a/src/components/TreeSelect/index.vue b/src/components/TreeSelect/index.vue index c8b9f02..bf8f9d0 100644 --- a/src/components/TreeSelect/index.vue +++ b/src/components/TreeSelect/index.vue @@ -22,7 +22,7 @@ :default-expanded-keys="defaultExpandedKey" :filter-node-method="filterNode" @node-click="handleNodeClick" - > + /> diff --git a/src/components/YtSelect/select-device.vue b/src/components/YtSelect/select-device.vue index ff7debb..5907b1a 100644 --- a/src/components/YtSelect/select-device.vue +++ b/src/components/YtSelect/select-device.vue @@ -1,7 +1,7 @@ @@ -145,10 +145,10 @@ - + - + @@ -156,30 +156,30 @@ @@ -191,26 +191,26 @@ 发送 - + + /> + - +
Receive
- +
diff --git a/src/views/iot/equipment/devices/modules/virtualDevices/bindDevices.vue b/src/views/iot/equipment/devices/modules/virtualDevices/bindDevices.vue index 56c3250..569a815 100644 --- a/src/views/iot/equipment/devices/modules/virtualDevices/bindDevices.vue +++ b/src/views/iot/equipment/devices/modules/virtualDevices/bindDevices.vue @@ -2,5 +2,3 @@
虚拟设备详情
- - diff --git a/src/views/iot/equipment/devices/modules/virtualDevices/log.vue b/src/views/iot/equipment/devices/modules/virtualDevices/log.vue index cb0f9cb..4fc5753 100644 --- a/src/views/iot/equipment/devices/modules/virtualDevices/log.vue +++ b/src/views/iot/equipment/devices/modules/virtualDevices/log.vue @@ -2,5 +2,3 @@
日志
- - diff --git a/src/views/iot/equipment/devices/modules/virtualDevices/script.vue b/src/views/iot/equipment/devices/modules/virtualDevices/script.vue index 7564d83..a6b80cc 100644 --- a/src/views/iot/equipment/devices/modules/virtualDevices/script.vue +++ b/src/views/iot/equipment/devices/modules/virtualDevices/script.vue @@ -2,5 +2,3 @@
脚本
- - diff --git a/src/views/iot/equipment/products/index.vue b/src/views/iot/equipment/products/index.vue index ff2776f..aa38b5c 100644 --- a/src/views/iot/equipment/products/index.vue +++ b/src/views/iot/equipment/products/index.vue @@ -193,7 +193,7 @@ const getNodeTypeNmae = (type) => { let cateOptions: any[] = [] const getCateName = (id: string) => { - return cateOptions.find(f => f.id === id).name || '' + return cateOptions.find(f => f.id === id)?.name || '' } const data = ref([]) const randomString=(len:number)=> { @@ -345,6 +345,7 @@ const getData = () => { // 获取字典 const getDict = () => { getCategoriesAll().then(res => { + res = res || {} cateOptions = res.data || [] column.value.forEach(item => { if (item.key === 'category') { diff --git a/src/views/iot/equipment/products/modules/components/PropertyModel.vue b/src/views/iot/equipment/products/modules/components/PropertyModel.vue index c97f5e2..cf3fd71 100644 --- a/src/views/iot/equipment/products/modules/components/PropertyModel.vue +++ b/src/views/iot/equipment/products/modules/components/PropertyModel.vue @@ -2,20 +2,23 @@
- + + + + - + - - - - - - - + + + + + + + @@ -23,9 +26,9 @@ 定位方式 - - - + + + @@ -33,22 +36,22 @@ 取值范围 - + - - + 取值范围 - + - - +   @@ -61,12 +64,12 @@ 布尔值 0 - - +   1 - - + @@ -74,12 +77,12 @@ 枚举值 - +   枚举描述 - +   @@ -92,7 +95,7 @@ 数据长度 - + String类型的UTC时间戳(毫秒) diff --git a/src/views/iot/equipment/products/modules/modeuls/functionDetail.vue b/src/views/iot/equipment/products/modules/modeuls/functionDetail.vue index 28bac46..71dd6ad 100644 --- a/src/views/iot/equipment/products/modules/modeuls/functionDetail.vue +++ b/src/views/iot/equipment/products/modules/modeuls/functionDetail.vue @@ -16,38 +16,37 @@ :boolItem="state.boolItem" :isProperty="true" :isUpdate="!state.isAdd" - > + />
-
+
- + - + - + - +
-
+
- + - + - +
- 取消 保存 @@ -155,74 +154,73 @@ const saveThingModel = async () => { const valid = await fun() if (valid) { if (state.isAdd) { - if (state.modelForm.type == 'property') { - //删除旧的 - const idx = state.model.properties.findIndex( - (p: any) => p.identifier == state.modelForm.raw.identifier - ) - if (idx >= 0) { - state.model.properties.splice(idx, 1) - } + if (state.modelForm.type == 'property') { + //删除旧的 + const idx = state.model.properties.findIndex( + (p: any) => p.identifier == state.modelForm.raw.identifier + ) + if (idx >= 0) { + state.model.properties.splice(idx, 1) + } + state.model.properties.push(newProperty()) + } else if (state.modelForm.type == 'service') { + //删除旧的 + const idx = state.model.services.findIndex( + (p: any) => p.identifier == state.modelForm.raw.identifier + ) + if (idx >= 0) { + state.model.services.splice(idx, 1) + } - state.model.properties.push(newProperty()) - } else if (state.modelForm.type == 'service') { - //删除旧的 - const idx = state.model.services.findIndex( - (p: any) => p.identifier == state.modelForm.raw.identifier - ) - if (idx >= 0) { - state.model.services.splice(idx, 1) - } + state.model.services.push({ + identifier: state.modelForm.identifier, + name: state.modelForm.name, + inputData: state.modelForm.raw.inputData, + outputData: state.modelForm.raw.outputData, + }) + } else if (state.modelForm.type == 'event') { + //删除旧的 + const idx = state.model.events.findIndex( + (p: any) => p.identifier == state.modelForm.raw.identifier + ) + if (idx >= 0) { + state.model.events.splice(idx, 1) + } - state.model.services.push({ - identifier: state.modelForm.identifier, - name: state.modelForm.name, - inputData: state.modelForm.raw.inputData, - outputData: state.modelForm.raw.outputData, - }) - } else if (state.modelForm.type == 'event') { - //删除旧的 - const idx = state.model.events.findIndex( - (p: any) => p.identifier == state.modelForm.raw.identifier - ) - if (idx >= 0) { - state.model.events.splice(idx, 1) + state.model.events.push({ + identifier: state.modelForm.identifier, + name: state.modelForm.name, + outputData: state.modelForm.raw.outputData, + }) } - - state.model.events.push({ - identifier: state.modelForm.identifier, - name: state.modelForm.name, - outputData: state.modelForm.raw.outputData, - }) - } - } else { - if (state.modelForm.type == 'property') { - let prop = newProperty() - for (var i = 0; i < state.model.properties.length; i++) { - if (state.model.properties[i].identifier == prop.identifier) { - state.model.properties[i] = prop + } else { + if (state.modelForm.type == 'property') { + let prop = newProperty() + for (var i = 0; i < state.model.properties?.length; i++) { + if (state.model.properties[i].identifier == prop.identifier) { + state.model.properties[i] = prop + } } + } else if (state.modelForm.type == 'service') { + state.model.services.forEach((s: any) => { + if (s.identifier == state.modelForm.identifier) { + s.identifier = state.modelForm.identifier + s.name = state.modelForm.name + s.inputData = state.modelForm.raw.inputData + s.outputData = state.modelForm.raw.outputData + } + }) + } else if (state.modelForm.type == 'event') { + state.model.events.forEach((s: any) => { + if (s.identifier == state.modelForm.identifier) { + s.identifier = state.modelForm.identifier + s.name = state.modelForm.name + s.outputData = state.modelForm.raw.outputData + } + }) } - } else if (state.modelForm.type == 'service') { - state.model.services.forEach((s: any) => { - if (s.identifier == state.modelForm.identifier) { - s.identifier = state.modelForm.identifier - s.name = state.modelForm.name - s.inputData = state.modelForm.raw.inputData - s.outputData = state.modelForm.raw.outputData - } - }) - } else if (state.modelForm.type == 'event') { - state.model.events.forEach((s: any) => { - if (s.identifier == state.modelForm.identifier) { - s.identifier = state.modelForm.identifier - s.name = state.modelForm.name - s.outputData = state.modelForm.raw.outputData - } - }) } - } - submitThingModelChange() + submitThingModelChange() } } @@ -230,5 +228,3 @@ defineExpose({ openDialog, }) - - diff --git a/src/views/iot/equipment/products/modules/modeuls/modelNumberDetail.vue b/src/views/iot/equipment/products/modules/modeuls/modelNumberDetail.vue index 66600b1..e089e77 100644 --- a/src/views/iot/equipment/products/modules/modeuls/modelNumberDetail.vue +++ b/src/views/iot/equipment/products/modules/modeuls/modelNumberDetail.vue @@ -4,10 +4,10 @@ 默认 自定义 - + - + @@ -90,5 +90,3 @@ defineExpose({ openDialog, }) - - diff --git a/src/views/iot/equipment/products/modules/objectModel.vue b/src/views/iot/equipment/products/modules/objectModel.vue index 70b8747..acf469f 100644 --- a/src/views/iot/equipment/products/modules/objectModel.vue +++ b/src/views/iot/equipment/products/modules/objectModel.vue @@ -1,15 +1,15 @@ diff --git a/src/views/iot/communication/convertors/index.vue b/src/views/iot/communication/convertors/index.vue index f9c4db1..4234cbf 100644 --- a/src/views/iot/communication/convertors/index.vue +++ b/src/views/iot/communication/convertors/index.vue @@ -20,13 +20,14 @@ > - +
+ diff --git a/src/views/iot/equipment/devices/modules/virtualDevices/log.vue b/src/views/iot/equipment/devices/modules/virtualDevices/log.vue index 4fc5753..7bc3c53 100644 --- a/src/views/iot/equipment/devices/modules/virtualDevices/log.vue +++ b/src/views/iot/equipment/devices/modules/virtualDevices/log.vue @@ -1,4 +1,5 @@ + diff --git a/src/views/iot/equipment/devices/modules/virtualDevices/script.vue b/src/views/iot/equipment/devices/modules/virtualDevices/script.vue index a6b80cc..1ebbec2 100644 --- a/src/views/iot/equipment/devices/modules/virtualDevices/script.vue +++ b/src/views/iot/equipment/devices/modules/virtualDevices/script.vue @@ -1,4 +1,5 @@ + diff --git a/src/views/iot/equipment/devices/virtualDeviceConfig.vue b/src/views/iot/equipment/devices/virtualDeviceConfig.vue index e30fa03..302d08a 100644 --- a/src/views/iot/equipment/devices/virtualDeviceConfig.vue +++ b/src/views/iot/equipment/devices/virtualDeviceConfig.vue @@ -1,6 +1,6 @@ - - diff --git a/src/views/iot/equipment/products/index.vue b/src/views/iot/equipment/products/index.vue index aa38b5c..3ccc2e7 100644 --- a/src/views/iot/equipment/products/index.vue +++ b/src/views/iot/equipment/products/index.vue @@ -95,7 +95,7 @@
@@ -104,7 +104,7 @@ - + + - - diff --git a/src/views/iot/equipment/products/modules/components/PropertyModel.vue b/src/views/iot/equipment/products/modules/components/PropertyModel.vue index cf3fd71..890793d 100644 --- a/src/views/iot/equipment/products/modules/components/PropertyModel.vue +++ b/src/views/iot/equipment/products/modules/components/PropertyModel.vue @@ -4,9 +4,6 @@ - - - diff --git a/src/views/iot/equipment/products/modules/functionConfig.vue b/src/views/iot/equipment/products/modules/functionConfig.vue index 9b7d879..48675bf 100644 --- a/src/views/iot/equipment/products/modules/functionConfig.vue +++ b/src/views/iot/equipment/products/modules/functionConfig.vue @@ -1,5 +1,5 @@ + - - diff --git a/src/views/monitor/admin/index.vue b/src/views/monitor/admin/index.vue index c69436d..902fe7c 100644 --- a/src/views/monitor/admin/index.vue +++ b/src/views/monitor/admin/index.vue @@ -1,7 +1,5 @@