12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273 |
- Namespace.register("U.MD.O.E");
- U.MD.O.E.fileinfo;
- U.MD.O.E.userInfo;
- U.MD.O.E.web;
- US = parent.US;
- U.MD.O.E.load = function (fileinfo, userinfo) {
-
-
-
-
-
- var _fileinfo = fileinfo,
- _fileid = fileinfo.UserDirectoryID;
- U.MD.O.E.variable(fileinfo, userinfo);
- U.MD.O.E.getData();
-
- U.MD.O.E.Panel.loadPlayUser(fileinfo);
- U.MD.O.E.Panel.loadOfficeHistory(fileinfo);
- U.MD.O.E.Panel.loadLink(fileinfo);
- U.MD.O.E.TL.toolsbind($(".U_MD_O_H_head_mo")[0]);
- top.$('#UD_Excel' + _fileinfo.UserDirectoryID + ' .U_MD_O_H_head_navigation_Title')[0].onblur = function () {
- U.MD.O.E.TitleChange();
- }
- }
- U.MD.O.E.otherFun = function () {
- U.MD.O.E.createSelection();
- U.MD.O.E.TL.borderPicker();
- U.MD.O.E.BC.scrollY();
- U.MD.O.E.KE.Control();
- U.MD.O.E.TL.toolsbind($('.U_MD_O_H_head_mo')[0]);
- $(".U_MD_O_E_headInput")[0].focus();
- U.MD.O.E.BC.cloneCell();
- U.MD.O.E.TL.borderPicker();
- }
- U.MD.O.E.getData = function () {
- var _fileinfo = U.MD.O.E.fileinfo,
- _fileid = _fileinfo.UserDirectoryID,
- _permission = U.MD.O.E.permission();
- if (_permission.web) {
- parent.U.A.Request(US.SCOKET, ['getExcel', _fileid, US.pageId, U.MD.O.E.userInfo.userid], U.MD.O.E.AsynLoad);
- }
- else if (_fileinfo.UserDirectoryID && _fileinfo.UserId && _fileinfo.UserallDirectoryName) {
-
- U.A.Request(US.DISK, ["GetFileContent", fileinfo.UserDirectoryID], function (r) {
-
- if (r.value && r.value.UsOffice !== undefined && r.value.UsOffice != null) {
- U.MD.O.E.AsynLoad(r);
- }
-
- else {
- U.A.Request("http://office.1473.cn/Officetohtml.ashx", ["Open", fileinfo.UserDirectoryExtendType, fileinfo.UserFilesServerName], function (r) {
- if (r.value.value != undefined) {
- var _table = $$("div");
- _taskId = Guid.newGuid();
- fileinfo.UsOffice = {};
- fileinfo.UsOffice[_taskId] = {
- column: {
- change: {},
- num: 200
- },
- row: {
- change: {},
- num: 200
- },
- cell: {},
- img: [],
- taskName: "工作表1",
- titie: ""
- }
- _xlsxData = JSON.parse(r.value.value);
- for (var i = 0; i < _xlsxData[0].length; i++) {
- for (var j in _xlsxData[0][i]) {
- _col = j.replace(/^Column/, '');
- _col = parseInt(_col);
- if (fileinfo.UsOffice[_taskId].cell[_col]) {
- fileinfo.UsOffice[_taskId].cell[_col][i + 1] = _xlsxData[0][i][j];
- } else {
- fileinfo.UsOffice[_taskId].cell[_col] = {};
- fileinfo.UsOffice[_taskId].cell[_col][i + 1] = _xlsxData[0][i][j];
- }
- }
- }
- U.MD.O.E.AsynLoad({ "value": fileinfo.UsOffice });
- }
- else {
- U.MD.O.E.AsynLoad(r);
- }
- });
- }
- });
- }
- else {
- U.MD.O.E.initExcel();
- }
- }
- U.MD.O.E.AsynLoad = function (r) {
- var _data;
- if (r.value && r.value.UsOffice !== undefined) {
- _data = r.value.UsOffice;
- } else {
- _data = r.value;
- }
- if (_data) {
- typeof (_data) === "string" ? _data = JSON.parse(_data) : "";
- U.MD.O.E.data = _data;
- U.MD.O.E.printTask();
- U.MD.O.E.rePrintExcel();
- U.MD.O.E.otherFun();
- } else {
- U.MD.O.E.initExcel();
- }
- }
- U.MD.O.E.permission = function () {
- var _iseditor,
- _isgroup,
- _permission = {
- "edit": false,
- "web": false
- };
- if (!U.MD.O.E.fileinfo.UserId) {
- _permission.edit = true;
- return _permission;
- }
- if (U.MD.O.E.fileinfo && US.friend.group) {
- _isgroup = U.Json.select(US.friend.group, {
- "GroupManageID": U.MD.O.E.fileinfo.GroupID
- })[0];
- }
- if (U.MD.O.E.fileinfo && (U.MD.O.E.fileinfo.GroupID == U.MD.O.E.userInfo.userid || U.MD.O.E.fileinfo.UserId == US.userInfo.userid)) {
- _iseditor = true;
- }
- if (_isgroup) {
- _permission.web = true;
- _permission.edit = true;
- } else if (_iseditor) {
- _permission.edit = true;
- }
- U.MD.O.E.web = _permission.web;
- return _permission;
- }
- U.MD.O.E.variable = function (fileinfo, userinfo) {
- U.MD.O.E.fileinfo = fileinfo
- U.MD.O.E.userInfo = userinfo;
- U.MD.O.E.taskCopyId = null;
- U.MD.O.E.colBoardWidth = 107;
- U.MD.O.E.rowBoardHeight = 22;
- U.MD.O.E.colBoardNum = 26;
- U.MD.O.E.rowBoardNum = 200;
- U.MD.O.E.taskNum = 1;
- U.MD.O.E.taskId = Guid.newGuid();
- U.MD.O.E.data = {};
- U.MD.O.E.data[U.MD.O.E.taskId] = {
- column: {
- change: {},
- num: U.MD.O.E.colBoardNum
- },
- row: {
- change: {},
- num: U.MD.O.E.rowBoardNum
- },
- cell: {},
- img: [],
- taskName: "工作表1",
- titie: ""
- }
- _Newleft = 0;
- _Newtop = 0;
- _NewRolltop = 0;
- _NewRollleft = 0;
- _Percentage = 0;
- _PageMove = "";
- }
- U.MD.O.E.addTask = function () {
- U.MD.O.E.taskId = Guid.newGuid();
- U.MD.O.E.taskNum++;
- var _data;
- if (U.MD.O.E.taskCopyId) {
- _data = JSON.stringify(U.MD.O.E.data[U.MD.O.E.taskCopyId]);
- _data = JSON.parse(_data);
- _data.taskName = "工作表" + U.MD.O.E.taskNum;
- } else {
- _data = {
- column: {
- change: {},
- num: U.MD.O.E.colBoardNum
- },
- row: {
- change: {},
- num: U.MD.O.E.rowBoardNum
- },
- cell: {},
- img: [],
- taskName: "工作表" + U.MD.O.E.taskNum
- }
- }
- var _dataInfo = {
- id: U.MD.O.E.taskId,
- data: _data
- }
- U.MD.O.E.dataChange(U.MD.O.E.excelInfo("addTask", _dataInfo));
-
- var _taskBar = $(".U_MD_O_E_taskBar")[0],
- _taskEl = $(".U_MD_O_E_task")[0];
- _newTask = _taskEl.cloneNode();
- _newTask.style.display = "block";
- _newTask.id = U.MD.O.E.taskId;
- _newTask.innerText = _data.taskName;
- $(".U_MD_O_E_taskCheck").removeClass("U_MD_O_E_taskCheck");
- $(_newTask).addClass("U_MD_O_E_taskCheck");
- _taskBar.appendChild(_newTask);
- U.MD.O.E.rePrintExcel();
- U.MD.O.E.addTaskClick(_newTask);
- U.MD.O.E.rightClick(_newTask, "taskBar");
- U.MD.O.E.taskCopyId = null;
- }
- U.MD.O.E.addTaskClick = function (taskEl) {
- $(taskEl).bind('click', function (e) {
- U.UF.EV.stopBubble(e);
- $(".U_MD_O_E_taskCheck").removeClass("U_MD_O_E_taskCheck");
- $(this).addClass("U_MD_O_E_taskCheck");
- U.MD.O.E.taskId = this.id;
- U.MD.O.E.rePrintExcel();
- });
- }
- U.MD.O.E.printTask = function (data) {
- var _data = U.MD.O.E.data,
- _taskBar = $(".U_MD_O_E_taskBar")[0],
- _taskEl = $(".U_MD_O_E_task")[0],
- _newTask,
- _attr,
- _num = 0;
- U.MD.O.E.taskNum = U.MD.O.E.jsonLen(_data);
- for (_attr in _data) {
- _newTask = _taskEl.cloneNode();
- _newTask.style.display = "block";
- _newTask.id = _attr;
- _num++;
- _newTask.innerText = _data[_attr].taskName || "工作表" + _num;
- if (_num === 1) {
- $(".U_MD_O_E_taskCheck").removeClass(".U_MD_O_E_taskCheck");
- $(_newTask).addClass("U_MD_O_E_taskCheck")
- U.MD.O.E.taskId = _attr;
- }
- _taskBar.appendChild(_newTask);
- if (!data) {
- U.MD.O.E.addTaskClick(_newTask);
- U.MD.O.E.rightClick(_newTask, "taskBar");
- } else {
- _newTask.onclick = function () {
- $(".U_MD_O_E_taskCheck")[0].className = "U_MD_O_E_task";
- this.className = "U_MD_O_E_task U_MD_O_E_taskCheck ";
- U.MD.O.E.rePrintExcel(U.MD.O.E.data[this.id], true);
- }
- }
- }
- }
- U.MD.O.E.newExcel = function () {
- parent.U.MD.D.I.openApplication("excel", { "userid": US.userInfo.userid, "directoryid": US.FTPFOLDERID });
- }
- U.MD.O.E.dataChange = function (info, req) {
- var _messageInfo = info.messageInfo || info,
- _type = _messageInfo.type,
- _excelData = U.MD.O.E.data,
- _content = _messageInfo.content;
- switch (_type) {
- case "blur":
- U.MD.O.E.dataChange.blur(_content);
- break;
- case "addLine":
- U.MD.O.E.dataChange.addLine(_content);
- break;
- case "delLine":
- U.MD.O.E.dataChange.delLine(_content);
- break;
- case "addCol":
- U.MD.O.E.dataChange.addCol(_content);
- break;
- case "delCol":
- U.MD.O.E.dataChange.delCol(_content);
- break;
- case "merge":
- U.MD.O.E.dataChange.merge(_content);
- break;
- case "splitCells":
- U.MD.O.E.dataChange.splitCells(_content);
- break;
- case "rowExpanding":
- U.MD.O.E.dataChange.rowExpanding(_content);
- break;
- case "colExpanding":
- U.MD.O.E.dataChange.colExpanding(_content);
- break;
- case "img":
- U.MD.O.E.dataChange.img(_content);
- break;
- case "addTask":
- U.MD.O.E.dataChange.addTask(_content);
- break;
- case "deleteTask":
- U.MD.O.E.dataChange.deleteTask(_content);
- break;
- case "reNameTask":
- U.MD.O.E.dataChange.reNameTask(_content);
- break;
- case "setStyle":
- U.MD.O.E.dataChange.setStyle(_content);
- break;
- case "setBorder":
- U.MD.O.E.dataChange.setBorder(_content);
- break;
- case "imgChange":
- U.MD.O.E.dataChange.imgChange(_content);
- break;
- case "excelAddHref":
- U.MD.O.E.dataChange.excelAddHref(_content);
- break;
- case "clearAContent":
- U.MD.O.E.dataChange.clearAContent(_content);
- break;
- case "updateTitle":
- U.MD.O.E.data[U.MD.O.E.taskId].title = _content[0];
- break;
- }
- U.MD.O.E.web && !req ? U.MD.O.E.send(info) : "";
-
- };
- U.MD.O.E.dataChange.imgChange = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _imgData = _excelData.img;
- _imgData[0].left = _content.left;
- _imgData[0].top = _content.top;
- }
- U.MD.O.E.dataChange.excelAddHref = function (content, taskId) {
- var _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _content = content;
- var _cellColList = _cellData[_content.col],
- _cell;
- if (!_cellColList) {
- _cellColList = _cellData[_content.col] = {};
- }
- if (!_cellColList[_content.row]) {
- _cellColList[_content.row] = {};
- _cellColList[_content.row].cssStyle = {};
- }
- _cell = _cellColList[_content.row];
- _content.content ? _cell.innerHTML = _content.content : "";
- }
- U.MD.O.E.dataChange.clearAContent = function (content, taskId) {
- var _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _content = content;
- var _cellColList = _cellData[_content.col],
- _cell;
- if (!_cellColList) {
- _cellColList = _cellData[_content.col] = {};
- }
- if (!_cellColList[_content.row]) {
- _cellColList[_content.row] = {};
- _cellColList[_content.row].cssStyle = {};
- }
- _cell = _cellColList[_content.row];
- _content.content ? _cell.innerHTML = _content.content : "";
- }
- U.MD.O.E.dataChange.addTask = function (content) {
- var _content = content;
- U.MD.O.E.data[content.id] = content.data;
- }
- U.MD.O.E.dataChange.deleteTask = function (content) {
- var _content = content;
- delete U.MD.O.E.data[content.id];
- }
- U.MD.O.E.dataChange.reNameTask = function (content) {
- var _content = content;
- U.MD.O.E.data[_content.id].taskName = _content.name;
- }
- U.MD.O.E.dataChange.addLine = function (content, taskId) {
- var _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _content = content,
- _rowData = _excelData.row,
- _cellData = _excelData.cell,
- _start = _content.start,
- _lineNum = _content.lineNum,
- _sizeChange = _content.sizeChange,
- _mergeArr = _content.mergeArr,
- _cellCol;
- if (_mergeArr.length) {
- _mergeArr.forEach(function (info) {
- _cellData[info.col][info.row].endRow = _cellData[info.col][info.row].endRow + _lineNum;
- });
- }
- for (var k in _cellData) {
- _cellCol = _cellData[k];
- var temp = {};
- for (var row in _cellCol) {
- if (row > _start) {
- temp[(+row) + _lineNum] = _cellCol[row];
- temp[(+row) + _lineNum].endRow ? temp[(+row) + _lineNum].endRow = temp[(+row) + _lineNum].endRow + _lineNum : "";
- } else {
- temp[row] = _cellCol[row];
- }
- }
- _cellData[k] = temp;
- }
- var _rowDataChange = _rowData.change,
- _temp = {},
- _rowChange;
- for (var k in _rowDataChange) {
- _rowChange = _rowDataChange[k];
- if (k > _start) {
- _temp[(+k) + _lineNum] = _rowChange;
- } else {
- _temp[k] = _rowChange;
- }
- }
- _rowData.change = _temp;
- if (_sizeChange) {
- for (var i = 1; i <= _lineNum; i++) {
- _rowData.change[_start + i] = _sizeChange;
- }
- }
- _rowData.num = _rowData.num + _lineNum;
- };
- U.MD.O.E.dataChange.delLine = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _rowData = _excelData.row,
- _cellData = _excelData.cell,
- _start = _content.start,
- _end = _content.end,
- _lineNum = _content.lineNum,
- _mergeArr = _content.mergeArr,
- _cellCol;
- for (var k in _cellData) {
- _cellCol = _cellData[k];
- var temp = {};
- for (var row in _cellCol) {
- if (row > _end) {
- temp[(+row) - _lineNum] = _cellCol[row];
- temp[(+row) - _lineNum].endRow ? temp[(+row) - _lineNum].endRow = temp[(+row) - _lineNum].endRow - _lineNum : "";
- } else if (row < _start) {
- temp[row] = _cellCol[row];
- }
- }
- _cellData[k] = temp;
- }
- if (_mergeArr.length) {
- _mergeArr.forEach(function (info) {
- U.MD.O.E.dataChange.merge(info, _taskId);
- });
- }
- var _rowDataChange = _rowData.change,
- _temp = {},
- _rowChange;
- for (var k in _rowDataChange) {
- _rowChange = _rowDataChange[k];
- if (k < _start) {
- _temp[k] = _rowChange;
- } else if (k > _end) {
- _temp[(+k) - _lineNum] = _rowChange;
- }
- }
- _rowData.change = _temp;
- _rowData.num = _rowData.num - _lineNum;
- };
- U.MD.O.E.dataChange.addCol = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _colData = _excelData.column,
- _cellData = _excelData.cell,
- _start = _content.start,
- _sizeChange = _content.sizeChange,
- _colNums = _content.colNums,
- _mergeArr = _content.mergeArr,
- _cellCol,
- _temp = {};
- if (_mergeArr.length) {
- _mergeArr.forEach(function (info) {
- _cellData[info.col][info.row].endCol = _cellData[info.col][info.row].endCol + _colNums;
- });
- }
- for (var k in _cellData) {
- _cellCol = _cellData[k];
- if (k > _start) {
- _temp[+(k) + _colNums] = _cellCol;
- var _temp2 = _temp[(+k) + _colNums];
- for (var i in _temp2) {
- _temp2[i].endCol ? _temp2[i].endCol = _temp2[i].endCol + _colNums : "";
- }
- } else {
- _temp[k] = _cellCol;
- }
- }
- _excelData.cell = _temp;
- var _colDataChange = _colData.change,
- _temp = {},
- _colChange;
- for (var k in _colDataChange) {
- _colChange = _colDataChange[k];
- if (k > _start) {
- _temp[(+k) + _colNums] = _colChange;
- } else {
- _temp[k] = _colChange;
- }
- }
- _colData.change = _temp;
- if (_sizeChange) {
- for (var i = 1; i <= _colNums; i++) {
- _colData.change[_start + i] = _sizeChange;
- }
- }
- _colData.num = _colData.num + _colNums;
- };
- U.MD.O.E.dataChange.delCol = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _colData = _excelData.column,
- _cellData = _excelData.cell,
- _start = _content.start,
- _end = _content.end,
- _colNums = _content.colNums,
- _mergeArr = _content.mergeArr,
- _cellCol,
- _temp = {};
- for (var k in _cellData) {
- _cellCol = _cellData[k];
- if (k > _end) {
- _temp[+(k) - _colNums] = _cellCol;
- var _temp2 = _temp[(+k) - _colNums];
- for (var i in _temp2) {
- _temp2[i].endCol ? _temp2[i].endCol = _temp2[i].endCol - _colNums : "";
- }
- } else if (k < _start) {
- _temp[k] = _cellCol;
- }
- }
- _excelData.cell = _temp;
- if (_mergeArr.length) {
- _mergeArr.forEach(function (info) {
- U.MD.O.E.dataChange.merge(info, _taskId);
- });
- }
- var _colDataChange = _colData.change,
- _temp = {},
- _colChange;
- for (var k in _colDataChange) {
- _colChange = _colDataChange[k];
- if (k < _start) {
- _temp[k] = _colChange;
- } else if (k > _end) {
- _temp[(+k) - _colNums] = _colChange;
- }
- }
- _colData.change = _temp;
- _colData.num = _colData.num - _colNums;
- };
- U.MD.O.E.dataChange.merge = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _cellColList = _cellData[_content.col];
- if (content.row === content.endRow && content.col === content.endCol) {
- _cellData[_content.col][_content.row].endRow = "";
- _cellData[_content.col][_content.row].endCol = ""
- return;
- }
- if (!_cellColList) {
- _cellColList = _cellData[_content.col] = {};
- }
- if (!_cellColList[_content.row]) {
- _cellColList[_content.row] = {};
- }
- _cellColList[_content.row].innerHTML = _content.content;
- _cellColList[_content.row].cssText = _content.cssText;
- _cellColList[_content.row].endRow = _content.endRow;
- _cellColList[_content.row].endCol = _content.endCol;
- };
- U.MD.O.E.dataChange.splitCells = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _cell = _cellData[_content.col][_content.row];
- _cell.endRow = "";
- _cell.endCol = "";
- };
- U.MD.O.E.dataChange.rowExpanding = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _rowData = _excelData.row;
- _content.forEach(function (data) {
- var _rowNum = data.rowName,
- _rowHeight = data.height;
- _rowData.change[_rowNum] = _rowHeight;
- });
- };
- U.MD.O.E.dataChange.colExpanding = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _colData = _excelData.column;
- _content.forEach(function (data) {
- var _colNum = data.colName,
- _colWidth = data.width;
- _colData.change[_colNum] = _colWidth;
- });
- };
- U.MD.O.E.dataChange.img = function (content, taskId) {
- var _content = content,
- _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _imgData = _excelData.img;
- _imgData.push(content);
- };
- U.MD.O.E.dataChange.blur = function (content, taskId) {
- var _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _content = content;
- _content.forEach(function (data) {
- var _text = data.innerText.replace(/\s+/g, ""),
- _cellColList = _cellData[data.col],
- _cell;
- if (!_cellColList) {
- _cellColList = _cellData[data.col] = {};
- }
- if (!_cellColList[data.row]) {
- _cellColList[data.row] = {};
- _cellColList[data.row].cssStyle = {};
- }
- _cell = _cellColList[data.row];
- data.content ? _cell.innerHTML = data.content : "";
- if (data.attr) {
- try {
- _cell.cssStyle[data.attr] = data.value;
- if (!data.value) {
- delete _cell.cssStyle[data.attr]
- }
- } catch (e) {
- console.log(e);
- }
- }
- var cssLen = U.MD.O.E.jsonLen(_cell.cssStyle);
- if (data.clearStyle && !cssLen) {
- data.cssStyle = {};
- data.clearStyle = false;
- }
- if (((!(_text) || _text === ("\u200D")) && !(_cell.endRow)) && !(cssLen)) {
- delete (_cellColList[data.row]);
- }
- })
- };
- U.MD.O.E.dataChange.setBorder = function (content, taskId) {
- var _taskId = taskId || U.MD.O.E.taskId,
- _excelData = U.MD.O.E.data[_taskId],
- _cellData = _excelData.cell,
- _content = content;
- _content.forEach(function (data) {
- var _text = data.innerText.replace(/\s+/g, ""),
- _cellColList = _cellData[data.col],
- _cell;
- if (!_cellColList) {
- _cellColList = _cellData[data.col] = {};
- }
- if (!_cellColList[data.row]) {
- _cellColList[data.row] = {};
- _cellColList[data.row].cssStyle = {};
- }
- _cell = _cellColList[data.row];
- data.content ? _cell.innerHTML = data.content : "";
- if (data.attr && data.br) {
- try {
- _cell.cssStyle[data.br] = data.value;
- if (!data.value) {
- delete _cell.cssStyle[data.attr]
- }
- } catch (e) {
- console.log(e);
- }
- }
- if (data.attr && data.bb) {
- try {
- _cell.cssStyle[data.bb] = data.value;
- if (!data.value) {
- delete _cell.cssStyle[data.attr]
- }
- } catch (e) {
- console.log(e);
- }
- }
- var cssLen = U.MD.O.E.jsonLen(_cell.cssStyle);
- if (data.clearStyle && !cssLen) {
- data.cssStyle = {};
- data.clearStyle = false;
- }
- if (((!(_text) || _text === ("\u200D")) && !(_cell.endRow)) && !(cssLen)) {
- delete (_cellColList[data.row]);
- }
- });
- }
- U.MD.O.E.Save = function (diskinfo) {
- if (!top.U.MD.U.L.isLogin(function (userinfo) { U.MD.O.E.userInfo = userinfo; })) {
- var _isftp,
- _isgroupuser,
- _uid = U.MD.O.E.userInfo.userid,
- _el = $(".U_MD_O_E_excelBox")[0],
- _fileinfo = U.MD.O.E.fileinfo,
- _fileid = _fileinfo.UserDirectoryID,
- _name = top.$('#UD_Excel' + _fileinfo.UserDirectoryID + ' .U_MD_O_H_head_navigation_Title')[0].value,
- _html = _el.innerHTML.escapeQuotes(),
- _jsonData = JSON.stringify(U.MD.O.E.data);
-
- var _directoryid = _fileinfo.UserDirectoryID;
- if (_fileinfo.UserDirectoryID && _fileinfo.UserId && _fileinfo.UserallDirectoryName) {
- top.U.A.Request(US.AUTH, ["SaveFileContent", U.MD.O.E.userInfo.userid, _fileid, _jsonData, _name], function (r) {
- console.log(r);
-
-
- U.Alert("保存成功");
- }, (['', _el]));
- } else {
- top.U.MD.DK.VW.chosenSaveFile('ue', _directoryid, _name, function (fileinfo) {
- top.U.A.Request(US.AUTH, ["SaveFileContent", U.MD.O.E.userInfo.userid, _fileid, _jsonData, fileinfo.UserallDirectoryName], function (r) {
-
-
-
- U.Alert("保存成功");
- });
- });
-
-
-
- }
- }
- }
- U.MD.O.E.LoadContent = function (fileid, fileinfo) {
- U.MD.O.E.initExcel(fileinfo);
- }
- U.MD.O.E.initExcel = function () {
- var _content = "";
- U.MD.O.E.printExcel();
- U.MD.O.E.otherFun();
- }
- U.MD.O.E.printExcel = function (excelobj) {
-
- var _excel = U.MD.O.E,
- _pageobj,
- _rowandrank;
- _excel.printTask();
- _excel.printColBoard(U.MD.O.E.colBoardNum, {});
- _excel.printRowBoard(U.MD.O.E.rowBoardNum, {});
- _excel.printTable();
- _excel.focusInit();
- }
- U.MD.O.E.focusInit = function () {
- var _editorBox = $("#U_MD_O_E_editorBox")[0],
- _focusBox = $("#U_MD_O_E_focusBox")[0];
- U.MD.O.E.BC.modifyFocusSize(1, 1, 1, 1);
- _focusBox.style.background = "";
- _focusBox.style.zIndex = "1";
- $("#POS_1_1").addClass("U_MD_O_E_cellCheckd");
- _editorBox.focusEl = $("#POS_1_1")[0];
-
- U.UF.E.picture.stretch($('.U_MD_O_E_excelBox')[0]);
- $('.U_MD_O_E_excelBox').bind({
- click: function (e) {
- if (e.target.tagName == "IMG") {
- $('.U_MD_O_E_excelBox')[0].imgStretch.img = e.target;
- $('.U_MD_O_E_excelBox')[0].imgStretch.stretch.upimg = e;
- U.UF.E.picture.stretch.setPosition($('.U_MD_O_E_excelBox')[0].imgStretch, e);
- $('.U_MD_O_E_excelBox')[0].focus();
- if (e.target == $(".U_MD_O_E_addTask_img")[0] || e.target == $(".U_MD_O_E_floatBtn")[0]) {
- $('.U_MD_O_E_excelBox')[0].imgStretch.stretch.style.display = "none";
- }
- } else {
- $('.U_MD_O_E_excelBox')[0].imgStretch.stretch.style.display = "none";
- }
- }
- });
- U.MD.O.E.BC.blur();
- U.MD.O.E.BC.focusDbClick();
- U.MD.O.E.BC.editorKeyEvent();
- }
- U.MD.O.E.rePrintExcel = function (data, datr) {
- var _excel = U.MD.O.E,
- _data = data || U.MD.O.E.data[U.MD.O.E.taskId],
- _dataRow = _data.row,
- _dataCol = _data.column,
- _dataCell = _data.cell,
- _dataImg = _data.img;
- $(".U_MD_O_E_rowBoard")[0].innerHTML = "";
- $(".U_MD_O_E_colBoard")[0].innerHTML = "";
- $(".U_MD_O_E_cellBox")[0].innerHTML = "";
- if (datr) {
- _excel.printColBoard(_dataCol.num, _dataCol, datr);
- _excel.printRowBoard(_dataRow.num, _dataRow, datr);
- _excel.printTable(_dataCell, datr);
- _excel.printImg(_dataImg, datr);
- } else {
- _excel.printColBoard(_dataCol.num, _dataCol);
- _excel.printRowBoard(_dataRow.num, _dataRow);
- _excel.printTable(_dataCell);
- _excel.focusInit();
- _excel.printImg(_dataImg);
- }
- }
- U.MD.O.E.printColBoard = function (colnum, colBoardInfo, data) {
-
- var _excel = U.MD.O.E,
- _excelBox = $(".U_MD_O_E_excelBox")[0],
- _colBoard = $(".U_MD_O_E_colBoard")[0],
- _checkAll = $$("div", { className: "U_MD_O_E_checkAll" }, _colBoard),
- _img = $$("img", { "onerror": U.MD.C.imgError, src: "http://coffice.1473.cn/Controls/Office/Excel/img/%E5%85%A8%E9%80%89.png" }, _checkAll),
- _frag = $$("frag"),
- i,
- _column,
- _name,
- _allWidth = 45,
- _colWidth = 136,
- _newWidth,
- _colBox = $$("div", { className: "U_MD_O_E_colBoardBox", style: { position: "relative", float: "left"} }, _frag),
- _colCheckdEl = $$("div", { className: "U_MD_O_E_colCheckdEl", style: { position: "absolute"} }, _colBox),
- _len = colnum;
- for (i = 1; i <= _len; i++) {
- _column = $$("div", { className: "U_MD_O_E_column" }, _colBox);
- $(_column).eAttr("colname", i);
- _name = U.MD.O.E.fromCharCode(i);
- _column.innerText = _name;
- _newWidth = _colWidth;
- if (!data) {
- _colRule = $$("div", { className: "U_MD_O_E_colRule" }, _column);
- _colRule.style.cssText = "margin-left:-3px;position: absolute;top:0px;height: 100%;width: 6px;cursor: e-resize";
- U.MD.O.E.BC.colExpanding(_colRule);
- U.MD.O.E.BC.cBoardChecked(_column);
- _colRule.style.left = (_newWidth - 1) + "px";
- }
-
- if (colBoardInfo.change && colBoardInfo.change[i]) {
- _newWidth = colBoardInfo.change[i]
- }
- _column.style.width = _newWidth + "px";
- _allWidth += _newWidth;
- }
- _colBoard.style.width = _allWidth + "px";
- _colBoard.appendChild(_frag);
- if (!data) {
- _excel.rightClick(_colBoard, "colBoard");
- }
- }
- U.MD.O.E.printRowBoard = function (columnnum, rowBoardInfo, data) {
-
- var _excel = U.MD.O.E,
- _excelBox = $(".U_MD_O_E_excelBox")[0],
- _rowBoard = $(".U_MD_O_E_rowBoard")[0],
- _rowCheckdEl,
- _frag = $$("frag"),
- i,
- _row,
- _rowHeight = _excel.rowBoardHeight,
- _newHeight,
- _len = columnnum,
- _rowRule;
- if (!data) {
- _rowCheckdEl = $$("div", { className: "U_MD_O_E_rowCheckdEl", style: { position: "absolute"} }, _rowBoard);
- }
- for (i = 1; i <= _len; i++) {
- _row = $$("div", { className: "U_MD_O_E_row" }, _frag);
- $(_row).eAttr("rowname", i);
- _row.innerText = i;
- _row.style.lineHeight = "22px";
- _newHeight = _rowHeight;
- if (!data) {
- _rowRule = $$("div", { className: "U_MD_O_E_rowRule" }, _row);
- _rowRule.style.cssText = "margin-top:-3px;position: absolute;height: 6px;width: 100%;cursor: n-resize";
- U.MD.O.E.BC.rowExpanding(_rowRule);
- U.MD.O.E.BC.rBoardChecked(_row);
- _rowRule.style.top = _newHeight + "px";
- }
-
- if (rowBoardInfo.change && (rowBoardInfo.change[i])) {
- _newHeight = rowBoardInfo.change[i]
- }
- _row.style.height = _newHeight + "px";
- }
- _rowBoard.appendChild(_frag);
- if (!data) {
- _excel.rightClick(_rowBoard, "rowBoard");
- }
- }
- U.MD.O.E.printTable = function (data, bonn) {
-
- var _focusBoxHTML = " <div id=\"U_MD_O_E_focusBox\" class=\"U_MD_O_E_focusBox\"> \n" +
- " <div id=\"U_MD_O_E_editorBox\" class=\"U_MD_O_E_editorBox\" contenteditable=\"false\">\n" +
- " </div>\n" +
- " <div contenteditable=\"false\" class=\"U_MD_O_E_borderLeft U_MD_O_E_borderColor U_MD_O_E_borderDefalut\">\n" +
- " </div>\n" +
- " <div contenteditable=\"false\" class=\"U_MD_O_E_borderTop U_MD_O_E_borderColor U_MD_O_E_borderDefalut\">\n" +
- " </div>\n" +
- " <div contenteditable=\"false\" class=\"U_MD_O_E_borderRight U_MD_O_E_borderColor U_MD_O_E_borderDefalut\">\n" +
- " </div>\n" +
- " <div contenteditable=\"false\" class=\"U_MD_O_E_borderBottom U_MD_O_E_borderColor U_MD_O_E_borderDefalut\">\n" +
- " </div>\n" +
- " <div contenteditable=\"false\" class=\"U_MD_O_E_borderCorner\">\n" +
- " </div>\n" +
- " </div>",
- _excel = U.MD.O.E,
- _excelBox = $(".U_MD_O_E_excelBox")[0],
- _cellBox = $(".U_MD_O_E_cellBox")[0],
- _columnList = $(".U_MD_O_E_column"),
- _rowList = $(".U_MD_O_E_row"),
- _width,
- _height,
- _colLen = _columnList.length,
- _rowLen = _rowList.length,
- _frag = $$("frag"),
- i,
- j,
- cell,
- _left = 0,
- _top = 0,
- _colName,
- _rowName;
- if (!bonn || !data) {
- _cellBox.innerHTML = _focusBoxHTML;
- }
- _excelBox.worksheetid = "e3979682e-cb7a-8db7-a3b3-88233ea32e24"
- for (i = 0; i < _colLen; i++) {
- _colName = _columnList[i].colname;
- _width = _columnList[i].offsetWidth;
- for (j = 0; j < _rowLen; j++) {
- _height = _rowList[j].offsetHeight;
- _rowName = _rowList[j].rowname;
- _cell = $$("div", { className: "U_MD_O_E_cell" }, _frag);
- _cell.style.width = _width + "px";
- _cell.style.height = _height + "px";
- _cell.style.left = _left + "px";
- _cell.style.top = _top + "px";
- _cell.id = "POS_" + _colName + "_" + _rowName;
- $(_cell).eAttr("col", _colName);
- $(_cell).eAttr("row", _rowName);
- if (!bonn || !data) {
- U.MD.O.E.BC.Focus(_cell);
- U.MD.O.E.BC.dragCheckd(_cell);
- }
- _top += _rowList[j].offsetHeight;
- }
- _left += _columnList[i].offsetWidth;
- _top = 0;
- }
- _cellBox.appendChild(_frag);
- if (!bonn || !data) {
- _excel.rightClick(_cellBox, "cellBox");
- }
- var col,
- row,
- _innerHTML,
- _colCell,
- _endCell,
- _cellInfo,
- _cell;
- if (data) {
- for (var col in data) {
- var _colCell = data[col];
- for (var row in _colCell) {
- _cellInfo = _colCell[row];
- _cell = $(_cellBox).find("#POS_" + col + "_" + row)[0]
- _cellInfo.innerHTML ? _cell.innerHTML = _cellInfo.innerHTML : '';
- if (_cellInfo.endRow) {
- _endCell = $(_cellBox).find("#POS_" + _cellInfo.endCol + "_" + _cellInfo.endRow)[0];
- _excel.RC.mergeCells(_cell, _endCell, true);
- }
- if (U.MD.O.E.jsonLen(_cellInfo.cssStyle)) {
- U.MD.O.E.TL.jsonSetStyle(_cell, _cellInfo.cssStyle);
- }
- _cellInfo.cssText ? _cell.style.cssText = _cellInfo.cssText : "";
- }
- }
- }
- }
- U.MD.O.E.printImg = function (dataArr, datr) {
- var _img;
- dataArr.forEach(function (data) {
- _img = U.MD.O.E.createImg(data.src, data);
- if (!datr) {
- U.MD.O.E.BC.pictureControl(_img);
- }
- })
- }
- U.MD.O.E.createSelection = function () {
-
- var els = $('div[datafont]'),
- csstext = "font-weight: normal;white-space: pre; min-height: 1.2em; padding:6px 4px; cursor: pointer;background:#fff";
- U.MD.UI.editor.Select({ '宋体': '宋体', 'sans-serif': 'sans-serif', '微软雅黑': '微软雅黑', '楷体': '楷体', '黑体': '黑体', '隶书': '隶书', 'andale mono': 'andale mono', 'arial black': 'arial black' },
- { "className": "U_MD_O_E_Editor_head_features_ul_s", style: { width: '100%', height: '20px', border: 'none'} }, function (v) { U.MD.O.E.TL.setStyle({ 'fontFamily': v }) },
- els[0])
- U.MD.UI.editor.Select({ '12': '12号', '14': '14号', '16': '16号', '18': '18号', '20': '20号', '24': '24号' },
- { "className": "U_MD_O_E_Editor_head_features_ul_s", style: { width: '100%', height: '20px', border: 'none'} },
- function (v) { U.MD.O.E.TL.setStyle({ 'fontSize': v + 'px' }) },
- els[1])
- }
- U.MD.O.E.upload = function (input) {
- U.UF.UP.inputUpload([input], 'http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor&UserId=FA92AAC5-4134-449F-9659-0DC12F4F68E9', function (r) {
- var _src = 'http://fs.1473.cn/' + r.value[0],
- _img;
- _img = U.MD.O.E.createImg(_src);
- _img.onload = function () {
- var _data = {
- src: _src,
- left: _img.offsetLeft,
- top: _img.offsetTop,
- width: _img.offsetWidth,
- height: _img.offsetHeight,
- type: "img"
- };
- console.log(_data);
- U.MD.O.E.dataChange(U.MD.O.E.excelInfo("img", _data));
- U.MD.O.E.BC.pictureControl(_img);
- }
- });
- }
- U.MD.O.E.NDimg = function () {
- if (!top.U.MD.U.L.isLogin()) {
- top.U.MD.DK.VW.choseFile(function (data) {
- var _src = 'http://fs.1473.cn/' + data.UserallDirectoryName,
- _img;
- _img = U.MD.O.E.createImg(_src);
- _img.onload = function () {
- var _data = {
- src: _src,
- left: _img.offsetLeft,
- top: _img.offsetTop,
- width: _img.offsetWidth,
- height: _img.offsetHeight,
- type: "img"
- };
- console.log(_data);
- U.MD.O.E.dataChange(U.MD.O.E.excelInfo("img", _data));
- U.MD.O.E.BC.pictureControl(_img);
- }
- window.focus();
- }, "jpg");
- }
- }
- U.MD.O.E.createImg = function (src, data) {
- var _cellBox = $(".U_MD_O_E_cellBox")[0],
- _img = $$("img", { "onerror": U.MD.C.imgError, src: src }, _cellBox),
- _focusBox = $("#U_MD_O_E_focusBox")[0];
- _img.style.position = "absolute";
- _img.style.maxWidth = "2000px;"
- _img.style.maxHeight = "2000px;"
- if (data) {
- _img.width = data.width;
- _img.height = data.height;
- _img.style.left = data.left + "px";
- _img.style.top = data.top + "px";
- } else {
- _img.style.left = _focusBox.style.left;
- _img.style.top = _focusBox.style.top;
- }
- return _img;
- }
- U.MD.O.E.changeImg = function (data) {
- var _Allimg = $(".U_MD_O_E_cellBox")[0].getElementsByTagName("img");
- for (var i = 0; i < _Allimg.length; i++) {
- _Allimg[i].index = i;
- if (data) {
- _Allimg[i].width = data.width;
- _Allimg[i].height = data.height;
- _Allimg[i].style.left = data.left + "px";
- _Allimg[i].style.top = data.top + "px";
- }
- }
- return _Allimg[0];
- }
- U.MD.O.E.rightClick = function (element, type) {
- switch (type) {
- case "cellBox":
- U.MD.O.E.rightClick.cellBox(element);
- break;
- case "colBoard":
- U.MD.O.E.rightClick.colBoard(element);
- break;
- case "rowBoard":
- U.MD.O.E.rightClick.rowBoard(element);
- break;
- case "taskBar":
- U.MD.O.E.rightClick.taskBar(element);
- break;
- }
- $(document).bind('mousedown', function (e) {
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- })
- };
- U.MD.O.E.rightClick.cellBox = function (element) {
- var _excel = U.MD.O.E,
- _cellBox = element;
- var _addLine = {
- innerHTML: '添加行<input id="lineNum" value="1" type="num" style="width: 30px;height: 18px;margin-left: 28px;box-sizing: border-box;"> 行',
- onclick: function () {
- var _input = $("#lineNum")[0],
- _line = _input.value,
- _cellarr = _excel.cellCheckd(),
- _cellLast = _cellarr[1];
- _excel.RC.addLine(_cellLast, +_line);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _addCol = {
- innerHTML: '添加列<input id="colNum" value="1" type="num" style="width: 30px;height: 18px;margin-left: 28px;box-sizing: border-box;"> 列',
- onclick: function () {
- var _input = $("#colNum")[0],
- _col = _input.value,
- _endCell = _excel.cellCheckd()[1];
- _excel.RC.addCol(_endCell, +_col);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _removeLine = {
- innerHTML: '删除行',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1],
- _checkeddata = _excel.BC.selectCellData(_startCell, _endCell),
- _rmlinenum = _checkeddata.maxy - _checkeddata.miny + 1;
- _excel.RC.removeLine(_startCell, _endCell);
- var _data = {
- checkeddata: _checkeddata,
- rmlinenum: _rmlinenum,
- type: "removeLine"
- };
- _excel.BC.reSelectCell(_data);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _removeCol = {
- innerHTML: '删除列',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1],
- _checkeddata = _excel.BC.selectCellData(_startCell, _endCell),
- _rmcolnum = _checkeddata.maxx - _checkeddata.minx + 1;
- _excel.RC.removeCol(_startCell, _endCell);
- var _data = {
- checkeddata: _checkeddata,
- rmcolnum: _rmcolnum,
- type: "removeCol"
- };
- _excel.BC.reSelectCell(_data);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _copy = {
- innerHTML: '复制',
- onclick: function () {
- _excel.RC.cellCopy();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _taste = {
- innerHTML: '粘贴',
- onclick: function () {
- _excel.RC.cellTaste();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _cut = {
- innerHTML: '剪切',
- onclick: function () {
- _excel.RC.cellCut();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _mergeCells = {
- innerHTML: '合并单元格',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1];
- _excel.RC.mergeCells(_startCell, _endCell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _splitCells = {
- innerHTML: '拆分单元格',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.splitCells(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearContent = {
- innerHTML: '清除内容',
- onclick: function () {
- var _cellList = U.UF.C.toArray($(".U_MD_O_E_cellCheckd"));
- _excel.RC.clearContent(_cellList);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearStyle = {
- innerHTML: '清除格式',
- onclick: function () {
- _excel.TL.clearStyle();
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertLink = {
- innerHTML: '插入链接',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.insertLink(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertImg = {
- innerHTML: '插入图片',
- onclick: function () {
- return $("#U_MD_O_E_Editor_head_features_ul_img")[0].click();
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _arr = [_addLine, _addCol, _removeLine, _removeCol, _copy, _taste, _cut, _mergeCells, _splitCells, _clearContent, _clearStyle, _insertLink, _insertImg, ];
- $(_cellBox).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault(e);
- U.UF.EL.rightMenu(_arr, _cellBox);
- $(this).find('input').bind('keypress', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keydown', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keyup', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('click', function (e) {
- U.UF.EV.stopBubble(e);
- });
- });
- $(_cellBox).bind('mousedown', function (e) {
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- });
- }
- U.MD.O.E.rightClick.taskBar = function (taskEl) {
- var _excel = U.MD.O.E;
- var _delete = {
- innerHTML: '删除',
- onclick: function (e) {
- U.UF.EV.stopBubble(e);
- _excel.RC.taskDelete(taskEl);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _reName = {
- innerHTML: '重命名',
- onclick: function (e) {
- U.UF.EV.stopBubble(e);
- _excel.RC.taskRename(taskEl);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _copy = {
- innerHTML: '复制',
- onclick: function (e) {
- U.UF.EV.stopBubble(e);
- _excel.RC.taskCopy(taskEl);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _arr = [_delete, _reName, _copy];
- $(taskEl).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault();
- U.UF.EL.rightMenu(_arr, taskEl);
- });
- $(taskEl).bind('dblclick', function () {
- U.MD.O.E.RC.taskRename(this);
- })
- $(taskEl).bind('mousedown', function (e) {
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- });
- }
- U.MD.O.E.rightClick.colBoard = function (element) {
- var _excel = U.MD.O.E,
- _colBoard = element;
- var _addCol = {
- innerHTML: '添加列<input id="colNum" value="1" type="num" style="width: 30px;height: 18px;margin-left: 28px;box-sizing: border-box;"> 列',
- onclick: function () {
- var _input = $("#colNum")[0],
- _col = _input.value,
- _endCell = _excel.cellCheckd()[1];
- _excel.RC.addCol(_endCell, +_col);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _removeCol = {
- innerHTML: '删除列',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1],
- _checkeddata = _excel.BC.selectCellData(_startCell, _endCell),
- _rmcolnum = _checkeddata.maxx - _checkeddata.minx + 1;
- _excel.RC.removeCol(_startCell, _endCell);
- var _data = {
- checkeddata: _checkeddata,
- rmcolnum: _rmcolnum,
- type: "removeCol"
- };
- _excel.BC.reSelectCell(_data);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _copy = {
- innerHTML: '复制',
- onclick: function () {
- _excel.RC.colBoardCopy();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _taste = {
- innerHTML: '粘贴',
- onclick: function () {
- _excel.RC.colBoardTaste();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _cut = {
- innerHTML: '剪切',
- onclick: function () {
- _excel.RC.colBoardCut();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _mergeCells = {
- innerHTML: '合并单元格',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1];
- _excel.RC.mergeCells(_startCell, _endCell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearContent = {
- innerHTML: '清除内容',
- onclick: function () {
- var _cellList = U.UF.C.toArray($(".U_MD_O_E_cellCheckd"));
- _excel.RC.clearContent(_cellList);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearStyle = {
- innerHTML: '清除格式',
- onclick: function () {
- var _cellList = U.UF.C.toArray($(".U_MD_O_E_cellCheckd"));
- _excel.RC.clearStyle(_cellList);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _setWidth = {
- innerHTML: '设置列宽<input id="colWidth" value="107" type="num" style="width: 50px;height: 18px;margin-left: 10px;box-sizing: border-box;"> px',
- onclick: function () {
- var _startCol = _excel.cellCheckd()[0].col,
- _endCol = _excel.cellCheckd()[1].col,
- _colWidth = $("#colWidth")[0].value;
- if (_colWidth < 50) {
- U.Alert("列宽不能低于50像素");
- return;
- }
- _excel.RC.cBoardsetWidth(_startCol, _endCol, _colWidth);
- _excel.BC.reSelectCell();
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _hide = {
- innerHTML: '隐藏列',
- onclick: function () {
- var _startCol = _excel.cellCheckd()[0].col,
- _endCol = _excel.cellCheckd()[1].col;
- _excel.RC.cBoardHide(_startCol, _endCol);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _cancelHide = {
- innerHTML: '取消隐藏',
- onclick: function () {
- var _startCol = _excel.cellCheckd()[0].col,
- _endCol = _excel.cellCheckd()[1].col;
- _excel.RC.cBoardCancelHide(_startCol, _endCol);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertLink = {
- innerHTML: '插入链接',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.insertLink(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertImg = {
- innerHTML: '插入图片',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.insertImg(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _arr = [_addCol, _removeCol, _copy, _taste, _cut, _mergeCells, _clearStyle, _clearContent, _setWidth, _hide, _cancelHide, _insertLink, _insertImg];
- $(_colBoard).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault();
- U.UF.EL.rightMenu(_arr, _colBoard);
- $(this).find('input').bind('keypress', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keydown', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keyup', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('click', function (e) {
- U.UF.EV.stopBubble(e);
- });
- });
- $(_colBoard).bind('mousedown', function (e) {
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- });
- }
- U.MD.O.E.rightClick.rowBoard = function (element) {
- var _excel = U.MD.O.E,
- _rowBoard = element;
- var _addLine = {
- innerHTML: '添加行<input id="lineNum" value="1" type="num" style="width: 30px;height: 18px;margin-left: 28px;box-sizing: border-box;"> 行',
- onclick: function () {
- var _input = $("#lineNum")[0],
- _line = _input.value,
- _cellLast = _excel.cellCheckd()[1];
- _input.bind('keypress', function (e) {
- U.UF.EV.stopBubble(e);
- });
- _excel.RC.addLine(_cellLast, +_line);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _removeLine = {
- innerHTML: '删除行',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1],
- _checkeddata = _excel.BC.selectCellData(_startCell, _endCell),
- _rmlinenum = _checkeddata.maxy - _checkeddata.miny + 1;
- _excel.RC.removeLine(_startCell, _endCell);
- var _data = {
- checkeddata: _checkeddata,
- rmlinenum: _rmlinenum,
- type: "removeLine"
- };
- _excel.BC.reSelectCell(_data);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _copy = {
- innerHTML: '复制',
- onclick: function () {
- _excel.RC.rBoardCopy();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _taste = {
- innerHTML: '粘贴',
- onclick: function () {
- _excel.RC.rBoardTaste();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _cut = {
- innerHTML: '剪切',
- onclick: function () {
- _excel.RC.rBoardCut();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearContent = {
- innerHTML: '清除内容',
- onclick: function () {
- _excel.RC.rBoardClearCt();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearStyle = {
- innerHTML: '清除格式',
- onclick: function () {
- var _cellList = U.UF.C.toArray($(".U_MD_O_E_cellCheckd"));
- _excel.RC.clearStyle(_cellList);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _mergeCells = {
- innerHTML: '合并单元格',
- onclick: function () {
- var _startCell = _excel.cellCheckd()[0],
- _endCell = _excel.cellCheckd()[1];
- _excel.RC.mergeCells(_startCell, _endCell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _setHeight = {
- innerHTML: '设置行高<input id="rowHeight" value="22" type="num" style="width: 50px;height: 18px;margin-left: 10px;box-sizing: border-box;"> px',
- onclick: function () {
- var _startRow = _excel.cellCheckd()[0].row,
- _endRow = _excel.cellCheckd()[1].row,
- _rowHeight = $("#rowHeight")[0].value;
- if (_rowHeight < 20) {
- U.Alert("高度不能低于20像素");
- return;
- }
- _excel.RC.rBoardsetHeight(_startRow, _endRow, _rowHeight);
- _excel.BC.reSelectCell();
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _hide = {
- innerHTML: '隐藏行',
- onclick: function () {
- var _startRow = _excel.cellCheckd()[0].row,
- _endRow = _excel.cellCheckd()[1].row;
- _excel.RC.rBoardHide(_startRow, _endRow);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _cancelHide = {
- innerHTML: '取消隐藏',
- onclick: function () {
- var _startRow = _excel.cellCheckd()[0].row,
- _endRow = _excel.cellCheckd()[1].row;
- _excel.RC.rBoardCancelHide(_startRow, _endRow);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertLink = {
- innerHTML: '插入链接',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.insertLink(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _insertImg = {
- innerHTML: '插入图片',
- onclick: function () {
- var _cell = _excel.cellCheckd()[0];
- _excel.RC.insertImg(_cell);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _clearStyle = {
- innerHTML: '清除格式',
- onclick: function () {
- var _cellList = U.UF.C.toArray($(".U_MD_O_E_cellCheckd"));
- _excel.RC.clearStyle(_cellList);
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _arr = [_addLine, _removeLine, _copy, _taste, _cut, _mergeCells, _clearContent, _clearStyle, _setHeight, _hide, _cancelHide, _insertLink, _insertImg];
- $(_rowBoard).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault();
- U.UF.EL.rightMenu(_arr, _rowBoard);
- $(this).find('input').bind('keypress', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keydown', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('keyup', function (e) {
- U.UF.EV.stopBubble(e);
- });
- $(this).find('input').bind('click', function (e) {
- U.UF.EV.stopBubble(e);
- });
- });
- $(_rowBoard).bind('mousedown', function (e) {
- $("#U_UF_EL_rightmenu")[0] && $("#U_UF_EL_rightmenu")[0].remove();
- });
- }
- U.MD.O.E.switchBar = function (button) {
- var _bar = $("#U_MD_O_E_body_left")[0],
- _display = _bar.style.display;
- if (_display === "block") {
- button.src = "http://coffice.1473.cn/Controls/Office/Excel/img/浮动按钮收缩.png";
- _bar.style.display = "none";
- } else {
- button.src = "http://coffice.1473.cn/Controls/Office/Excel/img/浮动按钮展开.png";
- _bar.style.display = "block";
- }
- }
- U.MD.O.E.fromCharCode = function (num) {
- if (num <= 0) return;
- var _code,
- firstNum = Math.floor(num / 26),
- endNum = num % 26;
- if (!endNum) endNum = 26;
- if (firstNum === 0 || (num === 26)) {
- _code = String.fromCharCode((64 + endNum));
- } else {
- _code = U.MD.O.E.fromCharCode(firstNum) + String.fromCharCode((64 + endNum));
- }
- return _code;
- }
- U.MD.O.E.placeCaretAtEnd = function (el) {
- if (el.collapse) {
- var range = el;
- range.collapse(false);
- var sel = window.getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- return;
- }
- if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") {
- var range = document.createRange();
- range.selectNodeContents(el);
- range.collapse(false);
- var sel = window.getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- } else if (typeof document.body.createTextRange != "undefined") {
- var textRange = document.body.createTextRange();
- textRange.moveToElementText(el);
- textRange.collapse(false);
- textRange.select();
- }
- };
- U.MD.O.E.After = function (el, newEl) {
- var _this = el;
- var parentEl = _this.parentNode;
- var child = parentEl.childNodes;
- var last = child[child.length - 1] || parentEl.lastChild;
- if (last === _this) {
- parentEl.appendChild(newEl);
- } else {
- parentEl.insertBefore(newEl, _this.nextSibling);
- }
- return newEl;
- };
- U.MD.O.E.cellCheckd = function () {
- var _arr = [],
- _posA,
- _posB,
- _checkCell = document.querySelectorAll(".U_MD_O_E_cellCheckd");
- _checkCell = U.UF.C.toArray(_checkCell);
- _checkCell.sort(function (a, b) {
- _idA = +(a.id.replace(/[^0-9]/ig, ""));
- _idB = +(b.id.replace(/[^0-9]/ig, ""));
- return _idA - _idB;
- });
- _arr.push(_checkCell[0]);
- _arr.push(_checkCell[_checkCell.length - 1]);
- return _arr;
- }
- U.MD.O.E.jsonLen = function (json) {
- var _json = json,
- _len = 0;
- for (var i in json) {
- _len++;
- }
- return _len;
- }
- U.MD.O.E.excelInfo = function (type, content) {
- return {
- sendId: U.MD.O.E.fileinfo.UserId,
- receiveId: U.MD.O.E.fileinfo.UserDirectoryID,
- type: 'us.excel',
- messageInfo: {
- type: type,
- worksheetId: U.MD.O.E.taskId,
- content: content,
- docId: U.MD.O.E.fileinfo.UserDirectoryID,
- pageId: US.pageId
- }
- };
- };
- U.MD.O.E.connect = function () {
- if (US.userInfo.userid && U.MD.O.E.fileinfo.UserDirectoryID) {
- U.A.Request(US.SCOKET, ["login", JSON.stringify({
- pageId: US.pageId,
- userId: US.userInfo.userid,
- userName: US.userInfo.UserName,
- type: US.systemId
- })], U.MD.O.E.pollingAsyn);
- }
- U.MD.O.E.addExcel();
- };
- U.MD.O.E.send = function (message) {
- U.A.Request(US.SCOKET, ["send", JSON.stringify({
- "us.excel": Array.prototype.concat(message)
- })]);
- }
- U.MD.O.E.addExcel = function () {
- var post = {
- excelId: U.MD.O.E.fileinfo.UserDirectoryID,
- pageId: US.pageId,
- userId: US.userInfo.userid
- };
- U.A.Request(US.SCOKET, ["addExcel", JSON.stringify(post)], function (v) {
- console.log(v.value);
- });
- };
- U.MD.O.E.TitleChange = function () {
- var _fileinfo = U.MD.O.E.fileinfo,
- _name = [];
- _name[0] = top.$('#UD_Excel' + _fileinfo.UserDirectoryID + ' .U_MD_O_H_head_navigation_Title')[0].value;
- U.MD.O.E.dataChange(U.MD.O.E.excelInfo("updateTitle", _name));
- }
|