Kaynağa Gözat

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

冷冷 7 yıl önce
ebeveyn
işleme
f4145a14ea

+ 64 - 0
src/api/activiti.js

@@ -0,0 +1,64 @@
+/*
+ *    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/model/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function delObj(id) {
+  return request({
+    url: '/act/model/' + id,
+    method: 'delete'
+  })
+}
+
+export function deploy(id) {
+    return request({
+        url: '/act/model/deploy/' + id,
+        method: 'post'
+    })
+}
+
+
+export function addObj(obj) {
+  return request({
+    url: '/act/model/insert',
+    method: 'post',
+    data: obj
+  })
+}
+
+export function getObj(id) {
+  return request({
+    url: '/admin/log/' + id,
+    method: 'get'
+  })
+}
+
+export function putObj(obj) {
+  return request({
+    url: '/admin/log/',
+    method: 'put',
+    data: obj
+  })
+}

+ 40 - 0
src/api/process.js

@@ -0,0 +1,40 @@
+/*
+ *    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/process',
+    method: 'get',
+    params: query
+  })
+}
+
+export function delObj(id) {
+  return request({
+    url: '/act/process/' + id,
+    method: 'delete'
+  })
+}
+
+export function status(id,type) {
+    return request({
+        url: '/act/process/status/' + id + "/" + type,
+        method: 'put'
+    })
+}

+ 4 - 3
src/config/env.js

@@ -1,9 +1,10 @@
 // 配置编译环境和线上环境之间的切换
 
-let baseUrl = '';
-let iconfontVersion = ['567566_r22zi6t8noas8aor', '567566_qo5lxgtishg', '599693_dfa50fge714', '667895_2ek3wqcg8w1', '667895_w0ofbdzuuir']
+let baseUrl = 'http://192.168.0.20:9999';
+let iconfontVersion = ['567566_r22zi6t8noas8aor', '567566_qo5lxgtishg', '599693_dfa50fge714', '667895_2ek3wqcg8w1', '667895_bywepfixwj8']
 let iconfontUrl = `//at.alicdn.com/t/font_$key.css`;
 let codeUrl = `${baseUrl}/code`
+let activitiUrl = `${baseUrl}/act`
 const env = process.env
 if (env.NODE_ENV == 'development') {
     baseUrl = ``; // 开发环境地址
@@ -18,4 +19,4 @@ export {
     iconfontVersion,
     codeUrl,
     env
-}
+}

+ 74 - 0
src/const/crud/activiti.js

@@ -0,0 +1,74 @@
+/*
+ *    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,
+  'indexLabel': '序号',
+  'stripe': true,
+  'menuAlign': 'center',
+  'menuWidth': 150,
+  'align': 'center',
+  'refreshBtn': true,
+  'showClomnuBtn': false,
+  'searchSize': 'mini',
+  'addBtn': true,
+  'editBtn': false,
+  'delBtn': false,
+  'column': [{
+      label: '模型ID',
+      prop: 'id',
+      editDisabled: true,
+      addVisdiplay: false
+  }, {
+      label: '模型标识',
+      prop: 'key',
+      editDisabled: true
+  },{
+    label: '流程分类',
+    prop: 'category',
+    search: true
+  }, {
+    label: '模型名称',
+    prop: 'name'
+  }, {
+    label: '版本号',
+    prop: 'version',
+    editDisabled: true,
+    addVisdiplay: false
+  }, {
+    label: '创建时间',
+    prop: 'createTime',
+    type: 'datetime',
+    format: 'yyyy-MM-dd HH:mm',
+    valueFormat: 'yyyy-MM-dd HH:mm:ss',
+    editDisabled: true,
+    addVisdiplay: false
+  }, {
+    label: '最后更新时间',
+    prop: 'lastUpdateTime',
+    type: 'datetime',
+    format: 'yyyy-MM-dd HH:mm',
+    valueFormat: 'yyyy-MM-dd HH:mm:ss',
+    editDisabled: true,
+    addVisdiplay: false
+  }, {
+      label: '备注',
+      prop: 'desc',
+      editVisdiplay: false,
+      hide: true
+  }]
+}

+ 59 - 0
src/const/crud/process.js

@@ -0,0 +1,59 @@
+/*
+ *    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,
+  'indexLabel': '序号',
+  'stripe': true,
+  'menuAlign': 'center',
+  'menuWidth': 150,
+  'align': 'center',
+  'refreshBtn': true,
+  'showClomnuBtn': false,
+  'searchSize': 'mini',
+  'addBtn': false,
+  'editBtn': false,
+  'delBtn': false,
+  'column': [{
+      label: '流程ID',
+      prop: 'processonDefinitionId'
+  }, {
+      label: '模型标识',
+      prop: 'key',
+      editDisabled: true
+  },{
+    label: '流程分类',
+    prop: 'category',
+    search: true
+  }, {
+    label: '模型名称',
+    prop: 'name'
+  }, {
+    label: '版本号',
+    prop: 'revision',
+    editDisabled: true,
+    addVisdiplay: false
+  }, {
+    label: '部署时间',
+    prop: 'deploymentTime',
+    type: 'datetime',
+    format: 'yyyy-MM-dd HH:mm',
+    valueFormat: 'yyyy-MM-dd HH:mm:ss',
+    editDisabled: true,
+    addVisdiplay: false
+  }]
+}

+ 1 - 1
src/main.js

@@ -63,4 +63,4 @@ new Vue({
     router,
     store,
     render: h => h(App)
-}).$mount('#app')
+}).$mount('#app')

+ 183 - 0
src/views/admin/activiti/index.vue

@@ -0,0 +1,183 @@
+<!--
+  -    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"
+                 @size-change="sizeChange"
+                 @search-change="searchChange"
+                 @refresh-change="refreshChange"
+                 @row-save="handleSave"
+                 @row-del="rowDel">
+        <template slot-scope="scope"
+                  slot="menu">
+          <a :href="actUrl + scope.row.id" target="_blank" type="primary" icon="el-icon-view">模型图</a>
+          <el-button type="success"
+                     v-if="permissions.sys_log_del"
+                     icon="el-icon-upload"
+                     size="mini"
+                     plain
+                     @click="handleDeploy(scope.row,scope.index)">部署</el-button>
+          <el-button type="danger"
+                     v-if="permissions.sys_log_del"
+                     icon="el-icon-delete"
+                     size="mini"
+                     plain
+                     @click="handleDel(scope.row,scope.index)">删除</el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+  import { fetchList, delObj, addObj, deploy } from '@/api/activiti'
+  import { tableOption } from '@/const/crud/activiti'
+  import { mapGetters } from 'vuex'
+  export default {
+    name: 'activiti',
+    data() {
+      return {
+        actUrl: '',
+        tableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        listQuery: {
+          page: 1,
+          limit: 20,
+          category: undefined
+        },
+        tableLoading: false,
+        tableOption: tableOption
+      }
+    },
+    created() {
+      this.actUrl = `http://192.168.0.20:9999/act/modeler.html?modelId=`
+      this.getList()
+    },
+    mounted: function() { },
+    computed: {
+      ...mapGetters(['permissions'])
+    },
+    methods: {
+      getList() {
+        this.tableLoading = true
+        this.listQuery.orderByField = 'create_time'
+        this.listQuery.isAsc = false
+        fetchList(this.listQuery).then(response => {
+          this.tableData = response.data.records
+          this.page.total = response.data.total
+          this.tableLoading = false
+        })
+      },
+      currentChange(val) {
+        this.listQuery.page = val
+        this.getList()
+      },
+      sizeChange(val) {
+        this.listQuery.limit = val
+        this.getList()
+      },
+      handleDel(row, index) {
+        this.$refs.crud.rowDel(row, index)
+      },
+      handleDeploy: function(row, index) {
+        var _this = this
+        this.$confirm('是否确认部署ID为"' + row.id + '"的模型?', '警告', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+        }).then(function() {
+                return deploy(row.id)
+            })
+            .then(data => {
+                this.getList()
+                _this.$message({
+                    showClose: true,
+                    message: '部署成功',
+                    type: 'success'
+                })
+            })
+            .catch(function(err) { })
+      },
+      rowDel: function(row, index) {
+        var _this = this
+        this.$confirm('是否确认删除ID为"' + row.id + '"的模型?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(function() {
+            return delObj(row.id)
+          })
+          .then(data => {
+            this.getList()
+            _this.$message({
+              showClose: true,
+              message: '删除成功',
+              type: 'success'
+            })
+          })
+          .catch(function(err) { })
+      },
+      /**
+       * @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()
+          })
+      },
+      /**
+       * 搜索回调
+       */
+      searchChange(form) {
+        this.listQuery.category = form.category
+        this.getList()
+      },
+      /**
+       * 刷新回调
+       */
+      refreshChange() {
+        this.getList()
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+</style>
+

+ 182 - 0
src/views/admin/activiti/process.vue

@@ -0,0 +1,182 @@
+<!--
+  -    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"
+                 @size-change="sizeChange"
+                 @search-change="searchChange"
+                 @refresh-change="refreshChange"
+                 @row-del="rowDel">
+        <template slot-scope="scope"
+                  slot="menu">
+          <el-button type="success"
+                     v-if="permissions.sys_log_del"
+                     icon="el-icon-view"
+                     size="mini"
+                     plain
+                     @click="handlePic(scope.row,scope.index)">流程图</el-button>
+          <el-button type="warning"
+                     v-if="permissions.sys_log_del && scope.row.suspend"
+                     icon="el-icon-circle-check"
+                     size="mini"
+                     plain
+                     @click="handleStatus(scope.row,'active')">激活</el-button>
+          <el-button type="warning"
+                     v-if="permissions.sys_log_del && !scope.row.suspend"
+                     icon="el-icon-circle-close"
+                     size="mini"
+                     plain
+                     @click="handleStatus(scope.row,'suspend')">失效</el-button>
+          <el-button type="danger"
+                     v-if="permissions.sys_log_del"
+                     icon="el-icon-delete"
+                     size="mini"
+                     plain
+                     @click="handleDel(scope.row,scope.index)">删除</el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <el-dialog
+            title="流程图"
+            :visible.sync="showPicDialog">
+      <img :src="actPicUrl">
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { fetchList, delObj, addObj, status} from '@/api/process'
+  import { tableOption } from '@/const/crud/process'
+  import { mapGetters } from 'vuex'
+  export default {
+    name: 'process',
+    data() {
+      return {
+        showPicDialog: false,
+        actPicUrl: '',
+        tableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        listQuery: {
+          page: 1,
+          limit: 20,
+          category: undefined
+        },
+        tableLoading: false,
+        tableOption: tableOption
+      }
+    },
+    created() {
+      this.getList()
+    },
+    mounted: function() { },
+    computed: {
+      ...mapGetters(['permissions'])
+    },
+    methods: {
+      getList() {
+        this.tableLoading = true
+        this.listQuery.orderByField = 'create_time'
+        this.listQuery.isAsc = false
+        fetchList(this.listQuery).then(response => {
+          this.tableData = response.data.records
+          this.page.total = response.data.total
+          this.tableLoading = false
+        })
+      },
+      currentChange(val) {
+        this.listQuery.page = val
+        this.getList()
+      },
+      sizeChange(val) {
+        this.listQuery.limit = val
+        this.getList()
+      },
+      handlePic(row, index) {
+          this.actPicUrl = `http://192.168.0.20:9999/act/process/resource/`+row.deploymentId + '/' + row.processonDefinitionId + "/image"
+          this.showPicDialog = true
+      },
+      handleStatus(row, type) {
+          var _this = this
+          this.$confirm('是否确认操作ID为"' + row.processonDefinitionId + '"的流程?', '警告', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          }).then(function() {
+                return status(row.processonDefinitionId,type)
+            }).then(data => {
+                this.getList()
+                _this.$message({
+                    showClose: true,
+                    message: '操作成功',
+                    type: 'success'
+                })
+            }).catch(function(err) { })
+      },
+      handleDel(row, index) {
+        this.$refs.crud.rowDel(row, index)
+      },
+      rowDel: function(row, index) {
+        var _this = this
+        this.$confirm('是否确认删除ID为"' + row.deploymentId + '"的模型?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(function() {
+            return delObj(row.deploymentId)
+          })
+          .then(data => {
+            this.getList()
+            _this.$message({
+              showClose: true,
+              message: '删除成功',
+              type: 'success'
+            })
+          })
+          .catch(function(err) { })
+      },
+      /**
+       * 搜索回调
+       */
+      searchChange(form) {
+        this.listQuery.category = form.category
+        this.getList()
+      },
+      /**
+       * 刷新回调
+       */
+      refreshChange() {
+        this.getList()
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+</style>
+

+ 2 - 2
src/views/admin/role/index.vue

@@ -338,7 +338,7 @@ export default {
       })
     },
     handlePermission (row) {
-      fetchRoleTree(row.roleCode)
+      fetchRoleTree(row.roleId)
         .then(response => {
           this.checkedKeys = response.data
           return fetchTree()
@@ -451,7 +451,7 @@ export default {
         fetchTree()
           .then(response => {
             this.treeData = response.data
-            return fetchRoleTree(roleCode)
+            return fetchRoleTree(roleId)
           })
           .then(response => {
             this.checkedKeys = response.data

+ 9 - 2
vue.config.js

@@ -1,4 +1,4 @@
-const url = 'http://pigx.pigx.top'
+const url = 'http://192.168.0.20:9999'
 module.exports = {
     lintOnSave: true,
     productionSourceMap: false,
@@ -57,6 +57,13 @@ module.exports = {
                     '^/tx': '/tx'
                 }
             },
+            '/act': {
+                target: url,
+                ws: true,
+                pathRewrite: {
+                    '^/act': '/act'
+                }
+            },
         }
     }
-}
+}