diff --git a/src/views/supervision_diary/edit.vue b/src/views/supervision_diary/edit.vue index 5193de6..5b3177e 100644 --- a/src/views/supervision_diary/edit.vue +++ b/src/views/supervision_diary/edit.vue @@ -1,19 +1,15 @@ @@ -66,6 +67,7 @@ const emit = defineEmits(['success', 'close']) const formRef = shallowRef() const popupRef = shallowRef>() const mode = ref('add') +const showDialog = ref(false) // 弹窗标题 @@ -77,6 +79,7 @@ const popupTitle = computed(() => { const formData = reactive({ id: '', project_id: '', + project_name: "", date: '', week: '', air_temperature: '', @@ -87,9 +90,22 @@ const formData = reactive({ supervision_work: '', construction_situation: '', other_matters: '', - annex: '', + annex: [], }) +const handleAvatarSuccess_four = (response: any) => { + Array.isArray(formData.annex) ? '' : formData.annex = [] + // @ts-ignore + response.code != 0 ? formData.annex.push({ uri: response.data.uri, name: response.data.name }) : ElMessage.error(response.msg); +}; +// 删除上传的文件 +const delFileFn = (index: number) => { formData.annex.splice(index, 1) } + +const customEvent = (e) => { + formData.project_id = e.id + formData.project_name = e.project_name + showDialog.value = false +} // 表单验证 const formRules = reactive({ @@ -159,8 +175,8 @@ const setFormData = async (data: Record) => { formData[key] = data[key] } } - - + + } const getDetail = async (row: Record) => { @@ -174,9 +190,9 @@ const getDetail = async (row: Record) => { // 提交按钮 const handleSubmit = async () => { await formRef.value?.validate() - const data = { ...formData, } - mode.value == 'edit' - ? await apiSupervisionDiaryEdit(data) + const data = { ...formData, } + mode.value == 'edit' + ? await apiSupervisionDiaryEdit(data) : await apiSupervisionDiaryAdd(data) popupRef.value?.close() emit('success') diff --git a/src/views/supervision_diary/index.vue b/src/views/supervision_diary/index.vue index 74ee966..6790ca1 100644 --- a/src/views/supervision_diary/index.vue +++ b/src/views/supervision_diary/index.vue @@ -1,16 +1,11 @@ 新增 - + 删除
- + @@ -52,23 +44,14 @@ - @@ -86,7 +69,7 @@