供应商管理数据同步, tms系统产品,服务渠道,产品渠道关系数据同步

This commit is contained in:
wuweihua
2026-10-12 10:28:06 +08:00
parent d08485d738
commit 2a9825c498
29 changed files with 1646 additions and 127 deletions
@@ -167,7 +167,14 @@
<el-table-column v-if="isColVisible('cooperationStatus')" label="合作状态" align="center" prop="cooperationStatus">
<template #default="scope">{{ formatOption(cooperationStatusOptions, scope.row.cooperationStatus) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('channelIds')" label="绑定渠道ID" align="center" prop="channelIds" />
<el-table-column v-if="isColVisible('channelIds')" label="绑定渠道" align="center" prop="channelIds" min-width="200">
<template #default="scope">
<span v-if="channelNames(scope.row.channelIds)" :title="channelNames(scope.row.channelIds)">
{{ channelNames(scope.row.channelIds) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column v-if="isColVisible('remark')" label="备注说明" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
<template #default="scope">
@@ -189,10 +196,18 @@
<script setup name="Supplier">
import { listSupplier, delSupplier } from "@/api/customersuppliermanagement/supplierinfo/supplier.js"
import { useChannels, parseChannelCodes } from '@/components/ChannelSelect/useChannels'
import { useColumnSettings } from '@/utils/columnSettings'
const { proxy } = getCurrentInstance()
/** 绑定渠道编码串 -> 渠道编码+名称展示(查不到的渠道回显原编码) */
const { ensureChannels, getChannelLabel } = useChannels()
function channelNames(channelIds) {
return parseChannelCodes(channelIds).map(code => getChannelLabel(code)).join(',')
}
ensureChannels()
/** 可自定义列(默认全部可见;选择列固定、操作列固定右侧不参与设置) */
const columnDefs = [
{ key: 'supplierCode', label: '供应商编码' },
@@ -217,7 +232,7 @@ const columnDefs = [
{ key: 'throwRatio', label: '抛比' },
{ key: 'cooperationStartDate', label: '合作开始日期' },
{ key: 'cooperationStatus', label: '合作状态' },
{ key: 'channelIds', label: '绑定渠道ID' },
{ key: 'channelIds', label: '绑定渠道' },
{ key: 'remark', label: '备注说明' }
]
const { colVisible, isColVisible, toggleColumn, resetColumns } = useColumnSettings('supplier-info-list', columnDefs)
@@ -168,11 +168,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="绑定渠道ID" prop="channelIds">
<el-input v-model="form.channelIds" type="textarea" :rows="2" placeholder="多个渠道ID用英文逗号分隔" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注说明" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入内容" />
@@ -182,6 +177,37 @@
</el-form>
</el-tab-pane>
<!-- ============ 绑定渠道 ============ -->
<el-tab-pane label="绑定渠道" name="channel">
<div class="pane-toolbar">
<channel-select v-model="form.channelIds" />
<span class="pane-tip">绑定结果以渠道编码逗号串存入供应商主表 channel_ids,渠道来源于老系统服务渠道镜像(每日自动同步)</span>
</div>
<el-table :data="boundChannels" border size="small" class="bound-table">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="渠道编码" prop="channelCode" width="160" show-overflow-tooltip />
<el-table-column label="渠道名称" prop="channelName" min-width="180" show-overflow-tooltip />
<el-table-column label="服务商" prop="serviceName" width="120" show-overflow-tooltip />
<el-table-column label="付款方式" prop="payType" width="90" align="center" show-overflow-tooltip />
<el-table-column label="货物类型" prop="cargoType" width="90" align="center" show-overflow-tooltip />
<el-table-column label="状态" width="90" align="center">
<template #default="{ row }">
<el-tag v-if="row.blOpen === '1'" type="success" size="small">启用</el-tag>
<el-tag v-else-if="row.blOpen === '0'" type="info" size="small">停用</el-tag>
<span v-else>未知</span>
</template>
</el-table-column>
<el-table-column label="操作" width="90" align="center">
<template #default="{ row }">
<el-button link type="danger" size="small" @click="removeChannel(row.channelCode)">移除</el-button>
</template>
</el-table-column>
<template #empty>
<el-empty description="暂未绑定渠道,点击上方「选择渠道」进行绑定" :image-size="80" />
</template>
</el-table>
</el-tab-pane>
<!-- ============ 公司主体 ============ -->
<el-tab-pane label="公司主体" name="company">
<div class="pane-toolbar">
@@ -589,6 +615,7 @@ import {
import { getToken } from '@/utils/auth'
import axios from 'axios'
import { saveAs } from 'file-saver'
import { useChannels, parseChannelCodes } from '@/components/ChannelSelect/useChannels'
const { proxy } = getCurrentInstance()
const route = useRoute()
@@ -596,6 +623,10 @@ const router = useRouter()
const { settlement_type } = useDict('settlement_type')
const { ensureChannels, findChannel } = useChannels()
/** 进入页面即预加载渠道缓存,供已绑渠道明细表回显名称 */
ensureChannels()
const pageLoading = ref(false)
const saving = ref(false)
const activeTab = ref('base')
@@ -671,6 +702,17 @@ function buildEmptyForm() {
}
const form = ref(buildEmptyForm())
/* ---------------- 渠道绑定 ---------------- */
/** 已绑渠道明细:镜像中能查到的回显完整信息,查不到的以占位行展示原编码(不丢失旧数据) */
const boundChannels = computed(() =>
parseChannelCodes(form.value.channelIds).map(code => findChannel(code) || { channelCode: code })
)
function removeChannel(channelCode) {
const codes = parseChannelCodes(form.value.channelIds).filter(code => code !== String(channelCode))
form.value.channelIds = codes.join(',')
}
/* ---------------- 用户冗余姓名 ---------------- */
function handleUserChange(uid, user, nameField) {
form.value[nameField] = user ? (user.nickName || user.userName || null) : null