工种信息

This commit is contained in:
todaywindy 2025-08-01 09:59:17 +08:00
parent 171b266e40
commit f8d544d12f
2 changed files with 12 additions and 4 deletions

View File

@ -85,10 +85,11 @@ class Worker extends Backend
$this->request->filter(['strip_tags', 'trim']);
$items = $this->items;
$filtered = array_filter($items, function ($item) {
return $item['pid'] == 0;
return $item['level'] == 2;
});
$pid_map = array_column($filtered, null, 'id');
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
@ -135,7 +136,8 @@ class Worker extends Backend
$worker_ids = [];
foreach ($list->items() as $item){
$dt = $item->toArray();
$tel = $dt['tel'];
preg_match_all('/\d+/', $dt['tel'], $matches);;
$tel = $matches[0][0] ?? '';
if (preg_match('/^\d{7,}$/', $tel)) {
$dt['tel'] = mb_substr($tel, 0, 3, 'UTF-8') . '****' . mb_substr($tel, -4, null, 'UTF-8');
} else {
@ -145,8 +147,9 @@ class Worker extends Backend
$data[] = $dt;
$worker_ids [] = $item['id'];
}
$worker_item = WorkerItem::whereIn('worker_id',$worker_ids)->where('item_path_id',1)
$worker_item = WorkerItem::whereIn('worker_id',$worker_ids)->where('item_path_id',2)
->field('worker_id,item_id')->select();
$worker_item_map = [];
// dd($worker_item);
foreach ($worker_item as $item){
@ -157,7 +160,7 @@ class Worker extends Backend
if (key_exists($datum['id'],$worker_item_map)){
foreach ($worker_item_map[$datum['id']] as $item){
if ($pid_map[$item] ?? false){
$datum ['worker_item'][] = trim($pid_map[$item]['title']);
$datum ['worker_item'][] = str_replace(" ",'',$pid_map[$item]['title']);
}
}
}else{

View File

@ -59,7 +59,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree','cascader'],
},
{
field: 'worker_item',
width:500,
title: '工种',
operate: false,
table: table,
class: 'autocontent',
formatter: Table.api.formatter.content
},
//{field: 'area_id', title: __('Area_id')},
//{field: 'lng', title: __('Lng'), operate:'BETWEEN'},