applyList.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :md="4" :sm="12">
  8. <a-form-item label="标题">
  9. <a-input placeholder="请输入搜索关键词" v-model="queryParam.title"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="4" :sm="12">
  13. <a-form-item label="状态">
  14. <a-select v-model="queryParam.status" placeholder="请选择" :allowClear="true">
  15. <a-select-option value="0">草稿</a-select-option>
  16. <a-select-option value="1">处理中</a-select-option>
  17. <a-select-option value="2">已结束</a-select-option>
  18. <a-select-option value="3">已撤回</a-select-option>
  19. </a-select>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="4" :sm="12">
  23. <a-form-item label="结果">
  24. <a-select v-model="queryParam.result" placeholder="请选择" :allowClear="true">
  25. <a-select-option value="0">未提交</a-select-option>
  26. <a-select-option value="1">处理中</a-select-option>
  27. <a-select-option value="2">通过</a-select-option>
  28. <a-select-option value="3">驳回</a-select-option>
  29. </a-select>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="12">
  33. <a-form-item label="创建时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
  34. <a-range-picker
  35. style="width: 100%"
  36. v-model="queryParam.createTimeRange"
  37. format="YYYY-MM-DD"
  38. :placeholder="['开始时间', '结束时间']"
  39. @change="onDateChange"
  40. @ok="onDateOk"
  41. />
  42. </a-form-item>
  43. </a-col>
  44. <!-- 查询按钮 -->
  45. <a-col :md="6" :sm="6">
  46. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  47. <a-button type="primary" @click="searchReset" icon="reload" style="marginLeft:10px;">重置</a-button>
  48. </a-col>
  49. </a-row>
  50. <a-row>
  51. <a-col :md="12" :sm="12" style="margin:10px 0;">
  52. <a-button type="primary" @click="addApply" :loading="addApplyLoading" icon="plus-circle">
  53. 发起申请
  54. </a-button>
  55. </a-col>
  56. </a-row>
  57. </a-form>
  58. </div>
  59. <!-- 表-->
  60. <a-row :gutter="24">
  61. <a-col :md="24" :sm="24">
  62. <a-table
  63. bordered
  64. ref="table"
  65. size="small"
  66. rowKey="id"
  67. :dataSource="dataSource"
  68. :pagination="ipagination"
  69. :loading="loading"
  70. @change="handleTableChange"
  71. >
  72. <!-- 序号 -->
  73. <a-table-column title="#" :width="50" align="center">
  74. <template slot-scope="t, r, i">
  75. <span> {{ i + 1 }} </span>
  76. </template>
  77. </a-table-column>
  78. <!-- <a-table-column title="标题" dataIndex="title" :width="150" align="center">
  79. <template slot-scope="t">
  80. <span> {{ t }} </span>
  81. </template>
  82. </a-table-column> -->
  83. <a-table-column title="所属流程" dataIndex="processName" :width="150" align="center">
  84. <template slot-scope="t">
  85. <span> {{ t }} </span>
  86. </template>
  87. </a-table-column>
  88. <a-table-column title="业务信息" dataIndex="description" :width="150" align="center">
  89. <template slot-scope="t">
  90. <span> {{ t }} </span>
  91. </template>
  92. </a-table-column>
  93. <a-table-column title="当前审批环节" dataIndex="currTaskName" :width="150" align="center">
  94. <template slot-scope="t">
  95. <span> {{ t }} </span>
  96. </template>
  97. </a-table-column>
  98. <!-- 状态 -->
  99. <a-table-column
  100. title="状态"
  101. dataIndex="status"
  102. :width="100"
  103. align="center"
  104. key="s"
  105. :sorter="(a, b) => a.status - b.status"
  106. >
  107. <template slot-scope="t, r">
  108. <template v-if="r.status == 0">
  109. <a-tag color="red">草稿</a-tag>
  110. </template>
  111. <template v-if="r.status == 1">
  112. <a-tag color="blue">处理中</a-tag>
  113. </template>
  114. <template v-if="r.status == 2">
  115. <a-tag color="purple">已结束</a-tag>
  116. </template>
  117. <template v-if="r.status == 3">
  118. <a-tag color="orange">已撤回</a-tag>
  119. </template>
  120. </template>
  121. </a-table-column>
  122. <!-- 结果 -->
  123. <a-table-column
  124. title="结果"
  125. dataIndex="result"
  126. :width="100"
  127. align="center"
  128. key="result"
  129. :sorter="(a, b) => a.result - b.result"
  130. >
  131. <template slot-scope="t, r">
  132. <!--未提交-->
  133. <template v-if="r.result == 0">
  134. <a-tag color="#f4a261">未提交</a-tag>
  135. </template>
  136. <!-- 处理中 -->
  137. <template v-if="r.result == 1">
  138. <a-tag color="#108ee9">处理中</a-tag>
  139. </template>
  140. <!-- 已通过 -->
  141. <template v-if="r.result == 2">
  142. <a-tag color="#87d068">已通过</a-tag>
  143. </template>
  144. <!-- 已驳回 -->
  145. <template v-if="r.result == 3">
  146. <a-tag color="gray">已驳回</a-tag>
  147. </template>
  148. </template>
  149. </a-table-column>
  150. <a-table-column title="创建时间" dataIndex="createTime" :width="150" align="center">
  151. <template slot-scope="t">
  152. <span> {{ t }} </span>
  153. </template>
  154. </a-table-column>
  155. <a-table-column title="提交申请时间" dataIndex="applyTime" :width="150" align="center">
  156. <template slot-scope="t">
  157. <span> {{ t }} </span>
  158. </template>
  159. </a-table-column>
  160. <!-- 操作按钮 -->
  161. <a-table-column title="操作" dataIndex="" align="center" :width="200">
  162. <template slot-scope="t, r">
  163. <template v-if="r.status == 0">
  164. <a href="javascript:void(0);" style="color: #00A0E9" @click="apply(r)">提交申请</a>
  165. <a-divider type="vertical" />
  166. <a href="javascript:void(0);" @click="edit(r)" style="color: #000000">编辑</a>
  167. <a-divider type="vertical" />
  168. <a-popconfirm title="确定删除吗?" @confirm="() => remove(r)">
  169. <a href="javascript:void(0);" style="color: red">删除</a>
  170. </a-popconfirm>
  171. </template>
  172. <template v-else-if="r.status == 1">
  173. <a href="javascript:void(0);" @click="detail(r)">详情</a>
  174. <a-divider type="vertical" />
  175. <a href="javascript:void(0);" @click="cancel(r)" style="color:orange;">撤回</a>
  176. <a-divider type="vertical" />
  177. <a href="javascript:void(0);" @click="history(r)" style="color:gray;">审批历史</a>
  178. </template>
  179. <template v-else-if="(r.status == 2 && r.result == 3) || r.status == 3">
  180. <a-popconfirm title="确定再次提交申请吗?" @confirm="() => apply(r)">
  181. <a href="javascript:void(0);" style="color:green;">再次申请</a>
  182. </a-popconfirm>
  183. <a-divider type="vertical" />
  184. <a href="javascript:void(0);" @click="edit(r)" style="color:#000000;">编辑</a>
  185. <a-divider type="vertical" />
  186. <a href="javascript:void(0);" @click="history(r)" style="color:gray;">审批历史</a>
  187. <a-divider type="vertical" />
  188. <a-popconfirm title="确定删除吗?" @confirm="() => remove(r)">
  189. <a href="javascript:void(0);" style="color: red">删除</a>
  190. </a-popconfirm>
  191. </template>
  192. <template v-else>
  193. <a href="javascript:void(0);" @click="detail(r)">详情</a>
  194. <a-divider type="vertical" />
  195. <a href="javascript:void(0);" @click="history(r)" style="color:gray;">审批历史</a>
  196. </template>
  197. </template>
  198. </a-table-column>
  199. </a-table>
  200. </a-col>
  201. </a-row>
  202. <!--发起申请按钮-->
  203. <a-drawer
  204. title="选择流程"
  205. width="33%"
  206. placement="right"
  207. :closable="false"
  208. @close="processModalVisible = false"
  209. :visible="processModalVisible"
  210. >
  211. <a-input-search style="margin-bottom: 10px;width: 200px" placeholder="输入流程名称" @search="onSearchProcess" />
  212. <a-empty description="无流程可供选择" v-if="activeKeyAll.length == 0" />
  213. <div v-else>
  214. <a-collapse v-model="activeKey">
  215. <a-collapse-panel
  216. v-for="value in activeKeyAll"
  217. :header="filterDictText(dictOptions, value) || '未分类'"
  218. :key="value"
  219. >
  220. <a-list :grid="{ gutter: 10, column: 1 }" :dataSource="processDataMap[value]">
  221. <a-list-item slot="renderItem" slot-scope="item">
  222. <a-card>
  223. <div slot="title">
  224. <a-row>
  225. <a-col span="12" :title="item.name">{{ item.name }} </a-col>
  226. <a-col span="12" style="text-align: right;">
  227. <a href="javascript:void (0)" @click="chooseProcess(item)">发起申请</a>
  228. </a-col>
  229. </a-row>
  230. </div>
  231. <b>版本:</b>v.{{ item.version }}
  232. <br />
  233. <b>说明:</b>{{ item.description }}
  234. </a-card>
  235. </a-list-item>
  236. </a-list>
  237. </a-collapse-panel>
  238. </a-collapse>
  239. </div>
  240. </a-drawer>
  241. <!--流程表单-->
  242. <a-modal :title="lcModa.title" v-model="lcModa.visible" :footer="null" :maskClosable="false" width="80%">
  243. <component
  244. :disabled="lcModa.disabled"
  245. v-if="lcModa.visible"
  246. :is="lcModa.formComponent"
  247. :processData="lcModa.processData"
  248. :isNew="lcModa.isNew"
  249. @afterSubmit="afterSub"
  250. @close=";(lcModa.visible = false), (lcModa.disabled = false)"
  251. ></component>
  252. </a-modal>
  253. <!--再次申请-->
  254. <a-modal title="再次申请" v-model="modalVisible" :mask-closable="false" :width="500" :footer="null">
  255. <div v-if="modalVisible">
  256. <a-form-item label="选择审批人" v-show="showAssign">
  257. <a-select
  258. style="width: 100%"
  259. v-model="form.assignees"
  260. placeholder="请选择"
  261. mode="multiple"
  262. :allowClear="true"
  263. >
  264. <a-select-option v-for="(item, i) in assigneeList" :key="i" :value="item.username">{{
  265. item.realname
  266. }}</a-select-option>
  267. </a-select>
  268. </a-form-item>
  269. <a-form-item label="下一审批人" v-show="isGateway">
  270. <a-alert type="info" showIcon message="分支网关处不支持自定义选择下一审批人,将自动下发给所有可审批人。"
  271. >,将发送给下一节点所有人</a-alert
  272. >
  273. </a-form-item>
  274. <a-form-item label="优先级" prop="priority">
  275. <a-select v-model="form.priority" placeholder="请选择" :allowClear="true" style="width: 100%">
  276. <a-select-option :value="0">普通</a-select-option>
  277. <a-select-option :value="1">重要</a-select-option>
  278. <a-select-option :value="2">紧急</a-select-option>
  279. </a-select>
  280. </a-form-item>
  281. <a-form-item label="消息通知">
  282. <a-checkbox v-model="form.sendMessage">站内消息通知</a-checkbox>
  283. <!-- <a-checkbox v-model="form.sendSms" disabled>短信通知</a-checkbox>
  284. <a-checkbox v-model="form.sendEmail" disabled>邮件通知</a-checkbox> -->
  285. </a-form-item>
  286. <div slot="footer">
  287. <a-button type="text" @click="modalVisible = false">取消</a-button>
  288. <div style="display:inline-block;width: 20px;"></div>
  289. <a-button type="primary" :disabled="submitLoading" @click="applySubmit">提交</a-button>
  290. </div>
  291. </div>
  292. </a-modal>
  293. <a-modal title="审批历史" v-model="modalLsVisible" :mask-closable="false" :width="'80%'" :footer="null">
  294. <div v-if="modalLsVisible">
  295. <historicDetail :procInstId="procInstId"></historicDetail>
  296. </div>
  297. </a-modal>
  298. <a-modal title="确认撤回" v-model="modalCancelVisible" :mask-closable="false" :width="500">
  299. <a-form ref="delForm" v-model="cancelForm" :label-width="70" v-if="modalCancelVisible">
  300. <a-form-item label="撤回原因" prop="reason">
  301. <a-input type="textarea" v-model="cancelForm.reason" :rows="4" />
  302. </a-form-item>
  303. </a-form>
  304. <div slot="footer">
  305. <a-button type="text" @click="modalCancelVisible = false">取消</a-button>
  306. <a-button type="primary" :disabled="submitLoading" @click="handelSubmitCancel">提交</a-button>
  307. </div>
  308. </a-modal>
  309. <!-- 项目管理整合 打开合同页面 -->
  310. <outerForm-check ref="outerFormCheck" @refreshData="handleSearch" ></outerForm-check>
  311. </a-card>
  312. </template>
  313. <script>
  314. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  315. import { activitiMixin } from '@/views/activiti/mixins/activitiMixin'
  316. import { filterObj } from '@/utils/util'
  317. import JEllipsis from '@/components/jeecg/JEllipsis'
  318. import { deleteAction, getAction, downFile, postAction } from '@/api/manage'
  319. import pick from 'lodash.pick'
  320. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  321. import { initDictOptions, filterDictText } from '@/components/dict/JDictSelectUtil'
  322. import historicDetail from '@/views/activiti/historicDetail'
  323. import outerFormCheck from '../../share/modal/OuterFormCheck'
  324. import {getEditorJumpUrl,getProjctManageUrl}from '../../../url.config'
  325. export default {
  326. name: 'applyList',
  327. mixins: [activitiMixin, JeecgListMixin],
  328. components: {
  329. JEllipsis,
  330. JTreeSelect,
  331. historicDetail,
  332. outerFormCheck
  333. },
  334. data() {
  335. return {
  336. editorJumpUrl:'',
  337. description: '我的申请',
  338. dictOptions: [],
  339. url: {
  340. list: '/actBusiness/listData',
  341. getProcessDataList: '/activiti_process/listData',
  342. delByIds: '/actBusiness/delByIds',
  343. getFirstNode: '/actProcessIns/getFirstNode',
  344. applyBusiness: '/actBusiness/apply',
  345. cancelApply: '/actBusiness/cancel',
  346. outformViewUrl:"/actBusiness/external/getViewUrl",
  347. applyOuterBusiness: '/actBusiness/external/apply',
  348. },
  349. // 查询条件
  350. queryParam: {
  351. createTimeRange: [],
  352. keyWord: ''
  353. },
  354. // 表头
  355. labelCol: {
  356. xs: { span: 4 },
  357. sm: { span: 4 }
  358. },
  359. wrapperCol: {
  360. xs: { span: 20 },
  361. sm: { span: 20 }
  362. },
  363. processModalVisible: null,
  364. activeKeyAll: [],
  365. activeKey: [],
  366. processDataMap: {},
  367. searchProcessKey: null,
  368. addApplyLoading: false,
  369. lcModa: {
  370. title: '',
  371. disabled: false,
  372. visible: false,
  373. formComponent: null,
  374. isNew: false
  375. },
  376. form: {
  377. priority: 0,
  378. assignees: [],
  379. sendMessage: true
  380. },
  381. modalVisible: false,
  382. showAssign: false,
  383. assigneeList: [],
  384. isGateway: false,
  385. dictPriority: [],
  386. submitLoading: false,
  387. error: '',
  388. /*审批历史*/
  389. modalLsVisible: false,
  390. procInstId: '',
  391. modalCancelVisible: false,
  392. cancelForm: {}
  393. }
  394. },
  395. computed: {},
  396. methods: {
  397. initDictConfig() {
  398. //初始化字典 - 流程分类
  399. initDictOptions('bpm_process_type').then(res => {
  400. if (res.success) {
  401. this.dictOptions = res.result
  402. }
  403. })
  404. },
  405. filterDictText(dictOptions, text) {
  406. if (dictOptions instanceof Array) {
  407. for (let dictItem of dictOptions) {
  408. if (text === dictItem.value) {
  409. return dictItem.text
  410. }
  411. }
  412. }
  413. return text || text == 'null' ? '' : text
  414. },
  415. getProcessList() {
  416. this.addApplyLoading = true
  417. this.postFormAction(this.url.getProcessDataList, { status: 1, roles: true })
  418. .then(res => {
  419. this.activeKeyAll = []
  420. if (res.success) {
  421. var result = res.result || []
  422. if (result.length > 0) {
  423. let searchProcessKey = this.searchProcessKey
  424. if (searchProcessKey) {
  425. //过滤条件
  426. result = _.filter(result, function(o) {
  427. return o.name.indexOf(searchProcessKey) > -1
  428. })
  429. }
  430. this.processDataMap = _.groupBy(result, 'categoryId')
  431. for (const categoryId in this.processDataMap) {
  432. this.activeKeyAll.push(categoryId)
  433. }
  434. this.activeKey = this.activeKeyAll
  435. }
  436. this.processModalVisible = true
  437. } else {
  438. this.$message.warning(res.message)
  439. }
  440. })
  441. .finally(() => (this.addApplyLoading = false))
  442. },
  443. loadData(arg) {
  444. if (!this.url.list) {
  445. this.$message.error('请设置url.list属性!')
  446. return
  447. }
  448. //加载数据 若传入参数1则加载第一页的内容
  449. if (arg === 1) {
  450. this.ipagination.current = 1
  451. }
  452. var params = this.getQueryParams() //查询条件
  453. this.loading = true
  454. getAction(this.url.list, params).then(res => {
  455. if (res.success) {
  456. let records = res.result || []
  457. this.dataSource = records
  458. this.ipagination.total = records.length
  459. }
  460. if (res.code === 510) {
  461. this.$message.warning(res.message)
  462. }
  463. this.loading = false
  464. })
  465. },
  466. getQueryParams() {
  467. var param = Object.assign({}, this.queryParam, this.isorter)
  468. delete param.createTimeRange // 时间参数不传递后台
  469. return filterObj(param)
  470. },
  471. // 重置
  472. searchReset() {
  473. var that = this
  474. var logType = that.queryParam.logType
  475. that.queryParam = {} //清空查询区域参数
  476. that.queryParam.logType = logType
  477. that.loadData(this.ipagination.current)
  478. },
  479. onDateChange: function(value, dateString) {
  480. console.log(dateString[0], dateString[1])
  481. this.queryParam.createTime_begin = dateString[0]
  482. this.queryParam.createTime_end = dateString[1]
  483. },
  484. onDateOk(value) {
  485. console.log(value)
  486. },
  487. getStatus(status) {
  488. let text = '未知',
  489. color = ''
  490. if (status == 0) {
  491. text = '草稿'
  492. color = 'default'
  493. } else if (status == 1) {
  494. text = '处理中'
  495. color = 'orange'
  496. } else if (status == 2) {
  497. text = '已结束'
  498. color = 'blue'
  499. } else if (status == 3) {
  500. text = '已撤回'
  501. color = 'magenta'
  502. }
  503. return { text: text, color: color }
  504. },
  505. getResult(result) {
  506. let text = '未知',
  507. color = ''
  508. if (result == 0) {
  509. text = '未提交'
  510. color = 'default'
  511. } else if (result == 1) {
  512. text = '处理中'
  513. color = 'orange'
  514. } else if (result == 2) {
  515. text = '已通过'
  516. color = 'green'
  517. } else if (result == 3) {
  518. text = '已驳回'
  519. color = 'red'
  520. }
  521. return { text: text, color: color }
  522. },
  523. apply(v) {
  524. if (!v.procDefId || v.procDefId == 'null') {
  525. this.$message.error('流程定义为空')
  526. return
  527. }
  528. //this.form.id = v.id
  529. //this.form.procDefId = v.procDefId
  530. //this.form.title = v.title
  531. //this.form.routeName = v.routeName;
  532. this.form = Object.assign({
  533. priority: 0,
  534. assignees: [],
  535. sendMessage: true
  536. }, v);
  537. // 加载审批人
  538. this.getAction(this.url.getFirstNode, { procDefId: v.procDefId }).then(res => {
  539. if (res.success) {
  540. if (res.result.type == 3 || res.result.type == 4) {
  541. this.isGateway = true
  542. this.modalVisible = true
  543. this.form.firstGateway = true
  544. this.showAssign = false
  545. this.error = ''
  546. return
  547. }
  548. this.form.firstGateway = false
  549. this.isGateway = false
  550. if (res.result.users && res.result.users.length > 0) {
  551. this.error = ''
  552. this.assigneeList = res.result.users
  553. // 默认勾选
  554. let ids = []
  555. res.result.users.forEach(e => {
  556. ids.push(e.username)
  557. })
  558. this.form.assignees = ids
  559. this.showAssign = true
  560. } else {
  561. this.form.assignees = []
  562. this.showAssign = true
  563. this.error = '审批节点未分配候选审批人员,请联系管理员!'
  564. }
  565. if (this.error) {
  566. this.$message.error(this.error)
  567. return
  568. }
  569. this.modalVisible = true
  570. } else {
  571. this.$message.error(res.message)
  572. }
  573. })
  574. },
  575. applySubmit() {
  576. if (this.showAssign && this.form.assignees.length < 1) {
  577. this.error = '请至少选择一个审批人'
  578. this.$message.error(this.error)
  579. return
  580. } else {
  581. this.error = ''
  582. }
  583. this.submitLoading = true
  584. var params = Object.assign({}, this.form)
  585. params.assignees = params.assignees.join(',')
  586. var requestUrl = this.url.applyBusiness;
  587. if (this.form.routeName != null && this.form.routeName.indexOf("外部表单")>-1){
  588. postAction(this.url.applyOuterBusiness, params)
  589. .then(res => {
  590. if (res.success) {
  591. this.$message.success('操作成功')
  592. this.loadData()
  593. this.modalVisible = false
  594. } else {
  595. this.$message.error(res.message)
  596. }
  597. })
  598. .finally(() => (this.submitLoading = false))
  599. }else{
  600. this.postFormAction(this.url.applyBusiness, params)
  601. .then(res => {
  602. if (res.success) {
  603. this.$message.success('操作成功')
  604. this.loadData()
  605. this.modalVisible = false
  606. } else {
  607. this.$message.error(res.message)
  608. }
  609. })
  610. .finally(() => (this.submitLoading = false))
  611. }
  612. },
  613. edit(r, isView) {
  614. if (!r.routeName) {
  615. this.$message.warning('该流程信息未配置表单,请联系开发人员!')
  616. return
  617. }
  618. if (r.routeName.indexOf('外部表单') != -1||r.tableName.indexOf('外部表单') != -1) {
  619. //其他项目的表单流程
  620. //var id = r.tableId //项目管理合同数据id
  621. //打开MyIframe弹框
  622. //this.$refs.MyIframe.editorVisible = true
  623. //并传入地址参数
  624. //this.$refs.MyIframe.editorJumpUrlMy = getProjctManageUrl()+'/contract-process-view?id=' + id
  625. this.showOuterFormViewDlg(r.tableId, '查看业务流程:' + r.processName, r);
  626. } else if (r.routeName.indexOf('自定义') != -1) {
  627. isView = isView || false
  628. this.lcModa.disabled = isView
  629. this.lcModa.title = '修改流程业务信息:' + r.title
  630. if (isView) this.lcModa.title = '查看流程业务信息:' + r.title
  631. let com = { component: () => import(`@/views/activiti/form/demoForm2`) }
  632. this.lcModa.formComponent = com.component
  633. this.lcModa.isNew = false
  634. this.lcModa.processData = r
  635. this.lcModa.visible = true
  636. } else {
  637. isView = isView || false
  638. this.lcModa.disabled = isView
  639. this.lcModa.title = '修改流程业务信息:' + r.title
  640. if (isView) this.lcModa.title = '查看流程业务信息:' + r.title
  641. this.lcModa.formComponent = this.getFormComponent(r.routeName).component
  642. this.lcModa.processData = r
  643. this.lcModa.isNew = false
  644. this.lcModa.visible = true
  645. }
  646. },
  647. remove(r) {
  648. this.postFormAction(this.url.delByIds, { ids: r.id }).then(res => {
  649. if (res.success) {
  650. this.$message.success(res.message)
  651. this.loadData()
  652. } else {
  653. this.$message.error(res.message)
  654. }
  655. })
  656. },
  657. cancel(v) {
  658. this.cancelForm.id = v.id
  659. this.cancelForm.procInstId = v.procInstId
  660. this.modalCancelVisible = true
  661. },
  662. handelSubmitCancel() {
  663. this.submitLoading = true
  664. this.postFormAction(this.url.cancelApply, this.cancelForm)
  665. .then(res => {
  666. if (res.success) {
  667. this.$message.success('操作成功')
  668. this.loadData()
  669. this.modalCancelVisible = false
  670. } else {
  671. this.$message.error(res.message)
  672. }
  673. })
  674. .finally(() => (this.submitLoading = false))
  675. },
  676. history(v) {
  677. if (!v.procInstId) {
  678. this.$message.error('流程实例ID不存在')
  679. return
  680. }
  681. this.procInstId = v.procInstId
  682. this.modalLsVisible = true
  683. },
  684. detail(v) {
  685. // this.$refs.modal.detail("1","8a8080f079ea4ed50179ea4f6c470001")
  686. this.edit(v, true)
  687. },
  688. handleTableChange(pagination, filters, sorter) {
  689. //分页、排序、筛选变化时触发
  690. //TODO 筛选
  691. if (Object.keys(sorter).length > 0) {
  692. this.isorter.column = sorter.field
  693. this.isorter.order = 'ascend' == sorter.order ? 'asc' : 'desc'
  694. }
  695. this.ipagination = pagination
  696. // this.loadData();
  697. },
  698. addApply() {
  699. this.getProcessList()
  700. },
  701. onSearchProcess(value) {
  702. this.searchProcessKey = value
  703. this.getProcessList()
  704. },
  705. chooseProcess(v) {
  706. console.log(v)
  707. // this.$refs.modal.add("1")
  708. if (!v.routeName) {
  709. this.$message.warning('该流程信息未配置表单,请联系开发人员!')
  710. return
  711. }
  712. if (v.routeName.indexOf('外部表单') != -1) {
  713. alert('调用其他项目页面')
  714. } else if (v.routeName.indexOf('自定义') != -1) {
  715. this.lcModa.disabled = false
  716. let com = { component: () => import(`@/views/activiti/form/demoForm2`) }
  717. this.lcModa.formComponent = com.component
  718. this.lcModa.title = '发起流程:' + v.name
  719. this.lcModa.isNew = true
  720. this.lcModa.processData = v
  721. this.lcModa.visible = true
  722. } else {
  723. this.lcModa.disabled = false
  724. this.lcModa.formComponent = this.getFormComponent(v.routeName).component
  725. this.lcModa.title = '发起流程:' + v.name
  726. this.lcModa.isNew = true
  727. this.lcModa.processData = v
  728. this.lcModa.visible = true
  729. }
  730. console.log('发起', v)
  731. },
  732. afterSub(formData) {
  733. this.lcModa.visible = false
  734. this.loadData()
  735. },
  736. showOuterFormViewDlg(tableId, title, processData){
  737. getAction(this.url.outformViewUrl,{tableId:tableId}).then(res=>{
  738. if (res.success){
  739. var url = res.result.url;
  740. var param = res.result.param;
  741. url = url+"?"+this.jsonToUrlParam(param);
  742. this.$refs.outerFormCheck.openDialog(url, title, processData);
  743. }else{
  744. this.$message.error(res.message);
  745. }
  746. });
  747. },
  748. jsonToUrlParam(query){
  749. var tmpArr = [];
  750. for (var i in query){
  751. var key = encodeURIComponent(i);
  752. var value = encodeURIComponent(query[i]);
  753. tmpArr.push(key+"="+value);
  754. }
  755. return tmpArr.join("&");
  756. },
  757. }
  758. }
  759. </script>
  760. <style scoped>
  761. @import '~@assets/less/common.less';
  762. </style>