index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="app-container">
  3. <el-form :inline="true">
  4. <el-form-item label="标题">
  5. <el-input
  6. v-model="queryParams.title"
  7. placeholder="请输入标题"
  8. clearable
  9. size="small"
  10. style="width: 240px"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  16. <el-button type="info" icon="el-icon-refresh-right" size="mini" @click="reList">清空</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-table ref="multipleTable" v-loading="loading" :data="tableData">
  20. <el-table-column label="序号" type="index" align="center">
  21. <template slot-scope="scope">
  22. <span>{{ (queryParams.pageNum-1) * queryParams.pageSize + (scope.$index + 1) }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="任务id" prop="taskId"/>
  26. <el-table-column label="任务名称" prop="taskName"/>
  27. <el-table-column label="外置表单" prop="formKey"/>
  28. <el-table-column label="部署id" prop="processDefinitionId"/>
  29. <el-table-column label="流程id" prop="instanceId"/>
  30. <el-table-column label="操作" align="center">
  31. <template slot-scope="scope">
  32. <el-button type="success"
  33. size="mini"
  34. @click="openForm(scope.$index, scope.row)">审批
  35. </el-button>
  36. <el-button
  37. size="mini" type="warning"
  38. @click="showImage(scope.$index, scope.row)">进度查看
  39. </el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. <pagination
  44. v-show="total>0"
  45. :total="total"
  46. :page.sync="queryParams.pageNum"
  47. :limit.sync="queryParams.pageSize"
  48. @pagination="getList"
  49. />
  50. <!-- 添加或修改角色配置对话框 -->
  51. <el-dialog :title="title" :visible.sync="open" width="1000px">
  52. <!--历史表单组件-->
  53. <addEnterprise ref="addEnterprise"/>
  54. <el-divider content-position="left">审核</el-divider>
  55. <template>
  56. <ele-form
  57. :isShowSubmitBtn=true
  58. :isShowBackBtn=false
  59. :isShowResetBtn=true
  60. :rules="formObj.rules"
  61. :form-desc="formObj.formDesc"
  62. :form-data="formObj.formData"
  63. :request-fn="handleRequest"
  64. @request-success="handleRequestSuccess"
  65. ></ele-form>
  66. </template>
  67. </el-dialog>
  68. <el-dialog :title="activitiImg.title" :visible.sync="activitiImg.open" width="1000px">
  69. <el-image :src="activitiImg.src"></el-image>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { list,get,add } from '@/api/activiti/pendingNew.js'
  75. //流程历史表单组件
  76. import addEnterprise from "@/views/activiti/formsActiviti/index.vue";
  77. export default {
  78. components:{
  79. addEnterprise
  80. },
  81. // 数据模型
  82. data: function() {
  83. return {
  84. instanceId:'',
  85. // 表格数据
  86. // 查询参数
  87. queryParams: {
  88. pageNum: 1,
  89. pageSize: 10
  90. },
  91. // 分页参数
  92. total: 0,
  93. pageNum: 1,
  94. pageSize: 10,
  95. tableData: [],
  96. // 弹出层标题
  97. title: '',
  98. // 是否显示弹出层
  99. open: false,
  100. //
  101. taskCommitForm:{
  102. taskId:undefined,
  103. myFormDataActiviti:{}
  104. },
  105. // 表单数据
  106. formEntity: {
  107. fId: {},
  108. modelKey: {},
  109. modulId: {},
  110. fName: {},
  111. instanceId: {},
  112. fKey: {},
  113. fVersion: {},
  114. applyUser: {},
  115. jsonData: {}
  116. },
  117. forms:{
  118. title:'查看审核流程',
  119. open:false,
  120. data:[]
  121. },
  122. // 动态表单数据
  123. formObj: {
  124. // 表单数据
  125. formData: {},
  126. formDesc: {},
  127. rules: {}
  128. },
  129. activitiImg:{
  130. title:'查看审核流程图',
  131. open:false,
  132. src:"",
  133. }
  134. }
  135. },
  136. // 初始化方法
  137. created() {
  138. // 表格初始化
  139. this.getList()
  140. },
  141. // 定义方法
  142. methods: {
  143. // 搜索按钮操作
  144. handleQuery() {
  145. this.queryParams.pageNum = 1
  146. this.getList()
  147. },
  148. reList() {
  149. this.queryParams = {
  150. pageNum: 1,
  151. pageSize: 10
  152. }
  153. this.getList()
  154. },
  155. // 获取列表数据
  156. getList() {
  157. this.loading = true
  158. list(this.addDateRange(this.queryParams)).then(
  159. response => {
  160. if (response.code === 200) {
  161. this.tableData = response.rows
  162. this.total = response.total
  163. this.loading = false
  164. }else{
  165. this.msgError(response.msg)
  166. }
  167. }
  168. )
  169. },
  170. openForm(index, row) {
  171. get(row.modelKey,row.formKey,row.modelVersion).then(
  172. response => {
  173. this.taskCommitForm.taskId = row.taskId
  174. this.formEntity = response.data
  175. this.formEntity.fId = undefined
  176. this.formEntity.instanceId=row.instanceId;
  177. let jsonData = response.data.jsonData
  178. let parse = JSON.parse(jsonData)
  179. this.formObj.formDesc = parse.formDesc
  180. this.formObj.rules = parse.rules
  181. let formData = parse.formData
  182. if (null != formData) {
  183. this.formObj.formData = parse.formData
  184. }
  185. this.open = true
  186. this.title = '审批'
  187. this.$nextTick(()=>{
  188. this.$refs.addEnterprise.showForms(row.instanceId)
  189. })
  190. }
  191. )
  192. },/*
  193. *显示流程图
  194. * */
  195. showImage(index, row) {
  196. let instanceId = row.instanceId
  197. let modelKey = row.modelKey
  198. let version = row.modelVersion
  199. instanceId = process.env.VUE_APP_BASE_URL + '/leaveNew/read-resource?processDefinitionKey=' + modelKey +'&version=' +version+ '&processInstanceId=' + instanceId+ '&t='+Math.random()
  200. this.activitiImg.open = true
  201. this.activitiImg.src = instanceId
  202. },
  203. handleRequest(data) {
  204. this.formObj.formData = data
  205. let s = JSON.stringify(this.formObj)
  206. this.formEntity.jsonData = s
  207. this.taskCommitForm.myFormDataActiviti = this.formEntity
  208. console.log(this.taskCommitForm);
  209. add(this.taskCommitForm).then(response => {
  210. if (response.code === 200) {
  211. this.msgSuccess(response.msg)
  212. this.getList()
  213. } else {
  214. this.msgError(response.msg)
  215. }
  216. })
  217. return Promise.resolve()
  218. },
  219. handleRequestSuccess() {
  220. this.$message.success('发送成功')
  221. this.getList()
  222. this.open = false
  223. },
  224. }
  225. }
  226. </script>
  227. <style scoped>
  228. </style>