右键复制
This commit is contained in:
@@ -119,7 +119,9 @@
|
||||
<column-settings :columns="columnDefs" :visible-map="colVisible" @toggle="toggleColumn" @reset="resetColumns" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" border :data="supplierList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" border :data="supplierList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-contextmenu="onTableRowContextmenu">
|
||||
<el-table-column type="selection" width="55" align="center" fixed="left" />
|
||||
<el-table-column v-if="isColVisible('supplierCode')" label="供应商编码" align="center" width="130" prop="supplierCode" />
|
||||
<el-table-column v-if="isColVisible('supplierName')" label="供应商名称" align="center" width="130" prop="supplierName" :show-overflow-tooltip="true" />
|
||||
@@ -189,12 +191,21 @@
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 右键复制列值 -->
|
||||
<table-copy-menu
|
||||
ref="copyMenuRef"
|
||||
:columns="copyColumns"
|
||||
:selected-rows="selectedRows"
|
||||
:visible-keys="visibleCopyKeys"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Supplier">
|
||||
import { listSupplier, delSupplier } from "@/api/customersuppliermanagement/supplierinfo/supplier.js"
|
||||
import { useChannels, parseChannelCodes } from '@/components/ChannelSelect/useChannels'
|
||||
import { useUsers } from '@/components/UserSelect/useUsers'
|
||||
import { useColumnSettings } from '@/utils/columnSettings'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -281,6 +292,47 @@ function formatDateOnly(value) {
|
||||
return s.length > 10 ? s.substring(0, 10) : s
|
||||
}
|
||||
|
||||
/** 员工ID -> 姓名(与表格 UserName 展示同源) */
|
||||
const { ensureUsers, getUserName } = useUsers()
|
||||
ensureUsers()
|
||||
|
||||
/* ================= 右键复制列值 ================= */
|
||||
const copyMenuRef = ref(null)
|
||||
/** 右键可复制列(取值口径与表格展示一致) */
|
||||
const copyColumns = computed(() => [
|
||||
{ key: 'supplierCode', label: '供应商编码', get: r => r.supplierCode || '' },
|
||||
{ key: 'supplierName', label: '供应商名称', get: r => r.supplierName || '' },
|
||||
{ key: 'supplierCodeDw', label: '对外代码', get: r => r.supplierCodeDw || '' },
|
||||
{ key: 'creditCode', label: '统一社会信用代码', get: r => r.creditCode || '' },
|
||||
{ key: 'supplierType', label: '供应商类型', get: r => formatOption(supplierTypeOptions.value, r.supplierType) },
|
||||
{ key: 'invoiceType', label: '开票类型', get: r => formatOption(invoiceTypeOptions.value, r.invoiceType) },
|
||||
{ key: 'kacheType', label: '卡车行类型', get: r => formatOption(kacheTypeOptions.value, r.kacheType) },
|
||||
{ key: 'isEnable', label: '启用状态', get: r => proxy.selectDictLabel(sys_normal_disable.value, r.isEnable) },
|
||||
{ key: 'purchaserUserId', label: '采购员', get: r => getUserName(r.purchaserUserId) },
|
||||
{ key: 'ed', label: '应付额度', get: r => (r.ed === null || r.ed === undefined ? '' : r.ed) },
|
||||
{ key: 'zq', label: '应付账期', get: r => (r.zq === null || r.zq === undefined ? '' : r.zq) },
|
||||
{ key: 'settlementUserId', label: '结算员', get: r => getUserName(r.settlementUserId) },
|
||||
{ key: 'serviceUserId', label: '跟单员', get: r => getUserName(r.serviceUserId) },
|
||||
{ key: 'settlementType', label: '结算方式', get: r => proxy.selectDictLabel(settlement_type.value, r.settlementType) },
|
||||
{ key: 'tempEd', label: '临时额度', get: r => (r.tempEd === null || r.tempEd === undefined ? '' : r.tempEd) },
|
||||
{ key: 'accountBalance', label: '应付余额', get: r => (r.accountBalance === null || r.accountBalance === undefined ? '' : r.accountBalance) },
|
||||
{ key: 'foreignCurrencyBalance', label: '外币应付余额', get: r => (r.foreignCurrencyBalance === null || r.foreignCurrencyBalance === undefined ? '' : r.foreignCurrencyBalance) },
|
||||
{ key: 'creditEd', label: '信用额度', get: r => (r.creditEd === null || r.creditEd === undefined ? '' : r.creditEd) },
|
||||
{ key: 'weightThreshold', label: '重量阈值', get: r => (r.weightThreshold === null || r.weightThreshold === undefined ? '' : r.weightThreshold) },
|
||||
{ key: 'throwRatio', label: '抛比', get: r => (r.throwRatio === null || r.throwRatio === undefined ? '' : r.throwRatio) },
|
||||
{ key: 'cooperationStartDate', label: '合作开始日期', get: r => formatDateOnly(r.cooperationStartDate) },
|
||||
{ key: 'cooperationStatus', label: '合作状态', get: r => formatOption(cooperationStatusOptions.value, r.cooperationStatus) },
|
||||
{ key: 'channelIds', label: '绑定渠道', get: r => channelNames(r.channelIds) },
|
||||
{ key: 'remark', label: '备注说明', get: r => r.remark || '' }
|
||||
])
|
||||
/** 右键菜单只展示当前「列设置」中可见的列 */
|
||||
const visibleCopyKeys = computed(() =>
|
||||
columnDefs.filter(c => isColVisible(c.key)).map(c => c.key)
|
||||
)
|
||||
function onTableRowContextmenu(row, column, event) {
|
||||
copyMenuRef.value && copyMenuRef.value.open(row, event)
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -315,6 +367,7 @@ const { queryParams } = toRefs(data)
|
||||
|
||||
/** 查询供应商列表 */
|
||||
function getList() {
|
||||
copyMenuRef.value && copyMenuRef.value.close()
|
||||
loading.value = true
|
||||
listSupplier(queryParams.value).then(response => {
|
||||
supplierList.value = response.rows
|
||||
|
||||
Reference in New Issue
Block a user