Browse Source

提交米莱的的代码

Lijy 11 hours ago
parent
commit
84fede3fc9

+ 88 - 5
fhKeeper/formulahousekeeper/timesheet_mld/src/components/taskComponent.vue

@@ -97,7 +97,7 @@
                                         <span style="float: right; color: #8492a6; font-size: 13px;margin-left: 20px" v-if="item.jobNumber">{{ item.jobNumber }}</span>
                                     </el-option>
                                 </el-select>
-                                <el-link v-if="executorItem.executorId && addForm.startDate && addForm.endDate" style="margin-left:5px;" @click.stop="viewTaskTimeList(executorItem.executorId)">查看</el-link>
+                                <el-link v-if="executorItem.executorId && addForm.startDate && addForm.endDate" style="margin-left:5px;" @click.stop="viewTaskTimeList(executorItem.executorId, executorItem.indexList)" type="primary" :underline="false">查看/修改</el-link>
                             </div>
                             
                             <!-- 计划工时 -->
@@ -605,6 +605,41 @@
             </div>
         </span>
     </div>
+
+    <!-- 修改工时弹窗 -->
+    <el-dialog title="修改计划" :visible.sync="modifyWorkingHoursRowVisable" width="840px" top="6.5vh" :before-close="handleClose" append-to-body>
+        <div>
+            <div class="modifyPlanTitle">
+                <div class="modifyPlanTitle-item">
+                    <div>执行人:</div>
+                    <el-select v-model="modifyWorkingHoursRow.userId" placeholder="请选择" filterable size="small" style="width: 180px;"  @change="getViewTaskTimeList()">
+                        <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id">
+                            <span style="float: left">{{ item.name }}</span>
+                            <span style="float: right; color: #8492a6; font-size: 13px;margin-left: 20px" v-if="item.jobNumber">{{ item.jobNumber }}</span>
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="modifyPlanTitle-item">
+                    <div>时间段:</div>
+                    <el-date-picker v-model="modifyWorkingHoursRow.startDate" type="datetime" style="width: 200px;" value-format="yyyy-MM-dd HH:mm:ss"  
+                    default-time="09:00:00" :placeholder="$t('pleaseselectadate')" size="small" @change="getViewTaskTimeList()" :clearable="false"></el-date-picker>
+                    <span style="margin:0 10px;">至</span>
+                    <el-date-picker style="width: 200px;" v-model="modifyWorkingHoursRow.endDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"  
+                    default-time="17:30:00" :placeholder="$t('pleaseselectadate')" size="small" @change="getViewTaskTimeList()" :clearable="false"></el-date-picker>
+                </div>
+            </div>
+            <el-table :data="modifyWorkingHoursList" style="width: 100%" border v-loading="modifyWorkingHoursListLoading" height="58vh">
+                <el-table-column prop="name" label="项目名称"></el-table-column>
+                <el-table-column prop="typeName" label="计划名称"></el-table-column>
+                <el-table-column prop="startDate" label="开始时间" width="180"></el-table-column>
+                <el-table-column prop="endDate" label="截止时间" width="180"></el-table-column>
+            </el-table>
+        </div>
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="modifyWorkingHoursRowVisable = false">取 消</el-button>
+            <el-button type="primary" @click="confirmArrangement()">确认安排</el-button>
+        </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -876,6 +911,11 @@ export default {
         },
         pmUserList: [],
         millerSReviewer: [],
+
+        modifyWorkingHoursRow: {},
+        modifyWorkingHoursList: [],
+        modifyWorkingHoursListLoading: false,
+        modifyWorkingHoursRowVisable: false,
     };
   },
   computed: {
@@ -923,16 +963,48 @@ export default {
     onTypeChange(e) {
         this.selectType = this.typeList.filter(a=>a.id == e)[0];
     },  
-    viewTaskTimeList(executorId) {
-        this.http.post('/task/viewUserTaskSchedule', { taskId: this.addForm.id, userId: executorId, startDate: this.addForm.startDate, endDate: this.addForm.endDate},
+    confirmArrangement() {
+        const { index, userId, startDate, endDate } = this.modifyWorkingHoursRow    
+        const userList = (this.addForm.executorListFront || []).filter(item => item.executorId == userId)
+        const row = this.addForm.executorListFront[index].executorId
+
+        if(userList.length > 0 && row != userId) {
+            this.$message({ message: '执行人已存在', type: "error" });
+            return
+        }
+
+        const name = this.users.find(item => item.id == userId).name
+
+        this.addForm.executorListFront[index].executorId = userId
+        this.addForm.executorListFront[index].executorName = name
+
+        this.addForm.startDate = startDate
+        this.addForm.endDate = endDate
+
+        this.modifyWorkingHoursRowVisable = false
+
+        this.$message({ message: '修改成功', type: "success" });
+    },
+    viewTaskTimeList(executorId, index) {
+        this.modifyWorkingHoursRow = { taskId: this.addForm.id, userId: executorId, startDate: this.addForm.startDate, endDate: this.addForm.endDate, index}
+        this.modifyWorkingHoursRowVisable = true
+        this.getViewTaskTimeList()
+    },
+    getViewTaskTimeList() {
+        this.modifyWorkingHoursListLoading = true
+        let obj = { ...this.modifyWorkingHoursRow }
+        delete obj.index
+        this.http.post('/task/viewUserTaskSchedule', { ...obj },
         res => {
+            this.modifyWorkingHoursListLoading = false
           if (res.code == "ok") {
-            
+            this.modifyWorkingHoursList = res.data;
           } else {
             this.$message({ message: res.msg, type: "error" });
           }
         },
         error => {
+          this.modifyWorkingHoursListLoading = false
           this.$message({ message: error, type: "error" });
         });
     },
@@ -1127,7 +1199,7 @@ export default {
                 projectId: obj.stage.projectId, 
                 groupId: obj.stage.groupId, 
                 stagesId: obj.stage.id, 
-                startDate: obj.addForm.startDate,
+                startDate: obj.addForm.startDate + ' 08:00:00',
                 taskLevel:0, 
                 planHours: 8, 
                 taskType: 0
@@ -2704,4 +2776,15 @@ export default {
         margin-right: 10px;
     }
 }
+
+.modifyPlanTitle {
+    display: flex;
+    align-items: center;
+    margin-bottom: 20px;
+}
+.modifyPlanTitle-item {
+    display: flex;
+    align-items: center;
+    margin-right: 20px;
+}
 </style>