file_detail.js 50 KB

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