MDomItem.js 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. /*
  2. DOMElement管理类
  3. 外部方法:
  4. get( textOrValue ) 参数"text"或"value" 获取文本或值
  5. getValue() 获取值
  6. getText() 获取文本
  7. getModifiedValue() 获取修改过的值,如果没有修改过返回null
  8. getModifiedText() 获取修改过的文本,如果没有修改过返回null
  9. setValue() 设置对象的值
  10. resetType( type ) 修改类型
  11. resetItemOptions( selectValue[, selectText ]) 修改可选项,selectValue可项值,selectText可选文本
  12. dispose() 清空对象
  13. verify( isShowWarning ) 参数isShowWarning,校验不通过的是否提示用户。根据isShowWarning参数和options的notEmpty、warningType、validRule属性校验对象,返回boolean
  14. */
  15. var MDomItem = new Class({
  16. Implements: [Options, Events],
  17. options : {
  18. existItem : null, //已经存在的对象
  19. existName : null, //已经存在的字段,按 name 取
  20. existId : null, //已经存在的字段,按 id 取
  21. /*
  22. attachment : [
  23. { name : aaa.doc , size : 333 , id : xxxx },
  24. { name : bbb.doc , size : 444 , id : xxxx },
  25. ]
  26. */
  27. objectId : "",
  28. name : "", //生成的对象的name属性
  29. value : "", //对象的值
  30. text : "", //对应的中文名称
  31. type : "text", //可以为 text,innertext, radio,checkbox,select,multiselect,img,button,hidden,rtf
  32. isEdited : true,
  33. tType : "", //type 为text时候有效,可以为 number,date,time, datetime,person,company,department, identity,
  34. count : 1, //如果是多选,多选的上限值,0表示无限制,默认为1,
  35. departments : [], //tType 为 identity、person、department时的,部门选择范围,
  36. companys : [], //tType 为 identity、person、department时的,公司选择范围
  37. //可以传入json 如 : { change : function(){alert("change " + this.name );}, click : function(){alert("click " + this.name) } }
  38. //或 字符串 : "{ change : function(){alert('change ' + this.name );}, click : function(){alert('click ' + this.name) } }"
  39. //或字符串: "change^^function(){alert('change ' + this.name );##click^^function(obj){alert('click ' + this.name);}"
  40. event : null, //需要绑定的事件
  41. selectValue : "", //选择性控件的可选值
  42. selectText : "", //选择型控件的可选文本
  43. defaultValue : "", //默认值
  44. className : "", //类
  45. style : {}, //样式
  46. attr : {}, //其他参数, 比如 " {readonly : true, size : '20' }"
  47. notEmpty : false, //是否允许为空,默认允许
  48. defaultValueAsEmpty: false, //检查空值时,默认值是否为空
  49. emptyTip : null, //为空时的提示,可以不设置
  50. //alert 或者 batch 或者 single,单个提醒或者批量提醒
  51. warningType : "batch",
  52. //可以传入校验类型或自定义方法,如
  53. //{email : true , url : true, date : true, dateISO : true, number : true, digits : true,
  54. // maxlength:5, minlength:10, rangelength:[5,10], max:5, min:10 ,range:[5,10], extension: ["xls","xlsx"],fun : function(){}
  55. // }
  56. validRule : null,
  57. //validMessage和validRule的对应,出错是提示的信息,如 {email : "请输入正确格式的电子邮件", fun : "请输入正确的密码"},如果不设置,默认如下:
  58. // { email: "请输入正确格式的电子邮件",
  59. // url: "请输入合法的网址",
  60. // date: "请输入合法的日期",
  61. // dateISO: "请输入合法的日期 (ISO).",
  62. // number: "请输入合法的数字",
  63. // digits: "只能输入整数",
  64. // maxlength: this.format("请输入一个 长度最多是 {0} 的字符串"),
  65. // minlength: this.format("请输入一个 长度最少是 {0} 的字符串"),
  66. // rangelength: this.format("请输入 一个长度介于 {0} 和 {1} 之间的字符串"),
  67. // range: this.format("请输入一个介于 {0} 和 {1} 之间的值"),
  68. // max: this.format("请输入一个最大为{0} 的值"),
  69. // min: this.format("请输入一个最小为{0} 的值"),
  70. // fun : "请输入正确的"+ this.options.text
  71. // }
  72. validMessage : null,
  73. RTFConfig : null //CKEditor 的设置项
  74. },
  75. initialize: function (container, options , form, app, css ) {
  76. this.form = form
  77. this.app = app;
  78. this.container = $(container);
  79. this.css = css;
  80. for(var o in options ){ //允许使用 function 来计算设置, on开头的属性被留作 fireEvent
  81. if( o != "validRule" && o!="validMessage" && o.substr(0,2)!="on" && typeOf( options[o] )== "function" ){
  82. options[o] = options[o].call();
  83. }
  84. }
  85. this.setOptions(options);
  86. this.unsetClassType = ["radio","checkbox","select","multiselect","img","button","hidden"];
  87. this.valSeparator = /,|;|\^\^|\|/; //如果是多值对象,作为用户选择的多个值的分隔符
  88. //this.parent = parent;
  89. this.mElement = null; //容器
  90. this.items = [];
  91. },
  92. load: function () {
  93. this.fireEvent("queryLoad");
  94. if( this.options.existItem || this.options.existName || this.options.existId ){
  95. this.processExist();
  96. }else{
  97. this.createElement();
  98. }
  99. this.fireEvent("postLoad");
  100. },
  101. processExist: function(){
  102. var self = this;
  103. var items , type;
  104. if( this.options.existItem ){
  105. items = $$( this.options.existItem );
  106. }else if( this.options.existName ){
  107. items = $$( "[name='"+this.options.existName+"']" );
  108. }else if( this.options.existId ){
  109. items = $$( "#"+this.options.existId );
  110. }
  111. if( !this.container ){
  112. this.mElement = this.container = items[0].getParent();
  113. }
  114. this.options.type = this.options.type || this.getType( item[0] );
  115. this.options.name = this.options.name || item[0].get("name");
  116. this.options.value = this.options.value || this.getValue( this.options.name );
  117. items.each(function(item){
  118. if( this.options.className ){
  119. item.setStyles( this.options.className );
  120. }
  121. if( this.options.style && typeof this.options.style == "object"){
  122. item.setStyles( this.options.style );
  123. }
  124. var event = this.options.event;
  125. this.bindEvent(item, event, type);
  126. }.bind(this))
  127. this.items = items;
  128. },
  129. createElement:function(){
  130. var _self = this;
  131. var item;
  132. var values;
  133. var type = this.options.type;
  134. if( !type || type=="" )type="text";
  135. var tType = this.options.tType;
  136. var name = this.options.name;
  137. var value ;
  138. if( typeOf( this.options.value ) === "boolean" ){
  139. value = this.options.value.toString();
  140. }else{
  141. value = this.options.value || this.options.defaultValue
  142. }
  143. var selectValue = this.options.selectValue || this.options.selectText;
  144. var selectText = this.options.selectText || this.options.selectValue ;
  145. var event = this.options.event;
  146. var styles = this.options.style || {};
  147. var attr = this.options.attr || {};
  148. var isEdited = this.options.isEdited;
  149. var parent = this.mElement = this.container ;
  150. var className = null ;
  151. if( this.options.className == "none" ){
  152. }else if( this.options.className != "") {
  153. className = this.options.className
  154. }else if( !isEdited ){
  155. }else{
  156. switch( type.toLowerCase() ){
  157. case "text" :
  158. if( !tType ){
  159. className = "inputText";
  160. }else if( tType == "number" ){
  161. className = "inputText";
  162. }else if( tType == "time" || tType == "date" || tType.toLowerCase() == "datetime" ){
  163. className = "inputTime";
  164. }else if( tType == "person" || tType == "department" || tType == "company" || tType == "identity"){
  165. className = "inputPerson";
  166. }else{
  167. className = "inputText";
  168. }
  169. break;
  170. case "number" : className = "inputText";
  171. break;
  172. case "password" : className = "inputPassword";
  173. break;
  174. case "radio" : className = "inputRadio";
  175. break
  176. case "checkbox" : className = "inputCheckbox";
  177. break
  178. case "select" : className = "inputSelect";
  179. break;
  180. case "multiselect" : className = "inputMultiselect";
  181. break;
  182. case "img" :
  183. break;
  184. case "textarea" : className = "inputTextarea";
  185. break;
  186. case "button": className = "inputButton";
  187. break;
  188. case "hidden":
  189. break;
  190. case "innertext":
  191. break;
  192. case "rtf":
  193. break;
  194. case "file": className = "inputFile";
  195. break;
  196. case "attachment": className = "inputFile";
  197. break;
  198. default : className = "inputText";
  199. }
  200. }
  201. if( isEdited ){
  202. switch( type.toLowerCase() ){
  203. case "text" :
  204. item = new Element( "input", {
  205. "type" : "text",
  206. "name" : name,
  207. "value" : value
  208. });
  209. item.set( attr );
  210. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  211. item.setStyles( styles );
  212. this.bindEvent(item,event,type,tType);
  213. if(parent)item.inject(parent);
  214. this.items.push( item );
  215. break;
  216. case "password" :
  217. item = new Element( "input", {
  218. "type" : "password",
  219. "name" : name,
  220. "value" : value
  221. });
  222. item.set( attr );
  223. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  224. item.setStyles( styles );
  225. this.bindEvent(item,event,type,tType);
  226. if(parent)item.inject(parent);
  227. this.items.push( item );
  228. break;
  229. case "radio" :
  230. selectValues = typeOf( selectValue ) == "array" ? selectValue : selectValue.split( this.valSeparator );
  231. selectTexts = typeOf( selectText ) == "array" ? selectText : selectText.split(this.valSeparator);
  232. for( i=0;i<selectValues.length;i++){
  233. item = new Element( "div");
  234. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  235. item.setStyles( styles );
  236. var input = new Element( "input", {
  237. "type" : "radio",
  238. "name" : name,
  239. "value" : selectValues[i],
  240. "checked" : selectValues[i] == value
  241. }).inject( item );
  242. input.set( attr );
  243. var textNode = new Element( "span", {
  244. "text" : selectTexts[i]
  245. }).inject(item);
  246. textNode.addEvent("click", function(){
  247. this.input.checked = ! this.input.checked;
  248. }.bind( {input : input} ) )
  249. this.bindEvent(item,event,type);
  250. if(parent)item.inject(parent);
  251. this.items.push( item );
  252. }
  253. break;
  254. case "checkbox" :
  255. values = typeOf( value ) == "string" ? value.split(this.valSeparator) : value ;
  256. values = typeOf( value ) == "array" ? value : [value];
  257. selectValues = typeOf( selectValue ) == "array" ? selectValue : selectValue.split( this.valSeparator );
  258. selectTexts = typeOf( selectText ) == "array" ? selectText : selectText.split(this.valSeparator);
  259. for( i=0;i<selectValues.length;i++){
  260. item = new Element( "div");
  261. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  262. item.setStyles( styles );
  263. var input = new Element( "input", {
  264. "type" : "checkbox",
  265. "name" : name,
  266. "value" : selectValues[i],
  267. "checked" : values.contains( selectValues[i] )
  268. }).inject( item );
  269. input.set( attr );
  270. var textNode = new Element( "span", {
  271. "text" : selectTexts[i]
  272. }).inject(item)
  273. textNode.addEvent("click", function(){
  274. this.input.checked = ! this.input.checked;
  275. }.bind( {input : input} ) )
  276. this.bindEvent(item,event,type);
  277. if(parent)item.inject(parent);
  278. this.items.push( item );
  279. }
  280. break;
  281. case "select" :
  282. item = new Element( "select" , {
  283. "name" : name
  284. });
  285. item.set( attr );
  286. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  287. item.setStyles( styles );
  288. selectValues = typeOf( selectValue ) == "array" ? selectValue : selectValue.split( this.valSeparator );
  289. selectTexts = typeOf( selectText ) == "array" ? selectText : selectText.split(this.valSeparator);
  290. for( i=0;i<selectValues.length;i++){
  291. new Element("option" , {
  292. "value" : selectValues[i],
  293. "selected" : selectValues[i] == value,
  294. "text" : selectTexts[i]
  295. }).inject(item)
  296. }
  297. this.bindEvent(item,event,type);
  298. if(parent)item.inject(parent);
  299. this.items.push( item );
  300. break;
  301. case "multiselect" :
  302. values = typeOf( value ) == "string" ? value.split(this.valSeparator) : value ;
  303. values = typeOf( value ) == "array" ? value : [value];
  304. item = new Element( "select" , {
  305. "name" : name,
  306. "multiple" : true
  307. });
  308. item.set( attr );
  309. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  310. item.setStyles( styles );
  311. selectValues = typeOf( selectValue ) == "array" ? selectValue : selectValue.split( this.valSeparator );
  312. selectTexts = typeOf( selectText ) == "array" ? selectText : selectText.split(this.valSeparator);
  313. for( i=0;i<selectValues.length;i++){
  314. new Element("option" , {
  315. "value" : selectValues[i],
  316. "selected" : values.contains( selectValues[i] ),
  317. "text" : selectTexts[i]
  318. }).inject(item)
  319. }
  320. this.bindEvent(item,event,type);
  321. if(parent)item.inject(parent);
  322. this.items.push( item );
  323. break;
  324. case "img" :
  325. item = new Element( "img", {
  326. "name" : name,
  327. "src" : value
  328. })
  329. item.set( attr );
  330. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  331. item.setStyles( styles );
  332. this.bindEvent(item,event,type);
  333. if(parent)item.inject(parent);
  334. this.items.push( item );
  335. break;
  336. case "textarea" :
  337. item = new Element( "textarea", {
  338. "name" : name,
  339. "value" : value
  340. })
  341. item.set( attr );
  342. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  343. item.setStyles( styles );
  344. this.bindEvent(item,event,type);
  345. if(parent)item.inject(parent);
  346. this.items.push( item );
  347. break;
  348. case "button":
  349. item = new Element( "button", {
  350. "name" : name,
  351. "value" : value,
  352. "text" : value
  353. })
  354. item.set( attr );
  355. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  356. item.setStyles( styles );
  357. this.bindEvent(item,event,type);
  358. if(parent)item.inject(parent);
  359. this.items.push( item );
  360. break;
  361. case "hidden":
  362. item = new Element( "input", {
  363. "type" : "hidden",
  364. "name" : name,
  365. "value" : value,
  366. "styles" : styles
  367. })
  368. item.set( attr );
  369. //this.bindEvent(item,event,type);
  370. if(parent)item.inject(parent);
  371. this.items.push( item );
  372. break;
  373. case "innertext":
  374. if( this.options.selectValue && this.options.selectText ){
  375. value = this.replaceText( value, this.options.selectValue , this.options.selectText );
  376. value = value.join(",");
  377. }
  378. item = new Element( "span", {
  379. "name" : name,
  380. "text" : value
  381. })
  382. item.set( attr );
  383. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  384. item.setStyles( styles );
  385. this.bindEvent(item,event,type);
  386. if(parent)item.inject(parent);
  387. this.items.push( item );
  388. break;
  389. case "rtf":
  390. COMMON.AjaxModule.load("ckeditor", function(){
  391. var item = new Element("div",{
  392. "name" : name,
  393. "id" : name
  394. });
  395. item.set( attr );
  396. if(parent)item.inject(parent);
  397. if( value )item.set("html", value);
  398. var editorConfig = {
  399. //"autoGrow_maxHeight": 400,
  400. //"autoGrow_minHeight": 300,
  401. "resize_enabled": true,
  402. //"resize_maxHeight": "3000",
  403. //"resize_minHeight": "200",
  404. "autoParagraph": true,
  405. "autoUpdateElement": true,
  406. "enterMode": 1,
  407. //"height": "200",
  408. //"width": "",
  409. "readOnly": false
  410. };
  411. if( this.options.RTFConfig ){
  412. editorConfig = Object.merge( editorConfig, this.options.RTFConfig )
  413. }
  414. if( !editorConfig.filebrowserFilesImage && !editorConfig.cloudFileDisable ){
  415. editorConfig.filebrowserFilesImage = function( e, callback ){
  416. MWF.xDesktop.requireApp("File", "FileSelector", function(){
  417. _self.selector_cloud = new MWF.xApplication.File.FileSelector( document.body ,{
  418. "style" : "default",
  419. "title": "选择云文件图片",
  420. "toBase64" : true,
  421. "listStyle": "preview",
  422. "selectType" : "images",
  423. "onPostSelectAttachment" : function(url, base64File){
  424. if(callback)callback(url, base64File);
  425. }
  426. });
  427. _self.selector_cloud.load();
  428. }, true);
  429. }
  430. }
  431. this.editor = CKEDITOR.replace(item, editorConfig);
  432. this.items.push( this.editor );
  433. }.bind(this));
  434. break;
  435. case "file" :
  436. item = new Element( "input", {
  437. "type" : "file",
  438. "name" : name,
  439. "id" : name,
  440. "value" : value
  441. })
  442. item.set( attr );
  443. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  444. item.setStyles( styles );
  445. this.bindEvent(item,event,type);
  446. if(parent)item.inject(parent);
  447. this.items.push( item );
  448. break;
  449. default :
  450. item = new Element( "input", {
  451. "type" : "text",
  452. "name" : name,
  453. "value" : value
  454. })
  455. item.set( attr );
  456. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  457. item.setStyles( styles );
  458. this.bindEvent(item,event,type);
  459. if(parent)item.inject(parent);
  460. this.items.push( item );
  461. }
  462. }else{
  463. switch( type.toLowerCase() ){
  464. case "radio" :
  465. case "checkbox" :
  466. case "select" :
  467. case "multiselect" :
  468. case "innertext":
  469. if( this.options.selectValue && this.options.selectText ){
  470. value = this.replaceText( value, this.options.selectValue , this.options.selectText );
  471. value = value.join(",");
  472. }
  473. item = new Element( "span", {
  474. "name" : name,
  475. "text" : value
  476. })
  477. item.set( attr );
  478. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  479. item.setStyles( styles );
  480. if(parent)item.inject(parent);
  481. this.items.push( item );
  482. break;
  483. case "img" :
  484. item = new Element( "img", {
  485. "name" : name,
  486. "src" : value
  487. })
  488. item.set( attr );
  489. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  490. item.setStyles( styles );
  491. this.bindEvent(item,event,type);
  492. if(parent)item.inject(parent);
  493. this.items.push( item );
  494. break;
  495. case "button":
  496. item = new Element( "button", {
  497. "name" : name,
  498. "value" : value,
  499. "text" : value
  500. })
  501. item.set( attr );
  502. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  503. item.setStyles( styles );
  504. this.bindEvent(item,event,type);
  505. if(parent)item.inject(parent);
  506. this.items.push( item );
  507. break;
  508. case "hidden":
  509. item = new Element( "input", {
  510. "type" : "hidden",
  511. "name" : name,
  512. "value" : value,
  513. "styles" : styles
  514. })
  515. item.set( attr );
  516. //this.bindEvent(item,event,type);
  517. if(parent)item.inject(parent);
  518. this.items.push( item );
  519. break;
  520. case "rtf":
  521. item = new Element( "span", {
  522. "name" : name,
  523. "html" : value
  524. })
  525. item.set( attr );
  526. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  527. item.setStyles( styles );
  528. if(parent)item.inject(parent);
  529. this.items.push( item );
  530. break;
  531. case "file" :
  532. item = new Element( "input", {
  533. "type" : "file",
  534. "name" : name,
  535. "id" : name,
  536. "value" : value
  537. });
  538. item.set( attr );
  539. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  540. item.setStyles( styles );
  541. this.bindEvent(item,event,type);
  542. if(parent)item.inject(parent);
  543. this.items.push( item );
  544. break;
  545. case "text" :
  546. case "textarea" :
  547. default :
  548. item = new Element( "span", {
  549. "name" : name,
  550. "text" : value
  551. });
  552. item.set( attr );
  553. if( className && this.css && this.css[className] )item.setStyles( this.css[className] );
  554. item.setStyles( styles );
  555. if(parent)item.inject(parent);
  556. this.items.push( item );
  557. break;
  558. }
  559. }
  560. //this.mElement = parent;
  561. // this.mElement.inject( this.container );
  562. return parent;
  563. },
  564. replaceText : function( value, selectValue, selectText ){
  565. var vals = typeOf( value ) == "array" ? value : value.split(this.valSeparator);
  566. var selectValues = typeOf( selectValue ) == "array" ? selectValue : selectValue.split( this.valSeparator );
  567. var selectTexts = typeOf( selectText ) == "array" ? selectText : selectText.split(this.valSeparator);
  568. for( var i=0 ;i<vals.length; i++ ){
  569. for( var j= 0; j<selectValues.length; j++){
  570. if( vals[i] == selectValues[j] ){
  571. vals[i] = selectTexts[j]
  572. }
  573. }
  574. }
  575. return vals;
  576. },
  577. bindEvent: function(item,events,type,tType){
  578. if( tType ) this.bindTTypeEvent( item,tType );
  579. if( !events || events == "" || events == "$none" )return;
  580. var _self = this;
  581. if( typeof events == "string" ){
  582. if( events.indexOf("^^") > -1 ){
  583. var eventsArr = events.split("##");
  584. if( eventsArr[0].split("^^").length != 2 )return;
  585. events = {};
  586. for(var i=0;i<eventsArr.length;i++){
  587. var ename = eventsArr[i].split("^^")[0];
  588. var efunction = eventsArr[i].split("^^")[1];
  589. events[ ename ] = eval( "(function(){ return "+ efunction +" })()" ) //字符串变对象或function,方法1
  590. }
  591. }else{
  592. //字符串变对象或function,方法2
  593. eval( "var events = " + events );
  594. }
  595. }
  596. if( typeOf(events) == "object" ){
  597. for( var e in events ){
  598. //jquery的写法
  599. //item.bind( e, { fun : events[e] }, function( event ){
  600. //this 是触发事件的对象,self是当前jDomItem对象
  601. //event.data.fun.call( this, _self );
  602. //})
  603. //方法固定,把参数作为this指正传给方法,需要在方法体里通过this获取参数
  604. //item.addEvent( e, events[e].bind({"item": item, "_self":_self}));
  605. //参数固定,把方法传入到function中,可以在回调方法中直接获取,和jquery的写法一样
  606. item.addEvent( e, function(ev){
  607. this.fun.call( ev ? ev.target : null, _self, ev );
  608. }.bind({fun : events[e]}));
  609. //不一定行
  610. //item.addEvent( e, (function(){
  611. // return function(){
  612. // events[e].call(item,_self);
  613. // }
  614. //})(e));
  615. }
  616. // for( var e in events ){
  617. // if( type && (e=="dblclick" || e=="click") ){
  618. // if( jQuery.inArray( type , this.unsetClassType) == -1 ){
  619. // if( !item.attr("title") || item.attr("title") == "" ){
  620. // item.attr( "title", e=="dblclick" ? "双击选择"+this.options.text : "单击选择"+this.options.text );
  621. // }
  622. // item.removeClass("inputtext").addClass("inputclick");
  623. // break;
  624. // }
  625. // }
  626. // }
  627. }
  628. },
  629. bindTTypeEvent : function( item, tType ){
  630. if( tType == "number" ){
  631. item.addEvent( "keyup" , function(){
  632. this.value=this.value.replace(/[^\d.]/g,'')
  633. } );
  634. }else if( tType == "time" || tType.toLowerCase() == "datetime" || tType == "date" ){
  635. item.addEvent( "click" , function(){
  636. this.selectCalendar( item, tType )
  637. }.bind(this) );
  638. }else if( tType == "person" || tType == "department" || tType == "company" || tType == "identity" ){
  639. item.addEvent( "click" , function(){
  640. this.selectPerson( item, tType )
  641. }.bind(this) );
  642. }
  643. },
  644. selectCalendar : function( item, type ){
  645. this.fireEvent("querySelect", this);
  646. MWF.require("MWF.widget.Calendar", function(){
  647. var calendar = new MWF.widget.Calendar( item, {
  648. "style" : "xform",
  649. "isTime": type == "time" || type.toLowerCase() == "datetime",
  650. "timeOnly": type == "time",
  651. "target": this.app.content
  652. });
  653. calendar.show();
  654. }.bind(this));
  655. },
  656. selectPerson: function( item, type ){
  657. MWF.xDesktop.requireApp("Organization", "Selector.package",null, false);
  658. this.fireEvent("querySelect", this);
  659. var value = item.get("value").split( this.valSeparator );
  660. var options = {
  661. "type": type,
  662. "title": this.options.text,
  663. "count" : this.options.count,
  664. "names": value || [],
  665. "departments" : this.options.departments,
  666. "companys" : this.options.companys,
  667. "onComplete": function(items){
  668. var arr = [];
  669. items.each(function(item){
  670. arr.push(item.data.name);
  671. }.bind(this));
  672. item.set("value",arr.join(","));
  673. this.items[0].fireEvent("change");
  674. }.bind(this)
  675. };
  676. var selector = new MWF.OrgSelector(this.app.content, options);
  677. },
  678. getType : function( item ){
  679. var tag = item.tagName.toLowerCase();
  680. if( tag == "input" ){
  681. type = item.get("type") ? item.get("type").toLowerCase() : "text" ;
  682. }else if( tag == "select" ){
  683. if( item.get("multiple") ){
  684. type = "multiselect";
  685. }else if( item.get("type") && item.get("type").toLowerCase() == "select-multiple" ){
  686. type = "multiselect";
  687. }else{
  688. type = "select";
  689. }
  690. }else{
  691. type = tag;
  692. }
  693. },
  694. get: function( vort , name ){ //value 和 text
  695. var value;
  696. var text;
  697. var type;
  698. var items;
  699. if( !name ){
  700. name = this.options.name;
  701. items = this.mElement.getElements("[name='"+name+"']");
  702. type = this.options.type;
  703. }else{
  704. items = $$( "[name='"+name+"']" );
  705. type = this.getType( items[0] );
  706. }
  707. if( this.options.isEdited ){
  708. switch( type.toLowerCase() ){
  709. case "text":
  710. value = items[0].get("value");
  711. break;
  712. case "password":
  713. value = items[0].get("value");
  714. break;
  715. case "hidden":
  716. value = items[0].get("value");
  717. break;
  718. case "innertext":
  719. text = items[0].get("text");
  720. if( this.options.selectValue && this.options.selectText ){
  721. value = this.replaceText( text, this.options.selectText , this.options.selectValue );
  722. }else{
  723. value = text;
  724. }
  725. break;
  726. case "radio":
  727. items.each(function( el ){
  728. if( el.checked ){
  729. value = el.get("value");
  730. text = el.getParent().get("text").trim();
  731. }
  732. });
  733. break;
  734. case "checkbox":
  735. value = [];
  736. text = [];
  737. items.each(function( el ){
  738. if( el.checked ){
  739. value.push(el.get("value"));
  740. text.push( el.getParent().get("text").trim() )
  741. }
  742. });
  743. break;
  744. case "textarea":
  745. value = items[0].get("value");
  746. break;
  747. case "select":
  748. items[0].getElements("option").each(function(el){
  749. if( el.selected ){
  750. value = el.get("value");
  751. text = el.get("text").trim();
  752. }
  753. });
  754. break;
  755. case "multiselect":
  756. value = [];
  757. text = [];
  758. items[0].getElements("option").each(function(el){
  759. if( el.selected ){
  760. value.push( el.get("value") );
  761. text.push( el.get("text").trim() );
  762. }
  763. });
  764. break;
  765. case "rtf":
  766. if( this.options.RTFConfig && this.options.RTFConfig.isSetImageMaxWidth ){
  767. var div = new Element( "div" , {
  768. "styles" : { "display" : "none" },
  769. "html" : this.editor.getData()
  770. } ).inject( this.container );
  771. div.getElements( "img").each( function( el ){
  772. el.setStyle( "max-width" , "100%" );
  773. });
  774. value = div.get("html");
  775. div.destroy();
  776. }else{
  777. value = this.editor.getData();
  778. }
  779. break;
  780. case "file":
  781. value = items[0].get("value");
  782. break;
  783. default:
  784. value = items[0].get("value");
  785. }
  786. }else{
  787. switch( type.toLowerCase() ){
  788. case "text":
  789. case "textarea":
  790. value = items[0].get("text");
  791. break;
  792. case "hidden":
  793. value = items[0].get("value");
  794. break;
  795. case "innertext":
  796. case "radio":
  797. case "checkbox":
  798. case "select":
  799. case "multiselect":
  800. text = items[0].get("text");
  801. if( this.options.selectValue && this.options.selectText ){
  802. value = this.replaceText( text, this.options.selectText , this.options.selectValue );
  803. }else{
  804. value = text;
  805. }
  806. break;
  807. case "rtf":
  808. value = items[0].get("html");
  809. break;
  810. case "file":
  811. value = items[0].get("value");
  812. break;
  813. default:
  814. value = items[0].get("text");
  815. }
  816. }
  817. if( !value )value="";
  818. if( !text )text = value;
  819. var result = {};
  820. result.value = value;
  821. result.text = text;
  822. if( vort == "value" )return value;
  823. if( vort == "text")return text;
  824. return result;
  825. },
  826. getValue : function( name ){
  827. return this.get( null , name ).value;
  828. },
  829. getText : function( name ){
  830. return this.get( null, name ).text;
  831. },
  832. getModifiedValue : function(){
  833. var value = this.getValue();
  834. return value == this.options.value ? null : value ;
  835. },
  836. getModifiedText : function(){
  837. var value = this.getText();
  838. return text == this.options.text ? null : text ;
  839. },
  840. set : function( type, valueOrText ){
  841. this.setValue( valueOrText )
  842. },
  843. resetItemOptions : function( selectValue, selectText ){
  844. var availTypes = "radio,checkbox,select,multiselect".split( "," );
  845. if( !availTypes.contains( this.options.type ) )return;
  846. this.dispose();
  847. this.options.selectValue = selectValue;
  848. this.options.selectText = selectText;
  849. this.createElement();
  850. },
  851. setValue :function(value){
  852. var items= this.mElement.getElements("[name='"+ this.options.name + "']");
  853. if( this.options.isEdited ){
  854. switch( this.options.type.toLowerCase() ){
  855. case "text":
  856. items[0].set( "value", value );
  857. break;
  858. case "password":
  859. items[0].set( "value", value );
  860. break;
  861. case "hidden":
  862. items[0].set( "value", value );
  863. break;
  864. case "innertext":
  865. items[0].set("text", value );
  866. break;
  867. case "radio":
  868. items.each(function( el ){
  869. if( el.get("value") == value ) this.checked = true;
  870. });
  871. break;
  872. case "checkbox":
  873. values = typeOf( value ) == "array" ? value : value.split("^^");
  874. items.each(function( el ){
  875. if( values.contains( el.get("value") ) != -1 ){
  876. this.checked = true;
  877. }else{
  878. this.checked = false;
  879. }
  880. });
  881. break;
  882. case "textarea":
  883. items[0].set( "value", value );
  884. break;
  885. case "rtf":
  886. this.editor.setData(value);
  887. break;
  888. case "select":
  889. items[0].getElements("option").each(function( el ){
  890. if( el.get("value") == value ) this.selected = true;
  891. });
  892. break;
  893. case "multiselect":
  894. values = typeOf( value ) == "array" ? value : value.split("^^");
  895. items[0].getElements("option").each(function( el ){
  896. if( values.contains( el.get("value") ) != -1 ){
  897. this.selected = true;
  898. }else{
  899. this.selected = false;
  900. }
  901. })
  902. break;
  903. default :
  904. items[0].set( "value", value );
  905. }
  906. }else{
  907. if( this.options.type.toLowerCase() == "rtf" ){
  908. items[0].set("html", value );
  909. }else{
  910. items[0].set("text", value );
  911. }
  912. }
  913. },
  914. setStyles : function( styles ){
  915. this.items.each( function( item ){
  916. item.setStyles( styles )
  917. })
  918. },
  919. getElements : function(){
  920. return this.mElement.getElements("[name='"+this.options.name+"']");
  921. },
  922. dispose : function(){
  923. this.container.empty();
  924. },
  925. verify : function( isShowWarning ){
  926. var flag = true
  927. if( !this.options.isEdited )return flag;
  928. if( this.options.warningType == "batch" ){
  929. if( !this.isNotEmpty(isShowWarning) ) flag = false;
  930. if( !this.checkValid(isShowWarning) ) flag = false;
  931. }else{
  932. if( !this.isNotEmpty(isShowWarning) || !this.checkValid(isShowWarning) ){
  933. return false;
  934. };
  935. }
  936. return flag;
  937. },
  938. isNotEmpty: function( isShowWarning ){
  939. if( !this.options.isEdited )return true;
  940. if( this.options.notEmpty == true || this.options.notEmpty == "yes" ){
  941. if( !this.checkNotEmpty( isShowWarning ) ){
  942. return false;
  943. }
  944. }
  945. return true;
  946. },
  947. checkNotEmpty:function( isShowWarning ){
  948. var value = this.getValue();
  949. var isEmpty = ( typeOf(value) === "array" ? ( value.length == 0 ) : ( value == "" || value == " ") );
  950. if( !isEmpty && this.options.defaultValueAsEmpty ){
  951. isEmpty = ( typeOf(value) === "array" ? ( value.length == 1 && value[0] == this.options.defaultValue ) : ( value == this.options.defaultValue ) );
  952. }
  953. if( !isEmpty ){
  954. this.clearWarning("empty");
  955. return true;
  956. }
  957. if( !isShowWarning )return false;
  958. var text = this.options.text;
  959. var items = this.mElement.getElements("[name='"+ this.options.name + "']");
  960. var warningText = "";
  961. var focus = false;
  962. var focusObj = null;
  963. try{
  964. switch( this.options.type.toLowerCase() ){
  965. case "text":
  966. warningText = this.options.emptyTip || (text+"不能为空");
  967. focus = false;
  968. break;
  969. case "password":
  970. warningText = this.options.emptyTip || (text+"不能为空");
  971. focus = false;
  972. break;
  973. case "hidden":
  974. warningText = this.options.emptyTip || (text+"不能为空");
  975. break;
  976. case "radio":
  977. warningText = this.options.emptyTip || ("请先选择"+text);
  978. break;
  979. case "checkbox":
  980. warningText = this.options.emptyTip || ("请先选择"+text);
  981. break;
  982. case "textarea":
  983. warningText = this.options.emptyTip || (text+"不能为空");
  984. focus = false;
  985. break;
  986. case "select":
  987. warningText = this.options.emptyTip || ("请先选择"+text);
  988. focus = false;
  989. break;
  990. case "multiselect":
  991. warningText = this.options.emptyTip || ("请先选择"+text);
  992. focus = false;
  993. break;
  994. case "file":
  995. warningText = this.options.emptyTip || ("请先上传"+text);
  996. break;
  997. case "attachment":
  998. warningText = this.options.emptyTip || ("请先上传"+text);
  999. break;
  1000. default :
  1001. warningText = this.options.emptyTip || (text+"不能为空");
  1002. focus = false;
  1003. }
  1004. if( this.options.warningType == "batch" ) {
  1005. this.setWarning(warningText, "empty");
  1006. }else if( this.options.warningType == "single" ){
  1007. this.setWarning(warningText, "empty");
  1008. }else{
  1009. this.app.notice(warningText,"error");
  1010. items[0].focus();
  1011. }
  1012. this.fireEvent("empty", this);
  1013. }catch( e ){
  1014. }
  1015. return false;
  1016. },
  1017. clearWarning : function( type ){
  1018. if( this.tipNode && this.setedEmpty ){
  1019. this.fireEvent("unempty", this);
  1020. this.tipNode.empty();
  1021. this.setedEmpty = false;
  1022. }
  1023. if( type == "empty" ){
  1024. if( this.warningEmptyNode ){
  1025. this.fireEvent("unempty", this);
  1026. this.warningEmptyNode.destroy();
  1027. this.warningEmptyNode = null;
  1028. }
  1029. }else{
  1030. if( this.warningInvalidNode ){
  1031. this.fireEvent("unempty", this);
  1032. this.warningInvalidNode.destroy();
  1033. this.warningInvalidNode = null;
  1034. }
  1035. }
  1036. this.warningStatus = false;
  1037. },
  1038. setWarning : function( msg, type ){
  1039. if( type == "empty" ){
  1040. if( this.tipNode ){
  1041. this.setedEmpty = true;
  1042. var div = this.tipNode;
  1043. div.set("html", "");
  1044. }else if( this.warningEmptyNode ){
  1045. var div = this.warningEmptyNode;
  1046. div.set("html", "");
  1047. }else{
  1048. var div = this.warningEmptyNode = new Element("div");
  1049. div.inject( this.container ) ;
  1050. }
  1051. }else{
  1052. if( this.tipNode ){
  1053. this.setedEmpty = true;
  1054. var div = this.tipNode;
  1055. div.set("html", "");
  1056. }else if( this.warningInvalidNode ){
  1057. var div = this.warningInvalidNode;
  1058. div.set("html", "");
  1059. }else{
  1060. var div = this.warningInvalidNode = new Element("div");
  1061. div.inject( this.container ) ;
  1062. }
  1063. }
  1064. this.warningStatus = true;
  1065. if( typeOf(msg) != "array" ){
  1066. msg = [msg];
  1067. }
  1068. msg.each( function(m){
  1069. //var html = "<table style=\"margin-top:3px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
  1070. //html += "<tr valign=\"middle\"><td><img src=\"./img/exclamation.png\" /></td>";
  1071. //html += "<td style=\"width:3px;\"></td><td><div style=\"color:#FF0000; margin-top:2px;\">"+m+"</div></td></tr>";
  1072. //html += "</table>";
  1073. var node = new Element("div",{
  1074. "text" : m,
  1075. "styles" : this.css.warningMessageNode
  1076. }).inject(div)
  1077. }.bind(this))
  1078. },
  1079. checkValid : function( isShowWarning ){
  1080. var value = this.getValue();
  1081. var rules = this.options.validRule;
  1082. if( !rules )return true;
  1083. var msgs = [];
  1084. var flag = true;
  1085. if( value && value != "" && value != " " ){
  1086. for(var r in rules ){
  1087. var valid = true;
  1088. var rule = rules[r];
  1089. if( typeof rule == "function"){
  1090. valid = rule.call( this, value, this );
  1091. }else if( this.validMethod[r] ){
  1092. var method = this.validMethod[r];
  1093. valid = method.call(this, value, rule, this );
  1094. }
  1095. if( !valid && isShowWarning ){
  1096. var msg = this.getValidMessage( r, rule );
  1097. if( msg != "" )msgs.push( msg );
  1098. }
  1099. if( !valid )flag = false;
  1100. }
  1101. }
  1102. if( msgs.length > 0 ){
  1103. if( this.options.warningType == "batch" ) {
  1104. this.setWarning(msgs, "invaild");
  1105. }else if( this.options.warningType == "single" ){
  1106. this.setWarning(msgs, "invaild");
  1107. }else{
  1108. this.app.notice(msgs.join("\n"),"error");
  1109. }
  1110. this.fireEvent("empty", this);
  1111. }else{
  1112. if( this.warningInvalidNode && this.warningInvalidNode.length ){
  1113. this.warningInvalidNode.destroy();
  1114. this.warningInvalidNode = null;
  1115. }
  1116. this.fireEvent("unempty", this);
  1117. }
  1118. return flag;
  1119. },
  1120. validMethod : {
  1121. email: function( value ) {
  1122. return /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
  1123. },
  1124. url: function( value ) {
  1125. return /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
  1126. },
  1127. phoneNumber: function( value ){
  1128. return /^0?1[0-9]\d{9}$/.test( value );
  1129. },
  1130. date: function( value ) {
  1131. return !/Invalid|NaN/.test( new Date( value ).toString() );
  1132. },
  1133. dateISO: function( value ) {
  1134. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
  1135. },
  1136. number: function( value ) {
  1137. return /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
  1138. },
  1139. digits: function( value ) {
  1140. return /^\d+$/.test( value );
  1141. },
  1142. minlength: function( value, param ) {
  1143. return value.length >= param;
  1144. },
  1145. maxlength: function( value, param ) {
  1146. return value.length <= param;
  1147. },
  1148. rangelength: function( value, param ) {
  1149. return ( value.length >= param[ 0 ] && value.length <= param[ 1 ] );
  1150. },
  1151. min: function( value, param ) {
  1152. return value >= param;
  1153. },
  1154. max: function( value, param ) {
  1155. return value <= param;
  1156. },
  1157. range: function( value, param ) {
  1158. return ( value >= param[ 0 ] && value <= param[ 1 ] );
  1159. },
  1160. extension: function( value, param ){
  1161. param = typeOf( param ) == "array" ? param.join("|") : param.replace(/,/g, "|"); //"png|jpe?g|gif";
  1162. return value.match(new RegExp(".(" + param + ")$", "i"));
  1163. }
  1164. },
  1165. getValidMessage : function( type, param ){
  1166. var msg = this.options.validMessage;
  1167. if( msg && typeOf(msg) == "object" ){
  1168. if( msg[type] ){
  1169. if( typeof msg[type] == "function" ){
  1170. return (msg[type]).call(this);
  1171. }else{
  1172. return msg[type];
  1173. }
  1174. }
  1175. }
  1176. switch( type ){
  1177. case "email":
  1178. return "请输入正确格式的电子邮件";
  1179. case "url":
  1180. return "请输入合法的网址";
  1181. case "phoneNumber" :
  1182. return "请输入正确的手机号码"
  1183. case "date":
  1184. return "请输入合法的日期";
  1185. case "dateISO":
  1186. return "请输入合法的日期 .";
  1187. case "number":
  1188. return "请输入合法的数字";
  1189. case "digits":
  1190. return "只能输入整数";
  1191. case "maxlength":
  1192. return "长度不能超过"+ param ;
  1193. case "minlength":
  1194. return "长度不能小于"+ param ;
  1195. case "rangelength":
  1196. return "长度不能要介于"+ param[0] + "和" + param[1] + "之间" ;
  1197. case "range":
  1198. return "请输入一个介于"+ param[0] + " 和 "+ param[1] + "之间的值" ;
  1199. case "min":
  1200. return "请输入一个最小为"+ param +" 的值" ;
  1201. case "max":
  1202. return "请输入一个最大为"+ param +"的值" ;
  1203. case "extension":
  1204. return "请上传" + param + "格式的附件" ;
  1205. default :
  1206. return "请输入正确的"+ this.options.text ;
  1207. }
  1208. }
  1209. });