Commit 5063d61a by 杨树贤

Merge branch 'ysx-对接审核中心-20251015' into Dev

# Conflicts:
#	app/Http/Services/DataService.php
#	app/Http/routes.php
parents 7c9224b4 87a3d0f4
...@@ -36,7 +36,7 @@ class SyncAllSupplierToErp extends Command ...@@ -36,7 +36,7 @@ class SyncAllSupplierToErp extends Command
public function handle() public function handle()
{ {
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
$supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code','!=','') $supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code','!=','')->where('create_time','>',1723132800)
->pluck('supplier_id')->toArray(); ->pluck('supplier_id')->toArray();
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'), $conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'), config('database.connections.rabbitmq.port'),
......
...@@ -60,6 +60,7 @@ class SupplierAccountApiController extends Controller ...@@ -60,6 +60,7 @@ class SupplierAccountApiController extends Controller
$data['create_time'] = time(); $data['create_time'] = time();
$data['create_uid'] = $request->user->userId; $data['create_uid'] = $request->user->userId;
$data['password'] = Hash::make($data['password_raw']); $data['password'] = Hash::make($data['password_raw']);
$data['account_name'] = SupplierAccountService::generateAccountName($supplierId);
$model = new SupplierAccountModel(); $model = new SupplierAccountModel();
$id = $model->insertGetId($data); $id = $model->insertGetId($data);
if ($id) { if ($id) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api; namespace App\Http\Controllers\Api;
use Cookie; use Cookie;
use Exception;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
...@@ -16,6 +17,7 @@ use Illuminate\Support\Facades\Auth; ...@@ -16,6 +17,7 @@ use Illuminate\Support\Facades\Auth;
use App\Http\Services\CompanyService; use App\Http\Services\CompanyService;
use App\Http\Services\SupplierService; use App\Http\Services\SupplierService;
use App\Http\Services\AdminUserService; use App\Http\Services\AdminUserService;
use App\Http\Services\AuditCenterService;
use App\Http\Services\SyncSupplierService; use App\Http\Services\SyncSupplierService;
use App\Http\Validators\SupplierValidator; use App\Http\Validators\SupplierValidator;
use App\Http\Services\StandardBrandService; use App\Http\Services\StandardBrandService;
...@@ -412,10 +414,14 @@ class SupplierApiController extends Controller ...@@ -412,10 +414,14 @@ class SupplierApiController extends Controller
$this->response(-1, '不同意时必须填写原因'); $this->response(-1, '不同意时必须填写原因');
} }
$supplierId = $request->get('supplier_id'); $supplierId = $request->get('supplier_id');
$service = new SupplierAuditService(); try {
$result = $service->auditSupplier($supplierId, $status, $rejectReason); $service = new SupplierAuditService();
if (!$result) { $result = $service->auditSupplier($supplierId, $status, $rejectReason);
$this->response(-1, '审核失败'); if (!$result) {
$this->response(-1, '审核失败');
}
} catch (Exception $e) {
$this->response(-1, $e->getMessage());
} }
$this->response(0, '审核成功'); $this->response(0, '审核成功');
} }
...@@ -834,4 +840,13 @@ class SupplierApiController extends Controller ...@@ -834,4 +840,13 @@ class SupplierApiController extends Controller
$this->response(-1, '清空线上采购员失败'); $this->response(-1, '清空线上采购员失败');
} }
} }
//获取审核流程
public function GetAuditFlow($request)
{
$supplierId = $request->get('supplier_id');
$supplierAuditService = new AuditCenterService();
$result = $supplierAuditService->getAuditInfoByIdAndType($supplierId, AuditCenterService::TYPE_SUPPLIER_AUDIT);
$this->response(0, 'ok', $result);
}
} }
...@@ -43,14 +43,23 @@ class AttachmentAuditFilter ...@@ -43,14 +43,23 @@ class AttachmentAuditFilter
} else { } else {
$query->whereRaw("(create_uid in $inUserIdSql)"); $query->whereRaw("(create_uid in $inUserIdSql)");
} }
}else{
$query->where(function ($selfQuery) use ($userId, $codeId) {
$selfQuery->where('create_uid', $userId)
->orWhere('purchase_uid', $codeId)
->orWhere('channel_uid', 'like', '%' . $codeId . '%');
});
} }
} }
// 默认只显示审核中的数据 // 默认只显示审核中的数据
if (empty($map['status'])) { if (isset($map['status']) && $map['status'] === "0") {
$query->where('status', AttachmentAuditModel::STATUS_PENDING); $query->where('status', AttachmentAuditModel::STATUS_PENDING);
} else { } else {
$query->where('status', $map['status']); if (!empty($map['status'])) {
$query->where('status', $map['status']);
}else{
$query->where('status', AttachmentAuditModel::STATUS_PENDING);
}
} }
// 供应商名称筛选 // 供应商名称筛选
......
...@@ -32,7 +32,7 @@ class SupplierAccountFilter ...@@ -32,7 +32,7 @@ class SupplierAccountFilter
$query->whereIn('supplier_id', $supplierIds); $query->whereIn('supplier_id', $supplierIds);
} else { } else {
//否则只能查看自己的 //否则只能查看自己的
$supplierIds = SupplierChannelModel::whereRaw(DB::raw("(yunxin_channel_uid REGEXP '$codeId')"))->pluck('supplier_id')->toArray(); $supplierIds = SupplierChannelModel::whereRaw(DB::raw("(channel_uid REGEXP '$codeId')"))->pluck('supplier_id')->toArray();
$query->whereIn('supplier_id', $supplierIds); $query->whereIn('supplier_id', $supplierIds);
} }
} }
......
...@@ -15,6 +15,7 @@ use App\Model\SupplierContactModel; ...@@ -15,6 +15,7 @@ use App\Model\SupplierContactModel;
use App\Http\Services\RegionService; use App\Http\Services\RegionService;
use App\Http\Services\SupplierService; use App\Http\Services\SupplierService;
use App\Http\Services\DepartmentService; use App\Http\Services\DepartmentService;
use App\Http\Services\AuditCenterService;
use App\Http\Services\SupplierTagService; use App\Http\Services\SupplierTagService;
use App\Http\Transformers\LogTransformer; use App\Http\Transformers\LogTransformer;
use App\Http\Services\SkuUploadLogService; use App\Http\Services\SkuUploadLogService;
......
<?php
namespace App\Http\Services;
use Exception;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
class AuditCenterService
{
const SYSTEM_ID = 1;
//审批状态 0-待审核 1-审核中 2-审核完成 -1-审核拒绝 -2-审核撤销
const APPROVAL_STATUS_WAIT = 0;
const APPROVAL_STATUS_ING = 1;
const APPROVAL_STATUS_FINISH = 2;
const APPROVAL_STATUS_REFUSE = -1;
const APPROVAL_STATUS_CANCEL = -2;
const TYPE_SUPPLIER_AUDIT = 'supplier_audit';
public static function getAuditInfoByIdAndType($id, $type)
{
$requestData = [
'bill_type' => $type,
'source_id' => $id,
'system_id' => self::SYSTEM_ID,
];
$response = self::requestAudit("/sync/bill/getBillInfo", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function getAuditInfoByBillId($billId)
{
$requestData = [
'bill_id' => $billId,
];
$response = self::requestAudit("/sync/bill/getBillInfo", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function audit($billId, $approvalUid, $approvalStatus, $remark)
{
$requestData = [
'bill_id' => $billId,
'approval_uid' => $approvalUid,
'approval_status' => $approvalStatus,
'remark' => $remark,
];
$response = self::requestAudit("/sync/bill/audit", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function getAuditFlowInfo($type, $userId, $orgId = null)
{
$requestData = [
"system_id" => self::SYSTEM_ID,
"bill_type" => $type,
"apply_uid" => $userId,
"org_id" => $orgId,
];
$response = self::requestAudit("/sync/flow/getFlowInfo", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function getAuditList($billType, $params)
{
//page
//limit
//source_id
//source_sn
//org_id
//system_id
//bill_type
//approval_status
//apply_uids
//apply_dept_ids
//apply_time
//update_time
$requestData = $params;
$requestData['system_id'] = self::SYSTEM_ID;
$response = self::requestAudit("/sync/bill/getBillList", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function addAudit($params, $applyUid, $createUid)
{
//{
// "flow_id": "6",
// "source_id": "1",
// "source_sn": "1",
// "org_id": "1",
// "system_id": "5",
// "trigger_reason": "测试触发",
// "current_node": "null",
// "apply_uid": "1580",
// "create_uid": "1580",
// "apply_node_ids": "41,42"
//}
$requestData = [
'flow_id' => $params['flow_id'],
'source_id' => $params['source_id'],
'source_sn' => $params['source_sn'],
'org_id' => $params['org_id'],
'system_id' => self::SYSTEM_ID,
'trigger_reason' => array_get($params, 'trigger_reason', ''),
'current_node' => array_get($params, 'current_node', ''),
'apply_uid' => $applyUid,
'create_uid' => $createUid,
'apply_node_ids' => array_get($params, 'apply_node_ids', ''),
];
$response = self::requestAudit("/sync/bill/addBill", $requestData);
if ($response['code'] != 0) {
throw new Exception($response['msg']);
}
return $response['data'];
}
public static function requestAudit($route, $data)
{
$url = config("website.AuditCenterUrl");
$url = $url . $route;
try {
Log::info("---------------同步请求audit接口 {$route}------------------");
Log::info(json_encode($data));
$client = new Client(['headers' => ['Content-Type' => 'application/json']]);
$response = $client->post($url, ['json' => $data]);
$result = json_decode($response->getBody()->getContents(), true);
if ($result['code'] != 0) {
throw new Exception($result['msg']);
}
Log::info("---------------同步请求audit接口 {$route}-----audit返回结果-------------");
return $result;
} catch (\Throwable $e) {
throw $e;
}
}
}
...@@ -876,16 +876,10 @@ class DataService ...@@ -876,16 +876,10 @@ class DataService
//同步供应商到erp //同步供应商到erp
public static function syncSupplierToErp() public static function syncSupplierToErp()
{ {
$conn = new AMQPStreamConnection( $supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code', '!=', '')->where('create_time','>',1723132800)
config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password')
);
$supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code', '!=', '')
->pluck('supplier_id')->toArray(); ->pluck('supplier_id')->toArray();
foreach ($supplierIds as $supplierId) { foreach ($supplierIds as $supplierId) {
(new SyncSupplierService())->syncSupplierToErp($supplierId,$conn); (new SyncSupplierService())->syncSupplierToErp($supplierId);
} }
} }
...@@ -899,4 +893,15 @@ class DataService ...@@ -899,4 +893,15 @@ class DataService
'international_code' => 'TW', 'international_code' => 'TW',
]); ]);
} }
public static function initSupplierAccountName()
{
$supplierAccountList = SupplierAccountModel::where('account_name', '')->get()->toArray();
foreach ($supplierAccountList as $supplierAccount) {
$supplierAccount['account_name'] = SupplierAccountService::generateAccountName($supplierAccount['supplier_id']);
SupplierAccountModel::where('id', $supplierAccount['id'])->update([
'account_name' => $supplierAccount['account_name'],
]);
}
}
} }
...@@ -339,7 +339,7 @@ class SkuService extends BaseService ...@@ -339,7 +339,7 @@ class SkuService extends BaseService
'sku_id' => $skuId, 'sku_id' => $skuId,
'cp_time' => $data['cp_time'], 'cp_time' => $data['cp_time'],
]; ];
ManualPutawaySkuLog::addManualPutawaySkuLog($skuId, $supplierCodes[$key]); ManualPutawaySkuLog::addManualPutawaySkuLog($skuId, $supplierCodes[$key],1);
} }
} else { } else {
foreach ($skuIds as $key => $skuId) { foreach ($skuIds as $key => $skuId) {
......
...@@ -73,8 +73,13 @@ class SupplierAccountService ...@@ -73,8 +73,13 @@ class SupplierAccountService
if (empty($supplier)) { if (empty($supplier)) {
return; return;
} }
if ($supplier->status != SupplierChannelModel::STATUS_PASSED) {
return;
}
//合作类型不包含芯链商家,则不创建账号 //合作类型不包含芯链商家,则不创建账号
if (strpos($supplier->cooperation_type, SupplierChannelModel::SUPPLIER_STOCKUP_TYPE) === false) { if (strpos($supplier->stockup_type, (string)SupplierChannelModel::SUPPLIER_STOCKUP_TYPE_XINLIAN) === false) {
return; return;
} }
//新建账号 //新建账号
......
...@@ -234,6 +234,20 @@ class SupplierService ...@@ -234,6 +234,20 @@ class SupplierService
//新增的时候也要去添加地址了 //新增的时候也要去添加地址了
$supplierAddressService = new SupplierAddressService(); $supplierAddressService = new SupplierAddressService();
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress); $supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
// 如果是直接申请审核,触发审核中心流程
if ($isDirectApply) {
try {
$auditService = new SupplierAuditService();
$triggerReason = $channel['supplier_type'] == SupplierChannelModel::SUPPLIER_TYPE_TEMPORARY
? request()->input('apply_audit_reason', '新增临时供应商并申请审核')
: '新增供应商并申请审核';
$auditService->addApprove($supplierId, $triggerReason);
} catch (\Exception $e) {
// 如果审核中心调用失败,记录日志但不影响主流程
\Illuminate\Support\Facades\Log::error('新增供应商触发审核中心失败: ' . $e->getMessage());
}
}
} else { } else {
/**这里的是更新供应商的操作**/ /**这里的是更新供应商的操作**/
$supplierId = $this->newSupplierId = $channel['supplier_id']; $supplierId = $this->newSupplierId = $channel['supplier_id'];
...@@ -340,9 +354,6 @@ class SupplierService ...@@ -340,9 +354,6 @@ class SupplierService
return $supplierId; return $supplierId;
}); });
//自动创建芯链账号
SupplierAccountService::autoCreateYunxinAccount($supplierId);
//保存日志 //保存日志
$newSupplier = $model->where('supplier_id', $this->newSupplierId)->first(); $newSupplier = $model->where('supplier_id', $this->newSupplierId)->first();
$newSupplier = $supplierTransformer->transformInfo($newSupplier); $newSupplier = $supplierTransformer->transformInfo($newSupplier);
...@@ -408,7 +419,7 @@ class SupplierService ...@@ -408,7 +419,7 @@ class SupplierService
//这里有个申请审核的判断逻辑 //这里有个申请审核的判断逻辑
//如果是申请审核,并且原来的状态不是已通过,无论什么情况,都要变成审核中,如果是已通过,那么就要走下面的判断是否要忽略审核流程 //如果是申请审核,并且原来的状态不是已通过,无论什么情况,都要变成审核中,如果是已通过,那么就要走下面的判断是否要忽略审核流程
if ($isAudit && $oldSupplier['status'] == SupplierChannelModel::STATUS_PASSED && !$needAudit && !empty($channel['supplier_id'])) { if ($isAudit && array_get($oldSupplier, 'status') == SupplierChannelModel::STATUS_PASSED && !$needAudit && !empty($channel['supplier_id'])) {
//什么都不需要操作 //什么都不需要操作
} else if ($isAudit && $newSupplier['is_entity'] != 0) { } else if ($isAudit && $newSupplier['is_entity'] != 0) {
$auditData[] = [ $auditData[] = [
...@@ -418,6 +429,7 @@ class SupplierService ...@@ -418,6 +429,7 @@ class SupplierService
]; ];
$this->batchApplyInReviewSupplier($auditData); $this->batchApplyInReviewSupplier($auditData);
} }
return $supplierId; return $supplierId;
} }
...@@ -780,6 +792,16 @@ class SupplierService ...@@ -780,6 +792,16 @@ class SupplierService
if (!$result) { if (!$result) {
return $result; return $result;
} }
// 触发审核中心流程
try {
$auditService = new SupplierAuditService();
$triggerReason = array_get($data, 'apply_audit_reason', '申请审核');
$auditService->addApprove($data['supplier_id'], $triggerReason);
} catch (\Exception $e) {
// 如果审核中心调用失败,记录日志但不影响主流程
\Illuminate\Support\Facades\Log::error('添加审核中心审批失败: ' . $e->getMessage());
}
} }
return true; return true;
} }
......
...@@ -33,7 +33,7 @@ class SyncSupplierService ...@@ -33,7 +33,7 @@ class SyncSupplierService
return false; return false;
} }
if (!$supplier['group_code']) { if (!$supplier['group_code'] && $supplier['status'] != SupplierChannelModel::STATUS_PASSED) {
return true; return true;
} }
...@@ -124,7 +124,7 @@ class SyncSupplierService ...@@ -124,7 +124,7 @@ class SyncSupplierService
'recid' => $receipt['receipt_id'], 'recid' => $receipt['receipt_id'],
'intermediaryBank' => $receipt['intermediary_bank'], 'intermediaryBank' => $receipt['intermediary_bank'],
'remark' => $receipt['remark'], 'remark' => $receipt['remark'],
'country_isocode' => !empty($receipt['nation']['international_code']) ? $receipt['nation']['international_code']: "", 'country_isocode' => !empty($receipt['nation']['international_code']) ? $receipt['nation']['international_code'] : "",
]; ];
} }
} }
...@@ -365,14 +365,14 @@ class SyncSupplierService ...@@ -365,14 +365,14 @@ class SyncSupplierService
} }
//修改供应商的状态 //修改供应商的状态
SupplierChannelModel::where('supplier_id', $supplierId) SupplierChannelModel::where('supplier_id', $supplierId)
->update([ ->update([
'is_entity' => $isEntityResult, 'is_entity' => $isEntityResult,
'update_time' => time(), 'update_time' => time(),
//这里的逻辑是,因为取消实体名单以后,如果之前的状态是黑名单的话,直接变成待提审 //这里的逻辑是,因为取消实体名单以后,如果之前的状态是黑名单的话,直接变成待提审
'status' => $isEntity ? SupplierChannelModel::STATUS_DISABLE : ($preStatus == SupplierChannelModel::STATUS_BLOCK ? SupplierChannelModel::STATUS_IN_REVIEW : $preStatus), 'status' => $isEntity ? SupplierChannelModel::STATUS_DISABLE : ($preStatus == SupplierChannelModel::STATUS_BLOCK ? SupplierChannelModel::STATUS_IN_REVIEW : $preStatus),
'disable_reason' => $reason, 'disable_reason' => $reason,
'united_tags' => !empty($tagList) ? implode(',', $tagList) : '', 'united_tags' => !empty($tagList) ? implode(',', $tagList) : '',
]); ]);
$isYunxinSupplier = false; $isYunxinSupplier = false;
//还要去修改对应的供应商账号,也是要记录禁用前的状态 //还要去修改对应的供应商账号,也是要记录禁用前的状态
$supplierAccount = SupplierAccountModel::where('supplier_id', $supplierId)->first(); $supplierAccount = SupplierAccountModel::where('supplier_id', $supplierId)->first();
......
...@@ -36,9 +36,9 @@ class AttachmentAuditTransformer ...@@ -36,9 +36,9 @@ class AttachmentAuditTransformer
$item['supplier_code'] = $item['supplier']['supplier_code']; $item['supplier_code'] = $item['supplier']['supplier_code'];
// 获取采购员信息 // 获取采购员信息
$yunxinChannelUid = $item['supplier']['yunxin_channel_uid']; $channelUid = $item['supplier']['channel_uid'];
if ($yunxinChannelUid) { if ($channelUid) {
$item['purchase_user_name'] = $adminUserService->getAdminUserNameByCodeId($yunxinChannelUid); $item['purchase_user_name'] = (new SupplierTransformer())->getChannelUserNames($item['supplier']['channel_uid']);
} else { } else {
$item['purchase_user_name'] = ''; $item['purchase_user_name'] = '';
} }
......
...@@ -47,6 +47,7 @@ class SupplierContactTransformer ...@@ -47,6 +47,7 @@ class SupplierContactTransformer
} }
$item['channel_user_type_name'] = array_get(config('field.ChannelUserType'), $item['channel_user_type']); $item['channel_user_type_name'] = array_get(config('field.ChannelUserType'), $item['channel_user_type']);
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
} }
unset($item); unset($item);
......
...@@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Validator; ...@@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Validator;
class SupplierAccountValidator class SupplierAccountValidator
{ {
//保存相关的验证,别问我为什么不用laravel自带的form-request类 //保存相关的验证,别问我为什么不用laravel自带的form-request类
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($request) public function checkSave($request)
{ {
//整理下请求数据 //整理下请求数据
...@@ -33,15 +32,16 @@ class SupplierAccountValidator ...@@ -33,15 +32,16 @@ class SupplierAccountValidator
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
$model = new SupplierAccountModel();
if (empty($account['id'])) { if (empty($account['id'])) {
$supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
$yunxinChannelUid = $supplierModel->where('supplier_code', $yunxinChannelUid = $supplierModel->where(
$account['supplier_code'])->value('yunxin_channel_uid'); 'supplier_code',
$account['supplier_code']
)->value('yunxin_channel_uid');
if (empty($yunxinChannelUid)) { if (empty($yunxinChannelUid)) {
//return '该供应商没有绑定SKU采购,请完善相关信息'; //return '该供应商没有绑定SKU采购,请完善相关信息';
} }
$model = new SupplierAccountModel();
$supplierCount = $model->where('supplier_code', $account['supplier_code']) $supplierCount = $model->where('supplier_code', $account['supplier_code'])
->count(); ->count();
if ($supplierCount > 0) { if ($supplierCount > 0) {
...@@ -52,6 +52,13 @@ class SupplierAccountValidator ...@@ -52,6 +52,13 @@ class SupplierAccountValidator
if ($mobileCount > 0) { if ($mobileCount > 0) {
return '该手机号已经被注册'; return '该手机号已经被注册';
} }
} else {
$supplierCount = $model->where('id', '!=', $account['id'])
->where('supplier_code', $account['supplier_code'])
->count();
if ($supplierCount > 0) {
return '该供应商已经存在账号';
}
} }
return true; return true;
......
...@@ -101,6 +101,13 @@ class SupplierValidator ...@@ -101,6 +101,13 @@ class SupplierValidator
return null; return null;
} }
if (empty($supplierId)) {
$count = SupplierChannelModel::where('supplier_name', $validateData['supplier_name'])->count();
if ($count) {
return "该供应商名称已经存在,请核验后再提交";
}
}
$rules = [ $rules = [
'supplier_type' => 'required', 'supplier_type' => 'required',
'supplier_name' => 'required', 'supplier_name' => 'required',
......
...@@ -13,16 +13,18 @@ ...@@ -13,16 +13,18 @@
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\NationModel;
use App\Http\Services\CrmService; use App\Http\Services\CrmService;
use App\Http\Services\SkuService; use App\Http\Services\SkuService;
use App\Http\Services\DataService; use App\Http\Services\DataService;
use App\Model\AttachmentAuditModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use App\Model\SupplierContractModel; use App\Model\SupplierContractModel;
use App\Http\Services\CompanyService; use App\Http\Services\CompanyService;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Model\SupplierAttachmentsModel;
use App\Http\Services\DepartmentService; use App\Http\Services\DepartmentService;
use App\Http\Services\SupplierAccountService; use App\Http\Services\SupplierAccountService;
use App\Model\SupplierAttachmentsModel;
Route::group(['middleware' => ['web', 'menu']], function () { Route::group(['middleware' => ['web', 'menu']], function () {
Route::get('/', 'WebController@Entrance'); Route::get('/', 'WebController@Entrance');
...@@ -72,8 +74,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () { ...@@ -72,8 +74,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/supplier_contract/{key}', 'SupplierContractApiController@Entrance'); Route::match(['get', 'post'], '/api/supplier_contract/{key}', 'SupplierContractApiController@Entrance');
Route::match(['get', 'post'], '/api/attachment_audit/{key}', 'AttachmentAuditApiController@Entrance'); Route::match(['get', 'post'], '/api/attachment_audit/{key}', 'AttachmentAuditApiController@Entrance');
//单独的统计接口 //单独的统计接口
Route::match(['get', 'post'], '/statisticsSkuNumber', function () { Route::match(['get', 'post'], '/statisticsSkuNumber', function () {});
});
}); });
//提供给其它系统使用的接口,不需要验证那种 //提供给其它系统使用的接口,不需要验证那种
...@@ -95,9 +96,9 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -95,9 +96,9 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
// DataService::initSupplierNationId(); SupplierChannelModel::where('supplier_id', '18715')->delete();
// DataService::initSupplierReceiptNationId(); // DataService::initSupplierReceiptNationId();
SupplierAttachmentsModel::where('type_name','芯链合作协议')->update([ // SupplierAccountService::initYunxinAccountName();
'type_name'=>'采购合作框架协议' // DataService::syncSupplierToErp();
]); // DataService::repaireSkuUploadRuler();
}); });
...@@ -14,7 +14,7 @@ class ManualPutawaySkuLog extends Model ...@@ -14,7 +14,7 @@ class ManualPutawaySkuLog extends Model
public $timestamps = false; public $timestamps = false;
public static function addManualPutawaySkuLog($skuId, $supplierCode = '') public static function addManualPutawaySkuLog($skuId, $supplierCode = '',$isNew = 0)
{ {
if (empty($supplierCode)) { if (empty($supplierCode)) {
...@@ -25,7 +25,7 @@ class ManualPutawaySkuLog extends Model ...@@ -25,7 +25,7 @@ class ManualPutawaySkuLog extends Model
$manualPutawaySkuLog = self::where('sku_id', $skuId)->first(); $manualPutawaySkuLog = self::where('sku_id', $skuId)->first();
if ($manualPutawaySkuLog) { if ($manualPutawaySkuLog) {
self::where('sku_id', $skuId)->update([ self::where('sku_id', $skuId)->update([
'is_new' => 1, 'is_new' => $isNew,
'update_time' => time(), 'update_time' => time(),
]); ]);
return; return;
...@@ -34,7 +34,7 @@ class ManualPutawaySkuLog extends Model ...@@ -34,7 +34,7 @@ class ManualPutawaySkuLog extends Model
'sku_id' => $skuId, 'sku_id' => $skuId,
'supplier_code' => $supplierCode, 'supplier_code' => $supplierCode,
'create_time' => time(), 'create_time' => time(),
'is_new' => 1, 'is_new' => $isNew,
]); ]);
} }
} }
...@@ -39,7 +39,7 @@ class SupplierChannelModel extends Model ...@@ -39,7 +39,7 @@ class SupplierChannelModel extends Model
const SUPPLIER_GROUP_MIX = 7; //混合分销商 const SUPPLIER_GROUP_MIX = 7; //混合分销商
//合作类型 //合作类型
const SUPPLIER_STOCKUP_TYPE = 5; //芯链商家 const SUPPLIER_STOCKUP_TYPE_XINLIAN = 5; //芯链商家
//供应商地区 //供应商地区
const REGION_CN = 2; //国内 const REGION_CN = 2; //国内
......
...@@ -206,7 +206,7 @@ return [ ...@@ -206,7 +206,7 @@ return [
'方案商' => '方案商', '方案商' => '方案商',
'原厂' => '原厂', '原厂' => '原厂',
'分销平台' => '分销平台', '分销平台' => '分销平台',
'代工厂' => '代工厂', '工厂渠道' => '工厂渠道',
], ],
'NeedCheckCompanyRegion' => [2, 4], 'NeedCheckCompanyRegion' => [2, 4],
......
...@@ -23,7 +23,7 @@ return [ ...@@ -23,7 +23,7 @@ return [
7 => '混合分销商', 7 => '混合分销商',
5 => '分销平台', 5 => '分销平台',
3 => '方案商', 3 => '方案商',
6 => '代工厂', 6 => '工厂渠道',
0 => '其它', 0 => '其它',
], ],
//供应商编码规则映射表,用于根据供应商类型生成编码 //供应商编码规则映射表,用于根据供应商类型生成编码
......
...@@ -15,6 +15,7 @@ return [ ...@@ -15,6 +15,7 @@ return [
'AddSupplierAttachment', 'AddSupplierAttachment',
'UpdateSupplierAttachment', 'UpdateSupplierAttachment',
'BatchUpdateSkuStatus', 'BatchUpdateSkuStatus',
'GetAuditFlow'
]//不用验证权限的方法 ]//不用验证权限的方法
], ],
]; ];
...@@ -46,5 +46,6 @@ return [ ...@@ -46,5 +46,6 @@ return [
'SkipSendEmail' => env('skip_send_email'), 'SkipSendEmail' => env('skip_send_email'),
'CubeUrl' => env('CUBE_URL'), 'CubeUrl' => env('CUBE_URL'),
'FootstoneCurlUrl' => 'http://footstone.liexindev.net/open/curl?url=', 'FootstoneCurlUrl' => 'http://footstone.liexindev.net/open/curl?url=',
'GoodsServerUrl' => 'http://192.168.1.237:60014' 'GoodsServerUrl' => 'http://192.168.1.237:60014',
'AuditCenterUrl' => 'http://audit_center.liexindev.net',
]; ];
# 供应商审核对接审核中心说明
## 概述
参考付款审核系统的对接方式,将供应商审核流程对接到审核中心,实现统一的审核管理。
## 修改的文件
### 1. resources/views/script/SupplierListScript.blade.php
在供应商列表页面添加审核流程时间线展示功能:
#### 功能说明:
- 当供应商状态为"审核中"时,鼠标悬停在状态字段上会显示审核流程时间线
- 时间线横向展示,包含每个审核节点的详细信息
- 使用 layui 的 tips 组件实现浮窗效果
#### 主要修改:
- 修改状态字段的 `templet` 函数,为审核中状态添加 `audit-status-hover` class
-`done` 回调中调用 `bindAuditStatusHover()` 绑定悬停事件
- 新增 `bindAuditStatusHover()` 函数处理鼠标悬停事件
- 新增 `showAuditFlowTips()` 函数显示审核流程浮窗
- 新增 `buildAuditTimeline()` 函数构建横向时间线 HTML
#### 时间线展示内容:
- 审核节点序号(圆形图标)
- 审核状态(通过/拒绝/待审核)
- 审核人
- 审核结果
- 审核时间
- 附加说明(如有)
### 2. app/Http/Services/SupplierAuditService.php
主要修改内容:
#### 新增方法:
- `auditByAuditCenter($billId, $approvalStatus, $remark)` - 通过审核中心审核
- `handleAuditResult($supplierId, $billInfo, $approvalStatus)` - 处理审核结果
- `auditPass($supplierId)` - 审核通过处理
- `auditNotPass($supplierId, $rejectReason)` - 审核不通过处理
- `addApprove($supplierId, $triggerReason)` - 添加审批到审核中心
#### 修改方法:
- `auditSupplier($supplierId, $status, $rejectReason)` - 主审核方法
- 先检查是否有审核中心单据
- 如果有,走审核中心流程
- 如果没有,走旧流程(兼容)
### 3. app/Http/Controllers/Api/SupplierApiController.php
已存在 `GetAuditFlow()` 接口,用于获取供应商的审核流程信息:
- 接口路径:`/api/supplier/GetAuditFlow`
- 参数:`supplier_id`
- 返回:审核单据详细信息,包括节点列表、当前节点、审核状态等
### 4. app/Http/Services/SupplierService.php
修改了两个方法:
#### `saveSupplier()` 方法:
- 在新增供应商并直接申请审核时(`$isDirectApply = true`
- 保存供应商后立即调用 `SupplierAuditService::addApprove()` 创建审核中心单据
- 使用 try-catch 包裹,失败不影响主流程
#### `batchApplyInReviewSupplier()` 方法:
- 在更新供应商状态为审核中后
- 调用 `SupplierAuditService::addApprove()` 创建审核中心单据
- 使用 try-catch 包裹,失败不影响主流程
## 核心流程
### 申请审核流程
#### 场景1:新增供应商并直接申请审核
```
1. 用户新增供应商,勾选"直接申请审核"
2. SupplierService::saveSupplier()
- 保存供应商信息
- 设置状态为 STATUS_IN_REVIEW
- 调用 SupplierAuditService::addApprove()
3. SupplierAuditService::addApprove()
- 检查是否已有审核单据
- 获取审核流配置
- 调用 AuditCenterService::addAudit() 创建审核单据
4. 审核单据创建成功,等待审核
```
#### 场景2:已有供应商申请审核
```
1. 用户点击"申请审核"
2. SupplierService::batchApplyInReviewSupplier()
- 更新供应商状态为 STATUS_IN_REVIEW
- 调用 SupplierAuditService::addApprove()
3. SupplierAuditService::addApprove()
- 检查是否已有审核单据
- 获取审核流配置
- 调用 AuditCenterService::addAudit() 创建审核单据
4. 审核单据创建成功,等待审核
```
### 审核流程
```
1. 审核人在审核中心点击审核
2. SupplierApiController::AuditSupplier()
- 接收审核参数(supplier_id, status, reject_reason)
3. SupplierAuditService::auditSupplier()
- 检查是否有审核中心单据
- 如果有:调用 auditByAuditCenter()
- 如果没有:调用 auditSupplierOld()(兼容旧流程)
4. auditByAuditCenter()
- 调用 AuditCenterService::audit() 提交审核
- 调用 handleAuditResult() 处理审核结果
5. handleAuditResult()
- 如果审核通过且流程完成:调用 auditPass()
- 如果审核拒绝:调用 auditNotPass()
6. auditPass() / auditNotPass()
- 更新供应商状态
- 创建芯链账号(通过时)
- 同步到金蝶和一体化(通过时)
- 记录操作日志
```
## 审核状态映射
### 供应商状态
- `STATUS_PENDING = 0` - 待提审
- `STATUS_IN_REVIEW = 1` - 审核中
- `STATUS_PASSED = 2` - 已通过
- `STATUS_REJECT = 3` - 未通过
### 审核中心状态
- `APPROVAL_STATUS_WAIT = 0` - 待审核
- `APPROVAL_STATUS_ING = 1` - 审核中
- `APPROVAL_STATUS_FINISH = 2` - 审核完成
- `APPROVAL_STATUS_REFUSE = -1` - 审核拒绝
- `APPROVAL_STATUS_CANCEL = -2` - 审核撤销
### 审核操作状态
- `1` - 通过
- `2` - 拒绝
## 关键配置
### 审核类型
```php
AuditCenterService::TYPE_SUPPLIER_AUDIT = 'supplier_audit';
```
### 系统ID
```php
AuditCenterService::SYSTEM_ID = 1;
```
## 兼容性说明
1. **向后兼容**:保留了旧的审核流程 `auditSupplierOld()`,如果没有审核中心单据,会自动使用旧流程
2. **异常处理**:审核中心调用失败不会影响主流程,会记录日志
3. **数据迁移**:现有的供应商审核数据不受影响,新的审核会自动使用审核中心
## 测试要点
1. **新增供应商并直接申请审核**
- 新增供应商时勾选"直接申请审核" → 检查供应商状态是否为审核中
- 检查审核中心是否创建了审核单据
2. **已有供应商申请审核**
- 创建供应商(不勾选直接申请) → 点击申请审核 → 检查审核中心是否有单据
3. **修改供应商后申请审核**
- 修改已通过的供应商信息 → 申请审核 → 检查是否触发审核流程
- 注意:部分字段修改不需要审核(由 `checkNeedAudit()` 判断)
4. **审核通过流程**
- 审核通过 → 检查供应商状态是否为已通过
- 检查是否创建了芯链账号
- 检查是否同步到金蝶和一体化
3. **审核拒绝流程**
- 审核拒绝 → 检查供应商状态是否为未通过
- 检查拒绝原因是否正确记录
4. **兼容性测试**
- 旧数据审核 → 应该走旧流程
- 新数据审核 → 应该走审核中心流程
## 注意事项
1. 审核中心需要配置好供应商审核流程(flow)
2. 审核节点需要配置审核人员
3. 确保 `config/website.php` 中配置了正确的审核中心地址
4. 审核中心服务需要正常运行
## 参考文件
- `app/Http/Services/Api/Audit/AuditPaymentService.php` - 付款审核对接示例
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
return `<span style="color: red">审核不通过</span>`; return `<span style="color: red">审核不通过</span>`;
} }
}}, }},
{field: 'audit_name', title: '当前审核人', align: 'center', width: 120},
{field: 'purchase_user_name', title: '采购员', align: 'center', width: 100}, {field: 'purchase_user_name', title: '采购员', align: 'center', width: 100},
{field: 'supplier_code', title: '供应商编码', align: 'center', width: 120}, {field: 'supplier_code', title: '供应商编码', align: 'center', width: 120},
{field: 'supplier_name', title: '供应商名称', align: 'center', width: 200}, {field: 'supplier_name', title: '供应商名称', align: 'center', width: 200},
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
{field: 'id', title: 'ID', align: 'center', width: 80}, {field: 'id', title: 'ID', align: 'center', width: 80},
{field: 'contacts_name', title: '联系人', align: 'center', width: 120}, {field: 'contacts_name', title: '联系人', align: 'center', width: 120},
{field: 'email', title: '邮箱', align: 'center', width: 170}, {field: 'email', title: '邮箱', align: 'center', width: 170},
{field: 'account_name', title: '账号', align: 'center', width: 170},
{ {
field: 'mobile', title: '号', align: 'center', width: 170, field: 'mobile', title: '手机号', align: 'center', width: 170,
templet: function (data) { templet: function (data) {
let text = canViewAccountInfo ? '查看' : ''; let text = canViewAccountInfo ? '查看' : '';
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">' + text + '</span>'; return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">' + text + '</span>';
......
...@@ -140,6 +140,30 @@ ...@@ -140,6 +140,30 @@
} }
}, },
{field: 'group_code', title: '集团编码', align: 'center', width: 90}, {field: 'group_code', title: '集团编码', align: 'center', width: 90},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
let statusHtml = '';
let color = '';
let title = '';
switch (data.status) {
case 3:
color = 'red';
title = data.reject_reason;
break;
case -3:
color = 'red';
title = data.block_reason;
break;
case -2:
color = 'red';
title = data.disable_reason;
break;
}
statusHtml = '<span class="audit-status-hover" data-supplier-id="' + data.supplier_id + '" style="cursor: pointer; color: ' + color + ';" title="' + title + '">' + data.status_name + '</span>';
return statusHtml;
}
},
{ {
field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) { field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) {
if (data.status === -3) { if (data.status === -3) {
...@@ -233,21 +257,7 @@ ...@@ -233,21 +257,7 @@
return '<span style="color: ' + color + ';" title="' + data.disable_reason + '">' + data.is_entity_name + '</span>'; return '<span style="color: ' + color + ';" title="' + data.disable_reason + '">' + data.is_entity_name + '</span>';
} }
}, },
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
switch (data.status) {
case 3:
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
case -3:
return "<span style='color: red' title='" + data.block_reason + "'>" + data.status_name + "</span>"
case -2:
return "<span style='color: red' title='" + data.disable_reason + "'>" + data.status_name + "</span>"
default:
return data.status_name;
}
}
},
{field: 'last_update_name', title: '最新修改人', align: 'center', width: 110}, {field: 'last_update_name', title: '最新修改人', align: 'center', width: 110},
{field: 'sign_com_name', title: '签约公司', align: 'center', width: 150}, {field: 'sign_com_name', title: '签约公司', align: 'center', width: 150},
{ {
...@@ -325,6 +335,9 @@ ...@@ -325,6 +335,9 @@
} }
}); });
// 绑定审核状态悬停事件
bindAuditStatusHover();
} }
}); });
...@@ -894,5 +907,122 @@ ...@@ -894,5 +907,122 @@
$('.main_filter').attr('class', 'main_filter'); $('.main_filter').attr('class', 'main_filter');
} }
// 绑定审核状态悬停事件
function bindAuditStatusHover() {
let auditFlowCache = {}; // 缓存审核流程数据
$('.audit-status-hover').hover(
function() {
let $this = $(this);
let supplierId = $this.data('supplier-id');
// 如果已经有缓存,直接显示
if (auditFlowCache[supplierId]) {
showAuditFlowTips($this, auditFlowCache[supplierId]);
return;
}
// 请求审核流程数据
$.ajax({
url: '/api/supplier/GetAuditFlow',
type: 'get',
data: {supplier_id: supplierId},
dataType: 'json',
success: function(res) {
if (res.err_code === 0 && res.data) {
auditFlowCache[supplierId] = res.data;
showAuditFlowTips($this, res.data);
}
}
});
},
function() {
// 鼠标移出时关闭tips
layer.closeAll('tips');
}
);
}
// 显示审核流程时间线
function showAuditFlowTips($element, auditData) {
let timelineHtml = buildAuditTimeline(auditData);
layer.tips(timelineHtml, $element, {
tips: [3, '#009688'],
time: 0,
area: ['auto', 'auto'],
maxWidth: 550
});
}
// 构建审核时间线HTML - 横向展示
function buildAuditTimeline(auditData) {
let nodeList = auditData.node_list || [];
let currentNodeId = auditData.current_node;
let approvalStatus = auditData.approval_status;
let html = '<div style="padding: 20px; background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); min-width: 500px;">';
html += '<div style="display: flex; justify-content: space-between; align-items: flex-start;">';
nodeList.forEach(function(node, index) {
let isPassed = node.approval_status == 1;
let isRejected = node.approval_status == 2;
let isWaiting = node.approval_status == 0;
// 确定图标和颜色
let iconNumber = index + 1;
let iconBgColor = '';
let iconTextColor = '#fff';
let nodeTitle = '';
if (isPassed) {
iconBgColor = '#5FB878';
nodeTitle = '审核通过';
} else if (isRejected) {
iconBgColor = '#FF5722';
nodeTitle = '审核拒绝';
} else if (isWaiting) {
iconBgColor = '#D2D2D2';
nodeTitle = '待审核';
}
// 每个节点
html += '<div style="flex: 1; text-align: center; position: relative;">';
// 圆形图标
html += '<div style="width: 40px; height: 40px; border-radius: 50%; background: ' + iconBgColor + '; color: ' + iconTextColor + '; line-height: 40px; font-size: 18px; font-weight: bold; margin: 0 auto 10px;">';
html += iconNumber;
html += '</div>';
// 节点标题
html += '<div style="font-weight: bold; margin-bottom: 8px; font-size: 14px; color: #333;">' + nodeTitle + '</div>';
// 节点详情
html += '<div style="color: #666; font-size: 12px; line-height: 1.8; text-align: left; padding: 0 10px;">';
html += '<div>审核人:' + (node.approval_names || '-') + '</div>';
html += '<div>审核结果:' + (node.approval_status_text || '-') + '</div>';
html += '<div>审核时间:' + (node.update_time || '-') + '</div>';
if (node.remark) {
html += '<div>附加说明:' + node.remark + '</div>';
}
html += '</div>';
html += '</div>';
// 连接线(最后一个节点不需要)
if (index < nodeList.length - 1) {
let lineColor = isPassed ? '#5FB878' : '#D2D2D2';
html += '<div style="flex: 0 0 50px; padding-top: 20px;">';
html += '<div style="height: 2px; background: ' + lineColor + ';"></div>';
html += '</div>';
}
});
html += '</div>';
html += '</div>';
return html;
}
</script> </script>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
where: { where: {
supplier_id: getQueryVariable("supplier_id") supplier_id: getQueryVariable("supplier_id")
}, },
size:"sm",
loading: true, loading: true,
first: true,//不显示首页 first: true,//不显示首页
last: false,//不显示尾页 last: false,//不显示尾页
...@@ -61,7 +62,9 @@ ...@@ -61,7 +62,9 @@
}, },
{field: 'supplier_fax', title: '传真', align: 'center', width: 140}, {field: 'supplier_fax', title: '传真', align: 'center', width: 140},
{field: 'channel_name', title: '<span class="require">* </span>采购员', align: 'center', width: 110}, {field: 'channel_name', title: '<span class="require">* </span>采购员', align: 'center', width: 110},
{field: 'channel_user_type_name', title: '<span class="require">* </span>采购员类型', align: 'center', width: 110}, {field: 'working_status', title: '采购员状态', align: 'center', width: 120}, {field: 'channel_user_type_name', title: '<span class="require">* </span>采购员类型', align: 'center', width: 110},
{field: 'working_status', title: '采购员状态', align: 'center', width: 120},
{field: 'update_time', title: '更新时间', align: 'center', width: 150},
]], ]],
id: 'contactList', id: 'contactList',
page: {}, page: {},
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="layui-inline"> <div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('审核uid','审核人',request()->get('audit_uid'),$auditUidList) !!} {!! $statusPresenter->render('audit_name','审核人',request()->get('audit_name'),$auditUidList) !!}
</div> </div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="layui-inline"> <div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('审核uid','审核人',request()->get('audit_uid'),$auditUidList) !!} {!! $statusPresenter->render('audit_name','审核人',request()->get('audit_name'),$auditUidList) !!}
</div> </div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
......
...@@ -140,6 +140,30 @@ ...@@ -140,6 +140,30 @@
} }
}, },
{field: 'group_code', title: '集团编码', align: 'center', width: 90}, {field: 'group_code', title: '集团编码', align: 'center', width: 90},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
let statusHtml = '';
let color = '';
let title = '';
switch (data.status) {
case 3:
color = 'red';
title = data.reject_reason;
break;
case -3:
color = 'red';
title = data.block_reason;
break;
case -2:
color = 'red';
title = data.disable_reason;
break;
}
statusHtml = '<span class="audit-status-hover" data-supplier-id="' + data.supplier_id + '" style="cursor: pointer; color: ' + color + ';" title="' + title + '">' + data.status_name + '</span>';
return statusHtml;
}
},
{ {
field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) { field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) {
if (data.status === -3) { if (data.status === -3) {
...@@ -188,7 +212,7 @@ ...@@ -188,7 +212,7 @@
align: 'center', align: 'center',
width: 120, width: 120,
templet: function (data) { templet: function (data) {
return data.yunxin_account ? '是' : '否'; return data.yunxin_account ? ( data.yunxin_account.a_status == 1?'是':'否') : '否';
} }
}, },
//通过芯链上传合同 //通过芯链上传合同
...@@ -233,21 +257,7 @@ ...@@ -233,21 +257,7 @@
return '<span style="color: ' + color + ';" title="' + data.disable_reason + '">' + data.is_entity_name + '</span>'; return '<span style="color: ' + color + ';" title="' + data.disable_reason + '">' + data.is_entity_name + '</span>';
} }
}, },
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
switch (data.status) {
case 3:
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
case -3:
return "<span style='color: red' title='" + data.block_reason + "'>" + data.status_name + "</span>"
case -2:
return "<span style='color: red' title='" + data.disable_reason + "'>" + data.status_name + "</span>"
default:
return data.status_name;
}
}
},
{field: 'last_update_name', title: '最新修改人', align: 'center', width: 110}, {field: 'last_update_name', title: '最新修改人', align: 'center', width: 110},
{field: 'sign_com_name', title: '签约公司', align: 'center', width: 150}, {field: 'sign_com_name', title: '签约公司', align: 'center', width: 150},
{ {
...@@ -325,6 +335,9 @@ ...@@ -325,6 +335,9 @@
} }
}); });
// 绑定审核状态悬停事件
bindAuditStatusHover();
} }
}); });
...@@ -894,5 +907,122 @@ ...@@ -894,5 +907,122 @@
$('.main_filter').attr('class', 'main_filter'); $('.main_filter').attr('class', 'main_filter');
} }
// 绑定审核状态悬停事件
function bindAuditStatusHover() {
let auditFlowCache = {}; // 缓存审核流程数据
$('.audit-status-hover').hover(
function() {
let $this = $(this);
let supplierId = $this.data('supplier-id');
// 如果已经有缓存,直接显示
if (auditFlowCache[supplierId]) {
showAuditFlowTips($this, auditFlowCache[supplierId]);
return;
}
// 请求审核流程数据
$.ajax({
url: '/api/supplier/GetAuditFlow',
type: 'get',
data: {supplier_id: supplierId},
dataType: 'json',
success: function(res) {
if (res.err_code === 0 && res.data) {
auditFlowCache[supplierId] = res.data;
showAuditFlowTips($this, res.data);
}
}
});
},
function() {
// 鼠标移出时关闭tips
layer.closeAll('tips');
}
);
}
// 显示审核流程时间线
function showAuditFlowTips($element, auditData) {
let timelineHtml = buildAuditTimeline(auditData);
layer.tips(timelineHtml, $element, {
tips: [3, '#009688'],
time: 0,
area: ['auto', 'auto'],
maxWidth: 550
});
}
// 构建审核时间线HTML - 横向展示
function buildAuditTimeline(auditData) {
let nodeList = auditData.node_list || [];
let currentNodeId = auditData.current_node;
let approvalStatus = auditData.approval_status;
let html = '<div style="padding: 20px; background: #fff; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); min-width: 500px;">';
html += '<div style="display: flex; justify-content: space-between; align-items: flex-start;">';
nodeList.forEach(function(node, index) {
let isPassed = node.approval_status == 1;
let isRejected = node.approval_status == 2;
let isWaiting = node.approval_status == 0;
// 确定图标和颜色
let iconNumber = index + 1;
let iconBgColor = '';
let iconTextColor = '#fff';
let nodeTitle = '';
if (isPassed) {
iconBgColor = '#5FB878';
nodeTitle = '审核通过';
} else if (isRejected) {
iconBgColor = '#FF5722';
nodeTitle = '审核拒绝';
} else if (isWaiting) {
iconBgColor = '#D2D2D2';
nodeTitle = '待审核';
}
// 每个节点
html += '<div style="flex: 1; text-align: center; position: relative;">';
// 圆形图标
html += '<div style="width: 40px; height: 40px; border-radius: 50%; background: ' + iconBgColor + '; color: ' + iconTextColor + '; line-height: 40px; font-size: 18px; font-weight: bold; margin: 0 auto 10px;">';
html += iconNumber;
html += '</div>';
// 节点标题
html += '<div style="font-weight: bold; margin-bottom: 8px; font-size: 14px; color: #333;">' + nodeTitle + '</div>';
// 节点详情
html += '<div style="color: #666; font-size: 12px; line-height: 1.8; text-align: left; padding: 0 10px;">';
html += '<div>审核人:' + (node.approval_names || '-') + '</div>';
html += '<div>审核结果:' + (node.approval_status_text || '-') + '</div>';
html += '<div>审核时间:' + (node.update_time || '-') + '</div>';
if (node.remark) {
html += '<div>附加说明:' + node.remark + '</div>';
}
html += '</div>';
html += '</div>';
// 连接线(最后一个节点不需要)
if (index < nodeList.length - 1) {
let lineColor = isPassed ? '#5FB878' : '#D2D2D2';
html += '<div style="flex: 0 0 50px; padding-top: 20px;">';
html += '<div style="height: 2px; background: ' + lineColor + ';"></div>';
html += '</div>';
}
});
html += '</div>';
html += '</div>';
return html;
}
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment