audit-project-list.vue 34 KB

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