8
0
ZaiZai 9 månader sedan
förälder
incheckning
d99007680c
2 ändrade filer med 26 tillägg och 6 borttagningar
  1. 24 5
      src/views/project/detail/info.vue
  2. 2 1
      src/views/project/detail/table.vue

+ 24 - 5
src/views/project/detail/info.vue

@@ -243,6 +243,9 @@ const props = defineProps({
     },
 })
 
+//事件
+const emit = defineEmits(['close', 'next'])
+
 //渲染完成
 onMounted(() => {
     getDataApi()
@@ -296,7 +299,10 @@ const getContractInfo = async () => {
     contractForm.value = {}
     if (isNullES(cid)) return
     const { data } = await mainApi.detail(cid)
-    contractForm.value = getObjValue(data)
+    const res = getObjValue(data)
+    const info = getObjValue(res.meterContractInfo)
+    res.meterContractInfo = info
+    contractForm.value = res
 }
 
 //获取合同段基本信息
@@ -308,7 +314,10 @@ const getContractInfo2 = async () => {
         id: cid,
         contractType: type,
     })
-    contractForm.value = getObjValue(data)
+    const res = getObjValue(data)
+    const info = getObjValue(res.meterContractInfo)
+    res.meterContractInfo = info
+    contractForm.value = res
 }
 
 //获取业务字典
@@ -377,13 +386,23 @@ const getContractRelation = async () => {
 }
 
 //保存并退出
-const saveAndExit = () => {
-
+const saveAndExit = async () => {
+    const isRes = await saveDataApi()
+    if (!isRes) return
+    emit('close')
 }
 
 //保存并进入下一步
-const saveAndNextStep = () => {
+const saveAndNextStep = async () => {
+    const isRes = await saveDataApi()
+    if (!isRes) return
+    emit('next')
+}
 
+//保存数据
+const submitLoading = ref(false)
+const saveDataApi = async () => {
+    console.log(contractForm.value)
 }
 </script>
 

+ 2 - 1
src/views/project/detail/table.vue

@@ -123,6 +123,7 @@
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
+import { getObjValue } from 'js-fast-way'
 
 //双向绑定
 const modelData = defineModel('modelValue', {
@@ -132,7 +133,7 @@ const modelData = defineModel('modelValue', {
 //监听数据
 const formModel = ref({})
 watch(() => modelData.value, (data) => {
-    formModel.value = data
+    formModel.value = getObjValue(data)
 }, { immediate: true, deep: true })
 
 //渲染完成