iam-audit-leavemeeting.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <div :class="$style.wrapHeight">
  3. <div :class="$style.rowHeight">
  4. <div :class="$style.rightcard">
  5. <a-card>
  6. <div :class="$style.wrapper">
  7. <audit-advanced-query
  8. :expand="expand"
  9. :search-data="formData"
  10. :ref-name="'searchform'"
  11. :search-style="{
  12. height: '130px',
  13. left: '20px',
  14. top: '45px !important',
  15. width: 'calc(100% - 5px) !important',
  16. margin: 'auto',
  17. }"
  18. :search-fun="handleSearch"
  19. @searchedClick="searchedClick"
  20. >
  21. <template>
  22. <a-col :span="12">
  23. <a-form-model-item :label="'文件标题'" prop="docTitle">
  24. <a-input v-model="formData.docTitle" allow-clear />
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-model-item :label="'编制人员'" prop="authName">
  29. <a-input v-model="formData.authName" allow-clear />
  30. </a-form-model-item>
  31. </a-col>
  32. </template>
  33. </audit-advanced-query>
  34. <SdDataTableEx
  35. ref="oaTable"
  36. :form-id="formId"
  37. :columns="columns"
  38. :actions="actions"
  39. :filter-expressions="expressions"
  40. :show-selection="true"
  41. :show-advance-query="true"
  42. :search-fields="['docTitle']"
  43. :row-selection="{ type: 'radio' }"
  44. @recordsDeleted="onRecordsDeleted"
  45. @searchbtnClick="searchbtnClick"
  46. >
  47. <a
  48. slot="fldSubject"
  49. slot-scope="text, record"
  50. :title="text"
  51. @click="fnReadDoc(record)"
  52. >{{ text }}</a
  53. >
  54. <a slot="opt" slot-scope="text, record" @click="fnEditDoc(record)">编辑</a>
  55. </SdDataTableEx>
  56. </div>
  57. </a-card>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import axios from '@/common/services/axios-instance'
  64. import { Modal, Message } from 'ant-design-vue'
  65. import PageService from '@/common/services/page-service'
  66. import { getUserInfo } from '@/common/store-mixin'
  67. import TableActionTypes from '@/common/services/table-action-types'
  68. import TableColumnTypes from '@/common/services/table-column-types'
  69. import SdDataTableEx from '@/common/components/sd-data-table-ex.vue'
  70. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  71. import AuditProjectuserService from '@product/iam/audit/work/projectuser/audit-projectuser-service'
  72. import auditAdvancedQueryMixins from '../../../components/audit-advanced-query-mixins'
  73. import auditAdvancedQuery from '../../../components/audit-advanced-query.vue'
  74. import components from './_import-components/iam-audit-leavemeeting-import'
  75. export default {
  76. name: 'IamAuditLeavemeeting',
  77. metaInfo: {
  78. title: '离场会',
  79. },
  80. components: {
  81. auditAdvancedQuery,
  82. SdDataTableEx,
  83. ...components,
  84. },
  85. mixins: [auditAdvancedQueryMixins],
  86. props: {
  87. // 是不是用于选择数据
  88. isSelectd: {
  89. type: Boolean,
  90. default: false,
  91. },
  92. },
  93. data() {
  94. return {
  95. formData: {
  96. orgName: '',
  97. orgId: '',
  98. cUser: '',
  99. },
  100. expand: false,
  101. categorys: [],
  102. activeKey: 'textlist',
  103. isKmAdmin: false,
  104. expressions: [],
  105. columns: [
  106. {
  107. title: '序号',
  108. dataIndex: 'sortNumber',
  109. customRender: (text, record, index) => `${index + 1}`,
  110. width: '80px',
  111. },
  112. {
  113. title: '文件标题',
  114. dataIndex: 'docTitle',
  115. scopedSlots: { customRender: 'fldSubject' },
  116. width: '40%',
  117. },
  118. {
  119. title: '被审计单位',
  120. dataIndex: 'auditUnitName',
  121. width: '20%',
  122. },
  123. {
  124. title: '编制人员',
  125. dataIndex: 'authName',
  126. },
  127. {
  128. title: '编制日期',
  129. dataIndex: 'authTime',
  130. sdRender: TableColumnTypes.date,
  131. sorter: true,
  132. },
  133. {
  134. title: '文档状态',
  135. dataIndex: 'reservestring1',
  136. sorter: true,
  137. },
  138. {
  139. dataIndex: 'creatorAccount',
  140. sdHidden: true,
  141. },
  142. ],
  143. // actions: [
  144. // {
  145. // label: '删除',
  146. // permission: null, // 纯前端操作,不需要权限控制
  147. // id: 'delete',
  148. // callback: this.deleteRows,
  149. // type: TableActionTypes.batch,
  150. // },
  151. // {
  152. // label: '新建',
  153. // permission: null, // 纯前端操作,不需要权限控制
  154. // id: 'create', // 没写type,一般按钮
  155. // callback: () => {
  156. // this.fnCreatDoc()
  157. // },
  158. // type: TableActionTypes.primary,
  159. // },
  160. // ],
  161. actions: [],
  162. businessTypeId: null,
  163. typeId: null,
  164. typeName: '',
  165. formId: 'iamLeaveMeeting',
  166. // 图文列表参数
  167. showCreateBtn: false,
  168. showDeleteBtn: false,
  169. pictureData: [],
  170. pagination: {
  171. onChange: (page) => {
  172. this.paginationChange(page)
  173. },
  174. current: 1,
  175. pageSize: 8,
  176. showTotal(total) {
  177. return `共${total}条`
  178. },
  179. },
  180. loading: false, // 图文列表数据的loading
  181. orderType: 'creationTime',
  182. creationTimeDesc: true,
  183. pictureRowSelection: [],
  184. searchText: '',
  185. picList: '',
  186. projectId: this.$root.$route.query.projectId,
  187. }
  188. },
  189. // 图文列表参数变化更新数据
  190. watch: {
  191. orderType() {
  192. this.pictureListRefresh()
  193. },
  194. creationTimeDesc() {
  195. this.pictureListRefresh()
  196. },
  197. },
  198. created() {
  199. this.addExpression()
  200. },
  201. mounted() {
  202. this.isShowBtn()
  203. },
  204. methods: {
  205. // 查看当前登录人是否项目成员,如果同时是项目阅读人员,取最大权限(项目成员权限)
  206. inProjectUser(userList) {
  207. var isProjectUser = false
  208. userList.map((item) => {
  209. if (item.userAccount === getUserInfo().account) {
  210. isProjectUser = true
  211. return isProjectUser
  212. }
  213. })
  214. return isProjectUser
  215. },
  216. // 离场会按钮展示条件梳理:1、新建、删除按钮对所有角色展示
  217. // 2、结束环节之后按钮不展示
  218. // 3、只是阅读人员不展示按钮
  219. isShowBtn() {
  220. const projectId = this.$root.$route.query.projectId
  221. axios({
  222. url: `api/xcoa-mobile/v1/iamauditproject/getProjectInfoById?id=` + projectId,
  223. method: 'get',
  224. }).then((res) => {
  225. if (res.data) {
  226. const itemStatus = res.data.itemStatus
  227. const readAuthorityCodes = res.data.readAuthorityCodes
  228. const userList = res.data.iamProjectUserList
  229. var isProjectUser = this.inProjectUser(userList)
  230. if (['05', '06', '07'].includes(itemStatus)) {
  231. this.actions = []
  232. } else {
  233. // this.actions = [
  234. // {
  235. // label: '删除',
  236. // permission: null, // 纯前端操作,不需要权限控制
  237. // id: 'delete',
  238. // callback: this.deleteRows,
  239. // type: TableActionTypes.batch,
  240. // },
  241. // {
  242. // label: '新建',
  243. // permission: null, // 纯前端操作,不需要权限控制
  244. // id: 'create', // 没写type,一般按钮
  245. // callback: () => {
  246. // this.fnCreatDoc()
  247. // },
  248. // type: TableActionTypes.primary,
  249. // },
  250. // ]
  251. // }
  252. if (
  253. readAuthorityCodes != null &&
  254. readAuthorityCodes.indexOf(getUserInfo().account) > -1 &&
  255. !isProjectUser
  256. ) {
  257. this.actions = []
  258. } else {
  259. this.actions = [
  260. {
  261. label: '删除',
  262. permission: null, // 纯前端操作,不需要权限控制
  263. id: 'delete',
  264. callback: this.deleteRows,
  265. type: TableActionTypes.batch,
  266. },
  267. {
  268. label: '新建',
  269. permission: null, // 纯前端操作,不需要权限控制
  270. id: 'create', // 没写type,一般按钮
  271. callback: () => {
  272. this.fnCreatDoc()
  273. },
  274. type: TableActionTypes.primary,
  275. },
  276. ]
  277. // 判断权限
  278. // axios({
  279. // url: 'api/xcoa-mobile/v1/iamprojectuser/userProject?projectId=' + projectId,
  280. // method: 'get',
  281. // }).then((res) => {
  282. // const datas = res.data
  283. // if (!datas.includes('02') && !datas.includes('05')) {
  284. // // 项目组员没有删除权限
  285. // this.actions = [
  286. // {
  287. // label: '新建',
  288. // permission: null, // 纯前端操作,不需要权限控制
  289. // id: 'create', // 没写type,一般按钮
  290. // callback: () => {
  291. // this.fnCreatDoc()
  292. // },
  293. // type: TableActionTypes.primary,
  294. // },
  295. // ]
  296. // } else {
  297. // this.actions = [
  298. // {
  299. // label: '删除',
  300. // permission: null, // 纯前端操作,不需要权限控制
  301. // id: 'delete',
  302. // callback: this.deleteRows,
  303. // type: TableActionTypes.batch,
  304. // },
  305. // {
  306. // label: '新建',
  307. // permission: null, // 纯前端操作,不需要权限控制
  308. // id: 'create', // 没写type,一般按钮
  309. // callback: () => {
  310. // this.fnCreatDoc()
  311. // },
  312. // type: TableActionTypes.primary,
  313. // },
  314. // ]
  315. // }
  316. // })
  317. }
  318. }
  319. }
  320. })
  321. },
  322. searchedClick() {
  323. this.expand = false
  324. },
  325. // 查询
  326. handleSearch() {
  327. this.expressions = []
  328. this.addExpression()
  329. // 文件标题
  330. if (this.formData.docTitle) {
  331. this.expressions.push({
  332. dataType: 'str',
  333. name: 'docTitle',
  334. op: 'like',
  335. stringValue: `%${this.formData.docTitle}%`,
  336. })
  337. }
  338. // 编制人员
  339. if (this.formData.authName) {
  340. this.expressions.push({
  341. dataType: 'str',
  342. name: 'authName',
  343. op: 'like',
  344. stringValue: `%${this.formData.authName}%`,
  345. })
  346. }
  347. },
  348. // 新建
  349. fnCreatDoc() {
  350. var url = '/iam-audit-leavemeeting-form?projectId=' + this.projectId
  351. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  352. if (refreshFlag) {
  353. return this.$refs.oaTable.refresh(true)
  354. }
  355. })
  356. },
  357. fnEditDoc(record) {
  358. setTimeout(() => {
  359. this.$refs.oaTable.refresh()
  360. this.loadData()
  361. }, 5000)
  362. var url = `/km-knowledage-form?&typeId=${this.typeId}&typeName=${this.typeName}&record=${record.id}`
  363. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  364. if (refreshFlag) {
  365. return this.$refs.oaTable.refresh(true)
  366. }
  367. })
  368. },
  369. // 查看
  370. fnReadDoc(record) {
  371. setTimeout(() => {
  372. this.$refs.oaTable.refresh()
  373. this.loadData()
  374. }, 5000)
  375. // 当前用户
  376. var currentUser = getUserInfo().name
  377. var mode = null
  378. var type = 0
  379. if (record.authName === currentUser) {
  380. mode = 'EDIT'
  381. if (record.reservestring1 === '已结束') {
  382. type = 1
  383. } else {
  384. type = 2
  385. }
  386. } else {
  387. mode = 'VIEW'
  388. }
  389. window.open(
  390. `#/iam-audit-leavemeeting-form?record=${record.id}&type=${type}&mode=${mode}&projectId=${this.projectId}`,
  391. '_blank'
  392. )
  393. },
  394. // 图片列表页面翻页
  395. paginationChange(page) {
  396. this.pagination.current = page
  397. this.loadData()
  398. },
  399. pictureListRefresh(toFirstPage) {
  400. if (toFirstPage) this.pagination.current = 1
  401. if (!this.isSelectd) {
  402. return this.loadData()
  403. }
  404. },
  405. // 列表删除数据时刷新一下
  406. onRecordsDeleted() {
  407. this.$refs.tree.refresh() // 刷新树
  408. },
  409. // 列表删除数据
  410. deleteRows() {
  411. const selectedRowKeys = this.$refs.oaTable.getSelectedRowKeys()
  412. if (selectedRowKeys.length === 0) {
  413. Modal.info({
  414. content: '请选择需要删除的文件',
  415. })
  416. return
  417. }
  418. // 当前用户
  419. var currentUser = getUserInfo().account
  420. var rows = this.$refs.oaTable.getSelectedRows()
  421. var titles = []
  422. for (var i = 0; i < rows.length; i++) {
  423. if (currentUser !== rows[i].creatorAccount) {
  424. titles.push(rows[i].docTitle)
  425. }
  426. }
  427. // 判断是否选择了非自己的离场会
  428. if (titles.length > 0) {
  429. // 判断是否项目组长/项目副组长
  430. AuditProjectuserService.isProjectLeader(parseInt(this.projectId), 'head').then((res) => {
  431. if (res && res.data === true) {
  432. this.doDelete(selectedRowKeys)
  433. } else {
  434. Modal.info({
  435. content: (h) => {
  436. const info = [h('p', null, '请选择自己的离场会,以下非您创建:')]
  437. titles.forEach((t) => {
  438. info.push(t)
  439. info.push(h('br'))
  440. })
  441. return h('p', info)
  442. },
  443. })
  444. }
  445. })
  446. } else {
  447. this.doDelete(selectedRowKeys)
  448. }
  449. },
  450. doDelete(selectedRowKeys) {
  451. Modal.confirm({
  452. title: '你确定删除这项内容吗?',
  453. content: '删除这条数据后,就无法恢复初始的状态。',
  454. okText: '删除',
  455. okType: 'danger',
  456. onOk: () => {
  457. this.loading = true
  458. const params = {
  459. ids: selectedRowKeys.join(','),
  460. }
  461. PageService.delete(params, this.formId).then((res) => {
  462. if (res.status === 200) {
  463. Message.success({ content: '删除成功!' }, 1).then(() => {
  464. this.$refs.oaTable.clearSelection()
  465. this.$refs.oaTable.refresh()
  466. this.loading = false
  467. })
  468. }
  469. })
  470. },
  471. })
  472. },
  473. // 项目负责人,项目组长/项目副组长【查看】所有《离场会》;项目主审/项目组员【查看】所有“已结束”《离场会》
  474. addExpression() {
  475. this.expressions.push({
  476. dataType: 'long',
  477. name: 'projectId',
  478. op: 'eq',
  479. longValue: parseInt(this.projectId),
  480. })
  481. AuditProjectuserService.isProjectLeader(parseInt(this.projectId), 'all').then((res) => {
  482. if (res && res.data === false) {
  483. this.expressions.push({
  484. dataType: 'exps',
  485. op: 'or',
  486. expressionsValue: [
  487. {
  488. dataType: 'str',
  489. name: 'creatorAccount',
  490. op: 'eq',
  491. stringValue: getUserInfo().account,
  492. },
  493. {
  494. dataType: 'str',
  495. name: 'reservestring1',
  496. op: 'like',
  497. stringValue: `%已结束%`,
  498. },
  499. ],
  500. })
  501. }
  502. })
  503. },
  504. },
  505. }
  506. </script>
  507. <style module lang="scss">
  508. @use '@/common/design' as *;
  509. </style>