Record.js 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. MWF.require("MWF.widget.O2Identity", null, false);
  2. MWF.xApplication.CRM.Chance={};
  3. MWF.xDesktop.requireApp("Selector", "package", null, false);
  4. MWF.xApplication.CRM.Record = new Class({
  5. Extends: MWF.xApplication.CRM.Template.PopupForm,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default",
  9. "width": "800",
  10. "height": "100%",
  11. "top" : 0,
  12. "left" : 0,
  13. "hasTop": true,
  14. "hasIcon": false,
  15. "hasBottom": true,
  16. "title": "",
  17. "draggable": false,
  18. "closeAction": true
  19. },
  20. initialize: function (explorer, actions, data, options) {
  21. this.setOptions(options);
  22. this.explorer = explorer;
  23. this.app = explorer.app;
  24. this.lp = this.app.lp.contact.contactEdit;
  25. this.path = "../x_component_CRM/$ClueEdit/";
  26. this.cssPath = this.path + this.options.style + "/css.wcss";
  27. this._loadCss();
  28. this.options.title = this.lp.title;
  29. this.data = data || {};
  30. this.actions = actions;
  31. this.configData = [];
  32. },
  33. load: function () {
  34. that = this;
  35. this.loadResource(function(){
  36. this.createForm();
  37. this.loadEvent();
  38. }.bind(this))
  39. },
  40. loadResource: function ( callback ) {
  41. if(callback)callback();
  42. },
  43. createForm:function(){
  44. var clueName = this.options.openName;
  45. var buttonHtml = '';
  46. var moreHtml = '';
  47. jQuery(".openDiv").notifyMe(
  48. 'right',
  49. 'default',
  50. clueName,
  51. buttonHtml,
  52. moreHtml,
  53. '',
  54. 'notify',
  55. 500,
  56. {"right":"0px","top":"0px"}
  57. );
  58. this.createContentHtml();
  59. },
  60. createContentHtml: function () {
  61. that = this;
  62. var tabConent ="<div class='panes'><div class='pane' id='tab-follow' style='display:block;'><p>First tab content</p></div><div></div>";
  63. jQuery(".notify-content").html(tabConent);
  64. var indexContentHtml = '<div class="log-cont"><div class="log-inner1"><div class="log-inner2"><div class="log-items">'+
  65. '<div class="load"><button type="button" class="el-button el-button--text"></button></div></div>'+
  66. '<div class="empty-mask" style="display: none;"><div class="empty-content"><img src="../x_component_CRM/$Template/empty.png" class="empty-icon"> <p class="empty-text">没有找到数据</p></div></div></div>'+
  67. '<div class="el-loading-mask" style="display: none;"><div class="el-loading-spinner"><svg viewBox="25 25 50 50" class="circular"><circle cx="50" cy="50" r="20" fill="none" class="path"></circle></svg></div></div>'+
  68. '</div></div>';
  69. jQuery("#tab-follow").html(indexContentHtml);
  70. this.actions.listByTypesAndTimeRange(this.options.openId,this.options.filter, function (json) {
  71. if(json.type=="success"){
  72. var recordDatas = json.data;
  73. jQuery(".fl-c").remove();
  74. var logItemHtml = "";
  75. for ( i in recordDatas){
  76. if(i<recordDatas.length){
  77. var recordData = recordDatas[i];
  78. var personImg = '../x_component_CRM/$Template/portrait.png';
  79. if(recordData.ICONBase64 && recordData.ICONBase64!=""){
  80. personImg = recordData.ICONBase64;
  81. }
  82. var attHtml = '';
  83. var relationHtml = '';
  84. if(recordData.attachmentListPreview.length>0){
  85. attHtml = attHtml+'<div class="vux-flexbox fl-b-images vux-flex-row" style="flex-wrap: wrap;"></div>'
  86. }
  87. if(recordData.attachmentList.length>0){
  88. attHtml = attHtml+'<div class="fl-b-files">';
  89. var attList = recordData.attachmentList;
  90. for(j in attList){
  91. if(j<attList.length){
  92. var attData = attList[j];
  93. attHtml = attHtml+'<div class="vux-flexbox cell vux-flex-row">'+
  94. '<img src="../x_component_CRM/$Record/default/icons/att.png" class="cell-head"> <div class="cell-body">'+attData.name+'<span style="color: rgb(204, 204, 204);">('+that.toDecimal(attData.length)+'KB)</span></div>'+
  95. '<button type="button" class="el-button el-button--primary aname" aid="'+attData.id+'" wcrm="'+attData.wcrm+'"><img src="../x_component_CRM/$Record/default/icons/down.png" style="margin-bottom:-3px;"><span>下载</span></button></div>'
  96. }
  97. }
  98. attHtml = attHtml+'</div>';
  99. }
  100. var types = recordData.types;
  101. var atype = "";
  102. var aid = "";
  103. if(types=="customer"){
  104. if(recordData.customer){
  105. atype = recordData.customer.customername;
  106. aid = recordData.customer.id;
  107. }
  108. }
  109. if(types=="leads"){
  110. if(recordData.leads){
  111. atype = recordData.leads.name;
  112. aid = recordData.leads.id;
  113. }
  114. }
  115. if(types=="contacts"){
  116. if(recordData.contacts){
  117. atype = recordData.contacts.contactsname;
  118. aid = recordData.contacts.id;
  119. }
  120. }
  121. if(types=="opportunity"){
  122. if(recordData.opportunity){
  123. atype = recordData.opportunity.name;
  124. aid = recordData.opportunity.id;
  125. }
  126. }
  127. if(aid!=""){
  128. relationHtml = '<div class="vux-flexbox relate-cell vux-flex-row" aid="'+aid+'" atype="'+types+'"><img src="../x_component_CRM/$Record/default/icons/'+types+'.png" class="cell-head">'+
  129. '<div class="relate-cell-body" style="color: rgb(99, 148, 229); cursor: pointer;">'+atype+'</div></div>';
  130. }
  131. logItemHtml = logItemHtml+'<div class="fl-c"><div class="vux-flexbox fl-h vux-flex-row">'+
  132. '<img class="div-photo fl-h-img" src="data:image/png;base64,'+personImg+'" lazy="loaded"></img> '+
  133. '<div class="fl-h-b"><div class="fl-h-name">'+recordData.person.name+'</div><div class="fl-h-time">'+recordData.updateTime+'</div></div></div>'+
  134. '<div class="fl-b"><div class="fl-b-content">'+recordData.content+'</div>'+attHtml+
  135. '<div class="follow"><span class="follow-info">'+recordData.category+'</span></div></div>'+relationHtml+
  136. '<div class="full-container" style="display: none;"></div></div>'
  137. }
  138. }
  139. if(logItemHtml!=""){
  140. jQuery(".load").before(logItemHtml);
  141. }
  142. if(recordDatas.length<1){
  143. jQuery(".empty-mask").show();
  144. }
  145. jQuery(".aname").click(function(){
  146. var attUrl = 'http://172.16.92.55:20020/x_wcrm_assemble_control/jaxrs/attachment/download/'+jQuery(this).attr("aid")+'/work/'+jQuery(this).attr("wcrm")
  147. window.open(attUrl);
  148. /*that.actions.downloadAttachment(jQuery(this).attr("aid"),jQuery(this).attr("wcrm"), function (wjson) {
  149. }.bind(that));*/
  150. });
  151. jQuery(".relate-cell").click(function(){
  152. var openid = jQuery(this).attr("aid");
  153. var openName = jQuery(this).find(".relate-cell-body").text();
  154. if(jQuery(this).attr("atype")=="customer"){
  155. MWF.xDesktop.requireApp("CRM", "CustomerOpen", function(){
  156. that.customer = new MWF.xApplication.CRM.CustomerOpen(that, that.actions,{},{
  157. "openId":openid,
  158. "openName":openName,
  159. "openStyle":{"right":"0px","top":"0px"},
  160. "onReloadView" : function(){
  161. }.bind(that)
  162. });
  163. that.customer.load();
  164. }.bind(that))
  165. }
  166. if(jQuery(this).attr("atype")=="leads"){
  167. MWF.xDesktop.requireApp("CRM", "ClueOpen", function(){
  168. that.customer = new MWF.xApplication.CRM.ClueOpen(that, that.actions,{},{
  169. "clueId":openid,
  170. "clueName":openName,
  171. "openStyle":{"right":"0px","top":"0px"},
  172. "onReloadView" : function(){
  173. }.bind(that)
  174. });
  175. that.customer.load();
  176. }.bind(that))
  177. }
  178. if(jQuery(this).attr("atype")=="contacts"){
  179. MWF.xDesktop.requireApp("CRM", "ContactsOpen", function(){
  180. that.customer = new MWF.xApplication.CRM.ContactsOpen(that, that.actions,{},{
  181. "openId":openid,
  182. "openName":openName,
  183. "openStyle":{"right":"0px","top":"0px"},
  184. "onReloadView" : function(){
  185. }.bind(that)
  186. });
  187. that.customer.load();
  188. }.bind(that))
  189. }
  190. });
  191. }
  192. }.bind(this));
  193. jQuery(".panes").css("height",jQuery("body").children(":first").height()-jQuery(".headNode").height());
  194. },
  195. loadEvent: function(){
  196. that = this;
  197. jQuery('.tabPanel div').click(function(){
  198. jQuery(this).addClass('hit').siblings().removeClass('hit');
  199. jQuery('.panes>div:eq('+jQuery(this).index()+')').show().siblings().hide();
  200. that.createTypeHtml();
  201. });
  202. jQuery('.headMoreBottonDiv').click(function(){
  203. jQuery(".el-dropdown-menu").toggle(100);
  204. });
  205. jQuery('.el-dropdown-menu__item').click(function(){
  206. if(jQuery(this).text()=="删除"){
  207. }
  208. //---for记录类型
  209. if(jQuery(this).parent().attr("tid")=="recordType"){
  210. jQuery(".se-select-name").text(jQuery(this).text());
  211. jQuery(this).parent().toggle(100);
  212. }
  213. });
  214. jQuery('.headMoveBottonDiv').click(function(){
  215. that.transfer();
  216. });
  217. jQuery('.headEditBottonDiv').click(function(){
  218. that.contactsEdit();
  219. });
  220. jQuery('#bar-file').change(function(event) {
  221. var files = event.target.files;
  222. debugger
  223. jQuery('.fileList').empty();
  224. if (files && files.length > 0) {
  225. // 获取目前上传的文件
  226. var fileListHtml = '<div class="fileList">';
  227. for(var i=0;i<files.length;i++){
  228. var file = files[i];
  229. var fsize = file.size/1024;
  230. var lastModifiedDate = file.lastModifiedDate;
  231. fileListHtml = fileListHtml+'<div class="fileItem"><div class="fname">'+file.name+'</div><div class="fsize">'+that.toDecimal(fsize)+'kb</div><div class="ftime">'+that.getFormateTime(lastModifiedDate)+'</div></div>';
  232. }
  233. fileListHtml = fileListHtml+'</div>';
  234. jQuery('.mix-container').append(fileListHtml);
  235. /*
  236. file = files[0];
  237. // 来在控制台看看到底这个对象是什么
  238. console.log(file);
  239. var filter = {};
  240. filter = {
  241. file:file,
  242. fileName:file.name
  243. };
  244. debugger
  245. var formdata=new FormData();
  246. formdata.append("fileName",file.name);
  247. formdata.append("file",file);
  248. that.actions.updateAttachment(that.options.clueId, "leads", formdata,file, function (json) {
  249. debugger
  250. if(json.type=="success"){
  251. Showbo.Msg.alert('附件上传成功!');
  252. }
  253. }.bind(that));
  254. /!*!// 那么我们可以做一下诸如文件大小校验的动作
  255. if(file.size > 1024 * 1024 * 2) {
  256. alert('图片大小不能超过 2MB!');
  257. return false;
  258. }*!/
  259. // 下面是关键的关键,通过这个 file 对象生成一个可用的图像 URL
  260. // 获取 window 的 URL 工具
  261. var URL = window.URL || window.webkitURL;
  262. // 通过 file 生成目标 url
  263. var imgURL = URL.createObjectURL(file);
  264. // 用这个 URL 产生一个 <img> 将其显示出来
  265. //jQuery('.fbpj .container').prev().find("img").attr('src', imgURL);
  266. jQuery('.mix-container').append('<div><img src="'+imgURL+'"></div>');
  267. // 使用下面这句可以在内存中释放对此 url 的伺服,跑了之后那个 URL 就无效了
  268. //URL.revokeObjectURL(imgURL);
  269. */
  270. }
  271. });
  272. jQuery('.se-send').click(function(){
  273. that.sendRecord();
  274. });
  275. jQuery('.el-dropdown-selfdefine').click(function(){
  276. jQuery("[tid='recordType']").toggle(100);
  277. });
  278. },
  279. sendRecord: function () {
  280. that = this;
  281. //var objFile = document.getElementById("bar-file");
  282. var objFile = jQuery('#bar-file')[0].files;
  283. jQuery(objFile).each(function(index,file){
  284. var filter = {};
  285. filter = {
  286. file:file,
  287. fileName:file.name
  288. };
  289. debugger
  290. var formdata=new FormData();
  291. formdata.append("fileName",file.name);
  292. formdata.append("file",file);
  293. that.actions.updateAttachment(that.options.openId, "record", formdata,file, function (json) {
  294. debugger
  295. /*if(json.type=="success"){
  296. Showbo.Msg.alert('附件上传成功!');
  297. }*/
  298. }.bind(that));
  299. }
  300. );
  301. var filters = {};
  302. filters = {
  303. types:"contacts",
  304. typesid:that.options.openId,
  305. content:jQuery('.el-textarea__inner').val(),
  306. category:jQuery('.se-select-name').text(),
  307. nexttime:jQuery('.el-input__inner').text(),
  308. businessids:"",
  309. contactsids:"",
  310. createuser:""
  311. };
  312. that.actions.createRecord(filters,function(json){
  313. if(json.type=="success"){
  314. Showbo.Msg.alert('跟进记录发布成功!');
  315. that.loadRecord();
  316. }
  317. }.bind(that),function(xhr,text,error){
  318. }.bind(that));
  319. },
  320. loadRecord: function(){
  321. //that = this;
  322. this.actions.getRecord(this.options.openId, function (json) {
  323. if(json.type=="success"){
  324. var recordDatas = json.data;
  325. jQuery(".fl-c").remove();
  326. var logItemHtml = "";
  327. debugger
  328. for ( i in recordDatas){
  329. if(i<recordDatas.length){
  330. var recordData = recordDatas[i];
  331. var personImg = 'http://172.16.92.55../x_component_CRM/$Template/portrait.png';
  332. logItemHtml = logItemHtml+'<div class="fl-c"><div class="vux-flexbox fl-h vux-flex-row">'+
  333. '<div class="div-photo fl-h-img" style="background-image: url(&quot;'+personImg+'&quot;);" lazy="loaded"></div> '+
  334. '<div class="fl-h-b"><div class="fl-h-name">'+recordData.person.name+'</div><div class="fl-h-time">'+recordData.updateTime+'</div></div>'+
  335. //'<div class="vux-flexbox fl-h-mark vux-flex-row"><img src="" class="fl-h-mark-img"><div class="fl-h-mark-name">跟进记录</div></div>'+
  336. //'<div class="el-dropdown"><i class="el-icon-arrow-down el-icon-more el-dropdown-selfdefine" style="color: rgb(205, 205, 205); margin-left: 8px;" aria-haspopup="list" aria-controls="dropdown-menu-4704" role="button" tabindex="0"></i> <ul class="el-dropdown-menu el-popper" style="display: none;" id="dropdown-menu-4704"><li data-v-e36820dc="" tabindex="-1" class="el-dropdown-menu__item">删除</li></ul></div>'+
  337. '</div>'+
  338. '<div class="fl-b"><div class="fl-b-content">'+recordData.content+'</div><div class="follow"><span class="follow-info">'+recordData.category+'</span></div></div>'+
  339. '<div class="full-container" style="display: none;"></div></div>'
  340. }
  341. }
  342. if(logItemHtml!=""){
  343. jQuery(".load").before(logItemHtml);
  344. }
  345. if(recordDatas.length<1){
  346. jQuery(".load").hide();
  347. jQuery(".empty-mask").show();
  348. }
  349. }
  350. }.bind(this));
  351. },
  352. toDecimal: function(x){
  353. if(x==""){
  354. return "";
  355. }else{
  356. var f = parseFloat(x);
  357. if (isNaN(f)) {
  358. return x;
  359. }
  360. f = Math.round(x*100)/100;
  361. return f;
  362. }
  363. },
  364. open: function (e) {
  365. this.fireEvent("queryOpen");
  366. this._open();
  367. this.fireEvent("postOpen");
  368. },
  369. create: function () {
  370. this.fireEvent("queryCreate");
  371. this.isNew = true;
  372. this._open();
  373. this.fireEvent("postCreate");
  374. },
  375. edit: function () {
  376. this.fireEvent("queryEdit");
  377. this.isEdited = true;
  378. this._open();
  379. this.fireEvent("postEdit");
  380. },
  381. _open: function () {
  382. if( this.options.hasMask ){
  383. this.formMaskNode = new Element("div.formMaskNode", {
  384. "styles": this.css.formMaskNode,
  385. "events": {
  386. "mouseover": function (e) {
  387. e.stopPropagation();
  388. },
  389. "mouseout": function (e) {
  390. e.stopPropagation();
  391. },
  392. "click": function (e) {
  393. e.stopPropagation();
  394. }
  395. }
  396. }).inject( this.container || this.app.content);
  397. }
  398. this.formAreaNode = new Element("div.formAreaNode", {
  399. "styles": this.css.formAreaNode
  400. });
  401. this.createFormNode();
  402. this.formAreaNode.inject(this.formMaskNode || this.container || this.app.content, "after");
  403. this.formAreaNode.fade("in");
  404. this.setFormNodeSize();
  405. this.setFormNodeSizeFun = this.setFormNodeSize.bind(this);
  406. if( this.app )this.app.addEvent("resize", this.setFormNodeSizeFun);
  407. if (this.options.draggable && this.formTopNode) {
  408. var size = (this.container || this.app.content).getSize();
  409. var nodeSize = this.formAreaNode.getSize();
  410. this.formAreaNode.makeDraggable({
  411. "handle": this.formTopNode,
  412. "limit": {
  413. "x": [0, size.x - nodeSize.x],
  414. "y": [0, size.y - nodeSize.y]
  415. }
  416. });
  417. }
  418. },
  419. createFormNode: function () {
  420. var _self = this;
  421. this.formNode = new Element("div.formNode", {
  422. "styles": this.css.formNode
  423. }).inject(this.formAreaNode);
  424. if (this.options.hasTop) {
  425. this.createTopNode();
  426. }
  427. if (this.options.hasIcon) {
  428. this.formIconNode = new Element("div.formIconNode", {
  429. "styles": this.isNew ? this.css.formNewNode : this.css.formIconNode
  430. }).inject(this.formNode);
  431. }
  432. this.createContent();
  433. //formContentNode.set("html", html);
  434. if (this.options.hasBottom) {
  435. this.createBottomNode();
  436. }
  437. this._setCustom();
  438. if( this.options.hasScroll ){
  439. //this.setScrollBar(this.formTableContainer)
  440. MWF.require("MWF.widget.ScrollBar", function () {
  441. new MWF.widget.ScrollBar(this.formTableContainer, {
  442. "indent": false,
  443. "style": "default",
  444. "where": "before",
  445. "distance": 30,
  446. "friction": 4,
  447. "axis": {"x": false, "y": true},
  448. "onScroll": function (y) {
  449. //var scrollSize = _self.viewContainerNode.getScrollSize();
  450. //var clientSize = _self.viewContainerNode.getSize();
  451. //var scrollHeight = scrollSize.y - clientSize.y;
  452. //if (y + 200 > scrollHeight && _self.view && _self.view.loadElementList) {
  453. // if (!_self.view.isItemsLoaded) _self.view.loadElementList();
  454. //}
  455. }
  456. });
  457. }.bind(this));
  458. }
  459. },
  460. createContent: function () {
  461. this.formContentNode = new Element("div.formContentNode", {
  462. "styles": this.css.formContentNode
  463. }).inject(this.formNode);
  464. this.formTableContainer = new Element("div.formTableContainer", {
  465. "styles": this.css.formTableContainer
  466. }).inject(this.formContentNode);
  467. this.formTableArea = new Element("div.formTableArea", {
  468. "styles": this.css.formTableArea,
  469. "text":"loading..."
  470. }).inject(this.formTableContainer);
  471. this._createTableContent();
  472. },
  473. createBottomNode: function () {
  474. this.formBottomNode = new Element("div.formBottomNode", {
  475. "styles": this.css.formBottomNode
  476. }).inject(this.formNode);
  477. this._createBottomContent()
  478. },
  479. createTopNode: function () {
  480. if (!this.formTopNode) {
  481. this.formTopNode = new Element("div.formTopNode", {
  482. "styles": this.css.formTopNode
  483. }).inject(this.formNode);
  484. this.formTopIconNode = new Element("div", {
  485. "styles": this.css.formTopIconNode
  486. }).inject(this.formTopNode);
  487. this.formTopTextNode = new Element("div", {
  488. "styles": this.css.formTopTextNode,
  489. "text": this.options.title + ( this.data.title ? ("-" + this.data.title ) : "" )
  490. }).inject(this.formTopNode);
  491. if (this.options.closeAction) {
  492. this.formTopCloseActionNode = new Element("div", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  493. this.formTopCloseActionNode.addEvent("click", function () {
  494. this.close();
  495. }.bind(this))
  496. }
  497. this.formTopContentNode = new Element("div", {
  498. "styles": this.css.formTopContentNode
  499. }).inject(this.formTopNode);
  500. this._createTopContent();
  501. }
  502. },
  503. _createTopContent: function () {
  504. },
  505. _createTableContent: function () {
  506. this.loadFormData();
  507. /*
  508. var Ttype = "clue";
  509. this.actions.getProfiles(Ttype,function(json){
  510. this.profileData = json.data;
  511. if(this.data.id){
  512. this.actions.getCustomerInfo(this.data.id,function(json){
  513. this.customerData = json.data;
  514. this.loadFormData();
  515. this.createCustomBottom();
  516. }.bind(this));
  517. }else{
  518. this.loadFormData();
  519. this.createCustomBottom();
  520. }
  521. }.bind(this));
  522. */
  523. },
  524. _createBottomContent: function () {
  525. this.cancelActionNode = new Element("div.formCancelActionNode", {
  526. "styles": this.css.formCancelActionNode,
  527. "text": this.lp.actionCancel
  528. }).inject(this.formBottomNode);
  529. if (this.options.isNew || this.options.isEdited) {
  530. //this.ok();
  531. this.okActionNode = new Element("div.formOkActionNode", {
  532. "styles": this.css.formOkActionNode,
  533. "text": this.lp.actionConfirm
  534. }).inject(this.formBottomNode);
  535. this.okActionNode.addEvent("click", function (e) {
  536. this.ok(e);
  537. }.bind(this));
  538. }
  539. this.cancelActionNode.addEvent("click", function (e) {
  540. this.cancel(e);
  541. }.bind(this));
  542. },
  543. loadFormData:function(){
  544. var tmpData={};
  545. this.loadForm();
  546. /*
  547. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  548. "<tr>" +
  549. " <td styles='formTableTitle'><span lable='TCustomerName'></span><span style='color:#f00'>*</span></td>" +
  550. " <td styles='formTableValue' item='TCustomerName'></td>" +
  551. "</tr><tr>" +
  552. " <td styles='formTableTitle' lable='TCustomerType'></td>" +
  553. " <td styles='formTableValue'><div id='TCustomerType'></div></td>" +
  554. "</tr><tr>" +
  555. " <td styles='formTableTitle' lable='TCustomerLevel'></td>" +
  556. " <td styles='formTableValue'><div id='TCustomerLevel'></div></td>" +
  557. "</tr><tr>" +
  558. " <td styles='formTableTitle' lable='TSource'></td>" +
  559. " <td styles='formTableValue'><div id='TSource'></div></td>" +
  560. "</tr><tr>" +
  561. " <td styles='formTableTitle' lable='TIndustryFirst'></td>" +
  562. " <td styles='formTableValue'><div id='TIndustryFirst'></div><div id='TIndustrySecond'></div></td>" +
  563. "</tr><tr>" +
  564. " <td styles='formTableTitle' lable='TDistrict'></td>" +
  565. " <td styles='formTableValue'><div id='TProvince'></div><div id='TCity'></div><div id='TArea'></div></td>" +
  566. "</tr><tr>" +
  567. " <td styles='formTableTitle' lable='TStreet'></td>" +
  568. " <td styles='formTableValue' item='TStreet'></td>" +
  569. "</tr><tr>" +
  570. " <td styles='formTableTitle' lable='TLocation'></td>" +
  571. " <td styles='formTableValue'><div style='width:100%;height:30px;'><input type='text' placeholder='"+this.lp.TLocationNotice+"' id='mapLocation' disabled/></div></td>" +
  572. "</tr><tr>" +
  573. " <td styles='formTableTitle'></td>" +
  574. " <td styles='formTableValue'><div id='mapDiv' styles='mapDiv'></div></td>" +
  575. "</tr><tr>" +
  576. " <td styles='formTableTitle' lable='TTelphone'></td>" +
  577. " <td styles='formTableValue' item='TTelphone'></td>" +
  578. "</tr><tr>" +
  579. " <td styles='formTableTitle' lable='TFax'></td>" +
  580. " <td styles='formTableValue' item='TFax'></td>" +
  581. "</tr><tr>" +
  582. " <td styles='formTableTitle' lable='TRemark'></td>" +
  583. " <td styles='formTableValue' item='TRemark'></td>" +
  584. "</tr><tr>" +
  585. " <td styles='formTableTitle' lable='TWebSite'></td>" +
  586. " <td styles='formTableValue' item='TWebSite'></td>" +
  587. "</tr><tr>" +
  588. " <td styles='formTableTitle' lable='TEmail'></td>" +
  589. " <td styles='formTableValue' item='TEmail'></td>" +
  590. "</tr><tr>" +
  591. " <td styles='formTableTitle' lable='TCustomerStatus'></td>" +
  592. " <td styles='formTableValue'><div id='TCustomerStatus'></div></td>" +
  593. "</tr><tr>" +
  594. " <td styles='formTableTitle' lable='TCustomerGrade'></td>" +
  595. " <td styles='formTableValue'><div id='TCustomerGrade'></div></td>" +
  596. "</tr>" +
  597. "</table>"
  598. this.formTableArea.set("html", html);
  599. this.TCustomerType = this.formTableArea.getElement("#TCustomerType");
  600. this.TCustomerLevel = this.formTableArea.getElement("#TCustomerLevel");
  601. this.TSource = this.formTableArea.getElement("#TSource");
  602. this.TIndustryFirst = this.formTableArea.getElement("#TIndustryFirst");
  603. this.TIndustrySecond = this.formTableArea.getElement("#TIndustrySecond");
  604. this.TProvince = this.formTableArea.getElement("#TProvince");
  605. this.TCity = this.formTableArea.getElement("#TCity");
  606. this.TArea = this.formTableArea.getElement("#TArea");
  607. this.TCustomerStatus = this.formTableArea.getElement("#TCustomerStatus");
  608. this.TCustomerGrade = this.formTableArea.getElement("#TCustomerGrade");
  609. var size = {"width":230,"height":30};
  610. this.TIndustryFirst.setStyles({"float":"left"});
  611. this.TIndustrySecond.setStyles({"float":"left","margin-left":"10px"});
  612. //客户类型
  613. this.TCustomerTypeSelector = new MWF.xApplication.CRM.Template.Select(this.TCustomerType,this, this.actions, size);
  614. this.TCustomerTypeSelector.load();
  615. alert(JSON.stringify(this.profileData.customertype_config))
  616. this.TCustomerTypeSelector.setList(this.profileData.customertype_config);
  617. if(this.customerData && this.customerData.customertype){
  618. this.TCustomerTypeSelector.selectValueDiv.set({"text":this.customerData.customertype});
  619. this.TCustomerTypeSelector.node.set("value",this.customerData.customertype);
  620. }
  621. //客户级别
  622. this.TCustomerLevelSelector = new MWF.xApplication.CRM.Template.Select(this.TCustomerLevel,this, this.actions, size);
  623. this.TCustomerLevelSelector.load();
  624. this.TCustomerLevelSelector.setList(this.profileData.level_config);
  625. if(this.customerData && this.customerData.level){
  626. this.TCustomerLevelSelector.selectValueDiv.set({"text":this.customerData.level});
  627. this.TCustomerLevelSelector.node.set("value",this.customerData.level);
  628. }
  629. //来源
  630. this.TSourceSelector = new MWF.xApplication.CRM.Template.Select(this.TSource,this, this.actions, size);
  631. this.TSourceSelector.load();
  632. this.TSourceSelector.setList(this.profileData.source_config);
  633. if(this.customerData && this.customerData.source){
  634. this.TSourceSelector.selectValueDiv.set({"text":this.customerData.source});
  635. this.TSourceSelector.node.set("value",this.customerData.source);
  636. }
  637. //行业
  638. this.TIndustryFirstSelector = new MWF.xApplication.CRM.Template.Select(this.TIndustryFirst,this, this.actions, {"width":230,"height":30});
  639. this.TIndustrySecondSelector = new MWF.xApplication.CRM.Template.Select(this.TIndustrySecond,this, this.actions, {"width":230,"height":30,"available":"no"});
  640. this.TIndustrySecondSelector.load();
  641. this.TIndustryFirstSelector.load();
  642. if(this.customerData && this.customerData.industryfirst){
  643. this.TIndustryFirstSelector.selectValueDiv.set({"text":this.customerData.industryfirst});
  644. this.TIndustryFirstSelector.node.set("value",this.customerData.industryfirst);
  645. this.profileData.industry_config.childNodes.each(function(d){
  646. if(d.configname == this.customerData.industryfirst){
  647. tmpData = d;
  648. }
  649. }.bind(this));
  650. this.TIndustrySecondSelector.setList(tmpData);
  651. this.TIndustrySecond.set("available","yes");
  652. this.TIndustrySecond.setStyles({"background-color":""});
  653. }
  654. if(this.customerData && this.customerData.industrysecond){
  655. this.TIndustrySecondSelector.selectValueDiv.set({"text":this.customerData.industrysecond});
  656. this.TIndustrySecondSelector.node.set("value",this.customerData.industrysecond);
  657. this.profileData.industry_config.childNodes.each(function(d){
  658. if(d.configname == this.customerData.industryfirst){
  659. tmpData = d;
  660. }
  661. }.bind(this));
  662. this.TIndustrySecondSelector.setList(tmpData);
  663. this.TIndustrySecond.set("available","yes");
  664. this.TIndustrySecond.setStyles({"background-color":""});
  665. }
  666. this.TIndustryFirstSelector.setList(this.profileData.industry_config,function(d){
  667. if(this.TIndustryFirst.get("value") == this.lp.defaultSelect){
  668. this.TIndustrySecondSelector.createDefault();
  669. this.TIndustrySecondSelector.setList();
  670. this.TIndustrySecond.set("available","no");
  671. this.TIndustrySecond.setStyles({"background-color":"#eeeeee"})
  672. }else{
  673. this.TIndustrySecondSelector.createDefault();
  674. this.TIndustrySecondSelector.setList(d);
  675. this.TIndustrySecond.set("available","yes");
  676. this.TIndustrySecond.setStyles({"background-color":""});
  677. }
  678. }.bind(this));
  679. //省、市、区
  680. this.TProvinceSelector = new MWF.xApplication.CRM.Template.Select(this.TProvince,this, this.actions, {"width":150,"height":30});
  681. this.TProvinceSelector.load({},function(){
  682. this.actions.getProvinceList(function(json){
  683. this.TProvinceSelector.setAddress(json.data,function(d){
  684. //city
  685. if(this.TProvince.get("value") == this.lp.defaultSelect){
  686. this.TCitySelector.createDefault();
  687. this.TCitySelector.setAddress();
  688. this.TCity.set("available","no");
  689. this.TCity.setStyles({"background-color":"#eeeeee"});
  690. }else{
  691. this.actions.getCityList({pid: d.cityid},function(json){
  692. this.TCitySelector.createDefault();
  693. this.TCitySelector.setAddress(json.data,function(dd){
  694. //area
  695. if(this.TCity.get("value") == this.lp.defaultSelect){
  696. this.TAreaSelector.createDefault();
  697. this.TAreaSelector.setAddress();
  698. this.TArea.set("available","no");
  699. this.TArea.setStyles({"background-color":"#eeeeee"});
  700. }else{
  701. this.actions.getAreaList({pid:dd.cityid},function(json){
  702. this.TAreaSelector.createDefault();
  703. this.TAreaSelector.setAddress(json.data);
  704. this.TArea.set("available","yes");
  705. this.TArea.setStyles({"background-color":""});
  706. }.bind(this));
  707. }
  708. }.bind(this));
  709. this.TCity.set("available","yes");
  710. this.TCity.setStyles({"background-color":""});
  711. }.bind(this));
  712. }
  713. this.TAreaSelector.createDefault();
  714. this.TAreaSelector.setAddress();
  715. this.TArea.set("available","no");
  716. this.TArea.setStyles({"background-color":"#eeeeee"});
  717. }.bind(this))
  718. }.bind(this))
  719. }.bind(this));
  720. this.TCitySelector = new MWF.xApplication.CRM.Template.Select(this.TCity,this, this.actions, {"width":150,"height":30,"available":"no"});
  721. this.TCitySelector.load();
  722. this.TAreaSelector = new MWF.xApplication.CRM.Template.Select(this.TArea,this, this.actions, {"width":150,"height":30,"available":"no"});
  723. this.TAreaSelector.load();
  724. if(this.customerData && this.customerData.province){ //省
  725. this.TProvinceSelector.selectValueDiv.set({"text":this.customerData.province});
  726. this.TProvinceSelector.node.set("value",this.customerData.province);
  727. }
  728. if(this.customerData && this.customerData.city){ //市
  729. if(this.customerData && this.customerData.province){
  730. this.actions.getCityListByName({"regionname":this.customerData.province},
  731. function(json){
  732. this.TCitySelector.setAddress(json.data,function(dd){
  733. //area
  734. if(this.TCity.get("value") == this.lp.defaultSelect){
  735. this.TAreaSelector.createDefault();
  736. this.TAreaSelector.setAddress();
  737. this.TArea.set("available","no");
  738. this.TArea.setStyles({"background-color":"#eeeeee"});
  739. }else{
  740. this.actions.getAreaList({pid:dd.cityid},function(json){
  741. this.TAreaSelector.createDefault();
  742. this.TAreaSelector.setAddress(json.data);
  743. this.TArea.set("available","yes");
  744. this.TArea.setStyles({"background-color":""});
  745. }.bind(this));
  746. }
  747. }.bind(this));
  748. }.bind(this));
  749. }
  750. this.TCitySelector.selectValueDiv.set({"text":this.customerData.city});
  751. this.TCitySelector.node.set("value",this.customerData.city);
  752. this.TCity.set("available","yes");
  753. this.TCity.setStyles({"background-color":""});
  754. }
  755. if(this.customerData && this.customerData.county){ //区
  756. if(this.customerData && this.customerData.city){
  757. this.actions.getAreaListByName({"regionname":this.customerData.city},
  758. function(json){
  759. this.TAreaSelector.setAddress(json.data);
  760. }.bind(this));
  761. }
  762. this.TAreaSelector.selectValueDiv.set({"text":this.customerData.county});
  763. this.TAreaSelector.node.set("value",this.customerData.county);
  764. this.TArea.set("available","yes");
  765. this.TArea.setStyles({"background-color":""});
  766. }
  767. this.TProvince.setStyles({"float":"left"});
  768. this.TCity.setStyles({"float":"left","margin-left":"10px"});
  769. this.TArea.setStyles({"float":"left","margin-left":"10px"});
  770. this.TCustomerStatusSelector = new MWF.xApplication.CRM.Template.Select(this.TCustomerStatus,this, this.actions, size);
  771. this.TCustomerStatusSelector.load();
  772. this.TCustomerStatusSelector.setList(this.profileData.state_config);
  773. if(this.customerData && this.customerData.state){
  774. this.TCustomerStatusSelector.selectValueDiv.set({"text":this.customerData.state});
  775. this.TCustomerStatusSelector.node.set("value",this.customerData.state);
  776. }
  777. this.TCustomerGradeSelector = new MWF.xApplication.CRM.Template.Select(this.TCustomerGrade,this, this.actions, size);
  778. this.TCustomerGradeSelector.load();
  779. this.TCustomerGradeSelector.setList(this.profileData.customerrank_config);
  780. this.TMap = this.formTableArea.getElement("#mapDiv");
  781. this.TMap.addEvents({
  782. "mousewheel":function(e){
  783. e.stopPropagation();
  784. }
  785. });
  786. this.mapLocation = this.formTableArea.getElement("#mapLocation");
  787. this.mapLocation.setStyles({
  788. "width": "99%",
  789. "text-indent":"5px",
  790. "border":"1px solid #999",
  791. "background-color":"#eee",
  792. "border-radius": "3px",
  793. "box-shadow": "0px 0px 6px #eee",
  794. "height": "26px"
  795. });
  796. MWF.xDesktop.requireApp("CRM", "BaiduMap", function(){
  797. this.bMap = new MWF.xApplication.CRM.BaiduMap(this.TMap,this.app,this,this.actions,{"from":"newCustomer"});
  798. var mapData = {};
  799. if(this.customerData && this.customerData.addresslatitude){
  800. mapData.latitude = this.customerData.addresslatitude
  801. }
  802. if(this.customerData && this.customerData.addresslongitude){
  803. mapData.longitude = this.customerData.addresslongitude
  804. }
  805. this.bMap.load(mapData);
  806. }.bind(this));
  807. */
  808. },
  809. ok: function (e) {
  810. this.fireEvent("queryOk");
  811. var data = this.form.getResult(true, ",", true, false, true);
  812. debugger;
  813. if (data) {
  814. this._ok(data, function (json) {
  815. if (json.type == "error") {
  816. if( this.app )this.app.notice(json.message, "error");
  817. } else {
  818. if( this.formMaskNode )this.formMaskNode.destroy();
  819. this.formAreaNode.destroy();
  820. if (this.explorer && this.explorer.view)this.explorer.view.reload();
  821. if( this.app )this.app.notice(this.isNew ? this.lp.createSuccess : this.lp.updateSuccess, "success");
  822. this.fireEvent("postOk");
  823. }
  824. }.bind(this))
  825. }
  826. },
  827. loadForm: function(){
  828. _self = this;
  829. this.form = new MForm(this.formTableArea, this.data, {
  830. style: "default",
  831. isEdited: this.isEdited || this.isNew,
  832. itemTemplate: this.getItemTemplate(this.lp )
  833. },this.app,this.css);
  834. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>";
  835. var itemTemplateObject = this.form.itemTemplate;
  836. debugger
  837. for ( i in itemTemplateObject){
  838. html = html+"<tr>" +
  839. " <td styles='formTableTitle'><span lable='"+i+"'>"+itemTemplateObject[i].text+"</td>" +
  840. " <td styles='formTableValue' item='"+i+"'></td>" +
  841. "</tr>";
  842. }
  843. html = html+"</table>";
  844. debugger
  845. this.formTableArea.set("html", html);
  846. this.form.load();
  847. if(!this.isNew){
  848. this.actions.getCustomerInfo(this.options.openId, function (json) {
  849. debugger
  850. var jsonObj = json.data;
  851. var spanObject = this.formTableArea.getElements("span");
  852. for ( j in spanObject){
  853. if(j < spanObject.length){
  854. debugger
  855. if(spanObject[j].get("name")!=null){
  856. var fieldName = spanObject[j].get("name");
  857. for (var prop in jsonObj){
  858. if(prop == fieldName){
  859. spanObject[j].set("text",jsonObj[prop]);
  860. }
  861. }
  862. }
  863. }
  864. }
  865. }.bind(this));
  866. }
  867. //this.nexttime = this.formTableArea.getElement("#nexttime");
  868. //this.nexttime.addEvent("click",function(){
  869. //_self.selectCalendar(this);
  870. //});
  871. this.formTableArea.getElements("textarea").setStyles({"height":"100px","overflow":"auto","color":"#666666"});
  872. this.formTableArea.getElements("input").setStyles({"color":"#666666"});
  873. },
  874. getItemTemplate: function( lp ){
  875. _self = this;
  876. return {
  877. contactsname:{
  878. type: "text",
  879. text: lp.contactsname,
  880. value:this.customerData && this.customerData.customername?this.customerData.customername:""
  881. },
  882. customername: {
  883. text: lp.customername,
  884. type: "openSelect"
  885. },
  886. cellphone: {
  887. text:lp.cellphone,
  888. type: "text"
  889. },
  890. telephone:{
  891. type: "text",
  892. text: lp.telephone
  893. },
  894. email: {
  895. text:lp.email,
  896. type: "text"
  897. },
  898. decision: {
  899. type: "select",
  900. text: lp.decision,
  901. value:_self.app.lp.contact.decision.value
  902. },
  903. post: {
  904. text:lp.post,
  905. type: "text"
  906. },
  907. sex: {
  908. type: "select",
  909. text: lp.sex,
  910. value:_self.app.lp.contact.sex.value
  911. },
  912. detailaddress: {
  913. text:lp.detailaddress,
  914. type: "text"
  915. },
  916. nexttime: {
  917. text:lp.nexttime,
  918. attr : {id:"nexttime"},
  919. type: "datetime"
  920. },
  921. remark: {
  922. text:lp.remark,
  923. type: "textarea"
  924. }
  925. }
  926. },
  927. getContactTemplate: function( lp ){
  928. _self = this;
  929. return {
  930. contactsname: {
  931. text: lp.contactsname,
  932. type: "text",
  933. notEmpty:true
  934. },
  935. customername: {
  936. text: lp.customername,
  937. type: "readonly",
  938. notEmpty:true
  939. },
  940. telephone:{
  941. type: "text",
  942. text: lp.telephone,
  943. },
  944. cellphone: {
  945. text:lp.cellphone,
  946. type: "text"
  947. },
  948. email:{
  949. type: "text",
  950. text: lp.email
  951. },
  952. decision: {
  953. type: "select",
  954. text: lp.decision,
  955. value:this.app.lp.contact.decision.value
  956. },
  957. post: {
  958. text:lp.post,
  959. type: "text"
  960. },
  961. sex: {
  962. type: "select",
  963. text: lp.sex,
  964. value:this.app.lp.contact.sex.value
  965. },
  966. detailaddress: {
  967. text:lp.detailaddress,
  968. type: "text"
  969. },
  970. nexttime: {
  971. text:lp.nexttime,
  972. attr : {id:"nexttime"},
  973. type: "datetime"
  974. },
  975. remark: {
  976. text:lp.remark,
  977. type: "textarea"
  978. }
  979. }
  980. },
  981. selectPerson: function (showContainer,nameId,fullNameId,count) {
  982. var options = {
  983. "type" : "",
  984. "types": ["person"],
  985. "values": this.configData,
  986. "count": count,
  987. "zIndex": 50000,
  988. "onComplete": function(items){
  989. MWF.require("MWF.widget.O2Identity", function(){
  990. var invitePersonList = [];
  991. var fullPersonList = [];
  992. this.configData = [];
  993. this.process = null;
  994. items.each(function(item){
  995. var _self = this;
  996. if( item.data.distinguishedName.split("@").getLast().toLowerCase() == "i" ){
  997. var person = new MWF.widget.O2Identity(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  998. invitePersonList.push( item.data.distinguishedName );
  999. }else{
  1000. //var person = new MWF.widget.O2Person(item.data, it.form.getItem("invitePersonList").container, {"style": "room"});
  1001. invitePersonList.push(item.data.name);
  1002. fullPersonList.push(item.data.distinguishedName);
  1003. var personJson = {
  1004. "name": item.data.name,
  1005. "distinguishedName": item.data.distinguishedName,
  1006. "employee":item.data.employee
  1007. }
  1008. debugger
  1009. this.configData.push(personJson);
  1010. }
  1011. }.bind(this));
  1012. if(items.length==0){
  1013. document.getElementById(nameId).innerHTML = "+点击选择"
  1014. }else{
  1015. document.getElementById(nameId).innerHTML = invitePersonList.join(",");
  1016. if(fullNameId!=""){
  1017. document.getElementById(fullNameId).innerHTML = fullPersonList.join(",");
  1018. }
  1019. }
  1020. }.bind(this));
  1021. }.bind(this)
  1022. };
  1023. var selector = new MWF.O2Selector(showContainer, options);
  1024. },
  1025. getFormateTime: function( timeStr ){
  1026. _self = this;
  1027. var date= new Date(timeStr);
  1028. return date.getFullYear()+'-'+_self.checkTime(date.getMonth()+1)+'-'+_self.checkTime(date.getDate())+ ' ' + _self.checkTime(date.getHours()) + ':' + _self.checkTime(date.getMinutes()) + ':' + _self.checkTime(date.getSeconds());
  1029. },
  1030. checkTime: function( i ){
  1031. if(i<10){
  1032. i = '0'+i
  1033. }
  1034. return i;
  1035. },
  1036. toDecimal: function(x){
  1037. if(x==""){
  1038. return "";
  1039. }else{
  1040. var f = parseFloat(x);
  1041. if (isNaN(f)) {
  1042. return x;
  1043. }
  1044. f = Math.round(x*100)/100;
  1045. return f;
  1046. }
  1047. },
  1048. createCustomBottom:function(){
  1049. this.okActionNode = new Element("div.formOkActionNode", {
  1050. "styles": this.css.formOkActionNode,
  1051. "text": this.lp.actionConfirm
  1052. }).inject(this.formBottomNode);
  1053. this.okActionNode.addEvent("click", function (e) {
  1054. this.ok(e);
  1055. }.bind(this));
  1056. },
  1057. _ok: function (data, callback) {
  1058. var saveDataStr = "";
  1059. for ( i in this.data){
  1060. saveDataStr = saveDataStr+"'"+i+"':'"+this.data[i]+"',";
  1061. }
  1062. debugger;
  1063. saveDataStr = "'{"+saveDataStr.replace(/'/g, '"')+"}'";
  1064. debugger;
  1065. //var saveData = JSON.parse(saveDataStr);
  1066. var saveData = eval('(' + saveDataStr.substring(1,saveDataStr.length - 1) + ')');
  1067. debugger;
  1068. //alert(JSON.stringify(saveData))
  1069. this.app.createShade();
  1070. this.actions.saveClue(saveData,function(json){
  1071. this.app.destroyShade();
  1072. this.app.notice(this.lp.saveSuccess,"success");
  1073. this.close();
  1074. this.fireEvent("reloadView",json);
  1075. }.bind(this),function(xhr,text,error){
  1076. this.app.showErrorMessage(xhr,text,error);
  1077. this.app.destroyShade();
  1078. }.bind(this));
  1079. }
  1080. });