risk-loss-event-list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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: '203px', top: '60px !important' }"
  10. :search-fun="handleSearch"
  11. @searchedClick="searchedClick"
  12. @resetForm="resetForm"
  13. >
  14. <template>
  15. <a-col :span="10">
  16. <a-form-model-item :label="'发生日期'">
  17. <a-range-picker v-model="formData.happenTime" style="width:100%;" />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :span="14">
  21. <a-form-model-item :label="'\u2003\u2003事件名称'">
  22. <a-input v-model="formData.eventName" />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :span="10">
  26. <a-form-model-item label="事件类型">
  27. <sd-select v-model="formData.eventType" :options="eventType" allow-clear />
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :span="14">
  31. <a-form-model-item :label="'\u2003\u2003事件性质'">
  32. <sd-select v-model="formData.eventNature" :options="eventNature" allow-clear />
  33. </a-form-model-item>
  34. </a-col>
  35. <a-col :span="10">
  36. <a-form-model-item :label="'处置进展'">
  37. <sd-select
  38. v-model="formData.disposalProgress"
  39. :allow-clear="true"
  40. :options="disposalProgress"
  41. />
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :span="14">
  45. <a-form-model-item :label="'是否重大风险事件'" class="zdfxsj">
  46. <sd-select
  47. v-model="formData.isMajorEvent"
  48. :allow-clear="true"
  49. :options="isMajorEvent"
  50. />
  51. </a-form-model-item>
  52. </a-col>
  53. </template>
  54. </audit-advanced-query>
  55. <div :class="[$style.btns]">
  56. <audit-advanced-export
  57. ref="Export"
  58. :class-style="[$style.buttonSpacing]"
  59. :exclebxh="false"
  60. :expressions="expressions"
  61. :config-id="231"
  62. :v-if="false"
  63. />
  64. </div>
  65. <sd-data-table
  66. ref="riskLossEventTable"
  67. data-url="api/xcoa-mobile/v1/iam-common/search"
  68. :row-key="'INST_ID'"
  69. :projectlist="true"
  70. :columns="columns"
  71. :actions="actions"
  72. show-selection
  73. :show-advance-query="true"
  74. :process-req="processReq"
  75. :search-fields="['EVENT_NAME', 'EVENT_TYPE']"
  76. :filter-expressions="expressions"
  77. @searchbtnClick="searchbtnClick"
  78. >
  79. <template slot="islink" slot-scope="text, record">
  80. <a @click="rowClick(record)">{{ text }}</a>
  81. </template>
  82. </sd-data-table>
  83. </a-card>
  84. </div>
  85. </template>
  86. <script>
  87. import moment from 'moment'
  88. import axios from '@/common/services/axios-instance'
  89. import FlowcenterService from '@/flowcenter/flowcenter-service'
  90. import { Modal, message } from 'ant-design-vue'
  91. import { getUserInfo } from '@/common/store-mixin'
  92. import systemManage from '@/system-manage/system-manage'
  93. import TableActionTypes from '@/common/services/table-action-types'
  94. import TableColumnTypes from '@/common/services/table-column-types'
  95. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  96. import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
  97. import auditAdvancedExport from '@product/iam/components/audit-advanced-export.vue'
  98. import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
  99. import components from './_import-components/risk-loss-event-list-import'
  100. export default {
  101. name: 'RiskLossEventList',
  102. metaInfo: {
  103. title: '风险损失事件',
  104. },
  105. components: {
  106. ...components,
  107. auditAdvancedQuery,
  108. auditAdvancedExport,
  109. },
  110. mixins: [auditAdvancedQueryMixins],
  111. data() {
  112. return {
  113. yearArry: [],
  114. waterMark: systemManage.getFormWaterMark(),
  115. flag: true,
  116. recordId: '',
  117. key: 0,
  118. searchform: 'searchform',
  119. formData: {
  120. happenTime: null,
  121. eventName: '',
  122. eventType: null,
  123. eventNature: null,
  124. disposalProgress: null,
  125. isMajorEvent: null,
  126. },
  127. eventType: [],
  128. eventNature: [],
  129. disposalProgress: [],
  130. isMajorEvent: [],
  131. dataUrl: 'api/xcoa-mobile/v1/riskassessment/all-list',
  132. // ?taskId=' + this.$route.query.taskId,
  133. columns: [
  134. {
  135. title: '序号',
  136. customRender: (text, record, index) => `${index + 1}`,
  137. width: '80px',
  138. },
  139. {
  140. title: '发生日期',
  141. dataIndex: 'HAPPEN_TIME',
  142. sdRender: TableColumnTypes.date,
  143. width: '100px',
  144. defaultSortOrder: 'descend',
  145. },
  146. {
  147. title: '事件名称',
  148. dataIndex: 'EVENT_NAME',
  149. scopedSlots: { customRender: 'islink' },
  150. width: '100px',
  151. },
  152. {
  153. title: '事件类型',
  154. dataIndex: 'EVENT_TYPE',
  155. width: '100px',
  156. },
  157. {
  158. title: '事件性质',
  159. dataIndex: 'EVENT_NATURE',
  160. width: '100px',
  161. },
  162. {
  163. title: '责任单位/部门',
  164. dataIndex: 'RESPONSIBLE_DEPT_NAME',
  165. width: '180px',
  166. },
  167. {
  168. title: '是否重大风险事件',
  169. dataIndex: 'IS_MAJOR_EVENT',
  170. width: '200px',
  171. },
  172. {
  173. title: '损失金额(万元)',
  174. dataIndex: 'LOSS_AMOUNT',
  175. width: '180px',
  176. },
  177. {
  178. title: '处置进展',
  179. dataIndex: 'DISPOSAL_PROGRESS',
  180. width: '100px',
  181. },
  182. {
  183. title: '填报单位',
  184. dataIndex: 'FILLING_UNIT_NAME',
  185. width: '100px',
  186. },
  187. ],
  188. actions: [
  189. {
  190. label: '新建',
  191. id: 'new',
  192. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  193. permission: null,
  194. callback: this.create,
  195. index: 1,
  196. },
  197. {
  198. label: '删除',
  199. id: 'delete',
  200. type: TableActionTypes.batch, // 批处理按钮,选中文档时才能点击
  201. permission: null,
  202. callback: (keys) => {
  203. this.deleteRows(keys)
  204. },
  205. index: 3,
  206. },
  207. {
  208. label: '导出',
  209. id: 'export',
  210. permission: null,
  211. callback: (keys) => {
  212. this.export()
  213. },
  214. index: 4,
  215. },
  216. ],
  217. expressions: [],
  218. formId: 'riskLossEvent',
  219. visible: false,
  220. flowStateOptions: [
  221. { id: '0', name: '起草' },
  222. { id: '1', name: '审核' },
  223. { id: '2', name: '结束' },
  224. ],
  225. }
  226. },
  227. created() {
  228. this.initDictionaryInfo()
  229. },
  230. methods: {
  231. export() {
  232. this.$refs.Export.exportdata()
  233. },
  234. initDictionaryInfo() {
  235. axios({
  236. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=LOSS_EVENT_TYPE',
  237. method: 'get',
  238. }).then((res) => {
  239. if (res.status === 200) {
  240. this.eventType = res.data
  241. }
  242. })
  243. axios({
  244. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=EVENT_NATURE',
  245. method: 'get',
  246. }).then((res) => {
  247. if (res.status === 200) {
  248. this.eventNature = res.data
  249. }
  250. })
  251. axios({
  252. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=DISPOSAL_PROGRESS',
  253. method: 'get',
  254. }).then((res) => {
  255. if (res.status === 200) {
  256. this.disposalProgress = res.data
  257. }
  258. })
  259. axios({
  260. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=IS_MAJOR_EVENT',
  261. method: 'get',
  262. }).then((res) => {
  263. if (res.status === 200) {
  264. this.isMajorEvent = res.data
  265. }
  266. })
  267. },
  268. // 默认且必须的条件
  269. processReq(req) {
  270. req.data.formId = 'riskLossEvent'
  271. return req
  272. },
  273. create() {
  274. const url = '/sd-flow-guide?code=PRODUCT_RISK_LEVENT' // 新页面要打开的路由地址
  275. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  276. if (refreshFlag) {
  277. // 这里写或者调刷新的方法
  278. this.refreshDataTable()
  279. }
  280. })
  281. },
  282. refreshDataTable() {
  283. if (this.$refs.riskLossEventTable) {
  284. this.$refs.riskLossEventTable.clearSelection()
  285. this.$refs.riskLossEventTable.refresh()
  286. }
  287. },
  288. rowClick(record) {
  289. let url = ''
  290. if (record.END_TYPE === 0) {
  291. url = `/sd-webflow/pages/draft/` + record.INST_ID
  292. } else {
  293. url = `/sd-webflow/done-pages/` + record.INST_ID
  294. }
  295. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  296. if (refreshFlag) this.refreshDataTable()
  297. })
  298. },
  299. handleSearch() {
  300. this.expressions = []
  301. // 发生日期
  302. if (this.strOrArr(this.formData.happenTime)) {
  303. if (this.formData.happenTime[0] === null) {
  304. this.formData.happenTime = null
  305. } else {
  306. this.expressions.push({
  307. dataType: 'long',
  308. name: 'HAPPEN_TIME',
  309. op: 'ge',
  310. longValue: moment(this.formData.happenTime[0])
  311. .startOf('day')
  312. .valueOf(),
  313. })
  314. this.expressions.push({
  315. dataType: 'long',
  316. name: 'HAPPEN_TIME',
  317. op: 'le',
  318. longValue: moment(this.formData.happenTime[1])
  319. .endOf('day')
  320. .valueOf(),
  321. })
  322. }
  323. }
  324. // 事件名称
  325. if (this.formData.eventName) {
  326. this.expressions.push({
  327. dataType: 'str',
  328. name: 'EVENT_NAME',
  329. op: 'like',
  330. stringValue: '%' + this.formData.eventName + '%',
  331. })
  332. }
  333. // 事件类型
  334. if (this.formData.eventType && this.formData.eventType.length > 0) {
  335. this.expressions.push({
  336. dataType: 'str',
  337. name: 'EVENT_TYPE',
  338. op: 'eq',
  339. stringValue: this.formData.eventType[0].id,
  340. })
  341. }
  342. // 事件性质
  343. if (this.formData.eventNature && this.formData.eventNature.length > 0) {
  344. this.expressions.push({
  345. dataType: 'str',
  346. name: 'EVENT_NATURE',
  347. op: 'eq',
  348. stringValue: this.formData.eventNature[0].id,
  349. })
  350. }
  351. // 处置进展
  352. if (this.formData.disposalProgress && this.formData.disposalProgress.length > 0) {
  353. this.expressions.push({
  354. dataType: 'str',
  355. name: 'DISPOSAL_PROGRESS',
  356. op: 'eq',
  357. stringValue: this.formData.disposalProgress[0].id,
  358. })
  359. }
  360. // 是否重大风险事件
  361. if (this.formData.isMajorEvent && this.formData.isMajorEvent.length > 0) {
  362. this.expressions.push({
  363. dataType: 'str',
  364. name: 'IS_MAJOR_EVENT',
  365. op: 'eq',
  366. stringValue: this.formData.isMajorEvent[0].id,
  367. })
  368. }
  369. this.expressions = [...this.expressions]
  370. },
  371. // 重置
  372. resetForm() {
  373. this.formData = {
  374. happenTime: null,
  375. eventName: '',
  376. eventType: null,
  377. eventNature: null,
  378. disposalProgress: null,
  379. isMajorEvent: null,
  380. }
  381. },
  382. // 判断数组或字符串为null或长度为0
  383. strOrArr(strOrArr) {
  384. return strOrArr !== null && strOrArr.length > 0
  385. },
  386. // 删除数据
  387. deleteRows(selectedRowKeys) {
  388. const selecteFlowState = this.$refs.riskLossEventTable.getSelectedRows()
  389. const currentAccount = getUserInfo().account
  390. if (selecteFlowState.length === 0) {
  391. Modal.info({
  392. content: '请选择需要删除的文件',
  393. })
  394. return
  395. }
  396. var flages = true
  397. selecteFlowState.forEach((item) => {
  398. if (item.CREATOR_ACCOUNT !== currentAccount) {
  399. Modal.error({
  400. content: '请选择自己创建的文件',
  401. })
  402. flages = false
  403. }
  404. })
  405. if (!flages) {
  406. return
  407. }
  408. let flag = false
  409. selecteFlowState.forEach((item) => {
  410. if (item.END_TYPE !== 0) {
  411. flag = true
  412. }
  413. })
  414. if (flag) {
  415. Modal.error({
  416. title: '删除失败:存在不是草稿状态的数据',
  417. })
  418. } else {
  419. Modal.confirm({
  420. title: '您确定删除这项内容吗?',
  421. content: '删除数据后,就无法恢复初始的状态。',
  422. okText: '删除',
  423. cancelText: '取消',
  424. okType: 'danger',
  425. onOk: () => {
  426. this.loading = true
  427. const params = {
  428. flowCallbackBeanName: 'formBeanCleanerCallBack',
  429. processInstanceIds: selectedRowKeys.join(','),
  430. }
  431. FlowcenterService.fnDarftsDelete(params).then((res) => {
  432. if (res.status === 200) {
  433. message.success({ content: '删除成功!' }, 1).then(() => {
  434. this.refreshDataTable()
  435. })
  436. }
  437. })
  438. },
  439. onCancel: () => {
  440. // resolve()
  441. },
  442. })
  443. }
  444. },
  445. },
  446. }
  447. </script>
  448. <style module lang="scss">
  449. @use '@/common/design' as *;
  450. .wrap-height {
  451. height: 100%;
  452. .row-height {
  453. display: flex;
  454. flex: auto;
  455. height: 100%;
  456. .rightcard {
  457. flex: 1;
  458. width: calc(100% - 20%);
  459. height: 100%;
  460. }
  461. }
  462. }
  463. .btns {
  464. position: absolute;
  465. top: 5px;
  466. right: 0;
  467. left: 20px;
  468. z-index: 100;
  469. width: 50%;
  470. span {
  471. color: blue;
  472. }
  473. }
  474. :global(.zdfxsj) {
  475. :global(.ant-form-item-label) {
  476. margin-left: -33px;
  477. }
  478. }
  479. </style>