uo_ljfieb_tv_pwr.sru 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. $PBExportHeader$uo_ljfieb_tv_pwr.sru
  2. forward
  3. global type uo_ljfieb_tv_pwr from treeview
  4. end type
  5. end forward
  6. global type uo_ljfieb_tv_pwr from treeview
  7. integer width = 549
  8. integer height = 452
  9. integer textsize = -9
  10. integer weight = 400
  11. fontcharset fontcharset = gb2312charset!
  12. fontpitch fontpitch = variable!
  13. string facename = "宋体"
  14. long backcolor = 16777215
  15. borderstyle borderstyle = stylelowered!
  16. boolean disabledragdrop = false
  17. boolean hideselection = false
  18. boolean tooltips = false
  19. boolean checkboxes = true
  20. boolean trackselect = true
  21. string picturename[] = {"application.ico","graphics\Shell32 005.bmp","graphics\task.bmp","graphics\Shell32 025.ico","graphics\guide.ico","graphics\plan.bmp","graphics\define.bmp","graphics\report.bmp","graphics\system.bmp","graphics\reportfold2.jpg","graphics\Window 08.ico"}
  22. long picturemaskcolor = 553648127
  23. long statepicturemaskcolor = 536870912
  24. end type
  25. global uo_ljfieb_tv_pwr uo_ljfieb_tv_pwr
  26. type variables
  27. Long uo_deep = 0
  28. datastore ds_eb
  29. s_sys_func_ljfieb uo_cur_info
  30. boolean ShowID = false
  31. end variables
  32. forward prototypes
  33. public function integer pf_treegrowth (long arg_handl, long arg_parentid)
  34. public function integer f_maketree ()
  35. public subroutine pf_refresh_value (long arg_handl, string arg_rightstr)
  36. public subroutine pf_get_value (long arg_handl, ref string arg_rightstr)
  37. public function integer pf_getinfo (long arg_funcid)
  38. end prototypes
  39. public function integer pf_treegrowth (long arg_handl, long arg_parentid);Int rslt = 1
  40. Long ll_CusareaID,count = 0,ll_i
  41. String ls_Cusareaname,ls_areaname
  42. Int li_sonflag, li_item
  43. s_sys_func_ljfieb ls_s_func[]
  44. Long ll_handl
  45. TreeViewItem l_tvi
  46. uo_deep++
  47. IF uo_deep > 10000 THEN //防止死递归
  48. RETURN 0
  49. END IF
  50. String ls_filter
  51. ls_filter = 'parentid='+String(arg_parentid) + " and if_use = 1"
  52. ds_eb.SetFilter(ls_filter)
  53. ds_eb.Filter()
  54. ds_eb.SetSort("sortflag")
  55. ds_eb.Sort()
  56. //
  57. FOR ll_i = 1 To ds_eb.RowCount( )
  58. // IF ds_eb.Object.if_use[ll_i] = 0 THEN CONTINUE
  59. IF ds_eb.Object.parentid[ll_i] = arg_parentid THEN
  60. count++
  61. ls_s_func[count].funcid = ds_eb.Object.funcid[ll_i]
  62. ls_s_func[count].treename = ds_eb.Object.treename[ll_i]
  63. ls_s_func[count].MenuName = ds_eb.Object.MenuName[ll_i]
  64. ls_s_func[count].parentid = ds_eb.Object.parentid[ll_i]
  65. ls_s_func[count].sortflag = ds_eb.Object.sortflag[ll_i]
  66. ls_s_func[count].functype = ds_eb.Object.functype[ll_i]
  67. ls_s_func[count].mainid = ds_eb.Object.mainid[ll_i]
  68. ls_s_func[count].if_use = ds_eb.Object.if_use[ll_i]
  69. ls_s_func[count].ebtype = ds_eb.Object.ebtype[ll_i]
  70. END IF
  71. NEXT
  72. FOR ll_i = 1 To count
  73. // li_item = 2
  74. IF ls_s_func[ll_i].functype = 0 THEN
  75. li_item = 2
  76. ELSEIF ls_s_func[ll_i].functype = 9 THEN
  77. li_item = 3
  78. END IF
  79. ll_handl = This.InsertItemLast(arg_handl,ls_s_func[ll_i].treename,li_item)
  80. IF This.GetItem ( ll_handl, l_tvi) = 1 THEN
  81. IF ShowID THEN
  82. IF ls_s_func[count].mainid > 0 THEN
  83. l_tvi.Label = String(ls_s_func[ll_i].funcid) +' - '+ ls_s_func[ll_i].treename + '['+String( ls_s_func[ll_i].mainid)+']'
  84. ELSE
  85. l_tvi.Label = String(ls_s_func[ll_i].funcid) +' - '+ ls_s_func[ll_i].treename
  86. END IF
  87. ELSE
  88. l_tvi.Label = ls_s_func[ll_i].treename
  89. END IF
  90. l_tvi.Data = ls_s_func[ll_i].funcid
  91. This.SetItem( ll_handl, l_tvi )
  92. END IF
  93. pf_treegrowth(ll_handl,ls_s_func[ll_i].funcid)
  94. NEXT
  95. RETURN 1
  96. end function
  97. public function integer f_maketree ();//wf_maketree()
  98. Long ll_hand
  99. uo_deep = 1
  100. Long tvi_hdl = 0
  101. This.SetRedraw(False)
  102. DO UNTIL This.FindItem(RootTreeItem!, 0) = -1
  103. This.DeleteItem(tvi_hdl)
  104. LOOP
  105. ll_hand = This.InsertItemLast(0,'电子商务',1)
  106. //ds_eb.retrieve()
  107. pf_treegrowth(ll_hand,0)
  108. This.ExpandItem(ll_hand)
  109. This.SetRedraw(True)
  110. RETURN 0
  111. end function
  112. public subroutine pf_refresh_value (long arg_handl, string arg_rightstr);Long ll_handl
  113. Long ll_funcid
  114. treeviewitem tvi
  115. ll_handl = arg_handl
  116. ll_handl = this.FindItem(ChildTreeItem!,ll_handl)
  117. DO WHILE ll_handl > 0
  118. this.GetItem(ll_handl,tvi)
  119. ll_funcid = long(tvi.Data)
  120. IF NOT ll_funcid = 0 THEN
  121. IF Mid(arg_rightstr,ll_funcid,1) = '0' or Mid(arg_rightstr,ll_funcid,1) = '' THEN
  122. tvi.StatePictureIndex = 1
  123. ELSE
  124. tvi.StatePictureIndex = 2
  125. END IF
  126. END IF
  127. this.SetItem(ll_handl,tvi)
  128. pf_refresh_value(ll_handl,arg_rightstr)
  129. ll_handl = this.FindItem(NextTreeItem!,ll_handl)
  130. LOOP
  131. end subroutine
  132. public subroutine pf_get_value (long arg_handl, ref string arg_rightstr);Long ll_handl
  133. Long ll_funcid
  134. treeviewitem tvi
  135. ll_handl = arg_handl
  136. ll_handl = this.FindItem(ChildTreeItem!,ll_handl)
  137. DO WHILE ll_handl > 0
  138. this.GetItem(ll_handl,tvi)
  139. ll_funcid = long(tvi.Data)
  140. IF NOT ll_funcid = 0 THEN
  141. if tvi.StatePictureIndex = 2 then
  142. arg_rightstr = replace(arg_rightstr,ll_funcid,1, '1')
  143. else
  144. arg_rightstr = replace(arg_rightstr,ll_funcid,1, '0')
  145. end if
  146. END IF
  147. pf_get_value(ll_handl,arg_rightstr)
  148. ll_handl = this.FindItem(NextTreeItem!,ll_handl)
  149. LOOP
  150. end subroutine
  151. public function integer pf_getinfo (long arg_funcid);Int rslt = 1
  152. SELECT funcid, parentid, mainid, functype, treename, menuname, if_use, sortflag, ebtype
  153. INTO :uo_cur_info.funcid,
  154. :uo_cur_info.parentid,
  155. :uo_cur_info.mainid,
  156. :uo_cur_info.functype,
  157. :uo_cur_info.treename,
  158. :uo_cur_info.menuname,
  159. :uo_cur_info.if_use,
  160. :uo_cur_info.sortflag,
  161. :uo_cur_info.ebtype
  162. FROM sys_func_pwr_eb
  163. Where funcid = :arg_funcid;
  164. IF sqlca.SQLCode <> 0 THEN
  165. uo_cur_info.funcid = 0
  166. uo_cur_info.parentid = 0
  167. uo_cur_info.mainid = 0
  168. uo_cur_info.functype = 0
  169. uo_cur_info.treename = ''
  170. uo_cur_info.menuname = ''
  171. uo_cur_info.if_use = 0
  172. uo_cur_info.sortflag = 0
  173. uo_cur_info.ebtype = 0
  174. rslt = 0
  175. GOTO ext
  176. END IF
  177. //
  178. //String ls_parenthandtype
  179. //Long ll_parentid
  180. //
  181. //ll_parentid = uo_cur_info.parentid
  182. //
  183. //IF uo_cur_info.parentid = 0 THEN
  184. // uo_cur_info.parenthandtype = ''
  185. //ELSE
  186. // SELECT areaname
  187. // INTO :ls_parenthandtype
  188. // FROM u_Cusarea
  189. // Where Cusareaid = :ll_parentid;
  190. // IF sqlca.SQLCode <> 0 THEN
  191. // uo_cur_info.parenthandtype = ''
  192. // ELSE
  193. // uo_cur_info.parenthandtype = ls_parenthandtype
  194. // END IF
  195. //END IF
  196. ext:
  197. RETURN rslt
  198. //
  199. //
  200. end function
  201. on uo_ljfieb_tv_pwr.create
  202. end on
  203. on uo_ljfieb_tv_pwr.destroy
  204. end on
  205. event constructor;ds_eb = CREATE datastore
  206. ds_eb.DataObject = 'ds_func_pwr_eb'
  207. ds_eb.SetTransObject(sqlca)
  208. f_maketree()
  209. end event
  210. event selectionchanged;Long ll_hand
  211. Long ll_funcid
  212. TreeViewItem l_tvi
  213. ll_hand = THIS.FindItem(CurrentTreeItem!,0)
  214. IF THIS.GetItem(ll_hand,l_tvi) = 1 THEN
  215. IF ll_hand = 1 THEN
  216. ll_funcid = 0
  217. ELSE
  218. ll_funcid = l_tvi.Data
  219. END IF
  220. pf_getinfo(ll_funcid)
  221. THIS.ExpandItem(ll_hand)
  222. END IF
  223. end event
  224. event destructor;DESTROY ds_eb
  225. end event