Browse Source

通用物模型

yanghao 1 tuần trước cách đây
mục cha
commit
f995ada61c

+ 1 - 1
.env.local

@@ -4,7 +4,7 @@ NODE_ENV=development
 VITE_DEV=true
 
 # 请求路径  http://192.168.188.60:48080  https://iot.deepoil.cc:5443  http://172.26.0.56:48080  http://192.168.188.198:48080
-VITE_BASE_URL='http://192.168.188.60:48080'
+VITE_BASE_URL='https://iot.deepoil.cc:5443'
 
 # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
 VITE_UPLOAD_TYPE=server

+ 6 - 0
src/api/iot/thingmodel/index.ts

@@ -197,6 +197,12 @@ export const ThingModelApi = {
   // 删除产品物模型
   deleteThingModel: async (id: number) => {
     return await request.delete({ url: `/iot/thing-model/delete?id=` + id })
+  },
+  // 导入通用物模型
+  importCommonThingModel: async (data) => {
+    return await request.get({
+      url: `/iot/thing-model/import-common?commonId=${data.commonId}&productId=${data.productId}`
+    })
   }
 }
 

+ 5 - 12
src/views/iot/thingmodel/index.vue

@@ -334,18 +334,11 @@ const submitImportCommonThing = async () => {
 
   importSubmitting.value = true
   try {
-    await Promise.all(
-      selectedCommonThingRows.value.map(async (item) => {
-        if (!item.id) return
-        const detail = await ThingModelCommon.getCommonThingModel(item.id)
-        await ThingModelApi.createThingModel({
-          ...detail,
-          id: undefined,
-          productId: product.value.id,
-          productKey: product.value.productKey
-        })
-      })
-    )
+    await ThingModelApi.importCommonThingModel({
+      commonId: selectedCommonThingRows.value.map((item) => item.id).join(','),
+      productId: product.value.id
+    })
+
     message.success('导入成功')
     closeImportDialog()
     await getList()

+ 1 - 1
src/views/pms/fiveDailyReportSummary/index.vue

@@ -192,7 +192,7 @@ function handleDeptCellClick(row) {
   if (rowType === '2' && row?.projectDeptId) {
     query.value.deptId = row.projectDeptId
     currentDeptName.value = row.projectDeptName || row.deptDisplayName || '5号国'
-    selectedDeptType.value = '1'
+    selectedDeptType.value = '2'
     return
   }