applyList.vue 27 KB

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