Selaa lähdekoodia

依斯贝服务填报

seyason 1 vuosi sitten
vanhempi
commit
b62a50f015

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -403,6 +403,9 @@ public class Report extends Model<Report> {
     @TableField("sap_service_id")
     private Integer sapServiceId;
 
+    @TableField(exist = false)
+    private String sapServiceName;
+
     @TableField(exist = false)
     private List<SapProjectService> serviceList;
 

+ 15 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -798,11 +798,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 if (companyId == 3092) {
                     Integer taskId = r.getTaskId();
                     if (taskId != null) {
-                        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", taskId).eq("executor_id", r.getCreatorId()));
-                        List<String> sapServiceIds = executorList.stream().map(TaskExecutor::getServiceId).collect(Collectors.toList());
-                        if (sapServiceIds.size() > 0) {
-                            List<SapProjectService> sapSList = sapProjectServiceMapper.selectList(new QueryWrapper<SapProjectService>().in("id", sapServiceIds));
+                        List<TaskExecutor> taskExecutors = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", taskId).eq("executor_id", r.getCreatorId()));
+                        List<Integer> serviceIds = new ArrayList<>();
+                        for (TaskExecutor executor : taskExecutors) {
+                            String serviceId = executor.getServiceId();
+                            if (!StringUtils.isEmpty(serviceId)) {
+                                List<Integer> ints = JSONArray.parseArray(serviceId, Integer.class);
+                                serviceIds.addAll(ints);
+                            }
+                        }
+                        if (serviceIds.size() > 0) {
+                            List<SapProjectService> sapSList = sapProjectServiceMapper.selectList(new QueryWrapper<SapProjectService>().in("id", serviceIds));
                             r.setServiceList(sapSList);
+                            Optional<SapProjectService> first = sapSList.stream().filter(s -> s.getId().equals(r.getSapServiceId())).findFirst();
+                            if (first.isPresent()) {
+                                r.setSapServiceName(first.get().getServiceName());
+                            }
                         } else {
                             r.setServiceList(new ArrayList<>());
                         }

+ 8 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -2297,7 +2297,7 @@
                     this.http.post('/task/getMyTaskService',{taskId:domainItem.taskId},res => {
                             if (res.code == "ok") {
                                 // domainItem.workContentList = res.data;
-                                that.$set(domainItem, 'serviceList', null);
+                                that.$set(domainItem, 'sapServiceId', null);
                                 that.$set(domainItem, 'serviceList', res.data);
                             } else {
                                 this.$message({
@@ -4183,6 +4183,8 @@
             },
 
             getRecentTaskList(domain, index) {
+                //刷新任务时,清空服务
+                this.$set(domain, 'sapServiceId', null);
                 var param = { 
                     projectId: domain.projectId,
                     isSubstitude:this.isSubstitude?1:0
@@ -4276,6 +4278,7 @@
                 } else {
                     this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList.filter(t=>t.stagesName == domain.stage);
                 }
+                this.getRecentTaskList(domain, index);
                 this.$forceUpdate();
             },
 
@@ -4297,6 +4300,8 @@
                                 domain.stage = '';
                             }
                             domain.stages = res.data;
+                            domain.taskId = null;
+                            this.getRecentTaskList(domain, index);
                             this.$forceUpdate();
                         }
                     },
@@ -5417,7 +5422,8 @@
                                     extraField3: list.report[i].extraField3,
                                     workContentList: list.report[i].workContentList,
                                     filteredRespList: filteredRespList,
-                                    serviceList: list.report[i].serviceList
+                                    serviceList: list.report[i].serviceList,
+                                    sapServiceId: list.report[i].sapServiceId,
                                 })
                                 if (list.report[i].state >= 2) {
                                     this.canEdit = true;

+ 72 - 15
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -204,15 +204,22 @@
                     :rules="[{ required: user.companyId==3092?true:false, message: '请选择任务/里程碑' }]"
                     label="任务/里程碑" placeholder="请选择任务/里程碑" @click="clickPickerTask(index,item)"
                     ></van-field>
+                    <van-field v-if="user.companyId==3092"  readonly name="sapServiceId" :value="item.sapServiceName" 
+                    :rules="[{ required: true, message: '请选择服务' }]"
+                    label="服务" placeholder="请选择服务" @click="clickPickerService(index,item)"
+                    ></van-field>
                     <van-field name="taskFinish" label="是否已完成" v-if="item.taskId != null">
                         <template #input>
                             <van-checkbox :disabled="!item.canEdit" v-model="item.taskFinish" shape="square">已完成</van-checkbox>
                         </template>
-                        
                     </van-field>
                     <van-popup v-model="item.showPickerTask" position="bottom">
                         <van-picker show-toolbar :columns="item.taskList" value-key="taskName" @confirm="choseTask" @cancel="item.showPickerTask = false;$forceUpdate()" />
                     </van-popup>
+                    
+                    <van-popup v-model="item.showPickerService" position="bottom">
+                        <van-picker show-toolbar :columns="item.serviceList" value-key="serviceName" @confirm="choseService" @cancel="item.showPickerService = false;$forceUpdate()" />
+                    </van-popup>
                     <!-- <van-field readonly clickable class="form_input" :value="item.workingTime" name="workingTime" label="工作时长" placeholder="请输入工作时长(单位:小时)"
                     :rules="[{ required: true, message: '请输入工作时长(单位:小时)' }]" @touchstart.native.stop="showNumberKey = true"/>
                     <van-number-keyboard v-model="item.workingTime" :show="showNumberKey" close-button-text="完成" extra-key="." :maxlength="4" @blur="showNumberKey = false" /> -->
@@ -911,7 +918,7 @@ import timetoolVue from '../timetool/timetool.vue';
                 this.getTaskGroups(this.form.domains[this.clickIndex], this.clickIndex);
 
                 // 获取1相关维度
-                this.getTaskList(domainItem.projectId)
+                this.getTaskList(domainItem)
                 this.dimension(domainItem.projectId)
                 //获取相关日报提交选择人
                 domainItem.projectAuditorId = null;
@@ -1517,7 +1524,10 @@ import timetoolVue from '../timetool/timetool.vue';
                                     extraField3: list[i].extraField3,
                                     extraField3Name: list[i].extraField3Name,
                                     workContentList: list[i].workContentList,
-                                    filteredRespList: filteredRespList
+                                    filteredRespList: filteredRespList,
+                                    sapServiceId: list[i].sapServiceId,
+                                    sapServiceName: list[i].sapServiceName,
+                                    serviceList: list[i].serviceList,
                                 })
                                 if (list[i].state >= 2) {
                                     this.canEdit = true;
@@ -1663,8 +1673,8 @@ import timetoolVue from '../timetool/timetool.vue';
                 // var proId = this.form.domains[this.clickIndex].projectId
                 // this.dimension(proId)
             },
-            //选择
-            clickPickerTask(i,item) {
+            //选择
+            clickPickerService(i,item) {
                 if (!item.canEdit) return;
                 // console.log(i);
                 this.clickIndex = i;
@@ -1672,15 +1682,33 @@ import timetoolVue from '../timetool/timetool.vue';
                 // this.getTaskList(proId)
                 // console.log(this.form.domains[this.clickIndex].taskList);
                 this.$toast.clear();
-                if(!this.form.domains[this.clickIndex].taskList){
-                    this.$toast.fail('当前项目暂无可选的任务/里程碑');
-                }else if(this.form.domains[this.clickIndex].taskList.length == 0){
+                if(!this.form.domains[this.clickIndex].serviceList || this.form.domains[this.clickIndex].serviceList.length == 0){
+                    this.$toast.fail('当前任务暂无服务');
+                } else{
+                    this.form.domains[this.clickIndex].showPickerService= true;
+                    this.$forceUpdate();
+                }
+            },
+            choseService(value, index) {
+                if(value){
+                    this.form.domains[this.clickIndex].sapServiceId = value.id;
+                    this.form.domains[this.clickIndex].sapServiceName = value.serviceName;
+                }
+                this.form.domains[this.clickIndex].showPickerService = false;
+                this.$forceUpdate();
+            },
+
+            //选择任务
+            clickPickerTask(i,item) {
+                if (!item.canEdit) return;
+                this.clickIndex = i;
+                this.$toast.clear();
+                if(!this.form.domains[this.clickIndex].taskList || this.form.domains[this.clickIndex].taskList.length == 0){
                     this.$toast.fail('当前项目暂无可选的任务/里程碑');
-                }else{
+                } else{
                     this.form.domains[this.clickIndex].showPickerTask = true;
+                    this.$forceUpdate();
                 }
-                
-                this.$forceUpdate();
             },
             choseTask(value, index) {
                 if(value){
@@ -1689,8 +1717,21 @@ import timetoolVue from '../timetool/timetool.vue';
                 }
                 this.form.domains[this.clickIndex].showPickerTask = false;
                 this.$forceUpdate();
+                if (this.user.companyId == 3092) {
+                    //依斯贝,加载服务
+                    this.$axios.post("/task/getMyTaskService", {taskId: value.taskId})
+                    .then(res => {
+                        if(res.code == "ok") {
+                            this.$set(this.form.domains[this.clickIndex],'sapServiceId',null);
+                            this.$set(this.form.domains[this.clickIndex],'sapServiceName',null);
+                            this.$set(this.form.domains[this.clickIndex],'serviceList',res.data);
+                            this.$forceUpdate();
+                        } else {
+                            this.$toast.fail('获取失败:'+res.msg);
+                        }
+                    }).catch(err=> {this.$toast.clear();});
+                }
             },
-
             choseProjects(value, index) {
                 // console.log(value)
                 if(value){
@@ -1765,6 +1806,7 @@ import timetoolVue from '../timetool/timetool.vue';
                             if(res.code == "ok") {
                                 domain.stage = '';
                                 domain.stages = res.data;
+                                this.getTaskList(domain);
                                 this.$forceUpdate();
                             } else {
                                 this.$toast.fail('获取失败');
@@ -1800,15 +1842,27 @@ import timetoolVue from '../timetool/timetool.vue';
             },
 
 
-            getTaskList(projectId) {
+            getTaskList(domainItem) {
                 //如果是专业版,需要列出任务列表
                 if (this.user.company.packageProject == 1) {
-                    this.$axios.post("/task/getRecentTask", {projectId: projectId})
+                    //清空选中的任务
+                    this.$set(domainItem, 'taskId', null);
+                    this.$set(domainItem, 'taskName', null);
+                    this.$set(domainItem, 'sapServiceId', null);
+                    this.$set(domainItem, 'sapServiceName', null);
+                    this.$set(domainItem, 'serviceList', null);
+                    var param = {projectId: domainItem.projectId}
+                    if (domainItem.groupId) {
+                        param.groupId = domainItem.groupId;
+                    }
+                    if (domainItem.stage) {
+                        param.stage = domainItem.stage;
+                    }
+                    this.$axios.post("/task/getRecentTask", param)
                         .then(res => {
                             if(res.code == "ok") {
                                 this.form.domains[this.clickIndex].taskList = res.data;
                                 this.form = this.form;
-                                // this.$forceUpdate();
                             } else {
                                 this.$toast.fail('获取失败');
                             }
@@ -2263,6 +2317,9 @@ import timetoolVue from '../timetool/timetool.vue';
                             formData.append('extraField2', this.form.domains[i].extraField2);
                             formData.append('extraField3', this.form.domains[i].extraField3);
                         }
+                        if (this.user.companyId == 3092) {
+                            formData.append('sapServiceId', this.form.domains[i].sapServiceId);
+                        }
                     }
                     if(!this.flgLg) {
                         return