risk-case-list.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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. <a-input v-model="formData.title" allow-clear></a-input>
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :span="12">
  21. <a-form-model-item label="发生年份">
  22. <a-date-picker
  23. v-model="formData.caseYear"
  24. placeholder="请选择年"
  25. mode="year"
  26. :open="dataopen"
  27. format="YYYY"
  28. :allow-clear="true"
  29. @openChange="openChangeYear"
  30. @panelChange="panelChangeYear"
  31. /></a-form-model-item>
  32. </a-col>
  33. <a-col :span="12">
  34. <a-form-model-item label="案例来源">
  35. <a-select v-model="formData.caseSource" allow-clear>
  36. <a-select-option
  37. v-for="(item, index) in caseSourceOptions"
  38. :key="index"
  39. :value="item.id"
  40. >
  41. {{ item.name }}
  42. </a-select-option>
  43. </a-select></a-form-model-item
  44. >
  45. </a-col>
  46. <a-col :span="12">
  47. <a-form-model-item label="当前状态">
  48. <sd-select v-model="formData.status" :options="statusList" allow-clear />
  49. </a-form-model-item>
  50. </a-col>
  51. </template>
  52. </audit-advanced-query>
  53. <sd-data-table
  54. ref="dataTable"
  55. data-url="api/xcoa-mobile/v1/iam-common/search"
  56. :row-key="'INST_ID'"
  57. :columns="columns"
  58. :actions="actions"
  59. show-selection
  60. :show-advance-query="true"
  61. :process-req="processReq"
  62. :filter-expressions="expressions"
  63. :search-fields="['title']"
  64. @searchbtnClick="searchbtnClick"
  65. >
  66. <template slot="islink" slot-scope="text, record">
  67. <a @click="rowClick(record)">{{ text }}</a>
  68. </template>
  69. </sd-data-table>
  70. </a-card>
  71. </div>
  72. </template>
  73. <script>
  74. import moment from 'moment'
  75. import { Modal, message } from 'ant-design-vue'
  76. import FlowcenterService from '@/flowcenter/flowcenter-service'
  77. import { getUserInfo } from '@/common/store-mixin'
  78. import TableActionTypes from '@/common/services/table-action-types'
  79. import TableColumnTypes from '@/common/services/table-column-types'
  80. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  81. import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
  82. import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
  83. import CommonService from '../../core/api/common-service'
  84. import components from './_import-components/risk-case-list-import'
  85. export default {
  86. name: 'RiskCaseList',
  87. metaInfo: {
  88. title: '风险案例库',
  89. },
  90. components: {
  91. ...components,
  92. auditAdvancedQuery,
  93. },
  94. mixins: [auditAdvancedQueryMixins],
  95. data() {
  96. return {
  97. loading: false,
  98. searchform: 'searchform',
  99. dataopen: false,
  100. formData: {
  101. title: '',
  102. caseYear: '',
  103. caseSource: '',
  104. status: [],
  105. },
  106. caseSourceOptions: [],
  107. statusList: [
  108. {
  109. id: 0,
  110. name: '起草中',
  111. },
  112. {
  113. id: 1,
  114. name: '审批中',
  115. },
  116. {
  117. id: 5,
  118. name: '已结束',
  119. },
  120. ],
  121. columns: [
  122. {
  123. title: '序号',
  124. customRender: (text, record, index) => `${index + 1}`,
  125. width: '65px',
  126. },
  127. {
  128. title: '案例名称',
  129. dataIndex: 'TITLE',
  130. scopedSlots: { customRender: 'islink' },
  131. },
  132. {
  133. title: '案件类别',
  134. dataIndex: 'CASE_TYPE',
  135. width: '140px',
  136. },
  137. {
  138. title: '发生年份',
  139. dataIndex: 'CASE_YEAR',
  140. width: '140px',
  141. },
  142. {
  143. title: '案例来源',
  144. dataIndex: 'CASE_SOURCE',
  145. width: '140px',
  146. },
  147. {
  148. title: '编制人员',
  149. dataIndex: 'CREATOR_NAME',
  150. width: '120px',
  151. sdCandidate: true,
  152. },
  153. {
  154. title: '编制日期',
  155. dataIndex: 'CREATION_TIME',
  156. sdRender: TableColumnTypes.date,
  157. sorter: true,
  158. defaultSortOrder: 'desc',
  159. width: '140px',
  160. },
  161. {
  162. title: '编制单位',
  163. dataIndex: 'CREATE_DEPT_NAME',
  164. width: '140px',
  165. },
  166. {
  167. title: '当前状态',
  168. dataIndex: 'FLOW_STATE',
  169. width: '140px',
  170. },
  171. { title: '当前处理人', dataIndex: 'CURRENT_USER', width: '140px' },
  172. ],
  173. actions: [
  174. {
  175. label: '新建',
  176. id: 'new',
  177. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  178. permission: null,
  179. callback: this.createReport,
  180. index: 4,
  181. },
  182. {
  183. label: '删除',
  184. id: 'delete',
  185. type: TableActionTypes.batch, // 批处理按钮,选中文档时才能点击
  186. permission: null,
  187. callback: (keys) => {
  188. this.deleteRows(keys)
  189. },
  190. index: 3,
  191. },
  192. ],
  193. expressions: [],
  194. }
  195. },
  196. created() {
  197. CommonService.getDictValues('CASE_SOURCE').then((res) => {
  198. this.caseSourceOptions = res
  199. })
  200. },
  201. methods: {
  202. // 默认且必须的条件
  203. processReq(req) {
  204. req.data.formId = 'riskCase'
  205. return req
  206. },
  207. // 点击选择框事件 弹出日期组件选择年
  208. openChangeYear(status) {
  209. if (status) {
  210. this.dataopen = true
  211. } else {
  212. this.dataopen = false
  213. }
  214. },
  215. // 选择年之后 关闭弹框
  216. panelChangeYear(value) {
  217. this.dataopen = false
  218. this.formData.caseYear = moment(value).format('YYYY')
  219. },
  220. createReport() {
  221. const url = '/sd-flow-guide?code=PRODUCT_RISK_CASE' // 新页面要打开的路由地址
  222. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  223. if (refreshFlag) {
  224. // 这里写或者调刷新的方法
  225. this.refreshDataTable()
  226. }
  227. })
  228. },
  229. refreshDataTable() {
  230. if (this.$refs.dataTable) {
  231. this.$refs.dataTable.clearSelection()
  232. this.$refs.dataTable.refresh()
  233. }
  234. },
  235. rowClick(record) {
  236. let url
  237. if (
  238. (record.FLOW_STATE === '起草') | (record.FLOW_STATE === '开始') &&
  239. record.CREATOR_ACCOUNT === getUserInfo().account
  240. ) {
  241. url = `/sd-webflow/pages/draft/` + record.INST_ID
  242. } else {
  243. // 查出来的自己不一定能操作,跳转到一个不可编辑页面
  244. url = `/sd-webflow/done-pages/` + record.INST_ID
  245. }
  246. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  247. if (refreshFlag) {
  248. this.refreshDataTable()
  249. }
  250. })
  251. },
  252. handleSearch() {
  253. this.expressions = []
  254. // 案例名称
  255. if (this.formData.title) {
  256. this.expressions.push({
  257. dataType: 'str',
  258. name: 'TITLE',
  259. op: 'like',
  260. stringValue: '%' + this.formData.title + '%',
  261. })
  262. }
  263. // 发生年份
  264. if (this.formData.caseYear) {
  265. this.expressions.push({
  266. dataType: 'str',
  267. name: 'CASE_YEAR',
  268. op: 'eq',
  269. stringValue: this.formData.caseYear,
  270. })
  271. }
  272. // 报告类型
  273. if (this.formData.caseSource) {
  274. this.expressions.push({
  275. dataType: 'str',
  276. name: 'CASE_SOURCE',
  277. op: 'eq',
  278. stringValue: this.formData.caseSource,
  279. })
  280. }
  281. // 流程状态
  282. if (this.formData.status.length > 0) {
  283. this.expressions.push({
  284. dataType: 'long',
  285. name: 'END_TYPE',
  286. op: 'eq',
  287. longValue: this.formData.status[0].id,
  288. })
  289. }
  290. this.expressions = [...this.expressions]
  291. },
  292. // 重置
  293. resetForm() {
  294. this.formData = {
  295. title: '',
  296. caseYear: '',
  297. caseSource: '',
  298. status: [],
  299. }
  300. },
  301. // 删除数据
  302. deleteRows(selectedRowKeys) {
  303. const selectRows = this.$refs.dataTable.getSelectedRows()
  304. if (selectedRowKeys.length === 0) {
  305. Modal.info({
  306. content: '请选择需要删除的文件',
  307. })
  308. return
  309. }
  310. let flag = false
  311. selectRows.forEach((item) => {
  312. if (item.END_TYPE !== 0) {
  313. flag = true
  314. }
  315. })
  316. if (flag) {
  317. Modal.error({
  318. title: '删除失败:存在不是草稿状态的数据',
  319. })
  320. } else {
  321. Modal.confirm({
  322. title: '你确定删除这项内容吗?',
  323. content: '删除这条数据后,就无法恢复初始的状态。',
  324. okText: '删除',
  325. okType: 'danger',
  326. onOk: () => {
  327. this.loading = true
  328. const params = {
  329. flowCallbackBeanName: 'formBeanCleanerCallBack',
  330. processInstanceIds: selectedRowKeys.join(','),
  331. }
  332. FlowcenterService.fnDarftsDelete(params).then((res) => {
  333. if (res.status === 200) {
  334. message.success({ content: '删除成功!' }, 1).then(() => {
  335. this.$refs.dataTable.clearSelection()
  336. this.$refs.dataTable.refresh()
  337. this.loading = false
  338. })
  339. }
  340. })
  341. },
  342. })
  343. }
  344. },
  345. },
  346. }
  347. </script>
  348. <style module lang="scss">
  349. @use '@/common/design' as *;
  350. </style>