相对方增加公司绑定

This commit is contained in:
2026-06-24 10:28:25 +08:00
parent 123ad0e605
commit 29b3bee464
2 changed files with 53 additions and 1 deletions
@@ -82,11 +82,25 @@
</a-radio-group>
</a-form-item>
<a-form-item label="是否集团内" required>
<a-radio-group v-model:value="formState.groupFlag">
<a-radio-group v-model:value="formState.groupFlag" @change="(e) => handleGroupFlagChange(e)">
<a-radio value="Y"></a-radio>
<a-radio value="N"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item
v-if="formState.groupFlag === 'Y'"
label="关联内部组织"
class="field-span-2"
>
<a-select
v-model:value="formState.linkedOrgId"
:options="agentOrgOptions"
placeholder="请选择关联的内部货代公司组织"
allow-clear
show-search
option-filter-prop="label"
/>
</a-form-item>
<a-form-item
v-if="showCustomerTaxno"
label="统一社会信用代码"
@@ -260,6 +274,7 @@
<script setup>
import { computed, ref } from "vue";
import { message } from "ant-design-vue";
import { getAgentOrgList } from "@/api/partner.js";
const props = defineProps({
optionSets: {
@@ -319,6 +334,8 @@ function createFormData() {
createTime: "",
syncTime: "",
syncMessage: "",
linkedOrgId: undefined,
linkedUserAccount: "",
};
}
@@ -347,6 +364,7 @@ const visible = ref(false);
const modalMode = ref("create");
const originalState = ref(createFormData());
const formState = ref(createFormData());
const agentOrgOptions = ref([]);
const isViewMode = computed(() => modalMode.value === "view");
@@ -424,6 +442,13 @@ function handleOppositeCharacterChange() {
}
}
function handleGroupFlagChange(e) {
const value = e?.target?.value ?? e;
if (value !== "Y") {
formState.value.linkedOrgId = undefined;
}
}
function handleNatureOfEnterpriseOrgChange() {
if (formState.value.natureOfEnterpriseOrg !== "QY") {
formState.value.natureOfEnterpriseOrgLev = undefined;
@@ -497,6 +522,12 @@ function normalizeFormBeforeSave() {
formState.value.isSgat = formState.value.gatFlag === "Y" ? "1" : "0";
formState.value.isJtn = formState.value.groupFlag === "Y" ? "1" : "0";
// 如果非集团内,清空关联内部组织
if (formState.value.groupFlag !== "Y") {
formState.value.linkedOrgId = undefined;
formState.value.linkedUserAccount = "";
}
formState.value.contacts = (formState.value.contacts || []).map((item) => ({
...item,
contactName: item.contactName?.trim?.() || "",
@@ -528,6 +559,10 @@ function showModal(record = {}, mode = "create") {
modalMode.value === "create" ? createFormData() : copyFormData(record);
originalState.value = copyFormData(source);
formState.value = copyFormData(source);
// 加载货代公司组织列表
getAgentOrgList().then((options) => {
agentOrgOptions.value = options;
});
visible.value = true;
}