index.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. import routerService from '@/common/services/router-service'
  2. import asyncComponent from '@/common/services/async-component'
  3. import flowService from '@/webflow/flow-service'
  4. import formService from '@/webform/form-service'
  5. import SdTable from '@/common/components/sd-table.vue'
  6. import routerReady from '@/common/router-ready'
  7. import axios from '@/common/services/axios-instance'
  8. import todoListService from '@/todo/todo-list-service'
  9. import { message } from '@/common/one-ui'
  10. // 隐藏系统内关联文件页签
  11. routerReady((router) => {
  12. router.beforeEach((to, from, next) => {
  13. // 如果是从自查离开,则去掉隐藏按钮样式样式
  14. if (from.fullPath.includes('cpm-check-self') || from.fullPath.includes('cpm-check-plan')) {
  15. const div = document.querySelector('.button_author_div')
  16. const parentDiv = div?.parentElement
  17. parentDiv?.removeChild(div)
  18. }
  19. import('@/application-manage/sd-task-list.vue').then(({ default: sdTaskList }) => {
  20. // @ts-ignore
  21. sdTaskList.methods.openTask = (record) => {
  22. if (record.instId === null) {
  23. message.warning('请先分配联系人', 3)
  24. return
  25. }
  26. if (!record.openLink) {
  27. record.openLink = '/api/framework/v1/task-form-process/done-pages'
  28. }
  29. todoListService.openTaskItem(record)
  30. }
  31. })
  32. // 首页或登录页不重定向,防止重复跳转
  33. if (to.path === '/' || to.path === '/sd-login') {
  34. next()
  35. return false
  36. }
  37. // 隐藏系统内关联文件页签
  38. import('@/webflow/sd-webflow.vue').then((sdWebflow) => {
  39. // @ts-ignore
  40. sdWebflow.default.props.removedTabs = {
  41. type: Array,
  42. default: () => ['sdRelatedDoc'],
  43. }
  44. })
  45. next()
  46. })
  47. })
  48. // @ts-ignore
  49. const oldColumnsComputed = SdTable.computed.columnsComputed
  50. // @ts-ignore
  51. SdTable.computed.columnsComputed = function () {
  52. const obj = oldColumnsComputed
  53. .bind(this)()
  54. .find((i) => i.title === '序号')
  55. if (
  56. obj ||
  57. this.$route?.path === '/risk-criteria-form' ||
  58. (this.$route?.path.indexOf('/sd-task-list') === -1 &&
  59. this.$route?.path.indexOf('/sd-business-list') === -1 &&
  60. this.$route?.path.indexOf('/cpm-project') === -1 &&
  61. this.$route?.path.indexOf('/law-dispute-search') === -1)
  62. ) {
  63. return [...oldColumnsComputed.bind(this)()]
  64. } else {
  65. const returnColumns = [...oldColumnsComputed.bind(this)()]
  66. if (returnColumns[0].scopedSlots?.customRender === 'id') {
  67. returnColumns.splice(1, 0, {
  68. dataIndex: 'xmindex',
  69. title: '序号',
  70. // @ts-ignore
  71. customRender: (text, record, index) => `${index + 1}`,
  72. width: '65px',
  73. show: true,
  74. })
  75. return returnColumns
  76. }
  77. return [
  78. {
  79. dataIndex: 'xmindex',
  80. title: '序号',
  81. // @ts-ignore
  82. customRender: (text, record, index) => `${index + 1}`,
  83. width: '65px',
  84. show: true,
  85. },
  86. ...oldColumnsComputed.bind(this)(),
  87. ]
  88. }
  89. }
  90. // 整改检查方案
  91. flowService.addFlowForm(
  92. 'onl:5d82a6c0eb3949fb9994156e4eeac6e1',
  93. './project/check-plan/cpm-check-plan-form.vue'
  94. )
  95. // 整改检查通知
  96. flowService.addFlowForm(
  97. 'onl:395bd21f5bd74dae9d9451cfa24d9a05',
  98. './project/check-notice/cpm-check-notice-form.vue'
  99. )
  100. // 问题整改反馈
  101. flowService.addFlowForm(
  102. 'onl:a5222825c6594c24b9a0b5c302edbfa2',
  103. './improve/feedback/cpm-improve-feedback-form.vue'
  104. )
  105. // 合规举报
  106. flowService.addFlowForm(
  107. 'onl:19a222eb058041af8a4a866d34078496',
  108. './accusation/cpm-accusation-form.vue'
  109. )
  110. // 问题确认单明细
  111. routerService.routeInFrame('cpm-confirm-detail', {
  112. component: './project/confirm/cpm-confirm-detail-form.vue',
  113. })
  114. // 问题整改清单录入
  115. routerService.routeInFrame('cpm-improve-rect', {
  116. component: './improve/rectProblem/cpm-improve-rect-problem-form.vue',
  117. })
  118. // 问题确认单
  119. flowService.addFlowForm(
  120. 'onl:fd31f3fb56224b7aa368d33ab4ea6519',
  121. './project/confirm/cpm-confirm-form.vue'
  122. )
  123. // 问题整改要求
  124. flowService.addFlowForm(
  125. 'onl:7db756cfc7544a2bb5b12b2f310bac08',
  126. './improve/require/audit-cpm-improve-require-form.vue'
  127. )
  128. // 合规项目
  129. routerService.routeInFrame('cpm-project-list', {
  130. component: './project/cpm-project-list.vue',
  131. })
  132. // 合规检查立项
  133. flowService.addFlowForm('onl:8d8b353ab83b461a9f2b3a8e04894f71', './project/cpm-project-check.vue')
  134. // 整改提醒
  135. routerService.routeInFrame('cpm-remind-config', {
  136. component: './improve/remind/cpm-improve-remind-config.vue',
  137. })
  138. // 工作底稿
  139. flowService.addFlowForm(
  140. 'onl:4d40a24f7eae43bba231b025ebf44f95',
  141. './project/work-paper/cpm-work-paper-form.vue'
  142. )
  143. // 内控-测试
  144. routerService.route('/cpm-project/', {
  145. component: './project/cpm-project.vue',
  146. children: [
  147. {
  148. path: 'cpm-check-plan',
  149. components: {
  150. rightfrm: asyncComponent(() => import('../../../src/application-manage/sd-task-list.vue')),
  151. },
  152. props: (route) => ({
  153. customValues: route.query.customValues,
  154. formListId: route.query.formListId,
  155. moduleId: route.query.moduleId,
  156. projectId: route.query.projectId,
  157. groupId: route.query.groupId,
  158. }),
  159. // @ts-ignore
  160. beforeEnter: (to, from, next) => {
  161. const mainIni = setInterval(() => {
  162. const mainDiv = document.querySelector('.header_cpm-project_product')
  163. if (mainDiv) {
  164. const div = document.createElement('div')
  165. div.className = 'button_author_div'
  166. div.style.display = 'none'
  167. const style = document.createElement('style')
  168. style.innerHTML = `.header_sd-data-table_common {
  169. display:none
  170. }`
  171. div.appendChild(style)
  172. mainDiv.appendChild(div)
  173. let projectId = to.query.groupId
  174. if (projectId.toString() === '1') {
  175. projectId = to.query.projectId
  176. }
  177. axios({
  178. method: 'get',
  179. url: `api/xcoa-mobile/v1/cpm-project-member/isProjectLeader?projectId=${projectId}`,
  180. }).then((res) => {
  181. // 如果不是组长,则隐藏新建按钮
  182. if (!res.data) {
  183. const btnIni = setInterval(() => {
  184. if (document.querySelectorAll('.header_sd-data-table_common button').length > 0) {
  185. style.innerHTML = `.header_sd-data-table_common .ant-btn-primary{
  186. display:none
  187. }`
  188. clearInterval(btnIni)
  189. }
  190. })
  191. } else {
  192. style.innerHTML = ''
  193. }
  194. })
  195. clearInterval(mainIni)
  196. }
  197. }, 100)
  198. next()
  199. },
  200. },
  201. {
  202. path: 'cpm-check-notice',
  203. components: {
  204. rightfrm: asyncComponent(() => import('../../../src/application-manage/sd-task-list.vue')),
  205. },
  206. props: (route) => ({
  207. customValues: route.query.customValues,
  208. formListId: route.query.formListId,
  209. moduleId: route.query.moduleId,
  210. projectId: route.query.projectId,
  211. groupId: route.query.groupId,
  212. }),
  213. // @ts-ignore
  214. beforeEnter: (to, from, next) => {
  215. const mainIni = setInterval(() => {
  216. const mainDiv = document.querySelector('.header_cpm-project_product')
  217. if (mainDiv) {
  218. const div = document.createElement('div')
  219. div.className = 'button_author_div'
  220. div.style.display = 'none'
  221. const style = document.createElement('style')
  222. style.innerHTML = `.header_sd-data-table_common {
  223. display:none
  224. }`
  225. div.appendChild(style)
  226. mainDiv.appendChild(div)
  227. let projectId = to.query.groupId
  228. if (projectId.toString() === '1') {
  229. projectId = to.query.projectId
  230. }
  231. axios({
  232. method: 'get',
  233. url: `api/xcoa-mobile/v1/cpm-project-member/isProjectLeader?projectId=${projectId}`,
  234. }).then((res) => {
  235. // 如果不是组长,则隐藏新建按钮
  236. if (!res.data) {
  237. const btnIni = setInterval(() => {
  238. if (document.querySelectorAll('.header_sd-data-table_common button').length > 0) {
  239. style.innerHTML = `.header_sd-data-table_common .ant-btn-primary{
  240. display:none
  241. }`
  242. clearInterval(btnIni)
  243. }
  244. })
  245. } else {
  246. style.innerHTML = ''
  247. }
  248. })
  249. clearInterval(mainIni)
  250. }
  251. }, 100)
  252. next()
  253. },
  254. },
  255. {
  256. path: 'cpm-check-self',
  257. components: {
  258. rightfrm: asyncComponent(() => import('../../../src/application-manage/sd-task-list.vue')),
  259. },
  260. props: (route) => ({
  261. customValues: route.query.customValues,
  262. formListId: route.query.formListId,
  263. moduleId: route.query.moduleId,
  264. projectId: route.query.projectId,
  265. groupId: route.query.groupId,
  266. }),
  267. // @ts-ignore
  268. beforeEnter: (to, from, next) => {
  269. const mainIni = setInterval(() => {
  270. const mainDiv = document.querySelector('.header_cpm-project_product')
  271. if (mainDiv) {
  272. const div = document.createElement('div')
  273. div.className = 'button_author_div'
  274. div.style.display = 'none'
  275. const style = document.createElement('style')
  276. style.innerHTML = `.header_sd-data-table_common {
  277. display:none
  278. }`
  279. div.appendChild(style)
  280. mainDiv.appendChild(div)
  281. let projectId = to.query.groupId
  282. if (projectId.toString() === '1') {
  283. projectId = to.query.projectId
  284. }
  285. axios({
  286. method: 'get',
  287. url: `api/xcoa-mobile/v1/cpm-project-member/isProjectLeader?projectId=${projectId}`,
  288. }).then((res) => {
  289. // 如果是组长,则去掉隐藏按钮的样式
  290. if (res.data) {
  291. const btnIni = setInterval(() => {
  292. if (document.querySelectorAll('.header_sd-data-table_common button').length > 0) {
  293. style.innerHTML = `.header_sd-data-table_common .ant-btn-primary{
  294. display:none
  295. }
  296. .header_sd-data-table_common button[disabled='disabled']{
  297. display:none
  298. }`
  299. document
  300. .querySelectorAll('.header_sd-data-table_common button')
  301. .forEach((item) => {
  302. if (item.innerHTML.replace(/\s/g, '').includes('删除')) {
  303. item.setAttribute('style', 'display:none')
  304. }
  305. })
  306. clearInterval(btnIni)
  307. }
  308. })
  309. } else {
  310. const btnIni = setInterval(() => {
  311. if (document.querySelectorAll('.header_sd-data-table_common button').length > 0) {
  312. style.innerHTML = `.header_sd-data-table_common button{
  313. display:none
  314. }
  315. .header_sd-data-table_common button[disabled='disabled']{
  316. display:none
  317. }`
  318. document
  319. .querySelectorAll('.header_sd-data-table_common button')
  320. .forEach((item) => {
  321. if (item.innerHTML.replace(/\s/g, '').includes('删除')) {
  322. item.setAttribute('style', 'display:none')
  323. }
  324. })
  325. clearInterval(btnIni)
  326. }
  327. })
  328. }
  329. })
  330. clearInterval(mainIni)
  331. }
  332. }, 100)
  333. next()
  334. },
  335. },
  336. {
  337. path: 'cpm-work-papre',
  338. components: {
  339. rightfrm: asyncComponent(() => import('../../../src/application-manage/sd-task-list.vue')),
  340. },
  341. props: (route) => ({
  342. customValues: route.query.customValues,
  343. formListId: route.query.formListId,
  344. moduleId: route.query.moduleId,
  345. projectId: route.query.projectId,
  346. groupId: route.query.groupId,
  347. }),
  348. beforeEnter: (to, from, next) => {
  349. const mainIni = setInterval(() => {
  350. const mainDiv = document.querySelector('.header_cpm-project_product')
  351. if (mainDiv) {
  352. const div = mainDiv.getElementsByClassName('button_author_div')
  353. if (div && div.length > 0) {
  354. for (var s = 0; s < div.length; s++) {
  355. document
  356. .querySelector('.header_cpm-project_product')
  357. .getElementsByClassName('button_author_div')
  358. [s]?.remove()
  359. }
  360. }
  361. document.querySelectorAll('.header_sd-data-table_common button').forEach((item) => {
  362. if (item.innerHTML.replace(/\s/g, '').includes('删除')) {
  363. item.setAttribute('style', '')
  364. }
  365. })
  366. clearInterval(mainIni)
  367. }
  368. }, 100)
  369. next()
  370. },
  371. },
  372. {
  373. path: 'cpm-work-report',
  374. components: {
  375. rightfrm: asyncComponent(() => import('../../../src/application-manage/sd-task-list.vue')),
  376. },
  377. props: (route) => ({
  378. customValues: route.query.customValues,
  379. formListId: route.query.formListId,
  380. moduleId: route.query.moduleId,
  381. projectId: route.query.projectId,
  382. groupId: route.query.groupId,
  383. }),
  384. beforeEnter: (to, from, next) => {
  385. const mainIni = setInterval(() => {
  386. const mainDiv = document.querySelector('.header_cpm-project_product')
  387. if (mainDiv) {
  388. const div = mainDiv.getElementsByClassName('button_author_div')
  389. if (div && div.length > 0) {
  390. for (var s = 0; s < div.length; s++) {
  391. document
  392. .querySelector('.header_cpm-project_product')
  393. .getElementsByClassName('button_author_div')
  394. [s]?.remove()
  395. }
  396. }
  397. document.querySelectorAll('.header_sd-data-table_common button').forEach((item) => {
  398. if (item.innerHTML.replace(/\s/g, '').includes('删除')) {
  399. item.setAttribute('style', '')
  400. }
  401. })
  402. clearInterval(mainIni)
  403. }
  404. }, 100)
  405. next()
  406. },
  407. },
  408. {
  409. path: 'cpm-confirm-list',
  410. components: {
  411. rightfrm: asyncComponent(() => import('./project/confirm/cpm-confirm-list.vue')),
  412. },
  413. props: (route) => ({
  414. customValues: route.query.customValues,
  415. formListId: route.query.formListId,
  416. moduleId: route.query.moduleId,
  417. projectId: route.query.projectId,
  418. groupId: route.query.groupId,
  419. }),
  420. beforeEnter: (to, from, next) => {
  421. const mainIni = setInterval(() => {
  422. const mainDiv = document.querySelector('.header_cpm-project_product')
  423. if (mainDiv) {
  424. const div = mainDiv.getElementsByClassName('button_author_div')
  425. if (div && div.length > 0) {
  426. for (var s = 0; s < div.length; s++) {
  427. document
  428. .querySelector('.header_cpm-project_product')
  429. .getElementsByClassName('button_author_div')
  430. [s]?.remove()
  431. }
  432. }
  433. document.querySelectorAll('.header_sd-data-table_common button').forEach((item) => {
  434. if (item.innerHTML.replace(/\s/g, '').includes('删除')) {
  435. item.setAttribute('style', '')
  436. }
  437. })
  438. clearInterval(mainIni)
  439. }
  440. }, 100)
  441. next()
  442. },
  443. },
  444. {
  445. path: 'cpm-check-user',
  446. component: asyncComponent(() => import('./project/user/audit-cpm-project-user.vue')),
  447. props: (route) => ({
  448. pageId: route.query.pageId,
  449. projectId: route.query.projectId,
  450. }),
  451. },
  452. {
  453. path: 'cpm-check-group',
  454. component: asyncComponent(() => import('./project/group/audit-cpm-project-group.vue')),
  455. props: (route) => ({
  456. pageId: route.query.pageId,
  457. projectId: route.query.projectId,
  458. }),
  459. },
  460. ],
  461. })
  462. // 制度审查
  463. flowService.addFlowForm('onl:a68deaea1d024a439ff0ffecd1068830', './check/cpm-rule-check.vue')
  464. // 合同审查
  465. flowService.addFlowForm('onl:cfa055669fbe4afbafaefebdc4fdad70', './check/cpm-contract-check.vue')
  466. // 重大决策审查
  467. flowService.addFlowForm(
  468. 'onl:930ec02130ab4d8798e23ffa32216e05',
  469. './policycheck/cpm-policy-check.vue'
  470. )
  471. // 合规检查报告
  472. flowService.addFlowForm(
  473. 'onl:e1e85d865d984f0383f238a5e0d11ab6',
  474. './project/report/cpm-project-report-form.vue'
  475. )
  476. // 领导专题学习
  477. routerService.routeInFrame('cpm-leader-study', {
  478. component: './cultural/cpm-leader-study-form.vue',
  479. })
  480. // 委员会专题纪要
  481. routerService.routeInFrame('cpm-committee', {
  482. component: './cultural/cpm-committee-form.vue',
  483. })
  484. // 合规培训
  485. flowService.addFlowForm('onl:fdb6b6b593ba432b8e5932da76c0910d', './cultural/cpm-train-form.vue')
  486. // 宣传管理
  487. flowService.addFlowForm('onl:d531f98f303444a58e892e46b86c4ed9', './cultural/cpm-billboard-form.vue')