|
@@ -73,13 +73,17 @@ const props = defineProps({
|
|
|
type: [String, Number],
|
|
|
default: '',
|
|
|
},
|
|
|
+ periodId: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
infoData: {
|
|
|
type: Object,
|
|
|
default: () => ({}),
|
|
|
},
|
|
|
})
|
|
|
//事件
|
|
|
-const emit = defineEmits(['close'])
|
|
|
+const emit = defineEmits(['finish', 'close'])
|
|
|
const useAppState = useAppStore()
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
const projectId = ref(useAppState.getProjectId)
|
|
@@ -96,22 +100,17 @@ const modalTitle = ref('开工预付款计量单新增')
|
|
|
const getStartAmountData = async () => {
|
|
|
const { error, code, data } = await orderApi.getStartAmount({
|
|
|
contractId: contractId.value,
|
|
|
-
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
if (modalTitle.value === '开工预付款计量单新增') {
|
|
|
baseForm.value.startPayAmount = Number(data)
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
baseForm.value.startPayAmount = 0
|
|
|
}
|
|
|
}
|
|
|
//监听
|
|
|
-watch(() => [
|
|
|
- props.ids,
|
|
|
- props.infoData,
|
|
|
-], ([Id, info]) => {
|
|
|
+watch(() => [props.ids, props.infoData], ([Id, info]) => {
|
|
|
ids.value = Id
|
|
|
infoData.value = info
|
|
|
if (Id.length > 0) {
|
|
@@ -123,37 +122,35 @@ watch(() => [
|
|
|
fileName.value = []
|
|
|
modalTitle.value = '开工预付款计量单新增'
|
|
|
}
|
|
|
-}, { immediate: true })
|
|
|
+}, { immediate: true, deep: true })
|
|
|
//双向绑定
|
|
|
// eslint-disable-next-line no-undef
|
|
|
const isShow = defineModel('modelValue', {
|
|
|
default: false,
|
|
|
})
|
|
|
|
|
|
+//监听
|
|
|
+watch(() => props.periodId, (pid) => {
|
|
|
+ baseForm.value.meterPeriodId = pid
|
|
|
+}, { immediate: true, deep: true })
|
|
|
+
|
|
|
//监听
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
- console.log('isShow', val)
|
|
|
getKey1Data()
|
|
|
getStartAmountData()
|
|
|
+ baseForm.value.meterPeriodId = props.periodId
|
|
|
}
|
|
|
})
|
|
|
|
|
|
//计量期
|
|
|
const key1Data = ref([])
|
|
|
const getKey1Data = async () => {
|
|
|
- const { error, code, data } = await periodApi.allPeriod({
|
|
|
+ const { data } = await periodApi.allPeriod({
|
|
|
contractId: contractId.value,
|
|
|
type: 2,
|
|
|
})
|
|
|
- if (!error && code === 200) {
|
|
|
- key1Data.value = getArrValue(data)
|
|
|
- if (key1Data.value.length > 0) {
|
|
|
- baseForm.value.meterPeriodId = key1Data.value[key1Data.value.length - 1].id
|
|
|
- }
|
|
|
- } else {
|
|
|
- key1Data.value = []
|
|
|
- }
|
|
|
+ key1Data.value = getArrValue(data)
|
|
|
}
|
|
|
|
|
|
//基础表单
|
|
@@ -189,8 +186,7 @@ const modalSave = async () => {
|
|
|
modalSaving.value = false
|
|
|
if (!error && code === 200) {
|
|
|
window?.$message?.success(msg)
|
|
|
-
|
|
|
-
|
|
|
+ emit('finish')
|
|
|
} else {
|
|
|
window.$message.error(msg ?? '操作失败')
|
|
|
}
|
|
@@ -204,13 +200,11 @@ const modalSave = async () => {
|
|
|
modalSaving.value = false
|
|
|
if (!error && code === 200) {
|
|
|
window?.$message?.success(msg)
|
|
|
-
|
|
|
-
|
|
|
+ emit('finish')
|
|
|
} else {
|
|
|
window.$message.error(msg ?? '操作失败')
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
modalClose()
|
|
|
}
|
|
|
|