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/supplier.vue |  256 +++++++++++++++++++++++++++++---------------------
 1 files changed, 148 insertions(+), 108 deletions(-)

diff --git a/src/views/basicInformation/mould/supplier.vue b/src/views/basicInformation/mould/supplier.vue
index 0b1d5ec..ae30965 100644
--- a/src/views/basicInformation/mould/supplier.vue
+++ b/src/views/basicInformation/mould/supplier.vue
@@ -1,130 +1,171 @@
 <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 label="寮�鎴疯" prop="bank">
-                    <el-input v-model="formData.bank" placeholder="璇疯緭鍏ュ紑鎴疯" />
-                </el-form-item>
-                <el-form-item label="鑱旂郴浜�" prop="contacts">
-                    <el-input v-model="formData.contacts" placeholder="璇疯緭鍏ヨ仈绯讳汉" />
-                </el-form-item>
-                <el-form-item label="鑱旂郴浜虹數璇�" prop="contactsPhone">
-                    <el-input
-                        v-model="formData.contactsPhone"
-                        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>
+  <div>
+    <el-dialog
+      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"
+      >
+        <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-cascader
+            placeholder="璇烽�夋嫨缁忚惀鍦板潃"
+            size="default"
+            :options="addressSelectOptions"
+            v-model="formData.address"
+            @change="handleChange"
+          >
+          </el-cascader>
+        </el-form-item>
+        <el-form-item label="璇︾粏鍦板潃" prop="addressDetail">
+          <el-input
+            v-model="formData.addressDetail"
+            placeholder="璇疯緭鍏ュ鎴疯缁嗗湴鍧�"
+          />
+        </el-form-item>
+        <el-form-item label="閾惰璐︽埛" prop="bankAccount">
+          <el-input
+            v-model="formData.bankAccount"
+            placeholder="璇疯緭鍏ラ摱琛岃处鎴�"
+          />
+        </el-form-item>
+        <el-form-item label="寮�鎴疯" prop="bank">
+          <el-input v-model="formData.bank" placeholder="璇疯緭鍏ュ紑鎴疯" />
+        </el-form-item>
+        <el-form-item label="鑱旂郴浜�" prop="contacts">
+          <el-input v-model="formData.contacts" placeholder="璇疯緭鍏ヨ仈绯讳汉" />
+        </el-form-item>
+        <el-form-item label="鑱旂郴浜虹數璇�" prop="contactsPhone">
+          <el-input
+            v-model="formData.contactsPhone"
+            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, onMounted } from "vue";
+import addressList from "@/api/jsonApi/areaList.json";
+import imageUpload from "@/components/ImageUpload/index.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"]);
+
+onMounted(()=>{
+  addressSelectOptions.value = mapAddress(addressList);
 })
-
-const emit = defineEmits(['submit', 'handleBeforeClose'])
-
+// 鍦板潃閫夋嫨鏁版嵁
+const addressSelectOptions = ref([]);
+// 澶勭悊鍦板潃鏁版嵁杞崲
+function mapAddress(list) {
+  return list.map(item => ({
+    value: item.no,
+    label: item.name,
+    children: item.children ? mapAddress(item.children) : undefined
+  }));
+}
 // 琛ㄥ崟寮曠敤
-const formRef = ref(null)
+const formRef = ref(null);
 // 琛ㄥ崟鏁版嵁
-const formData = ref({ ...props.form })
+const formData = ref({ ...props.form });
 // 寮圭獥鍙鎬�
-const dialogVisible = defineModel("supplierDialogFormVisible",{required:true,type:Boolean})
-
+const dialogVisible = defineModel("supplierDialogFormVisible", {
+  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:supplierDialogFormVisible', newVal)
-})
-
+watch(
+  () => dialogVisible.value,
+  (newVal) => {
+    emit("update:supplierDialogFormVisible", newVal);
+  }
+);
+// 澶勭悊鍦板潃閫夋嫨鍙樺寲
+const handleChange = (value) => {
+  console.log(value);
+};
 // 鎻愪氦琛ㄥ崟
 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:supplierDialogFormVisible', false)
-    formData.value = {}
-}
+  emit("update:supplierDialogFormVisible", 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:supplierDialogFormVisible', false)
-}
+  // 瑙﹀彂鐖剁粍浠剁殑鍏抽棴鍑芥暟
+  emit("handleBeforeClose");
+  emit("update:supplierDialogFormVisible", false);
+};
 const rules = reactive({
   supplierName: [
     { required: true, message: "璇疯緭鍏ヤ緵璐у晢鍚嶇О", trigger: "blur" },
@@ -149,6 +190,5 @@
   ],
 });
 </script>
-
 <style lang="sass" scoped>
 </style>
\ No newline at end of file

--
Gitblit v1.9.3