From ffc421d4676db1424d571d8b45dd9c86b84e3bda Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期二, 24 六月 2025 13:56:55 +0800 Subject: [PATCH] 在上传是 过滤掉pnpm配置文件 --- src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue | 105 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 33 deletions(-) diff --git a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue index 22d4448..8dddf2b 100644 --- a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue +++ b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue @@ -1,36 +1,38 @@ <template> <div> <el-dialog - v-model="dialogVisible" - :title="title" - width="600" - :close-on-click-modal="false" - :before-close="handleClose" + v-model="dialogVisible" + :title="title" + width="600" + :close-on-click-modal="false" + :before-close="handleClose" > <el-form - ref="formRef" - style="max-width: 400px; margin: 0 auto" - :model="formData" - :rules="rules" - label-width="auto" + ref="formRef" + style="max-width: 400px; margin: 0 auto" + :model="formData" + :rules="rules" + label-width="auto" > <el-form-item label="瀛楁鍚嶇О" prop="fieldName"> <el-input - v-model="formData.fieldName" - placeholder="璇疯緭鍏ュ瓧娈靛悕绉�" + v-model="formData.fieldName" + placeholder="璇疯緭鍏ュ瓧娈靛悕绉�" /> </el-form-item> - <el-form-item label="Activity form" props="dielDescription"> - <el-input v-model="formData.fieldDescription" type="textarea" placeholder="璇疯緭鍏ュ瓧娈垫弿杩�" /> - </el-form-item> - <el-form-item> - <el-button type="primary" @click="submitForm"> 纭畾 </el-button> + <el-form-item label="瀛楁鎻忚堪" prop="fieldDescription"> + <el-input v-model="formData.fieldDescription" type="textarea" placeholder="璇疯緭鍏ュ瓧娈垫弿杩�"/> + </el-form-item> + <el-form-item class="dialog-footer"> <el-button v-if="addOrEdit === 'edit'" @click="resetForm" - >閲嶇疆</el-button + >閲嶇疆 + </el-button > <el-button v-if="addOrEdit === 'add'" @click="cancelForm" - >鍙栨秷</el-button + >鍙栨秷 + </el-button > + <el-button type="primary" @click="submitForm"> 纭畾</el-button> </el-form-item> </el-form> </el-dialog> @@ -38,13 +40,10 @@ </template> <script setup> -import { ref, watch, defineProps, onMounted } from "vue"; -import addressList from "@/api/jsonApi/areaList.json"; +import {ref, reactive, watch, defineProps} from "vue"; +import {addOrEditCoalField} from "@/api/basicInformation/coalFieldMaintenance.js"; + const props = defineProps({ - beforeClose: { - type: Function, - default: () => {}, - }, form: { type: Object, default: () => ({}), @@ -58,10 +57,20 @@ default: "", }, }); - +const copyForm = defineModel("copyForm", { + required: true, + type: Object, +}); +// 琛ㄥ崟寮曠敤 +const formRef = ref(); const emit = defineEmits(["submit", "handleBeforeClose"]); // 琛ㄥ崟鏁版嵁 -const formData = ref({ ...props.form }); +const formData = ref({...props.form}); + +// 鐩戝惉props.form鐨勫彉鍖栵紝鏇存柊formData +watch(() => props.form, (newForm) => { + formData.value = {...newForm}; +}, {deep: true, immediate: true}); // 寮圭獥鍙鎬� const dialogVisible = defineModel("coalMaintenanceFieldDialogVisible", { required: true, @@ -72,6 +81,30 @@ if (!formRef.value) return; await formRef.value.validate(async (valid, fields) => { if (valid) { + const obj = ref({}); + + console.log("鎻愪氦琛ㄥ崟", formData.value); + if (props.title.includes('鏂板')) { + let result = await addOrEditCoalField( + {...formData.value} + ,) + console.log(result); + obj.value = { + title: "鏂板", + ...formData.value, + result + }; + } else { + let result = await addOrEditCoalField({ + ...formData.value, + }) + obj.value = { + title: "缂栬緫", + ...formData.value, + result + }; + } + emit("submit", obj.value); } }); }; @@ -82,9 +115,9 @@ }; // 閲嶇疆琛ㄥ崟 const resetForm = () => { - - -}; + if (!formRef.value) return + formData.value = JSON.parse(JSON.stringify(copyForm.value)); +} // 鍏抽棴寮圭獥 const handleClose = () => { // 瑙﹀彂鐖剁粍浠剁殑鍏抽棴鍑芥暟 @@ -92,10 +125,16 @@ emit("update:coalMaintenanceFieldDialogVisible", false); }; const rules = reactive({ - coal: [ - { required: true, message: "璇疯緭鍏ョ叅绉嶅悕绉�", trigger: "blur" }, + fieldName: [ + {required: true, message: "璇疯緭鍏ョ叅绉嶅悕绉�", trigger: "blur"}, ], }); </script> -<style lang="sass" scoped> +<style lang="scss" scoped> +.dialog-footer { + display: flex; + justify-content: flex-end; + margin-top: 20px; + flex-direction: column; +} </style> \ No newline at end of file -- Gitblit v1.9.3