processInsManage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <style lang="less">
  2. @import '~@assets/less/common.less';
  3. </style>
  4. <template>
  5. <div class="search">
  6. <a-card>
  7. <div class="table-page-search-wrapper">
  8. <a-form layout="inline" @keyup.enter.native="handleSearch">
  9. <a-row :gutter="24">
  10. <a-col :md="6" :sm="8">
  11. <a-form-item label="流程名称" prop="name">
  12. <a-input
  13. type="text"
  14. v-model="searchForm.name"
  15. placeholder="请输入"
  16. clearable
  17. />
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="标识Key" prop="name">
  22. <a-input
  23. type="text"
  24. v-model="searchForm.key"
  25. placeholder="请输入"
  26. clearable
  27. />
  28. </a-form-item>
  29. </a-col>
  30. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  31. <a-col :md="6" :sm="12" >
  32. <a-button @click="handleSearch" type="primary" icon="search">搜索</a-button>
  33. <a-button @click="handleReset" style="margin-left: 10px;">重置</a-button>
  34. </a-col>
  35. </span>
  36. </a-row>
  37. </a-form>
  38. </div>
  39. <a-row>
  40. <a-table :scroll="scroll" bordered
  41. :loading="loading"
  42. rowKey="id"
  43. :dataSource="data"
  44. :pagination="ipagination"
  45. @change="handleTableChange"
  46. ref="table"
  47. >
  48. <a-table-column title="#" :width="50">
  49. <template slot-scope="t,r,i" >
  50. <span> {{i+1}} </span>
  51. </template>
  52. </a-table-column>
  53. <a-table-column title="流程实例ID" dataIndex="id" :width="150">
  54. <template slot-scope="t,r,i" >
  55. <span> {{t}} </span>
  56. </template>
  57. </a-table-column>
  58. <a-table-column title="流程名称" dataIndex="name" :width="150">
  59. <template slot-scope="t,r,i" >
  60. <span> {{t}} </span>
  61. </template>
  62. </a-table-column>
  63. <a-table-column title="申请人" dataIndex="applyer" :width="100">
  64. <template slot-scope="t,r,i" >
  65. <span> {{t}} </span>
  66. </template>
  67. </a-table-column>
  68. <a-table-column title="标识Key" dataIndex="key" :width="150">
  69. <template slot-scope="t,r,i" >
  70. <span> {{t}} </span>
  71. </template>
  72. </a-table-column>
  73. <a-table-column title="版本" dataIndex="version" :width="150">
  74. <template slot-scope="t,r,i" >
  75. <span> v.{{t}} </span>
  76. </template>
  77. </a-table-column>
  78. <a-table-column title="当前环节" dataIndex="currTaskName" :width="150">
  79. <template slot-scope="t,r,i" >
  80. <span> {{t}} </span>
  81. </template>
  82. </a-table-column>
  83. <a-table-column title="状态" dataIndex="isSuspended" :width="110"
  84. key="isSuspended" :sorter="(a,b)=>Boolean(a.isSuspended)?0:1 - Boolean(b.isSuspended)?0:1"
  85. >
  86. <template slot-scope="t,r,i" >
  87. <span v-if="t" style="color: red"> 已挂起 </span>
  88. <span v-else style="color: #2f54eb"> 已激活 </span>
  89. </template>
  90. </a-table-column>
  91. <a-table-column title="操作" dataIndex="action" >
  92. <template slot-scope="t,r,i" >
  93. <template v-if="r.isSuspended">
  94. <a href="javascript:void(0);" style="color: green;" @click="editStatus(1,r)" >激活</a>
  95. <a-divider type="vertical" />
  96. </template>
  97. <template v-else>
  98. <a href="javascript:void(0);" style="color: orange;" @click="editStatus(0,r)" >挂起</a>
  99. <a-divider type="vertical" />
  100. </template>
  101. <a href="javascript:void(0);" style="color: blue;" @click="history(r)" >审批详情</a>
  102. <a-divider type="vertical" />
  103. <a href="javascript:void(0);" style="color: #999;" @click="detail(r)" >表单数据</a>
  104. <a-divider type="vertical" />
  105. <a-popconfirm title="确定删除吗?" @confirm="() => remove(r)">
  106. <a style="color: red;">删除</a>
  107. </a-popconfirm>
  108. </template>
  109. </a-table-column>
  110. </a-table>
  111. </a-row>
  112. </a-card>
  113. <a-modal
  114. :title="modalTitle"
  115. v-model="modalVisible"
  116. :mask-closable="false"
  117. :width="500"
  118. :styles="{top: '30px'}"
  119. >
  120. <a-form ref="form" :model="form" :label-width="70" :rules="formValidate">
  121. <a-form-item label="删除原因" prop="reason">
  122. <a-input type="textarea" v-model="form.reason" :rows="4" />
  123. </a-form-item>
  124. </a-form>
  125. <div slot="footer">
  126. <a-button type="text" @click="handelCancel">取消</a-button>
  127. <a-button type="primary" :loading="submitLoading" @click="handelSubmit">提交</a-button>
  128. </div>
  129. </a-modal>
  130. <!---->
  131. <a-modal title="审批历史" v-model="modalLsVisible" :mask-closable="false" :width="'80%'" :footer="null">
  132. <div v-if="modalLsVisible">
  133. <component :is="historicDetail" :procInstId="procInstId"></component>
  134. </div>
  135. </a-modal>
  136. <!--流程表单-->
  137. <a-modal :title="lcModa.title" v-model="lcModa.visible" :footer="null" :maskClosable="false" width="80%">
  138. <component :disabled="lcModa.disabled" v-if="lcModa.visible" :is="lcModa.formComponent"
  139. :processData="lcModa.processData" :isNew = "lcModa.isNew"
  140. @close="lcModa.visible=false,lcModa.disabled = false"></component>
  141. </a-modal>
  142. </div>
  143. </template>
  144. <script>
  145. import {activitiMixin} from "./mixins/activitiMixin";
  146. import {JeecgListMixin} from "../../mixins/JeecgListMixin";
  147. export default {
  148. mixins:[activitiMixin,JeecgListMixin],
  149. name: "process-ins-manage",
  150. data() {
  151. return {
  152. openSearch: true,
  153. openTip: true,
  154. loading: true, // 表单加载状态
  155. selectCount: 0, // 多选计数
  156. selectList: [], // 多选数据
  157. searchForm: {
  158. // 搜索框对应data对象
  159. name: "",
  160. key: "",
  161. pageNumber: 1, // 当前页数
  162. pageSize: 10 // 页面大小
  163. },
  164. modalType: 0, // 添加或编辑标识
  165. modalVisible: false, // 添加或编辑显示
  166. modalTitle: "", // 添加或编辑标题
  167. form: {
  168. // 添加或编辑表单对象初始化数据
  169. reason: ""
  170. },
  171. formValidate: {
  172. // 表单验证规则
  173. },
  174. submitLoading: false, // 添加或编辑提交状态
  175. data: [], // 表单数据
  176. total: 0, // 表单数据总数
  177. deleteId: "",
  178. url: {
  179. getRunningProcess:'/actProcessIns/getRunningProcess',
  180. deleteProcessIns:'/actProcessIns/delInsByIds/',
  181. updateInsStatus:'/actProcessIns/updateInsStatus/',
  182. },
  183. modalLsVisible: false,
  184. procInstId: '',
  185. lcModa: {
  186. title:'',
  187. disabled:false,
  188. visible:false,
  189. formComponent : null,
  190. isNew : false
  191. },
  192. };
  193. },
  194. methods: {
  195. loadData(){},
  196. init() {
  197. this.getDataList();
  198. },
  199. getDataList() {
  200. this.loading = true;
  201. this.getAction(this.url.getRunningProcess,this.searchForm).then(res => {
  202. this.loading = false;
  203. if (res.success) {
  204. this.data = res.result;
  205. }else {
  206. this.$message.error(res.message)
  207. }
  208. });
  209. },
  210. handleSearch() {
  211. this.searchForm.pageNumber = 1;
  212. this.searchForm.pageSize = 10;
  213. this.getDataList();
  214. },
  215. handleReset() {
  216. this.searchForm= {};
  217. this.searchForm.pageNumber = 1;
  218. this.searchForm.pageSize = 10;
  219. // 重新加载数据
  220. this.getDataList();
  221. },
  222. handelCancel() {
  223. this.modalVisible = false;
  224. },
  225. handelSubmit() {
  226. this.submitLoading = true;
  227. this.postFormAction(this.url.deleteProcessIns+this.deleteId, this.form).then(res => {
  228. this.submitLoading = false;
  229. if (res.success) {
  230. this.$message.success("操作成功");
  231. this.modalVisible = false;
  232. this.getDataList();
  233. }else {
  234. this.$message.error(res.message);
  235. }
  236. });
  237. },
  238. editStatus(status, v) {
  239. let operation = "";
  240. if (status == 0) {
  241. operation = "暂停挂起";
  242. } else {
  243. operation = "激活运行";
  244. }
  245. this.$confirm({
  246. title: "确认" + operation,
  247. content: `您确认要${operation}流程实例${v.name}?`,
  248. loading: true,
  249. onOk: () => {
  250. let params = {
  251. status: status,
  252. id: v.id
  253. };
  254. this.postFormAction(this.url.updateInsStatus,params).then(res => {
  255. if (res.success) {
  256. this.$message.success("操作成功");
  257. this.getDataList();
  258. }else {
  259. this.$message.error(res.message);
  260. }
  261. });
  262. }
  263. });
  264. },
  265. detail(r) {
  266. if (!r.routeName) {
  267. this.$message.warning(
  268. "该流程信息未配置表单,请联系开发人员!"
  269. );
  270. return;
  271. }
  272. if(r.routeName.indexOf("外部表单")!=-1){//外部项目的表单
  273. alert("调用其他项目页面")
  274. }else if(r.routeName.indexOf("自定义")!=-1){//自定义的表单流程
  275. this.lcModa.disabled = true;
  276. this.lcModa.title = '查看流程业务信息:'+r.processName;
  277. let com={component:() => import(`@/views/activiti/form/demoForm2`)}
  278. this.lcModa.formComponent = com.component;
  279. this.lcModa.isNew = false;
  280. this.lcModa.processData = r;
  281. this.lcModa.visible = true;
  282. }else{//固定的表单
  283. this.lcModa.disabled = true;
  284. this.lcModa.title = '查看流程业务信息:'+r.name;
  285. this.lcModa.formComponent = this.getFormComponent(r.routeName).component;
  286. this.lcModa.processData = r;
  287. this.lcModa.isNew = false;
  288. this.lcModa.visible = true;
  289. }
  290. },
  291. history(v) {
  292. if (!v.procInstId) {
  293. this.$message.error("流程实例ID不存在");
  294. return;
  295. }
  296. this.procInstId = v.procInstId;
  297. this.modalLsVisible = true;
  298. },
  299. remove(v) {
  300. this.modalTitle = `确认删除流程 ${v.name}`;
  301. // 单个删除
  302. this.deleteId = v.id;
  303. this.modalType = 0;
  304. this.modalVisible = true;
  305. },
  306. handleTableChange(pagination, filters, sorter) {
  307. //分页、排序、筛选变化时触发
  308. //TODO 筛选
  309. if (Object.keys(sorter).length > 0) {
  310. this.isorter.column = sorter.field;
  311. this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
  312. }
  313. this.ipagination = pagination;
  314. // this.loadData();
  315. }
  316. },
  317. mounted() {
  318. this.init();
  319. },
  320. watch: {
  321. }
  322. };
  323. </script>