file_detail.js 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. $(document).ready(function() {
  2. autoFlashHeight();
  3. $('#filing').height($(".sjs-height-0").height() - $('#add-slibing').parent().parent().height() - 10);
  4. class FilingObj {
  5. constructor(setting) {
  6. // 原始数据整理后的树结构,用来整理zTree显示
  7. this.dragTree = createDragTree({
  8. id: 'id',
  9. pid: 'tree_pid',
  10. level: 'tree_level',
  11. order: 'tree_order',
  12. rootId: '-1'
  13. });
  14. // 界面显示的zTree
  15. this.setting = setting;
  16. this.filingTree = null;
  17. this.pageCount = 15;
  18. this.expandKey = 'filing-' + window.location.pathname.split('/')[2];
  19. const cache = getLocalCache(this.expandKey);
  20. this.expandCache = cache ? _.uniq(cache.split(',')) : [];
  21. this.curFilingKey = 'cur-filing-' + window.location.pathname.split('/')[2];
  22. $('#filing').height($(".sjs-height-0").height()-$('.d-flex',".sjs-height-0").height());
  23. }
  24. calcTotalFileCount() {
  25. this.dragTree.recursiveFun(this.dragTree.children, x => {
  26. if (x.children && x.children.length > 0) {
  27. x.total_file_count = x.children.reduce((pre, c) => {
  28. if (x.filing_type === 1) console.log('reduce', c.name, c.total_file_count);
  29. return pre + c.total_file_count
  30. }, 0);
  31. } else {
  32. x.total_file_count = x.file_count || 0;
  33. }
  34. if (x.filing_type === 1) console.log(x.name, x.total_file_count);
  35. });
  36. }
  37. _loadFilingSourceNode() {
  38. const self = this;
  39. const loadChildren = function(children) {
  40. for (const child of children) {
  41. if (child.children && child.children.length > 0) loadChildren(child.children);
  42. child.source_node = self.dragTree.getItems(child.id);
  43. }
  44. };
  45. const nodes = this.filingTree.getNodes();
  46. loadChildren(nodes);
  47. }
  48. loadFiling() {
  49. const self = this;
  50. if (this.filingTree) $.fn.zTree.destroy(this.setting.treeId);
  51. const sortNodes = this.dragTree.nodes.map(x => {
  52. const result = {
  53. id: x.id,
  54. tree_pid: x.tree_pid,
  55. name: x.name + (x.total_file_count > 0 ? `(${x.total_file_count})` : ''),
  56. spid: x.spid,
  57. };
  58. if (x.is_fixed) result.isParent = true;
  59. if (x.is_folder || x.is_fixed) result.open = self.expandCache.indexOf(result.id) >= 0;
  60. return result;
  61. });
  62. this.filingTree = $.fn.zTree.init($('#filing'), this.setting, sortNodes);
  63. this._loadFilingSourceNode();
  64. const curCache = getLocalCache(this.curFilingKey);
  65. const curNode = curCache ? this.filingTree.getNodeByParam('id', curCache) : null;
  66. if (curNode){
  67. this.filingTree.selectNode(curNode);
  68. filingObj.setCurFiling(curNode);
  69. }
  70. }
  71. analysisFiling(data) {
  72. this.dragTree.loadDatas(data);
  73. this.calcTotalFileCount();
  74. this.loadFiling();
  75. }
  76. _getFileNameHtml(file) {
  77. const editHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1" name="edit-file" fid="${file.id}"><i class="fa fa-pencil fa-fw"></i></a>` : '';
  78. const viewHtml = file.viewpath ? `<a href="${file.viewpath}" class="mr-1" target="_blank"><i class="fa fa-eye fa-fw"></i></a>` : '';
  79. const downHtml = `<a href="javascript: void(0);" onclick="AliOss.downloadFile('${file.filepath}', '${file.filename + file.fileext}')" class="mr-1"><i class="fa fa-download fa-fw"></i></a>`;
  80. const delHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1 text-danger" name="del-file" fid="${file.id}"><i class="fa fa-trash-o fa-fw"></i></a>` : '';
  81. return `<div class="d-flex justify-content-between align-items-center table-file"><div name="filename" fid="${file.id}">${file.filename}${file.fileext}</div><div class="btn-group-table" style="display: none;">${editHtml}${viewHtml}${downHtml}${delHtml}</div></div>`;
  82. }
  83. _getEditFileNameHtml(file) {
  84. const inputHtml = `<input type="text" class="form-control form-control-sm form-control-width" maxlength="100" value="${file.filename + file.fileext}" fid="${file.id}">`;
  85. const btnHtml = `<div class="btn-group-table" style="display: none;"><a href="javascript: void(0)" class="mr-1" name="edit-file-ok"><i class="fa fa-check fa-fw"></i></a><a href="javascript: void(0)" class="mr-1" name="edit-file-cancel"><i class="fa fa-remove fa-fw"></i></a></div>`;
  86. return `<div class="d-flex justify-content-between align-items-center table-file"><div>${inputHtml}</div>${btnHtml}</div>`;
  87. }
  88. _getFileHtml(file) {
  89. const html = [];
  90. html.push(`<tr fid="${file.id}">`);
  91. html.push(`<td class="text-center"><input type="checkbox" name="bd-check" fid="${file.id}"></td>`);
  92. html.push(`<td fid="${file.id}">${this._getFileNameHtml(file)}</td>`);
  93. html.push(`<td class="text-center">${file.user_name}</td>`);
  94. html.push(`<td class="text-center">${moment(file.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>`);
  95. html.push(`<td class="text-center">${file.fileext_str}</td>`);
  96. html.push('</tr>');
  97. return html.join('');
  98. }
  99. refreshFilesTable() {
  100. const html = [];
  101. const files = this.curFiling.source_node.files;
  102. if (!files || files.length === 0) {
  103. $('#file-list').html('');
  104. return;
  105. }
  106. const startIndex = (this.curPage - 1)*this.pageCount;
  107. const endIndex = this.curPage*this.pageCount;
  108. for (const [i, f] of files.entries()) {
  109. if (i < startIndex || i >= endIndex) continue;
  110. html.push(this._getFileHtml(f));
  111. }
  112. $('#file-list').html(html.join(''));
  113. }
  114. refreshPages() {
  115. if (!filingObj.curFiling) return;
  116. filingObj.curTotalPage = Math.ceil(filingObj.curFiling.source_node.file_count / this.pageCount);
  117. $('#curPage').html(filingObj.curPage);
  118. $('#curTotalPage').html(filingObj.curTotalPage);
  119. if (filingObj.curTotalPage > 1) {
  120. $('#showPage').show();
  121. } else {
  122. $('#showPage').hide();
  123. }
  124. }
  125. async loadFiles(node, page) {
  126. if (node.source_node.children && node.source_node.children.length > 0) return;
  127. if (!node.source_node.files) node.source_node.files = [];
  128. if (!node.source_node.file_count) return;
  129. if (node.source_node.files && node.source_node.files.length === node.source_node.file_count) return;
  130. const needFiles = Math.min(page*this.pageCount, node.source_node.file_count);
  131. if (node.source_node.files && needFiles <= node.source_node.files.length) return;
  132. const files = await postDataAsync('file/load', { filing_id: node.id, page, count: this.pageCount });
  133. files.forEach(x => {
  134. const file = node.source_node.files.find(f => {return x.id === f.id; });
  135. if (file) {
  136. Object.assign(file, x);
  137. } else {
  138. node.source_node.files.push(x);
  139. }
  140. });
  141. node.source_node.files.sort((x, y) => {
  142. return x.create_time - y.create_time;
  143. });
  144. }
  145. addSiblingFiling(node) {
  146. const self = this;
  147. postData('filing/add', { tree_pid: node.tree_pid, tree_pre_id: node.id }, function(result) {
  148. const refreshData = self.dragTree.loadPostData(result);
  149. const newNode = refreshData.create[0];
  150. const nodes = self.filingTree.addNodes(node.getParentNode(), node.getIndex() + 1, [{ id: newNode.id, tree_pid: newNode.tree_pid, name: newNode.name, spid: newNode.spid }]);
  151. nodes[0].source_node = newNode;
  152. });
  153. }
  154. addChildFiling(node) {
  155. const self = this;
  156. postData('filing/add', { tree_pid: node.id }, function(result) {
  157. const refreshData = self.dragTree.loadPostData(result);
  158. const newNode = refreshData.create[0];
  159. const nodes = self.filingTree.addNodes(node, -1, [{ id: newNode.id, tree_pid: newNode.tree_pid, name: newNode.name, spid: newNode.spid}]);
  160. nodes[0].source_node = newNode;
  161. });
  162. }
  163. delFiling(node, callback) {
  164. const parent = node.getParentNode();
  165. const self = this;
  166. postData('filing/del', { id: node.id }, function(result) {
  167. self.updateFilingFileCount(node, 0);
  168. self.dragTree.loadPostData(result);
  169. self.filingTree.removeNode(node);
  170. self.calcTotalFileCount();
  171. if (parent) {
  172. const path = parent.getPath();
  173. for (const p of path) {
  174. p.name = p.source_node.name + (p.source_node.total_file_count > 0 ? `(${p.source_node.total_file_count})` : '');
  175. if (p.source_node.is_fixed) p.isParent = true;
  176. filingObj.filingTree.updateNode(p);
  177. }
  178. }
  179. if (callback) callback();
  180. });
  181. }
  182. async renameFiling(node, newName) {
  183. const result = await postDataAsync('filing/save', { id: node.id, name: newName });
  184. node.source_node.name = newName;
  185. node.name = node.source_node.name + (node.source_node.total_file_count > 0 ? `(${node.source_node.total_file_count})` : '');
  186. return result;
  187. }
  188. updateFilingFileCount(filing, count) {
  189. let differ = count - (filing.source_node.file_count || 0);
  190. filing.source_node.file_count = count;
  191. filing.source_node.total_file_count = count;
  192. filing.name = filing.source_node.name + (filing.source_node.total_file_count > 0 ? `(${filing.source_node.total_file_count})` : '');
  193. filingObj.filingTree.updateNode(filing);
  194. let parent = filing.getParentNode();
  195. while (!!parent) {
  196. parent.source_node.total_file_count = parent.source_node.total_file_count + differ;
  197. parent.name = parent.source_node.name + (parent.source_node.total_file_count > 0 ? `(${parent.source_node.total_file_count})` : '');
  198. filingObj.filingTree.updateNode(parent);
  199. parent = parent.getParentNode();
  200. }
  201. }
  202. uploadFiles(files, callback) {
  203. const formData = new FormData();
  204. formData.append('filing_id', filingObj.curFiling.id);
  205. for (const file of files) {
  206. if (file === undefined) {
  207. toastr.error('未选择上传文件。');
  208. return false;
  209. }
  210. if (file.size > 50 * 1024 * 1024) {
  211. toastr.error('上传文件大小超过50MB。');
  212. return false;
  213. }
  214. const fileext = '.' + file.name.toLowerCase().split('.').splice(-1)[0];
  215. if (whiteList.indexOf(fileext) === -1) {
  216. toastr.error('仅支持office文档、图片、压缩包格式,请勿上传' + fileext + '格式文件。');
  217. return false;
  218. }
  219. formData.append('size', file.size);
  220. formData.append('file[]', file);
  221. }
  222. postDataWithFile('file/upload', formData, function (data) {
  223. filingObj.curFiling.source_node.files.unshift(...data.files);
  224. filingObj.updateFilingFileCount(filingObj.curFiling, data.filing.file_count);
  225. filingObj.refreshFilesTable();
  226. filingObj.refreshPages();
  227. if (callback) callback();
  228. });
  229. }
  230. uploadBigFile(file, callback) {
  231. if (file.size > 500 * 1024 * 1024) {
  232. toastr.error('上传文件大小超过500MB。');
  233. return false;
  234. }
  235. const fileext = '.' + file.name.toLowerCase().split('.').splice(-1)[0];
  236. if (whiteList.indexOf(fileext) === -1) {
  237. toastr.error('仅支持office文档、图片、压缩包格式,请勿上传' + fileext + '格式文件。');
  238. return false;
  239. }
  240. AliOss.uploadBigFile(file, 'file/upload/big', { filing_id: filingObj.curFiling.id },
  241. { progressObj: $('#upload-big-file-progress'), resumeObj: $('#add-big-file-resume'), stopObj: $('#add-big-file-stop') },
  242. function(result) {
  243. filingObj.curFiling.source_node.files.unshift(...result.files);
  244. filingObj.updateFilingFileCount(filingObj.curFiling, result.filing.file_count);
  245. filingObj.refreshFilesTable();
  246. filingObj.refreshPages();
  247. if (callback) callback();
  248. });
  249. }
  250. delFiles(files, callback) {
  251. postData('file/del', { del: files }, async function(data) {
  252. for (const id of data.del) {
  253. const fIndex = filingObj.curFiling.source_node.files.findIndex(x => { return x.id === id });
  254. if (fIndex >= 0) filingObj.curFiling.source_node.files.splice(fIndex, 1);
  255. }
  256. filingObj.updateFilingFileCount(filingObj.curFiling, data.filing.file_count);
  257. await filingObj.loadFiles(filingObj.curFiling, filingObj.curPage);
  258. filingObj.refreshFilesTable();
  259. filingObj.refreshPages();
  260. if (callback) callback();
  261. });
  262. }
  263. renameFile(fileId, filename) {
  264. const self = this;
  265. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fileId });
  266. if (!file) return;
  267. const td = $(`td[fid=${fileId}]`);
  268. if (filename === file.filename + file.fileext) {
  269. td.html(this._getFileNameHtml(file));
  270. return;
  271. }
  272. postData('file/save', { id: fileId, filename }, function(data) {
  273. file.filename = data.filename;
  274. file.fileext = data.fileext;
  275. td.html(self._getFileNameHtml(file));
  276. }, function() {
  277. td.html(self._getFileNameHtml(file));
  278. });
  279. }
  280. relaFiles(files, callback) {
  281. postData('file/rela', { filing_id: this.curFiling.id, files: files }, async function(data) {
  282. filingObj.curFiling.source_node.files.unshift(...data.files);
  283. filingObj.updateFilingFileCount(filingObj.curFiling, data.filing.file_count);
  284. filingObj.refreshFilesTable();
  285. filingObj.refreshPages();
  286. if (callback) callback();
  287. });
  288. }
  289. async setCurFiling(node) {
  290. filingObj.curFiling = node;
  291. filingObj.curPage = 1;
  292. filingObj.refreshPages();
  293. if (filingObj.curFiling.source_node.children && filingObj.curFiling.source_node.children.length > 0) {
  294. $('#file-view').hide();
  295. } else {
  296. $('#file-view').show();
  297. await filingObj.loadFiles(node, 1);
  298. filingObj.refreshFilesTable();
  299. }
  300. if (filingObj.curFiling.source_node.filing_type === 5) {
  301. $('#rela-file-btn').show();
  302. } else {
  303. $('#rela-file-btn').hide();
  304. }
  305. setLocalCache(this.curFilingKey, filingObj.curFiling.id);
  306. }
  307. prePage() {
  308. if (this.curPage === 1) return;
  309. this.curPage = this.curPage - 1;
  310. this.refreshPages();
  311. this.refreshFilesTable();
  312. }
  313. async nextPage() {
  314. if (this.curPage === this.curTotalPage) return;
  315. await filingObj.loadFiles(this.curFiling, this.curPage + 1);
  316. this.curPage = this.curPage + 1;
  317. this.refreshPages();
  318. this.refreshFilesTable();
  319. }
  320. getCurFilingFullPath(){
  321. let cur = filingObj.curFiling;
  322. const result = [];
  323. while (cur) {
  324. result.unshift(cur.source_node.name);
  325. cur = cur.getParentNode();
  326. }
  327. return result.join('/');
  328. }
  329. expandFiling(node, expand) {
  330. if (expand) {
  331. this.expandCache.push(node.id);
  332. } else{
  333. this.expandCache = this.expandCache.filter(x => { return x !== node.id });
  334. }
  335. setLocalCache(this.expandKey, this.expandCache.join(','));
  336. }
  337. expandByLevel(level) {
  338. this.expandByCustom(x => {
  339. return x.level + 1 < level;
  340. })
  341. }
  342. expandByCustom(fun) {
  343. const self = this;
  344. const expandCache = [];
  345. const expandChildren = function(children) {
  346. for (const child of children) {
  347. if (!child.children || child.children.length === 0) continue;
  348. const expand = fun(child);
  349. if (expand) expandCache.push(child.id);
  350. self.filingTree.expandNode(child, expand, false, false);
  351. expandChildren(child.children);
  352. }
  353. };
  354. const nodes = this.filingTree.getNodes();
  355. expandChildren(nodes);
  356. this.expandCache = expandCache;
  357. setLocalCache(this.expandKey, this.expandCache.join(','));
  358. }
  359. moveFiling(node, tree_pid, tree_order) {
  360. if (tree_pid === node.source_node.tree_pid && tree_order === node.source_node.tree_order) return;
  361. const self = this;
  362. postData('filing/move', { id: node.id, tree_pid, tree_order }, function(result) {
  363. const refresh = self.dragTree.loadPostData(result);
  364. self.calcTotalFileCount();
  365. const updated = [];
  366. for (const u of refresh.update) {
  367. const node = self.filingTree.getNodeByParam('id', u.id);
  368. if (node) {
  369. const path = node.getPath();
  370. for (const p of path) {
  371. if (updated.indexOf(p.id) >= 0) continue;
  372. p.name = p.source_node.name + (p.source_node.total_file_count > 0 ? `(${p.source_node.total_file_count})` : '');
  373. filingObj.filingTree.updateNode(p);
  374. updated.push(p.id);
  375. }
  376. }
  377. }
  378. });
  379. }
  380. }
  381. const levelTreeSetting = {
  382. treeId: 'filing',
  383. view: {
  384. selectedMulti: false
  385. },
  386. data: {
  387. simpleData: {
  388. idKey: 'id',
  389. pIdKey: 'tree_pid',
  390. rootPId: '-1',
  391. enable: true,
  392. }
  393. },
  394. edit: {
  395. enable: true,
  396. showRemoveBtn: function(treeId, treeNode) {
  397. if (!canFiling) return false;
  398. return !treeNode.source_node.is_fixed;
  399. },
  400. showRenameBtn: function(treeId, treeNode) {
  401. if (!canFiling) return false;
  402. return !treeNode.source_node.is_fixed;
  403. },
  404. renameTitle: '编辑',
  405. removeTitle: '删除',
  406. drag: {
  407. isCopy: false,
  408. isMove: true,
  409. pre: true,
  410. next: true,
  411. inner: false,
  412. },
  413. editNameSelectAll: true,
  414. },
  415. callback: {
  416. onClick: async function (e, key, node) {
  417. if (filingObj.curFiling && filingObj.curFiling.id === node.id) return;
  418. filingObj.setCurFiling(node);
  419. },
  420. beforeEditName: function(key, node) {
  421. node.name = node.source_node.name;
  422. },
  423. beforeRename: async function(key, node, newName, isCancel) {
  424. if (!isCancel) await filingObj.renameFiling(node, newName);
  425. return true;
  426. },
  427. onRename: function(e, key, node, isCancel) {
  428. node.name = node.name + (node.source_node.total_file_count > 0 ? `(${node.source_node.total_file_count})` : '');
  429. filingObj.filingTree.updateNode(node);
  430. },
  431. beforeRemove: function(e, key, node, isCancel) {
  432. $('#del-filing').modal('show');
  433. return false;
  434. },
  435. onExpand(e, key, node) {
  436. filingObj.expandFiling(node, true);
  437. },
  438. onCollapse: function(e, key, node) {
  439. filingObj.expandFiling(node, false);
  440. },
  441. beforeDrop: function(key, nodes, target, moveType, isCopy) {
  442. if (!canFiling) return false;
  443. if (!target) return false;
  444. if (nodes[0].level < 1) {
  445. toastr.error('顶层节点请勿移动');
  446. return false;
  447. }
  448. if (nodes[0].source_node.filing_type !== target.source_node.filing_type) {
  449. toastr.error('请勿跨越最顶层节点移动');
  450. return false;
  451. }
  452. if (target.source_node.file_count > 0 && moveType === 'inner') {
  453. toastr.error(`节点[${target.source_node.name}]下存在文件,不可添加子级`);
  454. return false;
  455. }
  456. const order = nodes[0].getIndex() + 1;
  457. const targetOrder = target.getIndex() + 1;
  458. const targetMax = target.getParentNode().children.length;
  459. if (moveType === 'prev') {
  460. if (target.tree_pid === nodes[0].tree_pid) {
  461. if (targetOrder > order) {
  462. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder === 1 ? 1 : targetOrder - 1);
  463. } else {
  464. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder === 1 ? 1 : targetOrder);
  465. }
  466. } else {
  467. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder === 1 ? 1 : targetOrder);
  468. }
  469. } else if (moveType === 'next') {
  470. if (target.tree_pid === nodes[0].tree_pid) {
  471. if (targetOrder < order) {
  472. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder === targetMax ? targetMax : targetOrder + 1);
  473. } else {
  474. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder === targetMax ? targetMax : targetOrder);
  475. }
  476. } else {
  477. filingObj.moveFiling(nodes[0], target.tree_pid, targetOrder + 1);
  478. }
  479. } else if (moveType === 'inner') {
  480. filingObj.moveFiling(nodes[0], target.tree_id, targetMax + 1);
  481. }
  482. }
  483. }
  484. };
  485. const filingObj = new FilingObj(levelTreeSetting);
  486. filingObj.analysisFiling(filing);
  487. $('#add-slibing').click(() => {
  488. if (!filingObj.curFiling) return;
  489. if (filingObj.curFiling.source_node.is_fixed) {
  490. toastr.error('固定分类不可添加同级');
  491. return;
  492. }
  493. filingObj.addSiblingFiling(filingObj.curFiling);
  494. });
  495. $('#add-child').click(() => {
  496. if (!filingObj.curFiling) return;
  497. if (filingObj.curFiling.source_node.file_count > 0) {
  498. toastr.error('该分类下已导入文件,不可添加子级');
  499. return;
  500. }
  501. filingObj.addChildFiling(filingObj.curFiling);
  502. });
  503. // $('#del-filing-btn').click(() => {
  504. // if (!filingObj.curFiling) return;
  505. // if (filingObj.curFiling.source_node.is_fixed) {
  506. // toastr.error('固定分类不可删除');
  507. // return;
  508. // }
  509. //
  510. // $('#del-filing').modal('show');
  511. // });
  512. $('#del-filing-ok').click(() => {
  513. filingObj.delFiling(filingObj.curFiling, function() {
  514. $('#del-filing').modal('hide');
  515. });
  516. });
  517. $('#add-file-ok').click(() => {
  518. const input = $('#upload-file');
  519. filingObj.uploadFiles(input[0].files, function() {
  520. $(input).val('');
  521. $('#add-file').modal('hide');
  522. });
  523. });
  524. $('#add-big-file-ok').click(() => {
  525. const input = $('#upload-big-file');
  526. filingObj.uploadBigFile(input[0].files[0], function () {
  527. $('#upload-big-file').val('');
  528. $('#add-big-file').modal('hide');
  529. });
  530. });
  531. $('body').on('mouseenter', ".table-file", function(){
  532. $(this).children(".btn-group-table").css("display","block");
  533. });
  534. $('body').on('mouseleave', ".table-file", function(){
  535. $(this).children(".btn-group-table").css("display","none");
  536. });
  537. $('body').on('click', "a[name=del-file]", function() {
  538. const del = [this.getAttribute('fid')];
  539. filingObj.delFiles(del);
  540. });
  541. $('body').on('click', "a[name=edit-file]", function() {
  542. const check = $('[name=filename] input[fid]');
  543. if (check.length > 0 && check[0].getAttribute('fid') === this.getAttribute('fid')) return;
  544. const id = this.getAttribute('fid');
  545. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === id });
  546. $(`td[fid=${id}]`).html(filingObj._getEditFileNameHtml(file));
  547. });
  548. $('body').on('click', "a[name=edit-file-ok]", function() {
  549. const td = $(this).parent().parent().parent();
  550. const fid = td.attr('fid');
  551. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fid });
  552. if (!file) return;
  553. filingObj.renameFile(fid, $('input', td).val());
  554. });
  555. $('body').on('click', "a[name=edit-file-cancel]", function() {
  556. const td = $(this).parent().parent().parent();
  557. const fid = td.attr('fid');
  558. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fid });
  559. if (!file) return;
  560. td.html(filingObj._getFileNameHtml(file));
  561. });
  562. // $('body').on('blur', "[name=filename] input[fid]", function() {
  563. // filingObj.renameFile(this.getAttribute('fid'), this.value);
  564. // });
  565. // $('body').on('keypress', "[name=filename] input[fid]", function(e) {
  566. // if (e.keyCode == 13) {
  567. // filingObj.renameFile(this.getAttribute('fid'), this.value);
  568. // }
  569. // });
  570. $('.page-select').click(function() {
  571. const content = this.getAttribute('content');
  572. switch(content) {
  573. case 'pre': filingObj.prePage(); break;
  574. case 'next': filingObj.nextPage(); break;
  575. default: return;
  576. }
  577. });
  578. $('#batch-download').click(function () {
  579. const self = this;
  580. const files = [];
  581. const checkes = $('[name=bd-check]:checked');
  582. checkes.each(function() {
  583. const fid = this.getAttribute('fid');
  584. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fid; });
  585. file && files.push(file);
  586. });
  587. if (files.length === 0) return;
  588. $(self).attr('disabled', 'true');
  589. AliOss.zipFiles(files, filingObj.curFiling.source_node.name + '.zip', (fails) => {
  590. $(self).removeAttr('disabled');
  591. if (fails.length === 0) {
  592. toastr.success('下载成功');
  593. } else {
  594. toastr.warning(`下载成功(${fails.length}个文件下载失败)`);
  595. }
  596. }, () => {
  597. $(self).removeAttr('disabled');
  598. toastr.error('批量下载失败');
  599. });
  600. });
  601. $('#batch-del-file-btn').click(() => {
  602. const checkes = $('[name=bd-check]:checked');
  603. if (checkes.length === 0) {
  604. return;
  605. } else {
  606. for (const c of checkes) {
  607. const fid = c.getAttribute('fid');
  608. const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fid });
  609. if (!file) continue;
  610. if (file.user_id !== userID) {
  611. toastr.error(`文件【${file.filename + file.fileext}】不是您上传的文件,请勿删除`);
  612. return;
  613. }
  614. }
  615. }
  616. $('#batch-del-file').modal('show');
  617. });
  618. $('#batch-del-file-ok').click(function() {
  619. const del = [];
  620. const checkes = $('[name=bd-check]:checked');
  621. checkes.each(function() {
  622. del.push(this.getAttribute('fid'));
  623. });
  624. filingObj.delFiles(del, function() {
  625. $('#batch-del-file').modal('hide');
  626. });
  627. });
  628. class RelaFileLoader {
  629. constructor() {
  630. const self = this;
  631. // 可导入的标段
  632. this.treeSetting = {
  633. view: {
  634. selectedMulti: false
  635. },
  636. data: {
  637. simpleData: {
  638. idKey: 'id',
  639. pIdKey: 'tree_pid',
  640. rootPId: '-1',
  641. enable: true,
  642. }
  643. },
  644. edit: {
  645. enable: false,
  646. },
  647. callback: {
  648. onClick: async function (e, key, node) {
  649. if (this.curTender && this.curTender.id === node.id) return;
  650. self.setCurTender(node);
  651. },
  652. }
  653. };
  654. $('body').on('click', '[name=rf-check]', function () {
  655. self.selectFile(this.getAttribute('rfid'), this.checked);
  656. });
  657. $('#tf-type').change(function() {
  658. self.selectTfType(this.value);
  659. });
  660. $('#tf-sub-type').change(function() {
  661. self.selectTfSubType(this.value);
  662. });
  663. $('#tf-stage').change(function() {
  664. self.selectTfStage(this.value);
  665. });
  666. $('#rela-file-ok').click(function() {
  667. const selectFiles = self.getSelectRelaFile();
  668. filingObj.relaFiles(selectFiles, function() {
  669. $('#rela-file').modal('hide');
  670. });
  671. });
  672. }
  673. clearFileSelect() {
  674. if (!this.tenderTree) return;
  675. const nodes = this.tenderTree.getNodes();
  676. nodes.forEach(node => {
  677. const x = node.source_node;
  678. x.selectFiles = [];
  679. if (x.att) x.att.forEach(la => { la.checked = false });
  680. if (x.advance) {
  681. x.advance.forEach(a => {
  682. if (a.files) a.files.forEach(aa => { aa.checked = false });
  683. });
  684. }
  685. if (x.stage) {
  686. x.stage.forEach(s => {
  687. if (s.att) s.att.forEach(sa => { sa.checked = false });
  688. })
  689. }
  690. });
  691. }
  692. refreshSelectHint(){
  693. if (this.curTender) {
  694. $('#cur-tender-hint').html(`当前标段,已选${this.curTender.source_node.selectFiles.length}文件`);
  695. } else {
  696. $('#cur-tender-hint').html('');
  697. }
  698. const nodes = this.tenderTree.getNodes();
  699. const selectTenders = nodes.filter(x => { return x.source_node.selectFiles.length > 0; });
  700. if (selectTenders.length > 0) {
  701. const count = selectTenders.reduce((rst, x) => { return rst + x.source_node.selectFiles.length; }, 0);
  702. $('#rela-file-hint').html(`已选择${selectTenders.length}个标段,共${count}个文件`);
  703. } else {
  704. $('#rela-file-hint').html('未选择标段、文件');
  705. }
  706. }
  707. selectFile(fileId, isSelect) {
  708. const file = this.curFiles.find(x => { return x.rf_id == fileId });
  709. if (file) {
  710. file.checked = isSelect;
  711. if (isSelect) {
  712. this.curTender.source_node.selectFiles.push(file);
  713. } else {
  714. const index = this.curTender.source_node.selectFiles.findIndex(x => { return x.rf_id === file.rf_id });
  715. this.curTender.source_node.selectFiles.splice(index, 1);
  716. }
  717. this.refreshSelectHint();
  718. }
  719. }
  720. async showRelaFile(){
  721. $('#rela-filing-hint').html(`当前目录:${filingObj.getCurFilingFullPath()}`);
  722. if (!this.tenderTree) {
  723. const tenders = await postDataAsync('file/rela/tender', {});
  724. const sortNodes = tenders.map(x => {
  725. return { id: x.id, tree_pid: -1, name: x.name, source_node: x };
  726. });
  727. this.tenderTree = this.filingTree = $.fn.zTree.init($('#rela-tender'), this.treeSetting, sortNodes);
  728. }
  729. this.clearFileSelect();
  730. this.refreshSelectHint();
  731. const firstNode = this.filingTree.getNodes()[0];
  732. if (firstNode) {
  733. this.filingTree.selectNode(firstNode);
  734. await this.setCurTender(firstNode);
  735. }
  736. }
  737. refreshTenderFileStage() {
  738. if (this.rfType.sub_type) {
  739. const type = this.tenderFileType.find(x => { return x.value === this.rfType.type});
  740. const subType = type.subType ? type.subType.find(x => { return x.value === this.rfType.sub_type; }) : null;
  741. if (subType) {
  742. this.rfType.stage = subType.stage[0].value;
  743. const html= [];
  744. for (const stage of subType.stage) {
  745. html.push(`<option value="${stage.value}">${stage.text}</option>`);
  746. }
  747. $('#tf-stage').html(html.join('')).show();
  748. } else {
  749. $('#tf-stage').html('').hide();
  750. }
  751. } else {
  752. $('#tf-stage').html('').hide();
  753. }
  754. }
  755. refreshTenderFileSubType() {
  756. const type = this.tenderFileType.find(x => { return x.value === this.rfType.type});
  757. if (type.subType && type.subType.length > 0) {
  758. this.rfType.sub_type = type.subType[0].value;
  759. const html= [];
  760. for (const tfst of type.subType) {
  761. html.push(`<option value="${tfst.value}">${tfst.text}</option>`);
  762. }
  763. $('#tf-sub-type').html(html.join('')).show();
  764. } else {
  765. $('#tf-sub-type').html('').hide();
  766. }
  767. }
  768. refreshTenderFileType() {
  769. const html= [];
  770. for (const tft of this.tenderFileType) {
  771. html.push(`<option value="${tft.value}">${tft.text}</option>`);
  772. }
  773. $('#tf-type').html(html.join(''));
  774. }
  775. refreshSelects(tender) {
  776. this.tenderFileType = [];
  777. this.tenderFileType.push({ value: 'ledger', text: '台账附件' });
  778. if (tender.stage && tender.stage.length > 0) {
  779. const stages = tender.stage.map(x => { return {value: x.id, text: `第${x.order}期`}; });
  780. this.tenderFileType.push({
  781. value: 'stage', text: '计量期',
  782. subType: [
  783. { value: 'att', text: '计量附件', stage: JSON.parse(JSON.stringify(stages)) },
  784. ],
  785. });
  786. }
  787. if (tender.advance && tender.advance.length > 0) {
  788. const advanceType = [];
  789. tender.advance.forEach(x => {
  790. let at = advanceType.find(y => { return y.value === x.type + '' });
  791. if (!at) {
  792. at = { value: x.type + '', text: x.type_str, stage: [] };
  793. advanceType.push(at);
  794. }
  795. at.stage.push({ value: x.id, text: `第${x.order}期`});
  796. });
  797. this.tenderFileType.push({
  798. value: 'advance', text: '预付款', subType: advanceType
  799. });
  800. }
  801. this.rfType = { type: this.tenderFileType[0].value };
  802. this.refreshTenderFileType();
  803. this.refreshTenderFileSubType();
  804. this.refreshTenderFileStage();
  805. }
  806. async selectTfStage(stage){
  807. this.rfType.stage = stage;
  808. await this.loadFiles();
  809. this.refreshFileTable();
  810. }
  811. async selectTfSubType(sub_type){
  812. this.rfType.sub_type = sub_type;
  813. this.refreshTenderFileStage();
  814. await this.loadFiles();
  815. this.refreshFileTable();
  816. }
  817. async selectTfType(type){
  818. this.rfType.type = type;
  819. this.refreshTenderFileSubType();
  820. this.refreshTenderFileStage();
  821. await this.loadFiles();
  822. this.refreshFileTable();
  823. }
  824. refreshFileTable() {
  825. const html = [];
  826. const typeStr = [];
  827. const selectOption = $('option:selected');
  828. selectOption.each((i, x) => {
  829. typeStr.push(x.innerText);
  830. });
  831. for (const f of this.curFiles) {
  832. html.push('<tr>');
  833. const checked = f.checked ? "checked" : '';
  834. html.push(`<td><input type="checkbox" name="rf-check" rfid="${f.rf_id}" ${checked}></td>`);
  835. html.push(`<td>${f.filename}${f.fileext}</td>`);
  836. html.push(`<td>${typeStr.join(' - ')}</td>`);
  837. html.push('</tr>');
  838. }
  839. $('#rf-files').html(html.join(''));
  840. };
  841. initFilesId(files){
  842. const tender_id = this.curTender.id;
  843. const rfType = this.rfType;
  844. files.forEach((f, i) => {
  845. f.rf_id = `${tender_id}-${rfType.type}-${rfType.sub_type}-${rfType.stage}-${i}`;
  846. f.rf_key = {
  847. tender_id, ...rfType, id: f.id,
  848. };
  849. });
  850. }
  851. async _loadRelaFiles(rfType) {
  852. return await postDataAsync('file/rela/files', { tender_id: this.curTender.id, ...rfType });
  853. }
  854. async _loadLedgerFile() {
  855. if (!this.curTender.source_node.att) this.curTender.source_node.att = await this._loadRelaFiles(this.rfType);
  856. this.curFiles = this.curTender.source_node.att;
  857. }
  858. async _loadStageFile() {
  859. const rfType = this.rfType;
  860. const stage = this.curTender.source_node.stage.find(x => {
  861. return x.id == rfType.stage;
  862. });
  863. if (!stage) {
  864. this.curFiles = [];
  865. return;
  866. }
  867. if (!stage[this.rfType.sub_type]) stage[this.rfType.sub_type] = await this._loadRelaFiles(rfType);
  868. this.curFiles = stage[this.rfType.sub_type];
  869. }
  870. async _loadAdvanceFile() {
  871. const rfType = this.rfType;
  872. const advance = this.curTender.source_node.advance.find(x => {
  873. return x.id == rfType.stage;
  874. });
  875. if (!advance) {
  876. this.curFiles = [];
  877. return;
  878. }
  879. if (!advance.files) advance.files = await this._loadRelaFiles(rfType);
  880. this.curFiles = advance.files;
  881. }
  882. async loadFiles() {
  883. switch (this.rfType.type) {
  884. case 'ledger': await this._loadLedgerFile(); break;
  885. case 'stage': await this._loadStageFile(); break;
  886. case 'advance': await this._loadAdvanceFile(); break;
  887. }
  888. this.initFilesId(this.curFiles);
  889. }
  890. async setCurTender(node) {
  891. this.curTender = node;
  892. this.refreshSelects(node.source_node);
  893. await this.loadFiles();
  894. this.refreshSelectHint();
  895. this.refreshFileTable();
  896. }
  897. getSelectRelaFile() {
  898. const data = [];
  899. const nodes = this.tenderTree.getNodes();
  900. nodes.forEach(node => {
  901. if (node.source_node.selectFiles.length === 0) return;
  902. node.source_node.selectFiles.forEach(x => {
  903. data.push({
  904. filename: x.filename, fileext: x.fileext, filepath: x.filepath, filesize: x.filesize,
  905. rela_info: x.rf_key,
  906. })
  907. });
  908. });
  909. return data;
  910. }
  911. }
  912. const relaFileLoader = new RelaFileLoader();
  913. $('#rela-file').on('show.bs.modal', function() {
  914. relaFileLoader.showRelaFile(this.getAttribute('content'));
  915. });
  916. // 授权相关
  917. class FilingPermission {
  918. constructor (setting) {
  919. this.setting = setting;
  920. const self = this;
  921. $(setting.modal).on('show.bs.modal', () => {
  922. self.loadPermission();
  923. });
  924. $(`${setting.modal}-ok`).click(() => {
  925. self.savePermission();
  926. });
  927. $('[name=ftName]').click(function () {
  928. const filingId = this.getAttribute('ftid');
  929. self.setCurFiling(filingId);
  930. });
  931. $('.book-list').on('click', 'dt', function () {
  932. const idx = $(this).find('.acc-btn').attr('data-groupid');
  933. const type = $(this).find('.acc-btn').attr('data-type');
  934. if (type === 'hide') {
  935. $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
  936. $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o')
  937. $(this).find('.acc-btn').attr('data-type', 'show')
  938. })
  939. } else {
  940. $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
  941. $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square')
  942. $(this).find('.acc-btn').attr('data-type', 'hide')
  943. })
  944. }
  945. return false;
  946. });
  947. $('dl').on('click', 'dd', function () {
  948. const type = $(this).data('type');
  949. if (type === 'all') {
  950. const cid = parseInt($(this).data('id'));
  951. const company = self.company.find(x => { return x.id === cid });
  952. for (const u of company.users) {
  953. if (u.filing_type.indexOf(self.curFiling) < 0) u.filing_type.push(self.curFiling);
  954. }
  955. } else {
  956. const uid = $(this).data('id');
  957. const pu = self.permissionUser.find(x => { return x.id === uid });
  958. if (pu.filing_type.indexOf(self.curFiling) < 0) pu.filing_type.push(self.curFiling);
  959. }
  960. self.loadCurFiling();
  961. });
  962. $('#sync-filing').click(function() {
  963. const selectFiling = $('[name=cbft]:checked');
  964. if (selectFiling.length === 0) {
  965. toastr.warning('请先选择文档类别');
  966. return;
  967. }
  968. const selectFilingId = [];
  969. selectFiling.each((i, x) => { selectFilingId.push(x.value); });
  970. self.syncFiling(self.curFiling, selectFilingId);
  971. toastr.success('同步成功');
  972. $('[name=cbft]').each((i, x) => { x.checked = false; });
  973. });
  974. $('#batch-del-filing').click(() => {
  975. const selectUser = $('[name=ftu-check]:checked');
  976. if (selectUser.length === 0) {
  977. toastr.warning('请先选择用户');
  978. return;
  979. }
  980. const userId = [];
  981. selectUser.each((i, x) => { userId.push(x.getAttribute('uid')); });
  982. self.delFiling(self.curFiling, userId);
  983. self.loadCurFiling();
  984. });
  985. $('body').on('click', '[name=del-filing]', function() {
  986. const id = this.getAttribute('uid');
  987. self.delFiling(self.curFiling, id);
  988. self.loadCurFiling();
  989. })
  990. }
  991. analysisFiling(data) {
  992. this.permissionUser = data;
  993. this.permissionUser.forEach(x => { x.filing_type = x.filing_type ? x.filing_type.split(',') : []; });
  994. this.company = [];
  995. for (const pu of this.permissionUser) {
  996. let c = this.company.find(x => { return x.company === pu.company });
  997. if (!c) {
  998. c = { id: this.company.length + 1, company: pu.company, users: [] };
  999. this.company.push(c);
  1000. }
  1001. c.users.push(pu);
  1002. }
  1003. }
  1004. loadCurFiling() {
  1005. const html = [];
  1006. for (const f of this.permissionUser) {
  1007. if (f.filing_type.indexOf(this.curFiling) < 0) continue;
  1008. html.push('<tr>');
  1009. html.push(`<td><input uid="${f.id}" type="checkbox" name="ftu-check"></td>`);
  1010. html.push(`<td>${f.name}</td>`);
  1011. html.push(`<td>${moment(f.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>`);
  1012. html.push(`<td>${f.file_permission}</td>`);
  1013. html.push(`<td><button class="btn btn-sm btn-outline-danger" uid="${f.id}" name="del-filing">移除</button></td>`);
  1014. html.push('</tr>');
  1015. }
  1016. $(this.setting.list).html(html.join(''));
  1017. }
  1018. setCurFiling(filingType) {
  1019. this.curFiling = filingType;
  1020. $('[name=ftName]').removeClass('bg-warning-50');
  1021. $(`[ftid=${filingType}]`).addClass('bg-warning-50');
  1022. this.loadCurFiling();
  1023. }
  1024. loadPermissionUser() {
  1025. const html = [];
  1026. for (const c of this.company) {
  1027. html.push(`<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${c.id}" data-type="hide"><i class="fa fa-plus-square"></i></a> ${c.company}</dt>`);
  1028. html.push(`<div class="dd-content" data-toggleid="${c.id}">`);
  1029. html.push(`<dd class="border-bottom p-2 mb-0 " data-id="${c.id}" data-type="all"><p class="mb-0 d-flex"><span class="text-primary">添加单位下全部用户</span></p></dd>`);
  1030. for (const u of c.users) {
  1031. html.push(`<dd class="border-bottom p-2 mb-0 " data-id="${u.id}" >`);
  1032. html.push(`<p class="mb-0 d-flex"><span class="text-primary">${u.name}</span><span class="ml-auto">${u.mobile}</span></p>`);
  1033. html.push(`<span class="text-muted">${u.role}</span>`);
  1034. html.push(`</dd>`);
  1035. }
  1036. html.push('</div>');
  1037. }
  1038. $('#puList').html(html.join(''));
  1039. }
  1040. loadPermission() {
  1041. const self = this;
  1042. postData('permission', {}, function(result) {
  1043. self.analysisFiling(result);
  1044. if (!self.curFiling) {
  1045. self.setCurFiling($('[name=ftName]').attr('ftid'));
  1046. } else {
  1047. self.loadCurFiling();
  1048. }
  1049. self.loadPermissionUser();
  1050. });
  1051. }
  1052. syncFiling(sourceId, targetIds) {
  1053. for (const pu of this.permissionUser) {
  1054. if (pu.filing_type.indexOf(sourceId) >= 0) {
  1055. targetIds.forEach(id => {
  1056. if (pu.filing_type.indexOf(id) < 0) pu.filing_type.push(id);
  1057. });
  1058. } else {
  1059. targetIds.forEach(id => {
  1060. if (pu.filing_type.indexOf(id) >= 0) pu.filing_type.splice(pu.filing_type.indexOf(id), 1);
  1061. })
  1062. }
  1063. }
  1064. }
  1065. delFiling(filingId, userId) {
  1066. const userIds = userId instanceof Array ? userId : [userId];
  1067. for (const id of userIds) {
  1068. const pu = this.permissionUser.find(x => { return x.id === id });
  1069. if (!pu) continue;
  1070. if (pu.filing_type.indexOf(filingId) >= 0) pu.filing_type.splice(pu.filing_type.indexOf(filingId), 1);
  1071. }
  1072. }
  1073. savePermission() {
  1074. const self = this;
  1075. const data = this.permissionUser.map(x => {
  1076. return { id: x.id, filing_type: x.filing_type.join(',') };
  1077. });
  1078. postData('permission/save', data, function(result) {
  1079. $(self.setting.modal).modal('hide');
  1080. });
  1081. }
  1082. }
  1083. const filingPermission = new FilingPermission({
  1084. modal: '#filing-permission',
  1085. list: '#filing-valid',
  1086. });
  1087. // 显示层次
  1088. (function (select) {
  1089. $(select).click(function () {
  1090. const tag = $(this).attr('tag');
  1091. setTimeout(() => {
  1092. showWaitingView();
  1093. switch (tag) {
  1094. case "1":
  1095. case "2":
  1096. case "3":
  1097. case "4":
  1098. filingObj.expandByLevel(parseInt(tag));
  1099. break;
  1100. case "last":
  1101. filingObj.expandByCustom(() => { return true; });
  1102. break;
  1103. }
  1104. closeWaitingView();
  1105. }, 100);
  1106. });
  1107. })('a[name=showLevel]');
  1108. });