--delete System_ModuleFormat where module like '%System%'
--插入用户模块格式
if(select count(1) from System_ModuleFormat where module='System_Member' and field='uid')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Member' as module,'uid' as field,
	'用户ID' as field_name,'用户ID' as title,
	50 as width,10 as sort,0 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Member' as module,'username' as field,
	'用户名' as field_name,'用户名' as title,
	100 as width,20 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Member' as module,'nickname' as field,
	'昵称' as field_name,'昵称' as title,
	100 as width,30 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Member' as module,'status_name' as field,
	'状态' as field_name,'状态' as title,
	50 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
end
/**/GO
--插入角色模块格式
if(select count(1) from System_ModuleFormat where module='System_Role' and field='id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Role' as module,'id' as field,
	'角色ID' as field_name,'角色ID' as title,
	100 as width,10 as sort,0 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Role' as module,'role_name' as field,
	'角色名' as field_name,'角色名' as title,
	100 as width,20 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_Role' as module,'status_name' as field,
	'状态' as field_name,'状态' as title,
	100 as width,30 as sort,1 as show,0 as hidden,0 as sum_field;
end
/**/GO
--插入选择窗口用户模块格式
if(select count(1) from System_ModuleFormat where module='Dialog_System_Member' and field='uid')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'Dialog_System_Member' as module,'uid' as field,
	'用户ID' as field_name,'用户ID' as title,
	50 as width,10 as sort,0 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'Dialog_System_Member' as module,'username' as field,
	'用户名' as field_name,'用户名' as title,
	50 as width,20 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'Dialog_System_Member' as module,'nickname' as field,
	'昵称' as field_name,'昵称' as title,
	50 as width,30 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'Dialog_System_Member' as module,'status_name' as field,
	'状态' as field_name,'状态' as title,
	50 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
end
/**/GO
--插入用户操作日志模块格式
if(select count(1) from System_ModuleFormat where module='System_UserLog' and field='log_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'log_id' as field,
	'ID' as field_name,'ID' as title,
	50 as width,10 as sort,0 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'module' as field,
	'系统模块' as field_name,'系统模块' as title,
	80 as width,20 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'op_type' as field,
	'操作类型' as field_name,'操作类型' as title,
	100 as width,30 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'order_id' as field,
	'单据ID' as field_name,'单据ID' as title,
	60 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'order_number' as field,
	'单据号' as field_name,'单据号' as title,
	150 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'uid' as field,
	'用户ID' as field_name,'用户ID' as title,
	60 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'nickname' as field,
	'用户姓名' as field_name,'用户姓名' as title,
	80 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'system_date' as field,
	'操作日期' as field_name,'操作日期' as title,
	120 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_UserLog' as module,'ip_addr' as field,
	'IP地址' as field_name,'IP地址' as title,
	80 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
end
/**/GO

--delete System_ModuleFormat where module='System_ModuleScript' 
--插入选择窗口模块脚本格式
if(select count(1) from System_ModuleFormat where module='System_ModuleScript' and field='ms_id')=0
begin
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_ModuleScript' as module,'ms_id' as field,
	'用户ID' as field_name,'用户ID' as title,
	50 as width,10 as sort,0 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_ModuleScript' as module,'ms_code' as field,
	'脚本编码' as field_name,'脚本编码' as title,
	200 as width,20 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_ModuleScript' as module,'ms_name' as field,
	'脚本名称' as field_name,'脚本名称' as title,
	250 as width,30 as sort,1 as show,0 as hidden,0 as sum_field;

	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_ModuleScript' as module,'ms_type' as field,
	'脚本类型' as field_name,'脚本类型' as title,
	100 as width,40 as sort,1 as show,0 as hidden,0 as sum_field;
	
	insert System_ModuleFormat(module,field,field_name,
	title,width,sort,show,hidden,sum_field)
	select 'System_ModuleScript' as module,'remark' as field,
	'备注' as field_name,'备注' as title,
	250 as width,50 as sort,1 as show,0 as hidden,0 as sum_field;
end
/**/GO
