processInsManage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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="100%">
  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. <!-- 项目管理整合 打开合同页面 -->
  143. <outerForm-check ref="outerFormCheck" @refreshData="handleSearch" ></outerForm-check>
  144. </div>
  145. </template>
  146. <script>
  147. import {activitiMixin} from "./mixins/activitiMixin";
  148. import {JeecgListMixin} from "../../mixins/JeecgListMixin";
  149. import outerFormCheck from '../../share/modal/OuterFormCheck'
  150. import { getAction } from '@/api/manage'
  151. import {getEditorJumpUrl,getProjctManageUrl}from '../../../url.config'
  152. export default {
  153. mixins:[activitiMixin,JeecgListMixin],
  154. name: "process-ins-manage",
  155. components:{
  156. outerFormCheck
  157. },
  158. data() {
  159. return {
  160. openSearch: true,
  161. openTip: true,
  162. loading: true, // 表单加载状态
  163. selectCount: 0, // 多选计数
  164. selectList: [], // 多选数据
  165. searchForm: {
  166. // 搜索框对应data对象
  167. name: "",
  168. key: "",
  169. pageNumber: 1, // 当前页数
  170. pageSize: 10 // 页面大小
  171. },
  172. modalType: 0, // 添加或编辑标识
  173. modalVisible: false, // 添加或编辑显示
  174. modalTitle: "", // 添加或编辑标题
  175. form: {
  176. // 添加或编辑表单对象初始化数据
  177. reason: ""
  178. },
  179. formValidate: {
  180. // 表单验证规则
  181. },
  182. submitLoading: false, // 添加或编辑提交状态
  183. data: [], // 表单数据
  184. total: 0, // 表单数据总数
  185. deleteId: "",
  186. url: {
  187. getRunningProcess:'/actProcessIns/getRunningProcess',
  188. deleteProcessIns:'/actProcessIns/delInsByIds/',
  189. updateInsStatus:'/actProcessIns/updateInsStatus/',
  190. outformViewUrl:"/actBusiness/external/getViewUrl",
  191. },
  192. modalLsVisible: false,
  193. procInstId: '',
  194. lcModa: {
  195. title:'',
  196. disabled:false,
  197. visible:false,
  198. formComponent : null,
  199. isNew : false
  200. },
  201. };
  202. },
  203. methods: {
  204. loadData(){},
  205. init() {
  206. this.getDataList();
  207. },
  208. getDataList() {
  209. this.loading = true;
  210. this.getAction(this.url.getRunningProcess,this.searchForm).then(res => {
  211. this.loading = false;
  212. if (res.success) {
  213. this.data = res.result;
  214. }else {
  215. this.$message.error(res.message)
  216. }
  217. });
  218. },
  219. handleSearch() {
  220. this.searchForm.pageNumber = 1;
  221. this.searchForm.pageSize = 10;
  222. this.getDataList();
  223. },
  224. handleReset() {
  225. this.searchForm= {};
  226. this.searchForm.pageNumber = 1;
  227. this.searchForm.pageSize = 10;
  228. // 重新加载数据
  229. this.getDataList();
  230. },
  231. handelCancel() {
  232. this.modalVisible = false;
  233. },
  234. handelSubmit() {
  235. this.submitLoading = true;
  236. this.postFormAction(this.url.deleteProcessIns+this.deleteId, this.form).then(res => {
  237. this.submitLoading = false;
  238. if (res.success) {
  239. this.$message.success("操作成功");
  240. this.modalVisible = false;
  241. this.getDataList();
  242. }else {
  243. this.$message.error(res.message);
  244. }
  245. });
  246. },
  247. editStatus(status, v) {
  248. let operation = "";
  249. if (status == 0) {
  250. operation = "暂停挂起";
  251. } else {
  252. operation = "激活运行";
  253. }
  254. this.$confirm({
  255. title: "确认" + operation,
  256. content: `您确认要${operation}流程实例${v.name}?`,
  257. loading: true,
  258. onOk: () => {
  259. let params = {
  260. status: status,
  261. id: v.id
  262. };
  263. this.postFormAction(this.url.updateInsStatus,params).then(res => {
  264. if (res.success) {
  265. this.$message.success("操作成功");
  266. this.getDataList();
  267. }else {
  268. this.$message.error(res.message);
  269. }
  270. });
  271. }
  272. });
  273. },
  274. detail(r) {
  275. if (!r.routeName) {
  276. this.$message.warning(
  277. "该流程信息未配置表单,请联系开发人员!"
  278. );
  279. return;
  280. }
  281. if(r.routeName.indexOf("外部表单")!=-1||r.tableName.indexOf('外部表单') != -1){//外部项目的表单
  282. //其他项目的表单流程
  283. //var id = r.tableId //项目管理合同数据id
  284. //打开MyIframe弹框
  285. //this.$refs.MyIframe.editorVisible = true
  286. //并传入地址参数
  287. //this.$refs.MyIframe.editorJumpUrlMy = getProjctManageUrl()+'/contract-process-view?id=' + id
  288. this.showOuterFormViewDlg(r.tableId, '查看业务流程:' + r.processName, r);
  289. }else if(r.routeName.indexOf("自定义")!=-1){//自定义的表单流程
  290. this.lcModa.disabled = true;
  291. this.lcModa.title = '查看流程业务信息:'+r.name;
  292. let com={component:() => import(`@/views/activiti/form/demoForm2`)}
  293. this.lcModa.formComponent = com.component;
  294. this.lcModa.isNew = false;
  295. this.lcModa.processData = r;
  296. this.lcModa.visible = true;
  297. }else{//固定的表单
  298. this.lcModa.disabled = true;
  299. this.lcModa.title = '查看流程业务信息:'+r.name;
  300. this.lcModa.formComponent = this.getFormComponent(r.routeName).component;
  301. this.lcModa.processData = r;
  302. this.lcModa.isNew = false;
  303. this.lcModa.visible = true;
  304. }
  305. },
  306. history(v) {
  307. if (!v.procInstId) {
  308. this.$message.error("流程实例ID不存在");
  309. return;
  310. }
  311. this.procInstId = v.procInstId;
  312. this.modalLsVisible = true;
  313. },
  314. remove(v) {
  315. this.modalTitle = `确认删除流程 ${v.name}`;
  316. // 单个删除
  317. this.deleteId = v.id;
  318. this.modalType = 0;
  319. this.modalVisible = true;
  320. },
  321. handleTableChange(pagination, filters, sorter) {
  322. //分页、排序、筛选变化时触发
  323. //TODO 筛选
  324. if (Object.keys(sorter).length > 0) {
  325. this.isorter.column = sorter.field;
  326. this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
  327. }
  328. this.ipagination = pagination;
  329. // this.loadData();
  330. },
  331. showOuterFormViewDlg(tableId, title, processData){
  332. getAction(this.url.outformViewUrl,{tableId:tableId}).then(res=>{
  333. if (res.success){
  334. var url = res.result.url;
  335. var param = res.result.param;
  336. url = url+"?"+this.jsonToUrlParam(param);
  337. this.$refs.outerFormCheck.openDialog(url, title, processData);
  338. }else{
  339. this.$message.error(res.message);
  340. }
  341. });
  342. },
  343. jsonToUrlParam(query){
  344. var tmpArr = [];
  345. for (var i in query){
  346. var key = encodeURIComponent(i);
  347. var value = encodeURIComponent(query[i]);
  348. tmpArr.push(key+"="+value);
  349. }
  350. return tmpArr.join("&");
  351. },
  352. },
  353. mounted() {
  354. this.init();
  355. },
  356. watch: {
  357. }
  358. };
  359. </script>