gt.ftl 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <#-- 提取java枚举类型-->
  2. <#assign GtType= enum["cn.sinobest.framework.service.tags.Gt$GtType"] >
  3. <#-- 准备用户右对齐的类型,目前知道的是 文本、单选和多选-->
  4. <#assign rightAlign= [GtType.LABEL,GtType.CHECKBOX,GtType.RADIOBOX] >
  5. <#-- 准备动态字典-->
  6. <#assign gtDicts= parameters.gtDicts >
  7. <#-- 准备值-->
  8. <#assign gtValues= parameters.gtValues >
  9. <#-- 查询条件集合-->
  10. <#assign whereClsMap= parameters.whereClsMap!{} >
  11. <#-- 多记录表配置集合-->
  12. <#assign gltMap= parameters.gltMap!{} >
  13. <#-- 快速字典默认表头定义-->
  14. <#assign COMBOBOX_P_HEADER =
  15. [{"field":"AAA102","title":"字典代码","width":60},
  16. {"field":"AAA103","title":"字典值","width":100},
  17. {"field":"AAA101","title":"分类名称","width":120},
  18. {"field":"AAA100","title":"分类代码","width":100}]
  19. >
  20. <#-- 准备单选控件的值-->
  21. <#assign inputSets= {
  22. <#--子类型:[type类型,class名称,最大长度] -->
  23. "p":["text","postbox",6],<#-- 邮件编码-->
  24. "n":["text","numberbox",50],<#-- 只能输入数字-->
  25. "c":["text","chinessbox",50],<#-- 只能输入中文-->
  26. "f":["text","floatbox",50],<#-- 只能输入浮点数-->
  27. "d":["text","yearmonthbox",6],<#-- 只能输入YYYYMM格式的日期-->
  28. "t":["text","timebox",8],<#-- 只能输入时间格式-->
  29. "s":["text","datetime",19],<#-- 只能输入日期+时间 格式-->
  30. "m":["password","textbox",50],<#-- 密码输入框-->
  31. "x":["text","notpastebox",50],<#-- 不能粘贴的输入框-->
  32. "q":["text","searchgrid-text 05q",1000],<#-- 不能粘贴的输入框-->
  33. "y":["text","bankaccount",50],<#-- 银行账号每4位隔开 -->
  34. " ":["text","textbox",50]<#-- 默认-->
  35. }>
  36. <#assign multipleNames = []>
  37. <#--解析单记录表的控件内容 -->
  38. <#macro GT_COMPOMENT v_comp>
  39. <#--控件只读判断 -->
  40. <#assign v_readOnly=((parameters.readOnly!false)||((v_comp.readOnly!"")=="true"))?string("disabled","") />
  41. <#--分控件类型处理 -->
  42. <#switch v_comp.type!"">
  43. <#case GtType.LABEL ><#--处理文本 -->
  44. <#if (v_comp.nClass!"")=="tdprompt_n_v2">
  45. <span class="vldnn" style="font-size:13px;color:red;vertical-align: -11%;font-weight: bold;" >* </span>
  46. <#elseif (v_comp.nClass!"")=="tdprompt_n_v3">
  47. <span class="vldnn" style="font-size:13px;color:red;vertical-align: -11%;font-weight: bold;" >* </span>
  48. </#if>
  49. ${v_comp.label!"&nbsp;"}
  50. <#if v_comp.fdj??><#--处理放大镜 -->
  51. <span style="padding-left:2px" title="${v_comp.fdjhint!"单击可以打开查询窗口"
  52. }"><a href="javascript:void(0)" class="fdj" tabindex="10000" onclick="${v_comp.fdj!"void(0)"}"></a></span>
  53. </#if>
  54. <#break>
  55. <#case GtType.INPUT ><#--处理单行输入控件-->
  56. <#assign inputTmp=inputSets[v_comp.subtype!" "]>
  57. <#assign compValue=gtValues[v_comp.pname]!"">
  58. <#if (compValue?is_sequence)>
  59. <#assign compValue=(compValue[0]?string)!"">
  60. </#if>
  61. <#switch v_comp.subtype!"">
  62. <#case "q">
  63. <input title="${v_comp.tip!""}" type="${inputTmp[0]}" class="${inputTmp[1]}" name="${v_comp.pname!""
  64. }" valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_comp.cus!""} ${v_readOnly} value=${compValue?html}
  65. >
  66. <script language="javascript">
  67. $(function(){
  68. var arr=[];
  69. var columnheaders=${(tojson(gltMap[v_comp.glt][0].colHead))!"{}"};
  70. <#-- 转化列定义,用列表展现-->
  71. jQuery.each(columnheaders,function(indexInArray, valueOfElement){
  72. jQuery.each(valueOfElement,function(indexInArray, valueOfElement2){
  73. if(typeof valueOfElement2['field']=='undefined'){
  74. valueOfElement2['field']=(1+indexInArray).toString();
  75. }
  76. });
  77. });
  78. $('table#${parameters.id} .05q[name="${v_comp.pname!""}"]').filter(function(index){
  79. //避免重复初始化
  80. return $(this).data('_hasinit')==null;
  81. }).data('_hasinit',true).searchgrid({
  82. confid:${tojson(v_comp.glt)!"null"},
  83. whereCls:${(tojson(whereClsMap[v_comp.glt]))!"null"},
  84. url:"${request.contextPath!""}/gltPage.do",
  85. localdb:${v_comp.localdb!"false"},
  86. remotedb:${v_comp.remotedb!"false"},
  87. onselect:${v_comp.onselect!"null"},
  88. width:"${v_comp.ddWidth!"auto"}",
  89. height:"${v_comp.ddHeight!"auto"}",
  90. fieldIndices:[0,0],
  91. textFieldOnly:true,
  92. columns:columnheaders
  93. });
  94. });
  95. </script>
  96. <#break>
  97. <#case "y">
  98. <input title="${v_comp.tip!""}" type="${inputTmp[0]}" class="${inputTmp[1]}" maxlength="${v_comp.maxlength!inputTmp[2]}" name="_HID_${v_comp.pname!""
  99. }" value="${compValue?html}" valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_comp.cus!""} ${v_readOnly}/>
  100. <input type="hidden" name="${v_comp.pname!""}" value="${(compValue)}" class="${inputTmp[1]}hid" />
  101. <#break>
  102. <#default>
  103. <input title="${v_comp.tip!""}" type="${inputTmp[0]}" class="${inputTmp[1]}" maxlength="${v_comp.maxlength!inputTmp[2]}" name="${v_comp.pname!""
  104. }" value="${compValue?html}" valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_comp.cus!""} ${v_readOnly}/>
  105. <#break>
  106. </#switch>
  107. <#break>
  108. <#case GtType.SFZ ><#--处理身份证 -->
  109. <#assign compValue=gtValues[v_comp.pname]!"">
  110. <#if (compValue?is_sequence)>
  111. <#assign compValue=(compValue[0]?string)!"">
  112. </#if>
  113. <input type="text" title="${v_comp.tip!""}" class="idcardbox" maxlength="${v_comp.maxlength!19}" name="${v_comp.pname!""}" value="${compValue?html}"
  114. valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_comp.cus!""} ${v_readOnly}/>
  115. <#break>
  116. <#case GtType.TEXTAREA ><#--处理多行输入控件 -->
  117. <#assign compValue=gtValues[v_comp.pname]!"">
  118. <#if (compValue?is_sequence)>
  119. <#assign compValue=(compValue[0]?string)!"">
  120. </#if>
  121. <#switch v_comp.subtype!""><#case "q">
  122. <textarea class="textareabox 03q" title="${v_comp.tip!""}" rows="${v_comp.rows!3}" name="${v_comp.pname}" valueValidate="${v_comp.valueValidate!""}" vldStr="${
  123. v_comp.vld!((v_comp.label!"")+"="+"l(0-150)")}" ${v_comp.cus!""} ${v_readOnly}>${compValue?html}</textarea>
  124. <script language="javascript">
  125. $(function(){
  126. var arr=[];
  127. var columnheaders=${(tojson(gltMap[v_comp.glt][0].colHead))!"{}"};
  128. <#-- 转化列定义,用列表展现-->
  129. jQuery.each(columnheaders,function(indexInArray, valueOfElement){
  130. jQuery.each(valueOfElement,function(indexInArray, valueOfElement2){
  131. if(typeof valueOfElement2['field']=='undefined'){
  132. valueOfElement2['field']=(1+indexInArray).toString();
  133. }
  134. });
  135. });
  136. $('table#${parameters.id} .03q[name="${v_comp.pname!""}"]').filter(function(index){
  137. //避免重复初始化
  138. return $(this).data('_hasinit')==null;
  139. }).data('_hasinit',true).searchgrid({
  140. confid:${tojson(v_comp.glt)!"null"},
  141. whereCls:${(tojson(whereClsMap[v_comp.glt]))!"null"},
  142. url:"${request.contextPath!""}/gltPage.do",
  143. localdb:${v_comp.localdb!"false"},
  144. remotedb:${v_comp.remotedb!"false"},
  145. onselect:${v_comp.onselect!"null"},
  146. width:"${v_comp.ddWidth!"auto"}",
  147. height:"${v_comp.ddHeight!"auto"}",
  148. fieldIndices:[0,0],
  149. textFieldOnly:true,
  150. columns:columnheaders
  151. });
  152. });
  153. </script>
  154. <#break>
  155. <#default>
  156. <textarea class="textareabox" title="${v_comp.tip!""}" rows="${v_comp.rows!3}" name="${v_comp.pname}" valueValidate="${v_comp.valueValidate!""}" vldStr="${
  157. v_comp.vld!((v_comp.label!"")+"="+"l(0-150)")}" ${v_comp.cus!""} ${v_readOnly}>${compValue?html}</textarea>
  158. <#break>
  159. </#switch>
  160. <#break>
  161. <#case GtType.COMBOBOX ><#--处理字典控件 -->
  162. <#switch v_comp.subtype!"">
  163. <#case "p">
  164. <#assign compValue=gtValues[v_comp.pname]!"">
  165. <#if (compValue?is_sequence)>
  166. <#assign compValue=(compValue[0]?string)!"">
  167. </#if>
  168. <input type="text" title="${v_comp.tip!""}" class="searchgridbox" dsId="${parameters.dsId!""}" subtype="${v_comp.subtype}" name="${v_comp.pname!""
  169. }" textfield="${(gtDicts[v_comp.dname][compValue].AAA103)!""}" value="${
  170. compValue!"10"?html}" ${v_comp.cus!""} valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_readOnly}>
  171. <script language="javascript">
  172. $(function(){
  173. <#if v_comp.colHeads??>
  174. var columnheaders=${tojson(v_comp.colHeads)};
  175. <#else>
  176. var columnheaders=
  177. [{"field":"AAA102","title":"字典代码","width":60},
  178. {"field":"AAA103","title":"字典值","width":100},
  179. {"field":"AAA101","title":"分类名称","width":120},
  180. {"field":"AAA100","title":"分类代码","width":100}];
  181. </#if>
  182. var dicts=${tojson(gtDicts[v_comp.dname!""])!"null"};
  183. var arr=[];
  184. <#-- 转化字典,用列表展现-->
  185. for(key in dicts){
  186. arr.push(dicts[key]);
  187. }
  188. $('table#${parameters.id} .searchgridbox[name="${v_comp.pname!""}"]').filter(function(index){
  189. //避免重复初始化
  190. return $(this).data('_hasinit')==null;
  191. }).data('_hasinit',true).searchgrid({
  192. width:"${v_comp.ddWidth!"auto"}",
  193. height:"${v_comp.ddHeight!"auto"}",
  194. idField:'AAA102',
  195. textField:'AAA103',
  196. initdata:{"rows":arr},
  197. columns:[columnheaders]
  198. });
  199. });
  200. </script>
  201. <#break>
  202. <#case "q">
  203. <#assign compValue=gtValues[v_comp.pname]!"">
  204. <#if (compValue?is_sequence)>
  205. <#assign compValue=(compValue[0]?string)!"">
  206. </#if>
  207. <#assign disaplayValue=gtValues['_DIC_'+v_comp.pname]!"">
  208. <#if (disaplayValue?is_sequence)>
  209. <#assign disaplayValue=(disaplayValue[0]?string)!"">
  210. </#if>
  211. <input type="text" title="${v_comp.tip!""}" class="searchgridbox" dsId="${parameters.dsId!""}" subtype="${v_comp.subtype}" name="${v_comp.pname!""
  212. }" textfield="${(gtDicts[v_comp.dname][compValue].AAA103)!""}" value="${
  213. compValue?html}" ${v_comp.cus!""} valueValidate="${v_comp.valueValidate!""}" vldStr="${v_comp.vld!""}" ${v_readOnly} displayValue="${disaplayValue}">
  214. <script language="javascript">
  215. $(function(){
  216. var arr=[];
  217. var columnheaders=${(tojson(gltMap[v_comp.glt][0].colHead))!{}};
  218. <#-- 在fw_gentbl_conf表的ATTR字段获取05q控件的idfield和attrfield -->
  219. var attr="${(gltMap[v_comp.glt][0].attr)!""}";
  220. var selectstrFields=${(tojson(gltMap[v_comp.glt][0].fields))!{}};<#-- 默认第一个是idfield,第二个是textfield -->
  221. var attrIdField = selectstrFields[0];
  222. var attrTextField = selectstrFields[1];
  223. var attrIdFieldType = "STRING";
  224. var jsonGltAttr = {};
  225. if(attr != ""){
  226. var fields = attr.split("|");
  227. for(var i=0;i<fields.length;i++){
  228. var field = fields[i];
  229. var firstEqualPos = field.indexOf('=');
  230. if(-1 == firstEqualPos ){
  231. continue;
  232. }
  233. var key = field.substring(0,firstEqualPos).toLowerCase();
  234. var value = {};
  235. fieldAttributes = field.split('*');
  236. for(var j=0;j<fieldAttributes.length;j++){
  237. var fieldAttributePair = fieldAttributes[j].split('=');
  238. value[fieldAttributePair[0].toLowerCase()] = fieldAttributePair[1];
  239. }
  240. jsonGltAttr[key] = value;
  241. }
  242. if(jsonGltAttr["idfield"]!=null){
  243. attrIdField = jsonGltAttr["idfield"].idfield;
  244. if(jsonGltAttr["idfield"].type != null){
  245. attrIdFieldType = jsonGltAttr["idfield"].type;
  246. }
  247. }
  248. if(jsonGltAttr["textfield"]!=null){
  249. attrTextField = jsonGltAttr["textfield"].textfield;
  250. }
  251. }
  252. if(null != attrIdField){
  253. attrIdField = attrIdField.toUpperCase();
  254. }
  255. if(null != attrTextField){
  256. attrTextField = attrTextField.toUpperCase();
  257. }
  258. <#-- 转化列定义,用列表展现-->
  259. jQuery.each(columnheaders,function(indexInArray, valueOfElement){
  260. jQuery.each(valueOfElement,function(indexInArray, valueOfElement2){
  261. if(typeof valueOfElement2['field']=='undefined'){
  262. valueOfElement2['field']=(1+indexInArray).toString();
  263. }
  264. });
  265. });
  266. $('table#${parameters.id} .searchgridbox[name="${v_comp.pname!""}"]').filter(function(index){
  267. //避免重复初始化
  268. return $(this).data('_hasinit')==null;
  269. }).data('_hasinit',true).searchgrid({
  270. confid:${tojson(v_comp.glt)!"null"},
  271. whereCls:${(tojson(whereClsMap[v_comp.glt]))!"null"},
  272. url:"${request.contextPath!""}/gltPage.do",
  273. localdb:${v_comp.localdb!"false"},
  274. remotedb:${v_comp.remotedb!"false"},
  275. initshow:${v_comp.initshow!"false"},
  276. onselect:${v_comp.onselect!"null"},
  277. width:"${v_comp.ddWidth!"auto"}",
  278. height:"${v_comp.ddHeight!"auto"}",
  279. idField:attrIdField,
  280. idFieldType:attrIdFieldType,
  281. textField:attrTextField,
  282. fieldIndices:[0,1],
  283. columns:columnheaders
  284. });
  285. });
  286. </script>
  287. <#break>
  288. <#case "m">
  289. <#if !multipleNames?seq_contains(v_comp.pname)>
  290. <#assign multipleNames=multipleNames+[v_comp.pname]>
  291. </#if>
  292. <#assign compValue=gtValues[v_comp.pname]![]>
  293. <#if !(compValue?is_sequence)>
  294. <#assign compValue=[compValue?string]>
  295. </#if>
  296. <select class="incombox mutiplebox" title="${v_comp.tip!""}" name="${v_comp.pname!""}" dsId="${parameters.dsId!""}" dname="${v_comp.dname!""}" vldStr="${v_comp.vld!""}"
  297. ${v_comp.cus!""} ${v_readOnly} displayCol="${v_comp.displayCol!"BOTH"}" <#rt>
  298. fwpanelWidth="${v_comp.ddWidth!"auto"}" <#rt>
  299. fwpanelHeight="${v_comp.ddHeight!"auto"}" <#rt>
  300. onselect="${v_comp.onselect!""}" whereCls=${(tojson(whereClsMap[v_comp.dname]))!""} <#rt>
  301. style="display:none;" dictType="${v_comp.dictType!"default"}" multiple="multiple">
  302. <#list (gtDicts[v_comp.dname]!{})?values as dict>
  303. <#if compValue?seq_contains(dict.AAA102) >
  304. <option value="${dict.AAA102!""}" selected >${dict.AAA102!""}-${dict.AAA103!""}</option>
  305. </#if>
  306. </#list>
  307. <option value=""></option>
  308. </select>
  309. <SPAN class="fwcombox" >
  310. <INPUT class="fwcombox-text" autocomplete="off" ><SPAN class="fwcombox-arrow" ></SPAN>
  311. </SPAN>
  312. <#break>
  313. <#case "s">
  314. <#assign compValue=gtValues[v_comp.pname]!"">
  315. <#if (compValue?is_sequence)>
  316. <#assign compValue=(compValue[0]?string)!"">
  317. </#if>
  318. <select class="combobox" title="${v_comp.tip!""}" name="${v_comp.pname!""}" dsId="${parameters.dsId!""}" dname="${v_comp.dname!""}" vldStr="${v_comp.vld!""}" ${v_comp.cus!""} ${v_readOnly}
  319. fwpanelWidth="${v_comp.ddWidth!"auto"}" <#rt>
  320. fwpanelHeight="${v_comp.ddHeight!"auto"}" <#rt>
  321. onselect="${v_comp.onselect!""}" whereCls=${(tojson(whereClsMap[v_comp.dname]))!""}<#rt>
  322. style="display:none;" dictType="s" >
  323. <#list (gtDicts[v_comp.dname]!{})?values as dict>
  324. <#if dict.AAA102==(compValue?string)>
  325. <option value="${dict.AAA102!""}" selected >${dict.AAA103!""}</option>
  326. <#break>
  327. </#if>
  328. </#list>
  329. <option value=""></option>
  330. </select>
  331. <SPAN class="fwcombox" >
  332. <INPUT class="fwcombox-text" autocomplete="off" ><SPAN class="fwcombox-arrow" ></SPAN>
  333. </SPAN>
  334. <#break>
  335. <#default>
  336. <#assign compValue=gtValues[v_comp.pname]!"">
  337. <#if (compValue?is_sequence)>
  338. <#assign compValue=(compValue[0]?string)!"">
  339. </#if>
  340. <select class="incombox" title="${v_comp.tip!""}" name="${v_comp.pname!""}" dsId="${parameters.dsId!""}" dname="${v_comp.dname!""}" vldStr="${v_comp.vld!""}"
  341. ${v_comp.cus!""} ${v_readOnly} displayCol="${v_comp.displayCol!"BOTH"}" <#rt>
  342. fwpanelWidth="${v_comp.ddWidth!"auto"}" <#rt>
  343. fwpanelHeight="${v_comp.ddHeight!"auto"}" <#rt>
  344. onselect="${v_comp.onselect!""}" whereCls=${(tojson(whereClsMap[v_comp.dname]))!""} <#rt>
  345. style="display:none;" dictType="${v_comp.dictType!"default"}" >
  346. <#list (gtDicts[v_comp.dname]!{})?values as dict>
  347. <#if dict.AAA102==(compValue?string)>
  348. <option value="${dict.AAA102!""}" selected >${dict.AAA102!""}-${dict.AAA103!""}</option>
  349. <#break>
  350. </#if>
  351. </#list>
  352. <option value=""></option>
  353. </select>
  354. <SPAN class="fwcombox" >
  355. <INPUT class="fwcombox-text" autocomplete="off" ><SPAN class="fwcombox-arrow" ></SPAN>
  356. </SPAN>
  357. <#break>
  358. </#switch>
  359. <#break>
  360. <#case GtType.DATEPICKER ><#--处理日期控件 -->
  361. <#assign compValue=gtValues[v_comp.pname]!"">
  362. <#if (compValue?is_sequence)>
  363. <#assign compValue=(compValue[0]?string)!"">
  364. </#if>
  365. <#switch v_comp.subtype!"">
  366. <#case "y">
  367. <input type="text" class="${v_comp.timeClass!"datebox"}" title="${v_comp.tip!""}" name="${v_comp.pname!""}" dateFormat="yyyy-mm" boxLength="${v_comp.boxLength!"5"}" vldStr="${v_comp.vld!""}"
  368. maxlength="${v_comp.maxlength!50}" valueValidate="${v_comp.valueValidate!""}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  369. <#break>
  370. <#case "s">
  371. <input type="text" class="datetimenew" title="${v_comp.tip!""}" dateFormat='yyyy-MM-dd HH:mm:ss' name="${v_comp.pname!""}" vldStr="${v_comp.vld!""}"
  372. maxlength="${v_comp.maxlength!50}" valueValidate="${v_comp.valueValidate!""}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  373. <#break>
  374. <#case "t">
  375. <input type="text" class="datetimenew" title="${v_comp.tip!""}" dateFormat='HH:mm:ss' name="${v_comp.pname!""}" vldStr="${v_comp.vld!""}"
  376. maxlength="${v_comp.maxlength!50}" valueValidate="${v_comp.valueValidate!""}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  377. <#break>
  378. <#case "m">
  379. <input type="text" class="datetimenew" title="${v_comp.tip!""}" dateFormat='yyyy' name="${v_comp.pname!""}" vldStr="${v_comp.vld!""}"
  380. maxlength="${v_comp.maxlength!50}" valueValidate="${v_comp.valueValidate!""}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  381. <#break>
  382. <#default>
  383. <input type="text" class="${v_comp.timeClass!"datebox"}" title="${v_comp.tip!""}" name="${v_comp.pname!""}" vldStr="${v_comp.vld!""}"
  384. maxlength="${v_comp.maxlength!50}" valueValidate="${v_comp.valueValidate!""}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  385. </#switch>
  386. <#break>
  387. <#case GtType.FILE ><#--处理上传控件 -->
  388. <#assign compValue=gtValues[v_comp.pname]!"">
  389. <#if (compValue?is_sequence)>
  390. <#assign compValue=(compValue[0]?string)!"">
  391. </#if>
  392. <input type="file" class="filebox" title="${v_comp.tip!""}" name="${v_comp.pname!""}" vldStr="${v_comp.vld!""}" maxlength="${
  393. v_comp.maxlength!50}" value="${compValue?html}" ${v_comp.cus!""} ${v_readOnly}/>
  394. <#break>
  395. <#case GtType.LINK ><#--处理超级链接 -->
  396. <a href="${v_comp.href!("javascript:void(0)")}" ${v_comp.cus!""} ${v_readOnly} title="${v_comp.tip!""}" >${v_comp.label}</a>
  397. <#break>
  398. <#case GtType.BUTTON ><#--处理按钮-->
  399. <a class="buttonlink" name="${v_comp.pname!""}" href="${v_comp.href!("javascript:void(0)")}" ${v_readOnly} ${v_comp.cus!""} title="${v_comp.tip!""}" >${v_comp.label}</a>
  400. <#break>
  401. <#case GtType.IMG ><#--处理图片-->
  402. <img title="${v_comp.tip!""}" src="${request.contextPath}${v_comp.src!""}" ${v_comp.cus!""} alt="${v_comp.label}" ${v_readOnly}></img>
  403. <#break>
  404. <#case GtType.CHECKBOX >
  405. <#-- 标记该控件多值-->
  406. <#if !multipleNames?seq_contains(v_comp.pname)>
  407. <#assign multipleNames=multipleNames+[v_comp.pname]>
  408. </#if>
  409. <#-- 取控件的值-->
  410. <#assign compValue=gtValues[v_comp.pname]![]>
  411. <#if !(compValue?is_sequence)>
  412. <#assign compValue=[compValue?string]>
  413. </#if>
  414. <#if v_comp.dname??>
  415. <table class="inputSet">
  416. <#list (gtDicts[v_comp.dname]!{})?values?chunk(((v_comp.colNum)?number)!10) as dicts>
  417. <tr>
  418. <#list dicts as dict>
  419. <td align="right">
  420. <label>${dict.AAA103!""}<input title="${v_comp.tip!""}" type="checkbox" class="checkbox" ${v_comp.cus!""} name="${v_comp.pname!""}" value="${dict.AAA102!""}" ${
  421. (compValue?seq_contains(dict.AAA102))?string("checked","")} ${v_readOnly}/></label>
  422. </td>
  423. </#list>
  424. </tr>
  425. </#list>
  426. </table>
  427. <#else>
  428. <label>${v_comp.text}<input title="${v_comp.tip!""}" type="checkbox" class="checkbox" ${v_comp.cus!""} name="${v_comp.pname!""}" value="${v_comp.value!""}" vldStr="${v_comp.vld!""}" ${
  429. (compValue?seq_contains(v_comp.value!""))?string("checked","")} ${v_readOnly}/></label>
  430. </#if>
  431. <#break>
  432. <#case GtType.RADIOBOX >
  433. <#assign compValue=gtValues[v_comp.pname]![]>
  434. <#if !(compValue?is_sequence)>
  435. <#assign compValue=[compValue?string]>
  436. </#if>
  437. <#if v_comp.dname??>
  438. <table class="inputSet">
  439. <#list (gtDicts[v_comp.dname]!{})?values?chunk(((v_comp.colNum)?number)!10) as dicts>
  440. <tr>
  441. <#list dicts as dict>
  442. <td><label>${dict.AAA103!""}<input type="radio" title="${v_comp.tip!""}" class="checkbox" ${v_comp.cus!""} name="${v_comp.pname!""}" value="${dict.AAA102!""}" ${
  443. (compValue?seq_contains(dict.AAA102))?string("checked","")} ${v_readOnly}/></label></td>
  444. </#list>
  445. </tr>
  446. </#list>
  447. </table>
  448. <#else>
  449. <label>${v_comp.text}<input type="radio" title="${v_comp.tip!""}" class="checkbox" ${v_comp.cus!""} name="${v_comp.pname!""}" value="${v_comp.value!""}" vldStr="${v_comp.vld!""}" ${
  450. (compValue?seq_contains(v_comp.value!""))?string("checked","")} ${v_readOnly}/></label>
  451. </#if>
  452. <#break>
  453. <#case GtType.NESTTABLE >
  454. <@GT_TABLE_CONTENT v_comp.gt true/>
  455. <#break>
  456. <#default>
  457. </#switch>
  458. </#macro>
  459. <#--解析单记录表的表单内容模板-->
  460. <#macro GT_TABLE_CONTENT v_gt v_nested>
  461. <#if !v_nested>
  462. <table class="datatable" cellpadding="0" cellspacing="0" border=0 align="center" name="${v_gt.id}1"
  463. id="${v_gt.id}" width=98%>
  464. <#else>
  465. <table class="datatable" cellpadding="0" cellspacing="0" border=0 align="center" >
  466. </#if>
  467. <#-- 计算单记录表中一个td的默认宽度 -->
  468. <#assign def_td_width= ((100/(v_gt.colNum))/100)?string("percent") >
  469. <#assign rowNum = 0 >
  470. <#list v_gt.renders as row><#--行数据生成 -->
  471. <#assign rowNum = rowNum + 1 >
  472. <tr id="${rowNum}" name="${((parameters.rowHid!0)>1 && (parameters.rowHid!0)<=rowNum)?string("trHid","")}" style="display: ${((parameters.rowHid!0)>1 && (parameters.rowHid!0)<=rowNum)?string("none","")}">
  473. <#list row as col><#--列数据生成 -->
  474. <#if (col[0].nClass!"")=="tdprompt_n_v2">
  475. <td width="${col[0].width!def_td_width}" rowspan="${col[0].rowspan!1}" colspan="${col[0].colspan!1}" class="${
  476. rightAlign?seq_contains(col[0].type!"")?string("tdprompt","tdinput")} " <#rt>
  477. <#if col[0].align??>style="text-align:${col[0].align};"</#if> >
  478. <#elseif (col[0].nClass!"")=="tdprompt_n_v3">
  479. <td width="${col[0].width!def_td_width}" rowspan="${col[0].rowspan!1}" colspan="${col[0].colspan!1}" class="${
  480. rightAlign?seq_contains(col[0].type!"")?string("tdprompt","tdinput")} ${"tdprompt_n"}" <#rt>
  481. <#if col[0].align??>style="text-align:${col[0].align};"</#if> >
  482. <#else>
  483. <td width="${((col[0].type!"")==GtType.LABEL)?string(def_td_width,col[0].width!((100/(v_gt.colNum))*(col[0].colspan!1)/100)?string("percent"))}" rowspan="${col[0].rowspan!1}" colspan="${col[0].colspan!1}" class="${
  484. rightAlign?seq_contains(col[0].type!"")?string("tdprompt","tdinput")} ${col[0].nClass!""}" <#rt>
  485. <#if col[0].align??>style="text-align:${col[0].align};"</#if> >
  486. </#if>
  487. <#if (parameters.rowHid!0) == rowNum>
  488. <input id="${parameters.id}_rowHid_init" type="hidden" value="" />
  489. </#if>
  490. <#list col as comp>
  491. <@GT_COMPOMENT comp />
  492. </#list>
  493. </td>
  494. </#list>
  495. </tr>
  496. </#list>
  497. </table>
  498. <#-- 生成单记录表HIDDENT区域-->
  499. <#if v_gt.hiddens??>
  500. <#list v_gt.hiddens as hidden>
  501. <#assign compValue=gtValues[hidden]!"">
  502. <#if (compValue?is_sequence)>
  503. <#assign compValue=compValue[0]?string!"">
  504. </#if>
  505. <input type="hidden" name="${hidden}" value="${compValue?html}"/>
  506. </#list>
  507. </#if>
  508. </#macro>
  509. <#-- 开始生成单记录表脚本-->
  510. <#--若没有标题也没有边框,就不需要DIV也不需要fieldset-->
  511. <#if (parameters.hasTitle!true)||(parameters.hasBorder!true) >
  512. <#--只要标题不要边框-->
  513. <#if parameters.hasBorder!true >
  514. <fieldset class="fieldset" align="center" style="cursor:default;width:95%" >
  515. <#else>
  516. <fieldset align="center" style="border:none;cursor:default;width:95%" >
  517. </#if>
  518. <#if parameters.hasTitle!true ><#-- 生成标题-->
  519. <legend class="legend" style="cursor:hand;" >
  520. <span onclick="_FW.oFtl.fnShowTable('img_${parameters.id}1','div_${parameters.id}')" >
  521. <img id="img_${parameters.id}1" src="${request.contextPath}/themes/default/images/query_icon_right.gif">
  522. </span>
  523. <span title="单击展开或收缩查询条件" onclick="_FW.oFtl.fnShowTable('img_${parameters.id}1','div_${parameters.id}')">
  524. ${parameters.title!(parameters.gt.description!'')}
  525. </span>
  526. </legend>
  527. </#if>
  528. <#if parameters.hasBorder!true ><#-- 生成边框-->
  529. <div id="div_${parameters.id}" class="tablediv">
  530. <#else>
  531. <div id="div_${parameters.id}">
  532. </#if>
  533. <#else>
  534. <div> <#-- 没有边框和标题时需要加一个DIV否则 排在它后面的标签能居中-->
  535. </#if>
  536. <@GT_TABLE_CONTENT parameters.gt false/>
  537. <#-- 标识哪那些是可以多值的-->
  538. <input type="hidden" name="_multiple" value="<#rt/>
  539. <#list multipleNames as name>${name}<#if name_has_next>,</#if></#list>">
  540. <#--若没有标题也没有边框,就不需要DIV-->
  541. <#if (parameters.hasTitle!true)||(parameters.hasBorder!true) >
  542. </div>
  543. </#if>
  544. <#--若没有标题也没有边框,就不需要fieldset-->
  545. <#if (parameters.hasTitle!true)||(parameters.hasBorder!true) >
  546. </fieldset>
  547. <#if ((parameters.rowHid!0) > 1)>
  548. <div align="left" style="display:block;cursor:hand;position:relative;width:95%;top:-10px;left:5px;">
  549. <span id="text_${parameters.id}_rowHid" style="background:#ffffff;" title="单击展开隐藏字段"
  550. onclick="changeMoreImgButton('text_${parameters.id}_rowHid', 'trHid', '${parameters.id}_rowHid_init');">
  551. <img src="${request.contextPath}/themes/default/images/more.gif">
  552. </span>
  553. </div>
  554. </#if>
  555. <#else>
  556. </div>
  557. </#if>
  558. <#--根据配置显示归档查询按钮-->
  559. <#if (parameters.hasArchive) && (parameters.permitArchive) >
  560. <div id="${parameters.id}_archive_div" style="position:absolute;z-index:0;left:0px;top:0px;width:100px;height:100px;display:block;">
  561. <div style="position:absolute;">
  562. <a class="buttonlink" href="javascript:void(0)" name="btnQuery" onclick="queryArchive_${parameters.id}(${parameters.id},_FW.oFtl.fnGetForm($('#${parameters.id}').closest('form')));return false;">归档查询</a>
  563. </div>
  564. </div>
  565. <script>
  566. <#-- 动态加载单点登陆所需JS -->
  567. function queryArchive_${parameters.id}(id,data){
  568. _FW.oFtl.fnLoadScript({
  569. url:contextPath + "/js/fw/encrypt.js",
  570. beforeFunc: function(){return null==document.getElementById("fwencrypt");},
  571. afterFunc: function(script){
  572. if(null != script){
  573. script.id = "fwencrypt";
  574. }
  575. _FW.oFtl.fnLoadScript({
  576. url:contextPath + "/js/fw/encrypt2.js",
  577. beforeFunc: function(){return null==document.getElementById("fwencrypt2");},
  578. afterFunc: function(script){
  579. if(null != script){
  580. script.id = "fwencrypt2";
  581. }
  582. <#--回调单点登陆 -->
  583. queryArchive_${parameters.id}_login(id,data);
  584. }
  585. });
  586. }
  587. });
  588. }
  589. <#--单点登陆 -->
  590. function queryArchive_${parameters.id}_login(id,data){
  591. ssoLogin("${parameters.archiveUrl}",readCookie("LOGINID"),getSsoUid(),
  592. function(jsonpdata){
  593. if(data.FHZ<0){
  594. alert(jsonpdata.MSG);
  595. return;
  596. }else{
  597. <#--回调归档查询 -->
  598. _queryArchive_${parameters.id}(id,data);
  599. }
  600. }
  601. );
  602. }
  603. <#--真正的归档查询的代码,主要是拼接url参数字符串,然后在新窗口打开-->
  604. function _queryArchive_${parameters.id}(id,data){
  605. var querystr = "";
  606. for(var key in data){
  607. querystr += "&"+key+"="+encodeURIComponent(data[key]);
  608. }
  609. querystr += "&archiveGtId=" + encodeURIComponent(id);
  610. <#--检查gt是否在一个Tab里面,如果是在一个Tab里面,则获取Tab的顺序号,为了让归档页面自动打开相应的Tab-->
  611. var $tabPanel = $('#${parameters.id}').closest('div.ui-tabs-panel');
  612. if(0 != $tabPanel.size()){
  613. var tabPanelId = $tabPanel.attr("id");
  614. var number = parseInt(tabPanelId.substring(tabPanelId.lastIndexOf("-")+1),10)-1;
  615. querystr += "&selectedTabNo=" + number;
  616. }
  617. var href = document.location.href;
  618. if(href.indexOf('?')==-1 && querystr.length>2){
  619. querystr = '?' + querystr.substring(1);
  620. }
  621. querystr += "&t="+new Date().getTime();
  622. var destHref = "";
  623. for(var i=0,count=0,len=href.length;i<len;i++){
  624. if('/'==href.charAt(i)){
  625. count++;
  626. }
  627. if(4==count){
  628. destHref = "${parameters.archiveUrl}"+href.substring(i)+querystr;
  629. break;
  630. }
  631. }
  632. var url = destHref;
  633. var position = "resizable:1;status:0;help:0;scroll:1;center:1;dialogWidth:1024px;dialogHeight:600px";
  634. window.showModelessDialog(url,window,position);
  635. }
  636. </script>
  637. </#if>
  638. <#-- 生成单记录表对应js脚本的区域-->
  639. <script language="javascript">
  640. $(function(){
  641. if($(${parameters.id}).data('_init')){return;}
  642. //标志已经初始化,无需重新初始化
  643. $(${parameters.id}).data('_init',true);
  644. <#if !(parameters.showContent!true)>
  645. _FW.oFtl.fnShowTable('img_${parameters.id}1','div_${parameters.id}')
  646. </#if>
  647. _FW.oFtl.fnInitObject('${parameters.id}');
  648. //响应窗体的重新排列事件
  649. $(window).resize(function(){_FW.oFtl.fnResizeFWObj(${parameters.id});});
  650. //最后再重新排列下,原字典控件的宽度可能会变化,而导致不对齐
  651. _FW.oFtl.fnResizeFWObj(${parameters.id});
  652. <#--归档查询按钮定位-->
  653. <#if (parameters.hasArchive) && (parameters.permitArchive) >
  654. <#--在收缩或者展开fieldset的时候是否需要同时调整归档查询按钮的位置-->
  655. var needMoveArchiveBtn = "true";
  656. <#if !(parameters.hasTitle!true)&&!(parameters.hasBorder!true) >
  657. var _archiveTop = $("#${parameters.id}").offset().top + $("#${parameters.id}").outerHeight()+5 ;
  658. var _archiveLeft = $("#${parameters.id}").offset().left + $("#${parameters.id}").outerWidth()-84;
  659. ${parameters.id}_archive_div.style.top = _archiveTop;
  660. ${parameters.id}_archive_div.style.left = _archiveLeft;
  661. needMoveArchiveBtn = "false";<#--由于gt没有配置fieldset,所以归档按钮的层是位于开发人员自定义的fieldset里面,所以不需要重新定位归档按钮-->
  662. <#else>
  663. var _archiveTop = $("#${parameters.id}").offset().top + $("#${parameters.id}").outerHeight()+8 ;
  664. var _archiveLeft = $("#${parameters.id}").offset().left + $("#${parameters.id}").outerWidth()-74;
  665. ${parameters.id}_archive_div.style.top = _archiveTop;
  666. ${parameters.id}_archive_div.style.left = _archiveLeft;
  667. </#if>
  668. <#--在包围框fieldset设置单记录表的ID-->
  669. var $parent = $("#${parameters.id}");
  670. while($parent != null && $parent.get(0).tagName != null){
  671. if("fieldset" == $parent.get(0).tagName.toLowerCase()){
  672. $parent.get(0).fwgtid = "${parameters.id}";
  673. $parent.get(0).needMoveArchiveBtn = needMoveArchiveBtn;
  674. break;
  675. }else{
  676. $parent = $parent.parent();
  677. }
  678. }
  679. </#if>
  680. });
  681. function _gt_${parameters.id}_getParam(){
  682. var param={};
  683. param.actionType="${parameters.actionType}";
  684. param.actionID="${parameters.actionID}";
  685. return param;
  686. }
  687. function changeMoreImgButton(textId, trId, initId){
  688. var initObj = $("input[id='"+initId+"']");
  689. var text = "";
  690. $("tr[name='"+trId+"']").each(function () {
  691. if(this.style.display == "none"){
  692. this.style.display = "";
  693. if(initObj.value != 1){
  694. $(':input', this).each(function(){
  695. CFW.oGt._fnObjInit(this);
  696. });
  697. }
  698. text = "&nbsp;收起&nbsp;";
  699. }else{
  700. this.style.display = "none";
  701. text = "<img src='${request.contextPath}/themes/default/images/more.gif'>"
  702. }
  703. });
  704. document.getElementById(textId).innerHTML=text;
  705. }
  706. </script>