工种信息

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

View File

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