risk-tasks-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <div :class="$style.wrapHeight">
  3. <a-card>
  4. <!-- 高级搜索组件 -->
  5. <audit-advanced-query
  6. :expand="expand"
  7. :search-data="formData"
  8. :ref-name="searchform"
  9. :search-style="{ height: '170px', left: '20px', top: '57px' }"
  10. :search-fun="handleSearch"
  11. @searchedClick="searchedClick"
  12. @resetForm="resetForm"
  13. >
  14. <template>
  15. <a-col :span="12">
  16. <a-form-model-item label="任务年度">
  17. <sd-select v-model="formData.year" :options="yearArry" allow-clear />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :span="12">
  21. <a-form-model-item label="任务名称">
  22. <a-input v-model="formData.dutieName" allow-clear />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :span="12">
  26. <a-form-model-item label="发起机构">
  27. <a-input v-model="formData.inspectUnitName" allow-clear />
  28. </a-form-model-item>
  29. </a-col>
  30. </template>
  31. </audit-advanced-query>
  32. <sd-data-table-ex
  33. :key="key"
  34. ref="riskDutieTable"
  35. form-id="riskDutie"
  36. page-id="risk/dutie/riskDutie"
  37. data-url="api/xcoa-mobile/v1/riskdutie/all-list"
  38. :columns="columns"
  39. :actions="actions"
  40. show-selection
  41. :show-advance-query="true"
  42. :filter-expressions="expressions"
  43. :search-fields="['year', 'dutieName']"
  44. @searchbtnClick="searchbtnClick"
  45. >
  46. <template slot="islink" slot-scope="text, record">
  47. <a @click="openversion(record)">{{ text }}</a>
  48. </template>
  49. <template slot="action" slot-scope="text, record">
  50. <a-button type="link" @click="open(record)"
  51. ><sd-icon type="sd-eye" :style="{ fontSize: '25px' }"
  52. /></a-button>
  53. </template>
  54. </sd-data-table-ex>
  55. <div :class="[$style.btns]">
  56. <a-col :span="13" :offset="0">
  57. <a-radio-group v-model="radioValue" @change="radioOnChange">
  58. <a-radio :style="radioStyle" :value="'0'">
  59. 全部
  60. </a-radio>
  61. <a-radio :style="radioStyle" :value="'1'">
  62. 待处理
  63. </a-radio>
  64. </a-radio-group>
  65. </a-col>
  66. </div>
  67. </a-card>
  68. </div>
  69. </template>
  70. <script>
  71. import { getUserInfo } from '@/common/store-mixin'
  72. import FlowcenterService from '@/flowcenter/flowcenter-service'
  73. import { Modal, message } from 'ant-design-vue'
  74. import systemManage from '@/system-manage/system-manage'
  75. import TableActionTypes from '@/common/services/table-action-types'
  76. import TableColumnTypes from '@/common/services/table-column-types'
  77. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  78. import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
  79. import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
  80. import components from './_import-components/risk-tasks-list-import'
  81. export default {
  82. name: 'RiskTasksList',
  83. metaInfo: {
  84. title: '风险任务',
  85. },
  86. components: {
  87. ...components,
  88. auditAdvancedQuery,
  89. },
  90. mixins: [auditAdvancedQueryMixins],
  91. data() {
  92. return {
  93. yearArry: [],
  94. waterMark: systemManage.getFormWaterMark(),
  95. flag: true,
  96. recordId: '',
  97. key: 0,
  98. searchform: 'searchform',
  99. formData: {
  100. year: '',
  101. dutieName: '',
  102. inspectUnitName: '',
  103. },
  104. columns: [
  105. {
  106. title: '序号',
  107. customRender: (text, record, index) => `${index + 1}`,
  108. width: '80px',
  109. },
  110. { dataIndex: 'id', sdHidden: true },
  111. { dataIndex: 'instId', sdHidden: true },
  112. {
  113. title: '任务年度',
  114. dataIndex: 'year',
  115. width: '120px',
  116. defaultSortOrder: 'desc',
  117. },
  118. {
  119. title: '任务名称',
  120. dataIndex: 'dutieName',
  121. scopedSlots: { customRender: 'islink' },
  122. },
  123. {
  124. title: '任务编号',
  125. dataIndex: 'dutieCode',
  126. },
  127. {
  128. title: '发起机构',
  129. dataIndex: 'inspectUnitName',
  130. },
  131. {
  132. title: '任务类型',
  133. dataIndex: 'dutieType',
  134. },
  135. {
  136. title: '创建人员',
  137. dataIndex: 'creatorName',
  138. },
  139. {
  140. title: '创建日期',
  141. dataIndex: 'creationTime',
  142. sdRender: TableColumnTypes.date,
  143. width: '120px',
  144. },
  145. {
  146. title: '当前状态',
  147. dataIndex: 'flowState',
  148. width: '120px',
  149. },
  150. { title: '当前处理人', dataIndex: 'currentUser', width: '120px' },
  151. { title: '文档状态', dataIndex: 'endType', width: '120px', sdHidden: true },
  152. {
  153. title: '操作',
  154. dataIndex: '',
  155. scopedSlots: { customRender: 'action' },
  156. align: 'center',
  157. width: '80px',
  158. },
  159. ],
  160. actions: [
  161. {
  162. label: '新建任务',
  163. id: 'new',
  164. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  165. permission: null,
  166. callback: this.createRiskTask,
  167. index: 4,
  168. },
  169. {
  170. label: '删除',
  171. id: 'delete',
  172. permission: null,
  173. class: 'batch',
  174. callback: this.deleteRows,
  175. index: 3,
  176. },
  177. ],
  178. expressions: [],
  179. auditMattersPath: '',
  180. visible: false,
  181. radioValue: '0',
  182. radioType: true,
  183. radioStyle: {},
  184. }
  185. },
  186. mounted() {
  187. // 初始化年份下拉框
  188. this.initYearSelect()
  189. },
  190. methods: {
  191. radioOnChange(e, info) {
  192. this.radioValue = e.target.value
  193. this.radioType = true
  194. this.expressions.forEach((item) => {
  195. if (item.name === 'pending') {
  196. item.stringValue = this.radioValue
  197. this.radioType = false
  198. }
  199. })
  200. if (this.radioType) {
  201. this.expressions.push({
  202. dataType: 'str',
  203. name: 'pending',
  204. op: 'eq',
  205. stringValue: this.radioValue,
  206. })
  207. }
  208. this.expressions = [...this.expressions]
  209. this.$refs.riskDutieTable.clearSelection()
  210. },
  211. // 创建任务
  212. createRiskTask() {
  213. const url = '/sd-flow-guide?code=PRODUCT_RISK_TASKS' // 新页面要打开的路由地址
  214. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  215. if (refreshFlag) {
  216. // 这里写或者调刷新的方法
  217. this.refreshDataTable()
  218. }
  219. })
  220. },
  221. // 刷新列表
  222. refreshDataTable() {
  223. if (this.$refs.riskDutieTable) {
  224. this.$refs.riskDutieTable.refresh()
  225. this.$refs.riskDutieTable.clearSelection()
  226. }
  227. },
  228. // 初始化年份下拉框
  229. initYearSelect() {
  230. const nowYear = new Date().getFullYear()
  231. const yearArry = []
  232. yearArry.push(nowYear)
  233. for (let i = 1; i < 6; i++) {
  234. yearArry.push(nowYear - i)
  235. }
  236. for (let i = 1; i < 11; i++) {
  237. yearArry.push(nowYear + i)
  238. }
  239. yearArry.sort()
  240. yearArry.forEach((year) => {
  241. this.yearArry.push({
  242. name: year,
  243. id: year,
  244. })
  245. })
  246. },
  247. open(record) {
  248. this.recordId = record.id
  249. window.open('#/sd-webflow/done-pages/' + record.instId)
  250. },
  251. openversion(record) {
  252. if (record.flowState === '结束') {
  253. window.open('#/risk-tasks/?taskId=' + record.id)
  254. } else {
  255. let openurl = ''
  256. const loginUser = getUserInfo()
  257. if (
  258. (record.flowState === '开始') |
  259. (record.flowState === '起草') |
  260. (record.flowState === null)
  261. ) {
  262. if (loginUser.name === record.currentUser) {
  263. openurl = '/sd-webflow/pages/draft/' + record.instId
  264. } else {
  265. openurl = '/sd-webflow/done-pages/' + record.instId
  266. }
  267. } else {
  268. openurl = '/sd-webflow/done-pages/' + record.instId
  269. }
  270. crossWindowWatcher.waitForChanged(openurl).then((refreshFlag) => {
  271. if (refreshFlag) {
  272. // 这里写或者调刷新的方法
  273. this.refreshDataTable()
  274. }
  275. })
  276. }
  277. },
  278. handleSearch() {
  279. this.expressions = []
  280. // 全部 待处理
  281. if (this.radioValue === '1') {
  282. this.Expressions.push({
  283. dataType: 'str',
  284. name: 'pending',
  285. op: 'eq',
  286. stringValue: this.radioValue,
  287. })
  288. }
  289. // 年度
  290. if (this.formData.year.length > 0) {
  291. this.expressions.push({
  292. dataType: 'str',
  293. name: 'year',
  294. op: 'eq',
  295. stringValue: this.formData.year[0].name + '',
  296. })
  297. }
  298. // 任务名称
  299. if (this.formData.dutieName) {
  300. this.expressions.push({
  301. dataType: 'str',
  302. name: 'dutieName',
  303. op: 'like',
  304. stringValue: '%' + this.formData.dutieName + '%',
  305. })
  306. }
  307. // 发起机构
  308. if (this.formData.inspectUnitName) {
  309. this.expressions.push({
  310. dataType: 'str',
  311. name: 'inspectUnitName',
  312. op: 'like',
  313. stringValue: '%' + this.formData.inspectUnitName + '%',
  314. })
  315. }
  316. this.expressions = [...this.expressions]
  317. },
  318. // 重置
  319. resetForm() {
  320. this.formData = {
  321. year: '',
  322. dutieName: '',
  323. inspectUnitName: [],
  324. }
  325. },
  326. // 删除数据
  327. deleteRows(record) {
  328. const selecteFlowState = this.$refs.riskDutieTable.getSelectedRows()
  329. const selectedRowKeys = this.$refs.riskDutieTable.getSelectedRowKeys()
  330. if (selectedRowKeys.length === 0) {
  331. Modal.info({
  332. content: '请选择需要删除的文件',
  333. })
  334. return
  335. }
  336. let flag = false
  337. selecteFlowState.forEach((item) => {
  338. if (item.endType !== 0) {
  339. flag = true
  340. }
  341. })
  342. if (flag) {
  343. // 有过错误
  344. Modal.error({
  345. title: '删除失败:存在不是草稿状态的数据',
  346. })
  347. } else {
  348. Modal.confirm({
  349. title: '你确定删除这项内容吗?',
  350. content: '删除这条数据后,就无法恢复初始的状态。',
  351. okText: '删除',
  352. okType: 'danger',
  353. onOk: () => {
  354. this.loading = true
  355. const instIds = []
  356. selecteFlowState.forEach((item) => {
  357. if (item.instId) {
  358. instIds.push(item.instId)
  359. }
  360. })
  361. const params = {
  362. flowCallbackBeanName: 'formBeanCleanerCallBack',
  363. processInstanceIds: instIds.join(','),
  364. }
  365. FlowcenterService.fnDarftsDelete(params).then((res) => {
  366. if (res.status === 200) {
  367. message.success({ content: '删除成功!' }, 1).then(() => {
  368. this.$refs.riskDutieTable.clearSelection()
  369. this.$refs.riskDutieTable.refresh()
  370. this.loading = false
  371. })
  372. }
  373. })
  374. },
  375. })
  376. }
  377. },
  378. },
  379. }
  380. </script>
  381. <style module lang="scss">
  382. @use '@/common/design' as *;
  383. .wrap-height {
  384. height: 100%;
  385. .row-height {
  386. display: flex;
  387. flex: auto;
  388. height: 100%;
  389. .rightcard {
  390. flex: 1;
  391. width: calc(100% - 20%);
  392. height: 100%;
  393. }
  394. }
  395. }
  396. .btns {
  397. position: absolute;
  398. top: 20px;
  399. right: 0;
  400. left: 20px;
  401. z-index: 100;
  402. width: calc(100% - 400px);
  403. span {
  404. color: blue;
  405. }
  406. }
  407. </style>