📄 sys_role.h
字号:
extern int audit(), check_cen_oper();
static int chk_role_code(), set_role_default();
extern WINDOW *sql_win;
extern int do_query, do_insert, do_update, do_delete;
extern char G_oper_no[];
S_sys_role sys_role;
struct field_st sys_role_form[] = {
{
"role_code",
FLD_BEGIN + FLD_STRING + FLD_UPD + FLD_CHK,
17, 2, "",
5, 20, 3,
(void *)sys_role.role_code,
chk_role_code,
NULL,
},
{
"role_name",
FLD_STRING,
17, 2, "",
5, 44, 10,
(void *)sys_role.role_name,
set_role_default,
NULL
},
{
"role_doc",
FLD_STRING,
17, 2, "",
7, 20, 48,
(void *)sys_role.role_doc,
NULL,
NULL
},
{
"update_oper",
FLD_UPD + FLD_INS + FLD_STRING,
17, 2, "",
10, 20, 6,
(void *)sys_role.update_oper,
check_cen_oper,
NULL
},
{
NULL,
FLD_FORM + FLD_STRING,
17, 2, "",
10, 29, 10,
(void *)pub.cen_oper_name,
NULL,
NULL
},
/*
* 因显示格式与字段值有差异,因此增加FLD_FORM
* 域用于显示,本域则置为FLD_SKIP,以便显示或
* 输入时不使用,但构造insert,update语句时使用之。
*
* 因其值无需输入,为系统自动给出,因此应由前面
* 某个字段中执行fieldcheck()予以设置,如
* set_role_default
*
* 为此,tool.c中有关FORM,VIEW,NOEDIT等的fieldcheck
* 函数已放开执行。
*/
{
"update_date",
FLD_SKIP + FLD_STRING,
0, 0, "",
0, 0, 0,
(void *)sys_role.update_date,
NULL,
NULL
},
{
"NULL",
FLD_FORM + FLD_STRING,
17, 2, "",
10, 51, 10,
(void *)pub.update_date,
NULL,
NULL
},
{
"update_time",
FLD_SKIP + FLD_STRING,
0, 0, "",
0, 0, 0,
(void *)sys_role.update_time,
NULL,
NULL
},
{
"NULL",
FLD_FORM + FLD_STRING,
17, 2, "",
10, 64, 8,
(void *)pub.update_time,
NULL,
NULL
},
{
"role_purview",
FLD_END+FLD_SKIP + FLD_STRING,
0, 0, "",
0, 0, 0,
(void *)sys_role.role_purview,
NULL,
NULL
}
};
struct field_st *sys_role_ptr=sys_role_form;
struct screen_st sys_role_st= {
"sys_role.view",
{0, 0, 0, 0},
0,
sys_role_form,
0,
"sys_role",
audit,
audit,
audit,
NULL
};
static int chk_role_code(char *id)
{
int value;
char que_str[1024];
if (!id[0]) return(0);
if (do_query) return(0);
sprintf(que_str,
"select count(*) from sys_role where role_code = \'%s\'",
id);
#ifdef zgx010523_modi
if (query_count(que_str)) return(E_ROLE_EXIST/*72*/); /* 角色代码重复 */
#else
if (query_count(que_str))
if (do_insert)
return(E_ROLE_EXIST/*72*/); /* 角色代码重复 */
#endif
return(0);
}
/*
* 设置系统角色缺省信息:update_oper,update_date,update_time
*/
static int set_role_default(char *nop)
{
if ((do_insert || do_update)&& !sys_role.update_oper[0]) {
strcpy(sys_role.update_oper, G_oper_no);
check_cen_oper(sys_role.update_oper);
}
if (do_insert || do_update) {
getdatef(sys_role.update_date, "");
gettimef(sys_role.update_time, "");
}
str2date(pub.update_date, sys_role.update_date, "/");
str2time(pub.update_time, sys_role.update_time, ":");
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -