mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 13:31:04 +00:00
feat(物流公司): 绑定驱动列显示驱动中文名称
This commit is contained in:
parent
4668f0a1ea
commit
8933493127
@ -38,6 +38,12 @@ class ExpressCompanyServices extends BaseService
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$list = $this->dao->getList($where, ['*'], $page, $limit);
|
||||
$count = $this->dao->count($where);
|
||||
// 绑定驱动补充中文名称
|
||||
$driverNames = app()->make(ExpressDriverServices::class)->getExpressDriverNames();
|
||||
foreach ($list as &$item) {
|
||||
$item['driver_name'] = $driverNames[$item['driver_key']] ?? $item['driver_key'];
|
||||
}
|
||||
unset($item);
|
||||
return compact('list', 'count');
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,22 @@ class ExpressDriverServices extends BaseService
|
||||
return $this->dao->getEnabledDrivers();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子面单类型驱动的中文名称映射(driver_key => driver_name)
|
||||
* @return array
|
||||
*/
|
||||
public function getExpressDriverNames(): array
|
||||
{
|
||||
$names = [];
|
||||
$list = $this->getList([])['list'] ?? [];
|
||||
foreach ($list as $driver) {
|
||||
if (($driver['driver_type'] ?? '') === 'express') {
|
||||
$names[$driver['driver_key']] = $driver['driver_name'] ?? '';
|
||||
}
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 driver_key 获取驱动信息
|
||||
* @param string $driverKey
|
||||
|
||||
@ -33,9 +33,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="绑定驱动" width="120" prop="driver_key">
|
||||
<el-table-column label="绑定驱动" width="120" prop="driver_name">
|
||||
<template #default="scope">
|
||||
<el-tag type="info">{{ scope.row.driver_key || '-' }}</el-tag>
|
||||
<el-tag type="info">{{ scope.row.driver_name || scope.row.driver_key || '-' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" fixed="right" width="140" align="center">
|
||||
<el-table-column label="操作" fixed="right" width="160" align="center">
|
||||
<template #default="scope">
|
||||
<el-button type="text" v-db-click @click="openEditDialog(scope.row)"> 编辑 </el-button>
|
||||
<el-popconfirm title="确认删除该物流公司?" @confirm="handleDelete(scope.row)">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user