xiongzhu пре 7 година
родитељ
комит
35e95f73c2

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/UserInfoMapper.java

@@ -31,5 +31,7 @@ public interface UserInfoMapper {
     UserInfo queryUserInfo(UserInfo record);
 
     UserInfo login(Map<String, Object> parameter);
+
+    List<String> findDepartLeader(String userId);
 }
 

+ 10 - 0
src/main/java/com/izouma/awesomeadmin/dao/UserInfoMapper.xml

@@ -427,6 +427,16 @@
         from user_info
         WHERE username = #{username} AND password = #{password} AND del_flag = 'N'
     </select>
+    <select id="findDepartLeader" resultType="java.lang.String">
+        SELECT
+            *
+        FROM
+            user_info
+        WHERE
+            role_id = ( SELECT role_id FROM user_info WHERE id = #{userId} )
+            AND FIND_IN_SET( 9, role_id )
+            AND del_flag = 'N'
+    </select>
     <update id="delete">
         UPDATE user_info SET del_flag = 'Y'
         <where>

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/UserInfoService.java

@@ -29,5 +29,7 @@ public interface UserInfoService {
     UserInfo login(String username, String password);
 
     UserInfo loginSms(String phone, String code, String sessionId) throws UserInfoServiceImpl.LoginException;
+
+    List<String> findDepartLeader(String userId);
 }
 

+ 3 - 1
src/main/java/com/izouma/awesomeadmin/service/impl/DepartInfoServiceImpl.java

@@ -3,6 +3,9 @@ package com.izouma.awesomeadmin.service.impl;
 import java.util.*;
 
 import com.izouma.awesomeadmin.dto.TreeNode;
+import com.izouma.awesomeadmin.model.SysRole;
+import com.izouma.awesomeadmin.model.UserInfo;
+import com.izouma.awesomeadmin.service.SysRoleService;
 import com.izouma.awesomeadmin.service.UserInfoService;
 import com.izouma.awesomeadmin.util.TreeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -193,7 +196,6 @@ public class DepartInfoServiceImpl implements DepartInfoService {
         return null;
     }
 
-
     private List removeDuplicate(List list) {
         HashSet h = new HashSet(list);
         list.clear();

+ 13 - 2
src/main/java/com/izouma/awesomeadmin/service/impl/UserInfoServiceImpl.java

@@ -26,8 +26,8 @@ import com.izouma.awesomeadmin.service.UserInfoService;
 @Service
 public class UserInfoServiceImpl implements UserInfoService {
 
-    private static Logger logger = Logger.getLogger(UserInfoServiceImpl.class);
-    private RongCloud rongCloud = RongCloud.getInstance(PropertiesFileLoader.getProperties("rongyunappkey"), PropertiesFileLoader.getProperties("rongyunappsecret"));
+    private static Logger    logger    = Logger.getLogger(UserInfoServiceImpl.class);
+    private        RongCloud rongCloud = RongCloud.getInstance(PropertiesFileLoader.getProperties("rongyunappkey"), PropertiesFileLoader.getProperties("rongyunappsecret"));
 
 
     @Autowired
@@ -196,6 +196,17 @@ public class UserInfoServiceImpl implements UserInfoService {
         throw new LoginException("验证码错误");
     }
 
+    @Override
+    public List<String> findDepartLeader(String userId) {
+        logger.info("findDepartLeader");
+        try {
+            return userInfoMapper.findDepartLeader(userId);
+        } catch (Exception e) {
+            logger.error("findDepartLeader", e);
+        }
+        return null;
+    }
+
     public class LoginException extends Exception {
         public LoginException(String message) {
             super(message);

+ 7 - 1
src/main/resources/spring/applicationContext.xml

@@ -99,13 +99,19 @@
                 </bean>
             </list>
         </property>
+        <property name="beans">
+            <map>
+                <entry key="userService" value-ref="userInfoService"/>
+            </map>
+        </property>
     </bean>
 
     <bean id="customUserEntityManager" class="com.izouma.awesomeadmin.activiti.CustomUserEntityManager">
     </bean>
-
     <bean id="customGroupEntityManager" class="com.izouma.awesomeadmin.activiti.CustomGroupEntityManager">
     </bean>
+    <bean id="userInfoService" class="com.izouma.awesomeadmin.service.impl.UserInfoServiceImpl">
+    </bean>
 
     <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
         <property name="processEngineConfiguration" ref="processEngineConfiguration"/>

+ 29 - 17
src/main/vue/src/components/DynamicForm.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-form :model="formData" ref="form" label-position="right" label-width="100px" size="small" :rules="rules">
+    <el-form :model="formData" ref="form" label-position="right" label-width="100px" :size="size" :rules="rules">
         <el-form-item v-for="item in formDef" :prop="item.id" :label="item.name" :key="item.id" v-if="item.readable">
             <el-input v-if="item.type === 'string'" v-model="formData[item.id]" :disabled="!item.writable" class="form-item"></el-input>
             <el-select v-else-if="item.type === 'enum'" v-model="formData[item.id]" :disabled="!item.writable" class="form-item">
@@ -11,30 +11,31 @@
             <el-switch v-else-if="item.type === 'boolean'" v-model="formData[item.id]" :disabled="!item.writable" class="form-item">
             </el-switch>
         </el-form-item>
+        <slot></slot>
     </el-form>
 </template>
 <script>
 export default {
     props: {
-        formDef: {
+        formProps: {
             type: Array,
             required: true
         },
         value: {
             type: Object
+        },
+        size: {
+            type: String,
+            default: 'small'
         }
     },
     created() {
-        this.formData = this.val || {}
-        this.formDef.forEach(i => {
-            if (i.value) {
-                this.formData[i.id] = i.value
-            }
-        })
+        this.updateForm(this.formProps)
     },
     data() {
         return {
-            formData: {}
+            formData: {},
+            formDef: []
         }
     },
     computed: {
@@ -70,20 +71,31 @@ export default {
                 }
             })
             return data;
+        },
+        updateForm(props) {
+            try {
+                this.$refs.form.clearValidate();
+            } catch (error) {
+
+            }
+            props.forEach(i => {
+                if (i.value) {
+                    this.formData[i.id] = i.value || null
+                }
+            });
+            this.formDef = this.formProps;
         }
     },
     watch: {
-        formDef() {
-            this.$refs.form.clearValidate()
-            this.formDef.forEach(i => {
-                if (i.value) {
-                    this.formData[i.id] = i.value
-                }
-            })
+        formProps(val) {
+            this.updateForm(val);
         },
         value(val) {
             if (val instanceof Object) {
-                this.formData = val
+                //this.formData = val
+                for (let key in val) {
+                    this.formData[key] = val[key]
+                }
             }
         },
         formData(val) {

+ 63 - 0
src/main/vue/src/pages/CompleteTaskDynamic.vue

@@ -0,0 +1,63 @@
+<template>
+    <div>
+        <h3></h3>
+        <dynamic-form ref="taskForm" :formProps="taskForm"   style="width:500px">
+            <el-form-item>
+                <el-button @click="$router.go(-1)">取消</el-button>
+                <el-button @click="completeTask" type="primary" :loading="loading">完成</el-button>
+            </el-form-item>
+        </dynamic-form>
+    </div>
+</template>
+<script>
+import axios from 'axios'
+import DynamicForm from '../components/DynamicForm'
+
+export default {
+
+    data() {
+        return {
+            taskForm: [],
+            taskFormData: {},
+            loading: false
+        }
+    },
+    created() {
+        this.$http.get({
+            url: '/rest/form/form-data',
+            data: {
+                taskId: this.$route.query.id
+            }
+        }).then(res => {
+            this.taskForm = res.formProperties;
+            this.taskFormData = {};
+        })
+    },
+    methods: {
+        completeTask() {
+            this.$refs.taskForm.validate(valid => {
+                if (valid) {
+                    this.loading = true
+                    axios.post('rest/form/form-data', {
+                        taskId: this.$route.query.id,
+                        properties: this.$refs.taskForm.getData()
+                    }).then(res => {
+                        this.loading = false;
+                        this.$message.success('成功');
+                        this.$router.go(-1)
+                    }).catch(e => {
+                        console.log(e);
+                        this.loading = false;
+                        this.$message.error('失败');
+                    })
+                }
+            })
+        }
+    },
+    components: {
+        DynamicForm
+    }
+}
+</script>
+<style lang="less" scoped>
+</style>

+ 2 - 2
src/main/vue/src/pages/MyProcesses.vue

@@ -35,7 +35,7 @@
             </el-pagination>
         </div>
         <el-dialog :visible.sync="dialogVisible" title="发起流程">
-            <dynamic-form ref="startForm" :formDef="startForm" v-model="startFormModel"></dynamic-form>
+            <dynamic-form ref="startForm" :formProps="startForm" v-model="startFormModel"></dynamic-form>
             <div slot="footer">
                 <el-button @click="dialogVisible = false" size="small">取消</el-button>
                 <el-button type="primary" @click="confirmStartProcess" :loading="loading" size="small">确定</el-button>
@@ -131,7 +131,7 @@ export default {
                         this.getData()
                     }).catch(e => {
                         this.loading = false
-                        this.$message.success('失败');
+                        this.$message.error('失败');
                     })
                 }
             })

+ 88 - 49
src/main/vue/src/pages/MyTasks.vue

@@ -1,29 +1,45 @@
 <template>
     <div>
-        <div class="filters-container">
-        </div>
-        <el-table :data="tableData" :height="tableHeight" row-key="id" ref="table">
-            <el-table-column v-if="multipleMode" align="center" type="selection" min-width="50">
-            </el-table-column>
-            <el-table-column prop="id" label="id" width="150">
-            </el-table-column>
-            <el-table-column prop="name" label="名称">
-            </el-table-column>
-            <el-table-column prop="createTime" label="创建时间" :formatter="datetimeFormatter">
-            </el-table-column>
-            <el-table-column label="操作" align="center" width="100">
-                <template slot-scope="{row}">
-                    <el-button v-if="row.assignee" @click="handle(row)" type="primary" size="mini" plain>办理</el-button>
-                    <el-button v-else @click="claim(row)" type="primary" size="mini" plain>签收</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-        <div class="pagination-wrapper">
-            <el-pagination background @size-change="pageSizeChange" @current-change="currentPageChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalNumber">
-            </el-pagination>
-        </div>
+        <el-tabs v-model="tab" type="card">
+            <el-tab-pane label="待签收" name="toClaim">
+                <el-table :data="toClaim" row-key="id" ref="table">
+                    <el-table-column v-if="multipleMode" align="center" type="selection" min-width="50">
+                    </el-table-column>
+                    <el-table-column prop="id" label="id" width="150">
+                    </el-table-column>
+                    <el-table-column prop="name" label="名称">
+                    </el-table-column>
+                    <el-table-column prop="createTime" label="创建时间" :formatter="datetimeFormatter">
+                    </el-table-column>
+                    <el-table-column label="操作" align="center" width="100">
+                        <template slot-scope="{row}">
+                            <el-button v-if="row.assignee" @click="handle(row)" type="primary" size="mini" plain>办理</el-button>
+                            <el-button v-else @click="claim(row)" type="primary" size="mini" plain>签收</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </el-tab-pane>
+            <el-tab-pane label="待办" name="todo">
+                <el-table :data="todo" row-key="id" ref="table">
+                    <el-table-column v-if="multipleMode" align="center" type="selection" min-width="50">
+                    </el-table-column>
+                    <el-table-column prop="id" label="id" width="150">
+                    </el-table-column>
+                    <el-table-column prop="name" label="名称">
+                    </el-table-column>
+                    <el-table-column prop="createTime" label="创建时间" :formatter="datetimeFormatter">
+                    </el-table-column>
+                    <el-table-column label="操作" align="center" width="100">
+                        <template slot-scope="{row}">
+                            <el-button v-if="row.assignee" @click="handle(row)" type="primary" size="mini" plain>办理</el-button>
+                            <el-button v-else @click="claim(row)" type="primary" size="mini" plain>签收</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </el-tab-pane>
+        </el-tabs>
         <el-dialog :visible.sync="dialogVisible" title="办理">
-            <dynamic-form ref="taskForm" :formDef="taskForm" v-model="taskFormData"></dynamic-form>
+            <dynamic-form ref="taskForm" :formProps="taskForm" v-model="taskFormData"></dynamic-form>
             <div slot="footer">
                 <el-button @click="dialogVisible = false" size="small">取消</el-button>
                 <el-button type="primary" @click="completeTask" :loading="loading" size="small">确定</el-button>
@@ -42,10 +58,7 @@ export default {
     },
     data() {
         return {
-            totalNumber: 0,
-            totalPage: 0,
-            currentPage: 1,
-            pageSize: 20,
+            tab: 'toClaim',
             tableData: [],
             name: '',
             multipleMode: false,
@@ -53,11 +66,13 @@ export default {
             taskForm: [],
             taskFormData: {},
             dialogVisible: false,
-            selectedTaskId: null
+            selectedTaskId: null,
+            toClaim: [],
+            todo: []
         }
     },
     computed: {
-        ...mapState(['tableHeight', 'userInfo']),
+        ...mapState(['userInfo']),
         selection() {
             return this.$refs.table.selection.map(i => i.id);
         }
@@ -72,33 +87,57 @@ export default {
             this.getData();
         },
         getData() {
-            this.$http.get({
-                url: '/rest/runtime/tasks',
-                data: {
-                    involvedUser: this.userInfo.id
-                }
+            // this.$http.get({
+            //     url: '/rest/runtime/tasks',
+            //     data: {
+            //         assignee: this.userInfo.id
+            //     }
+            // }).then(res => {
+            //     this.tableData = res.data;
+            // })
+            axios.post('/rest/query/tasks', {
+                candidateUser: this.userInfo.id,
+            }).then(res => {
+                this.toClaim = res.data.data;
+            })
+            axios.post('/rest/query/tasks', {
+                assignee: this.userInfo.id
             }).then(res => {
-                this.tableData = res.data;
+                this.todo = res.data.data;
             })
         },
         handle(row) {
-            this.$http.get({
-                url: '/rest/form/form-data',
-                data: {
-                    taskId: row.id
+            this.$router.push({
+                name: 'CompleteTaskDynamic',
+                query: {
+                    id: row.id
                 }
-            }).then(res => {
-                this.selectedTaskId = row.id;
-                this.taskForm = res.formProperties;
-                this.taskFormData = {};
-                this.dialogVisible = true;
-                setTimeout(() => {
-                    this.$refs.taskForm.clearValidate()
-                }, 50);
             })
+            // this.$http.get({
+            //     url: '/rest/form/form-data',
+            //     data: {
+            //         taskId: row.id
+            //     }
+            // }).then(res => {
+            //     this.selectedTaskId = row.id;
+            //     this.taskForm = res.formProperties;
+            //     this.taskFormData = {};
+            //     this.dialogVisible = true;
+            //     setTimeout(() => {
+            //         this.$refs.taskForm.clearValidate()
+            //     }, 50);
+            // })
         },
         claim(row) {
-
+            axios.post(`/rest/runtime/tasks/${row.id}`, {
+                action: 'claim',
+                assignee: this.userInfo.id
+            }).then(res => {
+                this.$message.success('签收成功')
+                this.getData()
+            }).catch(e => {
+                this.$message.error('签收失败')
+            })
         },
         completeTask() {
             this.$refs.taskForm.validate(valid => {
@@ -114,7 +153,7 @@ export default {
                         this.getData()
                     }).catch(e => {
                         this.loading = false
-                        this.$message.success('失败');
+                        this.$message.error('失败');
                     })
                 }
             })

+ 3 - 1
src/main/vue/src/pages/ProcessModels.vue

@@ -7,7 +7,7 @@
             <el-button @click="showCreateModelDialog" type="primary" size="small" icon="el-icon-edit" class="filter-item">创建
             </el-button>
         </div>
-        <el-table :data="tableData" :height="tableHeight" row-key="id" ref="table"  v-loading="$store.state.fetchingData">
+        <el-table :data="tableData" :height="tableHeight" row-key="id" ref="table" v-loading="$store.state.fetchingData">
             <el-table-column v-if="multipleMode" align="center" type="selection" min-width="50">
             </el-table-column>
             <el-table-column prop="id" label="id" width="150">
@@ -158,6 +158,8 @@ export default {
             }).then(res => {
                 if (res.success) {
                     this.$message.success('发布成功');
+                } else {
+                    this.$message.error('发布失败');
                 }
             }).catch(e => {
                 this.$message.error('发布失败');

+ 4 - 19
src/main/vue/src/router/index.js

@@ -126,25 +126,10 @@ const router = new Router({
                     component: () => import('../pages/MyTasks')
                 },
                 {
-                    path: '/tableShouyiYaopinxinxis',
-                    name: 'tableShouyiYaopinxinxis',
-                    component: () => import('../pages/TableShouyiYaopinxinxis')
-                },
-                {
-                    path: '/tableShouyiYaopinxinxi',
-                    name: 'tableShouyiYaopinxinxi',
-                    component: () => import('../pages/TableShouyiYaopinxinxi')
-                },
-                {
-                    path: '/testAaas',
-                    name: 'testAaas',
-                    component: () => import('../pages/TestAaas')
-                },
-                {
-                    path: '/testAaa',
-                    name: 'testAaa',
-                    component: () => import('../pages/TestAaa')
-                },
+                    path: '/completeTaskDynamic',
+                    name: 'CompleteTaskDynamic',
+                    component: () => import('../pages/CompleteTaskDynamic')
+                }
             ]
         },
         {

+ 4 - 2
src/main/webapp/editor-app/configuration/toolbar-default-actions.js

@@ -261,7 +261,8 @@ KISBPM.TOOLBAR = {
         },
         
         closeEditor: function(services) {
-        	window.location.href = "./";
+        	// window.location.href = "./";
+            window.close();
         },
         
         /**
@@ -326,7 +327,8 @@ var SaveModelCtrl = [ '$rootScope', '$scope', '$http', '$route', '$location',
 
     $scope.saveAndClose = function () {
     	$scope.save(function() {
-    		window.location.href = "./";
+    		// window.location.href = "./";
+            window.close();
     	});
     };
     $scope.save = function (successCallback) {

+ 3 - 0
src/main/webapp/editor-app/i18n/zh-CN.json

@@ -149,6 +149,9 @@
     "PROPERTY.FORMPROPERTIES.WRITABLE" : "可写",
     "PROPERTY.FORMPROPERTIES.VALUES.ID" : "ID",
     "PROPERTY.FORMPROPERTIES.VALUES.NAME" : "名称",
+    "PROPERTY.FORMPROPERTIES.ENUMVALUES.EMPTY" : "未选择",
+    "PROPERTY.FORMPROPERTIES.VALUES.NAME.PLACEHOLDER" : "输入名称",
+    "PROPERTY.FORMPROPERTIES.VALUES.ID.PLACEHOLDER" : "输入ID",
 
     "PROPERTY.INPARAMETERS.VALUE" : "{{length}}输入参数",
     "PROPERTY.INPARAMETERS.EMPTY" : "没有配置输入参数",