function search_accurate_part($part_num = '') { $results = array(); $app = get_app(); // 指令号前缀转换 if (preg_match("/^([a-zA-Z]{1,2})(.*)\$/", $part_num, $matches)) { if (count($matches) == 3) { $part_num = transform_num_prefix($matches[1], $matches[0]); } } $part = Part::find('first', array('conditions' => array(' num = ? ', $part_num))); // app view fetch if ($part) { $procs = $part->processes; $part_id = $part->id; $results['is_success'] = true; $results['html'] = $app->view->fetch('Processes/list.php', compact('procs', 'part_id')); $results['nodes'] = \Controller\Search::search_accurate_part_get_nodes($part); } echo json_encode($results); }
function quick_list($part_num) { //精确查询 $results = array(); // 指令号前缀转换 if (preg_match("/^([a-zA-Z]{1,2})(.*)\$/", $part_num, $matches)) { if (count($matches) == 3) { $part_num = transform_num_prefix($matches[1], $matches[0]); } } $part = Part::find('first', array('conditions' => array(' num = ? ', $part_num))); if ($part) { $templates = \Controller\Works::quick_list_get_html($part); // results $results['is_success'] = true; $results['nodes'] = \Controller\Works::quick_list_get_nodes($part); $results['html'] = $templates['html']; $results['cur_proc_id'] = $templates['cur_proc_id']; } else { $results['is_success'] = false; } echo json_encode($results); }