计算预计结束时间2.0

dev^2
chengyufei 1 year ago
parent 9a5f1c11a1
commit 0ae1dd1104
  1. 65
      ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue
  2. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java

@ -5,15 +5,8 @@
<a-row>
<a-col :span="24">
<a-form-model-item label="上级任务" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="upperName">
<j-popup
v-model="model.upperTaskName"
field="upperTaskName"
org-fields="id,task_name"
dest-fields="upperId,upperTaskName"
code="taskname"
:multi="true"
@input="popupCallback"
/>
<j-popup v-model="model.upperTaskName" field="upperTaskName" org-fields="id,task_name"
dest-fields="upperId,upperTaskName" code="taskname" :multi="true" @input="popupCallback" />
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">-->
@ -31,7 +24,8 @@
<a-col :span="24">
<a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel">
<!-- <a-input-number :min="1" :max="16" v-model="model.workLevel" placeholder="请输入任务等级" style="width: 100%" />-->
<j-dict-select-tag v-model="model.workLevel" type="radio" placeholder="请选择任务等级" dict-code="workLevel" style="width: 100%">
<j-dict-select-tag v-model="model.workLevel" type="radio" placeholder="请选择任务等级" dict-code="workLevel"
style="width: 100%">
</j-dict-select-tag>
</a-form-model-item>
@ -62,13 +56,8 @@
<a-row>
<a-col :span="24">
<a-form-model-item label="项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectId">
<j-dict-select-tag
v-model="model.projectId"
placeholder="请选择项目"
dict-code="projectx,project_name,id"
style="width: 100%"
:disabled="model.typeId==null"
@change="fillTaskName" >
<j-dict-select-tag v-model="model.projectId" placeholder="请选择项目" dict-code="projectx,project_name,id"
style="width: 100%" :disabled="model.typeId == null" @change="fillTaskName">
</j-dict-select-tag>
</a-form-model-item>
</a-col>
@ -78,32 +67,29 @@
<!-- autocomplete="on" -->
<!-- :disabled="model.typeId==null">-->
<!-- </a-input>-->
<a-textarea v-model="model.taskName"
placeholder="请输入中文名称"
autocomplete="on"
:disabled="model.typeId==null"
auto-size />
<a-textarea v-model="model.taskName" placeholder="请输入中文名称" autocomplete="on"
:disabled="model.typeId == null" auto-size />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">
<j-multi-select-tag type="list_multi" v-model="model.managerUsers" dictCode="sys_user,realname,id" placeholder="请选择责任人"/>
<j-multi-select-tag type="list_multi" v-model="model.managerUsers" dictCode="sys_user,realname,id"
placeholder="请选择责任人" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="模块" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId">
<!-- <a-input v-model="model.moduleId" placeholder="请输入模块" modulex,module_name,id></a-input>-->
<j-dict-select-tag v-model="model.moduleId" placeholder="请选择模块" :dict-code="this.modulex"
style="width: 80%" @change="fillModuleName()"></j-dict-select-tag>
<j-dict-select-tag v-model="model.moduleId" placeholder="请选择模块" :dict-code="this.modulex" style="width: 80%"
@change="fillModuleName()"></j-dict-select-tag>
<a-button @click="handleAdd3" type="primary" icon="plus" style="width: 20%;"></a-button>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="功能" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="functionId">
<!-- <a-input v-model="model.functionId" placeholder="请输入功能id" functionx,function_name,id></a-input>-->
<j-dict-select-tag v-model="model.functionId" placeholder="请选择功能"
:dict-code="functionx"
style="width: 80%" @change="fillFunctionName()"></j-dict-select-tag>
<j-dict-select-tag v-model="model.functionId" placeholder="请选择功能" :dict-code="functionx" style="width: 80%"
@change="fillFunctionName()"></j-dict-select-tag>
<a-button @click="handleAdd1(model.moduleId)" type="primary" icon="plus" style="width: 20%;"></a-button>
</a-form-model-item>
</a-col>
@ -112,7 +98,8 @@
<!-- <a-input v-model="model.ruleId" placeholder="请输入规则id" rulex,rule_no,id></a-input>-->
<j-dict-select-tag v-model="model.ruleId" placeholder="请选择规则" :dict-code="rulex"
style="width: 80%"></j-dict-select-tag>
<a-button @click="handleAdd2(model.functionId,model.moduleId)" type="primary" icon="plus" style="width: 20%;"></a-button>
<a-button @click="handleAdd2(model.functionId, model.moduleId)" type="primary" icon="plus"
style="width: 20%;"></a-button>
</a-form-model-item>
</a-col>
</a-row>
@ -143,13 +130,14 @@
<a-col :span="24">
<a-form-model-item label="预计结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="expectedEndTime">
<!-- <j-date placeholder="请选择预计结束时间" v-model="model.expectedEndTime" style="width: 100%"/>-->
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" v-model="model.expectedEndTime" style="width: 100%"/>
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" v-model="model.expectedEndTime"
style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="预计时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="expectedDuration">
<a-input-number v-model="model.expectedDuration" placeholder="请输入预计时长" style="width: 100%"/>
<a-input-number v-model="model.expectedDuration" placeholder="请输入预计时长" style="width: 100%" @blur="expectedDuration()"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
@ -326,7 +314,8 @@ export default {
// queryTaskTypeById: "/taskType/taskType/queryById",
fillTaskName: "/task/task/fillTaskName",
list: "/task/task/list",
listtasktype: '/taskType/taskType/getTypeMap'
listtasktype: '/taskType/taskType/getTypeMap',
expectedDuration: '/task/task/estimateTime'
}
}
@ -343,6 +332,15 @@ export default {
this.tasktype()
},
methods: {
expectedDuration() {
let param = {
startTime: this.model.startTime,
expectedDuration: this.model.expectedDuration,
}
getAction(this.url. expectedDuration, param).then((res) => {
this.model.expectedEndTime=res.result
})
},
tasktype() {
getAction(this.url.listtasktype).then((res) => {
const data = res.result;
@ -505,11 +503,12 @@ export default {
flex-wrap: wrap;
align-items: baseline;
}
.B {
width: 10%;
}
::v-deep .ant-radio-group {
width: 85%;
}
</style>

@ -454,6 +454,8 @@ public class TaskController extends JeecgController<Task, ITaskService> {
return workTime;
}else {
//时间跨度没有超过两天
if (startTime.compareTo(date4) >= 0)
return workTime; //任务是下午下班之后发布的,且是下班之后提交的,没有多余工作时间
if (startTime.compareTo(date1) <= 0)
startTime = date1; //发布任务在8点之前
if (startTime.compareTo(date2) <= 0){
@ -530,6 +532,11 @@ public class TaskController extends JeecgController<Task, ITaskService> {
long tempTime = 0;
if (startTime.compareTo(date1) <= 0)
startTime = date1; //任务发布在8点半之前,修正时间
if (startTime.compareTo(date4) >= 0){
startTime = date1; //任务发布在晚上下班后,修正到第二天早上上班时间
offset ++;
}
if (startTime.compareTo(date2) < 0){
//上午发布任务
tempTime = date2.getTime() - startTime.getTime();
@ -547,6 +554,8 @@ public class TaskController extends JeecgController<Task, ITaskService> {
tempTime = date4.getTime() - startTime.getTime();
if (tempTime >= millisecond)
return new Date(startTime.getTime() + millisecond + DAYTIME*offset);
else
millisecond -= tempTime;
}
//时间修正,天数偏移量加1,到这里有两中情况,1、白天工作时间不足抵消 2、下午6点之后发布任务
offset ++;
@ -557,6 +566,7 @@ public class TaskController extends JeecgController<Task, ITaskService> {
return new Date(startTime.getTime() + millisecond + DAYTIME*offset);
//上午偏移不足,下午一定够,因为不会跨两天
millisecond -= tempTime;
startTime = date3;
return new Date(startTime.getTime() + millisecond + DAYTIME*offset);
}

Loading…
Cancel
Save