程序页面功能添加

This commit is contained in:
sc committed 2026-02-22 23:40:48 +08:00
1 parent 8a9a28d6d5
commit 9dcdecf916
8 files changed
+157 -11

No files matched your search

+95
View File
@@ -39,6 +39,9 @@
*/
int16_t Work_row = -1;
int16_t Work_step_row = -1;
int16_t run_step_row = -1;
int16_t pname_row = -1;
int16_t pname_step_row = -1;
// 绘图回调
static void table_style_cb(lv_event_t *e)
{
@@ -69,6 +72,24 @@ static void table_style_cb(lv_event_t *e)
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
else if ((table == guider_ui.screen_run_step)&&(row == run_step_row)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
else if ((table == guider_ui.screen_pname_row)&&(row == pname_row)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
}
else if ((table == guider_ui.screen_pname_step_row)&&(row == pname_step_row)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
dsc->label_dsc->font = &lv_font_simsun_24;
} ;
}
}
}
@@ -134,6 +155,9 @@ static void table_click_event_cb(lv_event_t *e) {
}
Work_row=-1;
Work_step_row=-1;
run_step_row = -1;
pname_row = -1;
pname_step_row = -1;
//获得来源表
if(table == guider_ui.screen_list_inf)//总览信息/工艺信息
{
@@ -147,6 +171,19 @@ static void table_click_event_cb(lv_event_t *e) {
rt_snprintf(sql, sizeof(sql),"%s' AND Step = '%s'",value_W,lv_table_get_cell_value(guider_ui.screen_w_list, row, 0));
Work_Program_stepINF_ui(sql);
}
else if(table == guider_ui.screen_run_step){//工艺信息
run_step_row = row;// 写入行号
if(value_W[0] == '\0') return;
}
else if(table == guider_ui.screen_pname_row){//工艺程序信息
pname_row = row;// 写入行号
rt_snprintf(value_W, sizeof(value_W),lv_table_get_cell_value(guider_ui.screen_pname_row, row, 0));
UI_pname_step_row(value_W);
}
else if(table == guider_ui.screen_pname_step_row){//工艺程序细节信息
pname_step_row = row;// 写入行号
if(value_W[0] == '\0') return;
}
}
// 初始化样式
@@ -199,11 +236,43 @@ void table_style_init(lv_obj_t *container)
lv_obj_set_style_pad_right(container, 10, LV_PART_ITEMS|LV_STATE_CHECKED);
}
// 页面事件回调函数
static void tabview_event_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *tabview = lv_event_get_target(e);
if (code == LV_EVENT_VALUE_CHANGED) {
// 获取当前选中的 Tab 索引
uint16_t tab_id = lv_tabview_get_tab_act(tabview);
// 根据 tab_id 执行不同操作
switch (tab_id) {
case 0://工单页面
break;
case 1://工艺页面
break;
case 2:
break;
case 3://程序页面
UI_pname_row();
break;
case 4:
break;
}
}
}
void custom_init(lv_ui *ui)
{
lv_obj_clear_flag(lv_tabview_get_content(ui->screen_tabview), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动
lv_obj_clear_flag(lv_tabview_get_content(ui->screen_w_io), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动
lv_obj_add_event_cb(ui->screen_tabview, tabview_event_cb, LV_EVENT_VALUE_CHANGED, NULL);//
lv_obj_set_style_pad_all(ui->screen_tabview_tab_1, 0, LV_PART_MAIN);
lv_obj_set_style_pad_all(ui->screen_tabview_tab_2, 0, LV_PART_MAIN);
lv_obj_set_style_pad_all(ui->screen_tabview_tab_3, 0, LV_PART_MAIN);
@@ -263,6 +332,32 @@ void custom_init(lv_ui *ui)
lv_table_set_col_width(guider_ui.screen_run_step, 1, 370);
lv_table_set_cell_value(guider_ui.screen_run_step,0,0,"步");
lv_table_set_cell_value(guider_ui.screen_run_step,0,1,"工艺");
//程序页面的工艺信息列表
guider_ui.screen_pname_row = lv_table_create(guider_ui.screen_step_set);
table_style_init(guider_ui.screen_pname_row);
lv_obj_add_event_cb(guider_ui.screen_pname_row, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_table_set_col_cnt(guider_ui.screen_pname_row,3);
lv_table_set_col_width(guider_ui.screen_pname_row, 0, 430);
lv_table_set_col_width(guider_ui.screen_pname_row, 1, 84);
lv_table_set_col_width(guider_ui.screen_pname_row, 2, 200);
lv_table_set_cell_value(guider_ui.screen_pname_row,0,0,"工艺");
lv_table_set_cell_value(guider_ui.screen_pname_row,0,1,"步骤");
lv_table_set_cell_value(guider_ui.screen_pname_row,0,2,"时间");
//程序页面的步骤列表
guider_ui.screen_pname_step_row = lv_table_create(guider_ui.screen_proess_set);
lv_obj_set_pos(guider_ui.screen_pname_step_row, 0, 0);
lv_obj_set_size(guider_ui.screen_pname_step_row, 300, 50);
table_style_init(guider_ui.screen_pname_step_row);
lv_obj_add_event_cb(guider_ui.screen_pname_step_row, table_style_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_table_set_row_cnt(guider_ui.screen_pname_step_row,1);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 0, 50);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 1, 250);
lv_table_set_cell_value(guider_ui.screen_pname_step_row,0,0,"步");
lv_table_set_cell_value(guider_ui.screen_pname_step_row,0,1,"工艺");
/* Add your codes here */
}
+2
View File
@@ -17,6 +17,8 @@ extern "C" {
extern int16_t Work_row;
extern int16_t Work_step_row;
extern int16_t pname_row;
extern int16_t pname_step_row;
void custom_init(lv_ui *ui);