audit-project-list.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. <template>
  2. <a-spin :spinning="!inited" tip="正在删除...">
  3. <div :class="$style.projectListDiv">
  4. <a-card :bordered="false">
  5. <!-- 高级搜索区域 -->
  6. <audit-advanced-query
  7. :expand="isShowAdvSearch"
  8. :search-data="advSearchForm"
  9. :ref-name="searchform"
  10. :search-style="{
  11. height: '170px',
  12. left: '30px',
  13. top: '65px !important',
  14. width: 'calc(100% - 40px) !important',
  15. }"
  16. :search-fun="advSearch"
  17. @searchedClick="searchedClick"
  18. >
  19. <template>
  20. <a-row>
  21. <a-col :span="8">
  22. <a-form-model-item label="项目名称" prop="projectTitle">
  23. <a-input v-model="advSearchForm.projectTitle" />
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="8">
  27. <a-form-model-item label="项目编号" prop="projectCode">
  28. <a-input v-model="advSearchForm.projectCode" />
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="8">
  32. <a-form-model-item label="项目组长" prop="groupLeaderName">
  33. <a-input v-model="advSearchForm.groupLeaderName" />
  34. </a-form-model-item>
  35. </a-col>
  36. </a-row>
  37. <a-row>
  38. <a-col :span="8">
  39. <a-form-model-item label="审计方式" prop="auditMode">
  40. <sd-select
  41. v-model="advSearchForm.auditMode"
  42. :allow-clear="true"
  43. :options="auditModeOptions"
  44. />
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :span="8">
  48. <a-form-model-item label="项目状态" prop="itemStatus">
  49. <sd-select
  50. v-model="advSearchForm.itemStatus"
  51. :allow-clear="true"
  52. :options="itemStatusOptions"
  53. />
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :span="8">
  57. <a-form-model-item label="审计类型" prop="auditType">
  58. <sd-select
  59. v-model="advSearchForm.auditType"
  60. :allow-clear="true"
  61. :options="auditTypeOptions"
  62. />
  63. </a-form-model-item>
  64. </a-col>
  65. </a-row>
  66. </template>
  67. </audit-advanced-query>
  68. <sd-data-table-ex
  69. ref="dataTable"
  70. style="margin-top: 42px;"
  71. :columns="columns"
  72. :process-req="processReq"
  73. show-selection
  74. form-id="iamAuditProject"
  75. data-url="api/xcoa-mobile/v1/iamauditproject/all-list"
  76. :filter-expressions="tableExpressions"
  77. @change="changeNum"
  78. @selectedRowsChanged="selectedRowsChanged"
  79. >
  80. <div slot="isLink" slot-scope="text, record">
  81. <a :title="text" @click="linkProject(record)">{{ text }}</a>
  82. </div>
  83. <div slot="opt" slot-scope="text, record" :class="$style.operatecol">
  84. <span v-for="(bt, index) in buttonsfortable" :key="index">
  85. <a-button
  86. v-if="
  87. bt.showCondition === record.itemStatus &&
  88. checkPermission(bt.permission, record.operatePermission)
  89. "
  90. type="link"
  91. size="small"
  92. :title="bt.label"
  93. :class="$style.optbutton"
  94. @click="optbuttonClick(bt.id, record)"
  95. >
  96. <sd-icon :type="bt.icontype" :theme="bt.theme" />
  97. </a-button>
  98. </span>
  99. </div>
  100. </sd-data-table-ex>
  101. <div :class="[$style.btns]">
  102. <a-col :span="7" :offset="0">
  103. <a-select v-model="searchYear" style="width:80px;" @change="changeYearSelect">
  104. <a-select-option v-for="year in yearArry" :key="year">
  105. {{ year }}
  106. </a-select-option>
  107. </a-select>
  108. <a-checkbox v-model="checkboxValue" style="margin-left: 15px;" @change="onChange">
  109. 仅显示我参与的
  110. </a-checkbox>
  111. </a-col>
  112. <a-col :span="7" :offset="10" :class="$style.actionBtn">
  113. <a-input-search
  114. v-model="searchValue"
  115. style="width: 200px;"
  116. placeholder="请输入搜索条件"
  117. allow-clear
  118. @search="onSearch"
  119. />
  120. <a-button title="高级搜索" :class="$style.advSearchBtn" @click="AdvSearchClick">
  121. <a-icon type="sd-audit-advancesearch" theme="filled" :class="$style.searchIcon" />
  122. </a-button>
  123. <a-button
  124. v-if="isApplicationAdmin"
  125. :class="[$style.buttonSpacing]"
  126. :disabled="deleteButtonDisable"
  127. @click="linkToDelete"
  128. >删除
  129. </a-button>
  130. </a-col>
  131. </div>
  132. <div v-show="false">
  133. <sd-user-picker
  134. ref="assignTeamLeader"
  135. v-model="mainSendUnit"
  136. :single="setType === 'groupLeader'"
  137. :read-only="false"
  138. @change="change"
  139. />
  140. </div>
  141. </a-card>
  142. </div>
  143. </a-spin>
  144. </template>
  145. <script>
  146. import { message, Modal } from 'ant-design-vue'
  147. import { getUserInfo } from '@/common/store-mixin'
  148. import axios from '@/common/services/axios-instance'
  149. import errorUtil from '@/common/services/error-util'
  150. import AuditService from '@product/iam/audit/plan/audit-service'
  151. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  152. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  153. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  154. import AuditProjectService from './audit-project-service'
  155. import components from './_import-components/audit-plan-list-import'
  156. export default {
  157. name: 'AuditProjectList',
  158. metaInfo: {
  159. title: '审计项目列表',
  160. },
  161. components: { ...components, auditAdvancedQuery },
  162. mixins: [auditAdvancedQueryMixins],
  163. data() {
  164. return {
  165. inited: true,
  166. searchYear: new Date().getFullYear().toString(),
  167. yearArry: [],
  168. searchValue: '',
  169. mainSendUnit: [],
  170. checkboxValue: false,
  171. isApplicationAdmin: false, // 是否为应用管理员
  172. deleteButtonDisable: true,
  173. pageId: 'audit/project/iamAuditProject',
  174. columns: [
  175. {
  176. title: '序号',
  177. customRender: (text, record, index) => `${index + 1}`,
  178. width: '80px',
  179. },
  180. {
  181. title: '项目名称',
  182. dataIndex: 'projectTitle',
  183. width: '35%',
  184. scopedSlots: { customRender: 'isLink' },
  185. },
  186. {
  187. title: '项目编号',
  188. width: '10%',
  189. sorter: true,
  190. dataIndex: 'projectCode',
  191. },
  192. {
  193. title: '审计类型',
  194. width: '110px',
  195. dataIndex: 'auditType',
  196. },
  197. {
  198. title: '项目状态',
  199. sorter: true,
  200. dataIndex: 'itemStatusStr',
  201. width: '120px',
  202. },
  203. {
  204. title: '审计组长',
  205. sorter: true,
  206. dataIndex: 'groupLeaderName',
  207. width: '120px',
  208. },
  209. {
  210. title: '审计方式',
  211. dataIndex: 'auditMode',
  212. width: '120px',
  213. },
  214. {
  215. title: '项目评价',
  216. dataIndex: 'projectScore',
  217. width: '120px',
  218. },
  219. {
  220. title: '操作',
  221. dataIndex: 'id',
  222. sdHidden: false,
  223. scopedSlots: { customRender: 'opt' },
  224. width: '150px',
  225. },
  226. ],
  227. actions: [],
  228. tableExpressions: [],
  229. buttonsfortable: [
  230. {
  231. label: '分配组长',
  232. id: 'assignTeamLeader',
  233. icontype: 'sd-audit-changeuser',
  234. theme: 'fill',
  235. showCondition: '01', // 未启动
  236. permission: '04', // 项目负责人
  237. },
  238. {
  239. label: '启动项目',
  240. id: 'startproject',
  241. icontype: 'sd-audit-start',
  242. theme: 'fill',
  243. showCondition: '01', // 未启动
  244. permission: '05,99', // 项目组长
  245. },
  246. {
  247. label: '关闭项目',
  248. id: 'closeProject',
  249. icontype: 'sd-audit-closeproject',
  250. theme: 'fill',
  251. showCondition: '04', // 报告阶段
  252. permission: '05,01', // 项目组长、项目副组长
  253. },
  254. {
  255. label: '重启项目',
  256. id: 'restart',
  257. icontype: 'sd-audit-restart',
  258. theme: 'fill',
  259. showCondition: '05', // 已关闭
  260. permission: '05,01', // 项目组长、项目副组长
  261. },
  262. {
  263. label: '项目评分',
  264. id: 'projectScore',
  265. icontype: 'sd-audit-support-center',
  266. theme: 'fill',
  267. showCondition: '05', // 已关闭
  268. permission: '05,01', // 项目组长、项目副组长
  269. },
  270. // {
  271. // label: '归档',
  272. // id: 'projectArchive',
  273. // icontype: 'sd-audit-archive',
  274. // theme: 'fill',
  275. // showCondition: '05', // 已关闭
  276. // permission: '05,01', // 项目组长、项目副组长
  277. // },
  278. // {
  279. // label: '设定查阅范围',
  280. // id: 'setReadAuthority',
  281. // icontype: 'sd-audit-set-searchread',
  282. // theme: 'fill',
  283. // showCondition: '05', // 已关闭
  284. // permission: '05,01,04', // 项目组长、项目副组长、项目负责人
  285. // },
  286. ],
  287. searchform: 'searchform',
  288. isShowAdvSearch: false,
  289. advSearchForm: {
  290. projectTitle: '',
  291. projectCode: '',
  292. groupLeaderName: '',
  293. auditMode: '',
  294. itemStatus: '',
  295. auditType: '',
  296. },
  297. itemStatusOptions: [],
  298. auditTypeOptions: [],
  299. auditModeOptions: [],
  300. projectId: '',
  301. setType: '',
  302. }
  303. },
  304. mounted() {
  305. // 初始化年份下拉框
  306. this.initYearSelect()
  307. // 初始化数据字典信息
  308. this.initDictionaryInfo()
  309. // 初始化权限
  310. this.initJurisdiction()
  311. },
  312. methods: {
  313. // 初始化权限
  314. initJurisdiction() {
  315. // 校验权限(检查层级资源权限权限和是否为审计人员)
  316. AuditProjectService.checkPermission().then((res) => {
  317. this.isApplicationAdmin = res.data.isHasPermission // 删除按钮权限(拥有应用管理员角色)
  318. })
  319. },
  320. // 初始化年份下拉框
  321. initYearSelect() {
  322. debugger
  323. AuditService.getPlanYear().then((res) => {
  324. debugger
  325. // 获取计划年度
  326. if (res.data != null && res.data !== '') {
  327. let flag = true
  328. res.data.forEach((e) => {
  329. this.yearArry.push(e)
  330. if (e === this.searchYear) {
  331. flag = false
  332. }
  333. })
  334. if (flag === true) {
  335. const arry = res.data.filter((e) => e < this.searchYear)
  336. if (arry.length > 0) {
  337. this.searchYear = arry[0]
  338. } else {
  339. this.searchYear = this.yearArry[this.yearArry.length - 1]
  340. }
  341. }
  342. this.yearArry.sort()
  343. } else {
  344. // 如果没有已经发布的计划,则显示当前年份
  345. this.yearArry.push(this.searchYear)
  346. }
  347. this.changeYearSelect(this.searchYear)
  348. })
  349. },
  350. initDictionaryInfo() {
  351. axios({
  352. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_PROJECT_STATUS',
  353. method: 'get',
  354. }).then((res) => {
  355. if (res.status === 200) {
  356. this.itemStatusOptions = res.data
  357. }
  358. })
  359. axios({
  360. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_METHOD',
  361. method: 'get',
  362. }).then((res) => {
  363. if (res.status === 200) {
  364. this.auditModeOptions = res.data
  365. }
  366. })
  367. axios({
  368. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PRODUCT_IAM_AUDIT_TYPE',
  369. method: 'get',
  370. }).then((res) => {
  371. if (res.status === 200) {
  372. this.auditTypeOptions = res.data
  373. }
  374. })
  375. },
  376. changeYearSelect(value) {
  377. debugger
  378. this.tableExpressions = []
  379. if (value) {
  380. // 计划年度
  381. this.tableExpressions.push({
  382. dataType: 'str',
  383. name: 'planYear',
  384. op: 'like',
  385. stringValue: `${value}`,
  386. })
  387. let isMyParticipateValue
  388. if (this.checkboxValue) {
  389. isMyParticipateValue = '1'
  390. } else {
  391. isMyParticipateValue = '0'
  392. }
  393. // 仅我参与的
  394. this.tableExpressions.push({
  395. dataType: 'str',
  396. name: 'isMyParticipate',
  397. op: 'eq',
  398. stringValue: `${isMyParticipateValue}`,
  399. })
  400. }
  401. this.$refs.dataTable.clearSelection()
  402. },
  403. onSearch(value) {
  404. this.tableExpressions = []
  405. // 计划年度
  406. this.tableExpressions.push({
  407. dataType: 'str',
  408. name: 'planYear',
  409. op: 'like',
  410. stringValue: `%${this.searchYear}%`,
  411. })
  412. let isMyParticipateValue
  413. if (this.checkboxValue) {
  414. isMyParticipateValue = '1'
  415. } else {
  416. isMyParticipateValue = '0'
  417. }
  418. // 仅我参与的
  419. this.tableExpressions.push({
  420. dataType: 'str',
  421. name: 'isMyParticipate',
  422. op: 'eq',
  423. stringValue: `${isMyParticipateValue}`,
  424. })
  425. if (value) {
  426. const expressions = []
  427. // 项目名称
  428. expressions.push({
  429. dataType: 'str',
  430. name: 'projectTitle',
  431. op: 'like',
  432. stringValue: `%${value}%`,
  433. })
  434. // 项目编号
  435. expressions.push({
  436. dataType: 'str',
  437. name: 'projectCode',
  438. op: 'like',
  439. stringValue: `%${value}%`,
  440. })
  441. // 审计类型
  442. expressions.push({
  443. dataType: 'str',
  444. name: 'auditType',
  445. op: 'like',
  446. stringValue: `%${value}%`,
  447. })
  448. // 项目状态
  449. expressions.push({
  450. dataType: 'str',
  451. name: 'itemStatus',
  452. op: 'like',
  453. stringValue: `%${value}%`,
  454. })
  455. // 项目组长
  456. expressions.push({
  457. dataType: 'str',
  458. name: 'groupLeaderName',
  459. op: 'like',
  460. stringValue: `%${value}%`,
  461. })
  462. // 审计方式
  463. expressions.push({
  464. dataType: 'str',
  465. name: 'auditMode',
  466. op: 'like',
  467. stringValue: `%${value}%`,
  468. })
  469. this.tableExpressions.push({
  470. dataType: 'exps',
  471. op: 'or',
  472. expressionsValue: expressions,
  473. })
  474. }
  475. this.$refs.dataTable.clearSelection()
  476. },
  477. searchedClick() {
  478. this.isShowAdvSearch = !this.isShowAdvSearch
  479. this.$refs.dataTable.clearSelection()
  480. },
  481. advSearch() {
  482. debugger
  483. this.tableExpressions = []
  484. // 计划年度
  485. this.tableExpressions.push({
  486. dataType: 'str',
  487. name: 'planYear',
  488. op: 'like',
  489. stringValue: `${this.searchYear}`,
  490. })
  491. let isMyParticipateValue
  492. if (this.checkboxValue) {
  493. isMyParticipateValue = '1'
  494. } else {
  495. isMyParticipateValue = '0'
  496. }
  497. // 仅我参与的
  498. this.tableExpressions.push({
  499. dataType: 'str',
  500. name: 'isMyParticipate',
  501. op: 'eq',
  502. stringValue: `${isMyParticipateValue}`,
  503. })
  504. // 项目名称
  505. if (this.advSearchForm.projectTitle) {
  506. this.tableExpressions.push({
  507. dataType: 'str',
  508. name: 'projectTitle',
  509. op: 'like',
  510. stringValue: `${this.advSearchForm.projectTitle}`,
  511. })
  512. }
  513. // 项目编号
  514. if (this.advSearchForm.projectCode) {
  515. this.tableExpressions.push({
  516. dataType: 'str',
  517. name: 'projectCode',
  518. op: 'like',
  519. stringValue: `${this.advSearchForm.projectCode}`,
  520. })
  521. }
  522. // 项目组长
  523. if (this.advSearchForm.groupLeaderName) {
  524. this.tableExpressions.push({
  525. dataType: 'str',
  526. name: 'groupLeaderName',
  527. op: 'like',
  528. stringValue: `${this.advSearchForm.groupLeaderName}`,
  529. })
  530. }
  531. // 审计方式
  532. if (this.advSearchForm.auditMode[0]) {
  533. this.tableExpressions.push({
  534. dataType: 'str',
  535. name: 'auditMode',
  536. op: 'like',
  537. stringValue: `${this.advSearchForm.auditMode[0].id}`,
  538. })
  539. }
  540. // 项目状态
  541. if (this.advSearchForm.itemStatus[0]) {
  542. this.tableExpressions.push({
  543. dataType: 'str',
  544. name: 'itemStatus',
  545. op: 'like',
  546. stringValue: `${this.advSearchForm.itemStatus[0].id}`,
  547. })
  548. }
  549. // 审计类型
  550. if (this.advSearchForm.auditType[0]) {
  551. this.tableExpressions.push({
  552. dataType: 'str',
  553. name: 'auditType',
  554. op: 'like',
  555. stringValue: `${this.advSearchForm.auditType[0].id}`,
  556. })
  557. }
  558. this.$refs.dataTable.clearSelection()
  559. },
  560. linkProject(record) {
  561. if (
  562. (record.operatePermission || this.hsaReadAuthorityPermission(record)) &&
  563. (record.itemStatus === '02' ||
  564. record.itemStatus === '03' ||
  565. record.itemStatus === '04' ||
  566. record.itemStatus === '05' ||
  567. record.itemStatus === '07')
  568. ) {
  569. window.open('#/audit-work/?projectId=' + record.id)
  570. } else {
  571. var url = '/audit-project-detail?record=' + record.id
  572. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  573. if (refreshFlag) {
  574. return this.$refs.SJXMDataTable.refresh(true)
  575. }
  576. })
  577. }
  578. },
  579. // 是否拥有查阅范围权限
  580. hsaReadAuthorityPermission(record) {
  581. if (
  582. record.readAuthorityCodes != null &&
  583. record.readAuthorityCodes.indexOf(getUserInfo().account) > -1
  584. ) {
  585. return true
  586. }
  587. return false
  588. },
  589. onChange(e) {
  590. let isMyParticipateValue
  591. this.tableExpressions = []
  592. if (e.target.checked) {
  593. isMyParticipateValue = '1'
  594. } else {
  595. isMyParticipateValue = '0'
  596. }
  597. // 仅我参与的
  598. this.tableExpressions.push({
  599. dataType: 'str',
  600. name: 'isMyParticipate',
  601. op: 'eq',
  602. stringValue: `${isMyParticipateValue}`,
  603. })
  604. // 计划年度
  605. this.tableExpressions.push({
  606. dataType: 'str',
  607. name: 'planYear',
  608. op: 'like',
  609. stringValue: `%${this.searchYear}%`,
  610. })
  611. this.$refs.dataTable.clearSelection()
  612. },
  613. // 项目组长配置保存
  614. change(val) {
  615. let codes = ''
  616. let names = ''
  617. if (val.length > 0) {
  618. val.forEach((e) => {
  619. codes += e.code + ','
  620. names += e.name + ','
  621. })
  622. codes = codes.substr(0, codes.length - 1)
  623. names = names.substr(0, names.length - 1)
  624. }
  625. if (this.setType === 'groupLeader') {
  626. return new Promise((resolve) => {
  627. // 分配项目组长配置
  628. AuditProjectService.assignTeamLeader(this.projectId, codes, names).then((res) => {
  629. if (res.data) {
  630. this.$refs.dataTable.clearSelection()
  631. this.$refs.dataTable.refresh()
  632. }
  633. })
  634. })
  635. }
  636. if (this.setType === 'readAuthority') {
  637. return new Promise((resolve) => {
  638. // 设定查阅范围
  639. AuditProjectService.assignReadAuthority(this.projectId, codes, names).then((res) => {
  640. if (res.data) {
  641. this.$refs.dataTable.clearSelection()
  642. this.$refs.dataTable.refresh()
  643. }
  644. })
  645. })
  646. }
  647. },
  648. AdvSearchClick() {
  649. this.isShowAdvSearch = !this.isShowAdvSearch
  650. },
  651. linkToDelete() {
  652. const selectedRowKeys = this.$refs.dataTable.getSelectedRowKeys()
  653. if (selectedRowKeys.length === 0) {
  654. Modal.info({
  655. content: '请选择需要删除的数据!',
  656. })
  657. return
  658. }
  659. return new Promise((resolve) => {
  660. Modal.confirm({
  661. title: '您确定删除这项内容吗?',
  662. content: '删除这条数据后,就无法恢复初始的状态。',
  663. okText: '删除',
  664. okType: 'danger',
  665. onOk: () => {
  666. this.inited = false
  667. axios({
  668. url: `api/xcoa-mobile/v1/iamauditproject/deleteProject`,
  669. method: 'delete',
  670. params: {
  671. ids: selectedRowKeys.join(','),
  672. },
  673. })
  674. .then((res) => {
  675. this.inited = true
  676. if (res.data) {
  677. const msg = '删除成功'
  678. message.success(msg)
  679. this.$refs.dataTable.clearSelection()
  680. this.$refs.dataTable.refresh()
  681. } else {
  682. message.error('删除失败,请联系管理员!')
  683. }
  684. })
  685. .catch((err) => {
  686. this.inited = true
  687. const msg = errorUtil.getMessage(err) || '删除失败'
  688. message.error(msg)
  689. })
  690. .finally(resolve)
  691. },
  692. onCancel: () => {
  693. resolve()
  694. },
  695. })
  696. })
  697. },
  698. optbuttonClick(val, record) {
  699. // 启动项目
  700. if (val === 'startproject') {
  701. return new Promise((resolve) => {
  702. // 项目启动前校验是否有变更申请单
  703. AuditProjectService.checkBeforeStartProject(record.id).then((res) => {
  704. if (res.data) {
  705. Modal.warning({
  706. title: '提示',
  707. content: '该项目的《变更申请》未结束!',
  708. })
  709. return null
  710. } else {
  711. // 启动操作
  712. const url = '/audit-project-start-form?record=' + record.id // 新页面要打开的路由地址
  713. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  714. if (refreshFlag) {
  715. this.$refs.dataTable.clearSelection()
  716. this.$refs.dataTable.refresh()
  717. }
  718. })
  719. }
  720. })
  721. })
  722. }
  723. // 分配项目组长操作 or 设定查阅范围操作
  724. if (val === 'assignTeamLeader') {
  725. this.setType = 'groupLeader'
  726. const jsonArry = []
  727. if (record.groupLeaderAccount !== '' && record.groupLeaderAccount !== null) {
  728. if (record.groupLeaderAccount.indexOf(',') > -1) {
  729. const codes = record.groupLeaderAccount.split(',')
  730. const names = record.groupLeaderName.split(',')
  731. for (let i = 0; i < codes.length; i++) {
  732. jsonArry.push({ type: 'User', code: codes[i], name: names[i], attrs: [] })
  733. }
  734. } else {
  735. jsonArry.push({
  736. type: 'User',
  737. code: record.groupLeaderAccount,
  738. name: record.groupLeaderName,
  739. attrs: [],
  740. })
  741. }
  742. }
  743. this.mainSendUnit = jsonArry
  744. this.projectId = record.id
  745. setTimeout(() => {
  746. this.$refs.assignTeamLeader.openPicker()
  747. }, 0)
  748. }
  749. // 设定查阅范围操作
  750. if (val === 'setReadAuthority') {
  751. this.setType = 'readAuthority'
  752. const jsonArry = []
  753. if (record.readAuthorityCodes !== '' && record.readAuthorityCodes !== null) {
  754. if (record.readAuthorityCodes.indexOf(',') > -1) {
  755. const codes = record.readAuthorityCodes.split(',')
  756. const names = record.readAuthorityNames.split(',')
  757. for (let i = 0; i < codes.length; i++) {
  758. jsonArry.push({ type: 'User', code: codes[i], name: names[i], attrs: [] })
  759. }
  760. } else {
  761. jsonArry.push({
  762. type: 'User',
  763. code: record.readAuthorityCodes,
  764. name: record.readAuthorityNames,
  765. attrs: [],
  766. })
  767. }
  768. }
  769. this.mainSendUnit = jsonArry
  770. this.projectId = record.id
  771. setTimeout(() => {
  772. this.$refs.assignTeamLeader.openPicker()
  773. }, 0)
  774. }
  775. // 关闭项目
  776. if (val === 'closeProject') {
  777. return new Promise((resolve) => {
  778. // 关闭项目前的校验
  779. AuditProjectService.checkBeforeCloseProject(record.id).then((res) => {
  780. if (res.data) {
  781. Modal.warning({
  782. title: '提示',
  783. content: '该项目的《审计报告》未结束!',
  784. })
  785. return null
  786. } else {
  787. Modal.confirm({
  788. title: '您确定要关闭该项目吗?',
  789. content: '关闭该项目后,就无法恢复初始的状态。',
  790. okText: '关闭',
  791. okType: 'danger',
  792. cancelText: '取消',
  793. onOk: () => {
  794. axios({
  795. url: `api/xcoa-mobile/v1/iamauditproject/closeProject?id=` + record.id,
  796. method: 'get',
  797. })
  798. .then(() => {
  799. const msg = '关闭成功!'
  800. message.success(msg)
  801. this.$refs.dataTable.clearSelection()
  802. this.$refs.dataTable.refresh()
  803. })
  804. .catch((err) => {
  805. const msg = errorUtil.getMessage(err) || '关闭失败'
  806. message.error(msg)
  807. })
  808. .finally(resolve)
  809. },
  810. onCancel: () => {
  811. resolve()
  812. },
  813. })
  814. }
  815. })
  816. })
  817. }
  818. // 重启项目
  819. if (val === 'restart') {
  820. return new Promise((resolve) => {
  821. Modal.confirm({
  822. title: '您确定要重启该项目吗?',
  823. content: '重启该项目后,就无法恢复初始的状态。',
  824. okText: '重启',
  825. okType: 'danger',
  826. onOk: () => {
  827. axios({
  828. url: `api/xcoa-mobile/v1/iamauditproject/restartProject?id=` + record.id,
  829. method: 'get',
  830. })
  831. .then(() => {
  832. const msg = '重启成功!'
  833. message.success(msg)
  834. this.$refs.dataTable.clearSelection()
  835. this.$refs.dataTable.refresh()
  836. })
  837. .catch((err) => {
  838. const msg = errorUtil.getMessage(err) || '重启失败'
  839. message.error(msg)
  840. })
  841. .finally(resolve)
  842. },
  843. onCancel: () => {
  844. resolve()
  845. },
  846. })
  847. })
  848. }
  849. if (val === 'projectArchive') {
  850. // 项目归档
  851. AuditProjectService.projectArchive(record.id).then((res) => {
  852. if (res.data) {
  853. const url = '/audit-archives-form?record=' + res.data + '&fromFlag=projectList' // 新页面要打开的路由地址
  854. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  855. if (refreshFlag) {
  856. // 这里写或者调刷新的方法
  857. this.$refs.dataTable.clearSelection()
  858. this.$refs.dataTable.refresh()
  859. }
  860. })
  861. }
  862. })
  863. }
  864. if (val === 'projectScore') {
  865. // 项目归档
  866. const url = '/audit-project-score?record=' + record.id // 新页面要打开的路由地址
  867. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  868. if (refreshFlag) {
  869. // 这里写或者调刷新的方法
  870. this.$refs.dataTable.clearSelection()
  871. this.$refs.dataTable.refresh()
  872. }
  873. })
  874. }
  875. },
  876. changeNum(data) {
  877. data.forEach((item, index) => {
  878. item.sortNum = index + 1
  879. })
  880. },
  881. selectedRowsChanged(row) {
  882. if (row.length > 0) {
  883. this.deleteButtonDisable = false
  884. } else {
  885. this.deleteButtonDisable = true
  886. }
  887. },
  888. // 校验操作权限
  889. checkPermission(btnPerm, dataPerm) {
  890. let result = false
  891. if (dataPerm !== null) {
  892. const dataPermArry = dataPerm.split(',')
  893. dataPermArry.forEach((item) => {
  894. if (btnPerm.includes(item)) {
  895. result = true
  896. }
  897. })
  898. }
  899. return result
  900. },
  901. processReq(req) {
  902. const url = req.url
  903. const arr = req.data.expressions
  904. if (url === 'api/xcoa-mobile/v1/iamauditproject/all-list' && arr.length === 0) {
  905. arr.push({
  906. dataType: 'str',
  907. name: 'planYear',
  908. op: 'like',
  909. stringValue: `%${this.searchYear}%`,
  910. })
  911. arr.push({
  912. dataType: 'str',
  913. name: 'isMyParticipate',
  914. op: 'eq',
  915. stringValue: '0',
  916. })
  917. }
  918. return req
  919. },
  920. },
  921. }
  922. </script>
  923. <style module lang="scss">
  924. @use '@/common/design' as *;
  925. .project-list-div {
  926. :global(.ant-col-offset-10) {
  927. margin-left: 0;
  928. }
  929. }
  930. .btns {
  931. position: absolute;
  932. top: 23px;
  933. right: 0;
  934. left: 20px;
  935. z-index: 100;
  936. width: calc(100% - 40px);
  937. }
  938. .operatecol {
  939. display: flex;
  940. flex-wrap: wrap;
  941. justify-content: flex-end;
  942. float: left;
  943. :global(.ant-btn-sm) {
  944. padding: 0 3px;
  945. }
  946. }
  947. .advSearchBtn {
  948. width: 35px;
  949. padding: 0;
  950. margin-left: -5px;
  951. border-radius: 0 5px 5px 0;
  952. }
  953. .actionBtn {
  954. float: right;
  955. width: auto;
  956. * {
  957. vertical-align: middle;
  958. }
  959. }
  960. .buttonSpacing {
  961. margin-left: 5px;
  962. }
  963. .search-icon {
  964. margin-left: 1px !important;
  965. font-size: 12px;
  966. }
  967. .optbutton {
  968. font-size: 20px;
  969. }
  970. </style>