applyList.vue 26 KB

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