ActivitiDaibanList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div>
  3. <a-card>
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-model-item prop="key" label="流程实例编号">
  9. <a-input v-model="queryParam.key" allowClear placeholder="请输入流程实例编号"></a-input>
  10. </a-form-model-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  14. <a-button @click="searchQuery" type="primary" icon="search" style="margin-right: 8px">查询</a-button>
  15. </span>
  16. </a-col>
  17. </a-row>
  18. </a-form>
  19. </div>
  20. <a-table
  21. :columns="columns"
  22. :dataSource="dataSource"
  23. rowKey="id"
  24. :loading="loading"
  25. class="j-table-force-nowrap"
  26. :pagination="ipagination"
  27. @change="handleTableChange"
  28. >
  29. <span slot="action" slot-scope="text, record">
  30. <a @click="handleDetail1(record)">查看流程进度</a>
  31. <a-divider type="vertical"/>
  32. <a @click="handleBanli(record)">办理</a>
  33. </span>
  34. <a-divider type="vertical" />
  35. </a-table>
  36. <activiti-file-model ref="ativitiFileModel" ></activiti-file-model>
  37. <pic-form1 ref="picForm" @ok="modalFormOk" ></pic-form1>
  38. </a-card>
  39. <a-modal
  40. title="表单详情"
  41. :visible="visible"
  42. :confirm-loading="confirmLoading"
  43. @cancel="modalCancel"
  44. >
  45. <template>
  46. <a-modal
  47. title="节点详情"
  48. :visible="visiblexx"
  49. :confirm-loading="confirmLoading"
  50. @cancel="modalxxCancel"
  51. >
  52. <template>
  53. <a-col :span="24">
  54. <a-select :value="jiedianValue" style="width: 100%" @change="handleChange">
  55. <a-select-option v-for="(value,key) in getRunNodes" :key="key">
  56. {{ value }}
  57. </a-select-option>
  58. </a-select>
  59. </a-col>
  60. </template>
  61. <template slot="footer">
  62. <a-button @click="handleZhiShuCancel">确定</a-button>
  63. </template>
  64. </a-modal>
  65. </template>
  66. <template slot="footer">
  67. <a-button @click="handleCancel">驳回</a-button>
  68. <a-button @click="handleZhiCancel">驳回指定</a-button>
  69. <a-button type="primary" @click="handleOk">通过</a-button>
  70. </template>
  71. <template v-for="l in circleData">
  72. <div style="pointer-events: none">
  73. <fm-generate-form
  74. :data="l.formData"
  75. :value="l.fillData"
  76. >
  77. </fm-generate-form>
  78. </div>
  79. </template>
  80. <template>
  81. <div style="margin-top: 80px">
  82. <fm-generate-form
  83. @on-change="mychangeValue"
  84. :data="myjsonData"
  85. :value="myeditData"
  86. >
  87. </fm-generate-form>
  88. </div>
  89. <el-input style="margin-bottom: 30px"
  90. type="textarea"
  91. :rows="2"
  92. placeholder="请输入评论"
  93. v-model="mycomment">
  94. </el-input>
  95. </template>
  96. </a-modal>
  97. </div>
  98. </template>
  99. <script>
  100. import {getAction, deleteAction, banli, postAction} from '@/api/manage'
  101. import { mixinDevice } from '@/utils/mixin'
  102. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  103. import ActivitiFileModel from './ActivitiFileModel'
  104. import { getModelList } from '@/api/activiti/activiti'
  105. import {filterObj} from "@/utils/util";
  106. import PicForm1 from "@views/activiti/PicForm1";
  107. export default {
  108. name: 'ActivitiDaibanList',
  109. mixins: [JeecgListMixin, mixinDevice],
  110. components: {
  111. PicForm1,
  112. ActivitiFileModel
  113. },
  114. data() {
  115. return {
  116. jiedianValue: undefined,
  117. visiblexx: false,
  118. getRunNodes: {},
  119. columns: [
  120. {
  121. title: '序号',
  122. dataIndex: '',
  123. key: 'rowIndex',
  124. width: 60,
  125. align: 'center',
  126. customRender: function(t, r, index) {
  127. return parseInt(index) + 1
  128. }
  129. }, {
  130. dataIndex: 'taskName',
  131. title: '任务名称',
  132. align: 'center'
  133. }, {
  134. dataIndex: 'processInstanceId',
  135. title: '流程实例编号',
  136. align: 'center'
  137. }, {
  138. dataIndex: 'executionId',
  139. title: '执行实例编号',
  140. align: 'center'
  141. }, {
  142. dataIndex: 'businessKey',
  143. title: '业务号',
  144. align: 'center'
  145. }, {
  146. title: '流程名称',
  147. dataIndex: 'processName',
  148. align: 'center',
  149. scopedSlots: { customRender: 'suspensionState' }
  150. },
  151. {
  152. title: '发起人',
  153. dataIndex: 'starter',
  154. align: 'center'
  155. },
  156. {
  157. title: '办理人',
  158. dataIndex: 'assignee',
  159. align: 'center'
  160. },
  161. {
  162. title: '任务创建时间',
  163. dataIndex: 'createTime',
  164. align: 'center'
  165. },
  166. {
  167. title: '流程启动时间',
  168. dataIndex: 'startTime',
  169. align: 'center'
  170. },
  171. {
  172. title: '操作',
  173. dataIndex: 'action',
  174. width: '150px',
  175. align: 'center',
  176. scopedSlots: { customRender: 'action' }
  177. }],
  178. url: {
  179. list: '/service/act/mylist',
  180. delete: '/act/reprocdef/deleteByDeploymentId',
  181. convertToModel: '/act/reprocdef/convertToModel',
  182. updateHandle: '/act/reprocdef/update',
  183. banli: '/service/completeTask',
  184. banlijson: '/service/getTaskInfo',
  185. countineBl: '/approval/handle',
  186. bohui: '/approval/handle'
  187. },
  188. queryParam: {
  189. category: '',
  190. key: '',
  191. name: ''
  192. },
  193. visible: false,
  194. confirmLoading: false,
  195. jsonData: {},
  196. editData: {},
  197. myjsonData: {},
  198. myeditData: {},
  199. mycomment: '',
  200. currentRecord: {},
  201. circleData: []
  202. }
  203. },
  204. created() {
  205. // this.getDataList()
  206. },
  207. methods: {
  208. handleChange(value) {
  209. console.log(value);
  210. this.jiedianValue = value;
  211. },
  212. handleZhiCancel() {
  213. this.visiblexx = true
  214. var record = this.currentRecord
  215. var select = { processInstanceId: record.processInstanceId }
  216. getAction('/approval/getRunNodes', select).then(res => {
  217. console.log('xxxxxxxxxxxx')
  218. console.log(this.jsonToMap(res.result))
  219. this.getRunNodes = res.result
  220. console.log(this.getRunNodes)
  221. })
  222. },
  223. handleZhiShuCancel(){
  224. let p = {}
  225. var record = this.currentRecord
  226. p.taskId = record.taskId
  227. p.comment = this.mycomment
  228. p.flag = 6
  229. p.runNodeId = this.jiedianValue
  230. banli(this.url.bohui, p).then(res => {
  231. //console.log('转为模型', res);
  232. this.visiblexx=false
  233. this.visible=false
  234. this.searchQuery()
  235. })
  236. },
  237. objToStrMap(obj) {
  238. let strMap = new Map()
  239. for (let k of Object.keys(obj)) {
  240. strMap.set(k, obj[k])
  241. }
  242. return strMap
  243. },
  244. /**
  245. *json转换为map
  246. */
  247. jsonToMap(jsonStr) {
  248. return this.objToStrMap(jsonStr)
  249. },
  250. handleDetail1: function(record) {
  251. this.$refs.picForm.edit(record)
  252. this.$refs.picForm.title = '流程'
  253. this.$refs.picForm.disableSubmit = true
  254. },
  255. handleBanli: function(record) {
  256. // banli(this.url.banli+"/"+record.taskId).then(res => {
  257. // console.log('转为模型', res)
  258. // if (res.code == 0) {
  259. // this.$message.success(res.msg);
  260. // } else {
  261. // this.$message.warning(res.msg);
  262. // }
  263. // })
  264. this.currentRecord = record
  265. banli(this.url.banlijson + '/' + record.processInstanceId + '/' + record.taskId).then(res => {
  266. //console.log('转为模型', res)
  267. if (res.code == 200) {
  268. //this.$message.success(res.msg);
  269. console.log('------转为模型', res.result)
  270. // todo 这个位置不知道为啥 有问题
  271. // this.circleData = res.result.fromData1;
  272. // for (let i = 0; i < this.circleData.length; i++) {
  273. // this.circleData[i].fillData = JSON.parse(this.circleData[i].value.split('###')[1]);
  274. // this.circleData[i].formData = JSON.parse(this.circleData[i].value.split('###')[0]);
  275. // }
  276. //console.log('----------------转为模型', this.circleData[0].formData)
  277. this.myjsonData = JSON.parse(res.result.fromData2)
  278. this.visible = true
  279. } else {
  280. //this.$message.warning(res.msg);
  281. }
  282. })
  283. },
  284. mychangeValue(field, value, data) {
  285. this.myeditData = data
  286. },
  287. handleOk(e) {
  288. this.visible = false
  289. let p = {}
  290. p.taskId = this.currentRecord.taskId
  291. p.comment = this.mycomment
  292. p.formData = this.myjsonData
  293. p.formDataValue = this.myeditData
  294. p.excutionId = this.currentRecord.executionId
  295. p.flag = 1
  296. banli(this.url.countineBl, p).then(res => {
  297. //console.log('转为模型', res);
  298. this.searchQuery()
  299. if (res.code == 0) {
  300. this.$message.success(res.msg)
  301. //console.log('------转为模型', res.result.fromData2)
  302. } else {
  303. //this.$message.warning(res.msg);
  304. }
  305. })
  306. },
  307. modalCancel() {
  308. this.visible = false
  309. },
  310. modalxxCancel() {
  311. this.visiblexx = false
  312. },
  313. handleCancel(e) {
  314. this.visible = false
  315. let p = {}
  316. p.taskId = this.currentRecord.taskId
  317. p.comment = this.mycomment
  318. p.flag = 2
  319. banli(this.url.bohui, p).then(res => {
  320. //console.log('转为模型', res);
  321. this.searchQuery()
  322. if (res.code == 0) {
  323. this.$message.success(res.msg)
  324. //console.log('------转为模型', res.result.fromData2)
  325. } else {
  326. //this.$message.warning(res.msg);
  327. }
  328. })
  329. },
  330. // 删除
  331. actDelete(deploymentId) {
  332. deleteAction(this.url.delete, { deploymentId: deploymentId }).then(res => {
  333. if (res.success) {
  334. this.$message.success(res.message)
  335. this.searchQuery()
  336. } else {
  337. this.$message.warning(res.message)
  338. }
  339. })
  340. },
  341. // 转为模型
  342. convertToModel(id) {
  343. getAction(this.url.convertToModel, { id: id }).then(res => {
  344. console.log('转为模型', res)
  345. if (res.success) {
  346. this.$message.success('操作成功,流程编号:' + res.result.deploymentId)
  347. this.searchQuery()
  348. } else {
  349. this.$message.warning('操作失败,流程编号:' + res.result.deploymentId)
  350. }
  351. })
  352. },
  353. // 挂起和激活
  354. updateHandle(id, state) {
  355. getAction(this.url.updateHandle, { id: id, state: state }).then(res => {
  356. console.log('挂起和激活', res)
  357. if (res.success) {
  358. this.$message.success(res.message)
  359. this.searchQuery()
  360. } else {
  361. this.$message.warning(res.message)
  362. }
  363. })
  364. },
  365. searchQuery() {
  366. this.selectedRowKeys = []
  367. this.selectionRows = []
  368. this.loadData(1)
  369. },
  370. loadData(arg) {
  371. if (!this.url.list) {
  372. this.$message.error('请设置url.list属性!')
  373. return
  374. }
  375. //加载数据 若传入参数1则加载第一页的内容
  376. if (arg === 1) {
  377. this.ipagination.current = 1
  378. }
  379. var params = this.getQueryParams()//查询条件
  380. this.loading = true
  381. getAction(this.url.list, params).then((res) => {
  382. if (res.success) {
  383. //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  384. this.dataSource = res.result.records || res.result
  385. this.totalOrderPrice = res.message
  386. if (res.total) {
  387. this.ipagination.total = res.total
  388. } else {
  389. this.ipagination.total = 0
  390. }
  391. //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  392. } else {
  393. this.$message.warning(res.message)
  394. }
  395. }).finally(() => {
  396. this.loading = false
  397. })
  398. },
  399. // 查询
  400. getDataList() {
  401. this.loading = true
  402. let params = this.queryParam
  403. getModelList(this.url.list, params).then(res => {
  404. console.log('查询数据', res)
  405. this.dataSource = res.result.records
  406. this.total = res.result.total
  407. this.ipagination.total = res.result.total
  408. this.loading = false
  409. })
  410. },
  411. openModeler() {
  412. this.$refs.ativitiFileModel.openModel()
  413. },
  414. deployProcess(id) {
  415. getAction(this.url.deploy, { id: id }).then(res => {
  416. if (res.success) {
  417. this.$message.success(res.message)
  418. this.searchQuery()
  419. } else {
  420. this.$message.error(res.message)
  421. }
  422. })
  423. }
  424. }
  425. }
  426. </script>
  427. <style lang="less" scoped>
  428. .table-operator .ant-btn {
  429. margin: 3px 8px 4px 0;
  430. }
  431. </style>