applyList.vue 28 KB

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