Commit 1724f4fb by 杨树贤

批量修改采购员的审核跳过问题

parent 060e9c63
...@@ -440,7 +440,6 @@ class SupplierApiController extends Controller ...@@ -440,7 +440,6 @@ class SupplierApiController extends Controller
$this->response(-1, '该采购员已经离职,请选择其他人员'); $this->response(-1, '该采购员已经离职,请选择其他人员');
} }
$supplierIds = explode(',', $supplierIds); $supplierIds = explode(',', $supplierIds);
$model = new SupplierChannelModel();
foreach ($supplierIds as $supplierId) { foreach ($supplierIds as $supplierId) {
$service = new SupplierService(); $service = new SupplierService();
$result = $service->allocateChannelUser($supplierId, $channelUid); $result = $service->allocateChannelUser($supplierId, $channelUid);
......
...@@ -426,7 +426,7 @@ class SupplierService ...@@ -426,7 +426,7 @@ class SupplierService
} }
//分配采购员 //分配采购员
public function allocateChannelUser($supplierId, $channelUid, $logFlag = true) public function allocateChannelUser($supplierId, $channelUid, $needLog = true)
{ {
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first(); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first();
if (empty($supplier)) { if (empty($supplier)) {
...@@ -438,9 +438,8 @@ class SupplierService ...@@ -438,9 +438,8 @@ class SupplierService
if (in_array($channelUid, $preChannelUid)) { if (in_array($channelUid, $preChannelUid)) {
return true; return true;
} }
$result = DB::connection('web')->transaction(function () use ($supplierId, $channelUid, $logFlag) { $result = DB::connection('web')->transaction(function () use ($supplierId, $channelUid, $needLog) {
$model = new SupplierChannelModel(); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first();
$supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : []; $supplier = $supplier ? $supplier->toArray() : [];
$preChannelUid = $supplier['channel_uid']; $preChannelUid = $supplier['channel_uid'];
$preChannelUid = explode(',', $preChannelUid); $preChannelUid = explode(',', $preChannelUid);
...@@ -448,17 +447,23 @@ class SupplierService ...@@ -448,17 +447,23 @@ class SupplierService
$preChannelUid = array_unique($preChannelUid); $preChannelUid = array_unique($preChannelUid);
$preChannelUid = implode(',', $preChannelUid); $preChannelUid = implode(',', $preChannelUid);
$preChannelUid = trim($preChannelUid, ','); $preChannelUid = trim($preChannelUid, ',');
if ($logFlag) { if ($needLog) {
$result = $model->where('supplier_id', $supplierId)->update([ $data = [
'update_time' => time(), 'update_time' => time(),
'channel_uid' => $preChannelUid, 'channel_uid' => $preChannelUid,
]); ];
//还要判断是否要进入审核状态,如果有忽略分配采购员进入审核的权限,那么就不用进入待审核状态
if (!checkPerm('IgnoreAllocateChannelUserAudit')) {
$data['status'] = SupplierChannelModel::STATUS_IN_REVIEW;
}
$result = SupplierChannelModel::where('supplier_id', $supplierId)->update($data);
} else { } else {
$result = $model->where('supplier_id', $supplierId)->update([ $result = SupplierChannelModel::where('supplier_id', $supplierId)->update([
'channel_uid' => $preChannelUid, 'channel_uid' => $preChannelUid,
]); ]);
} }
$contactResult = false; $contactResult = false;
if ($result) { if ($result) {
$contactModel = new SupplierContactModel(); $contactModel = new SupplierContactModel();
...@@ -470,7 +475,7 @@ class SupplierService ...@@ -470,7 +475,7 @@ class SupplierService
]; ];
$contactResult = $contactModel->insert($contact); $contactResult = $contactModel->insert($contact);
} }
if ($contactResult && $logFlag) { if ($contactResult && $needLog) {
//判断是否是非正式(is_type=1)供应商,如果是,自动转正,并且修改为待审核状态 //判断是否是非正式(is_type=1)供应商,如果是,自动转正,并且修改为待审核状态
$this->autoChangeIsType($supplier); $this->autoChangeIsType($supplier);
//记录日志 //记录日志
......
...@@ -148,15 +148,16 @@ ...@@ -148,15 +148,16 @@
}, },
{ {
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) { field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status === 3) { switch (data.status) {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
} else if (data.status === -3) {
return "<span style='color: red' title='" + data.block_reason + "'>" + data.status_name + "</span>"
} else {
return data.status_name;
}
switch (data.status){
case 3: 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;
} }
} }
}, },
......
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