123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <template xmlns="http://www.w3.org/1999/html">
- <div class="app-container">
- <el-form :inline="true">
- <el-form-item label="标题">
- <el-input
- v-model="queryParams.title"
- placeholder="请输入标题"
- clearable
- size="small"
- style="width: 240px"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button type="info" icon="el-icon-refresh-right" size="mini" @click="reList">清空</el-button>
- <el-button type="success" icon="el-icon-plus" size="mini" @click="dialogVisible = true">新增</el-button>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" ref="multipleTable" :data="tableData" @selection-change="handleSelectionChange">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column label="序号" type="index" align="center">
- <template slot-scope="scope">
- <span>{{ (queryParams.pageNum-1) * queryParams.pageSize + (scope.$index + 1) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="模型key" prop="modelKey"/>
- <el-table-column label="表单名称" prop="fName"/>
- <el-table-column label="创建时间" prop="createTime"/>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <template v-if="scope.row.instanceId==null">
- <el-button
- size="mini" type="success"
- @click="handleSumbit(scope.$index, scope.row)">提交流程
- </el-button>
- <el-button
- size="mini" type="primary"
- @click="handleUpdate(scope.$index, scope.row)">编辑
- </el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleDelete(scope.$index, scope.row)">删除
- </el-button>
- </template>
- <template v-else>
- <el-button
- size="mini" type="success"
- @click="showForms(scope.$index, scope.row)">查看
- </el-button>
- <el-button
- size="mini" type="warning"
- @click="showImage(scope.$index, scope.row)">进度查看
- </el-button>
- </template>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <el-dialog
- title="选择流程模型"
- :visible.sync="dialogVisible"
- width="350px"
- >
- <template>
- <el-select v-model="processKey" placeholder="请选择">
- <el-option
- v-for="item in leaveSelect"
- :key="item.value"
- :label="item.text"
- :value="item.value">
- </el-option>
- </el-select>
- </template>
- <el-button type="success" icon="el-icon-plus" size="mini" @click="handleAdd">下一步</el-button>
- </el-dialog>
- <!-- 添加或修改角色配置对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="1000px">
- <template>
- <ele-form
- :isShowSubmitBtn=true
- :isShowBackBtn=false
- :isShowResetBtn=true
- :rules="formObj.rules"
- :form-desc="formObj.formDesc"
- :form-data="formObj.formData"
- :request-fn="handleRequest"
- @request-success="handleRequestSuccess"
- ></ele-form>
- </template>
- </el-dialog>
- <!--查看审核流程表单-->
- <el-dialog :title="forms.title" :visible.sync="forms.open" width="1000px">
- <!--历史表单组件-->
- <addEnterprise ref="addEnterprise"/>
- </el-dialog>
- <!--显示流程图标签-->
- <el-dialog :title="activitiImg.title" :visible.sync="activitiImg.open" width="1000px">
- <el-image :src="activitiImg.src"></el-image>
- </el-dialog>
- </div>
- </template>
- <script>
- import { select, add, list, get, getForm, update, delTitle, submitApply, } from '@/api/activiti/leaveNew.js';
- //流程历史表单组件
- import addEnterprise from "@/views/activiti/formsActiviti/index.vue";
- export default {
- components:{
- addEnterprise
- },
- data: function() {
- return {
- instanceId:'',
- dialogVisible: false,
- //表格数据
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10
- },
- // 分页参数
- total: 0,
- pageNum: 1,
- pageSize: 10,
- tableData: [],
- //删除id
- multipleSelection: [],
- // 表单参数
- // 弹出层标题
- title: '',
- // 是否显示弹出层
- open: false,
- processKey: '',
- //部署文件下拉
- leaveSelect: [],
- // 表单数据
- formEntity: {
- fId: {},
- modelKey: {},
- modulId: {},
- fName: {},
- instanceId: {},
- fKey: {},
- fVersion: {},
- applyUser: {},
- jsonData: {}
- },
- //动态表单数据
- formObj: {
- // 表单数据
- formData: {},
- formDesc: {},
- rules: {}
- },
- forms: {
- title: '查看审核流程',
- open: false,
- data: []
- },
- activitiImg: {
- title: '查看审核流程图',
- open: false,
- src: ''
- }
- }
- },
- // 初始化方法
- created() {
- //表格初始化
- this.getList()
- //下拉框初始化
- this.select()
- },
- methods: {
- handleSelectionChange(val) {
- this.multipleSelection = []
- for (let i = 0; i < val.length; i++) {
- this.multipleSelection[i] = val[i].id
- }
- },
- //部署文件下啦方法
- select() {
- select().then(
- response => {
- console.log(response)
- this.leaveSelect = response.data
- }
- )
- },
- /** 查询角色列表 */
- getList() {
- this.loading = true
- list(this.addDateRange(this.queryParams)).then(
- response => {
- this.tableData = response.rows
- this.total = response.total
- this.loading = false
- }
- )
- }
- ,
- deleteTi() {
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
- confirmButtonText: '确定 ',
- cancelButtonText: '取消 ',
- type: 'warning',
- center: true
- }).then(() => {
- let ids = this.multipleSelection
- if (ids.length === 0) {
- this.msgError('你没有选择文章')
- return
- }
- delTitle(ids)
- this.msgSuccess('成功')
- this.reIds()
- this.reList()
- }).catch(() => {
- this.msgSuccess('已取消删除')
- })
- }
- ,
- reIds() {
- this.multipleSelection = []
- }
- ,
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1
- this.getList()
- }
- ,
- reList() {
- this.queryParams = {
- pageNum: 1,
- pageSize: 10
- }
- this.getList()
- },
- // 重置表单新增使用
- reset() {
- this.formObj.formDesc = {}
- this.formObj.rules = {}
- this.formObj.formData = {}
- this.resetForm('form')
- },
- //表单
- handleAdd() {
- dialogVisible: false
- this.reset()
- getForm(this.processKey).then(
- response => {
- this.formEntity = response.data
- this.formEntity.fId = undefined
- let jsonData = response.data.jsonData
- let parse = JSON.parse(jsonData)
- this.formObj.formDesc = parse.formDesc
- this.formObj.rules = parse.rules
- let formData = parse.formData
- if (null != formData) {
- this.formObj.formData = parse.formData
- }
- this.open = true
- this.title = '添加文章'
- }
- )
- },
- /*
- 打开编辑表单窗口
- * */
- handleUpdate(index, row) {
- dialogVisible: false
- this.reset()
- get(row.fId).then(
- response => {
- this.formEntity = response.data
- let jsonData = response.data.jsonData
- let parse = JSON.parse(jsonData)
- this.formObj.formDesc = parse.formDesc
- this.formObj.rules = parse.rules
- let formData = parse.formData
- if (null != formData) {
- this.formObj.formData = parse.formData
- }
- this.open = true
- this.title = '修改'
- }
- )
- },
- /*删除数据*/
- handleDelete(index, row) {
- var ids = []
- ids[0] = row.fId
- delTitle(ids).then(response => {
- if (response.code === 200) {
- this.msgSuccess('成功')
- this.open = false
- this.getList()
- } else {
- this.msgError(response.msg)
- }
- })
- },
- /*
- *显示流程表单
- * */
- showForms(index, row) {
- this.forms.open = true
- this.forms.title = '查看审核流程'
- this.$nextTick(()=>{
- this.$refs.addEnterprise.showForms(row.instanceId)
- })
- },
- showImage(index, row) {
- let instanceId = row.instanceId
- let modelKey = row.modelKey
- let version = row.modelVersion
- instanceId = process.env.VUE_APP_BASE_URL + '/leaveNew/read-resource?processDefinitionKey=' + modelKey +'&version=' +version+ '&processInstanceId=' + instanceId+ '&t='+Math.random()
- this.activitiImg.open = true
- this.activitiImg.src = instanceId
- },
- /**
- * 新增或跟新表单数据
- */
- handleRequest(data) {
- this.dialogVisible = false
- this.formObj.formData = data
- let s = JSON.stringify(this.formObj)
- this.formEntity.jsonData = s
- if (this.formEntity.fId === undefined) {
- add(this.formEntity).then(response => {
- if (response.code === 200) {
- this.getList()
- } else {
- this.msgError(response.msg)
- }
- })
- } else {
- update(this.formEntity).then(response => {
- if (response.code === 200) {
- this.msgSuccess(response.msg)
- this.getList()
- } else {
- this.msgError(response.msg)
- }
- })
- }
- return Promise.resolve()
- },
- handleRequestSuccess() {
- this.$message.success('发送成功')
- this.getList()
- this.open = false
- },
- /**
- * 提交审核信息
- * @param index
- * @param row
- */
- handleSumbit(index, row) {
- console.log(index, row)
- submitApply(row.fId).then(response => {
- if (response.code === 200) {
- this.msgSuccess(response.msg)
- this.getList()
- } else {
- this.msgError(response.msg)
- }
- })
- },
- }
- }
- </script>
|