feat: 恢复签约管理页 ScanBox 筛选面板;仓库页移除发起签约、新增奇门配置只读查看;新建外仓商品页面
- warehouses: 恢复 ScanBox,移除预览签约,新增奇门配置查看(支持复制货主/仓库编码) - stores: 恢复 ScanBox,移除发起签约按钮及弹窗(签约已统一由货主方发起) - storeWarehouse API: 新增 storeWarehouseList 导出 - 新建 stock/external_stock 外仓商品页面
This commit is contained in:
parent
6ea17d71ed
commit
84291ca149
@ -1,7 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
const v = "1.0";
|
||||
|
||||
/** 查询当前主体可见的仓库-货主签约列表 */
|
||||
/** 查询当前主体可见的货主列表 */
|
||||
export function storeList(data: {
|
||||
keyword?: string
|
||||
page?: number
|
||||
page_size?: number
|
||||
}) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storeWarehouse.store.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** 货主侧查询签约关系列表 */
|
||||
export function storeWarehouseList(data: {
|
||||
keyword?: string
|
||||
page?: number
|
||||
@ -20,6 +39,24 @@ export function storeWarehouseList(data: {
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** 查询当前主体可见的仓库列表 */
|
||||
export function warehouseList(data: {
|
||||
keyword?: string
|
||||
page?: number
|
||||
page_size?: number
|
||||
}) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storeWarehouse.warehouse.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
/**
|
||||
* 发起签约 / 预览签约信息
|
||||
* - 不带 action:提交签约申请(返回 mode: initiate | already_exists | already_confirmed)
|
||||
|
||||
@ -19,6 +19,7 @@ export const componentMap: Record<string, any> = {
|
||||
/** 与后端菜单 component 字段兼容:商品管理入口 */
|
||||
'stock/index': () => import('@/views/stock/stockManagement/index.vue'),
|
||||
'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'),
|
||||
'stock/external_stock/index': () => import('@/views/stock/external_stock/index.vue'),
|
||||
/** 组合商品并入商品管理,保留旧路径兼容 */
|
||||
// 'stock/combo_stock': () => import('@/views/stock/stockManagement/index.vue'),
|
||||
// 'stock/combo_stock/index': () => import('@/views/stock/stockManagement/index.vue'),
|
||||
|
||||
350
src/views/stock/external_stock/index.vue
Normal file
350
src/views/stock/external_stock/index.vue
Normal file
@ -0,0 +1,350 @@
|
||||
<template>
|
||||
<div class="external-stock-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="商品筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" @click="loadList">
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-input
|
||||
v-model="queryForm.keyword"
|
||||
placeholder="搜索商品编码/名称/条码"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
default-align="center"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
>
|
||||
<template #column-is_sn_mgmt="{ row }">
|
||||
<el-tag size="small" :type="row.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ row.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-is_shelf_life_mgmt="{ row }">
|
||||
<el-tag size="small" :type="row.is_shelf_life_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ row.is_shelf_life_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-is_batch_mgmt="{ row }">
|
||||
<el-tag size="small" :type="row.is_batch_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ row.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #empty>
|
||||
<el-empty description="暂无商品数据" :image-size="60" />
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<div class="lower-level" v-if="selectedRow">
|
||||
<div class="detail-header">
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="基本信息" name="info" />
|
||||
<el-tab-pane label="库存信息" name="storage" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div class="detail-container">
|
||||
<el-descriptions v-if="activeTab === 'info'" :column="2" border size="small">
|
||||
<el-descriptions-item label="商品编码">{{ selectedRow.item_code || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商品名称">{{ selectedRow.item_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="品牌">{{ selectedRow.brand_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="规格型号">{{ selectedRow.spec || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="库存单位">{{ selectedRow.stock_unit || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="条码">{{ selectedRow.barcode || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="SN管理">
|
||||
<el-tag size="small" :type="selectedRow.is_sn_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ selectedRow.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="效期管理">
|
||||
<el-tag size="small" :type="selectedRow.is_shelf_life_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ selectedRow.is_shelf_life_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="批次管理">
|
||||
<el-tag size="small" :type="selectedRow.is_batch_mgmt === 'Y' ? 'success' : 'info'">
|
||||
{{ selectedRow.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="毛重">{{ selectedRow.gross_weight ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包要求">{{ selectedRow.packing_requirements || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间" :span="2">{{ formatDate(selectedRow.created_at) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-else-if="activeTab === 'storage'" :column="2" border size="small">
|
||||
<el-descriptions-item label="仓库名称">{{ selectedRow.warehouse_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="可用库存">{{ selectedRow.available_qty ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="锁定库存">{{ selectedRow.locked_qty ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总库存">{{ selectedRow.total_qty ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="在途库存">{{ selectedRow.in_transit_qty ?? '—' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lower-level empty" v-else>
|
||||
<el-empty description="请选择数据查看详情" :image-size="60" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { stockWarehouse } from '@/api/stock/stock'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
// ─── 列表列配置 ─────────────────────────────────────────────────────────────
|
||||
const columns = [
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 130 },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 150 },
|
||||
{ prop: 'brand_name', label: '品牌', width: 100 },
|
||||
{ prop: 'spec', label: '规格型号', width: 120 },
|
||||
{ prop: 'stock_unit', label: '库存单位', width: 90 },
|
||||
{ prop: 'warehouse_name', label: '所属仓库', minWidth: 130 },
|
||||
{ prop: 'available_qty', label: '可用库存', width: 90 },
|
||||
{ prop: 'is_sn_mgmt', label: 'SN管理', width: 80 },
|
||||
{ prop: 'is_shelf_life_mgmt', label: '效期管理', width: 80 },
|
||||
{ prop: 'is_batch_mgmt', label: '批次管理', width: 80 },
|
||||
{ prop: 'updated_at', label: '更新时间', width: 160 }
|
||||
]
|
||||
|
||||
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
||||
const availableFields = [
|
||||
{
|
||||
label: 'SN管理',
|
||||
value: 'is_sn_mgmt',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '是', value: 'Y' },
|
||||
{ label: '否', value: 'N' }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '效期管理',
|
||||
value: 'is_shelf_life_mgmt',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '是', value: 'Y' },
|
||||
{ label: '否', value: 'N' }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '批次管理',
|
||||
value: 'is_batch_mgmt',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '是', value: 'Y' },
|
||||
{ label: '否', value: 'N' }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const presetTree: any[] = []
|
||||
|
||||
// ─── 列表状态 ──────────────────────────────────────────────────────────────
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
const activeTab = ref('info')
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
const currentCondition = ref<any>({})
|
||||
|
||||
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
pagination: {
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
where: { ...currentCondition.value }
|
||||
}
|
||||
if (queryForm.keyword) {
|
||||
params.where.keyword = queryForm.keyword
|
||||
}
|
||||
|
||||
const res = await stockWarehouse(params.pagination, params.where) as any
|
||||
if (res?.data) {
|
||||
const payload = res.data
|
||||
list.value = payload.list || []
|
||||
pagination.total = payload.pagination?.total || payload.total || 0
|
||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error('获取商品列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 事件处理 ──────────────────────────────────────────────────────────────
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedRow.value = row
|
||||
}
|
||||
|
||||
// ─── 工具函数 ──────────────────────────────────────────────────────────────
|
||||
function formatDate(dateStr: string | null | undefined) {
|
||||
if (!dateStr) return ''
|
||||
return new Date(dateStr).toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
|
||||
}
|
||||
|
||||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.external-stock-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
flex-shrink: 0;
|
||||
gap: 12px;
|
||||
|
||||
&-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
margin-top: 8px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.empty {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
max-height: 260px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,11 +1,19 @@
|
||||
<template>
|
||||
<div class="store-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="货主筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ warehouse_use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="openSignDialog">
|
||||
<el-icon><Plus /></el-icon> 发起签约
|
||||
</el-button>
|
||||
<el-button size="small" type="success" @click="openOpenAccountDialog">
|
||||
<el-icon><Plus /></el-icon> 代开户
|
||||
</el-button>
|
||||
@ -243,96 +251,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 发起签约弹窗 -->
|
||||
<el-dialog
|
||||
v-model="signDialog.visible"
|
||||
:title="signDialog.title"
|
||||
width="480px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="resetSignDialog"
|
||||
>
|
||||
<!-- Step 1: 发起 -->
|
||||
<template v-if="signDialog.step === 1">
|
||||
<el-form :model="signForm" label-width="100px" size="small">
|
||||
<el-form-item v-for="item in signFormItems" :key="item.prop" :label="item.label" :required="item.required">
|
||||
<el-input-number v-if="item.type === 'number'" v-model.number="signForm[item.prop]" :placeholder="item.placeholder" style="width: 100%" :controls="false" />
|
||||
<el-input v-else v-model="signForm[item.prop]" :placeholder="item.placeholder" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<!-- Step 2: 预览/确认 -->
|
||||
<template v-else-if="signDialog.step === 2">
|
||||
<div class="sign-preview">
|
||||
<el-descriptions :column="1" border size="small">
|
||||
<el-descriptions-item label="临时码">
|
||||
<el-tag type="info" size="small">{{ signDialog.tempCode }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="signDialog.contract" label="签约ID">
|
||||
{{ signDialog.contract.id }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="signDialog.contract" label="货主">
|
||||
{{ signDialog.contract.store_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="signDialog.contract" label="仓库">
|
||||
{{ signDialog.contract.warehouse_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="signDialog.contract" label="签约状态">
|
||||
<el-tag size="small" :type="getAuthStatusType(signDialog.contract.auth_status)">
|
||||
{{ signDialog.contract.auth_status_label }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div v-if="signDialog.mode === 'initiate'" class="sign-tip">
|
||||
<el-alert type="info" :closable="false" show-icon>
|
||||
<template #default>已生成临时码,点击「预览」可查看签约详情,点击「确认签约」立即生效。</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
<div v-else-if="signDialog.mode === 'confirm'" class="sign-tip">
|
||||
<el-alert type="success" :closable="false" show-icon>
|
||||
<template #default>签约已确认生效!</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<!-- Step 1 底部 -->
|
||||
<template v-if="signDialog.step === 1">
|
||||
<el-button size="small" @click="signDialog.visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="signDialog.loading" @click="doInitiateSign">
|
||||
发起签约
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- Step 2 底部 -->
|
||||
<template v-else-if="signDialog.step === 2">
|
||||
<el-button size="small" @click="signDialog.visible = false">关闭</el-button>
|
||||
<el-button
|
||||
v-if="signDialog.mode === 'initiate'"
|
||||
size="small"
|
||||
:loading="signDialog.loading"
|
||||
@click="doPreviewSign"
|
||||
>预览</el-button>
|
||||
<el-button
|
||||
v-if="signDialog.mode !== 'confirm'"
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="signDialog.loading"
|
||||
@click="doConfirmSign"
|
||||
>确认签约</el-button>
|
||||
<el-button
|
||||
v-if="signDialog.mode === 'confirm'"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="handleSignSuccess"
|
||||
>完成</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<el-dialog
|
||||
v-model="detailDialog.visible"
|
||||
@ -1009,23 +927,25 @@
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, Plus, Refresh, QuestionFilled, Link } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind,
|
||||
import { storeWarehouseList, storeWarehouseUnbind,
|
||||
storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields,
|
||||
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
||||
storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig,
|
||||
storeWarehouseOpenAccount
|
||||
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList } from '@/api/index/index'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import Detail from './component/detail.vue'
|
||||
import Log from './component/log.vue'
|
||||
import { columns as defaultColumns, signDialogDefault, signFormDefault, qimenFormDefault, signFormItems, qimenFormItems, qimenTableColumns, detailPanel, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems } from './store-config.ts'
|
||||
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, detailPanel, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems } from './store-config.ts'
|
||||
|
||||
// ─── 列表 ───────────────────────────────────────────────────────────────────
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
|
||||
const activeTab = ref('details')
|
||||
const componentMap: Record<string, any> = {
|
||||
@ -1074,13 +994,18 @@ const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
|
||||
const columns = ref(defaultColumns)
|
||||
const availableFields = reactive(defaultAvailableFields)
|
||||
const presetTree = ref<any[]>(defaultPresetTree)
|
||||
|
||||
const currentCondition = ref<any>({ warehouse_use_status: 1 })
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
@ -1099,11 +1024,41 @@ async function loadList() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
@ -1366,89 +1321,6 @@ async function handleRename(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 发起签约 ────────────────────────────────────────────────────────────────
|
||||
const signDialog = reactive({ ...signDialogDefault })
|
||||
const signForm = reactive<Record<string, any>>({ ...signFormDefault })
|
||||
|
||||
function openSignDialog() {
|
||||
resetSignDialog()
|
||||
signDialog.visible = true
|
||||
}
|
||||
|
||||
function resetSignDialog() {
|
||||
Object.assign(signDialog, signDialogDefault)
|
||||
Object.assign(signForm, signFormDefault)
|
||||
}
|
||||
|
||||
async function doInitiateSign() {
|
||||
if (!signForm.counterparty_id) {
|
||||
ElMessage.warning('请输入对方主体ID')
|
||||
return
|
||||
}
|
||||
signDialog.loading = true
|
||||
try {
|
||||
const res = await storeWarehouseSign({
|
||||
counterparty_id: signForm.counterparty_id,
|
||||
remask: signForm.remask || undefined
|
||||
}) as any
|
||||
if (res?.flag === 'success' || res?.code === 200) {
|
||||
signDialog.mode = res.data?.mode || 'initiate'
|
||||
signDialog.tempCode = res.data?.temp_code || ''
|
||||
signDialog.contract = res.data?.contract || null
|
||||
signDialog.step = 2
|
||||
signDialog.title = '签约预览'
|
||||
} else {
|
||||
ElMessage.error(res?.message || '发起签约失败')
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('发起签约失败')
|
||||
} finally {
|
||||
signDialog.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
async function doPreviewSign() {
|
||||
if (!signDialog.tempCode) return
|
||||
signDialog.loading = true
|
||||
try {
|
||||
const res = await storeWarehouseSign({ temp_code: signDialog.tempCode, action: 'preview' }) as any
|
||||
if (res?.flag === 'success' || res?.code === 200) {
|
||||
signDialog.mode = res.data?.mode || 'preview'
|
||||
signDialog.contract = res.data?.contract || null
|
||||
} else {
|
||||
ElMessage.error(res?.message || '预览失败')
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('预览失败')
|
||||
} finally {
|
||||
signDialog.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
async function doConfirmSign() {
|
||||
if (!signDialog.tempCode) return
|
||||
signDialog.loading = true
|
||||
try {
|
||||
const res = await storeWarehouseSign({ temp_code: signDialog.tempCode, action: 'confirm' }) as any
|
||||
if (res?.flag === 'success' || res?.code === 200) {
|
||||
signDialog.mode = 'confirm'
|
||||
signDialog.contract = res.data?.contract || null
|
||||
signDialog.title = '签约成功'
|
||||
} else {
|
||||
ElMessage.error(res?.message || '确认签约失败')
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('确认签约失败')
|
||||
} finally {
|
||||
signDialog.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSignSuccess() {
|
||||
signDialog.visible = false
|
||||
loadList()
|
||||
}
|
||||
|
||||
// ─── 详情 ────────────────────────────────────────────────────────────────────
|
||||
const detailDialog = reactive({ visible: false, row: null as any })
|
||||
|
||||
|
||||
@ -178,7 +178,30 @@ export const columns = [
|
||||
{ prop: 'actions', label: '操作', width: 380, fixed: 'right' }
|
||||
]
|
||||
|
||||
export const availableFields: any[] = []
|
||||
export const availableFields = [
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已解除', value: 4 },
|
||||
{ label: '已过期', value: 5 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'warehouse_use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
export const presetTree: any[] = []
|
||||
|
||||
|
||||
@ -1,14 +1,22 @@
|
||||
<template>
|
||||
<div class="warehouses-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="仓库筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ store_use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="openSignDialog('apply')">
|
||||
<el-button size="small" type="primary" @click="openSignDialog">
|
||||
<el-icon><Plus /></el-icon> 发起签约
|
||||
</el-button>
|
||||
<el-button size="small" type="warning" @click="openSignDialog('preview')">
|
||||
<el-icon><Search /></el-icon> 预览签约
|
||||
</el-button>
|
||||
<el-button size="small" @click="loadList">
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
@ -69,7 +77,13 @@
|
||||
{{ row.print_quantity ?? '—' }}
|
||||
</template>
|
||||
<template #column-has_qimen_config="{ row }">
|
||||
<el-tag size="small" :type="row.has_qimen_config ? 'success' : 'info'" effect="plain">
|
||||
<el-tag
|
||||
size="small"
|
||||
:type="row.has_qimen_config ? 'success' : 'info'"
|
||||
effect="plain"
|
||||
@click.stop="openQimenDialog(row)"
|
||||
style="cursor:pointer"
|
||||
>
|
||||
{{ row.has_qimen_config ? '已配置' : '未配置' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
@ -163,8 +177,7 @@
|
||||
@close="resetSignDialog"
|
||||
>
|
||||
<template v-if="signDialog.step === 1">
|
||||
<!-- 发起签约:填对方主体ID -->
|
||||
<el-form v-if="signDialog.signAction === 'apply'" :model="signForm" label-width="100px" size="small">
|
||||
<el-form :model="signForm" label-width="100px" size="small">
|
||||
<el-form-item label="对方主体ID" required>
|
||||
<el-input-number v-model.number="signForm.counterparty_id" placeholder="请输入对方主体ID" style="width: 100%" :controls="false" />
|
||||
</el-form-item>
|
||||
@ -172,12 +185,6 @@
|
||||
<el-input v-model="signForm.remask" placeholder="给对方主体的通用名称(可选)" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 预览签约:填仓库ID -->
|
||||
<el-form v-else :model="signForm" label-width="100px" size="small">
|
||||
<el-form-item label="仓库ID" required>
|
||||
<el-input-number v-model.number="signForm.warehouse_id" placeholder="请输入仓库ID" style="width: 100%" :controls="false" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<!-- 预览结果 / 提交结果 -->
|
||||
@ -252,7 +259,7 @@
|
||||
<template v-else-if="signDialog.step === 2">
|
||||
<el-button size="small" @click="goBackToStep1">返回</el-button>
|
||||
<el-button
|
||||
v-if="signDialog.signMode === 'preview' && signDialog.signAction === 'apply'"
|
||||
v-if="signDialog.signMode === 'preview'"
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="signDialog.loading"
|
||||
@ -264,6 +271,76 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 奇门接口配置查看弹窗 -->
|
||||
<el-dialog
|
||||
v-model="qimenDialog.visible"
|
||||
:title="`接口配置查看 — ${qimenDialog.contractRow?.warehouse_name || qimenDialog.contractRow?.remask || qimenDialog.contractRow?.counterparty_name || ''}`"
|
||||
width="90%"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="resetQimenDialog"
|
||||
>
|
||||
<div style="display:flex;justify-content:flex-end;margin-bottom:10px">
|
||||
<el-button size="small" @click="loadQimenConfigs">
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="qimenDialog.list" v-loading="qimenDialog.loading" size="small" border>
|
||||
<el-table-column prop="app_name" label="应用名称" min-width="120" />
|
||||
<el-table-column prop="interface_name" label="接口类型" width="130" />
|
||||
<el-table-column label="ERP" min-width="110">
|
||||
<template #default="{ row }">{{ row.erp_display || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货主编码" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<div class="copy-cell">
|
||||
<span class="copy-text">{{ row.qimen_customer_id || '—' }}</span>
|
||||
<el-button v-if="row.qimen_customer_id" size="small" type="primary" link @click="copyText(row.qimen_customer_id)">复制</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库编码" min-width="130">
|
||||
<template #default="{ row }">
|
||||
<div class="copy-cell">
|
||||
<span class="copy-text">{{ row.qimen_warehouse_code || '—' }}</span>
|
||||
<el-button v-if="row.qimen_warehouse_code" size="small" type="primary" link @click="copyText(row.qimen_warehouse_code)">复制</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="APPKEY" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<div class="copy-cell">
|
||||
<span class="copy-text">{{ row.self_app_key || '—' }}</span>
|
||||
<el-button v-if="row.self_app_key" size="small" type="primary" link @click="copyText(row.self_app_key)">复制</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="APPSECRET" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<div class="copy-cell">
|
||||
<template v-if="visibleSecrets[row.id || row.interface_type_id]">
|
||||
<span class="copy-text">{{ row.self_app_secret || '—' }}</span>
|
||||
<el-button v-if="row.self_app_secret" size="small" type="primary" link @click="copyText(row.self_app_secret)">复制</el-button>
|
||||
</template>
|
||||
<el-button v-else-if="row.self_app_secret" size="small" type="warning" link @click="toggleSecret(row)">显示</el-button>
|
||||
<span v-else>—</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="70" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="row.is_enabled ? 'success' : 'info'">{{ row.is_enabled ? '启用' : '停用' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无奇门配置" :image-size="50" />
|
||||
</template>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button size="small" @click="qimenDialog.visible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -276,8 +353,11 @@ import {
|
||||
storeWarehouseSign,
|
||||
storeWarehouseConfirmSign,
|
||||
storeWarehouseUnbind,
|
||||
storeWarehouseRename
|
||||
storeWarehouseRename,
|
||||
listApiConfig
|
||||
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import { listInterfaceTypes, getQimenAppList } from '@/api/index/index'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
// ─── 列表列配置 ─────────────────────────────────────────────────────────────
|
||||
@ -292,6 +372,34 @@ const columns = [
|
||||
{ prop: 'actions', label: '操作', width: 280, fixed: 'right' }
|
||||
]
|
||||
|
||||
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
||||
const availableFields = [
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已解除', value: 4 },
|
||||
{ label: '已过期', value: 5 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'store_use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const presetTree: any[] = []
|
||||
|
||||
// ─── 当前主体信息(从列表接口返回) ────────────────────────────────────────
|
||||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||||
|
||||
@ -300,10 +408,17 @@ const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
const activeTab = ref('details')
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
const queryForm = reactive<{
|
||||
keyword: string
|
||||
auth_status: number | undefined
|
||||
store_use_status: number | undefined
|
||||
}>({ keyword: '', auth_status: undefined, store_use_status: undefined })
|
||||
|
||||
const currentCondition = ref<any>({ store_use_status: 1 })
|
||||
|
||||
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
||||
async function loadList() {
|
||||
@ -311,7 +426,8 @@ async function loadList() {
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
@ -340,11 +456,41 @@ function isExpired(dateStr: string): boolean {
|
||||
return d < new Date()
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
@ -412,7 +558,6 @@ const signDialog = reactive({
|
||||
title: '发起签约',
|
||||
step: 1,
|
||||
loading: false,
|
||||
signAction: 'apply' as string,
|
||||
signMode: '' as string,
|
||||
contract: null as any,
|
||||
currentSubject: null as any,
|
||||
@ -421,49 +566,39 @@ const signDialog = reactive({
|
||||
|
||||
const signForm = reactive({
|
||||
counterparty_id: undefined as number | undefined,
|
||||
warehouse_id: undefined as number | undefined,
|
||||
remask: ''
|
||||
})
|
||||
|
||||
function openSignDialog(action: 'apply' | 'preview' = 'apply') {
|
||||
function openSignDialog() {
|
||||
signDialog.visible = true
|
||||
signDialog.step = 1
|
||||
signDialog.signAction = action
|
||||
signDialog.title = action === 'preview' ? '预览签约' : '发起签约'
|
||||
signDialog.title = '发起签约'
|
||||
signDialog.signMode = ''
|
||||
signDialog.contract = null
|
||||
signDialog.currentSubject = null
|
||||
signDialog.counterparty = null
|
||||
signForm.counterparty_id = undefined
|
||||
signForm.warehouse_id = undefined
|
||||
signForm.remask = ''
|
||||
}
|
||||
|
||||
function resetSignDialog() {
|
||||
signForm.counterparty_id = undefined
|
||||
signForm.warehouse_id = undefined
|
||||
signForm.remask = ''
|
||||
signDialog.step = 1
|
||||
signDialog.loading = false
|
||||
}
|
||||
|
||||
async function doPreviewSign() {
|
||||
const isPreviewOnly = signDialog.signAction === 'preview'
|
||||
if (isPreviewOnly && !signForm.warehouse_id) {
|
||||
ElMessage.warning('请输入仓库ID')
|
||||
return
|
||||
}
|
||||
if (!isPreviewOnly && !signForm.counterparty_id) {
|
||||
if (!signForm.counterparty_id) {
|
||||
ElMessage.warning('请输入对方主体ID')
|
||||
return
|
||||
}
|
||||
signDialog.loading = true
|
||||
try {
|
||||
// 第一步:拉取预览
|
||||
const params: any = isPreviewOnly
|
||||
? { action: 'preview', warehouse_id: signForm.warehouse_id }
|
||||
: { action: 'preview', warehouse_id: signForm.counterparty_id }
|
||||
const res = await storeWarehouseSign(params) as any
|
||||
const res = await storeWarehouseSign({
|
||||
action: 'preview',
|
||||
warehouse_id: signForm.counterparty_id
|
||||
}) as any
|
||||
if (res?.data) {
|
||||
const d = res.data
|
||||
signDialog.signMode = d.mode || ''
|
||||
@ -528,6 +663,124 @@ async function handleConfirmSign(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 奇门接口配置查看 ──────────────────────────────────────────────────────
|
||||
const qimenDialog = reactive({
|
||||
visible: false,
|
||||
loading: false,
|
||||
contractRow: null as any,
|
||||
list: [] as any[],
|
||||
availableTypes: [] as any[]
|
||||
})
|
||||
const qimenAppOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const visibleSecrets = reactive<Record<string | number, boolean>>({})
|
||||
|
||||
function toggleSecret(row: any) {
|
||||
const key = row.id || row.interface_type_id
|
||||
visibleSecrets[key] = !visibleSecrets[key]
|
||||
}
|
||||
|
||||
function openQimenDialog(row: any) {
|
||||
qimenDialog.contractRow = row
|
||||
qimenDialog.list = []
|
||||
qimenDialog.visible = true
|
||||
void loadQimenAppOptions()
|
||||
loadQimenConfigs()
|
||||
}
|
||||
|
||||
function resetQimenDialog() {
|
||||
qimenDialog.contractRow = null
|
||||
qimenDialog.list = []
|
||||
qimenDialog.availableTypes = []
|
||||
qimenAppOptions.value = []
|
||||
}
|
||||
|
||||
function getQimenErpDisplay(config: any): string {
|
||||
return String(config?.erp_name || config?.erpName || config?.qimen_app_key || '').trim()
|
||||
}
|
||||
|
||||
function mapQimenAppOptions(rawList: any[]) {
|
||||
const result: Array<{ label: string; value: string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawList || []) {
|
||||
const appKey = String(item?.app_key ?? item?.qimen_app_key ?? item?.value ?? '').trim()
|
||||
if (!appKey || seen.has(appKey)) continue
|
||||
const appName = String(item?.app_name ?? item?.name ?? item?.label ?? '').trim()
|
||||
result.push({ value: appKey, label: appName ? `${appName}(${appKey})` : appKey })
|
||||
seen.add(appKey)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async function loadQimenAppOptions() {
|
||||
try {
|
||||
const res: any = await getQimenAppList({})
|
||||
const payload = res?.data
|
||||
const listRaw =
|
||||
res?.list || res?.records || (Array.isArray(res) ? res : null) ||
|
||||
(Array.isArray(payload) ? payload : null) || payload?.list || payload?.records ||
|
||||
payload?.data?.list || payload?.data?.records || payload?.data || []
|
||||
const rows = Array.isArray(listRaw) ? listRaw : []
|
||||
qimenAppOptions.value = mapQimenAppOptions(rows)
|
||||
} catch {
|
||||
qimenAppOptions.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function loadQimenConfigs() {
|
||||
if (!qimenDialog.contractRow) return
|
||||
qimenDialog.loading = true
|
||||
try {
|
||||
const [res, typesRes] = await Promise.all([
|
||||
listApiConfig({ id: qimenDialog.contractRow.id }) as Promise<any>,
|
||||
listInterfaceTypes() as Promise<any>
|
||||
])
|
||||
const serverTypes: any[] = Array.isArray(typesRes?.list) ? typesRes.list : []
|
||||
const typeMap = new Map<number, any>(serverTypes.map((t: any) => [t.id, t]))
|
||||
if (res?.data) {
|
||||
qimenDialog.list = (res.data.list || []).map((item: any) => ({
|
||||
...item,
|
||||
erp_display: getQimenErpDisplay(item)
|
||||
}))
|
||||
;(res.data.list || []).forEach((item: any) => {
|
||||
const tid = item.interface_type_id
|
||||
if (tid && !typeMap.has(tid)) {
|
||||
typeMap.set(tid, {
|
||||
id: tid,
|
||||
interface_code: item.interface_code || item.interface_category || '',
|
||||
interface_name: item.interface_name || item.interface_code || `类型 ${tid}`
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
qimenDialog.availableTypes = Array.from(typeMap.values())
|
||||
} catch {
|
||||
ElMessage.error('加载接口配置列表失败')
|
||||
} finally {
|
||||
qimenDialog.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
async function copyText(text: string) {
|
||||
try {
|
||||
if (navigator?.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(text)
|
||||
} else {
|
||||
const input = document.createElement('textarea')
|
||||
input.value = text
|
||||
input.style.position = 'fixed'
|
||||
input.style.opacity = '0'
|
||||
document.body.appendChild(input)
|
||||
input.focus()
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
}
|
||||
ElMessage.success('已复制')
|
||||
} catch {
|
||||
ElMessage.error('复制失败')
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
@ -648,4 +901,18 @@ onMounted(() => {
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
|
||||
.copy-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
.copy-text {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user