$PBExportHeader$w_system_setting.srw forward global type w_system_setting from window end type type cb_3 from uo_imflatbutton within w_system_setting end type type dw_1 from u_dw_rbtnfilter within w_system_setting end type type st_database from statictext within w_system_setting end type type st_server from statictext within w_system_setting end type type cb_2 from uo_imflatbutton within w_system_setting end type type cb_1 from uo_imflatbutton within w_system_setting end type type cb_ch from uo_imflatbutton within w_system_setting end type type cb_output_file from uo_imflatbutton within w_system_setting end type type cb_input_file from uo_imflatbutton within w_system_setting end type type st_1 from statictext within w_system_setting end type type sle_filename from singlelineedit within w_system_setting end type type tv_func from treeview within w_system_setting end type type cb_end from uo_imflatbutton within w_system_setting end type type cb_clear_all from uo_imflatbutton within w_system_setting end type type cb_select_all from uo_imflatbutton within w_system_setting end type type gb_3 from groupbox within w_system_setting end type end forward global type w_system_setting from window integer x = 5 integer y = 4 integer width = 4151 integer height = 1784 boolean titlebar = true string title = "系统功能设定" boolean controlmenu = true boolean minbox = true boolean maxbox = true windowtype windowtype = popup! windowstate windowstate = maximized! long backcolor = 80269524 boolean center = true cb_3 cb_3 dw_1 dw_1 st_database st_database st_server st_server cb_2 cb_2 cb_1 cb_1 cb_ch cb_ch cb_output_file cb_output_file cb_input_file cb_input_file st_1 st_1 sle_filename sle_filename tv_func tv_func cb_end cb_end cb_clear_all cb_clear_all cb_select_all cb_select_all gb_3 gb_3 end type global w_system_setting w_system_setting type prototypes subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library 'user32.dll' end prototypes type variables long deep=0,il_handle end variables forward prototypes public function string wf_getright () public function integer wf_build_functree () public function integer pf_treegrowth (long arg_handl, long arg_funcid, integer arg_lp) public subroutine wf_refresh_tvchild (long arg_handl, string arg_rightstr) public subroutine wf_refresh_tvnext (long arg_handl, string arg_rightstr) public subroutine wf_getright_tvchild (long arg_handl, ref string arg_rightstr) public subroutine wf_getright_tvnext (long arg_handl, ref string arg_rightstr) public subroutine wf_set_tvparent (long arg_handl) public subroutine wf_set_tvchild (long arg_handl) public subroutine wf_refresh () public subroutine wf_clear_tvchild (long arg_handl, integer arg_statepictureindex) public subroutine wf_clear_tvnext (long arg_handl, integer arg_statepictureindex) public subroutine wf_set_tvnext (long arg_handl) end prototypes public function string wf_getright ();string ls_ret ls_ret=fill("0",2000) long ll_handl ll_handl = tv_func.finditem(RootTreeItem!,0) if ll_handl > 0 then wf_getright_tvchild(ll_handl,ls_ret) return ls_ret end function public function integer wf_build_functree ();//==================================================================== // Function: wf_build_functree() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments:(None) //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: yyx Date: 2004.11.16 //-------------------------------------------------------------------- // Modify History: // //==================================================================== long hand deep=1 long tvi_hdl = 0 do until tv_func.finditem(roottreeitem!, 0) = -1 tv_func.deleteitem(tvi_hdl) loop hand=tv_func.insertitemlast(0,sys_message_title,1) pf_treegrowth(hand,0,2) tv_func.expanditem(hand) return 1 end function public function integer pf_treegrowth (long arg_handl, long arg_funcid, integer arg_lp);//==================================================================== // function: pf_treegrowth() //-------------------------------------------------------------------- // description: //-------------------------------------------------------------------- // arguments: // value long arg_handl // value long arg_funcid // value integer arg_lp //-------------------------------------------------------------------- // returns: integer //-------------------------------------------------------------------- // author: yyx date: 2004.11.16 //-------------------------------------------------------------------- // modify history: // //==================================================================== Int rslt = 1 s_sys_func ls_s_func[] Long count = 0,ls_i Long handl treeviewitem tvi deep++ IF deep > 100000 THEN //防止死递归 RETURN 0 END IF String ls_filter ls_filter = 'parentid='+String(arg_funcid) sys_ds_funcinfo.SetFilter(ls_filter) sys_ds_funcinfo.Filter() FOR ls_i = 1 To sys_ds_funcinfo.RowCount( ) //if sys_ds_funcinfo.object.if_use[ls_i] = 0 then continue IF sys_ds_funcinfo.Object.parentid[ls_i] = arg_funcid THEN count++ ls_s_func[count].funcid = sys_ds_funcinfo.Object.funcid[ls_i] ls_s_func[count].treename = sys_ds_funcinfo.Object.treename[ls_i] ls_s_func[count].MenuName = sys_ds_funcinfo.Object.MenuName[ls_i] ls_s_func[count].parentid = sys_ds_funcinfo.Object.parentid[ls_i] ls_s_func[count].sortflag = sys_ds_funcinfo.Object.sortflag[ls_i] ls_s_func[count].functype = sys_ds_funcinfo.Object.functype[ls_i] ls_s_func[count].mainid = sys_ds_funcinfo.Object.mainid[ls_i] ls_s_func[count].if_use = sys_ds_funcinfo.Object.if_use[ls_i] ls_s_func[count].versiontype = sys_ds_funcinfo.Object.versiontype[ls_i] ls_s_func[count].worktype = sys_ds_funcinfo.Object.worktype[ls_i] ls_s_func[count].moduleid = sys_ds_funcinfo.Object.moduleid[ls_i] END IF NEXT String ls_item FOR ls_i = 1 To count ls_item = String(ls_s_func[ls_i].funcid) ls_item = Space(5 - Len(ls_item)) + ls_item+' - '+ls_s_func[ls_i].treename IF ls_s_func[ls_i].mainid > 0 THEN ls_item += ' ['+String(ls_s_func[ls_i].mainid)+']' END IF IF ls_s_func[ls_i].if_use = 0 THEN ls_item += ' *' END IF ls_item += ' ' IF ls_s_func[ls_i].versiontype = -1 THEN ls_item += ' 公共' elseIF ls_s_func[ls_i].versiontype = 0 THEN ls_item += ' 工业' elseIF ls_s_func[ls_i].versiontype = 1 THEN ls_item += ' 商业' elseIF ls_s_func[ls_i].versiontype = 2 THEN ls_item += ' 工业+' END IF // IF ls_s_func[ls_i].worktype = 0 THEN // ls_item += ' W[公共]' // elseIF ls_s_func[ls_i].worktype = 1 THEN // ls_item += ' W[单机]' // elseIF ls_s_func[ls_i].worktype = 2 THEN // ls_item += ' W[网络]' // END IF handl = tv_func.InsertItemLast(arg_handl,ls_item,arg_lp) //生成树 // tv_func.expanditem(arg_handl) tv_func.GetItem(handl,tvi) tvi.StatePictureIndex = 2 tvi.Data = ls_s_func[ls_i] tv_func.SetItem(handl,tvi) pf_treegrowth(handl,ls_s_func[ls_i].funcid,arg_lp+1) //下级生成树 NEXT RETURN rslt end function public subroutine wf_refresh_tvchild (long arg_handl, string arg_rightstr);long ll_handl long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) ll_funcid = tvi.data // messagebox("0",ll_funcid) if not ll_funcid = 0 then if mid(arg_rightstr,ll_funcid,1)='0' then tvi.statepictureindex = 1 else tvi.statepictureindex = 2 end if end if tv_func.setitem(ll_handl,tvi) wf_refresh_tvnext(ll_handl,arg_rightstr) ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) loop end subroutine public subroutine wf_refresh_tvnext (long arg_handl, string arg_rightstr);long ll_handl long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) ll_funcid = tvi.data // messagebox("1",ll_funcid) if not ll_funcid = 0 then if mid(arg_rightstr,ll_funcid,1)='0' then tvi.statepictureindex = 1 else tvi.statepictureindex = 2 end if end if tv_func.setitem(ll_handl,tvi) wf_refresh_tvchild(ll_handl,arg_rightstr) ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) loop end subroutine public subroutine wf_getright_tvchild (long arg_handl, ref string arg_rightstr);long ll_handl long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) ll_funcid = tvi.data // messagebox("0",ll_funcid) if not ll_funcid = 0 then if tvi.statepictureindex = 2 then arg_rightstr=replace(arg_rightstr,ll_funcid,1,"1") end if end if wf_getright_tvnext(ll_handl,arg_rightstr) ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) loop end subroutine public subroutine wf_getright_tvnext (long arg_handl, ref string arg_rightstr);long ll_handl long ll_funcid treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) ll_funcid = tvi.data // messagebox("1",ll_funcid) if not ll_funcid = 0 then if tvi.statepictureindex = 2 then arg_rightstr=replace(arg_rightstr,ll_funcid,1,"1") end if end if tv_func.setitem(ll_handl,tvi) wf_getright_tvchild(ll_handl,arg_rightstr) ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) loop end subroutine public subroutine wf_set_tvparent (long arg_handl);//==================================================================== // Function: wf_find_parenttree() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value long arg_handl // value long arg_state //-------------------------------------------------------------------- // Returns: (none) //-------------------------------------------------------------------- // Author: yyx Date: 2004.11.18 //-------------------------------------------------------------------- // Modify History: // //==================================================================== long ll_handl treeviewitem tvi ll_handl = arg_handl tv_func.getitem(ll_handl,tvi) tvi.StatePictureIndex = 2 tv_func.setitem(ll_handl,tvi) ll_handl = tv_func.finditem(ParentTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) tvi.StatePictureIndex = 2 tv_func.setitem(ll_handl,tvi) ll_handl = tv_func.finditem(ParentTreeItem!,ll_handl) loop end subroutine public subroutine wf_set_tvchild (long arg_handl);//==================================================================== // Function: wf_find_childtree() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value long arg_handl // value long arg_state //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: yyx Date: 2004.11.18 //-------------------------------------------------------------------- // Modify History: // //==================================================================== long ll_handl treeviewitem tvi ll_handl = arg_handl tv_func.getitem(ll_handl,tvi) tvi.StatePictureIndex = 1 tv_func.setitem(ll_handl,tvi) ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) do while ll_handl > 0 wf_set_tvnext(ll_handl) ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) loop end subroutine public subroutine wf_refresh ();//wf_refresh //long ll_row //long ll_storageid,ll_scid //long i,li_no,cnt //string ls_str,ls_storage_str,ls_scstr // //ll_row = dw_1.getrow() // //if ll_row > 0 then // if is_id = sys_super_id then // ls_str = fill('1',2000) // else // select rightstring into :ls_str // from u_user // where empid = :ins_empid // and scid = :sys_scid; // if sqlca.sqlcode <> 0 or isnull(ls_str) then // ls_str = '' // end if // ls_str=f_psw_zh(ls_str,1,sys_power_key) //解密 // ls_storage_str = dw_1.object.storagestr[ll_row] // ls_scstr = dw_1.object.scstr[ll_row] // end if //end if ////**storage_checkbox //for i = 1 to dw_2.rowcount() // if ls_storage_str = '0' then // dw_2.object.choice[i] = 1 // else // ll_storageid = dw_2.object.storageid[i] // if pos(ls_storage_str,','+string(ll_storageid)+',',1) > 0 then // dw_2.object.choice[i] = 1 // else // dw_2.object.choice[i] = 0 // end if // end if //next // ////**sc_checkbox //for i = 1 to dw_3.rowcount() // if ls_scstr = '0' then // dw_3.object.choice[i] = 1 // else // ll_scid = dw_3.object.scid[i] // if pos(ls_scstr,','+string(ll_scid)+',',1) > 0 then // dw_3.object.choice[i] = 1 // else // dw_3.object.choice[i] = 0 // end if // end if //next //**tv_checkbox //if ls_str = '' then return long ll_handl ll_handl = tv_func.finditem(RootTreeItem!,0) //if ll_handl > 0 then wf_refresh_tvchild(ll_handl,ls_str) return end subroutine public subroutine wf_clear_tvchild (long arg_handl, integer arg_statepictureindex);long ll_handl treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) tvi.statepictureindex = arg_statepictureindex tv_func.setitem(ll_handl,tvi) wf_clear_tvnext(ll_handl,arg_statepictureindex) ll_handl = tv_func.finditem(ChildTreeItem!,ll_handl) loop end subroutine public subroutine wf_clear_tvnext (long arg_handl, integer arg_statepictureindex);long ll_handl treeviewitem tvi ll_handl = arg_handl ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) do while ll_handl > 0 tv_func.getitem(ll_handl,tvi) tvi.statepictureindex = arg_statepictureindex tv_func.setitem(ll_handl,tvi) wf_clear_tvchild(ll_handl,arg_statepictureindex) ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) loop end subroutine public subroutine wf_set_tvnext (long arg_handl);//==================================================================== // Function: wf_find_childtree() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value long arg_handl // value long arg_state //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: yyx Date: 2004.11.18 //-------------------------------------------------------------------- // Modify History: // //==================================================================== long ll_handl treeviewitem tvi ll_handl = arg_handl tv_func.getitem(ll_handl,tvi) tvi.StatePictureIndex = 1 tv_func.setitem(ll_handl,tvi) ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) do while ll_handl > 0 wf_set_tvchild(ll_handl) ll_handl = tv_func.finditem(NextTreeItem!,ll_handl) loop end subroutine on w_system_setting.create this.cb_3=create cb_3 this.dw_1=create dw_1 this.st_database=create st_database this.st_server=create st_server this.cb_2=create cb_2 this.cb_1=create cb_1 this.cb_ch=create cb_ch this.cb_output_file=create cb_output_file this.cb_input_file=create cb_input_file this.st_1=create st_1 this.sle_filename=create sle_filename this.tv_func=create tv_func this.cb_end=create cb_end this.cb_clear_all=create cb_clear_all this.cb_select_all=create cb_select_all this.gb_3=create gb_3 this.Control[]={this.cb_3,& this.dw_1,& this.st_database,& this.st_server,& this.cb_2,& this.cb_1,& this.cb_ch,& this.cb_output_file,& this.cb_input_file,& this.st_1,& this.sle_filename,& this.tv_func,& this.cb_end,& this.cb_clear_all,& this.cb_select_all,& this.gb_3} end on on w_system_setting.destroy destroy(this.cb_3) destroy(this.dw_1) destroy(this.st_database) destroy(this.st_server) destroy(this.cb_2) destroy(this.cb_1) destroy(this.cb_ch) destroy(this.cb_output_file) destroy(this.cb_input_file) destroy(this.st_1) destroy(this.sle_filename) destroy(this.tv_func) destroy(this.cb_end) destroy(this.cb_clear_all) destroy(this.cb_select_all) destroy(this.gb_3) end on event open;// string ls_filename ls_filename = "func_"+string(today(),'yymmdd')+".Dbf" sle_filename.text = "E:\PB9_work\_Ewiserp_v31\"+ls_filename st_server.text = sqlca.ServerName st_database.text = sqlca.Database sys_ds_funcinfo.settransobject(sqlca) sys_ds_funcinfo.retrieve(-1) dw_1.settransobject(sqlca) dw_1.retrieve(-1) dw_1.setsort('parentid, sortflag') dw_1.sort() wf_build_functree() //wf_refresh() end event event key;IF Key = KeyEnter! Or Key = KeyDownArrow! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF end event event resize;dw_1.width = this.width / 2 tv_func.width = this.width - 20 - dw_1.width tv_func.height = this.height - tv_func.y - 140 dw_1.x = tv_func.x + tv_func.width + 5 dw_1.y = tv_func.y dw_1.height = tv_func.height end event type cb_3 from uo_imflatbutton within w_system_setting integer x = 1861 integer y = 104 integer width = 274 integer height = 96 integer taborder = 210 string text = "权限查找" end type event clicked;call super::clicked;// Long parentid Long funcid String treename String ls_last Int flag = 1 s_inputbox ins_parm ins_parm.title = "请输入神秘代码" ins_parm.msg = "请输入权限代码" openwithparm(w_inputbox_long,ins_parm) ins_parm = Message.PowerObjectParm if ins_parm.ifret = false then return funcid = ins_parm.long_a do IF funcid<>0 THEN select parentid, treename into :parentid,:treename from sys_func_pwr where funcid = :funcid; IF SQLCA.SQLCODE <>0 THEN flag = 0 GOTO EXT END IF END IF IF ls_last = '' THEN ls_last = treename ELSE ls_last = treename+"~r-"+ls_last END IF funcid = parentid loop until funcid = 0 EXT: IF flag = 1 then MESSAGEBOX("成功",ls_last) else MESSAGEBOX("失败","不存在该权限") end if end event type dw_1 from u_dw_rbtnfilter within w_system_setting integer x = 1349 integer y = 236 integer width = 1829 integer taborder = 30 string dataobject = "ds_sys_funcpwr_setting" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean rbutton_filter_use = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type type st_database from statictext within w_system_setting integer x = 2715 integer y = 128 integer width = 626 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217856 long backcolor = 67108864 string text = "none" boolean focusrectangle = false end type type st_server from statictext within w_system_setting integer x = 2715 integer y = 40 integer width = 626 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217856 long backcolor = 67108864 string text = "none" boolean focusrectangle = false end type type cb_2 from uo_imflatbutton within w_system_setting integer x = 1339 integer y = 104 integer width = 494 integer height = 96 integer taborder = 200 string text = "导入DW到数据库" end type event clicked;call super::clicked;IF Not sys_power_issuper THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF datastore ds_setting, ds_func String arg_filename arg_filename = Trim(sle_filename.Text) IF arg_filename = '' THEN MessageBox('提示','请输入文件名称',information!,ok!) RETURN END IF ds_setting = Create datastore ds_setting.DataObject = 'dw_system_import_setting' ds_setting.SetTransObject(sqlca) ds_func = Create datastore ds_func.DataObject = 'ds_sys_funcpwr' ds_func.RowsCopy(1, ds_func.RowCount(), Primary!, ds_setting, 1, Primary!) ds_setting.AcceptText() IF ds_setting.RowCount() <= 0 THEN MessageBox('提示','你导入的系统功能文件没有数据',information!,ok!) RETURN END IF DELETE FROM sys_func_pwr; IF sqlca.SQLCode <> 0 THEN rollback; MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!) RETURN END IF IF ds_setting.Update() = -1 THEN ROLLBACK; MessageBox('提示','你导入的系统功能文件UPEATE错误',information!,ok!) RETURN END IF //Long ll_i //Long ll_funcid //Long ll_parentid //Long ll_mainid //Int li_functype //String ls_treename //String ls_menuname //Int li_if_use //Int li_sortflag //int li_versiontype //int li_worktype //FOR ll_i = 1 TO ds_setting.RowCount() // ll_funcid = ds_setting.Object.funcid[ll_i] // ll_parentid = ds_setting.Object.parentid[ll_i] // ll_mainid = ds_setting.Object.mainid[ll_i] // li_functype = ds_setting.Object.functype[ll_i] // ls_treename = ds_setting.Object.treename[ll_i] // ls_menuname = ds_setting.Object.MenuName[ll_i] // li_if_use = ds_setting.Object.if_use[ll_i] // li_sortflag = ds_setting.Object.sortflag[ll_i] // li_versiontype = ds_setting.Object.versiontype[ll_i] // li_worktype = ds_setting.Object.worktype[ll_i] // INSERT INTO sys_func_pwr(funcid,parentid,mainid,functype,treename,menuname,if_use,sortflag,versiontype,worktype) // Values(:ll_funcid,:ll_parentid,:ll_mainid,:li_functype,:ls_treename,:ls_menuname,:li_if_use,:li_sortflag,:li_versiontype,:li_worktype); // IF sqlca.SQLCode <> 0 THEN // MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!) // RETURN // END IF //NEXT COMMIT; cb_1.TriggerEvent( Clicked!) MessageBox('提示','导入系统功能数据成功',information!,ok!) end event type cb_1 from uo_imflatbutton within w_system_setting integer y = 104 integer width = 274 integer height = 96 integer taborder = 60 string text = "刷新" end type event clicked;call super::clicked;sys_ds_funcinfo.settransobject(sqlca) sys_ds_funcinfo.retrieve(-1) wf_build_functree() end event type cb_ch from uo_imflatbutton within w_system_setting integer x = 2153 integer width = 261 integer height = 96 integer taborder = 50 string text = "选择" end type event clicked;call super::clicked;//new integer i string pathname,filename i=getfilesavename("选择备份文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf") IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>"" THEN sle_filename.text=pathname END IF end event type cb_output_file from uo_imflatbutton within w_system_setting integer x = 841 integer y = 104 integer width = 494 integer height = 96 integer taborder = 50 string text = "导入功能设定文件" end type event clicked;call super::clicked;IF Not sys_power_issuper THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF datastore ds_setting String arg_filename arg_filename = Trim(sle_filename.Text) IF arg_filename = '' THEN MessageBox('提示','请输入文件名称',information!,ok!) RETURN END IF ds_setting = Create datastore ds_setting.DataObject = 'dw_system_import_setting' ds_setting.SetTransObject(sqlca) ds_setting.ImportFile(arg_filename) ds_setting.AcceptText() IF ds_setting.RowCount() <= 0 THEN MessageBox('提示','你导入的系统功能文件没有数据',information!,ok!) RETURN END IF DELETE From sys_func_pwr; IF sqlca.SQLCode <> 0 THEN ROLLBACK; MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!) RETURN END IF Long ll_i Long ll_funcid Long ll_parentid Long ll_mainid Int li_functype String ls_treename String ls_menuname Int li_if_use Int li_sortflag Int li_versiontype Int li_worktype long ll_moduleid FOR ll_i = 1 To ds_setting.RowCount() ll_funcid = ds_setting.Object.funcid[ll_i] ll_parentid = ds_setting.Object.parentid[ll_i] ll_mainid = ds_setting.Object.mainid[ll_i] li_functype = ds_setting.Object.functype[ll_i] ls_treename = ds_setting.Object.treename[ll_i] ls_menuname = ds_setting.Object.MenuName[ll_i] li_if_use = ds_setting.Object.if_use[ll_i] li_sortflag = ds_setting.Object.sortflag[ll_i] li_versiontype = ds_setting.Object.versiontype[ll_i] li_worktype = ds_setting.Object.worktype[ll_i] ll_moduleid = ds_setting.Object.moduleid[ll_i] INSERT INTO sys_func_pwr(funcid,parentid,mainid,functype,treename,menuname,if_use,sortflag,versiontype,worktype,moduleid) Values(:ll_funcid,:ll_parentid,:ll_mainid,:li_functype,:ls_treename,:ls_menuname,:li_if_use,:li_sortflag,:li_versiontype,:li_worktype,:ll_moduleid); IF sqlca.SQLCode <> 0 THEN MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!) RETURN END IF NEXT COMMIT; cb_1.TriggerEvent( Clicked!) MessageBox('提示','导入系统功能数据成功',information!,ok!) end event type cb_input_file from uo_imflatbutton within w_system_setting integer x = 347 integer y = 104 integer width = 494 integer height = 96 integer taborder = 190 string text = "导出功能设置文件" end type event clicked;call super::clicked; string arg_filename,arg_msg blob arg_blob arg_filename = trim(sle_filename.text) if arg_filename = '' then messagebox('提示','请输入文件名称',information!,ok!) return end if if messagebox("询问","是否确定要将系统权限导出成文件",question!,yesno!,1) = 2 then return end if datastore ds_setting ds_setting = create datastore ds_setting.dataobject = 'dw_system_import_setting' ds_setting.settransobject(sqlca) ds_setting.retrieve( ) if fileexists(arg_filename) then if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then return end if end if if ds_setting.saveas(arg_filename,dbase2!,false) = 1 then arg_msg = '数据导出成功!' else arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!' end if messagebox('提示',arg_msg,information!,ok!) end event type st_1 from statictext within w_system_setting integer y = 20 integer width = 279 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "文件路径:" boolean focusrectangle = false end type type sle_filename from singlelineedit within w_system_setting event key pbm_keydown integer x = 283 integer width = 1847 integer height = 92 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type tv_func from treeview within w_system_setting event ue_tree_edit ( ) event ue_tree_add_bro ( ) event ue_tree_add_son ( ) event ue_tree_del ( ) event ue_tree_set_son ( ) event ue_tree_add_reportson ( ) event ue_tree_add_billfunc ( ) integer y = 240 integer width = 2414 integer height = 1432 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! boolean linesatroot = true boolean disabledragdrop = false boolean hideselection = false boolean tooltips = false string picturename[] = {"application.ico","graphics\Shell32 005.ico","graphics\blue folder.ico","graphics\Shell32 025.ico","Custom029!"} long picturemaskcolor = 536870912 long statepicturemaskcolor = 536870912 end type event ue_tree_edit();IF NOT il_handle > 0 THEN RETURN s_sys_func_parm s_sfp treeviewitem tvi tv_func.GetItem(il_handle,tvi) s_sfp.sfunc = tvi.Data s_sfp.opflag = 3 // add son OpenWithParm(w_mftree_add,s_sfp) s_sfp = Message.PowerObjectParm IF s_sfp.opflag = 0 THEN RETURN // 取消 Long ll_getitem treeviewitem ltvi_Item String ls_item IF il_handle > 0 THEN ll_getitem = THIS.GetItem(il_handle, ltvi_Item) IF ll_getitem > 0 THEN // ltvi_Item.label=string(s_sfp.sfunc.funcid)+'-'+s_sfp.sfunc.treename ls_item = String(s_sfp.sfunc.funcid) ls_item = Space(5 - Len(ls_item)) + ls_item+' - '+s_sfp.sfunc.treename IF s_sfp.sfunc.mainid > 0 THEN ls_item += ' ['+String(s_sfp.sfunc.mainid)+']' END IF IF s_sfp.sfunc.if_use = 0 THEN ls_item += ' *' END IF ltvi_Item.Label = ls_item ltvi_Item.Data = s_sfp.sfunc ll_getitem = THIS.SetItem(il_handle, ltvi_Item) il_handle = 0 END IF END IF end event event ue_tree_add_bro();if not il_handle>0 then return s_sys_func_parm s_sfp treeviewitem tvi tv_func.getitem(il_handle,tvi) s_sfp.sfunc=tvi.data s_sfp.opflag=1 // add brother openwithparm(w_mftree_add,s_sfp) s_sfp=message.powerobjectparm if s_sfp.opflag=0 then return // 取消 LONG ll_getitem,ll_newhandle,ll_pahandle TreeViewItem ltvi_Item,ltvi_PaItem string ls_item IF il_handle>0 THEN ll_getitem=this.GetItem(il_handle, ltvi_Item) IF ll_getitem>0 THEN //得到父项, ll_pahandle=FindItem(ParentTreeItem!, il_handle) IF ll_pahandle<0 THEN ll_pahandle=0 // ltvi_Item.label=string(s_sfp.sfunc.funcid)+'-'+s_sfp.sfunc.treename ls_item = String(s_sfp.sfunc.funcid) ls_item = Space(5 - Len(ls_item)) + ls_item+' - '+s_sfp.sfunc.treename IF s_sfp.sfunc.mainid > 0 THEN ls_item += ' ['+String(s_sfp.sfunc.mainid)+']' END IF IF s_sfp.sfunc.if_use = 0 THEN ls_item += ' *' END IF ltvi_Item.Label = ls_item ltvi_Item.Data = s_sfp.sfunc ltvi_Item.PictureIndex = 6 // ltvi_Item.SelectedPictureIndex = 5 ll_newhandle=this.InsertItemlast(ll_pahandle,ltvi_Item) this.GetItem(ll_newhandle, ltvi_Item) this.ExpandItem(ll_pahandle) //this.editlabel(ll_newhandle) il_handle=0 END IF END IF end event event ue_tree_add_son();if not il_handle>0 then return s_sys_func_parm s_sfp treeviewitem tvi tv_func.getitem(il_handle,tvi) s_sfp.sfunc=tvi.data s_sfp.opflag=2 // add son openwithparm(w_mftree_add,s_sfp) s_sfp=message.powerobjectparm if s_sfp.opflag=0 then return // 取消 LONG ll_getitem,ll_newhandle TreeViewItem ltvi_Item string ls_item IF il_handle>0 THEN ll_getitem=this.GetItem(il_handle, ltvi_Item) IF ll_getitem>0 THEN //ltvi_Item.children=true // ltvi_Item.label=string(s_sfp.sfunc.funcid)+'-'+s_sfp.sfunc.treename ls_item = String(s_sfp.sfunc.funcid) ls_item = Space(5 - Len(ls_item)) + ls_item+' - '+s_sfp.sfunc.treename IF s_sfp.sfunc.mainid > 0 THEN ls_item += ' ['+String(s_sfp.sfunc.mainid)+']' END IF IF s_sfp.sfunc.if_use = 0 THEN ls_item += ' *' END IF ltvi_Item.Label = ls_item ltvi_Item.Data = s_sfp.sfunc ltvi_Item.PictureIndex = 6 ltvi_Item.SelectedPictureIndex = 5 ll_newhandle=this.InsertItemlast(il_handle,ltvi_Item) this.ExpandItem(il_handle) //this.editlabel(ll_newhandle) il_handle=0 END IF END IF end event event ue_tree_del(); LONG ll_getitem TreeViewItem ltvi_Item uo_sys_funcpwr uo_sfp s_sys_func s_sf_ls IF il_handle>0 THEN ll_getitem=this.GetItem(il_handle, ltvi_Item) IF ll_getitem>0 THEN IF MessageBox ("询问","是否确定要删除当前结点?("+trim(ltvi_Item.label )+")",Question!,YesNo! ) = 2 THEN RETURN s_sf_ls=ltvi_Item.data uo_sfp.del(s_sf_ls.funcid ) This.deleteitem(il_handle) il_handle=0 END IF END IF end event event ue_tree_set_son();treeviewitem tvi tv_func.GetItem(il_handle,tvi) Long ll_getitem treeviewitem ltvi_Item uo_sys_funcpwr uo_sfp s_sys_func s_sf_ls IF il_handle > 0 THEN ll_getitem = THIS.GetItem(il_handle, ltvi_Item) IF ll_getitem > 0 THEN s_sf_ls = ltvi_Item.Data OpenWithParm(w_func_set_version,s_sf_ls) END IF cb_1.TriggerEvent(clicked!) END IF end event event ue_tree_add_reportson();IF NOT il_handle > 0 THEN RETURN s_sys_func_parm s_sfp treeviewitem tvi tv_func.GetItem(il_handle,tvi) s_sfp.sfunc = tvi.Data s_sfp.opflag = 2 // add son long ls_rslt = 1 uo_sys_funcpwr uo_sfp ls_rslt=uo_sfp.save( 0,s_sfp.sfunc.funcid,0,9,"报表打印","报表打印",1,0,-1,0, 1001) if ls_rslt<>1 then goto ext end if ls_rslt=uo_sfp.save( 0,s_sfp.sfunc.funcid,0,9,"报表数据发送","报表数据发送",1,1,-1,0, 1001 ) if ls_rslt<>1 then goto ext end if ext: if ls_rslt = 0 then rollback; messagebox('失败',uo_sfp.ins_msg) else commit; messagebox('成功',"成功") end if end event event ue_tree_add_billfunc();//IF Not il_handle > 0 THEN RETURN s_sys_func_parm s_sfp treeviewitem tvi tv_func.GetItem(il_handle,tvi) s_sfp.sfunc = tvi.Data s_sfp.opflag = 2 // add son Open(w_mftree_billfunc) // String is_billfuncstr is_billfuncstr = Message.StringParm IF is_billfuncstr = "" THEN RETURN Long ls_rslt = 1 Long ll_sort uo_sys_funcpwr uo_sfp IF Mid(is_billfuncstr , 1, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"新建","新建",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 2, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"删除","删除",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 3, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"确认","确认",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 4, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"反确认","反确认",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 5, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"审核","审核",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 6, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"撤审","撤审",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 7, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"终审","终审",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 8, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"终撤","终撤",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 9, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"添加备注","添加备注",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF IF Mid(is_billfuncstr , 10, 1) = "1" THEN ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,"打印","打印",1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF END IF Long ll_pos String ls_billfunc IF Len(is_billfuncstr) > 10 THEN is_billfuncstr = Mid(is_billfuncstr, 11) ll_pos = Pos(is_billfuncstr, '~n') DO WHILE ll_pos > 0 ls_billfunc = Left(is_billfuncstr, ll_pos - 1) is_billfuncstr = Mid(is_billfuncstr, ll_pos + Len( '~n')) ll_sort++ ls_rslt = uo_sfp.Save( 0,s_sfp.sfunc.funcid,0,9,Trim(ls_billfunc),Trim(ls_billfunc),1,ll_sort,-1,0, 1001 ) IF ls_rslt <> 1 THEN GOTO ext END IF ll_pos = Pos(is_billfuncstr, '~n') LOOP END IF ext: //ROLLBACK; IF ls_rslt = 0 THEN ROLLBACK; MessageBox('失败',uo_sfp.ins_msg) ELSE COMMIT; MessageBox('成功',"成功") END IF end event event clicked;Int ls_state treeviewitem tvi s_sys_func_parm s_sfp Long ll_parentid IF tv_func.GetItem(Handle,tvi) <> 1 THEN RETURN ls_state = tvi.StatePictureIndex IF IsNull(tvi.Data) THEN ll_parentid = 0 ELSE s_sfp.sfunc = tvi.Data ll_parentid = s_sfp.sfunc.funcid END IF IF Handle > 0 THEN IF ls_state = 2 THEN //孩子全部取消 wf_set_tvchild(Handle) ELSEIF ls_state = 1 THEN //父亲选定 wf_set_tvparent(Handle) END IF dw_1.SetFilter('parentid = '+String(ll_parentid)) dw_1.Filter() END IF end event event rightclicked;IF Handle <= 0 THEN RETURN il_handle = Handle m_popup om_1 om_1 = CREATE m_popup //把菜单的anyobject指向被右击的对象(dw_1) om_1.anyobject = THIS //om_1.setmenuitem("添加子项|添加兄弟|编辑|-|删除") //可在此调用om_1.setitemdisable(itemorder)函数disable某菜单项。 om_1.popupmenu(THIS.X+THIS.PointerX(),THIS.Y+THIS.PointerY()) DESTROY om_1 end event type cb_end from uo_imflatbutton within w_system_setting integer x = 2427 integer width = 261 integer height = 96 integer taborder = 170 boolean bringtotop = true string text = "退出" string normalpicname = "graphics\btngraphics\exit.bmp" end type event clicked;call super::clicked;close(parent) end event type cb_clear_all from uo_imflatbutton within w_system_setting integer x = 2418 integer y = 100 integer width = 274 integer height = 96 integer taborder = 180 boolean enabled = false string text = "合部清除" end type event clicked;call super::clicked;long ll_handl ll_handl = tv_func.finditem(RootTreeItem!,0) if ll_handl > 0 then wf_clear_tvchild(ll_handl,1) end event type cb_select_all from uo_imflatbutton within w_system_setting integer x = 2149 integer y = 100 integer width = 274 integer height = 96 integer taborder = 180 boolean enabled = false string text = "全部选择" end type event clicked;call super::clicked;long ll_handl ll_handl = tv_func.finditem(RootTreeItem!,0) if ll_handl > 0 then wf_clear_tvchild(ll_handl,2) end event type gb_3 from groupbox within w_system_setting integer y = 192 integer width = 3109 integer height = 36 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 end type