Kaynağa Gözat

:sparkles: 添加新特性。 工作流

冷冷 7 yıl önce
ebeveyn
işleme
219890c29e

+ 1 - 1
src/api/activiti.js

@@ -19,7 +19,7 @@ import request from '@/router/axios'
 
 export function fetchList(query) {
   return request({
-    url: '/act/model/list',
+    url: '/act/model',
     method: 'get',
     params: query
   })

+ 63 - 0
src/api/leavebill.js

@@ -0,0 +1,63 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+import request from '@/router/axios'
+
+export function fetchList(query) {
+  return request({
+    url: '/act/leavebill/page',
+    method: 'get',
+    params: query
+  })
+}
+
+export function addObj(obj) {
+  return request({
+    url: '/act/leavebill/',
+    method: 'post',
+    data: obj
+  })
+}
+
+export function getObj(id) {
+  return request({
+    url: '/act/leavebill/' + id,
+    method: 'get'
+  })
+}
+
+export function submit(id) {
+    return request({
+        url: '/act/leavebill/submit/' + id,
+        method: 'get'
+    })
+}
+
+export function delObj(id) {
+  return request({
+    url: '/act/leavebill/' + id,
+    method: 'delete'
+  })
+}
+
+export function putObj(obj) {
+  return request({
+    url: '/act/leavebill/',
+    method: 'put',
+    data: obj
+  })
+}

+ 55 - 0
src/api/task.js

@@ -0,0 +1,55 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+import request from '@/router/axios'
+
+export function fetchList(query) {
+  return request({
+    url: '/act/task/todo',
+    method: 'get',
+    params: query
+  })
+}
+
+export function fetchDetail(id) {
+    return request({
+        url: '/act/task/'+id,
+        method: 'get'
+    })
+}
+
+export function fetchComment(id) {
+    return request({
+        url: '/act/task/comment/'+id,
+        method: 'get'
+    })
+}
+
+export function fetchTask(id) {
+    return request({
+        url: '/act/task/view/'+id,
+        method: 'get'
+    })
+}
+
+export function doTask(obj) {
+    return request({
+        url: '/act/task',
+        method: 'post',
+        data: obj
+    })
+}

+ 2 - 2
src/config/env.js

@@ -2,7 +2,7 @@
 
 const env = process.env
 let baseUrl = '';
-let iconfontVersion = ['567566_r22zi6t8noas8aor', '567566_qo5lxgtishg', '599693_dfa50fge714', '667895_2ek3wqcg8w1', '667895_bywepfixwj8']
+let iconfontVersion = ['667895_5lt01cjobo7']
 let iconfontUrl = `//at.alicdn.com/t/font_$key.css`;
 let codeUrl = `/code`
 let actUrl = `${window.origin}/act/modeler.html?modelId=`;
@@ -20,4 +20,4 @@ export {
     iconfontVersion,
     codeUrl,
     env
-}
+}

+ 61 - 0
src/const/crud/leavebill.js

@@ -0,0 +1,61 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+export const tableOption = {
+  'border': true,
+  'index': true,
+  'stripe': true,
+  'menuAlign': "center",
+  'align': "center",
+  menuBtn: true,
+  'editBtn': false,
+  'delBtn': false,
+  'addBtn': false,
+  'dic': [],
+  'column': [
+	  {
+      label: 'ID',
+      prop: 'leaveId',
+      editDisabled: true,
+      addVisdiplay: false
+    },
+	  {
+      label: '申请人',
+      prop: 'username',
+      editDisabled: true,
+      addVisdiplay: false
+    },
+	  {
+      label: '天数',
+      prop: 'days'
+    },
+	  {
+      label: '请假时间',
+      prop: 'createTime',
+      type: 'datetime',
+      format: 'yyyy-MM-dd HH:mm'
+    },
+    {
+        label: '备注',
+        prop: 'content'
+    },
+    {
+        label: '状态',
+        prop: 'state'
+    }
+  ]
+}

+ 141 - 0
src/const/crud/task.js

@@ -0,0 +1,141 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+export const tableOption = {
+    'border': true,
+    'index': true,
+    'stripe': true,
+    'menuAlign': "center",
+    'align': "center",
+    'menuBtn': true,
+    'editBtn': false,
+    'delBtn': false,
+    'addBtn': false,
+    'dic': [],
+    'column': [
+        {
+            label: 'ID',
+            prop: 'taskId',
+            editDisabled: true,
+            addVisdiplay: false
+        },
+        {
+            label: '任务名称',
+            prop: 'taskName',
+            editDisabled: true,
+            addVisdiplay: false
+        },
+        {
+            label: '提交时间',
+            prop: 'time',
+            type: 'datetime',
+            format: 'yyyy-MM-dd HH:mm'
+        }
+    ]
+}
+export const formOption = {
+    submitBtn: false,
+    emptytBtn: false,
+    row:true,
+    span:12,
+    column: [
+        {
+            label: "任务编号",
+            prop: "taskId",
+            disabled: true
+        },
+        {
+            label: "任务名称",
+            prop: "taskName",
+            disabled: true
+        },
+        {
+            label: "申请人",
+            prop: "username",
+            disabled: true
+        },
+        {
+            label: "请假时长",
+            prop: "days",
+            disabled: true
+        },
+        {
+            label: "请假时间",
+            prop: "createTime",
+            type: 'datetime',
+            format: 'yyyy-MM-dd HH:mm',
+            disabled: true
+        },
+        {
+            label: '提交时间',
+            prop: 'time',
+            type: 'datetime',
+            format: 'yyyy-MM-dd HH:mm',
+            disabled: true
+        },
+        {
+            label: '事由',
+            prop: 'content',
+            type:'textarea',
+            minRows:2,
+            row:true,
+            span:24,
+            disabled: true
+        },
+        {
+            label: '批注',
+            prop: 'comment',
+            type:'textarea',
+            minRows:2,
+            row:true,
+            span:24,
+            rules: [{
+                required: true,
+                message: "请输入备注",
+                trigger: "blur"
+            }]
+        }
+    ]
+}
+
+export const taskOption = {
+        menu:false,
+        page:false,
+        addBtn:false,
+        align:'center',
+        menuAlign:'center',
+        column:[
+        {
+            label:'id',
+            prop:'id',
+            hide: true
+        },
+        {
+            label:'用户',
+            prop:'username'
+        },
+        {
+            label:'批注',
+            prop:'fullMessage'
+        },{
+            label: "操作时间",
+            prop: "time",
+            type: "datetime",
+            format: "yyyy-MM-dd hh:mm:ss",
+            valueFormat: "yyyy-MM-dd hh:mm:ss",
+        }
+    ]
+}

+ 205 - 0
src/views/admin/activiti/leave.vue

@@ -0,0 +1,205 @@
+<!--
+  -    Copyright (c) 2018-2025, lengleng All rights reserved.
+  -
+  - Redistribution and use in source and binary forms, with or without
+  - modification, are permitted provided that the following conditions are met:
+  -
+  - Redistributions of source code must retain the above copyright notice,
+  - this list of conditions and the following disclaimer.
+  - Redistributions in binary form must reproduce the above copyright
+  - notice, this list of conditions and the following disclaimer in the
+  - documentation and/or other materials provided with the distribution.
+  - Neither the name of the pig4cloud.com developer nor the names of its
+  - contributors may be used to endorse or promote products derived from
+  - this software without specific prior written permission.
+  - Author: lengleng (wangiegie@gmail.com)
+  -->
+
+<template>
+  <div class="app-container pull-auto">
+    <basic-container>
+      <avue-crud ref="crud"
+                 :page="page"
+                 :data="tableData"
+                 :table-loading="tableLoading"
+                 :option="tableOption"
+                 @current-change="currentChange"
+                 @refresh-change="refreshChange"
+                 @size-change="sizeChange"
+                 @row-update="handleUpdate"
+                 @row-save="handleSave"
+                 @row-del="rowDel">
+        <template slot="menuLeft">
+          <el-button type="primary"
+                     @click="handleAdd"
+                     size="small"
+                     v-if="permissions.act_leavebill_add">新 增</el-button>
+        </template>
+        <template slot-scope="scope"
+                  slot="dropMenu">
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_edit && scope.row.state == 0"
+                            @click.native="handleSubmit(scope.row,scope.index)">提交</el-dropdown-item>
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_edit"
+                            @click.native="handleEdit(scope.row,scope.index)">编辑</el-dropdown-item>
+
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_del"
+                            @click.native="handleDel(scope.row,'suspend')">删除</el-dropdown-item>
+        </template>
+      </avue-crud>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+  import { fetchList, getObj, addObj, putObj, delObj,submit } from '@/api/leavebill'
+  import { tableOption } from '@/const/crud/leavebill'
+  import { mapGetters } from 'vuex'
+  export default {
+    name: 'leavebill',
+    data() {
+      return {
+        tableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        listQuery: {
+          page: 1,
+          limit: 20
+        },
+        tableLoading: false,
+        tableOption: tableOption
+      }
+    },
+    created() {
+      this.getList()
+    },
+    mounted: function() { },
+    computed: {
+      ...mapGetters(['permissions'])
+  },
+  methods: {
+    getList() {
+      this.tableLoading = true
+      fetchList(this.listQuery).then(response => {
+        this.tableData = response.data.records
+        this.page.total = response.data.total
+        this.tableLoading = false
+    })
+    },
+    currentChange(val) {
+      this.page.currentPage = val
+      this.listQuery.page = val
+      this.getList()
+    },
+    sizeChange(val) {
+      this.page.pageSize = val
+      this.listQuery.limit = val
+      this.getList()
+    },
+    /**
+     * @title 打开新增窗口
+     * @detail 调用crud的handleadd方法即可
+     *
+     **/
+    handleAdd: function() {
+      this.$refs.crud.rowAdd()
+    },
+    handleEdit(row, index) {
+      this.$refs.crud.rowEdit(row, index)
+    },
+    handleDel(row, index) {
+      this.$refs.crud.rowDel(row, index)
+    },
+    rowDel: function(row, index) {
+      var _this = this
+      this.$confirm('是否确认删除ID为' + row.leaveId, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(function() {
+          return delObj(row.leaveId)
+        })
+        .then(data => {
+        _this.tableData.splice(index, 1)
+      _this.$message({
+        showClose: true,
+        message: '删除成功',
+        type: 'success'
+      })
+    })
+    .catch(function(err) { })
+    },
+    handleSubmit: function(row, index) {
+          var _this = this
+          this.$confirm('是否确认提交ID为' + row.leaveId, '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          }).then(function() {
+                  return submit(row.leaveId)
+          }).then(data => {
+                  _this.tableData.splice(index, 1)
+                  _this.$message({
+                      showClose: true,
+                      message: '提交成功',
+                      type: 'success'
+                  })
+                this.getList()
+            }).catch(function(err) { })
+      },
+    /**
+     * @title 数据更新
+     * @param row 为当前的数据
+     * @param index 为当前更新数据的行数
+     * @param done 为表单关闭函数
+     *
+     **/
+    handleUpdate: function(row, index, done) {
+      putObj(row).then(data => {
+        this.tableData.splice(index, 1, Object.assign({}, row))
+      this.$message({
+        showClose: true,
+        message: '修改成功',
+        type: 'success'
+      })
+      done()
+      this.getList()
+    })
+    },
+    /**
+     * @title 数据添加
+     * @param row 为当前的数据
+     * @param done 为表单关闭函数
+     *
+     **/
+    handleSave: function(row, done) {
+      addObj(row).then(data => {
+        this.tableData.push(Object.assign({}, row))
+      this.$message({
+        showClose: true,
+        message: '添加成功',
+        type: 'success'
+      })
+      done()
+      this.getList()
+    })
+    },
+    /**
+     * 刷新回调
+     */
+    refreshChange() {
+      this.getList()
+    }
+  }
+  }
+</script>
+
+<style lang="scss" scoped>
+</style>
+

+ 2 - 2
src/views/admin/activiti/process.vue

@@ -40,11 +40,11 @@
 
           <el-dropdown-item divided
                             v-if="permissions.sys_log_del && !scope.row.suspend"
-                            @click="handleStatus(scope.row,'suspend')">失效</el-dropdown-item>
+                            @click.native="handleStatus(scope.row,'suspend')">失效</el-dropdown-item>
 
           <el-dropdown-item divided
                             v-if="permissions.sys_log_del"
-                            @click="handleDel(scope.row,'suspend')">删除</el-dropdown-item>
+                            @click.native="handleDel(scope.row,'suspend')">删除</el-dropdown-item>
         </template>
       </avue-crud>
     </basic-container>

+ 197 - 0
src/views/admin/activiti/task.vue

@@ -0,0 +1,197 @@
+<!--
+  -    Copyright (c) 2018-2025, lengleng All rights reserved.
+  -
+  - Redistribution and use in source and binary forms, with or without
+  - modification, are permitted provided that the following conditions are met:
+  -
+  - Redistributions of source code must retain the above copyright notice,
+  - this list of conditions and the following disclaimer.
+  - Redistributions in binary form must reproduce the above copyright
+  - notice, this list of conditions and the following disclaimer in the
+  - documentation and/or other materials provided with the distribution.
+  - Neither the name of the pig4cloud.com developer nor the names of its
+  - contributors may be used to endorse or promote products derived from
+  - this software without specific prior written permission.
+  - Author: lengleng (wangiegie@gmail.com)
+  -->
+
+<template>
+  <div class="app-container pull-auto">
+    <basic-container>
+      <avue-crud ref="crud"
+                 :page="page"
+                 :data="tableData"
+                 :table-loading="tableLoading"
+                 :option="tableOption"
+                 @current-change="currentChange"
+                 @refresh-change="refreshChange"
+                 @size-change="sizeChange">
+        <template slot-scope="scope"
+                  slot="dropMenu">
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_edit"
+                            @click.native="audit(scope.row,scope.index)">审批</el-dropdown-item>
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_edit"
+                            @click.native="comment(scope.row,scope.index)">批注</el-dropdown-item>
+          <el-dropdown-item divided
+                            v-if="permissions.act_leavebill_edit"
+                            @click.native="viewPic(scope.row,scope.index)">流程图</el-dropdown-item>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <el-dialog title="查看任务"
+               :visible.sync="showTask">
+      <avue-form ref="form" v-model="obj" :option="formOption">
+        <template slot-scope="scope" slot="menuForm">
+          <el-button type="primary"
+                     icon="el-icon-check"
+                     size="small"
+                     @click="handleTask(scope.row,'1')"
+                     plain>同意</el-button>
+          <el-button type="danger"
+                     icon="el-icon-check"
+                     size="small"
+                     @click="handleTask(scope.row,'0')"
+                     plain>驳回</el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+    <el-dialog title="批注列表"
+               :visible.sync="showComment">
+      <avue-crud :data="taskTableData" :option="taskOption"></avue-crud>
+    </el-dialog>
+    <el-dialog title="流程图"
+               :visible.sync="showPicDialog">
+      <img :src="actPicUrl">
+      <div :style="picStype" v-if="showPicDialog"/>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { fetchList,fetchDetail,doTask,fetchTask,fetchComment} from '@/api/task'
+  import { tableOption,formOption,taskOption } from '@/const/crud/task'
+  import { mapGetters } from 'vuex'
+  export default {
+    name: 'task',
+    data() {
+      return {
+        picStype:'',
+        actPicUrl:'',
+        obj: {},
+        showTask: false,
+        showComment: false,
+        showPicDialog: false,
+        tableData: [],
+        taskTableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        listQuery: {
+          page: 1,
+          limit: 20
+        },
+        tableLoading: false,
+        tableOption: tableOption,
+        formOption: formOption,
+        taskOption:taskOption,
+      }
+    },
+    created() {
+      this.getList()
+    },
+    mounted: function() { },
+    computed: {
+      ...mapGetters(['permissions'])
+  },
+  methods: {
+    getList() {
+      this.tableLoading = true
+      fetchList(this.listQuery).then(response => {
+        this.tableData = response.data.records
+        this.page.total = response.data.total
+        this.tableLoading = false
+    })},
+    currentChange(val) {
+      this.page.currentPage = val
+      this.listQuery.page = val
+      this.getList()
+    },
+    sizeChange(val) {
+      this.page.pageSize = val
+      this.listQuery.limit = val
+      this.getList()
+    },
+    audit:function(row, index) {
+        fetchDetail(row.taskId).then(response => {
+          this.obj = response.data.data
+        })
+        fetchComment(row.taskId).then(response => {
+            this.taskTableData = response.data.data
+        })
+        this.obj = row
+        this.showTask = true
+    },
+    comment:function(row, index) {
+        fetchComment(row.taskId).then(response => {
+            this.taskTableData = response.data.data
+        })
+        this.showComment = true
+    },
+    handleSubmit: function(row, index) {
+          var _this = this
+          this.$confirm('是否确认提交ID为' + row.leaveId, '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          })
+              .then(function() {
+                  return submit(row.leaveId)
+              })
+              .then(data => {
+                  _this.tableData.splice(index, 1)
+                  _this.$message({
+                      showClose: true,
+                      message: '提交成功',
+                      type: 'success'
+                  })
+              })
+              .catch(function(err) { })
+      },
+    handleTask: function(row, result) {
+        this.obj.result = result
+        doTask(this.obj).then(response =>{
+            this.$message({
+                showClose: true,
+                message: '提交成功',
+                type: 'success'
+            })
+            done()
+            this.getList()
+        })
+    },
+    viewPic: function(row, index) {
+      fetchTask(row.taskId).then(response => {
+          let res = response.data.data
+          this.actPicUrl = `/act/process/resource/` + res.deploymentId + '/' + res.processonDefinitionId + "/image"
+          // 动态画框
+          this.picStype = 'position: absolute;border:2px solid red;top:'+(res.yaxis + 80) +'px;left:'+(res.xaxis + 20)+'px;width:'+res.width+'px;height:'+res.height+'px;'
+      })
+      this.showPicDialog = true
+    },
+    /**
+     * 刷新回调
+     */
+    refreshChange() {
+      this.getList()
+    }
+  }
+  }
+</script>
+
+<style lang="scss" scoped>
+</style>
+