浏览代码

换热区数据模型联调

picasso 3 年之前
父节点
当前提交
4d46920623
共有 3 个文件被更改,包括 13 次插入6 次删除
  1. 2 2
      .env.development
  2. 1 0
      src/api/heatStation/index.ts
  3. 10 4
      src/views/heatStation/heatStation/component/edit.vue

+ 2 - 2
.env.development

@@ -2,11 +2,11 @@
 ENV = 'development'
 
 # 本地环境接口地址
-VITE_API_URL = 'http://zhgy.sagoo.cn:8899/api/v1'
+#VITE_API_URL = 'http://zhgy.sagoo.cn:8899/api/v1'
 VITE_IMG_URL = 'http://zhgy.sagoo.cn:8899/'
 VITE_ASSESS_URL = 'http://zhgy.sagoo.cn/base-api/assess/v1'
 VITE_SCREEN_URL = 'http://home.yanglizhi.cn:10003'
 VITE_TOPO_URL = 'http://home.yanglizhi.cn:10001'
 VITE_WS_URL = 'ws://zhgy.sagoo.cn:8899/api/v1/websocket'
-# VITE_API_URL = 'http://sgadserver.wdeveloperw.xyz/api/v1'
+VITE_API_URL = 'http://sgadserver.wdeveloperw.xyz/api/v1'
 # VITE_IMG_URL = 'http://sgadserver.wdeveloperw.xyz/'

+ 1 - 0
src/api/heatStation/index.ts

@@ -14,5 +14,6 @@ export default {
     add: (data: object) => post('/region/heatStation/add', data),
     edit: (data: object) => put('/region/heatStation/edit', data),
     del: (id: number) => del('/region/heatStation/del', { id }),
+    detail: (id: number) => get('/region/heatStation/getInfoById', { id }),
   }
 }

+ 10 - 4
src/views/heatStation/heatStation/component/edit.vue

@@ -114,10 +114,8 @@ export default defineComponent({
 			state.treeData = tree
 
 			if (row) {
-				state.ruleForm = {
-					...row,
-					parentId: row.parentId === -1 ? '' : row.parentId
-				}
+				(state.ruleForm as any).id = row.id
+				getDetail()
 			}
 			nextTick(() => {
 				initMap()
@@ -153,6 +151,14 @@ export default defineComponent({
 			closeDialog()
 			state.keyword = ''
 		}
+		const getDetail = () => {
+			api.heatStation.detail(state.ruleForm.id)
+				.then((res: any) => {
+					state.ruleForm = {
+						...res
+					}
+				})
+		}
 		// 新增
 		const onSubmit = () => {
 			const formWrap = unref(formRef) as any