Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
87a3d0f4
authored
Oct 15, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完成部分接入审核中心的工作
parent
f665e1ec
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
726 additions
and
35 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
config/perm.php
docs/SupplierAuditCenter_Integration.md
resources/views/script/SupplierListScript.blade.php
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
87a3d0f4
...
...
@@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Auth;
use
App\Http\Services\CompanyService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\AuditCenterService
;
use
App\Http\Services\SyncSupplierService
;
use
App\Http\Validators\SupplierValidator
;
use
App\Http\Services\StandardBrandService
;
...
...
@@ -839,4 +840,13 @@ class SupplierApiController extends Controller
$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
);
}
}
app/Http/Controllers/SupplierController.php
View file @
87a3d0f4
...
...
@@ -15,6 +15,7 @@ use App\Model\SupplierContactModel;
use
App\Http\Services\RegionService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\DepartmentService
;
use
App\Http\Services\AuditCenterService
;
use
App\Http\Services\SupplierTagService
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Services\SkuUploadLogService
;
...
...
app/Http/Services/SupplierAuditService.php
View file @
87a3d0f4
...
...
@@ -12,14 +12,193 @@ class SupplierAuditService
{
public
function
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
)
{
//先去获取审核流信息
$auditFlowInfo
=
AuditCenterService
::
getAuditFlowInfo
(
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
,
request
()
->
user
->
userId
);
//再去判断当前是否有审核单据
// 获取审核单据信息
$auditBillInfo
=
AuditCenterService
::
getAuditInfoByIdAndType
(
$supplierId
,
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
);
if
(
empty
(
$auditBillInfo
))
{
// 如果没有审核单据,说明是旧流程,继续使用原有逻辑
return
$this
->
auditSupplierOld
(
$supplierId
,
$status
,
$rejectReason
);
}
// 使用审核中心流程
$approvalStatus
=
$status
==
SupplierChannelModel
::
STATUS_PASSED
?
1
:
2
;
$result
=
$this
->
auditByAuditCenter
(
$auditBillInfo
[
'id'
],
$approvalStatus
,
$rejectReason
);
dd
(
$auditFlowInfo
);
return
$result
?
true
:
false
;
}
/**
* 通过审核中心审核
*/
private
function
auditByAuditCenter
(
$billId
,
$approvalStatus
,
$remark
)
{
$billInfo
=
AuditCenterService
::
getAuditInfoByBillId
(
$billId
);
if
(
empty
(
$billInfo
))
{
throw
new
\Exception
(
"单据不存在"
);
}
$approvalUid
=
request
()
->
user
->
userId
;
// 调用审核中心审核接口
if
(
in_array
(
$billInfo
[
'approval_status'
],
[
AuditCenterService
::
APPROVAL_STATUS_WAIT
,
AuditCenterService
::
APPROVAL_STATUS_ING
]))
{
$billInfo
=
AuditCenterService
::
audit
(
$billId
,
$approvalUid
,
$approvalStatus
,
$remark
);
}
// 处理审核结果
$this
->
handleAuditResult
(
$billInfo
[
'source_id'
],
$billInfo
,
$approvalStatus
);
return
true
;
}
/**
* 处理审核结果
*/
private
function
handleAuditResult
(
$supplierId
,
$billInfo
,
$approvalStatus
)
{
// 判断billInfo的状态,如果是完成,则直接完成,如果是拒绝,则走拒绝流程
if
(
$approvalStatus
==
1
)
{
// 通过
if
(
$billInfo
[
'approval_status'
]
==
AuditCenterService
::
APPROVAL_STATUS_FINISH
)
{
$this
->
auditPass
(
$supplierId
);
}
}
else
{
// 拒绝
if
(
$billInfo
[
'approval_status'
]
==
AuditCenterService
::
APPROVAL_STATUS_REFUSE
)
{
$this
->
auditNotPass
(
$supplierId
,
array_get
(
$billInfo
[
'current_node_info'
],
'remark'
,
'审核不通过'
));
}
}
}
/**
* 审核通过处理
*/
private
function
auditPass
(
$supplierId
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
!
$supplier
)
{
return
false
;
}
$status
=
SupplierChannelModel
::
STATUS_PASSED
;
// 更新供应商状态
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'status'
=>
$status
,
'need_review'
=>
0
,
'update_time'
=>
time
(),
]);
// 自动创建芯链账号
SupplierAccountService
::
autoCreateYunxinAccount
(
$supplierId
);
// 添加日志
$logService
=
new
LogService
();
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'审核供应商'
,
'审核通过'
);
// 同步到金蝶
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
// 同步到一体化
if
(
!
checkPerm
(
'IgnoreCompanyCheck'
))
{
$regionType
=
$supplier
[
'region'
]
==
SupplierChannelModel
::
REGION_CN
?
1
:
2
;
if
(
$regionType
==
2
)
{
(
new
SyncSupplierService
())
->
syncSupplierToUnited
(
$supplierId
);
}
else
{
$supplier
[
'tax_number'
]
=
$supplier
[
'supplier_name'
]
?:
$supplier
[
'tax_number'
];
$company
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplier
[
'supplier_name'
],
$supplier
[
'tax_number'
],
$regionType
);
if
(
!
empty
(
$company
))
{
if
(
!
empty
(
$company
[
'tax_number'
]))
{
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'tax_number'
=>
$company
[
'tax_number'
],
]);
}
(
new
SyncSupplierService
())
->
syncSupplierToUnited
(
$supplierId
);
}
}
}
else
{
(
new
SyncSupplierService
())
->
syncSupplierToUnited
(
$supplierId
);
}
if
(
!
empty
(
$supplier
[
'group_code'
]))
{
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
);
}
return
true
;
}
/**
* 审核不通过处理
*/
private
function
auditNotPass
(
$supplierId
,
$rejectReason
)
{
$status
=
SupplierChannelModel
::
STATUS_REJECT
;
// 更新供应商状态
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'status'
=>
$status
,
'reject_reason'
=>
$rejectReason
,
'update_time'
=>
time
(),
]);
// 添加日志
$logService
=
new
LogService
();
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'审核供应商'
,
'审核不通过,原因是 : '
.
$rejectReason
);
return
true
;
}
/**
* 添加审批到审核中心
*/
public
function
addApprove
(
$supplierId
,
$triggerReason
)
{
$supplierInfo
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
!
$supplierInfo
)
{
throw
new
\Exception
(
"供应商不存在"
);
}
$auditInfo
=
AuditCenterService
::
getAuditInfoByIdAndType
(
$supplierId
,
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
);
// 如果存在审核信息,并且状态不是 已完成,已拒绝,已撤销时直接跳过
if
(
!
empty
(
$auditInfo
)
&&
!
in_array
(
$auditInfo
[
'approval_status'
],
[
AuditCenterService
::
APPROVAL_STATUS_REFUSE
,
AuditCenterService
::
APPROVAL_STATUS_CANCEL
,
AuditCenterService
::
APPROVAL_STATUS_FINISH
]))
{
return
$auditInfo
;
}
// 先获取审核流节点数据
$flowInfo
=
AuditCenterService
::
getAuditFlowInfo
(
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
,
request
()
->
user
->
userId
,
null
// 供应商没有公司ID概念,传null
);
// 创建审批单据
$billInfo
=
AuditCenterService
::
addAudit
([
"flow_id"
=>
$flowInfo
[
'flow_info'
][
'id'
],
"source_id"
=>
$supplierId
,
"source_sn"
=>
$supplierInfo
[
'supplier_code'
],
"org_id"
=>
1
,
"trigger_reason"
=>
$triggerReason
,
"current_node"
=>
null
,
"apply_node_ids"
=>
implode
(
","
,
array_column
(
$flowInfo
[
'node_list'
],
'id'
))
],
request
()
->
user
->
userId
,
request
()
->
user
->
userId
);
return
$billInfo
;
}
/**
* 旧的审核流程(兼容)
*/
private
function
auditSupplierOld
(
$supplierId
,
$status
,
$rejectReason
)
{
$model
=
new
SupplierChannelModel
();
...
...
@@ -330,4 +509,18 @@ dd($auditFlowInfo);
return
false
;
}
}
//获取审核流程
public
function
getAuditFlow
(
$supplierId
)
{
$flowInfo
=
AuditCenterService
::
getAuditList
(
AuditCenterService
::
TYPE_SUPPLIER_AUDIT
,
[
'id'
=>
2129
,
'page'
=>
1
,
'limit'
=>
1000
]
);
return
$flowInfo
;
}
}
app/Http/Services/SupplierService.php
View file @
87a3d0f4
...
...
@@ -234,6 +234,20 @@ class SupplierService
//新增的时候也要去添加地址了
$supplierAddressService
=
new
SupplierAddressService
();
$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
{
/**这里的是更新供应商的操作**/
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
...
...
@@ -405,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
)
{
$auditData
[]
=
[
...
...
@@ -415,6 +429,7 @@ class SupplierService
];
$this
->
batchApplyInReviewSupplier
(
$auditData
);
}
return
$supplierId
;
}
...
...
@@ -777,6 +792,16 @@ class SupplierService
if
(
!
$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
;
}
...
...
config/perm.php
View file @
87a3d0f4
...
...
@@ -15,6 +15,7 @@ return [
'AddSupplierAttachment'
,
'UpdateSupplierAttachment'
,
'BatchUpdateSkuStatus'
,
'GetAuditFlow'
]
//不用验证权限的方法
],
];
docs/SupplierAuditCenter_Integration.md
0 → 100644
View file @
87a3d0f4
# 供应商审核对接审核中心说明
## 概述
参考付款审核系统的对接方式,将供应商审核流程对接到审核中心,实现统一的审核管理。
## 修改的文件
### 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`
- 付款审核对接示例
resources/views/script/SupplierListScript.blade.php
View file @
87a3d0f4
...
...
@@ -140,6 +140,30 @@
}
},
{
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
)
{
if
(
data
.
status
===
-
3
)
{
...
...
@@ -233,21 +257,7 @@
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
:
'sign_com_name'
,
title
:
'签约公司'
,
align
:
'center'
,
width
:
150
},
{
...
...
@@ -325,6 +335,9 @@
}
});
// 绑定审核状态悬停事件
bindAuditStatusHover
();
}
});
...
...
@@ -894,5 +907,122 @@
$
(
'.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 = '
#
5
FB878
';
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>
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
View file @
87a3d0f4
...
...
@@ -140,6 +140,30 @@
}
},
{
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
)
{
if
(
data
.
status
===
-
3
)
{
...
...
@@ -188,7 +212,7 @@
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
data
.
yunxin_account
?
'是'
:
'否'
;
return
data
.
yunxin_account
?
(
data
.
yunxin_account
.
a_status
==
1
?
'是'
:
'否'
)
:
'否'
;
}
},
//通过芯链上传合同
...
...
@@ -233,21 +257,7 @@
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
:
'sign_com_name'
,
title
:
'签约公司'
,
align
:
'center'
,
width
:
150
},
{
...
...
@@ -325,6 +335,9 @@
}
});
// 绑定审核状态悬停事件
bindAuditStatusHover
();
}
});
...
...
@@ -894,5 +907,122 @@
$
(
'.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 = '
#
5
FB878
';
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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment