audit-notice-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div>
  3. <a-card>
  4. <!-- 高级搜索组件 -->
  5. <audit-advanced-query
  6. :expand="expand"
  7. :search-data="formData"
  8. :ref-name="searchform"
  9. :search-style="{
  10. height: '140px',
  11. left: '20px',
  12. top: '45px !important',
  13. width: 'calc(100% - 5px) !important',
  14. margin: 'auto',
  15. }"
  16. :search-fun="handleSearch"
  17. @searchedClick="searchedClick"
  18. >
  19. <template>
  20. <a-col :span="12">
  21. <a-form-model-item :label="'文件标题'" prop="fileTitle">
  22. <a-input v-model="formData.fileTitle" allow-clear />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :span="12">
  26. <a-form-model-item :label="'被审计单位'" prop="auditedUnitNames">
  27. <a-input v-model="formData.auditedUnitNames" allow-clear />
  28. </a-form-model-item>
  29. </a-col>
  30. </template>
  31. </audit-advanced-query>
  32. <sd-data-table-ex
  33. ref="noticeDataTable"
  34. :filter-expressions="expressions"
  35. :columns="columns"
  36. :actions="actions"
  37. form-id="iamAuditNotice"
  38. :data-url="dataurl"
  39. :search-fields="['fileTitle', 'auditedUnitNames', 'creatorName', 'flowState']"
  40. show-selection
  41. :show-advance-query="true"
  42. @searchbtnClick="searchbtnClick"
  43. >
  44. <div slot="islink" slot-scope="text, record">
  45. <a @click="rowClick(record)">{{ text }}</a>
  46. </div>
  47. </sd-data-table-ex>
  48. </a-card>
  49. </div>
  50. </template>
  51. <script>
  52. import axios from '@/common/services/axios-instance'
  53. import { Modal, Message } from 'ant-design-vue'
  54. import { getUserInfo } from '@/common/store-mixin'
  55. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  56. import PageService from '@/common/services/page-service'
  57. import TableColumnTypes from '@/common/services/table-column-types'
  58. import TableActionTypes from '@/common/services/table-action-types'
  59. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  60. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  61. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  62. import components from './_import-components/audit-notice-list-import'
  63. export default {
  64. name: 'AuditNoticeList',
  65. metaInfo: {
  66. title: '审计通知书',
  67. },
  68. components: {
  69. ...components,
  70. auditAdvancedQuery,
  71. },
  72. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  73. data() {
  74. return {
  75. userType: '',
  76. projectId: this.$root.$route.query.projectId,
  77. searchform: 'searchform',
  78. expressions: [
  79. {
  80. dataType: 'str',
  81. name: 'projectId',
  82. op: 'eq',
  83. stringValue: this.$root.$route.query.projectId,
  84. },
  85. ],
  86. formData: {},
  87. formId: 'iamAuditNotice',
  88. dataurl:
  89. 'api/xcoa-mobile/v1/iamauditnotice/all-list?projectId=' + this.$root.$route.query.projectId,
  90. columns: [
  91. {
  92. title: '序号',
  93. dataIndex: 'sortNumber',
  94. customRender: (text, record, index) => `${index + 1}`,
  95. width: '80px',
  96. },
  97. {
  98. title: '文件标题',
  99. dataIndex: 'fileTitle',
  100. scopedSlots: { customRender: 'islink' },
  101. width: '35%',
  102. },
  103. {
  104. title: 'instId',
  105. dataIndex: 'instId',
  106. sdHidden: true,
  107. },
  108. {
  109. title: '被审计单位',
  110. dataIndex: 'auditedUnitNames',
  111. },
  112. {
  113. title: '编制人员',
  114. dataIndex: 'creatorName',
  115. sorter: true,
  116. width: '120px',
  117. },
  118. {
  119. title: '编制日期',
  120. dataIndex: 'creationTime',
  121. defaultSortOrder: 'descend', // 没有点击任何排序列时,默认的排序列
  122. sorter: true,
  123. sdRender: TableColumnTypes.date,
  124. width: '120px',
  125. },
  126. {
  127. title: '当前状态',
  128. dataIndex: 'flowState',
  129. },
  130. {
  131. title: '当前处理人',
  132. dataIndex: 'currentUser',
  133. },
  134. ],
  135. actions: [],
  136. }
  137. },
  138. mounted() {
  139. this.setUserProject()
  140. // this.isShowBtn()
  141. },
  142. created() {},
  143. methods: {
  144. // 查看当前登录人是否项目成员,如果同时是项目阅读人员,取最大权限(项目成员权限)
  145. inProjectUser(userList) {
  146. var isProjectUser = false
  147. userList.map((item) => {
  148. if (item.userAccount === getUserInfo().account) {
  149. isProjectUser = true
  150. return isProjectUser
  151. }
  152. })
  153. return isProjectUser
  154. },
  155. // 是否显示按钮 禅道bug21826需要,关闭项目后各阶段都不能再新建(包括其他操作按钮)
  156. isShowBtn() {
  157. const projectId = this.$root.$route.query.projectId
  158. axios({
  159. url: `api/xcoa-mobile/v1/iamauditproject/getProjectInfoById?id=` + projectId,
  160. method: 'get',
  161. }).then((res) => {
  162. if (res.data) {
  163. const itemStatus = res.data.itemStatus
  164. const readAuthorityCodes = res.data.readAuthorityCodes
  165. const userList = res.data.iamProjectUserList
  166. var isProjectUser = this.inProjectUser(userList)
  167. if (['05', '06', '07'].includes(itemStatus)) {
  168. this.actions = []
  169. } else {
  170. if (
  171. readAuthorityCodes != null &&
  172. readAuthorityCodes.indexOf(getUserInfo().account) > -1 &&
  173. !isProjectUser
  174. ) {
  175. this.actions = []
  176. } else {
  177. this.setUserProject()
  178. }
  179. }
  180. }
  181. })
  182. },
  183. // 删除数据
  184. deleteRows(record) {
  185. const selecteFlowState = this.$refs.noticeDataTable.getSelectedRows()
  186. const selectedRowKeys = this.$refs.noticeDataTable.getSelectedRowKeys()
  187. if (selectedRowKeys.length === 0) {
  188. Modal.info({
  189. content: '请选择需要删除的文件',
  190. })
  191. return
  192. }
  193. let flag = false
  194. selecteFlowState.forEach((item) => {
  195. if (item.flowState === '结束') {
  196. flag = true
  197. }
  198. })
  199. if (flag) {
  200. // 有过错误
  201. Modal.error({
  202. title: '删除失败,存在“流程已结束”数据!',
  203. })
  204. } else {
  205. Modal.confirm({
  206. title: '你确定删除这项内容吗?',
  207. content: '删除这条数据后,就无法恢复初始的状态。',
  208. okText: '删除',
  209. okType: 'danger',
  210. onOk: () => {
  211. this.loading = true
  212. const params = {
  213. ids: selectedRowKeys.join(','),
  214. }
  215. PageService.delete(params, this.formId).then((res) => {
  216. if (res.status === 200) {
  217. Message.success({ content: '删除成功!' }, 1).then(() => {
  218. this.$refs.noticeDataTable.clearSelection()
  219. this.$refs.noticeDataTable.refresh()
  220. this.loading = false
  221. })
  222. }
  223. })
  224. },
  225. })
  226. }
  227. },
  228. setUserProject() {
  229. var projectId = this.$root.$route.query.projectId
  230. const params = {
  231. projectId: projectId,
  232. }
  233. if (projectId) {
  234. axios({
  235. url: 'api/xcoa-mobile/v1/iamprojectuser/findUserProject',
  236. method: 'get',
  237. params,
  238. }).then((res) => {
  239. // 项目负责人04 【查看】所有《审计通知书》
  240. let dataxm = res.data.toString()
  241. if (dataxm.indexOf('0') === -1) {
  242. dataxm = 0 + dataxm
  243. }
  244. axios({
  245. url: `api/xcoa-mobile/v1/iamauditproject/getProjectInfoById?id=` + projectId,
  246. method: 'get',
  247. }).then((res) => {
  248. if (res.data) {
  249. const itemStatus = res.data.itemStatus
  250. if (
  251. (dataxm.indexOf('01') > -1 ||
  252. dataxm.indexOf('02') > -1 ||
  253. dataxm.indexOf('03') > -1 ||
  254. dataxm.indexOf('05') > -1) &&
  255. !['05', '06', '07'].includes(itemStatus)
  256. ) {
  257. this.actions = [
  258. {
  259. label: '删除',
  260. id: 'delete',
  261. type: TableActionTypes.batch,
  262. permission: null,
  263. callback: this.deleteRows,
  264. },
  265. {
  266. label: '新建',
  267. id: 'new',
  268. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  269. permission: 'create', // 纯前端操作,不需要权限控制
  270. callback: () => {
  271. // var url = '/audit-notice-form?record=' + record.id
  272. // crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  273. // if (refreshFlag) {
  274. // // 这里写或者调刷新的方法
  275. // this.refresh()
  276. // }
  277. // })
  278. // // 查询
  279. const url =
  280. '/sd-flow-guide?code=PRODUCT_IAM_SJTZS&projectId=' + this.projectId // 新页面要打开的路由地址
  281. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  282. if (refreshFlag) {
  283. // 这里写或者调刷新的方法
  284. this.refresh()
  285. }
  286. })
  287. // // window.open(
  288. // // '#/sd-flow-guide?code=PRODUCT_IAM_SJTZS&projectId=' + this.projectId
  289. // // )
  290. },
  291. },
  292. ]
  293. this.userType = res.data
  294. }
  295. }
  296. })
  297. })
  298. }
  299. },
  300. refresh() {
  301. return this.$refs.noticeDataTable.refresh(true)
  302. },
  303. rowClick(record) {
  304. const userInfo = getUserInfo()
  305. if (this.userType === '04' || userInfo.name !== record.currentUser) {
  306. window.open('#/sd-webflow/done-pages/' + record.instId)
  307. } else {
  308. if (record.endType === 0 || record.flowState === '开始' || record.flowState === '起草') {
  309. window.open('#/sd-webflow/pages/draft/' + record.instId)
  310. } else {
  311. window.open('#/sd-webflow/done-pages/' + record.instId)
  312. }
  313. }
  314. // const url = '/audit-notice-form?record=' + record.id + '&projectId=' + this.projectId // 新页面要打开的路由地址
  315. // crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  316. // if (refreshFlag) {
  317. // this.refresh()
  318. // }
  319. // })
  320. },
  321. // 查询
  322. handleSearch() {
  323. // 默认查询条件
  324. this.expressions = [
  325. {
  326. dataType: 'str',
  327. name: 'projectId',
  328. op: 'eq',
  329. stringValue: this.$root.$route.query.projectId,
  330. },
  331. ]
  332. // 文件标题
  333. if (this.formData.fileTitle) {
  334. this.expressions.push({
  335. dataType: 'str',
  336. name: 'fileTitle',
  337. op: 'like',
  338. stringValue: `%${this.formData.fileTitle}%`,
  339. })
  340. }
  341. // 被审计单位
  342. if (this.formData.auditedUnitNames) {
  343. this.expressions.push({
  344. dataType: 'str',
  345. name: 'auditedUnitNames',
  346. op: 'like',
  347. stringValue: `%${this.formData.auditedUnitNames}%`,
  348. })
  349. }
  350. },
  351. },
  352. }
  353. </script>
  354. <style module lang="scss">
  355. @use '@/common/design' as *;
  356. </style>