Lijy 2 years ago
parent
commit
d86c1d7a2f

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/components/cascader.vue

@@ -2,7 +2,7 @@
   <div tabindex="0" @blur="selectClihide()" style="display: inline-block;position: relative;">  
     <div :class="disabled ? 'disabledTrue' : 'disabledFalse'" @mouseenter="moveIonDiv" @mouseleave="outIonDiv">
         <div :style="`width:${selectWidth}px;height:${selectHeight}px`" :class="classDiv ? 'select selectDiv' : 'select'" @click.stop="selectCli" :ref="disabled ? '' : 'selectDiv'">
-            <div :style="'line-height: '+selectHeight+'px;font-size: '+selectFontSize+'px;'" :class="(selectName == $t('defaultText.pleaseChoose') || selectName == $t('qing-xuan-ze-bu-men')) ? 'selecttex selecttexXuan' : 'selecttex'">
+            <div :style="'line-height: '+selectHeight+'px;font-size: '+selectFontSize+'px;'" :class="(selectName == $t('defaultText.pleaseChoose') || selectName == $t('qing-xuan-ze-bu-men') || selectName == $t('other.allDepartments')) ? 'selecttex selecttexXuan' : 'selecttex'">
                 <ww-open-data type='departmentName' :openid='selectName'></ww-open-data>
                 <!-- {{selectName}} -->
             </div>

+ 6 - 3
fhKeeper/formulahousekeeper/timesheet/src/components/select.vue

@@ -274,7 +274,8 @@ export default {
                         distinction: this.distinction,
                         index: this.index, // 选中的索引
                         other: this.other,
-                        arrUserList: this.multiSelectList
+                        arrUserList: this.multiSelectList,
+                        name: this.selectName
                     }
                     this.$emit("selectCal", obj)
                 }
@@ -298,7 +299,8 @@ export default {
                         id: nameId,
                         distinction: this.distinction,
                         index: this.index, // 选中的索引
-                        other: this.other
+                        other: this.other,
+                        name: this.selectName
                     }
                     this.$emit("selectCal", obj)
                 }
@@ -379,7 +381,8 @@ export default {
                 distinction: this.distinction,
                 index: this.index, // 选中的索引
                 other: this.other,
-                arrUserList: this.multiSelectList
+                arrUserList: this.multiSelectList,
+                name: this.selectName
             }
             this.$emit("selectCal", obj)
         }

+ 44 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -42,12 +42,16 @@
                 <el-option v-for="item in customList" :key="item.id" :label="item.name" :value="item.name"></el-option>
             </el-select> -->
 
-            <el-select v-model="personnelValue" filterable clearable :placeholder="$t('pleaseselectpersonnel')"  size="small" style="margin-top: 10px;width: 350px" v-if="radio == $t('ren-yuan')" @change="personnel()">
+            <el-select v-model="personnelValue" filterable clearable :placeholder="$t('pleaseselectpersonnel')"  size="small" style="margin-top: 10px;width: 350px" v-if="radio == $t('ren-yuan') && user.userNameNeedTranslate != '1'" @change="personnel()">
                 <el-option v-for="item in hasReportUserList" :key="item.id" :label="item.name" :value="item.name">
                     <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>
+            <span style="text-align: left">
+            <selectCat v-if="radio == $t('ren-yuan') && user.userNameNeedTranslate == '1'" :size="'small'" :widthStr="'350'" :distinction="'2'" :subject="hasReportUserList" :clearable="true" @selectCal="selectCal"></selectCat>
+            </span>
+
         </el-col>
         <el-col :span="4">
             <el-button @click="exportProjectData" v-if="theCustomListFlg"  size="small">{{ $t('reporderived') }}</el-button>
@@ -88,12 +92,15 @@
                             <span style="float: right;font-size: 13px;">{{ item.projectName }}</span>
                         </el-option>
                     </el-select>
+
                 </el-form-item>
 
                 <el-form-item :label="$t('departmentchoice')" v-if="radio == $t('other.project')">
-                    <el-cascader v-model="exportParam.deptId" :options="departmentList" :placeholder="$t('defaultText.pleaseChoose')"
+                    <el-cascader v-if="user.userNameNeedTranslate != 1" v-model="exportParam.deptId" :options="departmentList" :placeholder="$t('defaultText.pleaseChoose')"
                         :props="{ checkStrictly: true, expandTrigger: 'hover' }" clearable filterable style="width:350px;"
                     ></el-cascader>
+
+                    <vueCascader :size="'medium'" :widthStr="'350'" :clearable="true" :subject="departmentList" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
                 </el-form-item>
 
                 <el-form-item prop="projectCategoryId" :label="$t('projectclassification')" v-if="radio == $t('projectclassification')">
@@ -103,9 +110,11 @@
                     </el-select>
                 </el-form-item>
                 <el-form-item prop="userIds" :label="$t('screening.selectPeople')" v-if="radio == $t('ren-yuan')">
-                    <el-select v-model="exportParam.userIds" :placeholder="$t('lable.allStaff')" multiple="true"  clearable style="width:350px;" filterable="true">
+                    <el-select v-if="user.userNameNeedTranslate != '1'" v-model="exportParam.userIds" :placeholder="$t('lable.allStaff')" multiple="true"  clearable style="width:350px;" filterable="true">
                         <el-option v-for="item in hasReportUserList"  :key="item.id" :label="item.name" :value="item.id"></el-option>
                     </el-select>
+
+                    <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'350'" :subject="hasReportUserList" :clearable="true" :multiSelect="true" @selectCal="selectCal"></selectCat>
                 </el-form-item>
                 <el-form-item prop="projectId" :label="user.timeType.fixMonthcost==0?$t('time.dateRange'):$t('Selectmonth')">
                     <el-date-picker v-show="user.timeType.fixMonthcost==0"
@@ -161,8 +170,17 @@
 </template>
 
 <script>
+// 引入自定义组件
+    import selectCat from "@/components/select.vue"
+    //引入自定义级联组件
+    import vueCascader from "@/components/cascader.vue"
+
     import util from "../../common/js/util";
     export default {
+        components: {
+            selectCat,
+            vueCascader
+        },
         data() {
             return {
                 allListData: [],
@@ -1210,6 +1228,29 @@
                 }
                 return arr;
             },
+            // 自定义事件
+            selectCal(obj) {
+                console.log(obj)
+                if(obj.distinction == 1) {
+                    let arr = []
+                    for(var i in obj.arrUserList) {
+                        arr.push(obj.arrUserList[i].id) 
+                    }
+                    this.exportParam.userIds = arr
+                } else if(obj.distinction == 2) {
+                    console.log(obj)
+                    this.personnelValue = obj.name
+                    this.personnel()
+                }
+            },
+            vueCasader(obj) {
+                if(obj.distinction == 1) {
+                    console.log(obj, '数据')
+                    let arr = []
+                    arr.push(obj.id)
+                    this.exportParam.deptId = arr
+                }
+            }
         },
         created() {
             this.myChart = null

+ 180 - 129
fhKeeper/formulahousekeeper/timesheet/src/views/project/custom_data.vue

@@ -248,137 +248,22 @@
                     var _this = this;
                     this.hasReportUserList = [];
                     if (res.code == "ok") {
-                        //工时总成本
-                        this.hasReportUserList = this.radio == '人员' ? res.data.userList : res.data.department;
-                        var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
-                        
-                        var totalHours = 0.0;
-                        if (list.length > 0) {
-                            var num = list.length==0?0:list[0].project.length;
-                            for(var i in list) {
-                                xList.push(list[i].name);
-                                var pro = list[i].project;
-                                for(var j in pro) {
-                                    if(array.indexOf(pro[j].project) == -1) {
-                                        array.push(pro[j].project)
-                                    }
-                                }
-                            }
-
-                            for(var i in array) {
-                                yList.push(array[i]);
-                                var dataList = [];
-                                for(var j in list) {
-                                    var project = list[j].project , num = 0;
-                                    if(project.length != 0) {
-                                        for(var k in project) {
-                                            if(project[k].project == array[i]) {
-                                                dataList.push({
-                                                    "value": project[k].cost,
-                                                    "cost": project[k].cost
-                                                })
-                                                totalHours += parseFloat(project[k].cost);
-                                            } else {
-                                                num++;
-                                            }
-                                            if(k == project.length-1 && num != project.length-1) {
-                                                dataList.push({
-                                                    "value": 0,
-                                                    "cost": 0
-                                                })
-                                            }
-                                        }
-                                    } else {
-                                        dataList.push({
-                                            "value": 0,
-                                            "cost": 0,
-                                        })
-                                    }
+                        if(this.user.userNameNeedTranslate == 1 && (this.radio == '人员' || this.radio == '部门')) {
+                            let arr = []
+                            for(var i in res.data.list) {
+                                let obj = {}
+                                if(this.radio == '人员') {
+                                    obj.type = 'userName'
+                                } else {
+                                    obj.type = 'departmentName'
                                 }
-                                series.push({
-                                    name: array[i],
-                                    type: 'bar',
-                                    stack:'1',
-                                    barMaxWidth: 30,
-                                    data: dataList,
-                                })
+                                obj.id = res.data.list[i].name
+                                arr.push(obj)
                             }
-                        } 
-                            
-                            
-                            var myChart = echarts.init(document.getElementById("container"));
-                            totalHours = totalHours.toFixed(1);
-                            _this.myChart = myChart;
-                            var option = {
-                                //总成本
-                                title: {
-                                    text: _this.user.timeType.customDataName + '总计' + totalHours,
-                                    left:'left',
-                                },
-                                
-                                // 工具箱
-                                legend: {
-                                    x: 80,
-                                    y: 10,
-                                    data: yList,
-                                    show: true,
-                               top:"5%",//与上方的距离 可百分比% 可像素px
-                                },
-                                grid : {
-                                    top : 80,    //距离容器上边界40像素
-                                    bottom: 35   //距离容器下边界30像素
-                                },
-                                toolbox: {
-                                    show: true,
-                                    feature:{
-                                        saveAsImage:{
-                                            show:true
-                                        },
-                                        restore:{
-                                            show:true
-                                        },
-                                        // dataView:{
-                                        //     show:true
-                                        // },
-                                        // dataZoom:{
-                                        //     show:true
-                                        // },
-                                        magicType:{
-                                            type:['line','bar']
-                                        }
-                                    }
-                                },
-                                tooltip:{
-                                    trigger:'axis',
-                                    formatter: function (params,ticket,callback) {
-                                        var totalTime = 0;
-                                        var res = "";
-                                        for(var i in params) {
-                                            if (params[i].data.value > 0) {
-                                                res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>项目名称:" + params[i].seriesName 
-                                                    + "</font><br/>"+_this.user.timeType.customDataName+" : " + params[i].data.cost+"</div>";
-                                                totalTime += Number(params[i].data.cost);
-                                            }
-                                        }
-                                        res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1);
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value}'
-                                    }
-                                }],
-                                series: series,
-                            };
-                            myChart.setOption(option,{notMerge:true});
+                            this.dealWithTranslationPlone(arr, res)
+                        } else {
+                            this.choli(res)
+                        }
                     } else {
                         this.$message({
                         message: res.msg,
@@ -394,6 +279,172 @@
                     });
                 });
             },
+            dealWithTranslationPlone(items, dataList) {
+                console.log(items, '处理的值')
+                    if (WWOpenData.initCanvas) {
+                        WWOpenData.initCanvas()
+                    }
+                    const myFunOne = async () => {
+                        const result = await new Promise((resolve, reject) => {
+                            if(WWOpenData.prefetch) {
+                                 WWOpenData.prefetch({ items }, (err, data) => {
+                                    if (err) { return reject(err) }
+                                    resolve(data)
+                                })
+                            }
+                        })
+                        for(var i in dataList.data.list) {
+                            dataList.data.list[i].name = result.items[i].data
+                        }
+                        this.choli(dataList)
+                    }
+                    myFunOne()
+            },
+            choli(data) {
+                console.log('过来的值', data)
+                var _this = this;
+                //工时总成本
+                    // this.hasReportUserList = this.radio == '人员' ? res.data.userList : res.data.department;
+                    // var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
+
+                    this.hasReportUserList = this.radio == '人员' ? data.data.userList : data.data.department;
+                    var xList = [] , yList = [] , list = data.data.list, array = [] , series = [];
+
+                    var totalHours = 0.0;
+                    if (list.length > 0) {
+                        var num = list.length==0?0:list[0].project.length;
+                        for(var i in list) {
+                            xList.push(list[i].name);
+                            var pro = list[i].project;
+                            for(var j in pro) {
+                                if(array.indexOf(pro[j].project) == -1) {
+                                    array.push(pro[j].project)
+                                }
+                            }
+                        }
+                        for(var i in array) {
+                            yList.push(array[i]);
+                            var dataList = [];
+                            for(var j in list) {
+                                var project = list[j].project , num = 0;
+                                if(project.length != 0) {
+                                    for(var k in project) {
+                                        if(project[k].project == array[i]) {
+                                            dataList.push({
+                                                "value": project[k].cost,
+                                                "cost": project[k].cost
+                                            })
+                                            totalHours += parseFloat(project[k].cost);
+                                        } else {
+                                            num++;
+                                        }
+                                        if(k == project.length-1 && num != project.length-1) {
+                                            dataList.push({
+                                                "value": 0,
+                                                "cost": 0
+                                            })
+                                        }
+                                    }
+                                } else {
+                                    dataList.push({
+                                        "value": 0,
+                                        "cost": 0,
+                                    })
+                                }
+                            }
+                            series.push({
+                                name: array[i],
+                                type: 'bar',
+                                stack:'1',
+                                barMaxWidth: 30,
+                                data: dataList,
+                            })
+                        }
+                    } 
+                        
+                        
+                    var myChart = echarts.init(document.getElementById("container"));
+                    totalHours = totalHours.toFixed(1);
+                    _this.myChart = myChart;
+                    var option = {
+                        //总成本
+                        title: {
+                            text: _this.user.timeType.customDataName + '总计' + totalHours,
+                            left:'left',
+                        },
+                        
+                        // 工具箱
+                        legend: {
+                            x: 80,
+                            y: 10,
+                            data: yList,
+                            show: true,
+                          top:"5%",//与上方的距离 可百分比% 可像素px
+                        },
+                        grid : {
+                            top : 80,    //距离容器上边界40像素
+                            bottom: 35   //距离容器下边界30像素
+                        },
+                        toolbox: {
+                            show: true,
+                            feature:{
+                                saveAsImage:{
+                                    show:true
+                                },
+                                restore:{
+                                    show:true
+                                },
+                                // dataView:{
+                                //     show:true
+                                // },
+                                // dataZoom:{
+                                //     show:true
+                                // },
+                                magicType:{
+                                    type:['line','bar']
+                                }
+                            }
+                        },
+                        tooltip:{
+                            trigger:'axis',
+                            formatter: function (params,ticket,callback) {
+                                var totalTime = 0;
+                                var res = "";
+                                for(var i in params) {
+                                    if (params[i].data.value > 0) {
+                                        res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>项目名称:" + params[i].seriesName 
+                                            + "</font><br/>"+_this.user.timeType.customDataName+" : " + params[i].data.cost+"</div>";
+                                        totalTime += Number(params[i].data.cost);
+                                    }
+                                }
+                                if(_this.user.userNameNeedTranslate != 1) {
+                                    res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1);
+                                } else {
+                                    if(_this.radio == '人员' || _this.radio == '部门') {
+                                        res = res +'<br/>'+ '' + '<br/>总计: ' + totalTime.toFixed(1);
+                                    } else {
+                                        res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1);
+                                    }
+                                }
+                                return res;
+                            }
+                        },
+                        xAxis: {
+                            data: xList,
+                            axisLabel: {
+                                interval:0,rotate:20
+                            }
+                        },
+                        yAxis: [{
+                            type : 'value',
+                            axisLabel: {
+                                formatter:'{value}'
+                            }
+                        }],
+                        series: series,
+                    };
+                    myChart.setOption(option,{notMerge:true});
+            },
             yanjiu() {
                 // console.log('触发')
             },

+ 57 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -319,8 +319,19 @@
         <el-dialog :title="editTitle[isBatch]" :visible.sync="dialogVisible" width="60%" style="height:95%" :close-on-click-modal="false" @closed="guanbi()" custom-class="editReportDialog" ref="editReportDialog">
             <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="120px">
                 <el-form-item :label="$t('screening.selectPeople')" v-if="isSubstitude">
-                    <el-input @focus="showChooseMembTree" v-model="workForm.userNames"
+                    <el-input v-if="user.userNameNeedTranslate != 1" @focus="showChooseMembTree" v-model="workForm.userNames"
                     :placeholder="$t('defaultText.pleaseSelectAsubstitute')" ></el-input>
+                    <div class="daitianrbao"  @click="showChooseMembTree" v-if="user.userNameNeedTranslate == 1">
+                        <span class="spnn" v-if="workForm.userNames">
+                            <span v-for="(item, index) in workForm.userNames" :key="index">
+                                <span><ww-open-data type='userName' :openid='item'></ww-open-data></span>
+                                <span v-if="index < workForm.userNames.length - 1">,</span>
+                            </span>
+                        </span>
+                        <span class="spnn hover" v-else>
+                            {{$t('defaultText.pleaseSelectAsubstitute')}}
+                        </span>
+                    </div>
                 </el-form-item>
                 <el-form-item :label="$t('screening.workingDate')" prop="createDate">
                     <el-date-picker v-model="workForm.createDate" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
@@ -955,7 +966,11 @@
                     </el-select>
                 </el-form-item>
                 <el-form-item prop="departmentId" :label="$t('other.selectdepartment')" v-if="permissions.reportsCompany">
-                    <el-cascader v-model="exportParam.departmentId" :placeholder="$t('other.allDepartments')" :options="departmentList" :props="{ checkStrictly: true, value: 'id' }" clearable style="width: 350px;"></el-cascader>
+
+                    <el-cascader v-if="user.userNameNeedTranslate != 1" v-model="exportParam.departmentId" :placeholder="$t('other.allDepartments')" :options="departmentList" :props="{ checkStrictly: true, value: 'id' }" clearable style="width: 350px;"></el-cascader>
+
+                    <vueCascader :size="'medium'" :widthStr="'350'" :clearable="true" :subject="departmentList" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1" :selectNameChuan="$t('other.allDepartments')"></vueCascader>
+
                 </el-form-item>
                 <el-form-item prop="projectId" :label="$t('time.dateRange')">
                     <el-date-picker
@@ -1544,12 +1559,16 @@
 
     // 自定义select组件
     import selectCat from "@/components/select.vue"
+
+     // 引入自定义级联组件
+    import vueCascader from "@/components/cascader.vue"
     
     let _that = this
     export default {
         mixins: [dragMixin],
         components: {
-            selectCat
+            selectCat,
+            vueCascader
         },
         data() {
             return {
@@ -2831,6 +2850,12 @@
                 if (this.workForm.userNames.length > 0) {
                     this.workForm.userNames = this.workForm.userNames.substring(0, this.workForm.userNames.length-1);
                 }
+
+                if(this.user.userNameNeedTranslate == 1) {
+                    if(this.workForm.userNames) {
+                        this.workForm.userNames = this.workForm.userNames.split(',')
+                    }
+                }
                 
             },
 
@@ -5940,6 +5965,14 @@
                 // obj.id 是 选中人员的id, obj.idx 是 当前的索引
                 this.workForm.domains[obj.idx].projectAuditorId = obj.id
             },
+            vueCasader(obj) {
+                console.log(obj, '看看值')
+                if(obj.distinction == 1) {
+                    let arr = []
+                    arr.push(obj.item.id)
+                    this.exportParam.departmentId = arr
+                }
+            },
             //分页
             handleCurrentChange(val) {
                 this.toViewForm.pageIndex = val;
@@ -6290,4 +6323,25 @@
         font-size: 14px;
         padding-right: 8px;
     }
+    .daitianrbao {
+        width: 100%;
+        box-sizing: border-box;
+        height: 40px;
+        border-radius: 4px;
+        border: 1px solid #DCDFE6;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        display: flex;
+        // align-items: center;
+    }
+    .daitianrbao .spnn {
+        display: inline-block;
+        box-sizing: border-box;
+        padding: 0 15px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
+    .daitianrbao .hover {
+        color: #DCDFE6 !important;
+    }
 </style>