sj
2 years ago
49 changed files with 0 additions and 9282 deletions
@ -1,9 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getActivityList(query) { |
||||
return request({ |
||||
url: '/bpm/activity/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
@ -1,24 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getProcessDefinitionPage(query) { |
||||
return request({ |
||||
url: '/bpm/process-definition/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function getProcessDefinitionList(query) { |
||||
return request({ |
||||
url: '/bpm/process-definition/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function getProcessDefinitionBpmnXML(id) { |
||||
return request({ |
||||
url: '/bpm/process-definition/get-bpmn-xml?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
@ -1,52 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建工作流的表单定义
|
||||
export function createForm(data) { |
||||
return request({ |
||||
url: '/bpm/form/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新工作流的表单定义
|
||||
export function updateForm(data) { |
||||
return request({ |
||||
url: '/bpm/form/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除工作流的表单定义
|
||||
export function deleteForm(id) { |
||||
return request({ |
||||
url: '/bpm/form/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得工作流的表单定义
|
||||
export function getForm(id) { |
||||
return request({ |
||||
url: '/bpm/form/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得工作流的表单定义分页
|
||||
export function getFormPage(query) { |
||||
return request({ |
||||
url: '/bpm/form/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 获得动态表单的精简列表
|
||||
export function getSimpleForms() { |
||||
return request({ |
||||
url: '/bpm/form/list-all-simple', |
||||
method: 'get' |
||||
}) |
||||
} |
@ -1,27 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建请假申请
|
||||
export function createLeave(data) { |
||||
return request({ |
||||
url: '/bpm/oa/leave/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 获得请假申请
|
||||
export function getLeave(id) { |
||||
return request({ |
||||
url: '/bpm/oa/leave/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得请假申请分页
|
||||
export function getLeavePage(query) { |
||||
return request({ |
||||
url: '/bpm/oa/leave/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
@ -1,58 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getModelPage(query) { |
||||
return request({ |
||||
url: '/bpm/model/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function getModel(id) { |
||||
return request({ |
||||
url: '/bpm/model/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export function updateModel(data) { |
||||
return request({ |
||||
url: '/bpm/model/update', |
||||
method: 'PUT', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 任务状态修改
|
||||
export function updateModelState(id, state) { |
||||
return request({ |
||||
url: '/bpm/model/update-state', |
||||
method: 'put', |
||||
data: { |
||||
id, |
||||
state |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export function createModel(data) { |
||||
return request({ |
||||
url: '/bpm/model/create', |
||||
method: 'POST', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function deleteModel(id) { |
||||
return request({ |
||||
url: '/bpm/model/delete?id=' + id, |
||||
method: 'DELETE' |
||||
}) |
||||
} |
||||
|
||||
export function deployModel(id) { |
||||
return request({ |
||||
url: '/bpm/model/deploy?id=' + id, |
||||
method: 'POST' |
||||
}) |
||||
} |
@ -1,35 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getMyProcessInstancePage(query) { |
||||
return request({ |
||||
url: '/bpm/process-instance/my-page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function createProcessInstance(data) { |
||||
return request({ |
||||
url: '/bpm/process-instance/create', |
||||
method: 'POST', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function cancelProcessInstance(id, reason) { |
||||
return request({ |
||||
url: '/bpm/process-instance/cancel', |
||||
method: 'DELETE', |
||||
data: { |
||||
id, |
||||
reason |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export function getProcessInstance(id) { |
||||
return request({ |
||||
url: '/bpm/process-instance/get?id=' + id, |
||||
method: 'get', |
||||
}) |
||||
} |
@ -1,56 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getTodoTaskPage(query) { |
||||
return request({ |
||||
url: '/bpm/task/todo-page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function getDoneTaskPage(query) { |
||||
return request({ |
||||
url: '/bpm/task/done-page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function completeTask(data) { |
||||
return request({ |
||||
url: '/bpm/task/complete', |
||||
method: 'PUT', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function approveTask(data) { |
||||
return request({ |
||||
url: '/bpm/task/approve', |
||||
method: 'PUT', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function rejectTask(data) { |
||||
return request({ |
||||
url: '/bpm/task/reject', |
||||
method: 'PUT', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function updateTaskAssignee(data) { |
||||
return request({ |
||||
url: '/bpm/task/update-assignee', |
||||
method: 'PUT', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function getTaskListByProcessInstanceId(processInstanceId) { |
||||
return request({ |
||||
url: '/bpm/task/list-by-process-instance-id?processInstanceId=' + processInstanceId, |
||||
method: 'get', |
||||
}) |
||||
} |
@ -1,25 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
export function getTaskAssignRuleList(query) { |
||||
return request({ |
||||
url: '/bpm/task-assign-rule/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function createTaskAssignRule(data) { |
||||
return request({ |
||||
url: '/bpm/task-assign-rule/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
export function updateTaskAssignRule(data) { |
||||
return request({ |
||||
url: '/bpm/task-assign-rule/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
@ -1,52 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建用户组
|
||||
export function createUserGroup(data) { |
||||
return request({ |
||||
url: '/bpm/user-group/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新用户组
|
||||
export function updateUserGroup(data) { |
||||
return request({ |
||||
url: '/bpm/user-group/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除用户组
|
||||
export function deleteUserGroup(id) { |
||||
return request({ |
||||
url: '/bpm/user-group/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得用户组
|
||||
export function getUserGroup(id) { |
||||
return request({ |
||||
url: '/bpm/user-group/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得用户组分页
|
||||
export function getUserGroupPage(query) { |
||||
return request({ |
||||
url: '/bpm/user-group/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 获取用户组精简信息列表
|
||||
export function listSimpleUserGroups() { |
||||
return request({ |
||||
url: '/bpm/user-group/list-all-simple', |
||||
method: 'get' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建
|
||||
export function createArea(data) { |
||||
return request({ |
||||
url: '/farm/area/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新
|
||||
export function updateArea(data) { |
||||
return request({ |
||||
url: '/farm/area/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export function deleteArea(id) { |
||||
return request({ |
||||
url: '/farm/area/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得
|
||||
export function getArea(id) { |
||||
return request({ |
||||
url: '/farm/area/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得分页
|
||||
export function getAreaPage(query) { |
||||
return request({ |
||||
url: '/farm/area/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出 Excel
|
||||
export function exportAreaExcel(query) { |
||||
return request({ |
||||
url: '/farm/area/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,62 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建
|
||||
export function createCrop(data) { |
||||
return request({ |
||||
url: '/farm/crop/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新
|
||||
export function updateCrop(data) { |
||||
return request({ |
||||
url: '/farm/crop/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export function deleteCrop(id) { |
||||
return request({ |
||||
url: '/farm/crop/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得
|
||||
export function getCrop(id) { |
||||
return request({ |
||||
url: '/farm/crop/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得分页
|
||||
export function getCropPage(query) { |
||||
return request({ |
||||
url: '/farm/crop/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出 Excel
|
||||
export function exportCropExcel(query) { |
||||
return request({ |
||||
url: '/farm/crop/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
||||
|
||||
//获得ERP Material 列表
|
||||
export function getMaterialList(){ |
||||
return request({ |
||||
url: '/farm/crop/getMaterialList', |
||||
method: 'get', |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建
|
||||
export function createCropRecord(data) { |
||||
return request({ |
||||
url: '/farm/crop-record/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新
|
||||
export function updateCropRecord(data) { |
||||
return request({ |
||||
url: '/farm/crop-record/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export function deleteCropRecord(id) { |
||||
return request({ |
||||
url: '/farm/crop-record/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得
|
||||
export function getCropRecord(id) { |
||||
return request({ |
||||
url: '/farm/crop-record/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得分页
|
||||
export function getCropRecordPage(query) { |
||||
return request({ |
||||
url: '/farm/crop-record/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出 Excel
|
||||
export function exportCropRecordExcel(query) { |
||||
return request({ |
||||
url: '/farm/crop-record/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场任务讨论
|
||||
export function createDiscuss(data) { |
||||
return request({ |
||||
url: '/farm/discuss/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场任务讨论
|
||||
export function updateDiscuss(data) { |
||||
return request({ |
||||
url: '/farm/discuss/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场任务讨论
|
||||
export function deleteDiscuss(id) { |
||||
return request({ |
||||
url: '/farm/discuss/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务讨论
|
||||
export function getDiscuss(id) { |
||||
return request({ |
||||
url: '/farm/discuss/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务讨论分页
|
||||
export function getDiscussPage(query) { |
||||
return request({ |
||||
url: '/farm/discuss/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场任务讨论 Excel
|
||||
export function exportDiscussExcel(query) { |
||||
return request({ |
||||
url: '/farm/discuss/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,63 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场任务事件
|
||||
export function createEvent(data) { |
||||
return request({ |
||||
url: '/farm/event/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场任务事件
|
||||
export function updateEvent(data) { |
||||
return request({ |
||||
url: '/farm/event/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场任务事件
|
||||
export function deleteEvent(id) { |
||||
return request({ |
||||
url: '/farm/event/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务事件
|
||||
export function getEvent(id) { |
||||
return request({ |
||||
url: '/farm/event/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务事件分页
|
||||
export function getEventPage(query) { |
||||
return request({ |
||||
url: '/farm/event/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 搜索条件获得农场任务事件分页
|
||||
export function getEventSearchPage(query) { |
||||
return request({ |
||||
url: '/farm/event/pageSearch', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场任务事件 Excel
|
||||
export function exportEventExcel(query) { |
||||
return request({ |
||||
url: '/farm/event/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建
|
||||
export function createLogMsg(data) { |
||||
return request({ |
||||
url: '/farm/log-msg/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新
|
||||
export function updateLogMsg(data) { |
||||
return request({ |
||||
url: '/farm/log-msg/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export function deleteLogMsg(id) { |
||||
return request({ |
||||
url: '/farm/log-msg/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得
|
||||
export function getLogMsg(id) { |
||||
return request({ |
||||
url: '/farm/log-msg/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得分页
|
||||
export function getLogMsgPage(query) { |
||||
return request({ |
||||
url: '/farm/log-msg/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出 Excel
|
||||
export function exportLogMsgExcel(query) { |
||||
return request({ |
||||
url: '/farm/log-msg/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,63 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场项目
|
||||
export function createProject(data) { |
||||
return request({ |
||||
url: '/farm/project/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场项目
|
||||
export function updateProject(data) { |
||||
return request({ |
||||
url: '/farm/project/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场项目
|
||||
export function deleteProject(id) { |
||||
return request({ |
||||
url: '/farm/project/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场项目
|
||||
export function getProject(id) { |
||||
return request({ |
||||
url: '/farm/project/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场项目分页
|
||||
export function getProjectPage(query) { |
||||
return request({ |
||||
url: '/farm/project/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 搜索条件获得农场项目分页
|
||||
export function getProjectSearchPage(query) { |
||||
return request({ |
||||
url: '/farm/project/pageSearch', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场项目 Excel
|
||||
export function exportProjectExcel(query) { |
||||
return request({ |
||||
url: '/farm/project/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场资源
|
||||
export function createResource(data) { |
||||
return request({ |
||||
url: '/farm/resource/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场资源
|
||||
export function updateResource(data) { |
||||
return request({ |
||||
url: '/farm/resource/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场资源
|
||||
export function deleteResource(id) { |
||||
return request({ |
||||
url: '/farm/resource/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场资源
|
||||
export function getResource(id) { |
||||
return request({ |
||||
url: '/farm/resource/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场资源分页
|
||||
export function getResourcePage(query) { |
||||
return request({ |
||||
url: '/farm/resource/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场资源 Excel
|
||||
export function exportResourceExcel(query) { |
||||
return request({ |
||||
url: '/farm/resource/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场资源分类
|
||||
export function createResourceType(data) { |
||||
return request({ |
||||
url: '/farm/resource-type/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场资源分类
|
||||
export function updateResourceType(data) { |
||||
return request({ |
||||
url: '/farm/resource-type/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场资源分类
|
||||
export function deleteResourceType(id) { |
||||
return request({ |
||||
url: '/farm/resource-type/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场资源分类
|
||||
export function getResourceType(id) { |
||||
return request({ |
||||
url: '/farm/resource-type/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场资源分类分页
|
||||
export function getResourceTypePage(query) { |
||||
return request({ |
||||
url: '/farm/resource-type/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场资源分类 Excel
|
||||
export function exportResourceTypeExcel(query) { |
||||
return request({ |
||||
url: '/farm/resource-type/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,72 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建农场任务
|
||||
export function createTask(data) { |
||||
return request({ |
||||
url: '/farm/task/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新农场任务
|
||||
export function updateTask(data) { |
||||
return request({ |
||||
url: '/farm/task/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除农场任务
|
||||
export function deleteTask(id) { |
||||
return request({ |
||||
url: '/farm/task/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务
|
||||
export function getTask(id) { |
||||
return request({ |
||||
url: '/farm/task/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得农场任务分页
|
||||
export function getTaskPage(query) { |
||||
return request({ |
||||
url: '/farm/task/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
//一次性获得农场任务分页数据
|
||||
export function getAdminTaskPage(query){ |
||||
return request({ |
||||
url: '/farm/task/apiPage', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 条件搜索获得农场任务分页
|
||||
export function getTaskSearchPage(query) { |
||||
return request({ |
||||
url: '/farm/task/pageSearch', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出农场任务 Excel
|
||||
export function exportTaskExcel(query) { |
||||
return request({ |
||||
url: '/farm/task/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建任务类型
|
||||
export function createTaskCate(data) { |
||||
return request({ |
||||
url: '/farm/task-cate/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新任务类型
|
||||
export function updateTaskCate(data) { |
||||
return request({ |
||||
url: '/farm/task-cate/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除任务类型
|
||||
export function deleteTaskCate(id) { |
||||
return request({ |
||||
url: '/farm/task-cate/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得任务类型
|
||||
export function getTaskCate(id) { |
||||
return request({ |
||||
url: '/farm/task-cate/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得任务类型分页
|
||||
export function getTaskCatePage(query) { |
||||
return request({ |
||||
url: '/farm/task-cate/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出任务类型 Excel
|
||||
export function exportTaskCateExcel(query) { |
||||
return request({ |
||||
url: '/farm/task-cate/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,54 +0,0 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 创建
|
||||
export function createWorkHour(data) { |
||||
return request({ |
||||
url: '/farm/work-hour/create', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 更新
|
||||
export function updateWorkHour(data) { |
||||
return request({ |
||||
url: '/farm/work-hour/update', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除
|
||||
export function deleteWorkHour(id) { |
||||
return request({ |
||||
url: '/farm/work-hour/delete?id=' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
// 获得
|
||||
export function getWorkHour(id) { |
||||
return request({ |
||||
url: '/farm/work-hour/get?id=' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 获得分页
|
||||
export function getWorkHourPage(query) { |
||||
return request({ |
||||
url: '/farm/work-hour/page', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 导出 Excel
|
||||
export function exportWorkHourExcel(query) { |
||||
return request({ |
||||
url: '/farm/work-hour/export-excel', |
||||
method: 'get', |
||||
params: query, |
||||
responseType: 'blob' |
||||
}) |
||||
} |
@ -1,175 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="定义编号" align="center" prop="id" width="400" /> |
||||
<el-table-column label="定义名称" align="center" prop="name" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="handleBpmnDetail(scope.row)"> |
||||
<span>{{ scope.row.name }}</span> |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="定义分类" align="center" prop="category" width="100"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="表单信息" align="center" prop="formType" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-if="scope.row.formId" type="text" @click="handleFormDetail(scope.row)"> |
||||
<span>{{ scope.row.formName }}</span> |
||||
</el-button> |
||||
<el-button v-else-if="scope.row.formCustomCreatePath" type="text" @click="handleFormDetail(scope.row)"> |
||||
<span>{{ scope.row.formCustomCreatePath }}</span> |
||||
</el-button> |
||||
<label v-else>暂无表单</label> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag> |
||||
<el-tag size="medium" type="warning" v-else>未部署</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" prop="version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag> |
||||
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.deploymentTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="定义描述" align="center" prop="description" width="300" show-overflow-tooltip /> |
||||
<el-table-column label="操作" align="center" width="150" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-s-custom" @click="handleAssignRule(scope.row)" |
||||
v-hasPermi="['bpm:task-assign-rule:update']">分配规则</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<!-- 流程表单配置详情 --> |
||||
<el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body> |
||||
<parser :key="new Date().getTime()" :form-conf="detailForm" /> |
||||
</el-dialog> |
||||
|
||||
<!-- 流程模型图的预览 --> |
||||
<el-dialog title="流程图" :visible.sync="showBpmnOpen" width="80%" append-to-body> |
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" /> |
||||
</el-dialog> |
||||
|
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- ========== 流程任务分配规则 ========== --> |
||||
<taskAssignRuleDialog ref="taskAssignRuleDialog" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getProcessDefinitionBpmnXML, getProcessDefinitionPage} from "@/api/bpm/definition"; |
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
||||
import {getForm} from "@/api/bpm/form"; |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
import Parser from '@/components/parser/Parser' |
||||
import taskAssignRuleDialog from "../taskAssignRule/taskAssignRuleDialog"; |
||||
|
||||
export default { |
||||
name: "processDefinition", |
||||
components: { |
||||
Parser, |
||||
taskAssignRuleDialog |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 表格数据 |
||||
list: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10 |
||||
}, |
||||
|
||||
// 流程表单详情 |
||||
detailOpen: false, |
||||
detailForm: { |
||||
fields: [] |
||||
}, |
||||
|
||||
// BPMN 数据 |
||||
showBpmnOpen: false, |
||||
bpmnXML: null, |
||||
bpmnControlForm: { |
||||
prefix: "activiti" |
||||
}, |
||||
|
||||
// 数据字典 |
||||
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), |
||||
}; |
||||
}, |
||||
created() { |
||||
const key = this.$route.query && this.$route.query.key |
||||
if (key) { |
||||
this.queryParams['key'] = key |
||||
} |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询流程定义列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
getProcessDefinitionPage(this.queryParams).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
} |
||||
); |
||||
}, |
||||
/** 流程表单的详情按钮操作 */ |
||||
handleFormDetail(row) { |
||||
// 流程表单 |
||||
if (row.formId) { |
||||
// 设置值 |
||||
this.detailForm = { |
||||
...JSON.parse(row.formConf), |
||||
fields: decodeFields(row.formFields) |
||||
} |
||||
// 弹窗打开 |
||||
this.detailOpen = true |
||||
// 业务表单 |
||||
} else if (row.formCustomCreatePath) { |
||||
this.$router.push({ path: row.formCustomCreatePath}); |
||||
} |
||||
}, |
||||
/** 流程图的详情按钮操作 */ |
||||
handleBpmnDetail(row) { |
||||
getProcessDefinitionBpmnXML(row.id).then(response => { |
||||
this.bpmnXML = response.data |
||||
// 弹窗打开 |
||||
this.showBpmnOpen = true |
||||
}) |
||||
}, |
||||
/** 处理任务分配规则列表的按钮操作 */ |
||||
handleAssignRule(row) { |
||||
this.$refs['taskAssignRuleDialog'].initProcessDefinition(row.id); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.my-process-designer { |
||||
height: calc(100vh - 200px); |
||||
} |
||||
</style> |
@ -1,569 +0,0 @@
|
||||
<template> |
||||
<div class="container"> |
||||
<div class="left-board"> |
||||
<div class="logo-wrapper"> |
||||
<div class="logo">流程表单</div> |
||||
</div> |
||||
<el-scrollbar class="left-scrollbar"> |
||||
<!-- 左边:表单项 --> |
||||
<div class="components-list"> |
||||
<div v-for="(item, listIndex) in leftComponents" :key="listIndex"> |
||||
<div class="components-title"> |
||||
<svg-icon icon-class="component" /> |
||||
{{ item.title }} |
||||
</div> |
||||
<draggable |
||||
class="components-draggable" |
||||
:list="item.list" |
||||
:group="{ name: 'componentsGroup', pull: 'clone', put: false }" |
||||
:clone="cloneComponent" |
||||
draggable=".components-item" |
||||
:sort="false" |
||||
@end="onEnd" |
||||
> |
||||
<div |
||||
v-for="(element, index) in item.list" |
||||
:key="index" |
||||
class="components-item" |
||||
@click="addComponent(element)" |
||||
> |
||||
<div class="components-body"> |
||||
<svg-icon :icon-class="element.__config__.tagIcon" /> |
||||
{{ element.__config__.label }} |
||||
</div> |
||||
</div> |
||||
</draggable> |
||||
</div> |
||||
|
||||
<!-- 左边:动态表单 --> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="表单名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入表单名" /> |
||||
</el-form-item> |
||||
<el-form-item label="开启状态" prop="status"> |
||||
<el-radio-group v-model="form.status"> |
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" |
||||
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
<el-form-item label="备注" prop="remark"> |
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-scrollbar> |
||||
</div> |
||||
|
||||
<div class="center-board"> |
||||
<div class="action-bar"> |
||||
<el-button icon="el-icon-check" type="text" @click="save">保存</el-button> |
||||
<!-- <el-button icon="el-icon-video-play" type="text" @click="run">--> |
||||
<!-- 运行--> |
||||
<!-- </el-button>--> |
||||
<el-button icon="el-icon-view" type="text" @click="showJson"> |
||||
查看json |
||||
</el-button> |
||||
<!-- <el-button icon="el-icon-download" type="text" @click="download">--> |
||||
<!-- 导出vue文件--> |
||||
<!-- </el-button>--> |
||||
<!-- <el-button class="copy-btn-main" icon="el-icon-document-copy" type="text" @click="copy">--> |
||||
<!-- 复制代码--> |
||||
<!-- </el-button>--> |
||||
<el-button class="delete-btn" icon="el-icon-delete" type="text" @click="empty"> |
||||
清空 |
||||
</el-button> |
||||
</div> |
||||
|
||||
<!-- 中间,表单项 --> |
||||
<el-scrollbar class="center-scrollbar"> |
||||
<el-row class="center-board-row" :gutter="formConf.gutter"> |
||||
<el-form |
||||
:size="formConf.size" |
||||
:label-position="formConf.labelPosition" |
||||
:disabled="formConf.disabled" |
||||
:label-width="formConf.labelWidth + 'px'" |
||||
> |
||||
<draggable class="drawing-board" :list="drawingList" :animation="340" group="componentsGroup"> |
||||
<draggable-item |
||||
v-for="(item, index) in drawingList" |
||||
:key="item.renderKey" |
||||
:drawing-list="drawingList" |
||||
:current-item="item" |
||||
:index="index" |
||||
:active-id="activeId" |
||||
:form-conf="formConf" |
||||
@activeItem="activeFormItem" |
||||
@copyItem="drawingItemCopy" |
||||
@deleteItem="drawingItemDelete" |
||||
/> |
||||
</draggable> |
||||
<div v-show="!drawingList.length" class="empty-info"> |
||||
从左侧拖入或点选组件进行表单设计 |
||||
</div> |
||||
</el-form> |
||||
</el-row> |
||||
</el-scrollbar> |
||||
</div> |
||||
|
||||
<!-- 右边:组件属性/表单属性 --> |
||||
<right-panel |
||||
:active-data="activeData" |
||||
:form-conf="formConf" |
||||
:show-field="!!drawingList.length" |
||||
@tag-change="tagChange" |
||||
@fetch-data="fetchData" |
||||
/> |
||||
|
||||
<!-- <form-drawer--> |
||||
<!-- :visible.sync="drawerVisible"--> |
||||
<!-- :form-data="formData"--> |
||||
<!-- size="100%"--> |
||||
<!-- :generate-conf="generateConf"--> |
||||
<!-- />--> |
||||
|
||||
<json-drawer |
||||
size="60%" |
||||
:visible.sync="jsonDrawerVisible" |
||||
:json-str="JSON.stringify(formData)" |
||||
@refresh="refreshJson" |
||||
/> |
||||
|
||||
<!-- <code-type-dialog--> |
||||
<!-- :visible.sync="dialogVisible"--> |
||||
<!-- title="选择生成类型"--> |
||||
<!-- :show-file-name="showFileName"--> |
||||
<!-- @confirm="generate"--> |
||||
<!-- />--> |
||||
|
||||
<!-- <input id="copyNode" type="hidden">--> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import draggable from 'vuedraggable' |
||||
import { debounce } from 'throttle-debounce' |
||||
import { saveAs } from 'file-saver' |
||||
import ClipboardJS from 'clipboard' |
||||
import render from '@/components/render/render' |
||||
import FormDrawer from '@/views/infra/build/FormDrawer' |
||||
import JsonDrawer from '@/views/infra/build/JsonDrawer' |
||||
import RightPanel from '@/views/infra/build/RightPanel' |
||||
import { |
||||
inputComponents, selectComponents, layoutComponents, formConf |
||||
} from '@/components/generator/config' |
||||
import { |
||||
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone, isObjectObject |
||||
} from '@/utils/index' |
||||
import { |
||||
makeUpHtml, vueTemplate, vueScript, cssStyle |
||||
} from '@/components/generator/html' |
||||
import { makeUpJs } from '@/components/generator/js' |
||||
import { makeUpCss } from '@/components/generator/css' |
||||
import drawingDefalut from '@/components/generator/drawingDefalut' |
||||
import logo from '@/assets/logo/logo.png' |
||||
import CodeTypeDialog from '@/views/infra/build/CodeTypeDialog' |
||||
import DraggableItem from '@/views/infra/build/DraggableItem' |
||||
import { |
||||
getDrawingList, saveDrawingList, getIdGlobal, saveIdGlobal, getFormConf |
||||
} from '@/utils/db' |
||||
import loadBeautifier from '@/utils/loadBeautifier' |
||||
import {CommonStatusEnum} from "@/utils/constants"; |
||||
import {createForm, getForm, updateForm} from "@/api/bpm/form"; |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
|
||||
let beautifier |
||||
const emptyActiveData = { style: {}, autosize: {} } |
||||
let oldActiveId |
||||
let tempActiveData |
||||
const drawingListInDB = getDrawingList() |
||||
const formConfInDB = getFormConf() |
||||
const idGlobal = getIdGlobal() |
||||
|
||||
export default { |
||||
components: { |
||||
draggable, |
||||
render, |
||||
FormDrawer, |
||||
JsonDrawer, |
||||
RightPanel, |
||||
CodeTypeDialog, |
||||
DraggableItem |
||||
}, |
||||
data() { |
||||
return { |
||||
logo, |
||||
idGlobal, |
||||
formConf, |
||||
inputComponents, |
||||
selectComponents, |
||||
layoutComponents, |
||||
labelWidth: 100, |
||||
// drawingList: drawingDefalut, |
||||
drawingData: {}, // 生成后的表单数据 |
||||
activeId: drawingDefalut[0].__config__.formId, |
||||
|
||||
drawingList: [], // 表单项的数组 |
||||
// activeId: undefined, |
||||
// activeData: {}, |
||||
|
||||
drawerVisible: false, |
||||
formData: {}, |
||||
dialogVisible: false, |
||||
jsonDrawerVisible: false, |
||||
generateConf: null, |
||||
showFileName: false, |
||||
activeData: drawingDefalut[0], // 右边编辑器激活的表单项 |
||||
saveDrawingListDebounce: debounce(340, saveDrawingList), |
||||
saveIdGlobalDebounce: debounce(340, saveIdGlobal), |
||||
leftComponents: [ |
||||
{ |
||||
title: '输入型组件', |
||||
list: inputComponents |
||||
}, |
||||
{ |
||||
title: '选择型组件', |
||||
list: selectComponents |
||||
}, |
||||
{ |
||||
title: '布局型组件', |
||||
list: layoutComponents |
||||
} |
||||
], |
||||
|
||||
// 表单参数 |
||||
form: { |
||||
status: CommonStatusEnum.ENABLE, |
||||
}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [{ required: true, message: "表单名不能为空", trigger: "blur" }], |
||||
status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }], |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
}, |
||||
watch: { |
||||
// eslint-disable-next-line func-names |
||||
'activeData.__config__.label': function (val, oldVal) { |
||||
if ( |
||||
this.activeData.placeholder === undefined |
||||
|| !this.activeData.__config__.tag |
||||
|| oldActiveId !== this.activeId |
||||
) { |
||||
return |
||||
} |
||||
this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '') + val |
||||
}, |
||||
activeId: { |
||||
handler(val) { |
||||
oldActiveId = val |
||||
}, |
||||
immediate: true |
||||
}, |
||||
drawingList: { |
||||
handler(val) { |
||||
this.saveDrawingListDebounce(val) |
||||
if (val.length === 0) this.idGlobal = 100 |
||||
}, |
||||
deep: true |
||||
}, |
||||
idGlobal: { |
||||
handler(val) { |
||||
this.saveIdGlobalDebounce(val) |
||||
}, |
||||
immediate: true |
||||
} |
||||
}, |
||||
mounted() { |
||||
// 【add by 芋道源码】不读缓存 |
||||
// if (Array.isArray(drawingListInDB) && drawingListInDB.length > 0) { |
||||
// this.drawingList = drawingListInDB |
||||
// } else { |
||||
// this.drawingList = drawingDefalut |
||||
// } |
||||
// this.activeFormItem(this.drawingList[0]) |
||||
// if (formConfInDB) { |
||||
// this.formConf = formConfInDB |
||||
// } |
||||
loadBeautifier(btf => { |
||||
beautifier = btf |
||||
}) |
||||
const clipboard = new ClipboardJS('#copyNode', { |
||||
text: trigger => { |
||||
const codeStr = this.generateCode() |
||||
this.$notify({ |
||||
title: '成功', |
||||
message: '代码已复制到剪切板,可粘贴。', |
||||
type: 'success' |
||||
}) |
||||
return codeStr |
||||
} |
||||
}) |
||||
clipboard.on('error', e => { |
||||
this.$message.error('代码复制失败') |
||||
}) |
||||
}, |
||||
created() { |
||||
// 读取表单配置 |
||||
const formId = this.$route.query && this.$route.query.formId |
||||
if (formId) { |
||||
getForm(formId).then(response => { |
||||
const data = response.data |
||||
this.form = { |
||||
id: data.id, |
||||
name: data.name, |
||||
status: data.status, |
||||
remark: data.remark |
||||
} |
||||
this.formConf = JSON.parse(data.conf) |
||||
this.drawingList = decodeFields(data.fields) |
||||
// 设置激活的表单项 |
||||
this.activeData = this.drawingList[0] |
||||
this.activeId = this.activeData.__config__.formId |
||||
// 设置 idGlobal,避免重复 |
||||
this.idGlobal += this.drawingList.length |
||||
}); |
||||
} |
||||
}, |
||||
methods: { |
||||
setObjectValueReduce(obj, strKeys, data) { |
||||
const arr = strKeys.split('.') |
||||
arr.reduce((pre, item, i) => { |
||||
if (arr.length === i + 1) { |
||||
pre[item] = data |
||||
} else if (!isObjectObject(pre[item])) { |
||||
pre[item] = {} |
||||
} |
||||
return pre[item] |
||||
}, obj) |
||||
}, |
||||
setRespData(component, resp) { |
||||
const { dataPath, renderKey, dataConsumer } = component.__config__ |
||||
if (!dataPath || !dataConsumer) return |
||||
const respData = dataPath.split('.').reduce((pre, item) => pre[item], resp) |
||||
|
||||
// 将请求回来的数据,赋值到指定属性。 |
||||
// 以el-tabel为例,根据Element文档,应该将数据赋值给el-tabel的data属性,所以dataConsumer的值应为'data'; |
||||
// 此时赋值代码可写成 component[dataConsumer] = respData; |
||||
// 但为支持更深层级的赋值(如:dataConsumer的值为'options.data'),使用setObjectValueReduce |
||||
this.setObjectValueReduce(component, dataConsumer, respData) |
||||
const i = this.drawingList.findIndex(item => item.__config__.renderKey === renderKey) |
||||
if (i > -1) this.$set(this.drawingList, i, component) |
||||
}, |
||||
fetchData(component) { |
||||
const { dataType, method, url } = component.__config__ |
||||
if (dataType === 'dynamic' && method && url) { |
||||
this.setLoading(component, true) |
||||
this.$axios({ |
||||
method, |
||||
url |
||||
}).then(resp => { |
||||
this.setLoading(component, false) |
||||
this.setRespData(component, resp.data) |
||||
}) |
||||
} |
||||
}, |
||||
setLoading(component, val) { |
||||
const { directives } = component |
||||
if (Array.isArray(directives)) { |
||||
const t = directives.find(d => d.name === 'loading') |
||||
if (t) t.value = val |
||||
} |
||||
}, |
||||
activeFormItem(currentItem) { |
||||
this.activeData = currentItem |
||||
this.activeId = currentItem.__config__.formId |
||||
}, |
||||
onEnd(obj) { |
||||
if (obj.from !== obj.to) { |
||||
this.fetchData(tempActiveData) |
||||
this.activeData = tempActiveData |
||||
this.activeId = this.idGlobal |
||||
} |
||||
}, |
||||
addComponent(item) { |
||||
const clone = this.cloneComponent(item) |
||||
this.fetchData(clone) |
||||
this.drawingList.push(clone) |
||||
this.activeFormItem(clone) |
||||
}, |
||||
cloneComponent(origin) { |
||||
const clone = deepClone(origin) |
||||
const config = clone.__config__ |
||||
config.span = this.formConf.span // 生成代码时,会根据span做精简判断 |
||||
this.createIdAndKey(clone) |
||||
clone.placeholder !== undefined && (clone.placeholder += config.label) |
||||
tempActiveData = clone |
||||
return tempActiveData |
||||
}, |
||||
createIdAndKey(item) { |
||||
const config = item.__config__ |
||||
config.formId = ++this.idGlobal |
||||
config.renderKey = `${config.formId}${+new Date()}` // 改变renderKey后可以实现强制更新组件 |
||||
if (config.layout === 'colFormItem') { |
||||
item.__vModel__ = `field${this.idGlobal}` |
||||
} else if (config.layout === 'rowFormItem') { |
||||
config.componentName = `row${this.idGlobal}` |
||||
!Array.isArray(config.children) && (config.children = []) |
||||
delete config.label // rowFormItem无需配置label属性 |
||||
} |
||||
if (Array.isArray(config.children)) { |
||||
config.children = config.children.map(childItem => this.createIdAndKey(childItem)) |
||||
} |
||||
return item |
||||
}, |
||||
// 获得表单数据 |
||||
AssembleFormData() { |
||||
this.formData = { |
||||
fields: deepClone(this.drawingList), |
||||
...this.formConf |
||||
} |
||||
}, |
||||
save() { |
||||
// this.AssembleFormData() |
||||
// console.log(this.formData) |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
const form = { |
||||
conf: JSON.stringify(this.formConf), // 表单配置 |
||||
fields: this.encodeFields(), // 表单项的数组 |
||||
...this.form // 表单名等 |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateForm(form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.close() |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createForm(form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.close() |
||||
}); |
||||
}); |
||||
}, |
||||
/** 关闭按钮 */ |
||||
close() { |
||||
this.$tab.closeOpenPage({ path: "/bpm/manager/form" }); |
||||
}, |
||||
encodeFields() { |
||||
const fields = [] |
||||
this.drawingList.forEach(item => { |
||||
fields.push(JSON.stringify(item)) |
||||
}) |
||||
return fields |
||||
}, |
||||
generate(data) { |
||||
const func = this[`exec${titleCase(this.operationType)}`] |
||||
this.generateConf = data |
||||
func && func(data) |
||||
}, |
||||
execRun(data) { |
||||
this.AssembleFormData() |
||||
this.drawerVisible = true |
||||
}, |
||||
execDownload(data) { |
||||
const codeStr = this.generateCode() |
||||
const blob = new Blob([codeStr], { type: 'text/plain;charset=utf-8' }) |
||||
saveAs(blob, data.fileName) |
||||
}, |
||||
execCopy(data) { |
||||
document.getElementById('copyNode').click() |
||||
}, |
||||
empty() { |
||||
this.$confirm('确定要清空所有组件吗?', '提示', { type: 'warning' }).then( |
||||
() => { |
||||
this.drawingList = [] |
||||
this.idGlobal = 100 |
||||
} |
||||
) |
||||
}, |
||||
drawingItemCopy(item, list) { |
||||
let clone = deepClone(item) |
||||
clone = this.createIdAndKey(clone) |
||||
list.push(clone) |
||||
this.activeFormItem(clone) |
||||
}, |
||||
drawingItemDelete(index, list) { |
||||
list.splice(index, 1) |
||||
this.$nextTick(() => { |
||||
const len = this.drawingList.length |
||||
if (len) { |
||||
this.activeFormItem(this.drawingList[len - 1]) |
||||
} |
||||
}) |
||||
}, |
||||
generateCode() { |
||||
const { type } = this.generateConf |
||||
this.AssembleFormData() |
||||
const script = vueScript(makeUpJs(this.formData, type)) |
||||
const html = vueTemplate(makeUpHtml(this.formData, type)) |
||||
const css = cssStyle(makeUpCss(this.formData)) |
||||
return beautifier.html(html + script + css, beautifierConf.html) |
||||
}, |
||||
showJson() { |
||||
this.AssembleFormData() |
||||
this.jsonDrawerVisible = true |
||||
}, |
||||
download() { |
||||
this.dialogVisible = true |
||||
this.showFileName = true |
||||
this.operationType = 'download' |
||||
}, |
||||
run() { |
||||
this.dialogVisible = true |
||||
this.showFileName = false |
||||
this.operationType = 'run' |
||||
}, |
||||
copy() { |
||||
this.dialogVisible = true |
||||
this.showFileName = false |
||||
this.operationType = 'copy' |
||||
}, |
||||
tagChange(newTag) { |
||||
newTag = this.cloneComponent(newTag) |
||||
const config = newTag.__config__ |
||||
newTag.__vModel__ = this.activeData.__vModel__ |
||||
config.formId = this.activeId |
||||
config.span = this.activeData.__config__.span |
||||
this.activeData.__config__.tag = config.tag |
||||
this.activeData.__config__.tagIcon = config.tagIcon |
||||
this.activeData.__config__.document = config.document |
||||
if (typeof this.activeData.__config__.defaultValue === typeof config.defaultValue) { |
||||
config.defaultValue = this.activeData.__config__.defaultValue |
||||
} |
||||
Object.keys(newTag).forEach(key => { |
||||
if (this.activeData[key] !== undefined) { |
||||
newTag[key] = this.activeData[key] |
||||
} |
||||
}) |
||||
this.activeData = newTag |
||||
this.updateDrawingList(newTag, this.drawingList) |
||||
}, |
||||
updateDrawingList(newTag, list) { |
||||
const index = list.findIndex(item => item.__config__.formId === this.activeId) |
||||
if (index > -1) { |
||||
list.splice(index, 1, newTag) |
||||
} else { |
||||
list.forEach(item => { |
||||
if (Array.isArray(item.__config__.children)) this.updateDrawingList(newTag, item.__config__.children) |
||||
}) |
||||
} |
||||
}, |
||||
refreshJson(data) { |
||||
this.drawingList = deepClone(data.fields) |
||||
delete data.fields |
||||
this.formConf = data |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang='scss'> |
||||
@import '@/styles/home'; |
||||
</style> |
@ -1,163 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="表单名" prop="name"> |
||||
<el-input v-model="queryParams.name" 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="['bpm:form:create']">新增</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="编号" align="center" prop="id" /> |
||||
<el-table-column label="表单名" align="center" prop="name" /> |
||||
<el-table-column label="开启状态" align="center" prop="status"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="备注" align="center" prop="remark" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleDetail(scope.row)" |
||||
v-hasPermi="['bpm:form:query']">详情</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
||||
v-hasPermi="['bpm:form:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['bpm:form:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!--表单配置详情--> |
||||
<el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body> |
||||
<div class="test-form"> |
||||
<parser :key="new Date().getTime()" :form-conf="detailForm" /> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {deleteForm, getForm, getFormPage} from "@/api/bpm/form"; |
||||
import Parser from '@/components/parser/Parser' |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
|
||||
export default { |
||||
name: "Form", |
||||
components: { |
||||
Parser |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 工作流的列表 |
||||
list: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
}, |
||||
// 表单详情 |
||||
detailOpen: false, |
||||
detailForm: { |
||||
fields: [] |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
// 执行查询 |
||||
getFormPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 详情按钮操作 */ |
||||
handleDetail(row) { |
||||
getForm(row.id).then(response => { |
||||
// 设置值 |
||||
const data = response.data |
||||
this.detailForm = { |
||||
...JSON.parse(data.conf), |
||||
fields: decodeFields(data.fields) |
||||
} |
||||
// 弹窗打开 |
||||
this.detailOpen = true |
||||
}) |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.$router.push({ |
||||
path:"/bpm/manager/form/edit" |
||||
}); |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.$router.push({ |
||||
path:"/bpm/manager/form/edit", |
||||
query:{ |
||||
formId: row.id |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除工作表单的编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteForm(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,251 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="组名" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入组名" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="状态" prop="status"> |
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable> |
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" |
||||
:key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['bpm:user-group:create']">新增</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="编号" align="center" prop="id" /> |
||||
<el-table-column label="组名" align="center" prop="name" /> |
||||
<el-table-column label="描述" align="center" prop="description" /> |
||||
<el-table-column label="成员" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span v-for="userId in scope.row.memberUserIds"> |
||||
{{ getUserNickname(userId) }} |
||||
</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" prop="status"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['bpm:user-group:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['bpm:user-group:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<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="name"> |
||||
<el-input v-model="form.name" placeholder="请输入组名" /> |
||||
</el-form-item> |
||||
<el-form-item label="描述" prop="description"> |
||||
<el-input v-model="form.description" placeholder="请输入描述" /> |
||||
</el-form-item> |
||||
<el-form-item label="成员" prop="memberUserIds"> |
||||
<el-select v-model="form.memberUserIds" multiple placeholder="请选择成员"> |
||||
<el-option v-for="user in users" :key="parseInt(user.id)" :label="user.nickname" :value="parseInt(user.id)"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="状态" prop="status"> |
||||
<el-radio-group v-model="form.status"> |
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" |
||||
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createUserGroup, updateUserGroup, deleteUserGroup, getUserGroup, getUserGroupPage } from "@/api/bpm/userGroup"; |
||||
import {CommonStatusEnum} from "@/utils/constants"; |
||||
import {listSimpleUsers} from "@/api/system/user"; |
||||
|
||||
export default { |
||||
name: "UserGroup", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 用户组列表 |
||||
list: [], |
||||
// 用户列表 |
||||
users: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
status: null, |
||||
tenantId: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [{ required: true, message: "组名不能为空", trigger: "blur" }], |
||||
description: [{ required: true, message: "描述不能为空", trigger: "blur" }], |
||||
memberUserIds: [{ required: true, message: "成员不能为空", trigger: "change" }], |
||||
status: [{ required: true, message: "状态不能为空", trigger: "blur" }], |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
// 获得用户列表 |
||||
listSimpleUsers().then(response => { |
||||
this.users = response.data; |
||||
}) |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getUserGroupPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
name: undefined, |
||||
description: undefined, |
||||
memberUserIds: [], |
||||
status: CommonStatusEnum.ENABLE, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加用户组"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getUserGroup(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改用户组"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateUserGroup(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createUserGroup(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除用户组编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteUserGroup(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
getUserNickname(userId) { |
||||
for (const user of this.users) { |
||||
if (user.id === userId) { |
||||
return user.nickname; |
||||
} |
||||
} |
||||
return '未知(' + userId + ')'; |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,545 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="流程标识" prop="key"> |
||||
<el-input v-model="queryParams.key" placeholder="请输入流程标识" clearable style="width: 240px;" |
||||
@keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="流程名称" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名称" clearable style="width: 240px;" |
||||
@keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="流程分类" prop="category"> |
||||
<el-select v-model="queryParams.category" placeholder="流程分类" clearable style="width: 240px"> |
||||
<el-option v-for="dict in categoryDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['bpm:model:create']">新建流程</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport" |
||||
v-hasPermi="['bpm:model:import']">导入流程</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="流程标识" align="center" prop="key" /> |
||||
<el-table-column label="流程名称" align="center" prop="name" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="handleBpmnDetail(scope.row)"> |
||||
<span>{{ scope.row.name }}</span> |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="流程分类" align="center" prop="category" width="100"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="表单信息" align="center" prop="formType" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-if="scope.row.formId" type="text" @click="handleFormDetail(scope.row)"> |
||||
<span>{{ scope.row.formName }}</span> |
||||
</el-button> |
||||
<el-button v-else-if="scope.row.formCustomCreatePath" type="text" @click="handleFormDetail(scope.row)"> |
||||
<span>{{ scope.row.formCustomCreatePath }}</span> |
||||
</el-button> |
||||
<label v-else>暂无表单</label> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="最新部署的流程定义" align="center"> |
||||
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-tag size="medium" v-if="scope.row.processDefinition">v{{ scope.row.processDefinition.version }}</el-tag> |
||||
<el-tag size="medium" type="warning" v-else>未部署</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="激活状态" align="center" prop="processDefinition.version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-switch v-if="scope.row.processDefinition" v-model="scope.row.processDefinition.suspensionState" |
||||
:active-value="1" :inactive-value="2" @change="handleChangeState(scope.row)" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.processDefinition">{{ parseTime(scope.row.processDefinition.deploymentTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="450" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
||||
v-hasPermi="['bpm:model:update']">修改流程</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-setting" @click="handleDesign(scope.row)" |
||||
v-hasPermi="['bpm:model:update']">设计流程</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-s-custom" @click="handleAssignRule(scope.row)" |
||||
v-hasPermi="['bpm:task-assign-rule:query']">分配规则</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-thumb" @click="handleDeploy(scope.row)" |
||||
v-hasPermi="['bpm:model:deploy']">发布流程</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-ice-cream-round" @click="handleDefinitionList(scope.row)" |
||||
v-hasPermi="['bpm:process-definition:query']">流程定义</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['bpm:model:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 流程表单配置详情 --> |
||||
<el-dialog title="表单详情" :visible.sync="detailOpen" width="50%" append-to-body> |
||||
<parser :key="new Date().getTime()" :form-conf="detailForm" /> |
||||
</el-dialog> |
||||
|
||||
<!-- 流程模型图的预览 --> |
||||
<el-dialog title="流程图" :visible.sync="showBpmnOpen" width="80%" append-to-body> |
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" /> |
||||
</el-dialog> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> |
||||
<el-form-item label="流程标识" prop="key"> |
||||
<el-input v-model="form.key" placeholder="请输入流标标识" style="width: 330px;" :disabled="form.id" /> |
||||
<el-tooltip v-if="!form.id" class="item" effect="light" content="新建后,流程标识不可修改!" placement="top"> |
||||
<i style="padding-left: 5px;" class="el-icon-question" /> |
||||
</el-tooltip> |
||||
<el-tooltip v-else class="item" effect="light" content="流程标识不可修改!" placement="top"> |
||||
<i style="padding-left: 5px;" class="el-icon-question" /> |
||||
</el-tooltip> |
||||
</el-form-item> |
||||
<el-form-item label="流程名称" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入流程名称" :disabled="form.id" clearable /> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.id" label="流程分类" prop="category"> |
||||
<el-select v-model="form.category" placeholder="请选择流程分类" clearable style="width: 100%"> |
||||
<el-option v-for="dict in categoryDictDatas" :key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="流程描述" prop="description"> |
||||
<el-input type="textarea" v-model="form.description" clearable /> |
||||
</el-form-item> |
||||
<div v-if="form.id"> |
||||
<el-form-item label="表单类型" prop="formType"> |
||||
<el-radio-group v-model="form.formType"> |
||||
<el-radio v-for="dict in modelFormTypeDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)"> |
||||
{{dict.label}} |
||||
</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.formType === 10" label="流程表单" prop="formId"> |
||||
<el-select v-model="form.formId" clearable style="width: 100%"> |
||||
<el-option v-for="form in forms" :key="form.id" :label="form.name" :value="form.id"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.formType === 20" label="表单提交路由" prop="formCustomCreatePath" > |
||||
<el-input v-model="form.formCustomCreatePath" placeholder="请输入表单提交路由" style="width: 330px;" /> |
||||
<el-tooltip class="item" effect="light" content="自定义表单的提交路径,使用 Vue 的路由地址,例如说:bpm/oa/leave/create" placement="top"> |
||||
<i style="padding-left: 5px;" class="el-icon-question" /> |
||||
</el-tooltip> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.formType === 20" label="表单查看路由" prop="formCustomViewPath"> |
||||
<el-input v-model="form.formCustomViewPath" placeholder="请输入表单查看路由" style="width: 330px;" /> |
||||
<el-tooltip class="item" effect="light" content="自定义表单的查看路径,使用 Vue 的路由地址,例如说:bpm/oa/leave/view" placement="top"> |
||||
<i style="padding-left: 5px;" class="el-icon-question" /> |
||||
</el-tooltip> |
||||
</el-form-item> |
||||
</div> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
|
||||
<!-- 用户导入对话框 --> |
||||
<el-dialog title="导入流程" :visible.sync="upload.open" width="400px" append-to-body> |
||||
<el-upload ref="upload" :limit="1" accept=".bpmn, .xml" :headers="upload.headers" :action="upload.url" |
||||
:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" |
||||
:auto-upload="false" name="bpmnFile" :data="upload.form" drag> |
||||
<i class="el-icon-upload"></i> |
||||
<div class="el-upload__text"> |
||||
将文件拖到此处,或 |
||||
<em>点击上传</em> |
||||
</div> |
||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“bpm”或“xml”格式文件!</div> |
||||
<div class="el-upload__tip" slot="tip"> |
||||
<el-form ref="uploadForm" size="mini" label-width="90px" :model="upload.form" :rules="upload.rules" @submit.native.prevent> |
||||
<el-form-item label="流程标识" prop="key"> |
||||
<el-input v-model="upload.form.key" placeholder="请输入流标标识" style="width: 250px;" /> |
||||
<el-tooltip class="item" effect="light" content="新建后,流程标识不可修改!" placement="top"> |
||||
<i style="padding-left: 5px;" class="el-icon-question" /> |
||||
</el-tooltip> |
||||
</el-form-item> |
||||
<el-form-item label="流程名称" prop="name"> |
||||
<el-input v-model="upload.form.name" placeholder="请输入流程名称" clearable /> |
||||
</el-form-item> |
||||
<el-form-item label="流程描述" prop="description"> |
||||
<el-input type="textarea" v-model="upload.form.description" clearable /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-upload> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button> |
||||
<el-button @click="uploadClose">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
|
||||
<!-- ========== 流程任务分配规则 ========== --> |
||||
<taskAssignRuleDialog ref="taskAssignRuleDialog" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
deleteModel, |
||||
deployModel, |
||||
getModelPage, |
||||
getModel, |
||||
updateModelState, |
||||
createModel, |
||||
updateModel |
||||
} from "@/api/bpm/model"; |
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
||||
import {getForm, getSimpleForms} from "@/api/bpm/form"; |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
import Parser from '@/components/parser/Parser' |
||||
import {getBaseHeader} from "@/utils/request"; |
||||
import taskAssignRuleDialog from "../taskAssignRule/taskAssignRuleDialog"; |
||||
|
||||
import Treeselect from "@riophae/vue-treeselect"; |
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
||||
|
||||
export default { |
||||
name: "model", |
||||
components: { |
||||
Parser, |
||||
Treeselect, |
||||
taskAssignRuleDialog |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 表格数据 |
||||
list: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10 |
||||
}, |
||||
|
||||
// BPMN 数据 |
||||
showBpmnOpen: false, |
||||
bpmnXML: null, |
||||
bpmnControlForm: { |
||||
prefix: "activiti" |
||||
}, |
||||
|
||||
// 流程表单详情 |
||||
detailOpen: false, |
||||
detailForm: { |
||||
fields: [] |
||||
}, |
||||
|
||||
// 流程表单 |
||||
title: "", |
||||
open: false, |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
key: [{ required: true, message: "流程标识不能为空", trigger: "blur" }], |
||||
name: [{ required: true, message: "流程名称不能为空", trigger: "blur" }], |
||||
formType: [{ required: true, message: "流程名称不能为空", trigger: "blur" }], |
||||
formId: [{ required: true, message: "业务表单不能为空", trigger: "blur" }], |
||||
category: [{ required: true, message: "流程分类不能为空", trigger: "blur" }], |
||||
formCustomCreatePath: [{ required: true, message: "表单提交路由不能为空", trigger: "blur" }], |
||||
formCustomViewPath: [{ required: true, message: "表单查看路由不能为空", trigger: "blur" }], |
||||
}, |
||||
|
||||
// 流程导入参数 |
||||
upload: { |
||||
// 是否显示弹出层(用户导入) |
||||
open: false, |
||||
// 是否禁用上传 |
||||
isUploading: false, |
||||
// 设置上传的请求头部 |
||||
headers: getBaseHeader(), |
||||
// 上传的地址 |
||||
url: process.env.VUE_APP_BASE_API + '/admin-api' + "/bpm/model/import", |
||||
// 表单 |
||||
form: {}, |
||||
// 校验规则 |
||||
rules: { |
||||
key: [{ required: true, message: "流程标识不能为空", trigger: "blur" }], |
||||
name: [{ required: true, message: "流程名称不能为空", trigger: "blur" }], |
||||
}, |
||||
}, |
||||
// 流程表单的下拉框的数据 |
||||
forms: [], |
||||
|
||||
// 数据字典 |
||||
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), |
||||
modelFormTypeDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_FORM_TYPE), |
||||
taskAssignRuleDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
// 获得流程表单的下拉框的数据 |
||||
getSimpleForms().then(response => { |
||||
this.forms = response.data |
||||
}) |
||||
}, |
||||
methods: { |
||||
/** 查询流程模型列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
getModelPage(this.queryParams).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
} |
||||
); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
key: undefined, |
||||
name: undefined, |
||||
description: undefined, |
||||
category: undefined, |
||||
formType: undefined, |
||||
formId: undefined, |
||||
formCustomCreatePath: undefined, |
||||
formCustomViewPath: undefined |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRange = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.title = "新建模型"; |
||||
this.open = true; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
this.title = "修改模型"; |
||||
this.open = true; |
||||
// 设置 form |
||||
this.form = { |
||||
...row |
||||
}; |
||||
// 触发一次校验 |
||||
// this.$refs["form"].validate(); |
||||
}, |
||||
/** 设计按钮操作 */ |
||||
handleDesign(row) { |
||||
this.$router.push({ |
||||
path:"/bpm/manager/model/design", |
||||
query:{ |
||||
modelId: row.id |
||||
} |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 更新 |
||||
if (this.form.id) { |
||||
updateModel({ |
||||
...this.form, |
||||
formId: this.form.formType === 10 ? this.form.formId : undefined, |
||||
formCustomCreatePath: this.form.formType === 20 ? this.form.formCustomCreatePath : undefined, |
||||
formCustomViewPath: this.form.formType === 20 ? this.form.formCustomViewPath : undefined, |
||||
}).then(response => { |
||||
this.$modal.msgSuccess("修改模型成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 创建 |
||||
createModel(this.form).then(response => { |
||||
this.open = false; |
||||
this.getList(); |
||||
this.$alert('<strong>新建模型成功!</strong>后续需要执行如下 4 个步骤:' + |
||||
'<div>1. 点击【修改流程】按钮,配置流程的分类、表单信息</div>' + |
||||
'<div>2. 点击【设计流程】按钮,绘制流程图</div>' + |
||||
'<div>3. 点击【分配规则】按钮,设置每个用户任务的审批人</div>' + |
||||
'<div>4. 点击【发布流程】按钮,完成流程的最终发布</div>' + |
||||
'另外,每次流程修改后,都需要点击【发布流程】按钮,才能正式生效!!!', |
||||
'重要提示', { |
||||
dangerouslyUseHTMLString: true, |
||||
type: 'success' |
||||
}); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const that = this; |
||||
this.$modal.confirm('是否删除该流程!!').then(function() { |
||||
deleteModel(row.id).then(response => { |
||||
that.getList(); |
||||
that.msgSuccess("删除成功"); |
||||
}) |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 部署按钮操作 */ |
||||
handleDeploy(row) { |
||||
const that = this; |
||||
this.$modal.confirm('是否部署该流程!!').then(function() { |
||||
deployModel(row.id).then(response => { |
||||
that.getList(); |
||||
that.msgSuccess("部署成功"); |
||||
}) |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 流程表单的详情按钮操作 */ |
||||
handleFormDetail(row) { |
||||
// 流程表单 |
||||
if (row.formId) { |
||||
getForm(row.formId).then(response => { |
||||
// 设置值 |
||||
const data = response.data |
||||
this.detailForm = { |
||||
...JSON.parse(data.conf), |
||||
fields: decodeFields(data.fields) |
||||
} |
||||
// 弹窗打开 |
||||
this.detailOpen = true |
||||
}) |
||||
// 业务表单 |
||||
} else if (row.formCustomCreatePath) { |
||||
this.$router.push({ path: row.formCustomCreatePath}); |
||||
} |
||||
}, |
||||
/** 流程图的详情按钮操作 */ |
||||
handleBpmnDetail(row) { |
||||
getModel(row.id).then(response => { |
||||
this.bpmnXML = response.data.bpmnXml |
||||
// 弹窗打开 |
||||
this.showBpmnOpen = true |
||||
}) |
||||
}, |
||||
/** 跳转流程定义的列表 */ |
||||
handleDefinitionList(row) { |
||||
this.$router.push({ |
||||
path:"/bpm/manager/definition", |
||||
query:{ |
||||
key: row.key |
||||
} |
||||
}); |
||||
}, |
||||
/** 更新状态操作 */ |
||||
handleChangeState(row) { |
||||
const id = row.id; |
||||
let state = row.processDefinition.suspensionState; |
||||
let statusState = state === 1 ? '激活' : '挂起'; |
||||
this.$modal.confirm('是否确认' + statusState + '流程名字为"' + row.name + '"的数据项?').then(function() { |
||||
return updateModelState(id, state); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess(statusState + "成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导入按钮操作 */ |
||||
handleImport() { |
||||
this.upload.open = true; |
||||
}, |
||||
// 文件上传中处理 |
||||
handleFileUploadProgress(event, file, fileList) { |
||||
this.upload.isUploading = true; |
||||
}, |
||||
// 文件上传成功处理 |
||||
handleFileSuccess(response, file, fileList) { |
||||
if (response.code !== 0) { |
||||
this.$modal.msgError(response.msg) |
||||
return; |
||||
} |
||||
// 重置表单 |
||||
this.uploadClose(); |
||||
// 提示,并刷新 |
||||
this.$modal.msgSuccess("导入流程成功!请点击【设计流程】按钮,进行编辑保存后,才可以进行【发布流程】"); |
||||
this.getList(); |
||||
}, |
||||
uploadClose() { |
||||
// 关闭弹窗 |
||||
this.upload.open = false; |
||||
// 重置上传状态和文件 |
||||
this.upload.isUploading = false; |
||||
this.$refs.upload.clearFiles(); |
||||
// 重置表单 |
||||
this.upload.form = {}; |
||||
this.resetForm("uploadForm"); |
||||
}, |
||||
/** 提交上传文件 */ |
||||
submitFileForm() { |
||||
this.$refs["uploadForm"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.$refs.upload.submit(); |
||||
}) |
||||
}, |
||||
/** 处理任务分配规则列表的按钮操作 */ |
||||
handleAssignRule(row) { |
||||
this.$refs['taskAssignRuleDialog'].initModel(row.id); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.my-process-designer { |
||||
height: calc(100vh - 200px); |
||||
} |
||||
</style> |
@ -1,185 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
|
||||
<!-- 流程设计器,负责绘制流程等 --> |
||||
<my-process-designer :key="`designer-${reloadIndex}`" v-model="xmlString" v-bind="controlForm" |
||||
keyboard ref="processDesigner" @init-finished="initModeler" |
||||
@save="save"/> |
||||
|
||||
<!-- 流程属性器,负责编辑每个流程节点的属性 --> |
||||
<my-properties-panel :key="`penal-${reloadIndex}`" :bpmn-modeler="modeler" :prefix="controlForm.prefix" class="process-panel" |
||||
:model="model" /> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import translations from "@/components/bpmnProcessDesigner/src/translations"; |
||||
// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务) |
||||
import CustomContentPadProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/content-pad"; |
||||
// 自定义左侧菜单(修改 默认任务 为 用户任务) |
||||
import CustomPaletteProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/palette"; |
||||
// import xmlObj2json from "./utils/xml2json"; |
||||
import MyProcessPalette from "@/components/bpmnProcessDesigner/package/palette/ProcessPalette"; |
||||
import {createModel, getModel, updateModel} from "@/api/bpm/model"; |
||||
// 自定义侧边栏 |
||||
// import MyProcessPanel from "../package/process-panel/ProcessPanel"; |
||||
|
||||
export default { |
||||
name: "App", |
||||
components: { MyProcessPalette }, |
||||
data() { |
||||
return { |
||||
xmlString: "", // BPMN XML |
||||
modeler: null, |
||||
reloadIndex: 0, |
||||
controlDrawerVisible: false, |
||||
translationsSelf: translations, |
||||
controlForm: { |
||||
simulation: true, |
||||
labelEditing: false, |
||||
labelVisible: false, |
||||
prefix: "activiti", |
||||
headerButtonSize: "mini", |
||||
additionalModel: [CustomContentPadProvider, CustomPaletteProvider] |
||||
}, |
||||
addis: { |
||||
CustomContentPadProvider, |
||||
CustomPaletteProvider |
||||
}, |
||||
// 流程模型的信息 |
||||
model: {}, |
||||
}; |
||||
}, |
||||
created() { |
||||
// 如果 modelId 非空,说明是修改流程模型 |
||||
const modelId = this.$route.query && this.$route.query.modelId |
||||
if (modelId) { |
||||
getModel(modelId).then(response => { |
||||
this.xmlString = response.data.bpmnXml |
||||
this.model = { |
||||
...response.data, |
||||
bpmnXml: undefined, // 清空 bpmnXml 属性 |
||||
} |
||||
// this.controlForm.processId = response.data.key |
||||
}) |
||||
} |
||||
}, |
||||
methods: { |
||||
initModeler(modeler) { |
||||
setTimeout(() => { |
||||
this.modeler = modeler; |
||||
console.log(modeler); |
||||
}, 10); |
||||
}, |
||||
reloadProcessDesigner(deep) { |
||||
this.controlForm.additionalModel = []; |
||||
for (let key in this.addis) { |
||||
if (this.addis[key]) { |
||||
this.controlForm.additionalModel.push(this.addis[key]); |
||||
} |
||||
} |
||||
deep && (this.xmlString = undefined); |
||||
this.reloadIndex += 1; |
||||
this.modeler = null; // 避免 panel 异常 |
||||
// if (deep) { |
||||
// this.xmlString = undefined; |
||||
// this.$refs.processDesigner.processRestart(); |
||||
// } |
||||
}, |
||||
save(bpmnXml) { |
||||
const data = { |
||||
...this.model, |
||||
bpmnXml: bpmnXml, // this.bpmnXml 只是初始化流程图,后续修改无法通过它获得 |
||||
} |
||||
|
||||
// 修改的提交 |
||||
if (data.id) { |
||||
updateModel(data).then(response => { |
||||
this.$modal.msgSuccess("修改成功") |
||||
// 跳转回去 |
||||
this.close() |
||||
}) |
||||
return |
||||
} |
||||
// 添加的提交 |
||||
createModel(data).then(response => { |
||||
this.$modal.msgSuccess("保存成功") |
||||
// 跳转回去 |
||||
this.close() |
||||
}) |
||||
}, |
||||
/** 关闭按钮 */ |
||||
close() { |
||||
this.$tab.closeOpenPage({ path: "/bpm/manager/model" }); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
//body { |
||||
// overflow: hidden; |
||||
// margin: 0; |
||||
// box-sizing: border-box; |
||||
//} |
||||
//.app { |
||||
// width: 100%; |
||||
// height: 100%; |
||||
// box-sizing: border-box; |
||||
// display: inline-grid; |
||||
// grid-template-columns: 100px auto max-content; |
||||
//} |
||||
.demo-control-bar { |
||||
position: fixed; |
||||
right: 8px; |
||||
bottom: 8px; |
||||
z-index: 1; |
||||
.open-control-dialog { |
||||
width: 48px; |
||||
height: 48px; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
border-radius: 4px; |
||||
font-size: 32px; |
||||
background: rgba(64, 158, 255, 1); |
||||
color: #ffffff; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
|
||||
// TODO 芋艿:去掉多余的 faq |
||||
//.info-tip { |
||||
// position: fixed; |
||||
// top: 40px; |
||||
// right: 500px; |
||||
// z-index: 10; |
||||
// color: #999999; |
||||
//} |
||||
|
||||
.control-form { |
||||
.el-radio { |
||||
width: 100%; |
||||
line-height: 32px; |
||||
} |
||||
} |
||||
.element-overlays { |
||||
box-sizing: border-box; |
||||
padding: 8px; |
||||
background: rgba(0, 0, 0, 0.6); |
||||
border-radius: 4px; |
||||
color: #fafafa; |
||||
} |
||||
|
||||
.my-process-designer { |
||||
height: calc(100vh - 84px); |
||||
} |
||||
.process-panel__container { |
||||
position: absolute; |
||||
right: 0; |
||||
top: 55px; |
||||
height: calc(100vh - 84px); |
||||
} |
||||
|
||||
</style> |
@ -1,75 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="开始时间" prop="startTime"> |
||||
<el-date-picker clearable size="small" v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" /> |
||||
</el-form-item> |
||||
<el-form-item label="结束时间" prop="endTime"> |
||||
<el-date-picker clearable size="small" v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" /> |
||||
</el-form-item> |
||||
<el-form-item label="请假类型" prop="type"> |
||||
<el-select v-model="form.type" placeholder="请选择"> |
||||
<el-option v-for="dict in typeDictData" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="原因" prop="reason"> |
||||
<el-col :span="10"> |
||||
<el-input type="textarea" :rows="3" v-model="form.reason" placeholder="请输入原因" /> |
||||
</el-col> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="submitForm">提 交</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createLeave} from "@/api/bpm/leave" |
||||
import { getDictDatas, DICT_TYPE } from '@/utils/dict' |
||||
|
||||
export default { |
||||
name: "LeaveCreate", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 表单参数 |
||||
form: { |
||||
startTime: undefined, |
||||
endTime: undefined, |
||||
type: undefined, |
||||
reason: undefined, |
||||
}, |
||||
// 表单校验 |
||||
rules: { |
||||
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }], |
||||
endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }], |
||||
type: [{ required: true, message: "请假类型不能为空", trigger: "change" }], |
||||
reason: [{ required: true, message: "请假原因不能为空", trigger: "change" }], |
||||
}, |
||||
|
||||
typeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE), |
||||
}; |
||||
}, |
||||
created() { |
||||
}, |
||||
methods: { |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
|
||||
// 添加的提交 |
||||
createLeave(this.form).then(response => { |
||||
this.$modal.msgSuccess("发起成功"); |
||||
this.$tab.closeOpenPage({ path: "/bpm/oa/leave" }); |
||||
}); |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,53 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> |
||||
<el-form-item label="开始时间:" prop="startTime"> {{parseTime(form.startTime, '{y}-{m}-{d}')}} </el-form-item> |
||||
<el-form-item label="结束时间:" prop="endTime"> {{parseTime(form.endTime, '{y}-{m}-{d}')}} </el-form-item> |
||||
<el-form-item label="请假类型:" prop="type"> |
||||
<dict-tag :type="DICT_TYPE.BPM_OA_LEAVE_TYPE" :value="form.type"/> |
||||
</el-form-item> |
||||
<el-form-item label="原因:" prop="reason"> {{ form.reason }}</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getLeave} from "@/api/bpm/leave" |
||||
import {getDictDatas, DICT_TYPE} from '@/utils/dict' |
||||
export default { |
||||
name: "LeaveDetail", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
id: undefined, // 请假编号 |
||||
// 表单参数 |
||||
form: { |
||||
startTime: undefined, |
||||
endTime: undefined, |
||||
type: undefined, |
||||
reason: undefined, |
||||
}, |
||||
|
||||
typeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.id = this.$route.query.id; |
||||
if (!this.id) { |
||||
this.$message.error('未传递 id 参数,无法查看 OA 请假信息'); |
||||
return; |
||||
} |
||||
this.getDetail(); |
||||
}, |
||||
methods: { |
||||
/** 获得请假信息 */ |
||||
getDetail() { |
||||
getLeave(this.id).then(response => { |
||||
this.form = response.data; |
||||
}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,178 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="请假类型" prop="type"> |
||||
<el-select v-model="queryParams.type" placeholder="请选择请假类型" clearable> |
||||
<el-option v-for="dict in leaveTypeDictData" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="申请时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item label="结果" prop="result"> |
||||
<el-select v-model="queryParams.result" placeholder="请选择流结果" clearable> |
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)" |
||||
:key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="原因" prop="reason"> |
||||
<el-input v-model="queryParams.reason" placeholder="请输入原因" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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" |
||||
v-hasPermi="['bpm:oa-leave:create']" @click="handleAdd">发起请假</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="申请编号" align="center" prop="id" /> |
||||
<el-table-column label="状态" align="center" prop="result"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="开始时间" align="center" prop="startTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.startTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.endTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="请假类型" align="center" prop="type"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_OA_LEAVE_TYPE" :value="scope.row.type"/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="原因" align="center" prop="reason" /> |
||||
<el-table-column label="申请时间" align="center" prop="applyTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleCancel(scope.row)" |
||||
v-hasPermi="['bpm:oa-leave:create']" v-if="scope.row.result === 1">取消请假</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)" |
||||
v-hasPermi="['bpm:oa-leave:query']">详情</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleProcessDetail(scope.row)">审批进度</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getLeavePage } from "@/api/bpm/leave" |
||||
import { getDictDatas, DICT_TYPE } from '@/utils/dict' |
||||
import {cancelProcessInstance} from "@/api/bpm/processInstance"; |
||||
|
||||
export default { |
||||
name: "Leave", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 请假申请列表 |
||||
list: [], |
||||
//审批进度弹出层 |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
result: null, |
||||
type: null, |
||||
reason: null, |
||||
}, |
||||
|
||||
leaveTypeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE), |
||||
leaveResultData: getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getLeavePage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.$router.push({ path: "/bpm/oa/leave/create"}); |
||||
}, |
||||
/** 详情按钮操作 */ |
||||
handleDetail(row) { |
||||
this.$router.push({ path: "/bpm/oa/leave/detail", query: { id: row.id}}); |
||||
}, |
||||
/** 查看审批进度的操作 */ |
||||
handleProcessDetail(row) { |
||||
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstanceId}}); |
||||
}, |
||||
/** 取消请假 */ |
||||
handleCancel(row) { |
||||
const id = row.processInstanceId; |
||||
this.$prompt('请输入取消原因?', "取消流程", { |
||||
type: 'warning', |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, // 判断非空,且非空格 |
||||
inputErrorMessage: "取消原因不能为空", |
||||
}).then(({ value }) => { |
||||
return cancelProcessInstance(id, value); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("取消成功"); |
||||
}) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,169 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!-- 第一步,通过流程定义的列表,选择对应的流程 --> |
||||
<div v-if="!selectProcessInstance"> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="流程名称" align="center" prop="name" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="handleBpmnDetail(scope.row)"> |
||||
<span>{{ scope.row.name }}</span> |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="流程分类" align="center" prop="category" width="100"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="流程描述" align="center" prop="description" width="300" show-overflow-tooltip /> |
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" size="small" icon="el-icon-plus" @click="handleSelect(scope.row)">选择</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
<!-- 第二步,填写表单,进行流程的提交 --> |
||||
<div v-else> |
||||
<el-card class="box-card" > |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-document">申请信息【{{ selectProcessInstance.name }}】</span> |
||||
<el-button style="float: right;" type="primary" @click="selectProcessInstance = undefined">选择其它流程</el-button> |
||||
</div> |
||||
<el-col :span="16" :offset="6"> |
||||
<div> |
||||
<parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> |
||||
</div> |
||||
</el-col> |
||||
</el-card> |
||||
<el-card class="box-card"> |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-picture-outline">流程图</span> |
||||
</div> |
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" /> |
||||
</el-card> |
||||
</div> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getProcessDefinitionBpmnXML, getProcessDefinitionList} from "@/api/bpm/definition"; |
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
||||
import {getForm} from "@/api/bpm/form"; |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
import Parser from '@/components/parser/Parser' |
||||
import {createProcessInstance, getMyProcessInstancePage} from "@/api/bpm/processInstance"; |
||||
|
||||
// 流程实例的发起 |
||||
export default { |
||||
name: "ProcessInstanceCreate", |
||||
components: { |
||||
Parser |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 表格数据 |
||||
list: [], |
||||
|
||||
// 流程表单详情 |
||||
detailForm: { |
||||
fields: [] |
||||
}, |
||||
|
||||
// BPMN 数据 |
||||
bpmnXML: null, |
||||
bpmnControlForm: { |
||||
prefix: "activiti" |
||||
}, |
||||
|
||||
// 流程表单 |
||||
selectProcessInstance: undefined, // 选择的流程实例 |
||||
|
||||
// 数据字典 |
||||
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询流程定义列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
getProcessDefinitionList({ |
||||
suspensionState: 1 |
||||
}).then(response => { |
||||
this.list = response.data |
||||
this.loading = false |
||||
} |
||||
); |
||||
}, |
||||
/** 处理选择流程的按钮操作 **/ |
||||
handleSelect(row) { |
||||
// 设置选择的流程 |
||||
this.selectProcessInstance = row; |
||||
|
||||
// 流程表单 |
||||
if (row.formId) { |
||||
// 设置对应的表单 |
||||
this.detailForm = { |
||||
...JSON.parse(row.formConf), |
||||
fields: decodeFields(row.formFields) |
||||
} |
||||
|
||||
// 加载流程图 |
||||
getProcessDefinitionBpmnXML(row.id).then(response => { |
||||
this.bpmnXML = response.data |
||||
}) |
||||
} else if (row.formCustomCreatePath) { |
||||
this.$router.push({ path: row.formCustomCreatePath}); |
||||
// 这里暂时无需加载流程图,因为跳出到另外个 Tab; |
||||
} |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm(params) { |
||||
if (!params) { |
||||
return; |
||||
} |
||||
// 设置表单禁用 |
||||
const conf = params.conf; |
||||
conf.disabled = true; // 表单禁用 |
||||
conf.formBtns = false; // 按钮隐藏 |
||||
|
||||
// 提交表单,创建流程 |
||||
const variables = params.values; |
||||
createProcessInstance({ |
||||
processDefinitionId: this.selectProcessInstance.id, |
||||
variables: variables |
||||
}).then(response => { |
||||
this.$modal.msgSuccess("发起流程成功"); |
||||
// 关闭当前窗口 |
||||
this.$tab.closeOpenPage(); |
||||
this.$router.go(-1); |
||||
}).catch(() => { |
||||
conf.disabled = false; // 表单开启 |
||||
conf.formBtns = true; // 按钮展示 |
||||
}) |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.my-process-designer { |
||||
height: calc(100vh - 200px); |
||||
} |
||||
|
||||
.box-card { |
||||
width: 100%; |
||||
margin-bottom: 20px; |
||||
} |
||||
</style> |
@ -1,424 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<!-- 审批信息 --> |
||||
<el-card class="box-card" v-loading="processInstanceLoading" v-for="(item, index) in runningTasks" :key="index"> |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-picture-outline">审批任务【{{ item.name }}】</span> |
||||
</div> |
||||
<el-col :span="16" :offset="6" > |
||||
<el-form :ref="'form' + index" :model="auditForms[index]" :rules="auditRule" label-width="100px"> |
||||
<el-form-item label="流程名" v-if="processInstance && processInstance.name"> |
||||
{{ processInstance.name }} |
||||
</el-form-item> |
||||
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser"> |
||||
{{ processInstance.startUser.nickname }} |
||||
<el-tag type="info" size="mini">{{ processInstance.startUser.deptName }}</el-tag> |
||||
</el-form-item> |
||||
<el-form-item label="审批建议" prop="comment"> |
||||
<el-input type="textarea" v-model="auditForms[index].comment" placeholder="请输入审批建议" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px;"> |
||||
<el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleAudit(item, true)">通过</el-button> |
||||
<el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleAudit(item, false)">不通过</el-button> |
||||
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleUpdateAssignee(item)">转办</el-button> |
||||
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate(item)">委派</el-button> |
||||
<el-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleBack(item)">退回</el-button> |
||||
</div> |
||||
</el-col> |
||||
</el-card> |
||||
<!-- 申请信息 --> |
||||
<el-card class="box-card" v-loading="processInstanceLoading"> |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-document">申请信息【{{ processInstance.name }}】</span> |
||||
</div> |
||||
<el-col v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 10" |
||||
:span="16" :offset="6"> |
||||
<div > |
||||
<parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> |
||||
</div> |
||||
</el-col> |
||||
<div v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 20"> |
||||
<router-link :to="this.processInstance.processDefinition.formCustomViewPath + '?id=' |
||||
+ this.processInstance.businessKey"> |
||||
<el-button type="primary">点击查看</el-button> |
||||
</router-link> |
||||
</div> |
||||
</el-card> |
||||
<el-card class="box-card" v-loading="tasksLoad"> |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-picture-outline">审批记录</span> |
||||
</div> |
||||
<el-col :span="16" :offset="4" > |
||||
<div class="block"> |
||||
<el-timeline> |
||||
<el-timeline-item v-for="(item, index) in tasks" :key="index" |
||||
:icon="getTimelineItemIcon(item)" :type="getTimelineItemType(item)"> |
||||
<p style="font-weight: 700">任务:{{ item.name }}</p> |
||||
<el-card :body-style="{ padding: '10px' }"> |
||||
<label v-if="item.assigneeUser" style="font-weight: normal; margin-right: 30px;"> |
||||
审批人:{{ item.assigneeUser.nickname }} |
||||
<el-tag type="info" size="mini">{{ item.assigneeUser.deptName }}</el-tag> |
||||
</label> |
||||
<label style="font-weight: normal">创建时间:</label> |
||||
<label style="color:#8a909c; font-weight: normal">{{ parseTime(item.createTime) }}</label> |
||||
<label v-if="item.endTime" style="margin-left: 30px;font-weight: normal">审批时间:</label> |
||||
<label v-if="item.endTime" style="color:#8a909c;font-weight: normal"> {{ parseTime(item.endTime) }}</label> |
||||
<label v-if="item.durationInMillis" style="margin-left: 30px;font-weight: normal">耗时:</label> |
||||
<label v-if="item.durationInMillis" style="color:#8a909c;font-weight: normal"> {{ getDateStar(item.durationInMillis) }} </label> |
||||
<p v-if="item.comment"> |
||||
<el-tag :type="getTimelineItemType(item)">{{ item.comment }}</el-tag> |
||||
</p> |
||||
</el-card> |
||||
</el-timeline-item> |
||||
</el-timeline> |
||||
</div> |
||||
</el-col> |
||||
</el-card> |
||||
|
||||
<!-- 高亮流程图 --> |
||||
<el-card class="box-card" v-loading="processInstanceLoading"> |
||||
<div slot="header" class="clearfix"> |
||||
<span class="el-icon-picture-outline">流程图</span> |
||||
</div> |
||||
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" :activityData="activityList" |
||||
:processInstanceData="processInstance" :taskData="tasks" /> |
||||
</el-card> |
||||
|
||||
<!-- 对话框(转派审批人) --> |
||||
<el-dialog title="转派审批人" :visible.sync="updateAssignee.open" width="500px" append-to-body> |
||||
<el-form ref="updateAssigneeForm" :model="updateAssignee.form" :rules="updateAssignee.rules" label-width="110px"> |
||||
<el-form-item label="新审批人" prop="assigneeUserId"> |
||||
<el-select v-model="updateAssignee.form.assigneeUserId" clearable style="width: 100%"> |
||||
<el-option v-for="item in userOptions" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitUpdateAssigneeForm">确 定</el-button> |
||||
<el-button @click="cancelUpdateAssigneeForm">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getProcessDefinitionBpmnXML} from "@/api/bpm/definition"; |
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
||||
import store from "@/store"; |
||||
import {decodeFields} from "@/utils/formGenerator"; |
||||
import Parser from '@/components/parser/Parser' |
||||
import {createProcessInstance, getProcessInstance} from "@/api/bpm/processInstance"; |
||||
import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssignee} from "@/api/bpm/task"; |
||||
import {getDate} from "@/utils/dateUtils"; |
||||
import {listSimpleUsers} from "@/api/system/user"; |
||||
import {getActivityList} from "@/api/bpm/activity"; |
||||
|
||||
// 流程实例的详情页,可用于审批 |
||||
export default { |
||||
name: "ProcessInstanceDetail", |
||||
components: { |
||||
Parser |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
processInstanceLoading: true, |
||||
// 流程实例 |
||||
id: undefined, // 流程实例的编号 |
||||
processInstance: {}, |
||||
|
||||
// 流程表单详情 |
||||
detailForm: { |
||||
fields: [] |
||||
}, |
||||
|
||||
// BPMN 数据 |
||||
bpmnXML: null, |
||||
bpmnControlForm: { |
||||
prefix: "activiti" |
||||
}, |
||||
activityList: [], |
||||
|
||||
// 审批记录 |
||||
tasksLoad: true, |
||||
tasks: [], |
||||
|
||||
// 审批表单 |
||||
runningTasks: [], |
||||
auditForms: [], |
||||
auditRule: { |
||||
comment: [{ required: true, message: "审批建议不能为空", trigger: "blur" }], |
||||
}, |
||||
|
||||
// 转派审批人 |
||||
userOptions: [], |
||||
updateAssignee: { |
||||
open: false, |
||||
form: { |
||||
assigneeUserId: undefined, |
||||
}, |
||||
rules: { |
||||
assigneeUserId: [{ required: true, message: "新审批人不能为空", trigger: "change" }], |
||||
} |
||||
}, |
||||
|
||||
// 数据字典 |
||||
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.id = this.$route.query.id; |
||||
if (!this.id) { |
||||
this.$message.error('未传递 id 参数,无法查看流程信息'); |
||||
return; |
||||
} |
||||
this.getDetail(); |
||||
|
||||
// 获得用户列表 |
||||
this.userOptions = []; |
||||
listSimpleUsers().then(response => { |
||||
this.userOptions.push(...response.data); |
||||
}); |
||||
}, |
||||
methods: { |
||||
/** 获得流程实例 */ |
||||
getDetail() { |
||||
// 获得流程实例相关 |
||||
this.processInstanceLoading = true; |
||||
getProcessInstance(this.id).then(response => { |
||||
if (!response.data) { |
||||
this.$message.error('查询不到流程信息!'); |
||||
return; |
||||
} |
||||
// 设置流程信息 |
||||
this.processInstance = response.data; |
||||
|
||||
// 设置表单信息 |
||||
if (this.processInstance.processDefinition.formType === 10) { |
||||
this.detailForm = { |
||||
...JSON.parse(this.processInstance.processDefinition.formConf), |
||||
disabled: true, // 表单禁用 |
||||
formBtns: false, // 按钮隐藏 |
||||
fields: decodeFields(this.processInstance.processDefinition.formFields) |
||||
} |
||||
// 设置表单的值 |
||||
this.detailForm.fields.forEach(item => { |
||||
const val = this.processInstance.formVariables[item.__vModel__] |
||||
if (val) { |
||||
item.__config__.defaultValue = val |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 加载流程图 |
||||
getProcessDefinitionBpmnXML(this.processInstance.processDefinition.id).then(response => { |
||||
this.bpmnXML = response.data |
||||
}); |
||||
// 加载活动列表 |
||||
getActivityList({ |
||||
processInstanceId: this.processInstance.id |
||||
}).then(response => { |
||||
this.activityList = response.data; |
||||
}); |
||||
|
||||
// 取消加载中 |
||||
this.processInstanceLoading = false; |
||||
}); |
||||
|
||||
// 获得流程任务列表(审批记录) |
||||
this.tasksLoad = true; |
||||
this.runningTasks = []; |
||||
this.auditForms = []; |
||||
getTaskListByProcessInstanceId(this.id).then(response => { |
||||
// 审批记录 |
||||
this.tasks = response.data; |
||||
// 排序,将未完成的排在前面,已完成的排在后面; |
||||
this.tasks.sort((a, b) => { |
||||
// 有已完成的情况,按照完成时间倒序 |
||||
if (a.endTime && b.endTime) { |
||||
return b.endTime - a.endTime; |
||||
} else if (a.endTime) { |
||||
return 1; |
||||
} else if (b.endTime) { |
||||
return -1; |
||||
// 都是未完成,按照创建时间倒序 |
||||
} else { |
||||
return b.createTime - a.createTime; |
||||
} |
||||
}); |
||||
|
||||
// 需要审核的记录 |
||||
const userId = store.getters.userId; |
||||
this.tasks.forEach(task => { |
||||
if (task.result !== 1) { // 只有待处理才需要 |
||||
return; |
||||
} |
||||
if (!task.assigneeUser || task.assigneeUser.id !== userId) { // 自己不是处理人 |
||||
return; |
||||
} |
||||
this.runningTasks.push({...task}); |
||||
this.auditForms.push({ |
||||
comment: '' |
||||
}) |
||||
}); |
||||
|
||||
// 取消加载中 |
||||
this.tasksLoad = false; |
||||
}); |
||||
}, |
||||
/** 处理选择流程的按钮操作 **/ |
||||
handleSelect(row) { |
||||
// 设置选择的流程 |
||||
this.selectProcessInstance = row; |
||||
|
||||
// 流程表单 |
||||
if (row.formId) { |
||||
// 设置对应的表单 |
||||
this.detailForm = { |
||||
...JSON.parse(row.formConf), |
||||
fields: decodeFields(row.formFields) |
||||
} |
||||
} else if (row.formCustomCreatePath) { |
||||
this.$router.push({ path: row.formCustomCreatePath}); |
||||
// 这里暂时无需加载流程图,因为跳出到另外个 Tab; |
||||
} |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm(params) { |
||||
if (!params) { |
||||
return; |
||||
} |
||||
// 设置表单禁用 |
||||
const conf = params.conf; |
||||
conf.disabled = true; // 表单禁用 |
||||
conf.formBtns = false; // 按钮隐藏 |
||||
|
||||
// 提交表单,创建流程 |
||||
const variables = params.values; |
||||
createProcessInstance({ |
||||
processDefinitionId: this.selectProcessInstance.id, |
||||
variables: variables |
||||
}).then(response => { |
||||
this.$modal.msgSuccess("发起流程成功"); |
||||
// 关闭当前窗口 |
||||
this.$tab.closeOpenPage(); |
||||
this.$router.go(-1); |
||||
}).catch(() => { |
||||
conf.disabled = false; // 表单开启 |
||||
conf.formBtns = true; // 按钮展示 |
||||
}) |
||||
}, |
||||
getDateStar(ms) { |
||||
return getDate(ms); |
||||
}, |
||||
getTimelineItemIcon(item) { |
||||
if (item.result === 1) { |
||||
return 'el-icon-time'; |
||||
} |
||||
if (item.result === 2) { |
||||
return 'el-icon-check'; |
||||
} |
||||
if (item.result === 3) { |
||||
return 'el-icon-close'; |
||||
} |
||||
if (item.result === 4) { |
||||
return 'el-icon-remove-outline'; |
||||
} |
||||
return ''; |
||||
}, |
||||
getTimelineItemType(item) { |
||||
if (item.result === 1) { |
||||
return 'primary'; |
||||
} |
||||
if (item.result === 2) { |
||||
return 'success'; |
||||
} |
||||
if (item.result === 3) { |
||||
return 'danger'; |
||||
} |
||||
if (item.result === 4) { |
||||
return 'info'; |
||||
} |
||||
return ''; |
||||
}, |
||||
/** 处理审批通过和不通过的操作 */ |
||||
handleAudit(task, pass) { |
||||
const index = this.runningTasks.indexOf(task); |
||||
this.$refs['form' + index][0].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
const data = { |
||||
id: task.id, |
||||
comment: this.auditForms[index].comment |
||||
} |
||||
if (pass) { |
||||
approveTask(data).then(response => { |
||||
this.$modal.msgSuccess("审批通过成功!"); |
||||
this.getDetail(); // 获得最新详情 |
||||
}); |
||||
} else { |
||||
rejectTask(data).then(response => { |
||||
this.$modal.msgSuccess("审批不通过成功!"); |
||||
this.getDetail(); // 获得最新详情 |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
/** 处理转派审批人 */ |
||||
handleUpdateAssignee(task) { |
||||
// 设置表单 |
||||
this.resetUpdateAssigneeForm(); |
||||
this.updateAssignee.form.id = task.id; |
||||
// 设置为打开 |
||||
this.updateAssignee.open = true; |
||||
}, |
||||
/** 提交转派审批人 */ |
||||
submitUpdateAssigneeForm() { |
||||
this.$refs['updateAssigneeForm'].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
updateTaskAssignee(this.updateAssignee.form).then(response => { |
||||
this.$modal.msgSuccess("转派任务成功!"); |
||||
this.updateAssignee.open = false; |
||||
this.getDetail(); // 获得最新详情 |
||||
}); |
||||
}); |
||||
}, |
||||
/** 取消转派审批人 */ |
||||
cancelUpdateAssigneeForm() { |
||||
this.updateAssignee.open = false; |
||||
this.resetUpdateAssigneeForm(); |
||||
}, |
||||
/** 重置转派审批人 */ |
||||
resetUpdateAssigneeForm() { |
||||
this.updateAssignee.form = { |
||||
id: undefined, |
||||
assigneeUserId: undefined, |
||||
}; |
||||
this.resetForm("updateAssigneeForm"); |
||||
}, |
||||
/** 处理审批退回的操作 */ |
||||
handleDelegate(task) { |
||||
this.$modal.msgError("暂不支持【委派】功能,可以使用【转派】替代!"); |
||||
}, |
||||
/** 处理审批退回的操作 */ |
||||
handleBack(task) { |
||||
this.$modal.msgError("暂不支持【退回】功能!"); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.my-process-designer { |
||||
height: calc(100vh - 200px); |
||||
} |
||||
|
||||
.box-card { |
||||
width: 100%; |
||||
margin-bottom: 20px; |
||||
} |
||||
</style> |
@ -1,187 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="流程名" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="所属流程" prop="processDefinitionId"> |
||||
<el-input v-model="queryParams.processDefinitionId" placeholder="请输入流程定义的编号" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="流程分类" prop="category"> |
||||
<el-select v-model="queryParams.category" placeholder="请选择流程分类" clearable> |
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)" |
||||
:key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="提交时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item label="状态" prop="status"> |
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable> |
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)" |
||||
:key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="结果" prop="result"> |
||||
<el-select v-model="queryParams.result" placeholder="请选择流结果" clearable> |
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)" |
||||
:key="dict.value" :label="dict.label" :value="dict.value"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['bpm:process-instance:query']">发起流程</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="编号" align="center" prop="id" width="320" /> |
||||
<el-table-column label="流程名" align="center" prop="name" /> |
||||
<el-table-column label="流程分类" align="center" prop="category"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="当前审批任务" align="center" prop="tasks"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-for="task in scope.row.tasks" :key="task" type="text" @click="handleFormDetail(task.id)"> |
||||
<span>{{ task.name }}</span> |
||||
</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" prop="status"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="scope.row.status" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="结果" align="center" prop="result"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="提交时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="结束时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.endTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" size="small" icon="el-icon-delete" v-if="scope.row.result === 1" |
||||
v-hasPermi="['bpm:process-instance:cancel']" @click="handleCancel(scope.row)">取消</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)" |
||||
v-hasPermi="['bpm:process-instance:query']">详情</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getMyProcessInstancePage, cancelProcessInstance } from "@/api/bpm/processInstance"; |
||||
|
||||
export default { |
||||
name: "ProcessInstance", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 工作流的流程实例的拓展列表 |
||||
list: [], |
||||
// 是否显示弹出层 |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
processDefinitionId: null, |
||||
category: null, |
||||
status: null, |
||||
result: null, |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getMyProcessInstancePage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 **/ |
||||
handleAdd() { |
||||
this.$router.push({ path: "/bpm/process-instance/create"}) |
||||
}, |
||||
/** 取消按钮操作 */ |
||||
handleCancel(row) { |
||||
const id = row.id; |
||||
this.$prompt('请输入取消原因?', "取消流程", { |
||||
type: 'warning', |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, // 判断非空,且非空格 |
||||
inputErrorMessage: "取消原因不能为空", |
||||
}).then(({ value }) => { |
||||
return cancelProcessInstance(id, value); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("取消成功"); |
||||
}) |
||||
}, |
||||
/** 处理详情按钮 */ |
||||
handleDetail(row) { |
||||
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.id}}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,124 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="流程名" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="任务编号" align="center" prop="id" width="320" fixed /> |
||||
<el-table-column label="任务名称" align="center" prop="name" width="200" /> |
||||
<el-table-column label="所属流程" align="center" prop="processInstance.name" width="200" /> |
||||
<el-table-column label="流程发起人" align="center" prop="processInstance.startUserNickname" width="120" /> |
||||
<el-table-column label="结果" align="center" prop="result"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="审批意见" align="center" prop="comment" width="200" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="审批时间" align="center" prop="endTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.endTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="耗时" align="center" prop="durationInMillis" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ getDateStar(scope.row.durationInMillis) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleAudit(scope.row)" |
||||
v-hasPermi="['bpm:task:query']">详情</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getDoneTaskPage} from '@/api/bpm/task' |
||||
import {getDate} from "@/utils/dateUtils"; |
||||
|
||||
export default { |
||||
name: "Done", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 已办任务列表 |
||||
list: [], |
||||
// 查询参数 |
||||
dateRangeCreateTime: [], |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
}, |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
getDoneTaskPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
getDateStar(ms) { |
||||
return getDate(ms); |
||||
}, |
||||
/** 处理审批按钮 */ |
||||
handleAudit(row) { |
||||
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstance.id}}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,111 +0,0 @@
|
||||
<template> |
||||
<div class="app-container"> |
||||
<doc-alert title="工作流" url="https://doc.iocoder.cn/bpm" /> |
||||
|
||||
<!-- 搜索工作栏 --> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="流程名" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入流程名" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="任务编号" align="center" prop="id" width="320" /> |
||||
<el-table-column label="任务名称" align="center" prop="name" /> |
||||
<el-table-column label="所属流程" align="center" prop="processInstance.name" /> |
||||
<el-table-column label="流程发起人" align="center" prop="processInstance.startUserNickname" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" prop="version" width="80"> |
||||
<template slot-scope="scope"> |
||||
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag> |
||||
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleAudit(scope.row)" |
||||
v-hasPermi="['bpm:task:update']">审批</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getTodoTaskPage} from '@/api/bpm/task' |
||||
import {listSimpleUsers} from "@/api/system/user"; |
||||
|
||||
export default { |
||||
name: "Todo", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 待办任务列表 |
||||
list: [], |
||||
// 查询参数 |
||||
dateRangeCreateTime: [], |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
}, |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
getTodoTaskPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 处理审批按钮 */ |
||||
handleAudit(row) { |
||||
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstance.id}}); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,337 +0,0 @@
|
||||
<template> |
||||
<div> |
||||
<!-- 列表弹窗 --> |
||||
<el-dialog title="任务分配规则" :visible.sync="visible" width="800px" append-to-body> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="任务名" align="center" prop="taskDefinitionName" width="120" fixed /> |
||||
<el-table-column label="任务标识" align="center" prop="taskDefinitionKey" width="120" show-tooltip-when-overflow /> |
||||
<el-table-column label="规则类型" align="center" prop="type" width="120"> |
||||
<template slot-scope="scope"> |
||||
<dict-tag :type="DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE" :value="scope.row.type" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="规则范围" align="center" prop="options" width="440px"> |
||||
<template slot-scope="scope"> |
||||
<el-tag size="medium" v-if="scope.row.options" v-for="option in scope.row.options" :key="option"> |
||||
{{ getAssignRuleOptionName(scope.row.type, option) }} |
||||
</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column v-if="modelId" label="操作" align="center" width="80" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdateTaskAssignRule(scope.row)" |
||||
v-hasPermi="['bpm:task-assign-rule:update']">修改</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-dialog> |
||||
<!-- 添加/修改弹窗 --> |
||||
<el-dialog title="修改任务规则" :visible.sync="open" width="500px" append-to-body> |
||||
<el-form ref="taskAssignRuleForm" :model="form" :rules="rules" label-width="110px"> |
||||
<el-form-item label="任务名称" prop="taskDefinitionName"> |
||||
<el-input v-model="form.taskDefinitionName" disabled /> |
||||
</el-form-item> |
||||
<el-form-item label="任务标识" prop="taskDefinitionKey"> |
||||
<el-input v-model="form.taskDefinitionKey" disabled /> |
||||
</el-form-item> |
||||
<el-form-item label="规则类型" prop="type"> |
||||
<el-select v-model="form.type" clearable style="width: 100%"> |
||||
<el-option v-for="dict in taskAssignRuleTypeDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 10" label="指定角色" prop="roleIds"> |
||||
<el-select v-model="form.roleIds" multiple clearable style="width: 100%"> |
||||
<el-option v-for="item in roleOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 20 || form.type === 21" label="指定部门" prop="deptIds"> |
||||
<treeselect v-model="form.deptIds" :options="deptTreeOptions" multiple flat :defaultExpandLevel="3" |
||||
placeholder="请选择指定部门" :normalizer="normalizer"/> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 22" label="指定岗位" prop="postIds"> |
||||
<el-select v-model="form.postIds" multiple clearable style="width: 100%"> |
||||
<el-option v-for="item in postOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 30" label="指定用户" prop="userIds"> |
||||
<el-select v-model="form.userIds" multiple clearable style="width: 100%"> |
||||
<el-option v-for="item in userOptions" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 40" label="指定用户组" prop="userGroupIds"> |
||||
<el-select v-model="form.userGroupIds" multiple clearable style="width: 100%"> |
||||
<el-option v-for="item in userGroupOptions" :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="form.type === 50" label="指定脚本" prop="scripts"> |
||||
<el-select v-model="form.scripts" multiple clearable style="width: 100%"> |
||||
<el-option v-for="dict in taskAssignScriptDictDatas" :key="parseInt(dict.value)" |
||||
:label="dict.label" :value="parseInt(dict.value)"/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitAssignRuleForm">确 定</el-button> |
||||
<el-button @click="cancelAssignRuleForm">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
||||
import {createTaskAssignRule, getTaskAssignRuleList, updateTaskAssignRule} from "@/api/bpm/taskAssignRule"; |
||||
import {listSimpleRoles} from "@/api/system/role"; |
||||
import {listSimpleDepts} from "@/api/system/dept"; |
||||
|
||||
import Treeselect from "@riophae/vue-treeselect"; |
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
||||
import {listSimplePosts} from "@/api/system/post"; |
||||
import {listSimpleUsers} from "@/api/system/user"; |
||||
import {listSimpleUserGroups} from "@/api/bpm/userGroup"; |
||||
|
||||
export default { |
||||
name: "taskAssignRuleDialog", |
||||
components: { |
||||
Treeselect |
||||
}, |
||||
data() { |
||||
return { |
||||
// 如下参数,可传递 |
||||
modelId: undefined, // 流程模型的编号。如果 modelId 非空,则用于流程模型的查看与配置 |
||||
processDefinitionId: undefined, // 流程定义的编号。如果 processDefinitionId 非空,则用于流程定义的查看,不支持配置 |
||||
visible: false, |
||||
|
||||
// 任务分配规则表单 |
||||
row: undefined, // 选中的流程模型 |
||||
list: [], // 选中流程模型的任务分配规则们 |
||||
loading: false, // 加载中 |
||||
open: false, // 是否打开 |
||||
form: {}, // 表单 |
||||
rules: { // 表单校验规则 |
||||
type: [{ required: true, message: "规则类型不能为空", trigger: "change" }], |
||||
roleIds: [{required: true, message: "指定角色不能为空", trigger: "change" }], |
||||
deptIds: [{required: true, message: "指定部门不能为空", trigger: "change" }], |
||||
postIds: [{required: true, message: "指定岗位不能为空", trigger: "change"}], |
||||
userIds: [{required: true, message: "指定用户不能为空", trigger: "change"}], |
||||
userGroupIds: [{required: true, message: "指定用户组不能为空", trigger: "change"}], |
||||
scripts: [{required: true, message: "指定脚本不能为空", trigger: "change"}], |
||||
}, |
||||
|
||||
// 各种下拉框 |
||||
roleOptions: [], |
||||
deptOptions: [], |
||||
deptTreeOptions: [], |
||||
postOptions: [], |
||||
userOptions: [], |
||||
userGroupOptions: [], |
||||
|
||||
// 数据字典 |
||||
modelFormTypeDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_FORM_TYPE), |
||||
taskAssignRuleTypeDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE), |
||||
taskAssignScriptDictDatas: getDictDatas(DICT_TYPE.BPM_TASK_ASSIGN_SCRIPT), |
||||
}; |
||||
}, |
||||
methods: { |
||||
initModel(modelId) { |
||||
this.modelId = modelId; |
||||
this.processDefinitionId = undefined; |
||||
|
||||
// 初始化所有下拉框 |
||||
this.init0(); |
||||
}, |
||||
initProcessDefinition(processDefinitionId) { |
||||
this.modelId = undefined; |
||||
this.processDefinitionId = processDefinitionId; |
||||
|
||||
// 初始化所有下拉框 |
||||
this.init0(); |
||||
}, |
||||
/** 初始化 */ |
||||
init0() { |
||||
// 设置可见 |
||||
this.visible = true; |
||||
// 获得列表 |
||||
this.getList(); |
||||
|
||||
// 获得角色列表 |
||||
this.roleOptions = []; |
||||
listSimpleRoles().then(response => { |
||||
this.roleOptions.push(...response.data); |
||||
}); |
||||
// 获得部门列表 |
||||
this.deptOptions = []; |
||||
this.deptTreeOptions = []; |
||||
listSimpleDepts().then(response => { |
||||
this.deptOptions.push(...response.data); |
||||
this.deptTreeOptions.push(...this.handleTree(response.data, "id")); |
||||
}); |
||||
// 获得岗位列表 |
||||
this.postOptions = []; |
||||
listSimplePosts().then(response => { |
||||
this.postOptions.push(...response.data); |
||||
}); |
||||
// 获得用户列表 |
||||
this.userOptions = []; |
||||
listSimpleUsers().then(response => { |
||||
this.userOptions.push(...response.data); |
||||
}); |
||||
// 获得用户组列表 |
||||
this.userGroupOptions = []; |
||||
listSimpleUserGroups().then(response => { |
||||
this.userGroupOptions.push(...response.data); |
||||
}); |
||||
}, |
||||
/** 获得任务分配规则列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
getTaskAssignRuleList({ |
||||
modelId: this.modelId, |
||||
processDefinitionId: this.processDefinitionId, |
||||
}).then(response => { |
||||
this.loading = false; |
||||
this.list = response.data; |
||||
}) |
||||
}, |
||||
/** 处理修改任务分配规则的按钮操作 */ |
||||
handleUpdateTaskAssignRule(row) { |
||||
// 先重置标识 |
||||
this.resetAssignRuleForm(); |
||||
// 设置表单 |
||||
this.form = { |
||||
...row, |
||||
options: [], |
||||
roleIds: [], |
||||
deptIds: [], |
||||
postIds: [], |
||||
userIds: [], |
||||
userGroupIds: [], |
||||
scripts: [], |
||||
}; |
||||
// 将 options 赋值到对应的 roleIds 等选项 |
||||
if (row.type === 10) { |
||||
this.form.roleIds.push(...row.options); |
||||
} else if (row.type === 20 || row.type === 21) { |
||||
this.form.deptIds.push(...row.options); |
||||
} else if (row.type === 22) { |
||||
this.form.postIds.push(...row.options); |
||||
} else if (row.type === 30) { |
||||
this.form.userIds.push(...row.options); |
||||
} else if (row.type === 40) { |
||||
this.form.userGroupIds.push(...row.options); |
||||
} else if (row.type === 50) { |
||||
this.form.scripts.push(...row.options); |
||||
} |
||||
this.open = true; |
||||
}, |
||||
/** 提交任务分配规则的表单 */ |
||||
submitAssignRuleForm() { |
||||
this.$refs["taskAssignRuleForm"].validate(valid => { |
||||
if (valid) { |
||||
// 构建表单 |
||||
let form = { |
||||
...this.form, |
||||
taskDefinitionName: undefined, |
||||
}; |
||||
// 将 roleIds 等选项赋值到 options 中 |
||||
if (form.type === 10) { |
||||
form.options = form.roleIds; |
||||
} else if (form.type === 20 || form.type === 21) { |
||||
form.options = form.deptIds; |
||||
} else if (form.type === 22) { |
||||
form.options = form.postIds; |
||||
} else if (form.type === 30) { |
||||
form.options = form.userIds; |
||||
} else if (form.type === 40) { |
||||
form.options = form.userGroupIds; |
||||
} else if (form.type === 50) { |
||||
form.options = form.scripts; |
||||
} |
||||
form.roleIds = undefined; |
||||
form.deptIds = undefined; |
||||
form.postIds = undefined; |
||||
form.userIds = undefined; |
||||
form.userGroupIds = undefined; |
||||
form.scripts = undefined; |
||||
// 新增 |
||||
if (!form.id) { |
||||
form.modelId = this.modelId; // 模型编号 |
||||
createTaskAssignRule(form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
// 修改 |
||||
} else { |
||||
form.taskDefinitionKey = undefined; // 无法修改 |
||||
updateTaskAssignRule(form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 取消任务分配规则的表单 */ |
||||
cancelAssignRuleForm() { |
||||
this.open = false; |
||||
this.resetAssignRuleForm(); |
||||
}, |
||||
/** 表单重置 */ |
||||
resetAssignRuleForm() { |
||||
this.form = {}; |
||||
this.resetForm("taskAssignRuleForm"); |
||||
}, |
||||
getAssignRuleOptionName(type, option) { |
||||
if (type === 10) { |
||||
for (const roleOption of this.roleOptions) { |
||||
if (roleOption.id === option) { |
||||
return roleOption.name; |
||||
} |
||||
} |
||||
} else if (type === 20 || type === 21) { |
||||
for (const deptOption of this.deptOptions) { |
||||
if (deptOption.id === option) { |
||||
return deptOption.name; |
||||
} |
||||
} |
||||
} else if (type === 22) { |
||||
for (const postOption of this.postOptions) { |
||||
if (postOption.id === option) { |
||||
return postOption.name; |
||||
} |
||||
} |
||||
} else if (type === 30) { |
||||
for (const userOption of this.userOptions) { |
||||
if (userOption.id === option) { |
||||
return userOption.nickname; |
||||
} |
||||
} |
||||
} else if (type === 40) { |
||||
for (const userGroupOption of this.userGroupOptions) { |
||||
if (userGroupOption.id === option) { |
||||
return userGroupOption.name; |
||||
} |
||||
} |
||||
} else if (type === 50) { |
||||
option = option + ''; // 转换成 string |
||||
for (const dictData of this.taskAssignScriptDictDatas) { |
||||
if (dictData.value === option) { |
||||
return dictData.label; |
||||
} |
||||
} |
||||
} |
||||
return '未知(' + option + ')'; |
||||
}, |
||||
// 格式化部门的下拉框 |
||||
normalizer(node) { |
||||
return { |
||||
id: node.id, |
||||
label: node.name, |
||||
children: node.children |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,276 +0,0 @@
|
||||
<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="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间筛选" label-width="100px"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:area:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:area:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table :data="list" style="width: 100%;margin-bottom: 20px;" row-key="id" border lazy |
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
||||
<el-table-column label="ID" align="center" prop="id" /> |
||||
<el-table-column label="区域名" align="center" prop="name" /> |
||||
<el-table-column label="唯一占用" align="center" prop="occupied" > |
||||
<template slot-scope="scope"> |
||||
<el-button type="danger" v-if="!scope.row.occupied">未占用</el-button> |
||||
<el-button type="success" v-if="scope.row.occupied">已占用</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="面积(亩)" align="center" prop="area" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:area:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:area:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="上级区域选址" prop="twoAreaList"> |
||||
<el-cascader :options="twoAreaList" :props="{emitPath:false, checkStrictly:true}" v-model="form.parentId" placeholder="不选择,默认为第一级区域"></el-cascader> |
||||
</el-form-item> |
||||
<el-form-item label="区域名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="面积(亩)" prop="area"> |
||||
<el-input v-model="form.area" placeholder="请输入" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createArea, updateArea, deleteArea, getArea, getAreaPage, exportAreaExcel } from "@/api/farm/area"; |
||||
|
||||
export default { |
||||
name: "Area", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 400, |
||||
name: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
}, |
||||
|
||||
firstList:[], |
||||
assembleList:[], |
||||
|
||||
allAreaList:[], //提供给新增和修改数据 |
||||
twoAreaList:[] //用于新增和修改展示数据 |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getAreaPage(params).then(response => { |
||||
this.allAreaList = response.data.list; |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
let filterList = this.list.filter(t => t.parentId == 0); |
||||
let oneList = []; |
||||
filterList.forEach((one) => { |
||||
let twoList = []; |
||||
let filterTwoList = this.list.filter(t => t.parentId == one.id); |
||||
filterTwoList.forEach(two =>{ |
||||
let filterThreeList = this.list.filter(t => t.parentId == two.id); |
||||
let threeList = []; |
||||
filterThreeList.forEach(three =>{ |
||||
threeList.push({id:three.id, name:three.name, occupied:three.occupied, area:three.area, createTime:three.createTime}); |
||||
}) |
||||
twoList.push({id:two.id, name:two.name, occupied:two.occupied, area:two.area, createTime:two.createTime, children:threeList}) |
||||
}) |
||||
oneList.push({id:one.id, name:one.name, occupied:one.occupied, area:one.area, createTime:one.createTime, children:twoList}); |
||||
}) |
||||
|
||||
this.list = oneList; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
name: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.assembleArea(); |
||||
this.open = true; |
||||
this.title = "添加"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
this.assembleArea(); |
||||
getArea(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateArea(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createArea(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteArea(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportAreaExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
|
||||
assembleArea(){ |
||||
//先拿到一级区域 |
||||
let firstLsit = this.allAreaList.filter(t => t.parentId == 0); |
||||
let secondList = []; |
||||
//在根据一级区域拿到二级区域 |
||||
let oneList = []; |
||||
firstLsit.forEach(first =>{ |
||||
let list = this.allAreaList.filter(area => area.parentId == first.id); |
||||
let twoList = []; |
||||
list.forEach(item => { |
||||
secondList.push(item); |
||||
twoList.push({value:item.id, label:item.name}); |
||||
}); |
||||
if(twoList.length != 0){ |
||||
oneList.push({value:first.id, label:first.name, children:twoList}); |
||||
}else{ |
||||
oneList.push({value:first.id, label:first.name}); |
||||
} |
||||
}); |
||||
this.twoAreaList = oneList; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,286 +0,0 @@
|
||||
<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="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入物料名" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:crop:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:crop:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="作物id" align="center" prop="id" /> |
||||
<el-table-column label="作物名" align="center" prop="name" /> |
||||
<el-table-column label="作物品种" align="center" prop="variety"/> |
||||
<el-table-column label="作物图片" align="center" prop="images" > |
||||
<template slot-scope="scope"> |
||||
<el-image |
||||
v-if="scope.row.images != null && scope.row.images[0] != null" |
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="当前库存" align="center" prop="stock" /> |
||||
<el-table-column label="ERP物料id" align="center" prop="materialId" /> |
||||
<el-table-column label="ERP物料名字" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.materialId"> {{erpNameConvert(scope.row.materialId)}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:crop:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:crop:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="800px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
||||
<el-form-item label="作物名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入作物名" /> |
||||
</el-form-item> |
||||
<el-form-item label="作物品种名" prop="variety"> |
||||
<el-input v-model="form.variety" placeholder="请输入作物品种" /> |
||||
</el-form-item> |
||||
<el-form-item label="图片:"> |
||||
<imageUpload v-model="form.images"/> |
||||
</el-form-item> |
||||
<el-form-item label="当前库存" prop="stock"> |
||||
<el-input v-model="form.stock" placeholder="请输入当前库存" /> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="ERP物料id" prop="materialId"> |
||||
<el-select v-model="form.materialId" filterable placeholder="请先选择ERP物料"> |
||||
<el-option v-for="item in materialList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createCrop, updateCrop, deleteCrop, getCrop, getCropPage, exportCropExcel, getMaterialList } from "@/api/farm/crop"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
|
||||
export default { |
||||
name: "Crop", |
||||
components: { |
||||
ImageUpload, |
||||
Editor |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
images: null, |
||||
stock: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [{ required: true, message: "物料名不能为空", trigger: "blur" }], |
||||
stock: [{ required: true, message: "当前库存不能为空", trigger: "blur" }], |
||||
}, |
||||
|
||||
materialList :[] |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getCropPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
this.getErpMaterial(); |
||||
}); |
||||
}, |
||||
getErpMaterial(){ |
||||
getMaterialList().then(res =>{ |
||||
this.materialList = res; |
||||
}) |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
name: undefined, |
||||
images: undefined, |
||||
stock: undefined, |
||||
materialId: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getCrop(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateCrop(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createCrop(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteCrop(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportCropExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
erpNameConvert(materialId){ |
||||
let list = this.materialList.filter(m => m.id == materialId); |
||||
return list.length == 0 ? "" : list[0].name; |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
@ -1,301 +0,0 @@
|
||||
<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="cropId"> |
||||
<el-select v-model="queryParams.cropId" placeholder="请选择" clearable size="small"> |
||||
<el-option v-for="item in cropList" :label="item.name" :value="item.id" :key="item.id" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="操作类型" prop="type"> |
||||
<el-select v-model="queryParams.type" placeholder="请选择出入库" clearable size="small"> |
||||
<el-option label="出库" value="0" /> |
||||
<el-option label="入库" value="1" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="操作时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:crop-record:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:crop-record:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="序列号" align="center" prop="id" /> |
||||
<el-table-column label="作物名" align="center" prop="resourceType" > |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.cropId"> {{cropList.find(t=>t.id == scope.row.cropId ).name}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="出入库" align="center" prop="type" /> |
||||
<el-table-column label="操作数量" align="center" prop="stock" /> |
||||
<el-table-column label="剩余数量" align="center" prop="afterStock" /> |
||||
<el-table-column label="操作时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<span>业务原因不支持操作</span> --> |
||||
<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:crop-record:update']">修改</el-button> --> |
||||
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:crop-record:delete']">删除</el-button> --> |
||||
<!-- </template> |
||||
</el-table-column> --> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="作物选择"> |
||||
<el-select v-model="form.cropId" placeholder="请选择" @change="selectCrop"> |
||||
<el-option v-for="item in cropList" :key="item.id" :label="item.name" :value="item.id"> {{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="操作类型" prop="type"> |
||||
<el-radio-group v-model="form.type"> |
||||
<el-radio :label="false" @change="changeType(false)">出库</el-radio> |
||||
<el-radio :label="true" @change="changeType(true)">入库</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="当前数量" prop="currentStock"> |
||||
<span> {{currentStock}} </span> |
||||
</el-form-item> |
||||
|
||||
|
||||
<el-form-item label="操作数量" prop="stock"> |
||||
<el-input v-model="form.stock" type="number" placeholder="请输入操作数量" @blur="stockChange(form.stock)"/> |
||||
</el-form-item> |
||||
<el-form-item label="剩余数量" prop="afterStock"> |
||||
<el-input v-model="form.afterStock" type="number" :disabled="true" placeholder="请输入剩余数量" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createCropRecord, updateCropRecord, deleteCropRecord, getCropRecord, getCropRecordPage, exportCropRecordExcel } from "@/api/farm/cropRecord"; |
||||
import Editor from '@/components/Editor'; |
||||
import { getCropPage, getCrop } from "@/api/farm/crop"; |
||||
|
||||
|
||||
export default { |
||||
name: "CropRecord", |
||||
components: { |
||||
Editor |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
cropId: null, |
||||
type: null, |
||||
stock: null, |
||||
afterStock: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
stock: [{ required: true, message: "操作数量不能为空", trigger: "blur" }], |
||||
afterStock: [{ required: true, message: "剩余数量不能为空", trigger: "blur" }], |
||||
}, |
||||
cropList:[], //作物List |
||||
currentStock: null |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getCrop(); |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/**查询作物名 */ |
||||
getCrop(){ |
||||
getCropPage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
name: null |
||||
}).then(res=>{ |
||||
this.cropList = res.data.list; |
||||
}) |
||||
}, |
||||
|
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getCropRecordPage(params).then(response => { |
||||
response.data.list.forEach(item =>{ |
||||
item.type = item.type ? "入库" : "出库"; |
||||
}) |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
cropId: undefined, |
||||
type: false, |
||||
stock: undefined, |
||||
afterStock: undefined, |
||||
}; |
||||
this.currentStock = undefined; |
||||
this.getCrop(); |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getCropRecord(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改"; |
||||
this.selectCrop(response.data.cropId); |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateCropRecord(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createCropRecord(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteCropRecord(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportCropRecordExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
selectCrop(rows){ |
||||
this.cropList.forEach(crop =>{ |
||||
if(crop.id == rows){ |
||||
this.currentStock = crop.stock; |
||||
} |
||||
}) |
||||
}, |
||||
stockChange(number){ |
||||
if(this.form.type){ |
||||
this.form.afterStock = parseInt(this.currentStock) + parseInt(number); |
||||
}else{ |
||||
this.form.afterStock = parseInt(this.currentStock) - parseInt(number); |
||||
} |
||||
}, |
||||
changeType(boolType){ |
||||
this.stockChange(this.form.stock); |
||||
} |
||||
}, |
||||
|
||||
}; |
||||
</script> |
@ -1,544 +0,0 @@
|
||||
<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="projectId"> |
||||
<el-select v-model="queryParams.projectId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in projectList" :key="item.id" :label="item.id" :value="item.id"> |
||||
{{ item.id }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:discuss:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:discuss:export']">导出</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="danger" size="mini" @click="dialogVisible = true">第一次进来请先看活动规则</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" stripe :data="list"> |
||||
<el-table-column label="讨论ID" align="center" prop="id" /> |
||||
<el-table-column label="项目ID/名" align="center" prop="projectId"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.projectId">{{convertProject(scope.row.projectId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务ID" align="center" prop="taskId" /> |
||||
<el-table-column label="任务内容" align="center" prop="taskId" width="120"> |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.taskId">{{convertTask(scope.row.taskId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="需要的资源" align="center" prop="resources" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{resouceConvert(scope.row.resources)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="采收数量" align="center" prop="recoveryNumber" /> |
||||
<el-table-column label="工时" align="center" prop="workingHours" /> |
||||
<!-- <el-table-column label="执行人" align="center" prop="joinPerson" width="80" > |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.joinPerson">{{executorPersonConvert(scope.row.joinPerson)}}</span> |
||||
</template> |
||||
</el-table-column> --> |
||||
<el-table-column label="参与人数" align="center" prop="joinNumber" /> |
||||
<el-table-column label="总工时" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{countTotalHour(scope.row.workingHours, scope.row.joinNumber)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column label="讨论内容" align="center" prop="content" /> --> |
||||
<el-table-column label="事件图片" align="center" prop="images"> |
||||
<template slot-scope="scope"> |
||||
<el-image |
||||
v-if="scope.row.images != null && scope.row.images[0] != null" |
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="执行时间" align="center" prop="executeTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.executeTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:discuss:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:discuss:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="项目" prop="projectId"> |
||||
<el-select v-model="form.projectId" placeholder="请选择项目" @change="changeProject" :disabled="canSelect"> |
||||
<el-option |
||||
v-for="item in projectList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务" prop="taskId"> |
||||
<el-select v-model="form.taskId" placeholder="请选择任务" @change="changeTask" > |
||||
<el-option |
||||
v-for="item in selectTaskList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="讨论"> |
||||
<editor v-model="form.content" :min-height="192"/> |
||||
</el-form-item> |
||||
<el-form-item label="讨论图片"> |
||||
<imageUpload v-model="form.images"/> |
||||
</el-form-item> |
||||
<el-button type="primary" @click="addResource">添加资源</el-button> |
||||
<el-form-item label="资源选择" v-for="(item,index) in form.resources" :key="index"> |
||||
<el-cascader :options="twoList" clearable v-model="item.resourceId"> |
||||
</el-cascader> |
||||
<el-input v-model="item.num"/> |
||||
<el-button @click="deleteResource(item)">删除</el-button> |
||||
</el-form-item> |
||||
<el-form-item label="工时" prop="workingHours"> |
||||
<el-input v-model="form.workingHours" placeholder="请输入工时" /> |
||||
</el-form-item> |
||||
<el-form-item label="采收数量" prop="recoveryNumber"> |
||||
<el-input id="recoveryNumber" v-model="form.recoveryNumber" :disabled="canInput" placeholder="采收任务类型请填写数量" /> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="执行人" prop="joinPerson"> |
||||
<el-select v-model="form.joinPerson" filterable multiple placeholder="请先选择项目"> |
||||
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> --> |
||||
<el-form-item label="参与人数" prop="joinNumber"> |
||||
<el-input v-model="form.joinNumber" placeholder="请输入参与人数" /> |
||||
</el-form-item> |
||||
<el-form-item label="执行时间" prop="executeTime"> |
||||
<el-date-picker clearable v-model="form.executeTime" type="datetime" value-format="timestamp" |
||||
placeholder="选择" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
|
||||
<!-- 活动规则提示 --> |
||||
<el-dialog title="活动规则提示" :visible.sync="dialogVisible" width="70%"> |
||||
<el-form label-width="80px"> |
||||
<el-form-item>新增活动只能选择进行中的项目下的进行中的任务</el-form-item> |
||||
<!-- <el-form-item>执行人只能从项目的成员中选择</el-form-item> --> |
||||
<el-form-item>提交活动后,任务自动变成已完成,并新增执行人的工时</el-form-item> |
||||
<el-form-item>如果任务类型是采收, 则会将采收数量同步到ERP对应物料数量</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createDiscuss, updateDiscuss, deleteDiscuss, getDiscuss, getDiscussPage, exportDiscussExcel } from "@/api/farm/discuss"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
import { getProjectPage } from "@/api/farm/project"; |
||||
import { getTaskPage } from "@/api/farm/task"; |
||||
import { getTaskCatePage } from "@/api/farm/taskCate"; |
||||
import { getCpUserPage } from "@/api/system/cpUser"; |
||||
import { getResourceTypePage } from "@/api/farm/resourceType"; |
||||
import { getResourcePage } from "@/api/farm/resource"; |
||||
|
||||
export default { |
||||
name: "Discuss", |
||||
components: { |
||||
ImageUpload, |
||||
Editor, |
||||
}, |
||||
data() { |
||||
return { |
||||
//活动规则 |
||||
dialogVisible: false, |
||||
//采收input |
||||
canInput : true, |
||||
//项目、任务能否选择 |
||||
canSelect: false, |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场任务讨论列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
projectId: null, |
||||
taskId: null, |
||||
content: null, |
||||
images: null, |
||||
resources: null, |
||||
}, |
||||
// 表单参数 |
||||
form: { |
||||
recoveryNumber: '0' |
||||
}, |
||||
// 表单校验 |
||||
rules: { |
||||
projectId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
taskId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
projectList:[], |
||||
taskList:[], |
||||
selectTaskList:[], //对应项目的任务 |
||||
taskCateList:[], |
||||
cpUserList:[], //所有cpUser |
||||
selectCpUserList:[], //参与人 |
||||
|
||||
resourceTypeList:[], |
||||
resourceList:[], |
||||
twoList: [] |
||||
}; |
||||
}, |
||||
|
||||
created() { |
||||
this.getProject(); |
||||
this.getTaskCateList(); |
||||
this.getCpUserList(); |
||||
}, |
||||
methods: { |
||||
getCpUserList() { |
||||
getCpUserPage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res => { |
||||
this.cpUserList = res.data.list; |
||||
}) |
||||
}, |
||||
executorPersonConvert(joinPerson){ |
||||
let executorPersonName = ""; |
||||
joinPerson.forEach(joinId =>{ |
||||
this.cpUserList.forEach(user =>{ |
||||
if(joinId == user.id){ |
||||
executorPersonName += user.name +"\n"; |
||||
} |
||||
}) |
||||
}) |
||||
return executorPersonName; |
||||
}, |
||||
getTaskCateList() { |
||||
getTaskCatePage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res => { |
||||
this.taskCateList = res.data.list.filter(t => t.parentId != 0); |
||||
}) |
||||
}, |
||||
/*获取项目列表*/ |
||||
getProject(){ |
||||
getProjectPage({ |
||||
pageNo: 1, |
||||
pageSize: 400, |
||||
}).then(res=>{ |
||||
this.projectList = res.data.list; |
||||
this.getTask(); |
||||
}) |
||||
}, |
||||
/*获取任务列表*/ |
||||
getTask(){ |
||||
getTaskPage({ |
||||
pageNo: 1, |
||||
pageSize: 400, |
||||
draft:false, |
||||
}).then(res=>{ |
||||
this.taskList = res.data.list; |
||||
this.getResourceTypeList(); |
||||
}) |
||||
}, |
||||
/*资源类型 */ |
||||
getResourceTypeList(){ |
||||
getResourceTypePage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res =>{ |
||||
this.resourceTypeList = res.data.list; |
||||
this.getResourceList(); |
||||
}) |
||||
}, |
||||
/*资源 */ |
||||
getResourceList(){ |
||||
getResourcePage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res => { |
||||
this.resourceList = res.data.list; |
||||
this.twoRescoure(); |
||||
this.getList(); |
||||
}) |
||||
}, |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getDiscussPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
projectId: undefined, |
||||
taskId: undefined, |
||||
content: undefined, |
||||
images: undefined, |
||||
resources: [], |
||||
recoveryNumber:undefined |
||||
}; |
||||
this.canInput = true, |
||||
this.canSelect = false, |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.twoRescoure(); |
||||
this.projectList = this.projectList.filter(item => item.state == 'STARTING'); |
||||
this.open = true; |
||||
this.title = "添加农场任务讨论"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
this.canSelect = true; |
||||
this.twoRescoure(); |
||||
const id = row.id; |
||||
getDiscuss(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场任务讨论"; |
||||
this.showCpUserList(response.data.projectId); |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateDiscuss(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createDiscuss(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.id != null) { |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
} |
||||
if (this.form.images == undefined || this.form.images =="") { |
||||
this.form.images = []; |
||||
} |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场任务讨论编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteDiscuss(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场任务讨论数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportDiscussExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
//新增/修改 选择项目时 |
||||
changeProject(row){ |
||||
this.form.taskId = null; |
||||
this.selectTaskList = this.taskList.filter(task => task.status == 'STARTED' && task.projectId == row); |
||||
this.showCpUserList(row); |
||||
}, |
||||
showCpUserList(projectId){ |
||||
let project = this.projectList.filter(project => project.id == projectId)[0]; |
||||
let projectMemberList = []; |
||||
if(project.members != undefined && project.members != null){ |
||||
project.members.forEach(memberId =>{ |
||||
this.cpUserList.forEach(user =>{ |
||||
if(memberId == user.id){ |
||||
projectMemberList.push(user); |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
this.selectCpUserList = projectMemberList; |
||||
}, |
||||
changeTask(row){ |
||||
this.form.recoveryNumber = null; |
||||
let task = this.taskList.filter(task => task.id == row)[0]; |
||||
let taskCate = this.taskCateList.filter(cate => cate.id == task.taskCateName)[0]; |
||||
if(taskCate.synchronizeErp){ |
||||
//采收数量可编辑 |
||||
this.canInput = false; |
||||
}else{ |
||||
//采收数量不可编辑 |
||||
this.canInput = true; |
||||
} |
||||
}, |
||||
//展示项目名 |
||||
convertProject(projectId){ |
||||
let project = this.projectList.filter(item => item.id == projectId)[0]; |
||||
return project != undefined ? |
||||
project.name != undefined ? project.id +"/\n"+ project.name : project.id |
||||
: projectId; |
||||
}, |
||||
//展示任务类型 任务内容 |
||||
convertTask(taskId){ |
||||
let task = this.taskList.filter(item => item.id == taskId)[0]; |
||||
return task.taskName +"/\n"+ task.taskMsg; |
||||
}, |
||||
resouceConvert(resources){ |
||||
if(resources != undefined){ |
||||
let resouceMsg = ""; |
||||
resources.forEach(item =>{ |
||||
let typeName = this.resourceTypeList.filter(type => type.id == item.resourceId[0])[0]; |
||||
let resName = this.resourceList.filter(name => name.id == item.resourceId[1])[0]; |
||||
resouceMsg += typeName.name +"/" + resName.name +":" + item.num +"\n"; |
||||
}) |
||||
return resouceMsg; |
||||
} |
||||
}, |
||||
addResource(){ |
||||
let resourceTmp = {num:1} |
||||
this.form.resources = this.form.resources.concat(resourceTmp) |
||||
}, |
||||
deleteResource(item){ |
||||
this.form.resources = this.form.resources.filter(res => res!=item) |
||||
}, |
||||
twoRescoure() { |
||||
let firstList = []; |
||||
this.resourceTypeList.forEach((type) => { |
||||
let secondList = []; |
||||
this.resourceList.forEach((res) => { |
||||
if (res.resourceType == type.id) { |
||||
secondList.push({ value: res.id, label: res.name }); |
||||
} |
||||
}) |
||||
firstList.push({ value: type.id, label: type.name, children: secondList }); |
||||
}) |
||||
this.twoList = firstList; |
||||
}, |
||||
//计算总工时 |
||||
countTotalHour(hour, number){ |
||||
if(hour != undefined && number != undefined){ |
||||
return (hour * number).toFixed(1); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,376 +0,0 @@
|
||||
<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="projectId"> |
||||
<el-input v-model="queryParams.projectId" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="任务名" prop="taskId"> |
||||
<el-input v-model="queryParams.taskId" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="事件名" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:event:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:event:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" stripe :data="list"> |
||||
<el-table-column label="事件ID" align="center" prop="id" /> |
||||
<el-table-column label="项目名" align="center" prop="projectId"> |
||||
<template slot-scope="scope"> |
||||
<span>{{projectList.find(p => p.id == scope.row.projectId).name}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务类型及内容" align="center" prop="taskId"> |
||||
<template slot-scope="scope"> |
||||
<span>{{taskConvert(scope.row.taskId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="事件名" align="center" prop="name" /> |
||||
<el-table-column label="事件内容" align="center" prop="content" /> |
||||
<el-table-column label="事件图片" align="center" prop="images"> |
||||
<template slot-scope="scope"> |
||||
<el-image |
||||
v-if="scope.row.images[0] != null" |
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:event:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:event:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="项目" prop="projectId"> |
||||
<el-select v-model="form.projectId" placeholder="请选择项目"> |
||||
<el-option |
||||
v-for="item in projectList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务" prop="projectId"> |
||||
<el-select v-model="form.taskId" placeholder="请选择任务"> |
||||
<el-option |
||||
v-for="item in taskList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="事件名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="内容"> |
||||
<editor v-model="form.content" :min-height="192"/> |
||||
</el-form-item> |
||||
<el-form-item label="图片"> |
||||
<imageUpload v-model="form.images"/> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createEvent, updateEvent, deleteEvent, getEvent, getEventPage, getEventSearchPage, exportEventExcel } from "@/api/farm/event"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
import { getProjectPage } from "@/api/farm/project"; |
||||
import { getTaskPage } from "@/api/farm/task"; |
||||
import {getTaskCatePage} from "@/api/farm/taskCate"; |
||||
|
||||
export default { |
||||
name: "Event", |
||||
components: { |
||||
ImageUpload, |
||||
Editor, |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场任务事件列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
projectId: null, |
||||
taskId: null, |
||||
name: null, |
||||
content: null, |
||||
images: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
projectId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
taskId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
taskList:[], |
||||
projectList:[], |
||||
projectId:'', |
||||
taskId:'', |
||||
taskCateList:[] |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getProject(); |
||||
this.getTaskCate(); |
||||
}, |
||||
methods: { |
||||
taskConvert(task){ |
||||
let taskArr = this.taskList.filter(t => t.id == task)[0]; |
||||
let taskTypeName = ""; |
||||
let taskName = ""; |
||||
this.taskCateList.forEach(cate =>{ |
||||
if (cate.id == taskArr.taskCateId) { |
||||
taskTypeName = cate.name; |
||||
} |
||||
if (cate.id == taskArr.taskCateName) { |
||||
taskName = cate.name; |
||||
} |
||||
}) |
||||
return taskTypeName + "/" +taskName; |
||||
}, |
||||
/*获取项目列表*/ |
||||
getProject(){ |
||||
getProjectPage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
}).then(res=>{ |
||||
this.projectList = res.data.list; |
||||
this.getTask(); |
||||
}) |
||||
}, |
||||
/*获取任务列表*/ |
||||
getTask(){ |
||||
getTaskPage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
}).then(res=>{ |
||||
this.taskList = res.data.list; |
||||
this.getList(); |
||||
}) |
||||
}, |
||||
getTaskCate(){ |
||||
getTaskCatePage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
}).then(res =>{ |
||||
this.taskCateList = res.data.list; |
||||
}) |
||||
}, |
||||
|
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getEventPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 搜索条件查询列表 */ |
||||
getSearchList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getEventSearchPage(params).then(response => { |
||||
response.data.list.forEach(eve => { |
||||
this.projectList.forEach(project =>{ |
||||
if(project.id == eve.projectId){ |
||||
eve.projectId = project.name; |
||||
} |
||||
}); |
||||
this.taskList.forEach(task =>{ |
||||
if (task.id == eve.taskId) { |
||||
eve.taskId = task.name; |
||||
} |
||||
}) |
||||
}); |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
|
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
projectId: undefined, |
||||
taskId: undefined, |
||||
name: undefined, |
||||
content: undefined, |
||||
images: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getSearchList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加农场任务事件"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getEvent(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场任务事件"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateEvent(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createEvent(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.id != null) { |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
} |
||||
if (this.form.images == undefined || this.form.images =="") { |
||||
this.form.images = []; |
||||
} |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场任务事件编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteEvent(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场任务事件数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportEventExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,258 +0,0 @@
|
||||
<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="type"> |
||||
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small"> |
||||
<el-option label="请选择字典生成" value="" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="标题" prop="title"> |
||||
<el-input v-model="queryParams.title" placeholder="请输入标题" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="用户id" prop="userId"> |
||||
<el-input v-model="queryParams.userId" placeholder="请输入用户id" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:log-msg:create']">新增</el-button> |
||||
</el-col> --> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:log-msg:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="" align="center" prop="id" /> |
||||
<el-table-column label="类型" align="center" prop="type" /> |
||||
<el-table-column label="操作" align="center" prop="operation" /> |
||||
<el-table-column label="标题" align="center" prop="title" /> |
||||
<el-table-column label="任务内容" align="center" prop="msg" /> |
||||
<el-table-column label="用户" align="center" prop="userId"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ userConver(scope.row.userId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:log-msg:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:log-msg:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> --> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<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="type"> |
||||
<el-select v-model="form.type" placeholder="请选择类型"> |
||||
<el-option label="请选择字典生成" value="" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="标题" prop="title"> |
||||
<el-input v-model="form.title" placeholder="请输入标题" /> |
||||
</el-form-item> |
||||
<el-form-item label="用户id" prop="userId"> |
||||
<el-input v-model="form.userId" placeholder="请输入用户id" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createLogMsg, updateLogMsg, deleteLogMsg, getLogMsg, getLogMsgPage, exportLogMsgExcel } from "@/api/farm/logMsg"; |
||||
import {listUser} from "@/api/system/user"; |
||||
|
||||
export default { |
||||
name: "LogMsg", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
type: null, |
||||
title: null, |
||||
userId: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
}, |
||||
|
||||
systemUserList:[] |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getLogMsgPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
this.getSysUserList(); |
||||
}); |
||||
}, |
||||
getSysUserList(){ |
||||
listUser({ |
||||
pageNo:1, |
||||
pageSize:200 |
||||
}).then(res=>{ |
||||
this.systemUserList = res.data.list; |
||||
}) |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
type: undefined, |
||||
title: undefined, |
||||
userId: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getLogMsg(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateLogMsg(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createLogMsg(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteLogMsg(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportLogMsgExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
userConver(userId){ |
||||
let sa = this.systemUserList.filter(user => user.id == userId)[0]; |
||||
return sa == undefined ? userId : sa.nickname; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,584 +0,0 @@
|
||||
<style> |
||||
.el-table .cell{ |
||||
white-space: pre-line; |
||||
} |
||||
</style> |
||||
|
||||
|
||||
<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="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="状态" prop="state"> |
||||
<el-select v-model="queryParams.state" filterable placeholder="请单选"> |
||||
<el-option v-for="item in searchState" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="区域" prop="areaId"> |
||||
<el-select v-model="queryParams.areaId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in areasList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="成员名" prop="executorName"> |
||||
<el-select v-model="queryParams.executorName" filterable placeholder="请单选"> |
||||
<el-option v-for="item in membersList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="优先级" prop="weight"> |
||||
<el-input v-model="queryParams.weight" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="开始时间"> |
||||
<el-date-picker v-model="dateRangePlanStartTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item label="结束时间"> |
||||
<el-date-picker v-model="dateRangePlanEndTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> --> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:project:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:project:export']">导出</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="danger" size="mini" @click="dialogVisible = true">第一次进来请先看项目规则</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list" stripe > |
||||
<el-table-column label="ID" align="center" prop="id" /> |
||||
<el-table-column label="项目状态" align="center" prop="state" > |
||||
<template slot-scope="scope"> |
||||
<el-button type="info" v-if="scope.row.state == 'PLAN'">计划中</el-button> |
||||
<el-button type="primary" v-if="scope.row.state == 'STARTING'">进行中</el-button> |
||||
<el-button type="success" v-if="scope.row.state == 'FINISH'">已完成</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="项目名" align="center" prop="name" /> |
||||
<el-table-column label="区域名" align="center" prop="areas" width="180" > |
||||
<template slot-scope="scope"> |
||||
<span>{{areasConvert(scope.row.areas)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="面积" align="center" prop="plantArea"/> |
||||
<el-table-column label="作物名" align="center" prop="cropId" > |
||||
<template slot-scope="scope"> |
||||
<span> {{cropList.find(t=>t.id == scope.row.cropId ).name}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="负责人" align="center" prop="mainPerson"> |
||||
<template slot-scope="scope"> |
||||
<span>{{mainPersonConvert(scope.row.mainPerson)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column label="项目成员" align="center" prop="members"> |
||||
<template slot-scope="scope"> |
||||
<span>{{membersConvert(scope.row.members)}}</span> |
||||
</template> |
||||
</el-table-column> --> |
||||
<el-table-column label="作物图片" align="center" prop="images"> |
||||
<template slot-scope="scope"> |
||||
<el-image |
||||
v-if="scope.row.images != null && scope.row.images[0] != null" |
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="育苗日期" align="center" prop="growSeedTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.growSeedTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="种植日期" align="center" prop="plantTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.plantTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="采收开始日期" align="center" prop="planStartTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.planStartTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="种植结束日期" align="center" prop="planEndTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.planEndTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="优先级" align="center" prop="weight" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:project:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:project:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="项目名" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="区域选择" prop="assemAreaList"> |
||||
<el-cascader :options="assemAreaList" :props="props" emitPath clearable ref="chooseA" v-model="form.areas"> |
||||
</el-cascader> |
||||
</el-form-item> |
||||
<el-form-item label="种植面积" prop="plantArea"> |
||||
<el-input v-model="form.plantArea" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="作物选择" prop="cropId"> |
||||
<el-select v-model="form.cropId" filterable placeholder="请选择" @change="changeCrop"> |
||||
<el-option v-for="item in cropList" :key="item.id" :label="item.name" :value="item.id"> {{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="负责人" prop="mainPerson"> |
||||
<el-select v-model="form.mainPerson" filterable placeholder="请选择"> |
||||
<el-option v-for="item in membersList" :key="item.id" :label="item.name" :value="item.id"> {{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="成员选择" prop="members"> |
||||
<el-select v-model="form.members" filterable multiple placeholder="请选择"> |
||||
<el-option v-for="item in membersList" :key="item.id" :label="item.name" :value="item.id"> {{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> --> |
||||
<el-form-item label="育苗日期" prop="growSeedTime"> |
||||
<el-date-picker clearable v-model="form.growSeedTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="决定项目状态" /> |
||||
</el-form-item> |
||||
<el-form-item label="种植日期" prop="plantTime"> |
||||
<el-date-picker clearable v-model="form.plantTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="采收开始日期" prop="planStartTime"> |
||||
<el-date-picker clearable v-model="form.planStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="种植结束日期" prop="planEndTime"> |
||||
<el-date-picker clearable v-model="form.planEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="优先级" prop="weight"> |
||||
<el-input v-model="form.weight" placeholder="请输入数字(1第一优先,99最后优先)" /> |
||||
</el-form-item> |
||||
<el-form-item label="项目状态" prop="state"> |
||||
<el-radio-group v-model="form.state"> |
||||
<el-radio :label="0" :disabled="true">计划中</el-radio> |
||||
<el-radio :label="1" :disabled="true">进行中</el-radio> |
||||
<el-radio :label="2">已完成</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
<el-form-item label="作物图片"> |
||||
<imageUpload v-model="form.images" :disabled=true /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
|
||||
<!-- 项目规则提示 --> |
||||
<el-dialog title="项目规则提示" :visible.sync="dialogVisible" width="70%"> |
||||
<el-form label-width="80px"> |
||||
<el-form-item>添加计划中的项目时,不会做任何限制,可随意添加</el-form-item> |
||||
<el-form-item>项目更改为进行中的时候,会检查区域占用情况,未占用,则更改成功,并占用区域。如果区域已占用,项目无法更改为进行中</el-form-item> |
||||
<el-form-item>项目的作物、区域、成员,将作为项目下任务所选择的基础信息</el-form-item> |
||||
<el-form-item>进行中的项目不可以修改作物、区域</el-form-item> |
||||
<el-form-item>项目更改为完成时,会检查改项目下所有任务是否完成,如果有未完成的则更改失败。更改成功会释放占用的区域</el-form-item> |
||||
<el-form-item>已完成项目不可进行任务修改</el-form-item> |
||||
<el-form-item>项目的状态只能由计划中 ——> 进行中 ——>已完成,不可逆向变更状态</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createProject, updateProject, deleteProject, getProject, getProjectPage, exportProjectExcel, getProjectSearchPage } from "@/api/farm/project"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
import { getAreaPage} from "@/api/farm/area"; |
||||
import { getCropPage} from "@/api/farm/crop"; |
||||
import { getCpUserPage} from "@/api/system/cpUser" |
||||
|
||||
|
||||
export default { |
||||
name: "Project", |
||||
components: { |
||||
ImageUpload, |
||||
Editor, |
||||
}, |
||||
data() { |
||||
return { |
||||
//项目规则 |
||||
dialogVisible: false, |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场项目列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangePlanStartTime: [], |
||||
dateRangePlanEndTime: [], |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
content: null, |
||||
resources: null, |
||||
images: null, |
||||
weight: null, |
||||
areas: null, |
||||
cropId: null, |
||||
members: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
props: { multiple: true , emitPath: false}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
areas:[{ required: true, message: "不能为空", trigger: "blur" }], |
||||
cropId:[{ required: true, message: "不能为空", trigger: "blur" }], |
||||
members:[{ required: true, message: "不能为空", trigger: "blur" }], |
||||
growSeedTime:[{ required: true, message: "不能为空", trigger: "blur" }], |
||||
plantTime:[{ required: true, message: "不能为空", trigger: "blur" }], |
||||
planStartTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
planEndTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
weight: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
searchState:[ |
||||
{id:'PLAN', name:'计划中'}, |
||||
{id:'STARTING', name:'进行中'}, |
||||
{id:'FINISH', name:'已完成'} |
||||
], |
||||
areasList:[], |
||||
cropList:[], |
||||
membersList:[], |
||||
|
||||
assemAreaList: [], |
||||
areasParentList: [], |
||||
areasSonList: [] |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
mainPersonConvert(mainPersonId){ |
||||
let mainPerson = this.membersList.filter(item => item.id == mainPersonId)[0]; |
||||
return mainPerson.name; |
||||
}, |
||||
membersConvert(members){ |
||||
let membersName = ""; |
||||
if(members != undefined){ |
||||
this.membersList.forEach(item =>{ |
||||
members.forEach(memberId =>{ |
||||
if (memberId == item.id) { |
||||
membersName += item.name +"\n"; |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
return membersName; |
||||
}, |
||||
areasConvert(areas){ |
||||
let areasName = ""; |
||||
areas.forEach(selectArea =>{ |
||||
let firstName = ""; |
||||
let secondName = ""; |
||||
let thiredName = ""; |
||||
this.areasList.forEach(area => { |
||||
if(area.id == selectArea){ |
||||
thiredName = area.name; |
||||
if(area.parentId != 0){ |
||||
let tempArea = this.areasList.filter(parent => parent.id == area.parentId)[0]; |
||||
secondName = tempArea.name; |
||||
if(tempArea.parentId != 0){ |
||||
tempArea = this.areasList.filter(parent => parent.id == tempArea.parentId)[0]; |
||||
firstName = tempArea.name; |
||||
} |
||||
} |
||||
} |
||||
|
||||
}) |
||||
|
||||
let name = ""; |
||||
if(firstName != ''){ |
||||
name = (firstName+"/"+secondName+"/"+thiredName+"\n"); |
||||
}else{ |
||||
name = (secondName+"/"+thiredName+"\n"); |
||||
} |
||||
areasName += name; |
||||
}) |
||||
return areasName; |
||||
}, |
||||
getCropList(){ |
||||
getCropPage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res =>{ |
||||
this.cropList = res.data.list; |
||||
}) |
||||
}, |
||||
getAreasList(){ |
||||
getAreaPage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
}).then(res =>{ |
||||
this.areasList = res.data.list; |
||||
}) |
||||
}, |
||||
getCpUserList(){ |
||||
getCpUserPage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res =>{ |
||||
this.membersList = res.data.list; |
||||
}) |
||||
}, |
||||
/** 查询项目列表 */ |
||||
getList() { |
||||
this.getAreasList(); |
||||
this.getCropList(); |
||||
this.getCpUserList(); |
||||
// this.assemArea(); |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getProjectPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/* 搜索条件查询项目列表*/ |
||||
getSearchList(){ |
||||
this.loading = true; |
||||
//处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
//执行查询 |
||||
getProjectPage(params).then(response =>{ |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}) |
||||
}, |
||||
|
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
name: undefined, |
||||
content: undefined, |
||||
resources: undefined, |
||||
images: undefined, |
||||
planStartTime: undefined, |
||||
planEndTime: undefined, |
||||
weight: undefined, |
||||
areas: undefined, |
||||
cropId:undefined, |
||||
members: undefined |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getSearchList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangePlanStartTime = []; |
||||
this.dateRangePlanEndTime = []; |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.getCpUserList(); |
||||
this.assemArea(); |
||||
this.open = true; |
||||
this.title = "添加农场项目"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
this.assemArea(); |
||||
const id = row.id; |
||||
getProject(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场项目"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
console.log("提交信息",this.form); |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateProject(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createProject(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.id != null) { |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
} |
||||
if (this.form.images == undefined || this.form.images =="") { |
||||
this.form.images = []; |
||||
} |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场项目编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteProject(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场项目数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportProjectExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
|
||||
assemArea() { |
||||
let parentLsit = this.areasList.filter(t => t.parentId == 0); |
||||
let sonList = this.areasList.filter(s => s.parentId != 0); |
||||
let firstList = []; |
||||
parentLsit.forEach(p => { |
||||
this.areasParentList.push(p); |
||||
let secondList = []; |
||||
sonList.forEach(s => { |
||||
if (p.id == s.parentId) { |
||||
let three = this.areasList.filter(t => t.parentId == s.id); |
||||
if(three.length == 0){ |
||||
secondList.push({ value: s.id, label: s.name}); |
||||
}else{ |
||||
let threeList = []; |
||||
three.forEach(three =>{ |
||||
threeList.push({value:three.id, label:three.name}) |
||||
}) |
||||
secondList.push({ value: s.id, label: s.name ,children:threeList}); |
||||
} |
||||
} |
||||
}) |
||||
firstList.push({ value: p.id, label: p.name, children: secondList }) |
||||
}) |
||||
this.assemAreaList = firstList; |
||||
}, |
||||
changeCrop(row){ |
||||
let crop = this.cropList.filter(c => c.id == row); |
||||
this.form.images = crop[0].images; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,373 +0,0 @@
|
||||
<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="resourceType"> |
||||
<el-select v-model="queryParams.resourceType" placeholder="请选择" clearable size="small"> |
||||
<el-option v-for="item in resourceTypeList" :label="item.name" :value="item.id" :key="item.id" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="资源名称" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="可用事件开始"> |
||||
<el-date-picker v-model="dateRangeValidityStartTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item label="可用事件结束"> |
||||
<el-date-picker v-model="dateRangeValidityEndTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> --> |
||||
<el-form-item label="唯一占用" prop="solo"> |
||||
<el-select v-model="queryParams.solo" placeholder="唯一占用" clearable size="small"> |
||||
<el-option label="是" value="true" /> |
||||
<el-option label="否" value="false" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:resource:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:resource:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" stripe :data="list"> |
||||
<el-table-column label="ID" align="center" prop="id" /> |
||||
<el-table-column label="资源类型" align="center" prop="resourceType" > |
||||
<template slot-scope="scope"> |
||||
<span> {{resourceTypeList.find(t=>t.id == scope.row.resourceType ).name}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="名称" align="center" prop="name" /> |
||||
<el-table-column label="保管人" align="center" prop="custodianId" > |
||||
<template slot-scope="scope"> |
||||
<span> {{custodianUserList.find(t=>t.id == scope.row.custodianId ).name}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="单位" align="center" prop="unit" /> |
||||
<el-table-column label="数量" align="center" prop="number" /> |
||||
<el-table-column label="图片" align="center" prop="images" > |
||||
<template slot-scope="scope"> |
||||
<el-image |
||||
v-if="scope.row.images[0] != null" :src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="开始时间" align="center" prop="validityStartTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.validityStartTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="结束时间" align="center" prop="validityEndTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.validityEndTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="唯一" align="center" prop="solo" > |
||||
<template slot-scope="scope"> |
||||
<el-button type="danger" v-if="scope.row.solo">唯一</el-button> |
||||
<el-button type="success" v-if="!scope.row.solo">任意</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="是否被占用" align="center" prop="occupied" > |
||||
<template slot-scope="scope"> |
||||
<el-button type="danger" v-if="scope.row.occupied">被占用</el-button> |
||||
<el-button type="success" v-if="!scope.row.occupied">否</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:resource:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:resource:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="800px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
||||
<el-form-item label="资源类型:" prop="resourceType"> |
||||
<el-select v-model="form.resourceType" placeholder="请选择"> |
||||
<el-option v-for="item in resourceTypeList" :label="item.name" :value="item.id" :key="item.id" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="资源名称:" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="保管人" prop="custodianId"> |
||||
<el-select v-model="form.custodianId" placeholder="请选择"> |
||||
<el-option v-for="item in custodianUserList" :label="item.name" :value="item.id" :key="item.id" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="单位" prop="unit"> |
||||
<el-input v-model="form.unit" placeholder="请输入: 例如:千克、个、斤" /> |
||||
</el-form-item> |
||||
<el-form-item label="数量" prop="number"> |
||||
<el-input v-model="form.number" placeholder="请输入数字"/> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="资源描述:"> |
||||
<editor v-model="form.content" :min-height="192"/> |
||||
</el-form-item> |
||||
<el-form-item label="图片:"> |
||||
<imageUpload v-model="form.images"/> |
||||
</el-form-item> |
||||
<el-form-item label="有效期开始:" prop="validityStartTime"> |
||||
<el-date-picker clearable v-model="form.validityStartTime" type="datetime" value-format="timestamp" placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="有效期结束:" prop="validityEndTime"> |
||||
<el-date-picker clearable v-model="form.validityEndTime" type="datetime" value-format="timestamp" placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="唯一占用:" prop="solo"> |
||||
<el-radio-group v-model="form.solo"> |
||||
<el-radio :label="false">否</el-radio> |
||||
<el-radio :label="true">是</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createResource, updateResource, deleteResource, getResource, getResourcePage, exportResourceExcel } from "@/api/farm/resource"; |
||||
import { getResourceTypePage } from "@/api/farm/resourceType"; |
||||
import { getCpUserPage } from "@/api/system/cpUser"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
|
||||
export default { |
||||
name: "Resource", |
||||
components: { |
||||
ImageUpload, |
||||
Editor, |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场资源列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeValidityStartTime: [], |
||||
dateRangeValidityEndTime: [], |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
resourceType: null, |
||||
name: null, |
||||
content: null, |
||||
images: null, |
||||
solo: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
resourceType: [{ required: true, message: "资源类型不能为空", trigger: "blur" }], |
||||
name: [{ required: true, message: "资源名称不能为空", trigger: "blur" }], |
||||
validityStartTime: [{ required: true, message: "有效期开始不能为空", trigger: "blur" }], |
||||
validityEndTime: [{ required: true, message: "有效期结束不能为空", trigger: "blur" }], |
||||
}, |
||||
resourceTypeList:[], |
||||
custodianUserList:[], //保管人 |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getResourceType(); |
||||
this.getCustodianUser(); |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeValidityStartTime, 'validityStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeValidityEndTime, 'validityEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getResourcePage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
getResourceType(){ |
||||
getResourceTypePage({ |
||||
pageNo: 1, |
||||
pageSize: 20, |
||||
name: null, |
||||
}).then(res=>{ |
||||
this.resourceTypeList = res.data.list; |
||||
}) |
||||
}, |
||||
getCustodianUser(){ |
||||
getCpUserPage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res =>{ |
||||
this.custodianUserList = res.data.list; |
||||
}) |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
resourceType: undefined, |
||||
name: undefined, |
||||
content: undefined, |
||||
images: undefined, |
||||
validityStartTime: undefined, |
||||
validityEndTime: undefined, |
||||
solo: false, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeValidityStartTime = []; |
||||
this.dateRangeValidityEndTime = []; |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加农场资源"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getResource(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场资源"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
console.log("农场资源提交信息", this.form); |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateResource(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createResource(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场资源编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteResource(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeValidityStartTime, 'validityStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeValidityEndTime, 'validityEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场资源数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportResourceExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,214 +0,0 @@
|
||||
<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="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间筛选" label-width="100px"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:resource-type:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:resource-type:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" stripe :data="list"> |
||||
<el-table-column label="ID" align="center" prop="id" /> |
||||
<el-table-column label="名称" align="center" prop="name" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:resource-type:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:resource-type:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="600px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
||||
<el-form-item label="名称:" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createResourceType, updateResourceType, deleteResourceType, getResourceType, getResourceTypePage, exportResourceTypeExcel } from "@/api/farm/resourceType"; |
||||
|
||||
export default { |
||||
name: "ResourceType", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场资源分类列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getResourceTypePage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
name: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加农场资源分类"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getResourceType(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场资源分类"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateResourceType(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createResourceType(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场资源分类编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteResourceType(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场资源分类数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportResourceTypeExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,767 +0,0 @@
|
||||
<style> |
||||
.el-table .cell { |
||||
white-space: pre-line; |
||||
} |
||||
</style> |
||||
|
||||
<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="projectId"> |
||||
<el-select v-model="queryParams.projectId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="负责人" prop="mainPerson"> |
||||
<el-select v-model="queryParams.mainPerson" filterable placeholder="请单选"> |
||||
<el-option v-for="item in cpUserList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务名" prop="taskCateId"> |
||||
<el-select v-model="queryParams.taskCateId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in cateOneList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务内容" prop="taskCateName"> |
||||
<el-select v-model="queryParams.taskCateName" filterable placeholder="请单选"> |
||||
<el-option v-for="item in cateTwoList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="区域" prop="areaId"> |
||||
<el-select v-model="queryParams.areaId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in areasList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="作物名" prop="cropId"> |
||||
<el-select v-model="queryParams.cropId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in cropList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="资源名" prop="areas"> |
||||
<el-select v-model="queryParams.resourceId" filterable placeholder="请单选"> |
||||
<el-option v-for="item in resourceList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> --> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item label="优先级" prop="weight"> |
||||
<el-input v-model="queryParams.weight" placeholder="请输入优先级" clearable @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:task:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" |
||||
:loading="exportLoading" v-hasPermi="['farm:task:export']">导出</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="danger" size="mini" @click="dialogVisible = true">第一次进来请先看任务规则</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" stripe :data="list"> |
||||
<el-table-column label="任务ID" fixed align="center" prop="id" /> |
||||
<el-table-column label="任务状态" fixed align="center" prop="status" > |
||||
<template slot-scope="scope"> |
||||
<el-button type="info" v-if="scope.row.status == 'PLAN'">计划中</el-button> |
||||
<el-button type="info" v-if="scope.row.status == 'READY'">准备中</el-button> |
||||
<el-button type="primary" v-if="scope.row.status == 'STARTED'">已开始</el-button> |
||||
<el-button type="danger" v-if="scope.row.status == 'EXCEPTION'">异常状态</el-button> |
||||
<el-button type="success" v-if="scope.row.status == 'COMPLETE'">任务完成</el-button> |
||||
<el-button type="danger" v-if="scope.row.status == 'RETRY'">返工</el-button> |
||||
<el-button type="danger" v-if="scope.row.status == 'END'">任务关闭</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="项目名" fixed align="center" prop="projectName"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.projectName != undefind ? scope.row.projectName : scope.row.id}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="负责人" align="center" prop="mainPerson"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.mainPersonName}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="区域" align="center" prop="areas" width="180" > |
||||
<template slot-scope="scope"> |
||||
<span>{{areaConvert(scope.row.areaNameList)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="作物名" align="center" prop="cropName"> |
||||
<template slot-scope="scope"> |
||||
<span> {{scope.row.cropName}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务名" align="center" prop="taskCateId"> |
||||
<template slot-scope="scope"> |
||||
<span> {{scope.row.taskName}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务内容" align="center" prop="taskCateName"> |
||||
<template slot-scope="scope"> |
||||
<span> {{scope.row.taskMsg}} </span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column label="需要的资源" align="center" prop="resources" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{resouceConvert(scope.row.taskResourceList)}}</span> |
||||
</template> |
||||
</el-table-column> --> |
||||
<el-table-column label="优先级" align="center" prop="weight" /> |
||||
<el-table-column label="预计执行时间" align="center" prop="planStartTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.planStartTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:task:update']" v-if="scope.row.status != 'COMPLETE'">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:task:delete']">撤回</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList" /> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="900px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="项目选择" prop="projectId"> |
||||
<el-select v-model="form.projectId" placeholder="只能选择进行中的项目" @change="changeProject"> |
||||
<el-option v-for="item in projectList" :key="item.id" :label="item.id+'/'+item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="作物选择" prop="cropId"> |
||||
<el-select v-model="form.cropId" placeholder="请先选择项目"> |
||||
<el-option v-for="item in selectCropList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="负责人" prop="mainPerson"> |
||||
<el-select v-model="form.mainPerson" filterable placeholder="请先选择项目"> |
||||
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="区域选择" prop="assemAreaList"> |
||||
<el-cascader :options="assemAreaList" :props="props" emitPath clearable ref="chooseA" v-model="form.areas" placeholder="请先选择项目"> |
||||
</el-cascader> |
||||
</el-form-item> |
||||
<el-form-item label="任务类型" prop="taskCateId"> |
||||
<el-select v-model="form.taskCateId" placeholder="请选择" @change="changeCateOne"> |
||||
<el-option v-for="item in cateOneList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务内容" prop="taskCateName"> |
||||
<el-select v-model="form.taskCateName" placeholder="请选择"> |
||||
<el-option v-for="item in cateTwoList" :key="item.id" :label="item.name" :value="item.id"> |
||||
{{ item.name }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<!-- <el-button type="primary" @click="addResource">添加资源</el-button> |
||||
<el-form-item label="资源选择" v-for="(item,index) in form.resources" :key="index"> |
||||
<el-cascader :options="twoList" clearable v-model="item.resourceId"> |
||||
</el-cascader> |
||||
<el-input v-model="item.num"/> |
||||
<el-button @click="deleteResource(item)">删除</el-button> |
||||
</el-form-item> --> |
||||
<el-form-item label="任务图片"> |
||||
<imageUpload v-model="form.images" /> |
||||
</el-form-item> |
||||
<el-form-item label="预计执行时间" prop="planStartTime"> |
||||
<el-date-picker clearable v-model="form.planStartTime" type="datetime" value-format="timestamp" |
||||
placeholder="选择" /> |
||||
</el-form-item> |
||||
<el-form-item label="优先级" prop="weight"> |
||||
<el-input v-model="form.weight" placeholder="请输入优先级" /> |
||||
</el-form-item> |
||||
<!-- <el-form-item label="任务状态" prop="status"> |
||||
<el-radio-group v-model="form.status"> |
||||
<el-radio :label="0">计划中</el-radio> |
||||
<el-radio :label="1">准备中 </el-radio> |
||||
<el-radio :label="2">已开始</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> --> |
||||
<!-- <el-form-item label="状态" prop="status"> |
||||
<el-select v-model="form.status" placeholder="请选择"> |
||||
<el-option v-for="item in taskStatus" :key="item.id" :label="item.desc" :value="item.id"> |
||||
{{ item.desc }} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> --> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
|
||||
<!-- 项目规则提示 --> |
||||
<el-dialog title="项目规则提示" :visible.sync="dialogVisible" width="70%"> |
||||
<el-form label-width="80px"> |
||||
<el-form-item>新增任务,只能选择进行中的任务</el-form-item> |
||||
<el-form-item>作物只能选择项目的作物,负责人只能从项目成员中选择,区域只能从项目区域中选择</el-form-item> |
||||
<el-form-item>任务状态为计划中、准备中,不做任何检查</el-form-item> |
||||
<el-form-item>任务状态更改为进行中,会检查唯一资源占用情况,如果被占用,则更改失败。未被占用,则变成占用,更改成功</el-form-item> |
||||
<el-form-item>任务状态更改为完成,会返还唯一资源数量,并更改资源为未占用</el-form-item> |
||||
<el-form-item>已完成的任务不能修改任何信息,修改按钮隐藏</el-form-item> |
||||
<el-form-item>任务状态由系统根据执行时间计算, 计划中、准备中的到了执行时间自动变成已开始</el-form-item> |
||||
<el-form-item>执行时间不能添加今天之前的, 如果是今天 状态为已开始,如果是明天 状态为计划中</el-form-item> |
||||
<el-form-item>任务状态(完成),只能由提交活动变成完成状态</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createTask, updateTask, deleteTask, getTask, getTaskPage, getTaskSearchPage, exportTaskExcel, getAdminTaskPage} from "@/api/farm/task"; |
||||
import ImageUpload from '@/components/ImageUpload'; |
||||
import Editor from '@/components/Editor'; |
||||
import { getResourcePage } from "@/api/farm/resource"; |
||||
import { getProjectPage } from "@/api/farm/project"; |
||||
import { getCropPage } from "@/api/farm/crop"; |
||||
import { getResourceTypePage } from "@/api/farm/resourceType"; |
||||
import { getTaskCatePage } from "@/api/farm/taskCate"; |
||||
import { getCpUserPage } from "@/api/system/cpUser"; |
||||
import { getAreaPage } from "@/api/farm/area"; |
||||
|
||||
|
||||
export default { |
||||
name: "Task", |
||||
components: { |
||||
Editor, |
||||
ImageUpload, |
||||
}, |
||||
data() { |
||||
return { |
||||
//任务规则 |
||||
dialogVisible: false, |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 农场项目列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangePlanStartTime: [], |
||||
dateRangePlanEndTime: [], |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
taskCateId: null, |
||||
taskCateName: null, |
||||
resources: null, |
||||
images: null, |
||||
weight: null, |
||||
projectId: null, |
||||
cropId: null, |
||||
cropNum: null, |
||||
workingHours: null, |
||||
draft: false, |
||||
|
||||
areaId:null, |
||||
// executorName:null |
||||
}, |
||||
// 表单参数 |
||||
form: { |
||||
}, |
||||
// 表单校验 |
||||
rules: { |
||||
projectId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
mainPerson: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
cropId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
cropNum: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
taskCateId: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
taskCateName: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
workingHours: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
planStartTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
planEndTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
weight: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
// taskStatus:[ |
||||
// {id:0, name:"PLAN", desc:"计划中"}, |
||||
// {id:1, name:"READY", desc:"准备中"}, |
||||
// {id:2, name:"STARTED", desc:"已开始"}, |
||||
// // {id:3, name:"EXCEPTION", desc:"异常状态"}, |
||||
// // {id:4, name:"COMPLETE", desc:"任务完成"}, |
||||
// // {id:5, name:"RETRY", desc:"返工"}, |
||||
// // {id:6, name:"END", desc:"任务关闭"}, |
||||
// ], |
||||
// taskStatusSel:[], |
||||
resourceList: [], |
||||
selectResourceList: [], |
||||
projectList: [], |
||||
cropList: [], |
||||
selectCropList:[], //新增修改 作物 |
||||
|
||||
resourceTypeList: [], |
||||
resourceNumberList: [], |
||||
|
||||
twoList: [], |
||||
props: { multiple: true , emitPath: false}, |
||||
|
||||
cpUserList: [], |
||||
executorPerson: [], |
||||
|
||||
selectCpUserList: [], //新增修改 根据项目id 展示员工 |
||||
|
||||
taskCateAllList: [], //未组装的 |
||||
taskCateList: [], //组装好的 |
||||
|
||||
cateOneList: [], |
||||
cateTwoList: [], |
||||
|
||||
areasList: [], |
||||
assemAreaList: [], |
||||
areasParentList: [], |
||||
areasSonList: [], |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getTaskCateList(); |
||||
this.getAreasList(); |
||||
this.getProjectList(); |
||||
this.getResource(); |
||||
this.getCpUserList(); |
||||
this.getCropList(); |
||||
}, |
||||
methods: { |
||||
startMethod(){ |
||||
this.getResource(); |
||||
this.getResourceTypeList(); |
||||
this.getProjectList(); |
||||
this.getCpUserList(); |
||||
this.getCropList(); |
||||
this.getTaskCateList(); |
||||
this.getAreasList(); |
||||
}, |
||||
executorPersonConvert(executorPerson){ |
||||
let executorPersonName = ""; |
||||
executorPerson.forEach(person => { |
||||
executorPersonName += person + "\n"; |
||||
}) |
||||
return executorPersonName; |
||||
}, |
||||
areaConvert(area){ |
||||
let areaMsg = ""; |
||||
area.forEach(item =>{ |
||||
areaMsg += item +"\n"; |
||||
}) |
||||
return areaMsg; |
||||
}, |
||||
resouceConvert(resources){ |
||||
let resouceMsg = ""; |
||||
if(resources != null){ |
||||
resources.forEach(item =>{ |
||||
resouceMsg += item.resourceType +"/" + item.resourceName +":" + item.num +"\n"; |
||||
}) |
||||
} |
||||
return resouceMsg; |
||||
}, |
||||
addResource(){ |
||||
let resourceTmp = {num:1} |
||||
this.form.resources = this.form.resources.concat(resourceTmp) |
||||
}, |
||||
deleteResource(item){ |
||||
this.form.resources = this.form.resources.filter(res => res!=item) |
||||
}, |
||||
getAreasList() { |
||||
getAreaPage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res => { |
||||
this.areasList = res.data.list; |
||||
}) |
||||
}, |
||||
getTaskCateList() { |
||||
getTaskCatePage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res => { |
||||
this.taskCateList = res.data.list; |
||||
this.taskCateAllList = res.data.list; |
||||
|
||||
let catefilterList = this.taskCateList.filter(t => t.parentId == 0); |
||||
this.cateOneList = catefilterList; |
||||
this.cateTwoList = this.taskCateList.filter(t => t.parentId != 0); |
||||
let cateFirstList = []; |
||||
catefilterList.forEach(one => { |
||||
let cateSecondList = []; |
||||
this.taskCateList.forEach(two => { |
||||
if (one.id == two.parentId) { |
||||
cateSecondList.push({ value: two.id, label: two.name }) |
||||
} |
||||
}) |
||||
cateFirstList.push({ value: one.id, label: one.name, children: cateSecondList }) |
||||
}); |
||||
this.taskCateList = cateFirstList; |
||||
}) |
||||
}, |
||||
getCpUserList() { |
||||
getCpUserPage({ |
||||
pageNo: 1, |
||||
pageSize: 400 |
||||
}).then(res => { |
||||
this.cpUserList = res.data.list; |
||||
}) |
||||
}, |
||||
getCropList() { |
||||
getCropPage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res => { |
||||
this.cropList = res.data.list; |
||||
}) |
||||
}, |
||||
getProjectList() { |
||||
getProjectPage({ |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
state: 'STARTING' //只看进行中的项目 |
||||
}).then(res => { |
||||
this.projectList = res.data.list; |
||||
this.projectList.forEach(item =>{ |
||||
item.name == undefined ? item.name = item.id : item.name; |
||||
}) |
||||
}) |
||||
}, |
||||
/**查询资源*/ |
||||
getResource() { |
||||
getResourcePage({ |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
}).then(res => { |
||||
this.resourceList = res.data.list; |
||||
this.twoRescoure(); |
||||
this.getList(); |
||||
}) |
||||
}, |
||||
getResourceTypeList() { |
||||
getResourceTypePage({ |
||||
pageNo: 1, |
||||
pageSize: 100 |
||||
}).then(res => { |
||||
this.resourceTypeList = res.data.list; |
||||
}) |
||||
}, |
||||
/** 查询任务列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// this.assemArea(); |
||||
// 处理查询参数 |
||||
let params = { ...this.queryParams }; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
|
||||
getAdminTaskPage(params).then(response =>{ |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}) |
||||
|
||||
}, |
||||
/** 搜索条件查询任务列表 */ |
||||
getSearchList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = { ...this.queryParams }; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getAdminTaskPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
|
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
taskCateId: undefined, |
||||
taskCateName: undefined, |
||||
resources: [], |
||||
images: undefined, |
||||
planStartTime: undefined, |
||||
planEndTime: undefined, |
||||
weight: undefined, |
||||
projectName: undefined, |
||||
cropId: undefined, |
||||
cropNum: undefined, |
||||
mainPerson: undefined, |
||||
executorPerson: undefined, |
||||
workingHours: undefined, |
||||
projectId:undefined, |
||||
areaId:undefined, |
||||
executorName:undefined |
||||
}; |
||||
this.selectCpUserList = []; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getSearchList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangePlanStartTime = []; |
||||
this.dateRangePlanEndTime = []; |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.startMethod(); |
||||
this.reset(); |
||||
this.twoRescoure(); |
||||
// this.assemArea(); |
||||
this.resourceNumberList = []; |
||||
this.open = true; |
||||
this.title = "添加农场任务"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.startMethod(); |
||||
this.reset(); |
||||
// this.assemArea(); |
||||
const id = row.id; |
||||
getTask(id).then(response => { |
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改农场任务"; |
||||
let project = this.projectList.filter(project => project.id == response.data.projectId)[0]; |
||||
this.changeCpUser(project); |
||||
this.showAreaByProject(project); |
||||
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId); |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
console.log("提交按钮", this.form); |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
|
||||
this.judgePictureExists(); |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateTask(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createTask(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/*判断图片是否存在*/ |
||||
judgePictureExists(){ |
||||
if (this.form.id != null) { |
||||
if (this.form.images == "") { |
||||
this.form.images = []; |
||||
}else{ |
||||
let imagesType = typeof(this.form.images); |
||||
if (imagesType == "string") { |
||||
let imgArr = this.form.images.split(",") |
||||
this.form.images = imgArr; |
||||
} |
||||
} |
||||
return; |
||||
} |
||||
if (this.form.images == undefined || this.form.images =="") { |
||||
this.form.images = []; |
||||
} |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除农场项目编号为"' + id + '"的数据项?').then(function () { |
||||
return deleteTask(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => { }); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = { ...this.queryParams }; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有农场项目数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportTaskExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => { }); |
||||
}, |
||||
twoRescoure() { |
||||
let firstList = []; |
||||
this.resourceTypeList.forEach((type) => { |
||||
let secondList = []; |
||||
this.resourceList.forEach((res) => { |
||||
if (res.resourceType == type.id) { |
||||
secondList.push({ value: res.id, label: res.name }); |
||||
} |
||||
}) |
||||
firstList.push({ value: type.id, label: type.name, children: secondList }); |
||||
}) |
||||
this.twoList = firstList; |
||||
}, |
||||
changeCateOne(row) { |
||||
this.form.taskCateName = undefined; |
||||
this.cateTwoList = this.taskCateAllList.filter(t => t.parentId == row); |
||||
}, |
||||
changeProject(row) { |
||||
let project = this.projectList.filter(project => project.id == row)[0]; |
||||
//根据项目 自动展示作物 |
||||
this.form.cropId = null; |
||||
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId); |
||||
|
||||
//根据项目 展示区域 |
||||
this.form.areas = null; |
||||
this.showAreaByProject(project); |
||||
|
||||
|
||||
//清楚 可选成员数量 |
||||
this.selectCpUserList = []; |
||||
this.form.mainPerson = null; |
||||
this.form.executorPerson = null; |
||||
this.changeCpUser(project); |
||||
}, |
||||
changeCpUser(project){ |
||||
this.selectCpUserList = this.cpUserList.filter(item => item.id == project.mainPerson); |
||||
}, |
||||
showAreaByProject(project){ |
||||
//根据项目 展示可选区域 |
||||
let first = []; |
||||
let second =[]; |
||||
let third =[]; |
||||
this.areasList.forEach(ar =>{ |
||||
project.areas.forEach(sel =>{ |
||||
if(ar.id == sel){ |
||||
if(ar.parentId != 0){ |
||||
let parentAr = this.areasList.filter(item => item.id == ar.parentId)[0]; |
||||
let thi = this.areasList.filter(item => item.id == sel)[0] |
||||
if(parentAr.parentId != 0){ |
||||
let ppA = this.areasList.filter(item => item.id == parentAr.parentId)[0]; |
||||
first.push(ppA); |
||||
second.push(parentAr); |
||||
third.push(thi); |
||||
}else{ |
||||
first.push(parentAr); |
||||
second.push(thi); |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
let setFirst = new Set(first); |
||||
let setSecond = new Set(second); |
||||
|
||||
let oneList = []; |
||||
setFirst.forEach(fi =>{ |
||||
let twoList = []; |
||||
setSecond.forEach(se =>{ |
||||
if(se.parentId == fi.id){ |
||||
let threeList = []; |
||||
third.forEach(th =>{ |
||||
if(th.parentId == se.id){ |
||||
threeList.push({value:th.id, label:th.name}); |
||||
} |
||||
}) |
||||
if(threeList.length != 0){ |
||||
twoList.push({value:se.id, label:se.name, children:threeList}); |
||||
}else{ |
||||
twoList.push({value:se.id, label:se.name}); |
||||
} |
||||
} |
||||
}) |
||||
oneList.push({value:fi.id, label:fi.name, children:twoList}); |
||||
}) |
||||
this.assemAreaList = oneList; |
||||
} |
||||
|
||||
|
||||
} |
||||
}; |
||||
</script> |
@ -1,278 +0,0 @@
|
||||
<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="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间"> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:task-cate:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:task-cate:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table :data="list" style="width: 100%;margin-bottom: 20px;" row-key="id" border lazy |
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
||||
<el-table-column prop="id" label="id" sortable width="180"></el-table-column> |
||||
<el-table-column prop="name" label="名" sortable width="180"></el-table-column> |
||||
<el-table-column prop="unit" label="单位" sortable width="80"></el-table-column> |
||||
|
||||
<el-table-column prop="synchronizeErp" label="是否同步到ERP" align="center" sortable="180"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="success" v-if="!scope.row.synchronizeErp">否</el-button> |
||||
<el-button type="danger" v-if="scope.row.synchronizeErp">是</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:task-cate:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:task-cate:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="上级" prop="projectId"> |
||||
<el-select v-model="form.parentId" placeholder="请选择"> |
||||
<el-option |
||||
v-for="item in parentList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
{{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="分类名称" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="任务单位" prop="unit"> |
||||
<el-input v-model="form.unit" placeholder="请输入" /> |
||||
</el-form-item> |
||||
<el-form-item label="同步到erp" prop="synchronizeErp"> |
||||
<el-radio-group v-model="form.synchronizeErp"> |
||||
<el-radio :label=false>不同步</el-radio> |
||||
<el-radio :label=true>同步</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createTaskCate, updateTaskCate, deleteTaskCate, getTaskCate, getTaskCatePage, exportTaskCateExcel } from "@/api/farm/taskCate"; |
||||
|
||||
export default { |
||||
name: "TaskCate", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 任务类型列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 100, |
||||
parentId: null, |
||||
name: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
|
||||
cateList:[], |
||||
|
||||
parentList:[] |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getTaskCatePage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
|
||||
this.cateList = this.list; |
||||
let filterList = this.list.filter(t => t.parentId == 0); |
||||
let oneList = []; |
||||
if(filterList.length == 0){ |
||||
//没有上级 |
||||
this.list.forEach(t => { |
||||
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, synchronizeErp:one.synchronizeErp, children:twoList}); |
||||
}) |
||||
}else{ |
||||
filterList.forEach((one) => { |
||||
let twoList = []; |
||||
this.list.forEach((two) => { |
||||
if(one.id == two.parentId){ |
||||
twoList.push({id:two.id, name:two.name, unit:two.unit, synchronizeErp:two.synchronizeErp, createTime:two.createTime}) |
||||
} |
||||
}) |
||||
oneList.push({id:one.id, name:one.name, unit:one.unit, createTime:one.createTime, synchronizeErp:one.synchronizeErp, children:twoList}); |
||||
}) |
||||
} |
||||
|
||||
this.list = oneList; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
parentId: undefined, |
||||
name: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.parentList = this.cateList.filter(t => t.parentId == 0); |
||||
|
||||
this.open = true; |
||||
this.title = "添加任务类型"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id; |
||||
getTaskCate(id).then(response => { |
||||
this.parentList = this.cateList.filter(t => t.parentId == 0); |
||||
|
||||
this.form = response.data; |
||||
this.open = true; |
||||
this.title = "修改任务类型"; |
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateTaskCate(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createTaskCate(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除任务类型编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteTaskCate(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有任务类型数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportTaskCateExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -1,401 +0,0 @@
|
||||
<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="userId"> |
||||
<el-input v-model="queryParams.userId" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="" prop="projectId"> |
||||
<el-input v-model="queryParams.projectId" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="" prop="taskId"> |
||||
<el-input v-model="queryParams.taskId" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label="" prop="hour"> |
||||
<el-input v-model="queryParams.hour" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
||||
</el-form-item> |
||||
<el-form-item label=""> |
||||
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" |
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" @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="['farm:work-hour:create']">新增</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" |
||||
v-hasPermi="['farm:work-hour:export']">导出</el-button> |
||||
</el-col> |
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-row> |
||||
|
||||
<!-- 列表 --> |
||||
<el-table v-loading="loading" :data="list"> |
||||
<el-table-column label="id" align="center" prop="id" /> |
||||
<el-table-column label="员工名" align="center" prop="userId" > |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.userId">{{userConvert(scope.row.userId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="项目名" align="center" prop="projectId" > |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.projectId}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="任务名" align="center" prop="taskId" > |
||||
<template slot-scope="scope"> |
||||
<span>{{taskConvert(scope.row.taskId)}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="工时" align="center" prop="hour" /> |
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <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="handleUpdate(scope.row)" |
||||
v-hasPermi="['farm:work-hour:update']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
||||
v-hasPermi="['farm:work-hour:delete']">删除</el-button> |
||||
</template> |
||||
</el-table-column> --> |
||||
</el-table> |
||||
<!-- 分页组件 --> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
||||
@pagination="getList"/> |
||||
|
||||
<!-- 对话框(添加 / 修改) --> |
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
||||
<el-form-item label="项目" prop="projectId"> |
||||
<el-select v-model="form.projectId" @change="chooseProject" placeholder="请选择"> |
||||
<el-option |
||||
v-for="item in projectList" |
||||
:key="item.id" |
||||
:label="item.id +'/'+item.name" |
||||
:value="item.id"> |
||||
{{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="任务" prop="taskId"> |
||||
<el-select v-model="form.taskId" @change="chooseTask" placeholder="请选择"> |
||||
<el-option |
||||
v-for="item in selectTaskList" |
||||
:key="item.id" |
||||
:label="item.taskName +'/'+ item.taskMsg" |
||||
:value="item.id" |
||||
@change="chooseTask"> |
||||
{{item.taskName +"/"+ item.taskMsg}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="员工" prop="userId"> |
||||
<el-select v-model="form.userId" placeholder="请选择"> |
||||
<el-option |
||||
v-for="item in selectCpUserList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
{{item.name}} |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="工时" prop="hour"> |
||||
<el-input v-model="form.hour" placeholder="请输入" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { createWorkHour, updateWorkHour, deleteWorkHour, getWorkHour, getWorkHourPage, exportWorkHourExcel } from "@/api/farm/workHour"; |
||||
import { getProjectPage} from "@/api/farm/project"; |
||||
import { getTaskPage} from "@/api/farm/task"; |
||||
import { getCpUserPage} from "@/api/system/cpUser" |
||||
import { getTaskCatePage} from "@/api/farm/taskCate" |
||||
|
||||
|
||||
export default { |
||||
name: "WorkHour", |
||||
components: { |
||||
}, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 导出遮罩层 |
||||
exportLoading: false, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 列表 |
||||
list: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
dateRangeCreateTime: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNo: 1, |
||||
pageSize: 10, |
||||
userId: null, |
||||
projectId: null, |
||||
taskId: null, |
||||
hour: null, |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
hour: [{ required: true, message: "不能为空", trigger: "blur" }], |
||||
}, |
||||
|
||||
projectList: [], |
||||
taskList:[], |
||||
selectTaskList:[], |
||||
cpUserList:[], |
||||
selectCpUserList:[], |
||||
taskCateList:[] |
||||
|
||||
}; |
||||
}, |
||||
created() { |
||||
this.getTaskCateList(); |
||||
}, |
||||
methods: { |
||||
getTaskCateList(){ |
||||
getTaskCatePage({ |
||||
pageNo : 1, |
||||
pageSize : 100 |
||||
}).then(res =>{ |
||||
this.taskCateList = res.data.list; |
||||
this.getProjectPageList(); |
||||
}) |
||||
}, |
||||
getProjectPageList(){ |
||||
getProjectPage({ |
||||
pageNo:1, |
||||
pageSize:100 |
||||
}).then(res => { |
||||
this.projectList = res.data.list; |
||||
this.getTaskPageList(); |
||||
}) |
||||
}, |
||||
getTaskPageList(){ |
||||
getTaskPage({ |
||||
pageNo:1, |
||||
pageSize:100 |
||||
}).then(res => { |
||||
this.taskList = res.data.list; |
||||
this.getCpUserPageList(); |
||||
}) |
||||
}, |
||||
getCpUserPageList(){ |
||||
getCpUserPage({ |
||||
pageNo:1, |
||||
pageSize:400 |
||||
}).then(res => { |
||||
this.cpUserList = res.data.list; |
||||
this.getList() |
||||
}) |
||||
}, |
||||
/** 查询列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行查询 |
||||
getWorkHourPage(params).then(response => { |
||||
this.list = response.data.list; |
||||
this.total = response.data.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
/** 取消按钮 */ |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
/** 表单重置 */ |
||||
reset() { |
||||
this.form = { |
||||
id: undefined, |
||||
userId: undefined, |
||||
projectId: undefined, |
||||
taskId: undefined, |
||||
hour: undefined, |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNo = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRangeCreateTime = []; |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
this.getTaskPageList(); |
||||
this.getCpUserPageList(); |
||||
|
||||
const id = row.id; |
||||
getWorkHour(id).then(response => { |
||||
let task = this.taskList.filter(t => t.id == response.data.taskId); |
||||
this.form = response.data; |
||||
this.taskId = task[0].name; |
||||
let taskArr = this.taskList.filter(t => t.projectId == response.data.projectId); |
||||
this.selectTaskList = taskArr; |
||||
let userName = this.cpUserList.filter(t => t.id == response.data.userId); |
||||
this.form.userId = userName[0].name; |
||||
this.selectCpUserList = []; |
||||
let userIdArr = []; |
||||
userIdArr = JSON.parse(task[0].executorPerson); |
||||
userIdArr.push(task[0].mainPerson); |
||||
let userArr = []; |
||||
userIdArr.forEach(item =>{ |
||||
this.cpUserList.forEach(u =>{ |
||||
if(u.id == item){ |
||||
userArr.push(u); |
||||
} |
||||
}) |
||||
}) |
||||
let mapp = new Set(userArr); |
||||
let quchong = Array.from(mapp); |
||||
this.selectCpUserList = quchong; |
||||
|
||||
this.open = true; |
||||
this.title = "修改"; |
||||
|
||||
}); |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (!valid) { |
||||
return; |
||||
} |
||||
// 修改的提交 |
||||
if (this.form.id != null) { |
||||
updateWorkHour(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
return; |
||||
} |
||||
// 添加的提交 |
||||
createWorkHour(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const id = row.id; |
||||
this.$modal.confirm('是否确认删除编号为"' + id + '"的数据项?').then(function() { |
||||
return deleteWorkHour(id); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
// 处理查询参数 |
||||
let params = {...this.queryParams}; |
||||
params.pageNo = undefined; |
||||
params.pageSize = undefined; |
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
||||
// 执行导出 |
||||
this.$modal.confirm('是否确认导出所有数据项?').then(() => { |
||||
this.exportLoading = true; |
||||
return exportWorkHourExcel(params); |
||||
}).then(response => { |
||||
this.$download.excel(response, '${table.classComment}.xls'); |
||||
this.exportLoading = false; |
||||
}).catch(() => {}); |
||||
}, |
||||
|
||||
chooseProject(row){ |
||||
this.form.taskId = undefined; |
||||
this.form.userId = undefined; |
||||
this.selectTaskList = []; |
||||
this.selectCpUserList = []; |
||||
this.taskList.forEach(item=>{ |
||||
if(row == item.projectId){ |
||||
this.selectTaskList.push(item); |
||||
} |
||||
}) |
||||
|
||||
}, |
||||
|
||||
chooseTask(row){ |
||||
this.form.userId = undefined; |
||||
this.selectCpUserList = []; |
||||
let arr = this.selectTaskList.filter(t => t.id == row)[0]; |
||||
let userIdList = []; |
||||
userIdList.push(arr.mainPerson); |
||||
arr.executorPerson.forEach(exe =>{ |
||||
userIdList.push(exe); |
||||
}) |
||||
|
||||
let userList = []; |
||||
this.cpUserList.forEach(user =>{ |
||||
userIdList.forEach(id =>{ |
||||
if(user.id == id){ |
||||
userList.push(user); |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
let mapp = new Set(userList); |
||||
let quchong = Array.from(mapp); |
||||
this.selectCpUserList = quchong; |
||||
}, |
||||
|
||||
userConvert(userId){ |
||||
return this.cpUserList.filter(user => user.id == userId)[0].name; |
||||
}, |
||||
taskConvert(taskId){ |
||||
let task = this.taskList.filter(item => item.id == taskId)[0]; |
||||
let cate = this.taskCateList.filter(cate => cate.id == task.taskCateId)[0].name; |
||||
let cateName = this.taskCateList.filter(cate => cate.id == task.taskCateName)[0].name; |
||||
return cate +"/"+ cateName; |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue