ZaiZai 1 год назад
Родитель
Сommit
c2b3552cf7
2 измененных файлов с 21 добавлено и 27 удалено
  1. 20 26
      src/views/project/admin/create.vue
  2. 1 1
      src/views/project/gist/create.vue

+ 20 - 26
src/views/project/admin/create.vue

@@ -38,7 +38,7 @@
                 </el-col>
                 <el-col :span="6">
                     <el-form-item label="总投资:" prop="allInvestMoney">
-                        <el-input v-model="baseForm.allInvestMoney" :formatter="formatInput" clearable placeholder="请输入">
+                        <el-input v-model="baseForm.allInvestMoney" clearable placeholder="请输入">
                             <template #append>亿元</template>
                         </el-input>
                     </el-form-item>
@@ -182,7 +182,7 @@ const emit = defineEmits(['back'])
 const formInfo = ref(props.form)
 watch(() => props.form, (data) => {
     formInfo.value = data
-})
+}, { deep: true })
 
 //渲染完成
 onMounted(async () => {
@@ -330,7 +330,6 @@ const changeYear = (val) => {
     selectIndex.value = arrIndex(yearOptions.value, 'value', val)
 }
 
-
 const formatInput = (value) => {
     // 如果输入为空,则直接返回空字符串
     if (!value) {
@@ -367,7 +366,7 @@ watch(() => [
             // return accumulator + currentValue.yearForm.yearlyInvest
             return BigNumber(Number(accumulator)).plus(BigNumber(Number(currentValue.yearForm.yearlyInvest))).toNumber()
         }, 0)
-        baseForm.value.allInvestMoney = totalYearlyInvest
+        //baseForm.value.allInvestMoney = totalYearlyInvest
     },
 )
 
@@ -402,29 +401,26 @@ const createClick = async () => {
         console.log(form.id, 'form.id')
         if (isNullES(form.id)) {
             baseForm.value = {}
-            yearOptions.value = [
-                {
-                    value: '',
-                    label: '',
-                    yearForm: {
-                        yearlyInvest: '',
-                        oneInvest: '',
-                        twoInvest: '',
-                        threeInvest: '',
-                        fourInvest: '',
-                        yearlyTarget: '',
-                        onePlan: '',
-                        twoPlan: '',
-                        threePlan: '',
-                        fourPlan: '',
-                    },
-                }]
-            // cancelClick()
+            yearOptions.value = [{
+                value: '',
+                label: '',
+                yearForm: {
+                    yearlyInvest: '',
+                    oneInvest: '',
+                    twoInvest: '',
+                    threeInvest: '',
+                    fourInvest: '',
+                    yearlyTarget: '',
+                    onePlan: '',
+                    twoPlan: '',
+                    threePlan: '',
+                    fourPlan: '',
+                },
+            }]
         }
     } else {
         window.$message.error(msg ?? '操作失败')
     }
-    console.log('创建')
 }
 
 //保存
@@ -446,12 +442,10 @@ const saveClick = async () => {
     creatLoading.value = false
     if (!error && code === 200) {
         window?.$message?.success(msg)
-        const form = getObjValue(formInfo.value)
-        getProDetail(form.id)
+        cancelClick()
     } else {
         window.$message.error(msg ?? '操作失败')
     }
-    console.log('创建')
 }
 </script>
 

+ 1 - 1
src/views/project/gist/create.vue

@@ -64,7 +64,7 @@ const emit = defineEmits(['back'])
 const formInfo = ref(props.form)
 watch(() => props.form, (data) => {
     formInfo.value = data
-})
+}, { deep: true })
 
 //渲染完成
 onMounted(() => {