From 6b9dd0a1b0c259a02c086f7834467e1fa2c2a5ea Mon Sep 17 00:00:00 2001 From: 张诺 <zhang_12370@163.com> Date: 星期五, 30 五月 2025 17:58:54 +0800 Subject: [PATCH] 调整基础信息供应商模块,客户信息模块并新增联动查询省市区联动,修改table表格方法 --- src/views/basicInformation/mould/coal.vue | 195 ++++++++++++++++++++++-------------------------- 1 files changed, 91 insertions(+), 104 deletions(-) diff --git a/src/views/basicInformation/mould/coal.vue b/src/views/basicInformation/mould/coal.vue index 0a999c2..0694d23 100644 --- a/src/views/basicInformation/mould/coal.vue +++ b/src/views/basicInformation/mould/coal.vue @@ -1,131 +1,118 @@ <template> - <div> - <el-dialog - v-model="dialogVisible" - :title="title" - width="800" - :close-on-click-modal="false" - :before-close="handleClose" - > - <el-form - ref="formRef" - style="max-width: 600px; margin: 0 auto" - :model="formData" - :rules="rules" - label-width="auto" - > - <el-form-item label="鍗¤儭" prop="supplierName"> - <el-input - v-model="formData.supplierName" - placeholder="璇疯緭鍏ヤ緵璐у晢鍚嶇О" - /> - </el-form-item> - <el-form-item label="绾崇◣浜鸿瘑鍒彿" prop="identifyNumber"> - <el-input - v-model="formData.identifyNumber" - placeholder="璇疯緭鍏ョ撼绋庝汉璇嗗埆鍙�" - /> - </el-form-item> - <el-form-item label="缁忚惀鍦板潃" prop="address"> - <el-select v-model="formData.address" placeholder="璇烽�夋嫨缁忚惀鍦板潃"> - <el-option label="Zone one" value="shanghai" /> - <el-option label="Zone two" value="beijing" /> - </el-select> - </el-form-item> - <el-form-item label="閾惰璐︽埛" prop="bankAccount"> - <el-input - v-model="formData.bankAccount" - placeholder="璇疯緭鍏ラ摱琛岃处鎴�" - /> - </el-form-item> - <el-form-item> - <el-button type="primary" @click="submitForm"> 纭畾 </el-button> - </el-form-item> - </el-form> - </el-dialog> - </div> + <div> + <el-dialog + v-model="dialogVisible" + :title="title" + width="800" + :close-on-click-modal="false" + :before-close="handleClose" + > + <el-form + ref="formRef" + style="max-width: 600px; margin: 0 auto" + :model="formData" + :rules="rules" + label-width="auto" + > + <el-form-item label="鍗¤儭" prop="supplierName"> + <el-input + v-model="formData.supplierName" + placeholder="璇疯緭鍏ヤ緵璐у晢鍚嶇О" + /> + </el-form-item> + <el-form-item label="绾崇◣浜鸿瘑鍒彿" prop="identifyNumber"> + <el-input + v-model="formData.identifyNumber" + placeholder="璇疯緭鍏ョ撼绋庝汉璇嗗埆鍙�" + /> + </el-form-item> + <el-form-item label="缁忚惀鍦板潃" prop="address"> + <el-select v-model="formData.address" placeholder="璇烽�夋嫨缁忚惀鍦板潃"> + <el-option label="Zone one" value="shanghai" /> + <el-option label="Zone two" value="beijing" /> + </el-select> + </el-form-item> + <el-form-item label="閾惰璐︽埛" prop="bankAccount"> + <el-input v-model="formData.bankAccount" placeholder="璇疯緭鍏ラ摱琛岃处鎴�" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="submitForm"> + 纭畾 + </el-button> + <el-button v-if="addOrEdit === 'edit'" @click="resetForm">閲嶇疆</el-button> + <el-button v-if="addOrEdit === 'add'" @click="cancelForm">鍙栨秷</el-button> + </el-form-item> + </el-form> + </el-dialog> + </div> </template> <script setup> -import { ref, watch, defineProps } from "vue"; +import { ref, watch ,defineProps } from 'vue' const props = defineProps({ - beforeClose: { - type: Function, - default: () => {}, - }, - form: { - type: Object, - default: () => ({}), - }, - addOrEdit: { - type: String, - default: "add", - }, - title: { - type: String, - default: "", - }, -}); + beforeClose: { + type: Function, + default: () => {} + }, + form: { + type: Object, + default: () => ({}) + }, + addOrEdit: { + type: String, + default: 'add' + }, + title: { + type: String, + default: '' + }, +}) -const emit = defineEmits([ - "submit", - "handleBeforeClose", - "update:coalDialogFormVisible", -]); +const emit = defineEmits(['submit', 'handleBeforeClose','update:coalDialogFormVisible']) // 琛ㄥ崟寮曠敤 -const formRef = ref(null); +const formRef = ref(null) // 琛ㄥ崟鏁版嵁 -const formData = ref({ ...props.form }); +const formData = ref({ ...props.form }) // 寮圭獥鍙鎬� -const dialogVisible = defineModel("coalDialogFormVisible", { - required: true, - type: Boolean, -}); +const dialogVisible = defineModel("coalDialogFormVisible",{required:true,type:Boolean}) // 鐩戝惉澶栭儴浼犲叆鐨勮〃鍗曟暟鎹彉鍖� -watch( - () => props.form, - (newVal) => { - formData.value = { ...newVal }; - }, - { deep: true } -); +watch(() => props.form, (newVal) => { + formData.value = { ...newVal } +}, { deep: true }) // 鐩戝惉鍐呴儴寮圭獥鐘舵�佸彉鍖� -watch( - () => dialogVisible.value, - (newVal) => { - emit("update:coalDialogFormVisible", newVal); - } -); +watch(() => dialogVisible.value, (newVal) => { + emit('update:coalDialogFormVisible', newVal) +}) // 鎻愪氦琛ㄥ崟 const submitForm = async () => { - if (!formRef.value) return; - await formRef.value.validate((valid, fields) => { - if (valid) { - emit("submit", formData.value); - } - }); -}; + if (!formRef.value) return + await formRef.value.validate((valid, fields) => { + if (valid) { + emit('submit', formData.value) + } + }) +} // 鍙栨秷琛ㄥ崟 const cancelForm = () => { - emit("update:coalDialogFormVisible", false); - formData.value = {}; -}; + emit('update:coalDialogFormVisible', false) + formData.value = {} +} // 閲嶇疆琛ㄥ崟 const resetForm = () => { - if (!formRef.value) return; - formRef.value.resetFields(); -}; + if (!formRef.value) return + formRef.value.resetFields() +} // 鍏抽棴寮圭獥 const handleClose = () => { - // 瑙﹀彂鐖剁粍浠剁殑鍏抽棴鍑芥暟 - emit("handleBeforeClose"); - emit("update:coalDialogFormVisible", false); -}; + // 瑙﹀彂鐖剁粍浠剁殑鍏抽棴鍑芥暟 + emit("handleBeforeClose") + emit('update:coalDialogFormVisible', false) +} const rules = reactive({ supplierName: [ { required: true, message: "璇疯緭鍏ヤ緵璐у晢鍚嶇О", trigger: "blur" }, -- Gitblit v1.9.3