ProcessModelList.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  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.lcmc"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <a-form-item label="流程标识">
  14. <a-input placeholder="请输入搜索关键词" v-model="queryParam.lckey"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="4" :sm="8">
  18. <a-form-item label="是否最新">
  19. <a-switch
  20. checkedChildren="是"
  21. unCheckedChildren="否"
  22. defaultChecked
  23. v-model="queryParam.zx"
  24. />
  25. </a-form-item>
  26. </a-col>
  27. <!--<a-col :md="6" :sm="10">
  28. <a-form-item label="创建时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
  29. <a-range-picker
  30. style="width: 210px"
  31. v-model="queryParam.createTimeRange"
  32. format="YYYY-MM-DD"
  33. :placeholder="['开始时间', '结束时间']"
  34. @change="onDateChange"
  35. @ok="onDateOk"
  36. />
  37. </a-form-item>
  38. </a-col>-->
  39. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  40. <a-col :md="8" :sm="12">
  41. <a-button type="primary" style="left: 10px" @click="searchQuery" icon="search">查询</a-button>
  42. <a-button
  43. type="primary"
  44. @click="searchReset"
  45. icon="reload"
  46. style="margin-left: 8px;left: 10px"
  47. >重置</a-button>
  48. <a-button @click="editFormsOnline" style="margin-left: 8px;left: 10px;">在线编辑表单</a-button>
  49. </a-col>
  50. </span>
  51. <span style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
  52. <a-col :md="12" :sm="12">
  53. <!-- <a-button type="primary" style="left: 10px" @click="createObj.visible=true" icon="search">创建流程模型</a-button>-->
  54. </a-col>
  55. </span>
  56. </a-row>
  57. </a-form>
  58. </div>
  59. <!-- table区域-begin -->
  60. <a-table
  61. :scroll="{x:2250,y:500}"
  62. bordered
  63. ref="table"
  64. size="small"
  65. rowKey="id"
  66. :dataSource="dataSource"
  67. :pagination="ipagination"
  68. :loading="loading"
  69. @change="handleTableChange"
  70. >
  71. <a-table-column title="#" :width="50" fixed="left" key="a">
  72. <template slot-scope="t,r,i">
  73. <span>{{i+1}}</span>
  74. </template>
  75. </a-table-column>
  76. <a-table-column title="流程名称" data-index="name" :width="200" align="center" fixed="left">
  77. <template slot-scope="t,r,i">
  78. <span>{{t}}</span>
  79. </template>
  80. </a-table-column>
  81. <a-table-column title="流程标识" data-index="processKey" :width="200" align="center">
  82. <template slot-scope="t,r,i">
  83. <span>{{t}}</span>
  84. </template>
  85. </a-table-column>
  86. <a-table-column
  87. title="版本"
  88. data-index="version"
  89. key="asa"
  90. :width="100"
  91. align="center"
  92. :sorter="(a, b) => a.version - b.version"
  93. >
  94. <template slot-scope="t,r,i">
  95. <span>v.{{t}}</span>
  96. </template>
  97. </a-table-column>
  98. <a-table-column
  99. title="图标"
  100. data-index="iconAddress"
  101. key="iconAddress"
  102. :width="100"
  103. align="center"
  104. >
  105. <template slot-scope="t,r,i">
  106. <span><a-avatar
  107. shape="square"
  108. :src="t"
  109. /></span>
  110. </template>
  111. </a-table-column>
  112. <a-table-column
  113. title="所属分类"
  114. data-index="categoryId"
  115. :width="200"
  116. align="center"
  117. key="categoryId_"
  118. :filters="lcTypeF"
  119. @filter="filter_categoryId"
  120. >
  121. <template slot-scope="t,r,i">
  122. <span>{{filterDictText(dictOptions, t)}}</span>
  123. </template>
  124. </a-table-column>
  125. <a-table-column title="流程图片" data-index="diagramName" :width="200" align="center">
  126. <template slot-scope="t,r,i">
  127. <span @click="showResource(r)" style="color: blue;cursor: pointer;">{{t}}</span>
  128. </template>
  129. </a-table-column>
  130. <a-table-column title="表单路由" data-index="routeName" :width="200" align="center">
  131. <template slot-scope="t,r,i">
  132. <span @click="viewForm(r)" style="color: blue;cursor: pointer;">
  133. <!-- {{getFormComponent(t).text}} -->
  134. 预览表单
  135. </span>
  136. </template>
  137. </a-table-column>
  138. <a-table-column title="状态" data-index="status" :width="200" align="center">
  139. <template slot-scope="t,r,i">
  140. <span v-if="t==1" style="color: #00A0E9;">已启用</span>
  141. <span v-if="t!=1" style="color: #999;">未启用</span>
  142. </template>
  143. </a-table-column>
  144. <a-table-column title="备注说明" data-index="description" :width="200" align="center">
  145. <template slot-scope="t,r,i">
  146. <j-ellipsis :value="t" :length="10" />
  147. </template>
  148. </a-table-column>
  149. <a-table-column title="部署时间" data-index="createTime" :width="200" align="center">
  150. <template slot-scope="t,r,i">
  151. <span>{{t}}</span>
  152. </template>
  153. </a-table-column>
  154. <a-table-column title="更新时间" data-index="updateTime" :width="200" align="center">
  155. <template slot-scope="t,r,i">
  156. <span>{{t}}</span>
  157. </template>
  158. </a-table-column>
  159. <a-table-column title="操作" data-index align="center" :width="250" fixed="right">
  160. <template slot-scope="t,r,i">
  161. <a
  162. href="javascript:void(0);"
  163. v-if="r.status!=1"
  164. @click="editStatus(1,r)"
  165. style="color: rgb(144,96,255);"
  166. >启用</a>
  167. <a
  168. href="javascript:void(0);"
  169. v-if="r.status==1"
  170. @click="editStatus(0,r)"
  171. style="color: #cb892d"
  172. >禁用</a>
  173. <a-divider type="vertical" />
  174. <a href="javascript:void(0);" @click="getNodeData(r)">节点设置</a>
  175. <a-divider type="vertical" />
  176. <!-- <a href="javascript:void(0);" @click="convertToModel(r)" >转为模型</a> -->
  177. <a href="javascript:void(0);" @click="edit(r)">编辑</a>
  178. <a-divider type="vertical" />
  179. <br />
  180. <!-- 是自定义的表单才显示 -->
  181. <a
  182. v-if="r.routeName!=null&&r.routeName.indexOf('自定义')!=-1"
  183. href="javascript:void(0);"
  184. @click="editFrom(r)"
  185. >编辑表单</a>
  186. <a-divider v-if="r.routeName!=null&&r.routeName.indexOf('自定义')!=-1" type="vertical" />
  187. <a href="javascript:void(0);" style="color: red;" @click="remove(r)">删除</a>
  188. </template>
  189. </a-table-column>
  190. </a-table>
  191. <!-- table区域-end -->
  192. <!--编辑-->
  193. <a-modal
  194. :confirmLoading="confirmLoading"
  195. title="编辑流程"
  196. :visible="editObj.visible"
  197. @ok="editObjOk"
  198. @cancel="editObj.visible = false"
  199. >
  200. <a-form :form="editForm" v-if="editObj.visible">
  201. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="流程分类">
  202. <component
  203. :is="LcDict"
  204. :trigger-change="true"
  205. v-decorator="[ 'categoryId', {initialValue:editObj.categoryId, rules: [{ required: true, message: '不能为空' }] },]"
  206. placeholder="请选择流程分类"
  207. dictCode="bpm_process_type"
  208. ></component>
  209. </a-form-item>
  210. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="关联表单">
  211. <a-select
  212. @change="change_routeName"
  213. placeholder="请选择关联表单"
  214. :trigger-change="true"
  215. v-decorator="[ 'routeName', {initialValue:editObj.routeName, rules: [{ required: true, message: '不能为空' }] },]"
  216. >
  217. <a-select-option value>请选择</a-select-option>
  218. <a-select-option
  219. v-for="(item, i) in allFormComponent"
  220. :key="item.routeName"
  221. :value="item.routeName"
  222. >
  223. <span style="display: inline-block;width: 100%" :title=" item.text">{{ item.text}}</span>
  224. </a-select-option>
  225. </a-select>
  226. <!-- <a href="javascrip:void(0)" @click="viewForm">预览表单</a> -->
  227. </a-form-item>
  228. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="图标">
  229. <a-upload
  230. name="avatar"
  231. list-type="picture-card"
  232. class="avatar-uploader"
  233. :show-upload-list="false"
  234. action="/jeecg-boot/sys/common/uploadFile"
  235. @change="imgHandleChange"
  236. >
  237. <img v-if="imageUrl" :src="imageUrl" alt="avatar" />
  238. <div v-else>
  239. <a-icon type="plus" />
  240. <div class="ant-upload-text">上传</div>
  241. </div>
  242. </a-upload>
  243. </a-form-item>
  244. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="角色授权">
  245. <j-select-role
  246. placeholder="不选择则所有人可用"
  247. v-decorator="[ 'roles', {initialValue:editObj.roles, rules: []}]"
  248. />
  249. </a-form-item>
  250. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="备注描述">
  251. <a-textarea
  252. v-decorator="[ 'description', {initialValue:editObj.description, rules: []}]"
  253. placeholder="备注描述"
  254. :autoSize="{ minRows: 3, maxRows: 5 }"
  255. />
  256. </a-form-item>
  257. </a-form>
  258. </a-modal>
  259. <!--节点设置-->
  260. <a-modal
  261. title="编辑流程节点"
  262. width="900px"
  263. :maskClosable="false"
  264. :confirmLoading="confirmLoading"
  265. :visible="showProcessNodeEdit"
  266. :footer="null"
  267. @cancel="closeNode"
  268. >
  269. <a-row>
  270. <a-col :md="4" :sm="4" style="border-right: 1px solid #999">
  271. <!-- 选择流程节点-->
  272. <a-steps direction="vertical" :current="current" size="small">
  273. <template v-for="item,i in nodeList" >
  274. <a-step
  275. style="cursor: pointer;"
  276. :title="item.title"
  277. :description="item.description"
  278. :status="i==current?'process':'wait'"
  279. @click="change_steps(item,i)"
  280. />
  281. </template>
  282. </a-steps>
  283. </a-col>
  284. <a-col :md="20" :sm="20">
  285. <a-alert message="温馨提示:若流程运行至未分配审批人员的审批节点时,流程将自动中断取消!" banner />
  286. <span></span>
  287. <a-form :form="nodeForm" v-if="showProcessNodeEdit">
  288. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="节点名称">
  289. <span class="nodespan">{{editNode.title}}</span>
  290. </a-form-item>
  291. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="节点类型">
  292. <span class="nodespan">{{dictNodeType[editNode.type]}}</span>
  293. </a-form-item>
  294. <a-alert v-if="editNode.type!=2&&!confirmLoading" message="温馨提示:若每步流程填写表单的内容不同则需要选择关联表单,相同则不需要选择!" banner /><br/>
  295. <a-form-item v-if="editNode.type!=2&&!confirmLoading" :label-col="labelCol" :wrapper-col="wrapperCol" label="关联表单">
  296. <a-select
  297. placeholder="请选择关联表单"
  298. v-model="spry.tbTableInfoId"
  299. >
  300. <a-select-option
  301. v-for="(item, i) in tableByBusinessTableList"
  302. :key="item.id"
  303. :value="item.id"
  304. >
  305. <span style="display: inline-block;width: 100%" :title="item.stepMemo">{{ item.stepMemo}}</span>
  306. </a-select-option>
  307. </a-select>
  308. </a-form-item>
  309. <a-alert type="info" message="每个节点设置,如有修改都请保存一次,跳转节点后数据不会自动保存!" banner />
  310. <br />
  311. <a-form-item
  312. :label-col="labelCol"
  313. :wrapper-col="wrapperCol"
  314. label="审批人员"
  315. v-show="editNode.type==1"
  316. >
  317. <a-checkbox-group @change="spryType" v-model="spryTypes">
  318. <!-- 0角色 1用户 2部门 3发起人 4发起人的部门负责人-->
  319. <a-checkbox value="0">根据角色选择</a-checkbox>
  320. <a-checkbox value="1">直接选择人员</a-checkbox>
  321. <a-checkbox value="2">部门负责人</a-checkbox>
  322. <a-checkbox value="3">
  323. 发起人
  324. <a-tooltip placement="topLeft" title="自动获取发起人">
  325. <a-icon type="exclamation-circle" />
  326. </a-tooltip>
  327. </a-checkbox>
  328. <a-checkbox value="4">
  329. 发起人的部门负责人
  330. <a-tooltip
  331. placement="topLeft"
  332. title="自动获取发起人所在部门的负责人,即其上级领导。(如果其本身就是部门负责人,则指向发起人自己。)"
  333. >
  334. <a-icon type="exclamation-circle" />
  335. </a-tooltip>
  336. </a-checkbox>
  337. <a-checkbox value="5">上级部门负责人</a-checkbox>
  338. </a-checkbox-group>
  339. </a-form-item>
  340. <!-- 0角色 1用户 2部门 3发起人 4发起人的部门负责人-->
  341. <a-form-item
  342. :label-col="labelCol"
  343. :wrapper-col="wrapperCol"
  344. label="选择角色"
  345. v-if="spryTypes.indexOf('0')>-1"
  346. >
  347. <j-select-role v-model="spry.roleIds" />
  348. </a-form-item>
  349. <a-form-item
  350. :label-col="labelCol"
  351. :wrapper-col="wrapperCol"
  352. label="选择人员"
  353. v-if="spryTypes.indexOf('1')>-1"
  354. >
  355. <!-- 通过部门选择用户控件 -->
  356. <j-select-user-by-dep v-model="spry.userIds" :multi="true"></j-select-user-by-dep>
  357. </a-form-item>
  358. <a-form-item
  359. :label-col="labelCol"
  360. :wrapper-col="wrapperCol"
  361. label="选择部门"
  362. v-if="spryTypes.indexOf('2')>-1"
  363. >
  364. <j-select-depart v-model="spry.departmentIds" :multi="true"></j-select-depart>
  365. </a-form-item>
  366. <!--btn-->
  367. <!-- :disabled="editNode.type==0||editNode.type==2||confirmLoading" -->
  368. <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
  369. <a-button
  370. @click="sprySubmit"
  371. type="primary"
  372. html-type="submit"
  373. :disabled="editNode.type==2||confirmLoading"
  374. >提交并保存</a-button>
  375. <a-button @click="closeNode" style="margin-left: 10px">关闭</a-button>
  376. </a-form-item>
  377. </a-form>
  378. </a-col>
  379. </a-row>
  380. </a-modal>
  381. <!--查看图片-->
  382. <a-modal
  383. :title="viewTitle"
  384. width="90%"
  385. :visible="viewImage"
  386. :footer="null"
  387. @cancel="viewImage = false"
  388. >
  389. <div style="min-height: 400px">
  390. <img :src="diagramUrl" :alt="viewTitle" />
  391. </div>
  392. </a-modal>
  393. <!-- 表单编辑器 -->
  394. <a-drawer
  395. title="编辑器"
  396. width="100%"
  397. style="top:0%;height: 100%;"
  398. :visible="editorVisible"
  399. @close="editFromClose"
  400. >
  401. <iframe :src="editorJumpUrl" width="100%" height="800" frameborder="0" scrolling="auto" id="iframename" name="iframename"></iframe>
  402. <div
  403. :style="{
  404. position: 'absolute',
  405. right: 0,
  406. bottom: 0,
  407. width: '100%',
  408. borderTop: '1px solid #e9e9e9',
  409. padding: '10px 16px',
  410. background: '#fff',
  411. textAlign: 'right',
  412. zIndex: 1,
  413. }"
  414. >
  415. <a-button :style="{ marginRight: '8px' }" @click="editFromClose">
  416. 关闭
  417. </a-button>
  418. </div>
  419. </a-drawer>
  420. <!--流程表单 预览-->
  421. <!-- <a-modal :title="lcModa.title" v-model="lcModa.visible" :footer="null" :maskClosable="false" width="80%">
  422. <component :is="lcModa.formComponent" :disabled="true"></component>
  423. </a-modal>-->
  424. <a-modal
  425. :title="lcModa.title"
  426. v-model="lcModa.visible"
  427. :footer="null"
  428. :maskClosable="false"
  429. width="80%"
  430. >
  431. <component
  432. :disabled="lcModa.disabled"
  433. v-if="lcModa.visible"
  434. :is="lcModa.formComponent"
  435. :processData="lcModa.processData"
  436. :isNew="lcModa.isNew"
  437. @close="lcModa.visible=false,lcModa.disabled = false"
  438. ></component>
  439. </a-modal>
  440. </a-card>
  441. </template>
  442. <script>
  443. import { filterObj } from '@/utils/util'
  444. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  445. import { activitiMixin } from '@/views/activiti/mixins/activitiMixin'
  446. import JEllipsis from '@/components/jeecg/JEllipsis'
  447. import { deleteAction, getAction, downFile,postFormAction2 } from '@/api/manage'
  448. import pick from 'lodash.pick'
  449. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  450. import { initDictOptions, filterDictText } from '@/components/dict/JDictSelectUtil'
  451. import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
  452. import JSelectRole from '@/components/jeecgbiz/JSelectRole'
  453. import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  454. import {getEditorJumpUrl}from '../../../url.config'
  455. import { queryList,updateTbTableInfo } from '@/api/api'
  456. export default {
  457. name: 'ProcessModelList',
  458. mixins: [activitiMixin, JeecgListMixin],
  459. components: {
  460. JEllipsis,
  461. JSelectUserByDep,
  462. JSelectRole,
  463. JSelectDepart,
  464. JTreeSelect
  465. },
  466. data() {
  467. return {
  468. tableByBusinessTableList:[],//节点关联表单下拉集合
  469. imageUrl:"",
  470. viewImage: false,
  471. editorVisible:false,
  472. editorJumpUrl:"",
  473. viewTitle: '',
  474. diagramUrl: '',
  475. /*编辑流程*/
  476. editObj: {
  477. visible: false
  478. },
  479. editForm: this.$form.createForm(this),
  480. description: '已部署模型',
  481. // 查询条件
  482. queryParam: {
  483. createTimeRange: [],
  484. keyWord: ''
  485. },
  486. tabKey: '1',
  487. // 表头
  488. labelCol: {
  489. xs: { span: 4 },
  490. sm: { span: 4 }
  491. },
  492. wrapperCol: {
  493. xs: { span: 20 },
  494. sm: { span: 20 }
  495. },
  496. confirmLoading: false,
  497. current: 0,
  498. nodeForm: this.$form.createForm(this),
  499. dictOptions: [],
  500. nodeList: [],
  501. editNode: {},
  502. showProcessNodeEdit: false,
  503. dictNodeType: {
  504. '0': '开始节点',
  505. '1': '审批节点',
  506. '2': '结束节点'
  507. },
  508. spryTypes: [],
  509. url: {
  510. list: '/activiti_process/listData',
  511. img: '/activiti/models/export',
  512. updateStatus: '/activiti_process/updateStatus',
  513. delByIds: '/activiti_process/delByIds',
  514. convertToModel: '/activiti_process/convertToModel',
  515. updateInfo: '/activiti_process/updateInfo',
  516. updateInfo2: '/activiti_process/updateInfo2',
  517. getProcessNode: '/activiti_process/getProcessNode',
  518. editNodeUser: '/activiti_process/editNodeUser'
  519. },
  520. spry: {
  521. //选中的用户
  522. userIds: '',
  523. roleIds: '',
  524. departmentIds: '',
  525. chooseSponsor: false,
  526. chooseDepHeader: false,
  527. headSuperiorDepartment:false,
  528. tbTableInfoId:null
  529. },
  530. lcModa: {
  531. title: '',
  532. disabled: false,
  533. visible: false,
  534. formComponent: null,
  535. isNew: false
  536. },
  537. lcTypeF: [],
  538. dataList: [],
  539. allFormComponent2: []
  540. }
  541. },
  542. computed: {
  543. //可行性测试,根据文件路径动态加载组件
  544. LcDict: function() {
  545. var myComponent = () => import(`@/components/dict/JDictSelectTag`)
  546. return myComponent
  547. }
  548. },
  549. created() {
  550. // getAction("/actBusiness/getTableInfoList").then(res=>{
  551. // this.allFormComponent2=res.result;
  552. // })
  553. //获取关联表下拉数据
  554. this.getTableList()
  555. },
  556. methods: {
  557. initDictConfig() {
  558. //初始化字典 - 流程分类
  559. initDictOptions('bpm_process_type').then(res => {
  560. if (res.success) {
  561. var lcTypes = []
  562. this.dictOptions = res.result || []
  563. for (const dict of this.dictOptions) {
  564. lcTypes.push({ text: dict.text, value: dict.value })
  565. }
  566. this.lcTypeF = lcTypes
  567. console.log(lcTypes)
  568. }
  569. })
  570. },
  571. filterDictText(dictOptions, text) {
  572. if (dictOptions instanceof Array) {
  573. for (let dictItem of dictOptions) {
  574. if (text === dictItem.value) {
  575. return dictItem.text
  576. }
  577. }
  578. }
  579. return text
  580. },
  581. closeNode() {
  582. ;(this.showProcessNodeEdit = false), (this.current = 0), (this.spryTypes = []), (this.spry = {})
  583. },
  584. /*编辑流程节点*/
  585. change_steps(node, index) {
  586. this.spryTypes = []
  587. console.log('onChange:', node)
  588. this.current = index
  589. this.editNode = node
  590. /* 0角色 1用户 2部门 3发起人 4发起人的部门负责人 5上级部门负责人*/
  591. this.spry.headSuperiorDepartment=node.headSuperiorDepartment||false
  592. if(this.spry.headSuperiorDepartment) this.spryTypes.push('5')
  593. this.spry.chooseDepHeader = node.chooseDepHeader || false
  594. if (this.spry.chooseDepHeader) this.spryTypes.push('4')
  595. this.spry.chooseSponsor = node.chooseSponsor || false
  596. if (this.spry.chooseSponsor) this.spryTypes.push('3')
  597. var userIds = []
  598. for (const user of node.users || []) {
  599. userIds.push(user.username)
  600. }
  601. this.spry.userIds = userIds.join(',')
  602. if (userIds.length > 0) this.spryTypes.push('1')
  603. var roleIds = []
  604. for (const role of node.roles || []) {
  605. roleIds.push(role.roleCode)
  606. }
  607. this.spry.roleIds = roleIds.join(',')
  608. if (roleIds.length > 0) this.spryTypes.push('0')
  609. var departmentIds = []
  610. for (const department of node.departments || []) {
  611. departmentIds.push(department.id)
  612. }
  613. this.spry.departmentIds = departmentIds.join(',')
  614. if (departmentIds.length > 0) this.spryTypes.push('2')
  615. //关联表单
  616. var tbTableInfoId=null;
  617. if(node.tbTableInfoId){
  618. tbTableInfoId=node.tbTableInfoId
  619. }
  620. this.spry.tbTableInfoId=tbTableInfoId;
  621. console.log('回显this.spry', this.spry)
  622. },
  623. spryType(types) {
  624. /* 0角色 1用户 2部门 3发起人 4发起人的部门负责人*/
  625. // this.spryTypes = types;
  626. if (this.spryTypes.indexOf('0') == -1) this.spry.roleIds = ''
  627. if (this.spryTypes.indexOf('1') == -1) this.spry.userIds = ''
  628. if (this.spryTypes.indexOf('2') == -1) this.spry.departmentIds = ''
  629. //是否选中发起人
  630. this.spry.chooseSponsor = this.spryTypes.indexOf('3') > -1
  631. //是否选中发起人的部门领导
  632. this.spry.chooseDepHeader = this.spryTypes.indexOf('4') > -1
  633. //是否选中上级部门负责人
  634. this.spry.headSuperiorDepartment = this.spryTypes.indexOf('5') > -1
  635. console.log('this.spry', this.spry)
  636. },
  637. sprySubmit() {
  638. var _this = this
  639. //开始节点 选择初始提交表单
  640. if(this.editNode.type==0){
  641. let where={id:this.spry.tbTableInfoId,isInitial:"1"}
  642. updateTbTableInfo(where).then((res)=>{
  643. if(res.success){
  644. _this.$message.success('操作成功')
  645. }else{
  646. _this.$message.error('操作失败')
  647. }
  648. });
  649. }else{
  650. //修改关联表单信息
  651. // let where={id:this.spry.tbTableInfoId,isInitial:"1"}
  652. // updateTbTableInfo(where).then((res)=>{
  653. // if(res.success){
  654. // _this.$message.success('操作成功')
  655. // }else{
  656. // _this.$message.error('操作失败')
  657. // return;
  658. // }
  659. // });
  660. if (this.spryTypes.length == 0) {
  661. _this.$message.error('必须选择审批人!')
  662. return
  663. }
  664. _this.confirmLoading = true
  665. this.spry.nodeId = this.editNode.id
  666. this.postFormAction(_this.url.editNodeUser, this.spry)
  667. .then(res => {
  668. if (res.success) {
  669. _this.$message.success('操作成功')
  670. // _this.getData();
  671. } else {
  672. _this.$message.error(res.message)
  673. }
  674. })
  675. .finally(() => (_this.confirmLoading = false))
  676. }
  677. },
  678. getNodeData(row) {
  679. //查询节点关联表单下拉数据
  680. const where={businessTable:row.businessTable}
  681. queryList(where).then((res)=>{
  682. this.tableByBusinessTableList=res.result;
  683. })
  684. var _this = this
  685. _this
  686. .postFormAction(_this.url.getProcessNode, {
  687. id: row.id
  688. })
  689. .then(res => {
  690. if (res.success) {
  691. // 转换null为""
  692. _this.nodeList = res.result || []
  693. console.log('_this.nodeList', _this.nodeList)
  694. if (_this.nodeList.length > 0) {
  695. _this.editNode = _this.nodeList[0]
  696. _this.showProcessNodeEdit = true
  697. if(_this.nodeList[0].tbTableInfoId){
  698. this.spry.tbTableInfoId=_this.nodeList[0].tbTableInfoId;
  699. }
  700. }
  701. } else {
  702. _this.$message.error(res.message)
  703. }
  704. })
  705. },
  706. /*编辑流程信息*/
  707. edit(row) {
  708. //获取关联表下拉数据
  709. this.getTableList()
  710. this.editObj = Object.assign(this.editObj, row)
  711. this.imageUrl=this.editObj.iconAddress
  712. this.editObj.visible = true
  713. },
  714. editObjOk() {
  715. var _this = this
  716. this.editForm.validateFields((err, values) => {
  717. if (!err) {
  718. let formData = Object.assign(this.editObj, values)
  719. console.log('formData', formData)
  720. formData.iconAddress=this.imageUrl;
  721. this.confirmLoading = true
  722. postFormAction2(this.url.updateInfo2, formData)
  723. .then(res => {
  724. if (res.success) {
  725. _this.$message.success('操作成功')
  726. _this.loadData()
  727. _this.editObj.visible = false
  728. } else {
  729. _this.$message.error(res.message)
  730. }
  731. })
  732. .finally(() => (_this.confirmLoading = false))
  733. }
  734. })
  735. },
  736. change_routeName(event) {
  737. this.$nextTick(() => {
  738. let routeName = this.editForm.getFieldValue('routeName')
  739. console.log('routeName', routeName)
  740. var route = this.getFormComponent(routeName)
  741. this.editObj.businessTable = route.businessTable
  742. this.editObj.routeName = route.routeName
  743. console.log('this.editObj', this.editObj)
  744. })
  745. },
  746. viewForm(r) {
  747. // if (!routeName) routeName = this.editObj.routeName;
  748. // if (!routeName) {
  749. // this.$message.warning(
  750. // "请先选择表单!"
  751. // );
  752. // return;
  753. // }
  754. // let formComponent = this.getFormComponent(routeName);
  755. // this.lcModa.formComponent = formComponent.component;
  756. // this.lcModa.title = '流程表单预览:'+formComponent.text;
  757. // this.lcModa.visible = true;
  758. if (r.routeName.indexOf('外部表单') != -1) {
  759. alert('调用其他项目页面')
  760. } else if (r.routeName.indexOf('自定义') != -1) {
  761. //自定义表单展开
  762. this.lcModa.disabled = true
  763. let com = { component: () => import(`@/views/activiti/form/demoForm2`) }
  764. this.lcModa.formComponent = com.component
  765. this.lcModa.title = '流程表单预览'
  766. this.lcModa.isNew = true
  767. this.lcModa.processData = { businessTable: r.businessTable }
  768. this.lcModa.visible = true
  769. } else {
  770. //自带表单展开
  771. this.lcModa.disabled = true
  772. this.lcModa.formComponent = this.getFormComponent(r.routeName).component
  773. this.lcModa.title = '流程表单预览'
  774. this.lcModa.isNew = true
  775. this.lcModa.processData = r
  776. this.lcModa.visible = true
  777. }
  778. },
  779. convertToModel(row) {
  780. let that = this
  781. this.$confirm({
  782. title: '确认转化',
  783. content: '您确认要转化流程 ' + row.name + ' 为模型?',
  784. loading: true,
  785. onOk: () => {
  786. that.postFormAction(`${that.url.convertToModel}`, { id: row.id }).then(res => {
  787. if (res.success) {
  788. setTimeout(function() {
  789. that.$message.success('转化成功')
  790. }, 300)
  791. } else {
  792. that.$message.error(res.message)
  793. }
  794. })
  795. }
  796. })
  797. },
  798. remove(row) {
  799. var _this = this
  800. _this.$confirm({
  801. title: '确认删除',
  802. content: '您确认要删除流程 ' + row.name + ' ?',
  803. loading: true,
  804. onOk: () => {
  805. _this.postFormAction(_this.url.delByIds, { ids: row.id }).then(res => {
  806. if (res.success) {
  807. _this.$message.success('操作成功')
  808. _this.loadData()
  809. } else {
  810. _this.$message.error(res.message)
  811. }
  812. })
  813. }
  814. })
  815. },
  816. editStatus(status, row) {
  817. var _this = this
  818. let operation = ''
  819. if (status == 0) {
  820. operation = '不启用'
  821. } else {
  822. operation = '启用'
  823. }
  824. this.$confirm({
  825. title: '确认' + operation + '?',
  826. content: `您确认要${operation}流程${row.name}?`,
  827. onOk() {
  828. let params = {
  829. status: status,
  830. id: row.id
  831. }
  832. _this.postFormAction(_this.url.updateStatus, params).then(res => {
  833. if (res.success) {
  834. _this.$message.success('操作成功')
  835. _this.loadData()
  836. } else {
  837. _this.$message.error(res.message)
  838. }
  839. })
  840. },
  841. onCancel() {}
  842. })
  843. },
  844. /*查看流程图片*/
  845. showResource(row) {
  846. this.viewTitle = '流程图片预览(' + row.diagramName + ')'
  847. this.diagramUrl = `${this.doMian}${this.url.img}?id=${row.id}`
  848. this.viewImage = true
  849. },
  850. /*删除模型*/
  851. deletelc(y, row) {
  852. console.log(y, row)
  853. if (y) {
  854. getAction(this.url.delete + row.id).then(res => {
  855. if (res.success) {
  856. this.$message.success(res.message)
  857. } else {
  858. this.$message.error(res.message)
  859. }
  860. this.loadData()
  861. })
  862. }
  863. },
  864. handleTableChange(pagination, filters, sorter) {
  865. //分页、排序、筛选变化时触发
  866. //TODO 筛选
  867. if (Object.keys(sorter).length > 0) {
  868. this.isorter.column = sorter.field
  869. this.isorter.order = 'ascend' == sorter.order ? 'asc' : 'desc'
  870. }
  871. this.ipagination = pagination
  872. console.log(pagination, filters, sorter)
  873. /*if (Object.keys(filters).length>0&&this.dataList.length>0){
  874. for (const filterField in filters) {
  875. let fiterVals = filters[filterField]||[];
  876. }
  877. }*/
  878. // this.loadData();
  879. },
  880. loadData(arg) {
  881. if (!this.url.list) {
  882. this.$message.error('请设置url.list属性!')
  883. return
  884. }
  885. //加载数据 若传入参数1则加载第一页的内容
  886. if (arg === 1) {
  887. this.ipagination.current = 1
  888. }
  889. var params = this.getQueryParams() //查询条件
  890. this.loading = true
  891. getAction(this.url.list, params).then(res => {
  892. if (res.success) {
  893. let records = res.result || []
  894. this.dataSource = records
  895. this.dataList = records
  896. this.ipagination.total = records.length
  897. }
  898. if (res.code === 510) {
  899. this.$message.warning(res.message)
  900. }
  901. this.loading = false
  902. })
  903. },
  904. getQueryParams() {
  905. var param = Object.assign({}, this.queryParam, this.isorter)
  906. delete param.createTimeRange // 时间参数不传递后台
  907. return filterObj(param)
  908. },
  909. // 重置
  910. searchReset() {
  911. var that = this
  912. var logType = that.queryParam.logType
  913. that.queryParam = {} //清空查询区域参数
  914. that.queryParam.logType = logType
  915. that.loadData(this.ipagination.current)
  916. },
  917. onDateChange: function(value, dateString) {
  918. console.log(dateString[0], dateString[1])
  919. this.queryParam.createTime_begin = dateString[0]
  920. this.queryParam.createTime_end = dateString[1]
  921. },
  922. onDateOk(value) {
  923. console.log(value)
  924. },
  925. filter_categoryId(v, r) {
  926. // console.log(v,r)
  927. return r.categoryId == v
  928. },
  929. editFormsOnline() {
  930. //在线编辑表单
  931. // window.location.href = 'http://localhost:8080/#/formDesign'
  932. // window.open('http://localhost:8080/#/formDesign', '_blank')
  933. // window.open('http://106.15.206.14:8089/#/formDesign', '_blank')//测试地址
  934. // window.open(getEditorJumpUrl()+'/#/formDesign', '_blank')
  935. this.editorVisible=true;
  936. this.editorJumpUrl=getEditorJumpUrl()+'/#/formDesign';
  937. },
  938. //编辑表单
  939. editFrom(r) {
  940. // window.open('http://localhost:8080/#/formDesign?tableName=' + r.businessTable, '_blank')
  941. // window.open('http://106.15.206.14:8089/#/formDesign?tableName='+r.businessTable, '_blank')//测试地址
  942. this.editorVisible=true;
  943. // window.open(getEditorJumpUrl()+'/#/formDesign?tableName='+r.businessTable, '_blank')//测试地址
  944. this.editorJumpUrl=getEditorJumpUrl()+'/#/formDesign?tableName='+r.businessTable;
  945. },
  946. //编辑表单弹框关闭按钮
  947. editFromClose(){
  948. this.editorVisible=false;
  949. this.editorJumpUrl="";
  950. },
  951. imgHandleChange(info){
  952. if (info.file.status === 'done') {
  953. // Get this url from response in real world.
  954. getBase64(info.file.originFileObj, imageUrl => {
  955. this.imageUrl = imageUrl;
  956. this.editObj.iconAddress=imageUrl
  957. console.log(this.editObj.iconAddress)
  958. this.loading = false;
  959. });
  960. }
  961. }
  962. }
  963. }
  964. function getBase64(img, callback) {
  965. const reader = new FileReader();
  966. reader.addEventListener('load', () => callback(reader.result));
  967. reader.readAsDataURL(img);
  968. }
  969. </script>
  970. <style scoped>
  971. @import '~@assets/less/common.less';
  972. .nodespan {
  973. color: #999;
  974. }
  975. .ant-checkbox-wrapper + .ant-checkbox-wrapper {
  976. margin-left: 0;
  977. margin-right: 8px;
  978. }
  979. </style>