file_controller.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date 2021/10/27
  7. * @version
  8. */
  9. const auditConst = require('../const/audit');
  10. const sendToWormhole = require('stream-wormhole');
  11. const path = require('path');
  12. const advanceConst = require('../const/advance');
  13. module.exports = app => {
  14. class FileController extends app.BaseController {
  15. checkUnlock(ctx) {
  16. if (ctx.subProject.lock_file) throw '管理员锁定中,暂无法编辑分类&文件,仅可查看';
  17. }
  18. checkLock(ctx) {
  19. if (!ctx.subProject.lock_file) throw '请先锁定,再管理分类数据';
  20. }
  21. /**
  22. * 概算投资
  23. *
  24. * @param ctx
  25. * @returns {Promise<void>}
  26. */
  27. async index(ctx) {
  28. try {
  29. if (!ctx.session.sessionProject.page_show.openFile) {
  30. throw '该功能已关闭或无法查看';
  31. }
  32. const renderData = {
  33. jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.file.index),
  34. auditConst,
  35. };
  36. renderData.projectList = await ctx.service.subProject.getFileProject(ctx.session.sessionProject.id, ctx.session.sessionUser.accountId, ctx.session.sessionUser.is_admin);
  37. for (const p of renderData.projectList) {
  38. if (!p.is_folder) p.file_count = await this.service.filing.sumFileCount(p.id);
  39. }
  40. renderData.tenderList = await ctx.service.tender.getList4Select('stage');
  41. renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
  42. await this.layout('file/index.ejs', renderData, 'file/modal.ejs');
  43. } catch (err) {
  44. ctx.log(err);
  45. ctx.session.postError = err.toString();
  46. ctx.redirect(this.menu.menu.dashboard.url);
  47. }
  48. }
  49. async file(ctx) {
  50. try {
  51. const renderData = {
  52. jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.file.file),
  53. };
  54. renderData.filing = await ctx.service.filing.getValidFiling(ctx.params.id, ctx.subProject.permission.filing_type);
  55. renderData.categoryData = await ctx.service.category.getAllCategory(ctx.session.sessionProject.id);
  56. renderData.canFiling = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.filing.value) >= 0;
  57. renderData.canUpload = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.upload.value) >= 0;
  58. renderData.canDelete = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.delete.value) >= 0;
  59. renderData.filingTypes = ctx.service.filing.analysisFilingType(renderData.filing);
  60. renderData.fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject);
  61. await this.layout('file/file.ejs', renderData, 'file/file_modal.ejs');
  62. } catch (err) {
  63. ctx.log(err);
  64. }
  65. }
  66. async getFilingTypePermission(ctx) {
  67. try {
  68. if (ctx.subProject.project_id !== this.ctx.session.sessionProject.id) throw '您无权操作该数据';
  69. const filingType = await ctx.service.subProjPermission.getFilingType(ctx.subProject.id);
  70. ctx.body = { err: 0, msg: '', data: filingType };
  71. } catch(err) {
  72. ctx.log(err);
  73. ctx.ajaxErrorBody(err, '获取授权用户数据错误');
  74. }
  75. }
  76. async saveFilingTypePermission(ctx) {
  77. try {
  78. const data = JSON.parse(ctx.request.body.data);
  79. await ctx.service.subProjPermission.saveFilingType(data);
  80. ctx.body = { err: 0, msg: '', data: '' };
  81. } catch(err) {
  82. ctx.log(err);
  83. ctx.ajaxErrorBody(err, '保存授权用户信息错误');
  84. }
  85. }
  86. async addFiling(ctx) {
  87. try {
  88. this.checkUnlock(ctx);
  89. const data = JSON.parse(ctx.request.body.data);
  90. const result = await ctx.service.filing.add(data);
  91. ctx.body = { err: 0, msg: '', data: result };
  92. } catch (err) {
  93. ctx.log(err);
  94. ctx.ajaxErrorBody(err, '新增分类失败');
  95. }
  96. }
  97. async delFiling(ctx) {
  98. try {
  99. this.checkUnlock(ctx);
  100. const data = JSON.parse(ctx.request.body.data);
  101. const result = await ctx.service.filing.del(data);
  102. ctx.body = { err: 0, msg: '', data: result };
  103. } catch (err) {
  104. ctx.log(err);
  105. ctx.ajaxErrorBody(err, '删除分类失败');
  106. }
  107. }
  108. async saveFiling(ctx) {
  109. try {
  110. this.checkUnlock(ctx);
  111. const data = JSON.parse(ctx.request.body.data);
  112. const result = await ctx.service.filing.save(data);
  113. ctx.body = { err: 0, msg: '', data: result };
  114. } catch (err) {
  115. ctx.log(err);
  116. ctx.ajaxErrorBody(err, '保存分类数据失败');
  117. }
  118. }
  119. async moveFiling(ctx) {
  120. try {
  121. this.checkUnlock(ctx);
  122. const data = JSON.parse(ctx.request.body.data);
  123. if (!data.id || !(data.tree_order >= 0)) throw '数据错误';
  124. const result = await ctx.service.filing.move(data);
  125. ctx.body = { err: 0, msg: '', data: result };
  126. } catch (err) {
  127. ctx.log(err);
  128. ctx.ajaxErrorBody(err, '移动分类失败');
  129. }
  130. }
  131. async loadFile(ctx) {
  132. try {
  133. const data = JSON.parse(ctx.request.body.data);
  134. const order = data.order.split('|');
  135. if (order.length !== 2) throw '加载文件错误';
  136. if (order[0] !== 'filename' && order[0] !== 'create_time') throw '加载文件错误';
  137. if (order[1] !== 'asc' && order[1] !== 'desc') throw '加载文件错误';
  138. const result = await ctx.service.file.getFiles({
  139. where: { filing_id: data.filing_id, is_deleted: 0 },
  140. orders: [order],
  141. limit: data.count,
  142. offset: (data.page-1)*data.count,
  143. }, order);
  144. ctx.body = { err: 0, msg: '', data: result };
  145. } catch (err) {
  146. ctx.log(err);
  147. ctx.ajaxErrorBody(err, '加载文件失败');
  148. }
  149. }
  150. async checkCanUpload(ctx) {
  151. if (ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.upload.value) < 0) {
  152. throw '您无权上传、导入、删除文件';
  153. }
  154. }
  155. async checkFiling(filing) {
  156. const child = await this.ctx.service.filing.getDataByCondition({ tree_pid: filing.id, is_deleted: 0 });
  157. if (child) throw '该分类下存在子分类,请在子分类下上传、导入文件';
  158. }
  159. async checkFiles(ctx) {
  160. try{
  161. const data = JSON.parse(ctx.request.body.data);
  162. if (!data.filing_id || !data.files) throw '缺少参数';
  163. const result = await ctx.service.file.checkFiles(data.filing_id, data.files);
  164. ctx.body = { err: 0, msg: '', data: result };
  165. } catch(error) {
  166. this.log(error);
  167. ctx.ajaxErrorBody(error, '检查附件错误');
  168. }
  169. }
  170. async uploadFile(ctx){
  171. let stream;
  172. try {
  173. await this.checkCanUpload(ctx);
  174. const parts = ctx.multipart({ autoFields: true });
  175. let index = 0;
  176. const create_time = Date.parse(new Date()) / 1000;
  177. let stream = await parts();
  178. const user = await ctx. service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
  179. const filing = await ctx.service.filing.getDataById(parts.field.filing_id);
  180. if (!filing || filing.is_deleted) throw '分类不存在,请刷新页面后重试';
  181. await this.checkFiling(filing);
  182. const uploadfiles = [];
  183. while (stream !== undefined) {
  184. if (!stream.filename) throw '未发现上传文件!';
  185. const fileInfo = path.parse(stream.filename);
  186. const filepath = `sp/file/${filing.spid}/${ctx.moment().format('YYYYMMDD')}/${create_time + '_' + index + fileInfo.ext}`;
  187. // 保存文件
  188. await ctx.app.fujianOss.put(ctx.app.config.fujianOssFolder + filepath, stream);
  189. await sendToWormhole(stream);
  190. // 插入到stage_pay对应的附件列表中
  191. uploadfiles.push({
  192. filename: fileInfo.name,
  193. fileext: fileInfo.ext,
  194. filesize: Array.isArray(parts.field.size) ? parts.field.size[index] : parts.field.size,
  195. filepath,
  196. });
  197. ++index;
  198. if (Array.isArray(parts.field.size) && index < parts.field.size.length) {
  199. stream = await parts();
  200. } else {
  201. stream = undefined;
  202. }
  203. }
  204. const result = await ctx.service.file.addFiles(filing, uploadfiles, user);
  205. ctx.body = {err: 0, msg: '', data: result };
  206. } catch (error) {
  207. ctx.helper.log(error);
  208. // 失败需要消耗掉stream 以防卡死
  209. if (stream) await sendToWormhole(stream);
  210. ctx.body = this.ajaxErrorBody(error, '上传附件失败,请重试');
  211. }
  212. }
  213. async delFile(ctx) {
  214. try{
  215. const data = JSON.parse(ctx.request.body.data);
  216. if (!data.del) throw '缺少参数';
  217. const result = await ctx.service.file.delFiles(data.del);
  218. ctx.body = { err: 0, msg: '', data: result };
  219. } catch(error) {
  220. this.log(error);
  221. ctx.ajaxErrorBody(error, '删除附件失败');
  222. }
  223. }
  224. async saveFile(ctx) {
  225. try {
  226. const data = JSON.parse(ctx.request.body.data);
  227. if (!data.id) throw '缺少参数';
  228. const result = await ctx.service.file.saveFile(data.id, data.filename);
  229. ctx.body = { err: 0, msg: '', data: result };
  230. } catch (error) {
  231. this.log(error);
  232. ctx.ajaxErrorBody(error, '编辑附件失败');
  233. }
  234. }
  235. async moveFile(ctx) {
  236. try {
  237. const data = JSON.parse(ctx.request.body.data);
  238. if (!data.id || !data.filingId) throw '缺少参数';
  239. const result = await ctx.service.file.moveFile(data.id, data.filingId);
  240. ctx.body = { err: 0, msg: '', data: result };
  241. } catch (error) {
  242. this.log(error);
  243. ctx.ajaxErrorBody(error, '编辑附件失败');
  244. }
  245. }
  246. async uploadBigFile(ctx) {
  247. try {
  248. await this.checkCanUpload(ctx);
  249. const data = JSON.parse(ctx.request.body.data);
  250. if (!data.type || !data.filing_id || !data.fileInfo) throw '缺少参数';
  251. const filing = await ctx.service.filing.getDataById(data.filing_id);
  252. if (!filing || filing.is_deleted) throw '分类不存在,请刷新页面后重试';
  253. let result;
  254. const fileInfo = path.parse(data.fileInfo.filename);
  255. switch(data.type) {
  256. case 'begin':
  257. const create_time = Date.parse(new Date()) / 1000;
  258. result = {
  259. filename: `sp/file/${filing.spid}/${ctx.moment().format('YYYYMMDD')}/${create_time + '_' + fileInfo.ext}`,
  260. };
  261. result.filepath = ctx.app.config.fujianOssFolder + result.filename;
  262. // todo 写入ossToken
  263. result.oss = await ctx.helper.getOssToken(ctx.app.fujianOss);
  264. break;
  265. case 'end':
  266. const user = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
  267. const uploadFiles = [{
  268. filepath: data.filepath,
  269. filename: fileInfo.name, fileext: fileInfo.ext, filesize: data.fileInfo.filesize,
  270. }];
  271. result = await ctx.service.file.addFiles(filing, uploadFiles, user);
  272. break;
  273. }
  274. ctx.body = {err: 0, msg: '', data: result };
  275. } catch (error) {
  276. ctx.log(error);
  277. ctx.body = this.ajaxErrorBody(error, '上传附件失败,请重试');
  278. }
  279. }
  280. async loadValidRelaTender(ctx) {
  281. try {
  282. const data = JSON.parse(ctx.request.body.data);
  283. if (data.type) throw '参数错误';
  284. const accountInfo = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
  285. const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
  286. ? JSON.parse(accountInfo.permission) : null;
  287. const tenderList = await ctx.service.tender.getList('', userPermission, ctx.session.sessionUser.is_admin);
  288. const rela_tender = await ctx.subProject.rela_tender.split(',');
  289. const result = tenderList.filter(x => { return rela_tender.indexOf(x.id + '') >= 0});
  290. for (const r of result) {
  291. r.advance = await ctx.service.advance.getAllDataByCondition({ columns: ['id', 'order', 'type'], where: { tid: r.id }});
  292. r.advance.forEach(a => {
  293. const type = advanceConst.typeCol.find(x => { return x.type === a.type });
  294. if (type) a.type_str = type.name;
  295. });
  296. r.stage = await ctx.service.stage.getAllDataByCondition({ columns: ['id', 'order'], where: { tid: r.id, status: auditConst.stage.status.checked } });
  297. }
  298. ctx.body = {err: 0, msg: '', data: result };
  299. } catch (error) {
  300. ctx.helper.log(error);
  301. ctx.body = this.ajaxErrorBody(error, '加载标段信息失败');
  302. }
  303. }
  304. async _loadLedgerAtt(data) {
  305. if (!data.tender_id) throw '参数错误';
  306. return await this.ctx.service.ledgerAtt.getAllDataByCondition({ where: { tid: data.tender_id }, order: [['id', 'desc']]});
  307. }
  308. async _loadStageAtt(data) {
  309. if (!data.tender_id || !data.stage) throw '参数错误';
  310. switch (data.sub_type) {
  311. case 'att':
  312. const stage = await this.ctx.service.stage.getDataById(data.stage);
  313. return await this.ctx.service.stageAtt.getAllDataByCondition({ where: { tid: data.tender_id, sid: stage.order }, order: [['id', 'desc']]});
  314. }
  315. }
  316. async _loadAdvanceAtt(data) {
  317. if (!data.stage) throw '参数错误';
  318. const self = this;
  319. const result = await this.ctx.service.advanceFile.getAllDataByCondition({ where: { vid: data.stage }, order: [['id', 'desc']]});
  320. result.forEach(x => {
  321. const info = path.parse(x.filename);
  322. x.filename = info.name;
  323. x.filesize = self.ctx.helper.sizeToBytes(x.filesize);
  324. });
  325. return result;
  326. }
  327. async loadRelaFiles(ctx) {
  328. try {
  329. const data = JSON.parse(ctx.request.body.data);
  330. if (!data.type) throw '参数错误';
  331. let files;
  332. switch(data.type) {
  333. case 'ledger':
  334. files = await this._loadLedgerAtt(data);
  335. break;
  336. case 'stage':
  337. files = await this._loadStageAtt(data);
  338. break;
  339. case 'advance':
  340. files = await this._loadAdvanceAtt(data);
  341. break;
  342. default: throw '未知文件类型';
  343. }
  344. ctx.body = {err: 0, msg: '', data: files };
  345. } catch (error) {
  346. ctx.helper.log(error);
  347. ctx.body = this.ajaxErrorBody(error, '加载附件失败,请重试');
  348. }
  349. }
  350. async relaFile(ctx) {
  351. try {
  352. const data = JSON.parse(ctx.request.body.data);
  353. if (!data.filing_id || !data.files) throw '缺少参数';
  354. const user = await ctx. service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
  355. const filing = await ctx.service.filing.getDataById(data.filing_id);
  356. if (!filing || filing.is_deleted) throw '分类不存在,请刷新页面后重试';
  357. await this.checkFiling(filing);
  358. const result = await ctx.service.file.relaFiles(filing, data.files, user);
  359. ctx.body = {err: 0, msg: '', data: result };
  360. } catch (error) {
  361. ctx.helper.log(error);
  362. ctx.body = this.ajaxErrorBody(error, '导入附件失败,请重试');
  363. }
  364. }
  365. async template(ctx) {
  366. const defaultTemplate = await ctx.service.filingTemplateList.getOriginTemplate();
  367. ctx.redirect('/file/template/' + defaultTemplate.id);
  368. }
  369. async templateDetail(ctx) {
  370. try {
  371. const renderData = {
  372. jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.file.template),
  373. };
  374. renderData.templateList = await ctx.service.filingTemplateList.getAllTemplate(ctx.session.sessionProject.id);
  375. renderData.shareTemplate = await ctx.service.filingTemplateList.getShareTemplate(ctx.session.sessionProject.id);
  376. renderData.FtType = ctx.service.filingTemplateList.FtType;
  377. renderData.template = renderData.templateList.find(x => { return x.id === ctx.params.id });
  378. if (!renderData.template) throw '查看的资料模板不存在';
  379. renderData.templateData = await ctx.service.filingTemplate.getData(renderData.template.id);
  380. await this.layout('file/template.ejs', renderData, 'file/template_modal.ejs');
  381. } catch (err) {
  382. ctx.log(err);
  383. ctx.session.postError = err.toString();
  384. ctx.redirect(this.menu.menu.dashboard.url);
  385. }
  386. }
  387. async saveTemplate(ctx) {
  388. try {
  389. const id = ctx.query.id;
  390. const name = ctx.request.body.name;
  391. const is_share = ctx.request.body.is_share ? parseInt(ctx.request.body.is_share) : undefined;
  392. const share_id = ctx.request.body.share_id;
  393. const [save, templateId] = share_id ? await ctx.service.filingTemplateList.copy(share_id) : await ctx.service.filingTemplateList.save(name, is_share, id);
  394. if (!save) throw '保存数据失败';
  395. ctx.redirect('/file/template/' + templateId);
  396. } catch(err) {
  397. ctx.log(err);
  398. ctx.session.postError = err.toString();
  399. ctx.redirect('/file/template');
  400. }
  401. }
  402. async resetTemplate(ctx) {
  403. try {
  404. const id = ctx.query.id;
  405. await ctx.service.filingTemplateList.reset(id);
  406. ctx.redirect('/file/template/' + id);
  407. } catch (err) {
  408. ctx.log(err);
  409. ctx.postError(err, '重置模板失败');
  410. ctx.redirect('/file/template');
  411. }
  412. }
  413. async delTemplate(ctx) {
  414. try {
  415. const id = ctx.query.id;
  416. await ctx.service.filingTemplateList.delete(id);
  417. console.log(ctx.request.headers.referer, id);
  418. if (ctx.request.headers.referer.indexOf(id) > 0) {
  419. ctx.redirect('/file/template');
  420. } else {
  421. ctx.redirect(ctx.request.headers.referer);
  422. }
  423. } catch (err) {
  424. ctx.log(err);
  425. ctx.postError(err, '删除模板失败');
  426. ctx.redirect('/file/template');
  427. }
  428. }
  429. async updateTemplate(ctx) {
  430. try {
  431. const data = JSON.parse(ctx.request.body.data);
  432. if (!data.updateType) throw '数据错误';
  433. let result;
  434. if (data.updateType === 'add') {
  435. result = await ctx.service.filingTemplate.add(ctx.params.id, data);
  436. } else if (data.updateType === 'del') {
  437. result = await ctx.service.filingTemplate.del(ctx.params.id, data);
  438. } else if (data.updateType === 'save') {
  439. result = await ctx.service.filingTemplate.save(data);
  440. } else if (data.updateType === 'move') {
  441. if (!data.id || !(data.tree_order >= 0)) throw '数据错误';
  442. result = await ctx.service.filingTemplate.move(ctx.params.id, data);
  443. } else if (data.updateType === 'import') {
  444. result = await ctx.service.filingTemplate.import(ctx.params.id, data.data);
  445. } else if (data.updateType === 'multi' ) {
  446. result = await ctx.service.filingTemplate.multiUpdate(ctx.params.id, data.data);
  447. }
  448. ctx.body = { err: 0, msg: '', data: result };
  449. } catch (err) {
  450. ctx.log(err);
  451. ctx.ajaxErrorBody(err, '修改失败');
  452. }
  453. }
  454. async search(ctx) {
  455. try {
  456. const limit = 1000;
  457. const data = JSON.parse(ctx.request.body.data);
  458. if (!data.filing_type || !data.keyword) throw '数据错误';
  459. const validFilingType = [];
  460. for (const f of data.filing_type) {
  461. if (ctx.subProject.permission.filing_type === 'all' || ctx.subProject.permission.filing_type.indexOf(f) >= 0) validFilingType.push(f);
  462. }
  463. const result = await ctx.service.file.search(validFilingType, data.keyword, limit);
  464. ctx.body = { err: 0, msg: '', data: { list: result, limit } };
  465. } catch(err) {
  466. ctx.log(err);
  467. ctx.ajaxErrorBody(err, '搜索文件失败');
  468. }
  469. }
  470. async manage(ctx) {
  471. try {
  472. const renderData = {
  473. jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.file.manage),
  474. };
  475. renderData.filingData = await ctx.service.filing.getValidFiling(ctx.params.id, ctx.subProject.permission.filing_type);
  476. await this.layout('file/manage.ejs', renderData, 'file/manage_modal.ejs');
  477. } catch (err) {
  478. ctx.log(err);
  479. ctx.session.postError = err.toString();
  480. ctx.redirect(this.menu.menu.dashboard.url);
  481. }
  482. }
  483. async lockFiling(ctx) {
  484. try {
  485. await ctx.service.subProject.save({ id: ctx.subProject.id, lock_file: ctx.query.lock });
  486. ctx.redirect(`/sp/${ctx.subProject.id}/fm`);
  487. } catch(err) {
  488. ctx.log(err);
  489. ctx.postError(err, '资料归集分类锁定错误');
  490. ctx.redirect(`/sp/${ctx.subProject.id}/fm`);
  491. }
  492. }
  493. async manageUpdate(ctx) {
  494. try {
  495. this.checkLock(ctx);
  496. const data = JSON.parse(ctx.request.body.data);
  497. if (!data.updateType) throw '数据错误';
  498. let result;
  499. const updateData = JSON.parse(JSON.stringify(data));
  500. delete updateData.updateType;
  501. if (data.updateType === 'add') {
  502. result = await ctx.service.filing.add(updateData);
  503. } else if (data.updateType === 'del') {
  504. result = await ctx.service.filing.del(updateData);
  505. } else if (data.updateType === 'save') {
  506. result = await ctx.service.filing.save(updateData);
  507. } else if (data.updateType === 'move') {
  508. if (!data.id || !(data.tree_order >= 0)) throw '数据错误';
  509. result = await ctx.service.filing.move(updateData);
  510. } else if (data.updateType === 'multi' ) {
  511. result = await ctx.service.filing.multiUpdate(ctx.subProject.id, data.data);
  512. }
  513. ctx.body = { err: 0, msg: '', data: result };
  514. } catch (err) {
  515. ctx.log(err);
  516. ctx.ajaxErrorBody(err, '修改失败');
  517. }
  518. }
  519. }
  520. return FileController;
  521. };