Commit 127ef737 by 杨树贤

优化采购员离职显示

parent a6c0d55c
......@@ -211,6 +211,8 @@ class SupplierApiController extends Controller
$list = $query->paginate($limit)->toArray();
$transformer = new SupplierTransformer();
$list['data'] = $transformer->transformList($list['data']);
//这里还要单独去处理采购员是否离职的显示,考虑到性能,所以再单独搞个方法出来了
$list['data'] = $transformer->transformResignChannelUser($list['data']);
$this->response(0, 'ok', $list['data'], $list['total']);
}
......
......@@ -72,6 +72,36 @@ class SupplierTransformer
return $list;
}
//这个是用来区分采购员里面哪些是离职的,那些是不离职的,显示在前端
public function transformResignChannelUser($suppliers)
{
foreach ($suppliers as &$supplier) {
$onJobChannelUsers = (new IntracodeModel())->getSampleEncode();
$onJobUserNameList = array_values($onJobChannelUsers);
$channelUserNameList = !empty($supplier['channel_username']) ? explode(',',
$supplier['channel_username']) : [];
if (empty($channelUserNameList)) {
continue;
}
$resignChannelUserNameList = $onJobChannelUserNameList = [];
//然后判断哪些是离职,哪些是在职的
foreach ($channelUserNameList as $username) {
// dump($username, $onJobUserNameList);
if (!in_array($username, $onJobUserNameList)) {
$resignChannelUserNameList[] = $username;
} else {
$onJobChannelUserNameList[] = $username;
}
}
$supplier['resign_channel_username'] = $resignChannelUserNameList ? implode(',',
$resignChannelUserNameList) : '';
$supplier['on_job_channel_username'] = $onJobChannelUserNameList ? implode(',',
$onJobChannelUserNameList) : '';
}
unset($supplier);
return $suppliers;
}
public function checkHasQualityAssuranceAgreement($attachment)
{
if (!$attachment) {
......
......@@ -63,4 +63,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::match(['get', 'post'], '/test', function () {
// (new \App\Http\Services\DataService())->initSystemTag();
\App\Model\SupplierChannelModel::where('supplier_id', 6148)->update([
'status' => 2
]);
});
......@@ -33,7 +33,7 @@ class IntracodeModel extends Model
}
}
$redis->set('EncodedList_supplier_' . $includeResigned, json_encode($codeList));
$redis->expire('EncodedList_supplier_' . $includeResigned, 1);//缓存1s
$redis->expire('EncodedList_supplier_' . $includeResigned, 60);//缓存1分钟
}
}
return $codeList;
......@@ -56,7 +56,7 @@ class IntracodeModel extends Model
}
}
$redis->set('EncodedList_all_supplier', json_encode($codeList));
$redis->expire('EncodedList_all_supplier', 60);//缓存10分钟
$redis->expire('EncodedList_all_supplier', 60);//缓存1分钟
}
}
return $codeList;
......
......@@ -141,7 +141,18 @@
}
}
},
{field: 'channel_username', title: '采购员', align: 'center', width: 130},
{
field: 'channel_username', title: '采购员', align: 'center', width: 130, templet: function (data) {
if(!data.channel_username){
return '';
}
if (data.resign_channel_username) {
return `<span>${data.on_job_channel_username}</span>` + `,<span style="color: #D7D7D7">${data.resign_channel_username}</span>`;
}else{
return `<span>${data.on_job_channel_username}</span>`;
}
}
},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 110},
{field: 'last_update_name', title: '最新修改人', align: 'center', width: 110},
{field: 'yunxin_channel_username', title: 'SKU采购员', align: 'center', width: 110},
......@@ -642,7 +653,8 @@
layer.load(1);
location.reload();
});
});
})
;
//检查是否能够审核,因为审核人只能审自己相关部门人员修改的供应商记录
function checkCanAudit(supplierId) {
......
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