add department
This commit is contained in:
		
							parent
							
								
									ace2b71073
								
							
						
					
					
						commit
						1130a25608
					
				| @ -49,7 +49,7 @@ spring: | |||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 |           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 | ||||||
|           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) |           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) | ||||||
|           url: jdbc:mysql://localhost:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true |           url: jdbc:mysql://192.168.31.120:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true | ||||||
|           username: root |           username: root | ||||||
|           password: jyzbyj306 |           password: jyzbyj306 | ||||||
|         # 从库数据源 |         # 从库数据源 | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								ruoyi-ui/src/api/scientific/department.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								ruoyi-ui/src/api/scientific/department.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | |||||||
|  | import request from '@/utils/request' | ||||||
|  | 
 | ||||||
|  | // 查询department列表
 | ||||||
|  | export function listDepartment(query) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/scientific/department/list', | ||||||
|  |     method: 'get', | ||||||
|  |     params: query | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 查询department详细
 | ||||||
|  | export function getDepartment(departmentId) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/scientific/department/' + departmentId, | ||||||
|  |     method: 'get' | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 新增department
 | ||||||
|  | export function addDepartment(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/scientific/department', | ||||||
|  |     method: 'post', | ||||||
|  |     data: data | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 修改department
 | ||||||
|  | export function updateDepartment(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/scientific/department', | ||||||
|  |     method: 'put', | ||||||
|  |     data: data | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 删除department
 | ||||||
|  | export function delDepartment(departmentId) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/scientific/department/' + departmentId, | ||||||
|  |     method: 'delete' | ||||||
|  |   }) | ||||||
|  | } | ||||||
| @ -346,6 +346,41 @@ export const dynamicRoutes = [ | |||||||
|   //     },
 |   //     },
 | ||||||
|   //   ]
 |   //   ]
 | ||||||
|   // },
 |   // },
 | ||||||
|  | 
 | ||||||
|  |   // 合作单位路由
 | ||||||
|  |   { | ||||||
|  |     path: '/scientific/department', | ||||||
|  |     component: Layout, | ||||||
|  |     hidden: true, | ||||||
|  |     permissions: ['scientific:department'], | ||||||
|  |     children: [ | ||||||
|  |       { | ||||||
|  |         path: 'list', | ||||||
|  |         component: () => import('@/views/scientific/department/index'), | ||||||
|  |         name: 'departmentList', | ||||||
|  |         meta: { title: '合作单位列表', icon: '' } | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         path: 'detail/:departmentProcId([\\w|\\-]+)', | ||||||
|  |         component: () => import('@/views/scientific/department/detail'), | ||||||
|  |         name: 'departmentDetail', | ||||||
|  |         meta: { title: '合作单位详情' } | ||||||
|  |       }, | ||||||
|  |       // {
 | ||||||
|  |       //   path: 'planProjectQuery/:planId([\\w|\\-]+)',
 | ||||||
|  |       //   // permissions: ['scientific:application:list'],
 | ||||||
|  |       //   component: () => import('@/views/scientific/project/index'),
 | ||||||
|  |       //   name: 'planProjectQuery',
 | ||||||
|  |       //   meta: { title: '已申报项目' }
 | ||||||
|  |       // },
 | ||||||
|  |       { | ||||||
|  |         path: 'departmentApply', | ||||||
|  |         component: () => import('@/views/scientific/department/departmentApply'), | ||||||
|  |         name: 'departmentApply', | ||||||
|  |         meta: { title: '合作单位录入', icon: '' } | ||||||
|  |       }, | ||||||
|  |     ] | ||||||
|  |   }, | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| // 防止连续点击多次路由报错
 | // 防止连续点击多次路由报错
 | ||||||
|  | |||||||
							
								
								
									
										151
									
								
								ruoyi-ui/src/views/scientific/department/departmentApply.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								ruoyi-ui/src/views/scientific/department/departmentApply.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,151 @@ | |||||||
|  | <template> | ||||||
|  |   <div class="app-container"> | ||||||
|  |     <el-card class="box-card"> | ||||||
|  |       <div slot="header" class="clearfix"> | ||||||
|  |         <span>合作单位录入</span> | ||||||
|  |       </div> | ||||||
|  | 
 | ||||||
|  |       <el-col :span="18" :offset="3"> | ||||||
|  |         <div class="form-conf" v-if="formOpen"> | ||||||
|  |           <parser :key="new Date().getTime()" :form-conf="formData" @submit="submit" ref="parser" @getData="getData"/> | ||||||
|  |         </div> | ||||||
|  |       </el-col> | ||||||
|  |     </el-card> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { listProcess, startProcess_ } from '@/api/workflow/process' | ||||||
|  | import { listAllCategory } from '@/api/workflow/category' | ||||||
|  | import { getProcessForm, startProcess } from '@/api/workflow/process' | ||||||
|  | import Parser from '@/utils/generator/parser' | ||||||
|  | import {findLatestDeploymentTimeIndex } from '@/api/scientific/project_application_plan' | ||||||
|  | import { addHandbook } from '@/api/scientific/handbook' | ||||||
|  | import {addDepartment} from "@/api/scientific/department"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: 'departmentApply', | ||||||
|  |   components: { | ||||||
|  |     Parser | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       definitionId: null, | ||||||
|  |       deployId: null, | ||||||
|  |       procInsId: null, | ||||||
|  |       formOpen: false, | ||||||
|  |       formData: {}, | ||||||
|  | 
 | ||||||
|  |       processName: '', | ||||||
|  |       categoryOptions: [], | ||||||
|  |       // 流程定义表格数据 | ||||||
|  |       processParams: null, | ||||||
|  |       // 查询参数 | ||||||
|  |       queryParams: { | ||||||
|  |         pageNum: 1, | ||||||
|  |         pageSize: 10, | ||||||
|  |         processKey: undefined, | ||||||
|  |         processName: "", | ||||||
|  |         category: "008" | ||||||
|  |       }, | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |     this.initData(); | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     initData() { | ||||||
|  |       /** 查询流程定义列表 */ | ||||||
|  |       listProcess(this.queryParams).then(response => { | ||||||
|  |         findLatestDeploymentTimeIndex(response).then((latestIndex) => { | ||||||
|  |           this.processParams = response.rows[latestIndex]; | ||||||
|  |           this.processName = this.processParams.processName; | ||||||
|  |           this.definitionId = this.processParams.definitionId; | ||||||
|  |           getProcessForm({ | ||||||
|  |             definitionId: this.processParams.definitionId, | ||||||
|  |             deployId: this.processParams.deploymentId, | ||||||
|  |             procInsId: undefined | ||||||
|  |           }).then(res => { | ||||||
|  |             if (res.data) { | ||||||
|  |               this.formData = res.data; | ||||||
|  |               this.formOpen = true; | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |         }); | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     /** 接收子组件传的值 */ | ||||||
|  |     getData(data) { | ||||||
|  |       if (data) { | ||||||
|  |         const variables = []; | ||||||
|  |         data.fields.forEach(item => { | ||||||
|  |           let variableData = {}; | ||||||
|  |           variableData.label = item.__config__.label | ||||||
|  |           // 表单值为多个选项时 | ||||||
|  |           if (item.__config__.defaultValue instanceof Array) { | ||||||
|  |             const array = []; | ||||||
|  |             item.__config__.defaultValue.forEach(val => { | ||||||
|  |               array.push(val) | ||||||
|  |             }) | ||||||
|  |             variableData.val = array; | ||||||
|  |           } else { | ||||||
|  |             variableData.val = item.__config__.defaultValue | ||||||
|  |           } | ||||||
|  |           variables.push(variableData) | ||||||
|  |         }) | ||||||
|  |         this.variables = variables; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     submit(data) { | ||||||
|  |       if (data && this.definitionId) { | ||||||
|  |         console.log(data.valData) | ||||||
|  |         // 启动流程并将表单数据加入流程变量 | ||||||
|  |         startProcess_(this.definitionId, JSON.stringify(data.valData)).then(res => { | ||||||
|  |           if (res.code !== 200) { | ||||||
|  |             this.$modal.msgError("操作失败"); | ||||||
|  |             return; | ||||||
|  |           } | ||||||
|  |           let departmentData = data.valData; | ||||||
|  |           departmentData.departmentProcId = res.msg; | ||||||
|  |           // zqjia:默认刚录入指南时状态为审核中,但后端会改为未审核 | ||||||
|  |           departmentData.departmentStatus = 1; | ||||||
|  | 
 | ||||||
|  |           // zqjia:解析handbookFile,不然无法存到数据库中 | ||||||
|  |           const files = departmentData.departmentFile; | ||||||
|  | 
 | ||||||
|  |           if (files !== null && files !== undefined) { | ||||||
|  |             let formatedFiles = {}; | ||||||
|  |             files.forEach(file => { | ||||||
|  |               if(file.response.code === 200 && file.ossId) { | ||||||
|  |                 formatedFiles[file.name] = file.ossId; | ||||||
|  |               } | ||||||
|  |             }) | ||||||
|  |             departmentData.departmentFile = JSON.stringify(formatedFiles); | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|  |           addDepartment(JSON.stringify(departmentData)).then(resp => { | ||||||
|  |             if (res.code !== 200) { | ||||||
|  |               this.$modal.msgError("操作失败"); | ||||||
|  |               return; | ||||||
|  |             } | ||||||
|  |             this.$modal.msgSuccess(resp.msg); | ||||||
|  |             this.$tab.closeOpenPage({ | ||||||
|  |               path: '/scientific/department/list' | ||||||
|  |             }) | ||||||
|  |           }); | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .form-conf { | ||||||
|  |   margin: 15px auto; | ||||||
|  |   width: 80%; | ||||||
|  |   padding: 15px; | ||||||
|  | } | ||||||
|  | </style> | ||||||
							
								
								
									
										476
									
								
								ruoyi-ui/src/views/scientific/department/detail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										476
									
								
								ruoyi-ui/src/views/scientific/department/detail.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,476 @@ | |||||||
|  | <template> | ||||||
|  |   <div class="app-container"> | ||||||
|  |     <el-tabs tab-position="top" :value="processed === true ? 'approval' : 'form'"> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |       <el-tab-pane label="表单信息" name="form"> | ||||||
|  |         <div v-if="formOpen"> | ||||||
|  |           <el-card class="box-card" shadow="never" v-for="(formInfo, index) in processFormList" :key="index"> | ||||||
|  |             <div slot="header" class="clearfix"> | ||||||
|  |               <!--              <span>{{ formInfo.title }}</span>--> | ||||||
|  |               <span> 合作单位详情 </span> | ||||||
|  |             </div> | ||||||
|  | 
 | ||||||
|  |             <!--流程处理表单模块--> | ||||||
|  |             <el-col :span="20" :offset="2"> | ||||||
|  |               <parser :form-conf="formInfo"/> | ||||||
|  |             </el-col> | ||||||
|  |           </el-card> | ||||||
|  |         </div> | ||||||
|  |       </el-tab-pane > | ||||||
|  | 
 | ||||||
|  |     </el-tabs> | ||||||
|  | 
 | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { detailProcess } from '@/api/workflow/process' | ||||||
|  | import Parser from '@/utils/generator/parser' | ||||||
|  | import { complete, delegate, transfer, rejectTask, returnList, returnTask } from '@/api/workflow/task' | ||||||
|  | import { selectUser, deptTreeSelect } from '@/api/system/user' | ||||||
|  | import ProcessViewer from '@/components/ProcessViewer' | ||||||
|  | import '@riophae/vue-treeselect/dist/vue-treeselect.css' | ||||||
|  | import Treeselect from '@riophae/vue-treeselect' | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "WorkDetail", | ||||||
|  |   components: { | ||||||
|  |     ProcessViewer, | ||||||
|  |     Parser, | ||||||
|  |     Treeselect | ||||||
|  |   }, | ||||||
|  |   props: {}, | ||||||
|  |   computed: { | ||||||
|  |     commentType() { | ||||||
|  |       return val => { | ||||||
|  |         switch (val) { | ||||||
|  |           case '1': return '通过' | ||||||
|  |           case '2': return '退回' | ||||||
|  |           case '3': return '驳回' | ||||||
|  |           case '4': return '委派' | ||||||
|  |           case '5': return '转办' | ||||||
|  |           case '6': return '终止' | ||||||
|  |           case '7': return '撤回' | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     approveTypeTag() { | ||||||
|  |       return val => { | ||||||
|  |         switch (val) { | ||||||
|  |           case '1': return 'success' | ||||||
|  |           case '2': return 'warning' | ||||||
|  |           case '3': return 'danger' | ||||||
|  |           case '4': return 'primary' | ||||||
|  |           case '5': return 'success' | ||||||
|  |           case '6': return 'danger' | ||||||
|  |           case '7': return 'info' | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       height: document.documentElement.clientHeight - 205 + 'px;', | ||||||
|  |       // 模型xml数据 | ||||||
|  |       loadIndex: 0, | ||||||
|  |       xmlData: undefined, | ||||||
|  |       finishedInfo: { | ||||||
|  |         finishedSequenceFlowSet: [], | ||||||
|  |         finishedTaskSet: [], | ||||||
|  |         unfinishedTaskSet: [], | ||||||
|  |         rejectedTaskSet: [] | ||||||
|  |       }, | ||||||
|  |       historyProcNodeList: [], | ||||||
|  |       // 部门名称 | ||||||
|  |       deptName: undefined, | ||||||
|  |       // 部门树选项 | ||||||
|  |       deptOptions: undefined, | ||||||
|  |       userLoading: false, | ||||||
|  |       // 用户表格数据 | ||||||
|  |       userList: null, | ||||||
|  |       deptProps: { | ||||||
|  |         children: "children", | ||||||
|  |         label: "label" | ||||||
|  |       }, | ||||||
|  |       // 查询参数 | ||||||
|  |       queryParams: { | ||||||
|  |         pageNum: 1, | ||||||
|  |         pageSize: 10, | ||||||
|  |         deptId: undefined | ||||||
|  |       }, | ||||||
|  |       total: 0, | ||||||
|  |       // 遮罩层 | ||||||
|  |       loading: true, | ||||||
|  |       taskForm:{ | ||||||
|  |         comment:"", // 意见内容 | ||||||
|  |         procInsId: "", // 流程实例编号 | ||||||
|  |         taskId: "" ,// 流程任务编号 | ||||||
|  |         copyUserIds: "", // 抄送人Id | ||||||
|  |         vars: "", | ||||||
|  |         targetKey:"" | ||||||
|  |       }, | ||||||
|  |       rules: { | ||||||
|  |         comment: [{ required: true, message: '请输入审批意见', trigger: 'blur' }], | ||||||
|  |       }, | ||||||
|  |       currentUserId: null, | ||||||
|  |       variables: [], // 流程变量数据 | ||||||
|  |       taskFormOpen: false, | ||||||
|  |       taskFormData: {}, // 流程变量数据 | ||||||
|  |       processFormList: [], // 流程变量数据 | ||||||
|  |       formOpen: false, // 是否加载流程变量数据 | ||||||
|  |       returnTaskList: [],  // 回退列表数据 | ||||||
|  |       processed: false, | ||||||
|  |       returnTitle: null, | ||||||
|  |       returnOpen: false, | ||||||
|  |       rejectOpen: false, | ||||||
|  |       rejectTitle: null, | ||||||
|  |       userData: { | ||||||
|  |         title: '', | ||||||
|  |         type: '', | ||||||
|  |         open: false, | ||||||
|  |       }, | ||||||
|  |       copyUser: [], | ||||||
|  |       nextUser: [], | ||||||
|  |       userMultipleSelection: [], | ||||||
|  |       userDialogTitle: '', | ||||||
|  |       userOpen: false | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |     this.initData(); | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     initData() { | ||||||
|  |       this.taskForm.procInsId = this.$route.params && this.$route.params.departmentProcId; | ||||||
|  |       this.taskForm.taskId  = this.$route.query && this.$route.query.taskId; | ||||||
|  |       this.processed = this.$route.query && eval(this.$route.query.processed || false); | ||||||
|  | 
 | ||||||
|  |       // 流程任务重获取变量表单 | ||||||
|  |       this.getProcessDetails(this.taskForm.procInsId, this.taskForm.taskId); | ||||||
|  |       this.loadIndex = this.taskForm.procInsId; | ||||||
|  |     }, | ||||||
|  |     /** 查询部门下拉树结构 */ | ||||||
|  |     getTreeSelect() { | ||||||
|  |       deptTreeSelect().then(response => { | ||||||
|  |         this.deptOptions = response.data; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 查询用户列表 */ | ||||||
|  |     getList() { | ||||||
|  |       this.userLoading = true; | ||||||
|  |       selectUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { | ||||||
|  |         this.userList = response.rows; | ||||||
|  |         this.total = response.total; | ||||||
|  |         this.toggleSelection(this.userMultipleSelection); | ||||||
|  |         this.userLoading = false; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     // 筛选节点 | ||||||
|  |     filterNode(value, data) { | ||||||
|  |       if (!value) return true; | ||||||
|  |       return data.label.indexOf(value) !== -1; | ||||||
|  |     }, | ||||||
|  |     // 节点单击事件 | ||||||
|  |     handleNodeClick(data) { | ||||||
|  |       this.queryParams.deptId = data.id; | ||||||
|  |       this.getList(); | ||||||
|  |     }, | ||||||
|  |     setIcon(val) { | ||||||
|  |       if (val) { | ||||||
|  |         return "el-icon-check"; | ||||||
|  |       } else { | ||||||
|  |         return "el-icon-time"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     setColor(val) { | ||||||
|  |       if (val) { | ||||||
|  |         return "#2bc418"; | ||||||
|  |       } else { | ||||||
|  |         return "#b3bdbb"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     // 多选框选中数据 | ||||||
|  |     handleSelectionChange(selection) { | ||||||
|  |       this.userMultipleSelection = selection | ||||||
|  |     }, | ||||||
|  |     toggleSelection(selection) { | ||||||
|  |       if (selection && selection.length > 0) { | ||||||
|  |         this.$nextTick(()=> { | ||||||
|  |           selection.forEach(item => { | ||||||
|  |             let row = this.userList.find(k => k.userId === item.userId); | ||||||
|  |             this.$refs.userTable.toggleRowSelection(row); | ||||||
|  |           }) | ||||||
|  |         }) | ||||||
|  |       } else { | ||||||
|  |         this.$nextTick(() => { | ||||||
|  |           this.$refs.userTable.clearSelection(); | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     // 关闭标签 | ||||||
|  |     handleClose(type, tag) { | ||||||
|  |       let userObj = this.userMultipleSelection.find(item => item.userId === tag.id); | ||||||
|  |       this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1); | ||||||
|  |       if (type === 'copy') { | ||||||
|  |         this.copyUser = this.userMultipleSelection; | ||||||
|  |         // 设置抄送人ID | ||||||
|  |         if (this.copyUser && this.copyUser.length > 0) { | ||||||
|  |           const val = this.copyUser.map(item => item.id); | ||||||
|  |           this.taskForm.copyUserIds = val instanceof Array ? val.join(',') : val; | ||||||
|  |         } else { | ||||||
|  |           this.taskForm.copyUserIds = ''; | ||||||
|  |         } | ||||||
|  |       } else if (type === 'next') { | ||||||
|  |         this.nextUser = this.userMultipleSelection; | ||||||
|  |         // 设置抄送人ID | ||||||
|  |         if (this.nextUser && this.nextUser.length > 0) { | ||||||
|  |           const val = this.nextUser.map(item => item.id); | ||||||
|  |           this.taskForm.nextUserIds = val instanceof Array ? val.join(',') : val; | ||||||
|  |         } else { | ||||||
|  |           this.taskForm.nextUserIds = ''; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     /** 流程变量赋值 */ | ||||||
|  |     handleCheckChange(val) { | ||||||
|  |       if (val instanceof Array) { | ||||||
|  |         this.taskForm.values = { | ||||||
|  |           "approval": val.join(',') | ||||||
|  |         } | ||||||
|  |       } else { | ||||||
|  |         this.taskForm.values = { | ||||||
|  |           "approval": val | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     getProcessDetails(procInsId, taskId) { | ||||||
|  |       const params = {procInsId: procInsId, taskId: taskId} | ||||||
|  |       detailProcess(params).then(res => { | ||||||
|  |         const data = res.data; | ||||||
|  |         this.xmlData = data.bpmnXml; | ||||||
|  |         this.processFormList = data.processFormList; | ||||||
|  |         this.taskFormOpen = data.existTaskForm; | ||||||
|  |         if (this.taskFormOpen) { | ||||||
|  |           this.taskFormData = data.taskFormData; | ||||||
|  |         } | ||||||
|  |         this.historyProcNodeList = data.historyProcNodeList; | ||||||
|  |         this.finishedInfo = data.flowViewer; | ||||||
|  |         this.formOpen = true; | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onSelectCopyUsers() { | ||||||
|  |       this.userMultipleSelection = this.copyUser; | ||||||
|  |       this.onSelectUsers('添加抄送人', 'copy') | ||||||
|  |     }, | ||||||
|  |     onSelectNextUsers() { | ||||||
|  |       this.userMultipleSelection = this.nextUser; | ||||||
|  |       this.onSelectUsers('指定审批人', 'next') | ||||||
|  |     }, | ||||||
|  |     onSelectUsers(title, type) { | ||||||
|  |       this.userData.title = title; | ||||||
|  |       this.userData.type = type; | ||||||
|  |       this.getTreeSelect(); | ||||||
|  |       this.getList() | ||||||
|  |       this.userData.open = true; | ||||||
|  |     }, | ||||||
|  |     /** 通过任务 */ | ||||||
|  |     handleComplete() { | ||||||
|  |       // 校验表单 | ||||||
|  |       const taskFormRef = this.$refs.taskFormParser; | ||||||
|  |       const isExistTaskForm = taskFormRef !== undefined; | ||||||
|  |       // 若无任务表单,则 taskFormPromise 为 true,即不需要校验 | ||||||
|  |       const taskFormPromise = !isExistTaskForm ? true : new Promise((resolve, reject) => { | ||||||
|  |         taskFormRef.$refs[taskFormRef.formConfCopy.formRef].validate(valid => { | ||||||
|  |           valid ? resolve() : reject() | ||||||
|  |         }) | ||||||
|  |       }); | ||||||
|  |       const approvalPromise = new Promise((resolve, reject) => { | ||||||
|  |         this.$refs['taskForm'].validate(valid => { | ||||||
|  |           valid ? resolve() : reject() | ||||||
|  |         }) | ||||||
|  |       }); | ||||||
|  |       Promise.all([taskFormPromise, approvalPromise]).then(() => { | ||||||
|  |         if (isExistTaskForm) { | ||||||
|  |           this.taskForm.variables = taskFormRef[taskFormRef.formConfCopy.formModel] | ||||||
|  |         } | ||||||
|  |         complete(this.taskForm).then(response => { | ||||||
|  |           this.$modal.msgSuccess(response.msg); | ||||||
|  |           this.goBack(); | ||||||
|  |         }); | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     /** 委派任务 */ | ||||||
|  |     handleDelegate() { | ||||||
|  |       this.$refs["taskForm"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.userData.type = 'delegate'; | ||||||
|  |           this.userData.title = '委派任务' | ||||||
|  |           this.userData.open = true; | ||||||
|  |           this.getTreeSelect(); | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     /** 转办任务 */ | ||||||
|  |     handleTransfer(){ | ||||||
|  |       this.$refs["taskForm"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.userData.type = 'transfer'; | ||||||
|  |           this.userData.title = '转办任务'; | ||||||
|  |           this.userData.open = true; | ||||||
|  |           this.getTreeSelect(); | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     /** 拒绝任务 */ | ||||||
|  |     handleReject() { | ||||||
|  |       this.$refs["taskForm"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           const _this = this; | ||||||
|  |           this.$modal.confirm('拒绝审批单流程会终止,是否继续?').then(function() { | ||||||
|  |             return rejectTask(_this.taskForm); | ||||||
|  |           }).then(res => { | ||||||
|  |             this.$modal.msgSuccess(res.msg); | ||||||
|  |             this.goBack(); | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     changeCurrentUser(val) { | ||||||
|  |       this.currentUserId = val.userId | ||||||
|  |     }, | ||||||
|  |     /** 返回页面 */ | ||||||
|  |     goBack() { | ||||||
|  |       // 关闭当前标签页并返回上个页面 | ||||||
|  |       this.$tab.closePage(this.$route) | ||||||
|  |       this.$router.back() | ||||||
|  |     }, | ||||||
|  |     /** 接收子组件传的值 */ | ||||||
|  |     getData(data) { | ||||||
|  |       if (data) { | ||||||
|  |         const variables = []; | ||||||
|  |         data.fields.forEach(item => { | ||||||
|  |           let variableData = {}; | ||||||
|  |           variableData.label = item.__config__.label | ||||||
|  |           // 表单值为多个选项时 | ||||||
|  |           if (item.__config__.defaultValue instanceof Array) { | ||||||
|  |             const array = []; | ||||||
|  |             item.__config__.defaultValue.forEach(val => { | ||||||
|  |               array.push(val) | ||||||
|  |             }) | ||||||
|  |             variableData.val = array; | ||||||
|  |           } else { | ||||||
|  |             variableData.val = item.__config__.defaultValue | ||||||
|  |           } | ||||||
|  |           variables.push(variableData) | ||||||
|  |         }) | ||||||
|  |         this.variables = variables; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     submitUserData() { | ||||||
|  |       let type = this.userData.type; | ||||||
|  |       if (type === 'copy' || type === 'next') { | ||||||
|  |         if (!this.userMultipleSelection || this.userMultipleSelection.length <= 0) { | ||||||
|  |           this.$modal.msgError("请选择用户"); | ||||||
|  |           return false; | ||||||
|  |         } | ||||||
|  |         let userIds = this.userMultipleSelection.map(k => k.userId); | ||||||
|  |         if (type === 'copy') { | ||||||
|  |           // 设置抄送人ID信息 | ||||||
|  |           this.copyUser = this.userMultipleSelection; | ||||||
|  |           this.taskForm.copyUserIds = userIds instanceof Array ? userIds.join(',') : userIds; | ||||||
|  |         } else if (type === 'next') { | ||||||
|  |           // 设置下一级审批人ID信息 | ||||||
|  |           this.nextUser = this.userMultipleSelection; | ||||||
|  |           this.taskForm.nextUserIds = userIds instanceof Array ? userIds.join(',') : userIds; | ||||||
|  |         } | ||||||
|  |         this.userData.open = false; | ||||||
|  |       } else { | ||||||
|  |         if (!this.taskForm.comment) { | ||||||
|  |           this.$modal.msgError("请输入审批意见"); | ||||||
|  |           return false; | ||||||
|  |         } | ||||||
|  |         if (!this.currentUserId) { | ||||||
|  |           this.$modal.msgError("请选择用户"); | ||||||
|  |           return false; | ||||||
|  |         } | ||||||
|  |         this.taskForm.userId = this.currentUserId; | ||||||
|  |         if (type === 'delegate') { | ||||||
|  |           delegate(this.taskForm).then(res => { | ||||||
|  |             this.$modal.msgSuccess(res.msg); | ||||||
|  |             this.goBack(); | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |         if (type === 'transfer') { | ||||||
|  |           transfer(this.taskForm).then(res => { | ||||||
|  |             this.$modal.msgSuccess(res.msg); | ||||||
|  |             this.goBack(); | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |     }, | ||||||
|  |     /** 可退回任务列表 */ | ||||||
|  |     handleReturn() { | ||||||
|  |       this.$refs['taskForm'].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.returnTitle = "退回流程"; | ||||||
|  |           returnList(this.taskForm).then(res => { | ||||||
|  |             this.returnTaskList = res.data; | ||||||
|  |             this.taskForm.values = null; | ||||||
|  |             this.returnOpen = true; | ||||||
|  |           }) | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|  |     }, | ||||||
|  |     /** 提交退回任务 */ | ||||||
|  |     submitReturn() { | ||||||
|  |       this.$refs["taskForm"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           if (!this.taskForm.targetKey) { | ||||||
|  |             this.$modal.msgError("请选择退回节点!"); | ||||||
|  |           } | ||||||
|  |           returnTask(this.taskForm).then(res => { | ||||||
|  |             this.$modal.msgSuccess(res.msg); | ||||||
|  |             this.goBack() | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .clearfix:before, | ||||||
|  | .clearfix:after { | ||||||
|  |   display: table; | ||||||
|  |   content: ""; | ||||||
|  | } | ||||||
|  | .clearfix:after { | ||||||
|  |   clear: both | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .box-card { | ||||||
|  |   width: 100%; | ||||||
|  |   margin-bottom: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .el-tag + .el-tag { | ||||||
|  |   margin-left: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .el-row { | ||||||
|  |   margin-bottom: 20px; | ||||||
|  |   &:last-child { | ||||||
|  |     margin-bottom: 0; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | .el-col { | ||||||
|  |   border-radius: 4px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .button-new-tag { | ||||||
|  |   margin-left: 10px; | ||||||
|  | } | ||||||
|  | </style> | ||||||
							
								
								
									
										377
									
								
								ruoyi-ui/src/views/scientific/department/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										377
									
								
								ruoyi-ui/src/views/scientific/department/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,377 @@ | |||||||
|  | <template> | ||||||
|  |   <div class="app-container"> | ||||||
|  |     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | ||||||
|  | 
 | ||||||
|  |       <el-form-item label="单位名称" prop="departmentName"> | ||||||
|  |         <el-input | ||||||
|  |           v-model="queryParams.departmentName" | ||||||
|  |           placeholder="请输入单位名称" | ||||||
|  |           clearable | ||||||
|  |           @keyup.enter.native="handleQuery" | ||||||
|  |         /> | ||||||
|  |       </el-form-item> | ||||||
|  | 
 | ||||||
|  |       <el-form-item label="单位性质" prop="departmentCategory"> | ||||||
|  |         <el-input | ||||||
|  |           v-model="queryParams.departmentCategory" | ||||||
|  |           placeholder="请输入单位性质" | ||||||
|  |           clearable | ||||||
|  |           @keyup.enter.native="handleQuery" | ||||||
|  |         /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item label="联系人" prop="departmentPerson"> | ||||||
|  |         <el-input | ||||||
|  |           v-model="queryParams.departmentPerson" | ||||||
|  |           placeholder="请输入单位联系人姓名" | ||||||
|  |           clearable | ||||||
|  |           @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 icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||||||
|  |       </el-form-item> | ||||||
|  |     </el-form> | ||||||
|  | 
 | ||||||
|  |     <el-row :gutter="10" class="mb8"> | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |         <el-button | ||||||
|  |           type="primary" | ||||||
|  |           plain | ||||||
|  |           icon="el-icon-plus" | ||||||
|  |           size="mini" | ||||||
|  |           @click="handleAdd" | ||||||
|  |           v-hasPermi="['scientific:department:add']" | ||||||
|  |         >新增</el-button> | ||||||
|  |       </el-col> | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |         <el-button | ||||||
|  |           type="success" | ||||||
|  |           plain | ||||||
|  |           icon="el-icon-edit" | ||||||
|  |           size="mini" | ||||||
|  |           :disabled="single" | ||||||
|  |           @click="handleUpdate" | ||||||
|  |           v-hasPermi="['scientific:department:edit']" | ||||||
|  |         >修改</el-button> | ||||||
|  |       </el-col> | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |         <el-button | ||||||
|  |           type="danger" | ||||||
|  |           plain | ||||||
|  |           icon="el-icon-delete" | ||||||
|  |           size="mini" | ||||||
|  |           :disabled="multiple" | ||||||
|  |           @click="handleDelete" | ||||||
|  |           v-hasPermi="['scientific:department:remove']" | ||||||
|  |         >删除</el-button> | ||||||
|  |       </el-col> | ||||||
|  |       <el-col :span="1.5"> | ||||||
|  |         <el-button | ||||||
|  |           type="warning" | ||||||
|  |           plain | ||||||
|  |           icon="el-icon-download" | ||||||
|  |           size="mini" | ||||||
|  |           @click="handleExport" | ||||||
|  |           v-hasPermi="['scientific:department:export']" | ||||||
|  |         >导出</el-button> | ||||||
|  |       </el-col> | ||||||
|  |       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||||||
|  |     </el-row> | ||||||
|  | 
 | ||||||
|  |     <el-table v-loading="loading" :data="departmentList" @selection-change="handleSelectionChange"> | ||||||
|  |       <el-table-column type="selection" width="55" align="center" /> | ||||||
|  | 
 | ||||||
|  |       <el-table-column label="单位名称" align="center" prop="departmentName" /> | ||||||
|  |       <el-table-column label="单位地址" align="center" prop="departmentAddress" /> | ||||||
|  |       <el-table-column label="单位性质" align="center" prop="departmentCategory" :formatter="formatDepartmentCategory"/> | ||||||
|  |       <el-table-column label="单位联系人姓名" align="center" prop="departmentPerson" /> | ||||||
|  |       <el-table-column label="单位联系人电话" align="center" prop="departmentPhone" /> | ||||||
|  |       <el-table-column label="单位联系人邮件" align="center" prop="departmentEmail" /> | ||||||
|  | 
 | ||||||
|  |       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||||
|  |         <template slot-scope="scope"> | ||||||
|  |           <el-button | ||||||
|  |             size="mini" | ||||||
|  |             type="text" | ||||||
|  |             icon="el-icon-edit" | ||||||
|  |             @click="handleDepartmentDetail(scope.row)" | ||||||
|  |             v-hasPermi="['scientific:department:list']" | ||||||
|  |           >详情</el-button> | ||||||
|  | 
 | ||||||
|  |           <el-button | ||||||
|  |             size="mini" | ||||||
|  |             type="text" | ||||||
|  |             icon="el-icon-delete" | ||||||
|  |             @click="handleDelete(scope.row)" | ||||||
|  |             v-hasPermi="['scientific:department:remove']" | ||||||
|  |           >删除</el-button> | ||||||
|  | 
 | ||||||
|  |         </template> | ||||||
|  |       </el-table-column> | ||||||
|  |     </el-table> | ||||||
|  | 
 | ||||||
|  |     <pagination | ||||||
|  |       v-show="total>0" | ||||||
|  |       :total="total" | ||||||
|  |       :page.sync="queryParams.pageNum" | ||||||
|  |       :limit.sync="queryParams.pageSize" | ||||||
|  |       @pagination="getList" | ||||||
|  |     /> | ||||||
|  | 
 | ||||||
|  |     <!-- 添加或修改department对话框 --> | ||||||
|  |     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||||||
|  |       <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||||
|  |         <el-form-item label="单位名称" prop="departmentName"> | ||||||
|  |           <el-input v-model="form.departmentName" placeholder="请输入单位名称" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="单位地址" prop="departmentAddress"> | ||||||
|  |           <el-input v-model="form.departmentAddress" placeholder="请输入单位地址" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="单位性质,1企业,2科研机构,3高校" prop="departmentCategory"> | ||||||
|  |           <el-input v-model="form.departmentCategory" placeholder="请输入单位性质,1企业,2科研机构,3高校" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="单位联系人姓名" prop="departmentPerson"> | ||||||
|  |           <el-input v-model="form.departmentPerson" placeholder="请输入单位联系人姓名" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="单位联系人电话" prop="departmentPhone"> | ||||||
|  |           <el-input v-model="form.departmentPhone" placeholder="请输入单位联系人电话" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="单位联系人邮件" prop="departmentEmail"> | ||||||
|  |           <el-input v-model="form.departmentEmail" placeholder="请输入单位联系人邮件" /> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="相关文件" prop="departmentFile"> | ||||||
|  |           <file-upload v-model="form.departmentFile"/> | ||||||
|  |         </el-form-item> | ||||||
|  |         <el-form-item label="其他备注信息" prop="departmentNote"> | ||||||
|  |           <el-input v-model="form.departmentNote" placeholder="请输入其他备注信息" /> | ||||||
|  |         </el-form-item> | ||||||
|  |       </el-form> | ||||||
|  |       <div slot="footer" class="dialog-footer"> | ||||||
|  |         <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | ||||||
|  |         <el-button @click="cancel">取 消</el-button> | ||||||
|  |       </div> | ||||||
|  |     </el-dialog> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { listDepartment, getDepartment, delDepartment, addDepartment, updateDepartment } from "@/api/scientific/department"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "Department", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       // 按钮loading | ||||||
|  |       buttonLoading: false, | ||||||
|  |       // 遮罩层 | ||||||
|  |       loading: true, | ||||||
|  |       // 选中数组 | ||||||
|  |       ids: [], | ||||||
|  |       // 非单个禁用 | ||||||
|  |       single: true, | ||||||
|  |       // 非多个禁用 | ||||||
|  |       multiple: true, | ||||||
|  |       // 显示搜索条件 | ||||||
|  |       showSearch: true, | ||||||
|  |       // 总条数 | ||||||
|  |       total: 0, | ||||||
|  |       // department表格数据 | ||||||
|  |       departmentList: [], | ||||||
|  |       // 弹出层标题 | ||||||
|  |       title: "", | ||||||
|  |       // 是否显示弹出层 | ||||||
|  |       open: false, | ||||||
|  |       // 查询参数 | ||||||
|  |       queryParams: { | ||||||
|  |         pageNum: 1, | ||||||
|  |         pageSize: 10, | ||||||
|  |         departmentId: undefined, | ||||||
|  |         departmentName: undefined, | ||||||
|  |         departmentAddress: undefined, | ||||||
|  |         departmentCategory: undefined, | ||||||
|  |         departmentPerson: undefined, | ||||||
|  |         departmentPhone: undefined, | ||||||
|  |         departmentEmail: undefined, | ||||||
|  |         departmentFile: undefined, | ||||||
|  |         departmentNote: undefined, | ||||||
|  |         departmentStatus: '3', | ||||||
|  |       }, | ||||||
|  |       // 表单参数 | ||||||
|  |       form: {}, | ||||||
|  |       // 表单校验 | ||||||
|  |       rules: { | ||||||
|  |         departmentId: [ | ||||||
|  |           { required: true, message: "单位ID不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentName: [ | ||||||
|  |           { required: true, message: "单位名称不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentAddress: [ | ||||||
|  |           { required: true, message: "单位地址不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentCategory: [ | ||||||
|  |           { required: true, message: "单位性质,1企业,2科研机构,3高校不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentPerson: [ | ||||||
|  |           { required: true, message: "单位联系人姓名不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentPhone: [ | ||||||
|  |           { required: true, message: "单位联系人电话不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentEmail: [ | ||||||
|  |           { required: true, message: "单位联系人邮件不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentFile: [ | ||||||
|  |           { required: true, message: "相关文件不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |         departmentNote: [ | ||||||
|  |           { required: true, message: "其他备注信息不能为空", trigger: "blur" } | ||||||
|  |         ], | ||||||
|  |       } | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |     this.getList(); | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     /** 查询department列表 */ | ||||||
|  |     getList() { | ||||||
|  |       this.loading = true; | ||||||
|  |       listDepartment(this.queryParams).then(response => { | ||||||
|  |         this.departmentList = response.rows; | ||||||
|  |         this.total = response.total; | ||||||
|  |         this.loading = false; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     // 取消按钮 | ||||||
|  |     cancel() { | ||||||
|  |       this.open = false; | ||||||
|  |       this.reset(); | ||||||
|  |     }, | ||||||
|  |     // 表单重置 | ||||||
|  |     reset() { | ||||||
|  |       this.form = { | ||||||
|  |         departmentId: undefined, | ||||||
|  |         departmentName: undefined, | ||||||
|  |         departmentAddress: undefined, | ||||||
|  |         departmentCategory: undefined, | ||||||
|  |         departmentPerson: undefined, | ||||||
|  |         departmentPhone: undefined, | ||||||
|  |         departmentEmail: undefined, | ||||||
|  |         departmentFile: undefined, | ||||||
|  |         departmentNote: undefined, | ||||||
|  |         createBy: undefined, | ||||||
|  |         createTime: undefined, | ||||||
|  |         updateBy: undefined, | ||||||
|  |         updateTime: undefined | ||||||
|  |       }; | ||||||
|  |       this.resetForm("form"); | ||||||
|  |     }, | ||||||
|  |     /** 搜索按钮操作 */ | ||||||
|  |     handleQuery() { | ||||||
|  |       this.queryParams.pageNum = 1; | ||||||
|  |       this.getList(); | ||||||
|  |     }, | ||||||
|  |     /** 重置按钮操作 */ | ||||||
|  |     resetQuery() { | ||||||
|  |       this.resetForm("queryForm"); | ||||||
|  |       this.handleQuery(); | ||||||
|  |     }, | ||||||
|  |     // 多选框选中数据 | ||||||
|  |     handleSelectionChange(selection) { | ||||||
|  |       this.ids = selection.map(item => item.departmentId) | ||||||
|  |       this.single = selection.length!==1 | ||||||
|  |       this.multiple = !selection.length | ||||||
|  |     }, | ||||||
|  |     /** 新增按钮操作 */ | ||||||
|  |     handleAdd() { | ||||||
|  |       this.reset(); | ||||||
|  |       this.open = true; | ||||||
|  |       this.title = "添加department"; | ||||||
|  |     }, | ||||||
|  |     /** 修改按钮操作 */ | ||||||
|  |     handleUpdate(row) { | ||||||
|  |       this.loading = true; | ||||||
|  |       this.reset(); | ||||||
|  |       const departmentId = row.departmentId || this.ids | ||||||
|  |       getDepartment(departmentId).then(response => { | ||||||
|  |         this.loading = false; | ||||||
|  |         this.form = response.data; | ||||||
|  |         this.open = true; | ||||||
|  |         this.title = "修改department"; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 提交按钮 */ | ||||||
|  |     submitForm() { | ||||||
|  |       this.$refs["form"].validate(valid => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.buttonLoading = true; | ||||||
|  |           if (this.form.departmentId != null) { | ||||||
|  |             updateDepartment(this.form).then(response => { | ||||||
|  |               this.$modal.msgSuccess("修改成功"); | ||||||
|  |               this.open = false; | ||||||
|  |               this.getList(); | ||||||
|  |             }).finally(() => { | ||||||
|  |               this.buttonLoading = false; | ||||||
|  |             }); | ||||||
|  |           } else { | ||||||
|  |             addDepartment(this.form).then(response => { | ||||||
|  |               this.$modal.msgSuccess("新增成功"); | ||||||
|  |               this.open = false; | ||||||
|  |               this.getList(); | ||||||
|  |             }).finally(() => { | ||||||
|  |               this.buttonLoading = false; | ||||||
|  |             }); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 删除按钮操作 */ | ||||||
|  |     handleDelete(row) { | ||||||
|  |       const departmentIds = row.departmentId || this.ids; | ||||||
|  |       this.$modal.confirm('是否确认删除department编号为"' + departmentIds + '"的数据项?').then(() => { | ||||||
|  |         this.loading = true; | ||||||
|  |         return delDepartment(departmentIds); | ||||||
|  |       }).then(() => { | ||||||
|  |         this.loading = false; | ||||||
|  |         this.getList(); | ||||||
|  |         this.$modal.msgSuccess("删除成功"); | ||||||
|  |       }).catch(() => { | ||||||
|  |       }).finally(() => { | ||||||
|  |         this.loading = false; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 导出按钮操作 */ | ||||||
|  |     handleExport() { | ||||||
|  |       this.download('scientific/department/export', { | ||||||
|  |         ...this.queryParams | ||||||
|  |       }, `department_${new Date().getTime()}.xlsx`) | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     formatDepartmentCategory(row, column, cellValue) { | ||||||
|  |       switch (cellValue) { | ||||||
|  |         case '1': | ||||||
|  |           return '企业'; | ||||||
|  |         case '2': | ||||||
|  |           return '科研机构'; | ||||||
|  |         case '3': | ||||||
|  |           return '高校'; | ||||||
|  |         default: | ||||||
|  |           return '未知'; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     handleDepartmentDetail(row) { | ||||||
|  |       console.log(row); | ||||||
|  |       this.$router.push({ | ||||||
|  |         path: '/scientific/department/detail/' + row.departmentProcId, | ||||||
|  |         query: { | ||||||
|  |           processed: false, | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | </script> | ||||||
| @ -0,0 +1,109 @@ | |||||||
|  | package com.ruoyi.scientific.controller; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Arrays; | ||||||
|  | import java.util.concurrent.TimeUnit; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.scientific.domain.vo.DepartmentVo; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import javax.servlet.http.HttpServletResponse; | ||||||
|  | import javax.validation.constraints.*; | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import com.ruoyi.common.annotation.RepeatSubmit; | ||||||
|  | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.core.controller.BaseController; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.core.validate.AddGroup; | ||||||
|  | import com.ruoyi.common.core.validate.EditGroup; | ||||||
|  | import com.ruoyi.common.core.validate.QueryGroup; | ||||||
|  | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.scientific.domain.bo.DepartmentBo; | ||||||
|  | import com.ruoyi.scientific.service.IDepartmentService; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * department | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/scientific/department") | ||||||
|  | public class DepartmentController extends BaseController { | ||||||
|  | 
 | ||||||
|  |     private final IDepartmentService iDepartmentService; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:list") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo<DepartmentVo> list(DepartmentBo bo, PageQuery pageQuery) { | ||||||
|  |         return iDepartmentService.queryPageList(bo, pageQuery); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 导出department列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:export") | ||||||
|  |     @Log(title = "department", businessType = BusinessType.EXPORT) | ||||||
|  |     @PostMapping("/export") | ||||||
|  |     public void export(DepartmentBo bo, HttpServletResponse response) { | ||||||
|  |         List<DepartmentVo> list = iDepartmentService.queryList(bo); | ||||||
|  |         ExcelUtil.exportExcel(list, "department", DepartmentVo.class, response); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 获取department详细信息 | ||||||
|  |      * | ||||||
|  |      * @param departmentId 主键 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:query") | ||||||
|  |     @GetMapping("/{departmentId}") | ||||||
|  |     public R<DepartmentVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|  |                                      @PathVariable Long departmentId) { | ||||||
|  |         return R.ok(iDepartmentService.queryById(departmentId)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 新增department | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:add") | ||||||
|  |     @Log(title = "department", businessType = BusinessType.INSERT) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PostMapping() | ||||||
|  |     public R<Void> add(@Validated(AddGroup.class) @RequestBody DepartmentBo bo) { | ||||||
|  |         return toAjax(iDepartmentService.insertByBo(bo)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 修改department | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:edit") | ||||||
|  |     @Log(title = "department", businessType = BusinessType.UPDATE) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PutMapping() | ||||||
|  |     public R<Void> edit(@Validated(EditGroup.class) @RequestBody DepartmentBo bo) { | ||||||
|  |         return toAjax(iDepartmentService.updateByBo(bo)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 删除department | ||||||
|  |      * | ||||||
|  |      * @param departmentIds 主键串 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("scientific:department:remove") | ||||||
|  |     @Log(title = "department", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{departmentIds}") | ||||||
|  |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|  |                           @PathVariable Long[] departmentIds) { | ||||||
|  |         return toAjax(iDepartmentService.deleteWithValidByIds(Arrays.asList(departmentIds), true)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,72 @@ | |||||||
|  | package com.ruoyi.scientific.domain; | ||||||
|  | 
 | ||||||
|  | import com.baomidou.mybatisplus.annotation.*; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.math.BigDecimal; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * department对象 department | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @TableName("department") | ||||||
|  | public class Department extends BaseEntity { | ||||||
|  | 
 | ||||||
|  |     private static final long serialVersionUID=1L; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位ID | ||||||
|  |      */ | ||||||
|  |     @TableId(value = "department_id") | ||||||
|  |     private Long departmentId; | ||||||
|  |     /** | ||||||
|  |      * 单位名称 | ||||||
|  |      */ | ||||||
|  |     private String departmentName; | ||||||
|  |     /** | ||||||
|  |      * 单位地址 | ||||||
|  |      */ | ||||||
|  |     private String departmentAddress; | ||||||
|  |     /** | ||||||
|  |      * 单位性质,1企业,2科研机构,3高校 | ||||||
|  |      */ | ||||||
|  |     private String departmentCategory; | ||||||
|  |     /** | ||||||
|  |      * 单位联系人姓名 | ||||||
|  |      */ | ||||||
|  |     private String departmentPerson; | ||||||
|  |     /** | ||||||
|  |      * 单位联系人电话 | ||||||
|  |      */ | ||||||
|  |     private String departmentPhone; | ||||||
|  |     /** | ||||||
|  |      * 单位联系人邮件 | ||||||
|  |      */ | ||||||
|  |     private String departmentEmail; | ||||||
|  |     /** | ||||||
|  |      * 相关文件 | ||||||
|  |      */ | ||||||
|  |     private String departmentFile; | ||||||
|  |     /** | ||||||
|  |      * 其他备注信息 | ||||||
|  |      */ | ||||||
|  |     private String departmentNote; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程实例Id | ||||||
|  |      */ | ||||||
|  |     private String departmentProcId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过) | ||||||
|  |      */ | ||||||
|  |     private String departmentStatus; | ||||||
|  | } | ||||||
| @ -0,0 +1,80 @@ | |||||||
|  | package com.ruoyi.scientific.domain.bo; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.common.core.validate.AddGroup; | ||||||
|  | import com.ruoyi.common.core.validate.EditGroup; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import javax.validation.constraints.*; | ||||||
|  | 
 | ||||||
|  | import java.util.Date; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * department业务对象 department | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | public class DepartmentBo extends BaseEntity { | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位ID | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "单位ID不能为空", groups = { EditGroup.class }) | ||||||
|  |     private Long departmentId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位名称 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "单位不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String departmentName; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位地址 | ||||||
|  |      */ | ||||||
|  |     private String departmentAddress; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位性质,1企业,2科研机构,3高校 | ||||||
|  |      */ | ||||||
|  |     private String departmentCategory; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人姓名 | ||||||
|  |      */ | ||||||
|  |     private String departmentPerson; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人电话 | ||||||
|  |      */ | ||||||
|  |     private String departmentPhone; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人邮件 | ||||||
|  |      */ | ||||||
|  |     private String departmentEmail; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 相关文件 | ||||||
|  |      */ | ||||||
|  |     private String departmentFile; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 其他备注信息 | ||||||
|  |      */ | ||||||
|  |     private String departmentNote; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程实例Id | ||||||
|  |      */ | ||||||
|  |     private String departmentProcId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过) | ||||||
|  |      */ | ||||||
|  |     private String departmentStatus; | ||||||
|  | } | ||||||
| @ -0,0 +1,87 @@ | |||||||
|  | package com.ruoyi.scientific.domain.vo; | ||||||
|  | 
 | ||||||
|  | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||||
|  | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
|  | import com.ruoyi.common.annotation.ExcelDictFormat; | ||||||
|  | import com.ruoyi.common.convert.ExcelDictConvert; | ||||||
|  | import lombok.Data; | ||||||
|  | import java.util.Date; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * department视图对象 department | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @ExcelIgnoreUnannotated | ||||||
|  | public class DepartmentVo { | ||||||
|  | 
 | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位ID | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位ID") | ||||||
|  |     private Long departmentId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位名称 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位名称") | ||||||
|  |     private String departmentName; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位地址 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位地址") | ||||||
|  |     private String departmentAddress; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位性质,1企业,2科研机构,3高校 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位性质,1企业,2科研机构,3高校") | ||||||
|  |     private String departmentCategory; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人姓名 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位联系人姓名") | ||||||
|  |     private String departmentPerson; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人电话 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位联系人电话") | ||||||
|  |     private String departmentPhone; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 单位联系人邮件 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "单位联系人邮件") | ||||||
|  |     private String departmentEmail; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 相关文件 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "相关文件") | ||||||
|  |     private String departmentFile; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 其他备注信息 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "其他备注信息") | ||||||
|  |     private String departmentNote; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程实例Id | ||||||
|  |      */ | ||||||
|  |     private String departmentProcId; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过) | ||||||
|  |      */ | ||||||
|  |     private String departmentStatus; | ||||||
|  | } | ||||||
| @ -0,0 +1,59 @@ | |||||||
|  | package com.ruoyi.scientific.listener; | ||||||
|  | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
|  | import com.ruoyi.flowable.common.constant.ProcessConstants; | ||||||
|  | import com.ruoyi.scientific.domain.bo.DepartmentBo; | ||||||
|  | import com.ruoyi.scientific.service.IDepartmentService; | ||||||
|  | import com.ruoyi.scientific.service.IDepartmentService; | ||||||
|  | import org.flowable.engine.RuntimeService; | ||||||
|  | import org.flowable.engine.delegate.DelegateExecution; | ||||||
|  | import org.flowable.engine.delegate.ExecutionListener; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  | import org.flowable.engine.HistoryService; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.scientific.domain.vo.DepartmentVo; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | 
 | ||||||
|  | @Component | ||||||
|  | public class DepartmentUpdateListener implements ExecutionListener { | ||||||
|  |     /** | ||||||
|  |      * 注入字段(名称与流程设计时字段名称一致) | ||||||
|  |      */ | ||||||
|  | 
 | ||||||
|  |     private final IDepartmentService IdepartmentService = | ||||||
|  |         SpringUtils.getBean(IDepartmentService.class); | ||||||
|  |     private final HistoryService historyService = | ||||||
|  |         SpringUtils.getBean(HistoryService.class); | ||||||
|  | 
 | ||||||
|  |     private final RuntimeService runtimeService = | ||||||
|  |         SpringUtils.getBean(RuntimeService.class); | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void notify(DelegateExecution execution) { | ||||||
|  |         System.out.println("科研模块:执行合作单位更新任务监听器..."); | ||||||
|  | 
 | ||||||
|  |         String departmentProcId = execution.getProcessInstanceId(); | ||||||
|  |         DepartmentBo bo = new DepartmentBo(); | ||||||
|  |         bo.setDepartmentProcId(departmentProcId); | ||||||
|  |         PageQuery pageQuery = new PageQuery(); | ||||||
|  |         TableDataInfo<DepartmentVo> result = IdepartmentService.queryPageList(bo, pageQuery); | ||||||
|  |         Long departmentId = result.getRows().get(0).getDepartmentId(); | ||||||
|  | 
 | ||||||
|  |         // zqjia:获取在task complete时注入的review状态 | ||||||
|  |         String reviewStatus = (String) execution.getVariable("review"); | ||||||
|  |         // 获取流程状态 | ||||||
|  |         String status = (String) runtimeService.getVariable(departmentProcId, ProcessConstants.PROCESS_STATUS_KEY); | ||||||
|  | 
 | ||||||
|  |         // zqjia: runtimeService获取是否terminated,判断注入review字段可以区分是complete还是cancel | ||||||
|  |         if("terminated".equals(status)) { | ||||||
|  |             IdepartmentService.updateDepartmentInfoById(departmentId, "2"); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             if("1".equals(reviewStatus)) { | ||||||
|  |                 IdepartmentService.updateDepartmentInfoById(departmentId, "3"); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 IdepartmentService.updateDepartmentInfoById(departmentId, "0"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package com.ruoyi.scientific.mapper; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.scientific.domain.Department; | ||||||
|  | import com.ruoyi.scientific.domain.vo.DepartmentVo; | ||||||
|  | import com.ruoyi.common.core.mapper.BaseMapperPlus; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * departmentMapper接口 | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | public interface DepartmentMapper extends BaseMapperPlus<DepartmentMapper, Department, DepartmentVo> { | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,51 @@ | |||||||
|  | package com.ruoyi.scientific.service; | ||||||
|  | 
 | ||||||
|  | import com.ruoyi.scientific.domain.Department; | ||||||
|  | import com.ruoyi.scientific.domain.vo.DepartmentVo; | ||||||
|  | import com.ruoyi.scientific.domain.bo.DepartmentBo; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | 
 | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * departmentService接口 | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | public interface IDepartmentService { | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department | ||||||
|  |      */ | ||||||
|  |     DepartmentVo queryById(Long departmentId); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department列表 | ||||||
|  |      */ | ||||||
|  |     TableDataInfo<DepartmentVo> queryPageList(DepartmentBo bo, PageQuery pageQuery); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department列表 | ||||||
|  |      */ | ||||||
|  |     List<DepartmentVo> queryList(DepartmentBo bo); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 新增department | ||||||
|  |      */ | ||||||
|  |     Boolean insertByBo(DepartmentBo bo); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 修改department | ||||||
|  |      */ | ||||||
|  |     Boolean updateByBo(DepartmentBo bo); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除department信息 | ||||||
|  |      */ | ||||||
|  |     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); | ||||||
|  | 
 | ||||||
|  |     Boolean updateDepartmentInfoById(Long handbookId, String status); | ||||||
|  | } | ||||||
| @ -0,0 +1,134 @@ | |||||||
|  | package com.ruoyi.scientific.service.impl; | ||||||
|  | 
 | ||||||
|  | import cn.hutool.core.bean.BeanUtil; | ||||||
|  | import com.ruoyi.common.utils.StringUtils; | ||||||
|  | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
|  | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
|  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
|  | import com.ruoyi.scientific.domain.ProjectHandbook; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | import com.ruoyi.scientific.domain.bo.DepartmentBo; | ||||||
|  | import com.ruoyi.scientific.domain.vo.DepartmentVo; | ||||||
|  | import com.ruoyi.scientific.domain.Department; | ||||||
|  | import com.ruoyi.scientific.mapper.DepartmentMapper; | ||||||
|  | import com.ruoyi.scientific.service.IDepartmentService; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.Collection; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * departmentService业务层处理 | ||||||
|  |  * | ||||||
|  |  * @author zqjia | ||||||
|  |  * @date 2024-08-13 | ||||||
|  |  */ | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @Service | ||||||
|  | public class DepartmentServiceImpl implements IDepartmentService { | ||||||
|  | 
 | ||||||
|  |     private final DepartmentMapper baseMapper; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public DepartmentVo queryById(Long departmentId){ | ||||||
|  |         return baseMapper.selectVoById(departmentId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public TableDataInfo<DepartmentVo> queryPageList(DepartmentBo bo, PageQuery pageQuery) { | ||||||
|  |         LambdaQueryWrapper<Department> lqw = buildQueryWrapper(bo); | ||||||
|  |         Page<DepartmentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); | ||||||
|  |         return TableDataInfo.build(result); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询department列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<DepartmentVo> queryList(DepartmentBo bo) { | ||||||
|  |         LambdaQueryWrapper<Department> lqw = buildQueryWrapper(bo); | ||||||
|  |         return baseMapper.selectVoList(lqw); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private LambdaQueryWrapper<Department> buildQueryWrapper(DepartmentBo bo) { | ||||||
|  |         Map<String, Object> params = bo.getParams(); | ||||||
|  |         LambdaQueryWrapper<Department> lqw = Wrappers.lambdaQuery(); | ||||||
|  |         lqw.eq(bo.getDepartmentId() != null, Department::getDepartmentId, bo.getDepartmentId()); | ||||||
|  |         lqw.like(StringUtils.isNotBlank(bo.getDepartmentName()), Department::getDepartmentName, bo.getDepartmentName()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentAddress()), Department::getDepartmentAddress, bo.getDepartmentAddress()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentCategory()), Department::getDepartmentCategory, bo.getDepartmentCategory()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentPerson()), Department::getDepartmentPerson, bo.getDepartmentPerson()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentPhone()), Department::getDepartmentPhone, bo.getDepartmentPhone()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentEmail()), Department::getDepartmentEmail, bo.getDepartmentEmail()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentFile()), Department::getDepartmentFile, bo.getDepartmentFile()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentNote()), Department::getDepartmentNote, bo.getDepartmentNote()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentProcId()), Department::getDepartmentProcId, bo.getDepartmentProcId()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDepartmentStatus()), Department::getDepartmentStatus, bo.getDepartmentStatus()); | ||||||
|  |         return lqw; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 新增department | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean insertByBo(DepartmentBo bo) { | ||||||
|  |         Department add = BeanUtil.toBean(bo, Department.class); | ||||||
|  |         validEntityBeforeSave(add); | ||||||
|  |         boolean flag = baseMapper.insert(add) > 0; | ||||||
|  |         if (flag) { | ||||||
|  |             bo.setDepartmentId(add.getDepartmentId()); | ||||||
|  |         } | ||||||
|  |         return flag; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 修改department | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean updateByBo(DepartmentBo bo) { | ||||||
|  |         Department update = BeanUtil.toBean(bo, Department.class); | ||||||
|  |         validEntityBeforeSave(update); | ||||||
|  |         return baseMapper.updateById(update) > 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 保存前的数据校验 | ||||||
|  |      */ | ||||||
|  |     private void validEntityBeforeSave(Department entity){ | ||||||
|  |         //TODO 做一些数据校验,如唯一约束 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 批量删除department | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||||
|  |         if(isValid){ | ||||||
|  |             //TODO 做一些业务上的校验,判断是否需要校验 | ||||||
|  |         } | ||||||
|  |         return baseMapper.deleteBatchIds(ids) > 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public Boolean updateDepartmentInfoById(Long departmentId, String status){ | ||||||
|  |         // 获取项目的详细信息 | ||||||
|  |         Department update  = baseMapper.selectById(departmentId); | ||||||
|  |         if (update == null) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         // 更新状态信息 | ||||||
|  |         update.setDepartmentStatus(status); | ||||||
|  |         // 保存信息 | ||||||
|  |         validEntityBeforeSave(update); | ||||||
|  |         // 返回结果取决于是否更新成功 | ||||||
|  |         return baseMapper.updateById(update) > 0; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,24 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" ?> | ||||||
|  | <!DOCTYPE mapper | ||||||
|  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||||
|  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||||
|  | <mapper namespace="com.ruoyi.scientific.mapper.DepartmentMapper"> | ||||||
|  | 
 | ||||||
|  |     <resultMap type="com.ruoyi.scientific.domain.Department" id="DepartmentResult"> | ||||||
|  |         <result property="departmentId" column="department_id"/> | ||||||
|  |         <result property="departmentName" column="department_name"/> | ||||||
|  |         <result property="departmentAddress" column="department_address"/> | ||||||
|  |         <result property="departmentCategory" column="department_category"/> | ||||||
|  |         <result property="departmentPerson" column="department_person"/> | ||||||
|  |         <result property="departmentPhone" column="department_phone"/> | ||||||
|  |         <result property="departmentEmail" column="department_email"/> | ||||||
|  |         <result property="departmentFile" column="department_file"/> | ||||||
|  |         <result property="departmentNote" column="department_note"/> | ||||||
|  |         <result property="createBy" column="create_by"/> | ||||||
|  |         <result property="createTime" column="create_time"/> | ||||||
|  |         <result property="updateBy" column="update_by"/> | ||||||
|  |         <result property="updateTime" column="update_time"/> | ||||||
|  |     </resultMap> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | </mapper> | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user