[ 'title' => '用户', 'table' => 'user', 'field' => 'name', 'url' => 'user/user/dialog', ], 'role' => [ 'title' => '角色', 'table' => 'role', 'field' => 'name', 'url' => 'user/role/dialog', ], 'department' => [ 'title' => '部门', 'table' => 'department', 'field' => 'name', 'url' => 'user/department/dialog', ], 'supplier' => [ 'title' => '供应商', 'table' => 'supplier', 'join' => 'user', 'field' => 'user.name', 'url' => 'supplier/supplier/dialog', ], 'customer' => [ 'title' => '客户', 'table' => 'customer', 'join' => 'user', 'field' => 'user.name', 'url' => 'customer/customer/dialog', ], 'customer_contact' => [ 'title' => '客户联系人', 'table' => 'customer_contact', 'join' => 'user', 'field' => 'user.name', 'url' => 'customer/contact/dialog', ], 'supplier_product' => [ 'title' => '商品', 'table' => 'product', 'field' => 'name', 'url' => 'supplier/product/dialog', ], 'product' => [ 'title' => '产品', 'table' => 'product', 'field' => 'name', 'url' => 'product/product/dialog', ], 'promotion' => [ 'title' => '促销', 'table' => 'promotion', 'field' => 'id', 'url' => 'promotion/promotion/dialog', ], 'region' => [ 'title' => '销售组', 'table' => 'customer_region', 'field' => 'name', 'url' => 'customer/region/dialog', ], 'hr' => [ 'title' => '人事档案', 'table' => 'hr', 'field' => 'name', 'url' => 'hr/hr/dialog', ], 'logistics' => [ 'title' => '物流', 'table' => 'logistics', 'field' => 'name', 'url' => 'order/logistics/dialog', ], ]; public static function text($item, $value) { $dialog = self::$items[$item]; $rows = ''; if ($value) { $ids = explode(',', $value); $table = $dialog['table']; $join = $dialog['join']; if ($join) { $rows = DB::table($table) ->LeftJoin('user', 'user.id', '=', $table.'.user_id') ->whereIn($table.'.id', $ids) ->pluck($dialog['field'])->implode(','); } else { $rows = DB::table($table) ->whereIn('id', $ids) ->pluck($dialog['field'])->implode(','); } } return $rows; } public static function show($key, $data, $multi = 0, $readonly = 0) { $id = $key.'_id'; $name = $key.'_name'; if ($readonly == 0) { $html[] = '