Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 năm trước cách đây
mục cha
commit
62eec41658

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/main.js

@@ -20,14 +20,14 @@ Picker , Dialog , NumberKeyboard , Sticky , Skeleton ,
 Panel , Divider , List , pullRefresh , SwipeCell, Checkbox, 
 Search, Slider,Stepper,Tag, Calendar, Row, Col, RadioGroup, Radio, 
 Loading ,DropdownMenu, DropdownItem, Button, ActionSheet, PullRefresh,Tabbar,
-TabbarItem,Uploader,Collapse, CollapseItem,Empty} from 'vant';
+TabbarItem,Uploader,Collapse, CollapseItem,Empty,CheckboxGroup} from 'vant';
 
 Vue.use(Form).use(Toast).use(Grid).use(GridItem).use(DatetimePicker)
 .use(Picker).use(Dialog).use(NumberKeyboard).use(Sticky).use(Skeleton)
 .use(Panel).use(Divider).use(List).use(pullRefresh).use(SwipeCell)
 .use(Checkbox).use(Search).use(Slider).use(Stepper).use(Tag).use(Calendar).use(RadioGroup).use(Radio)
 .use(Row).use(Col).use(Loading).use(DropdownMenu).use(DropdownItem).use(Button).use(ActionSheet)
-.use(PullRefresh).use(Tabbar).use(TabbarItem).use(Popover).use(Uploader).use(Collapse).use(CollapseItem).use(Empty);
+.use(PullRefresh).use(Tabbar).use(TabbarItem).use(Popover).use(Uploader).use(Collapse).use(CollapseItem).use(Empty).use(CheckboxGroup);
 
 // rem
 import "amfe-flexible";

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2886 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit-03.vue


+ 170 - 16
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -168,9 +168,46 @@
 
 
                         <!-- 相关维度 -->
-                        <van-field :value="item.weiduName" v-if="item.projectId && user.timeType.customDegreeActive == 1"  readonly  name="id" clickable :label="user.timeType.customDegreeName" placeholder="请选择" @click="clickPickers(index)"/>
-                        <van-popup v-model="item.showPickDegree" position="bottom">
+                        <van-field :value="item.weiduName" v-if="item.projectId && user.timeType.customDegreeActive == 1" :disabled="item.state<=1"  readonly  name="id" clickable :label="user.timeType.customDegreeName" placeholder="请选择" @click="clickPickers(index, item)"/>
+                        <!-- <van-popup v-model="item.showPickDegree" position="bottom">
                             <van-picker show-toolbar :columns="item.wuduList" value-key="name" @confirm="choseProjects" @cancel="item.showPickDegree = false;$forceUpdate()" />
+                        </van-popup> -->
+
+                        <van-popup v-model="item.showPickDegree" position="bottom" @click-overlay="overlayPopup(index, 'showPickDegree')">
+                            <div class="chooseSomeone">
+                                <div class="chooseSomeoneFlex1">
+                                    <!-- 复选 -->
+                                    <van-radio-group v-model="item.radioPickDegree" v-if="!user.timeType.customDegreeMultiple">
+                                        <van-radio v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem.id" style="padding:10px">
+                                            {{ uitem.name ? uitem.name : '' }}
+                                        </van-radio>
+                                    </van-radio-group>
+                                    <!-- 多选 -->
+                                    <van-checkbox-group v-model="item.radioPickDegree" v-if="user.timeType.customDegreeMultiple">
+                                        <van-checkbox v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem.id" style="padding:10px">
+                                            {{ uitem.name ? uitem.name : '' }}
+                                        </van-checkbox>
+                                    </van-checkbox-group>
+                                </div>
+                                <van-button @click="choseProjects(item.radioPickDegree, item.wuduList)">
+                                    确定
+                                </van-button>
+                            </div>
+                        </van-popup>
+
+                        <!-- 任务里程碑 -->
+                        <van-field :label="'任务/里程碑'" :value="item.taskName" :disabled="item.state<=1" readonly 
+                            clickable v-if="user.company.packageProject == 1 && user.company.nonProjectSimple==0" 
+                            @click="clickTakKer(index, item)"
+                        />
+                        <van-popup v-model="item.showTaksDegree" position="bottom" @click-overlay="overlayPopup(index, 'showTaksDegree')">
+                            <div class="chooseSomeone">
+                                <div class="chooseSomeoneFlex1">
+                                    <div class="chooseSomeoneItem" v-for="(sle,sleIndex) in item.newTaskList" :key="sleIndex" @click="selectTask(sle, index)">
+                                        {{ sle.taskName }}
+                                    </div>
+                                </div>
+                            </div>
                         </van-popup>
 
                         <!-- 自定义数值 -->
@@ -901,6 +938,8 @@
                 }
                 this.getKaoqin()
                 this.getWorkTime()
+
+                this.getWeeklyReportData()
             },
             // 周日期按钮状态
             canSelect(item){
@@ -992,6 +1031,11 @@
                     //清空分组和阶段
                     domainItem.stage = null;
                     domainItem.groupId = null;
+                    // 清空自定义维度
+                    domainItem.weiduName = '';
+                    domainItem.wuduList = []
+                    domainItem.degreeId = ''
+                    domainItem.radioPickDegree = ''
                 }
 
                 this.showPickerUserddp = false;
@@ -1571,13 +1615,37 @@
                 //     }
                 // });
             },
-            clickPickers(i) {
+            clickPickers(i, item) {
                 // if (!this.canEdit) return;
+                const { state } = item
+                if(state < 1) return
                 this.clickIndex = i;
                 this.currentForm.domains[this.clickIndex].showPickDegree = true;
                 var proId = this.currentForm.domains[this.clickIndex].projectId
                 this.dimension(proId)
             },
+            clickTakKer(i, item) {
+                const { state, taskList, groupId } = item
+                if(state < 1) return
+                this.clickIndex = i;
+                let taskListJson = JSON.parse(JSON.stringify(taskList))
+                this.currentForm.domains[this.clickIndex].newTaskList = taskListJson.filter(item => item.groupId == groupId);
+                this.currentForm.domains[this.clickIndex].showTaksDegree = true;
+                var proId = this.currentForm.domains[this.clickIndex].projectId
+                this.$forceUpdate();
+            },
+            overlayPopup(index, fields) {
+                console.log('触发')
+                this.currentForm.domains[index][fields] = false
+                this.$forceUpdate();
+            },
+            selectTask(item, i) {
+                this.clickIndex = i;
+                this.currentForm.domains[this.clickIndex].taskId = item.taskId;
+                this.currentForm.domains[this.clickIndex].taskName = item.taskName;
+                this.currentForm.domains[this.clickIndex].showTaksDegree = false
+                this.$forceUpdate();
+            },
             //选择任务
             clickPickerTask(i) {
                 // if (!this.canEdit) return;
@@ -1597,13 +1665,25 @@
                 this.$forceUpdate();
             },
 
-            choseProjects(value, index) {
-                // console.log(value)
+            choseProjects(value, arrList) {
+                console.log(value)
+                // return
+                const { timeType } = this.user
                 if(value){
-                    this.currentForm.domains[this.clickIndex].weiduName = value.name;
-                    this.currentForm.domains[this.clickIndex].degreeId = value.id;
+                    if(!timeType.customDegreeMultiple) { // 单选
+                        let list = arrList.filter(item => item.id == value)[0]
+                        this.currentForm.domains[this.clickIndex].weiduName = list.name;
+                        this.currentForm.domains[this.clickIndex].degreeId = list.id;
+                    }   
+                    if(timeType.customDegreeMultiple) { // 多选
+                        let list = arrList.filter(s => value.includes(+s.id))
+                        this.currentForm.domains[this.clickIndex].weiduName = list.map(item => item.name).join(',');
+                        this.currentForm.domains[this.clickIndex].degreeId = list.map(item => item.id).join(',');
+                    }
                 }
                 this.currentForm.domains[this.clickIndex].showPickDegree = false;
+
+                console.log(this.currentForm.domains[this.clickIndex], '再次')
                 this.$forceUpdate();
             },
 
@@ -1690,11 +1770,32 @@
                         }).catch(err=> {this.$toast.clear();});
             },
             // 获取维度
-            dimension(projectId) {
+            dimension(projectId, index, flag = false, customDegreeMultiple, newClickIndex) {
                 this.$axios.post("/project/getDegreeList", {projectId: projectId})
                 .then(res => {
                     if(res.code == "ok") {
+                        res.data.forEach(item => {
+                            item.id = +item.id
+                        })
+                        // if(flag) {
+                        //     this.clickIndex = newClickIndex
+                        // }
                         this.currentForm.domains[this.clickIndex].wuduList = res.data;
+                        // let degreeId = this.currentForm.domains[this.clickIndex].degreeId
+                        // for(let i in degreeId) {
+                        //     degreeId[i] = +degreeId[i]
+                        // }
+                        // if(flag) {
+                        //     if(!customDegreeMultiple) { // 单选
+                        //         this.currentForm.domains[this.clickIndex].radioPickDegree = res.data.filter(item => item.id == degreeId)[0]
+                        //         this.currentForm.domains[this.clickIndex].weiduName = res.data.filter(item => item.id == degreeId)[0].name
+                        //     } else {
+                        //         let arr = res.data.filter(s => degreeId.includes(+s.id)).map(s => s.name);
+                        //         this.currentForm.domains[this.clickIndex].weiduName = arr.join(',')
+                        //     }
+                        // }
+
+                        // console.log(this.currentForm.domains[this.clickIndex])
                         this.$forceUpdate();
                     } else {
                         this.$toast.fail('获取失败');
@@ -1703,12 +1804,15 @@
             },
 
 
-            getTaskList(projectId) {
+            getTaskList(projectId, index, flag = false, newClickIndex) {
                 //如果是专业版,需要列出任务列表
                 if (this.user.company.packageProject == 1) {
                     this.$axios.post("/task/getRecentTask", {projectId: projectId})
                         .then(res => {
                             if(res.code == "ok") {
+                                if(flag) {
+                                    this.clickIndex = newClickIndex
+                                }
                                 this.currentForm.domains[this.clickIndex].taskList = res.data;
                                 this.currentForm = this.currentForm;
                                 // this.$forceUpdate();
@@ -2036,10 +2140,18 @@
 
 
                         if (this.user.timeType.customDegreeActive == 1) {
+                            let customDegreeMultiple = this.user.timeType.customDegreeMultiple
                             if(this.form[formIndex].domains[i].degreeId) {
-                                formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
+                                // formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
+                                if(!customDegreeMultiple) { // 单选
+                                    formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
+                                } else {
+                                    console.log(this.form[formIndex].domains[i].degreeId)
+                                    let newDegreeId = this.form[formIndex].domains[i].degreeId.split(',')
+                                    formData.append("multiDegrId", JSON.stringify(newDegreeId).replace(/,/g, '@'))
+                                }
                             } else {
-                                formData.append("degreeId", -1);
+                                formData.append("degreeId", !customDegreeMultiple ? -1 : "[]");
                             }
                         } else {
                             formData.append("degreeId", -1);
@@ -2497,7 +2609,7 @@
             // 处理按周填报回显数据
             handleWeeklyReportData(array) {
                 console.log(array, 'array')
-
+                const { timeType } = this.user
                 let objectItem = {
                     auditorFirst: {id: '', name: ''},
                     auditorSec: {id: '', name: ''},
@@ -2529,16 +2641,31 @@
                                 endTime, startTime, content, groupId, groupName,
                                 projectAuditorId, projectAuditorName, projectId,
                                 projectName, state, taskId, taskName, overtimeHours,
-                                stage, taskGroups, isOvertime, workingTime, subProjectId, progress
+                                stage, taskGroups, isOvertime, workingTime, subProjectId, progress,
+                                multiDegrId, degreeId, degreeList
                             } = arrayItem.reportList[j]
 
+                            let newMultiDegrId = []
+                            let newWeiduName = degreeList.filter(s => s.id == degreeId).map(s => s.name).join(',')
+                            if(timeType.customDegreeMultiple) {
+                                newMultiDegrId = multiDegrId ? JSON.parse(multiDegrId.replace(/@/g, ',')) : [] 
+                                newMultiDegrId = newMultiDegrId.map(item => {
+                                    return parseInt(item, 10);
+                                })
+
+                                newWeiduName = degreeList.filter(s => newMultiDegrId.includes(+s.id)).map(s => s.name).join(',');
+                            }
+
                             let newObj = {
                                 ...objectItem, id,
                                 endTime, startTime, content, groupId, groupName,
                                 projectAuditorId, projectAuditorName, projectId,
                                 projectName, state, taskId, taskName, overtimeHours,
                                 stage, taskGroups, workingTime, subProjectId, progress,
-                                isOvertime: isOvertime == 1 ? true : false
+                                isOvertime: isOvertime == 1 ? true : false,
+                                degreeId: !timeType.customDegreeMultiple ? degreeId : newMultiDegrId.join(','),
+                                radioPickDegree: !timeType.customDegreeMultiple ? degreeId : newMultiDegrId,
+                                wuduList: degreeList, weiduName: newWeiduName
                             }
                             list.push(newObj)
                         }
@@ -2557,17 +2684,25 @@
                     return
                 }
                 console.log(arrItem, '<=== 处理的数据')
+                const { timeType, company } = this.user
                 let newArrItem = JSON.parse(JSON.stringify(arrItem))
                 const { domains } = newArrItem
                 for(let i in domains) {
-                    const { projectId, projectName, stage, groupId, groupName } = domains[i]
+                    const { projectId, projectName, stage, groupId, groupName, degreeId } = domains[i]
                     if(projectId) {
                         this.fZr({ projectId, projectName }, 0, true, i)
-                    }
+                        // if(timeType.customDegreeActive == 1) {
+                        //     this.dimension(projectId, 0, true, timeType.customDegreeMultiple, i)
+                        // }
+                    }   
 
                     if(groupId) {
                         this.choseTaskGroup({ id: groupId, name: groupName }, 0, true, i)
                     }
+
+                    if(company.packageProject == 1 && company.nonProjectSimple==0) {
+                        this.getTaskList(projectId, 0, true, i)
+                    }
                 }
             }
         },
@@ -2640,6 +2775,25 @@
 </script>
 
 <style lang="less" scope>
+.chooseSomeone {
+    height: 80vh;
+    display: flex;
+    flex-direction: column;
+    .chooseSomeoneFlex1 {
+        flex: 1;
+        overflow: auto;
+    }
+    .chooseSomeoneBtn {
+        width:100%;
+    }
+    .chooseSomeoneItem {
+        padding: 10px 15px;
+        overflow: hidden;
+        text-overflow:ellipsis;
+        white-space: nowrap;
+        border-bottom: 1px solid #f6f6f6;
+    }
+}
 .currentState {
     position: absolute;
     top: 15px;