|
|
|
@ -28,17 +28,17 @@ |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
<tr> |
|
|
|
|
<td><a-input v-model:value="data.name" /></td> |
|
|
|
|
<td><a-input v-model:value="data.departName" /></td> |
|
|
|
|
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year1Value" /></td> |
|
|
|
|
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year2Value" /></td> |
|
|
|
|
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year3Value" /></td> |
|
|
|
|
<td>{{sum}}</td> |
|
|
|
|
<td>{{Amount}}</td> |
|
|
|
|
</tr> |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
<div class="button-container"> |
|
|
|
|
<a-button type="primary" @click="save">保存</a-button> |
|
|
|
|
<a-button type="primary" @click="handleSubmit">保存</a-button> |
|
|
|
|
<a-button type="primary" @click="router.back();">返回</a-button> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -46,7 +46,10 @@ |
|
|
|
|
<script setup> |
|
|
|
|
import {ref,onMounted,computed} from 'vue' |
|
|
|
|
import {useRoute, useRouter} from "vue-router"; |
|
|
|
|
import {saveOrUpdate} from "@/views/projectApplication/project/Project.api"; |
|
|
|
|
import {saveOrUpdate} from "@/views/projectAnnualBudget/ProjectAnnualBudget.api"; |
|
|
|
|
import {defHttp} from "@/utils/http/axios"; |
|
|
|
|
import {useMessage} from "@/hooks/web/useMessage"; |
|
|
|
|
const { createMessage } = useMessage(); |
|
|
|
|
|
|
|
|
|
const router = useRouter(); |
|
|
|
|
const route = useRoute(); |
|
|
|
@ -58,25 +61,14 @@ const data = ref({ |
|
|
|
|
year1Value:0, |
|
|
|
|
year2Value:0, |
|
|
|
|
year3Value:0, |
|
|
|
|
name:'', |
|
|
|
|
sum:'' |
|
|
|
|
departName:'', |
|
|
|
|
totalAmount:'' |
|
|
|
|
}) |
|
|
|
|
onMounted(()=> { |
|
|
|
|
// data.value.year1 = '2025' |
|
|
|
|
|
|
|
|
|
loadData(); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
async function handleSubmit() { |
|
|
|
|
let val = await validate(); |
|
|
|
|
console.log('val----------',JSON.stringify(val)) |
|
|
|
|
// let data = getFieldsValue(); |
|
|
|
|
// let params = Object.assign({}, formData, data); |
|
|
|
|
val.id = route.query.id; |
|
|
|
|
console.log('表单数据', val) |
|
|
|
|
await saveOrUpdate(val, true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const save = () => { |
|
|
|
|
const handleSubmit = async () => { |
|
|
|
|
let params = { |
|
|
|
|
year1:data.value.year1.$y, |
|
|
|
|
year2:data.value.year2.$y, |
|
|
|
@ -84,12 +76,48 @@ const save = () => { |
|
|
|
|
year1Value:data.value.year1Value, |
|
|
|
|
year2Value:data.value.year2Value, |
|
|
|
|
year3Value:data.value.year3Value, |
|
|
|
|
name:data.value.name, |
|
|
|
|
sum:data.value.sum, |
|
|
|
|
departName:data.value.departName, |
|
|
|
|
totalAmount:Number(data.value.year1Value) + Number(data.value.year2Value) + Number(data.value.year3Value), |
|
|
|
|
} |
|
|
|
|
console.log(JSON.stringify(params)) |
|
|
|
|
params.projectId = route.query.id; |
|
|
|
|
defHttp |
|
|
|
|
.post({ |
|
|
|
|
url: '/projectAnnualBudget/projectAnnualBudget/add/'+route.query.id, |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
/*.then(() => { |
|
|
|
|
// createMessage.success(`保存成功!`); |
|
|
|
|
// loadData(); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
// loading.value = false; |
|
|
|
|
});*/ |
|
|
|
|
} |
|
|
|
|
const sum = computed(() => { |
|
|
|
|
|
|
|
|
|
// 加载数据 |
|
|
|
|
async function loadData() { |
|
|
|
|
// loading.value = true; |
|
|
|
|
// 调用查询数据接口 |
|
|
|
|
await defHttp |
|
|
|
|
.get({ |
|
|
|
|
// 请求地址 |
|
|
|
|
url: '/projectAnnualBudget/projectAnnualBudget/queryByProjectId/'+route.query.id, |
|
|
|
|
}).then((result) => { |
|
|
|
|
data.value.year1Value = result.year1Value |
|
|
|
|
data.value.year2Value = result.year2Value |
|
|
|
|
data.value.year3Value = result.year3Value |
|
|
|
|
data.value.departName = result.departName |
|
|
|
|
console.log("the data()",JSON.stringify(result)) |
|
|
|
|
// 后台查询回来的 total,数据总数量 |
|
|
|
|
// pagination.total = result.total; |
|
|
|
|
// 将查询的数据赋值给 dataSource |
|
|
|
|
// dataSource.value = result.records; |
|
|
|
|
// // 重置选择 |
|
|
|
|
// selectedRows.value = []; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const Amount = computed(() => { |
|
|
|
|
return Number(data.value.year1Value) + Number(data.value.year2Value) + Number(data.value.year3Value) |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|