Browse Source

尝试调整图表部门文字转译

Lijy 2 years ago
parent
commit
dcbe32f6a8

+ 4 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue

@@ -503,6 +503,10 @@
                                                 console.log(window, 'window')
                                                 console.log(window, 'window')
                                                 //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
                                                 //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
                                                 window.WWOpenData.bind(document.querySelector('ww-open-data'))
                                                 window.WWOpenData.bind(document.querySelector('ww-open-data'))
+                                                if (WWOpenData.initCanvas) {
+                                                    WWOpenData.initCanvas()
+                                                    console.log('我企业微信 canvas 应该执行了吧')
+                                                }
                                             },
                                             },
                                             fail: function (res) {
                                             fail: function (res) {
                                                 console.log('查看错误信息', res)
                                                 console.log('查看错误信息', res)

+ 53 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -744,8 +744,19 @@
                     if (res.code == "ok") {
                     if (res.code == "ok") {
                         this.allListData = res.data
                         this.allListData = res.data
                         this.page = 1
                         this.page = 1
-                        
-                        this.jieliu_echarts()
+                        if(this.user.userNameNeedTranslate == '1' && this.radio == this.$t('lable.department')) {
+                            console.log('进入我处理的方法')
+                            let arr = []
+                            for(var i in this.allListData.costList) {
+                                let obj = {}
+                                obj.type = this.allListData.costList[i].type
+                                obj.id = this.allListData.costList[i].departmentName
+                                arr.push(obj)
+                            }
+                            this.dealWithTranslation(arr)
+                        } else {
+                            this.jieliu_echarts()
+                        }
                     } else {
                     } else {
                         this.$message({
                         this.$message({
                             message: res.msg,
                             message: res.msg,
@@ -760,11 +771,49 @@
                     });
                     });
                 });
                 });
             },
             },
+            dealWithTranslation(items) {
+                console.log('进来的值', items)
+
+                    if (WWOpenData.initCanvas) {
+                        WWOpenData.initCanvas()
+                        console.log('成功了吧')
+                    }
+                    
+                    const myFunOne = async () => {
+                        const result = await new Promise((resolve, reject) => {
+                            console.log('我触发了')
+                            console.log(WWOpenData)
+                            console.log(WWOpenData.prefetch)
+                            if(WWOpenData.prefetch) {
+                                 WWOpenData.prefetch({ items }, (err, data) => {
+                                    console.log(items)
+                                    console.log(err)
+                                    console.log(data)
+                                    if (err) { return reject(err) }
+                                    resolve(data)
+                                })
+                            }
+                           
+                        })
+                        console.log(result, '取到的数据')
+                        // result.items.map((v)=>{
+                        //     console.log(v,'返回数据 Echar 图标')
+                        //     this.dep_name.push(v.data)
+                        // })
+                        // this.on_analysis() // ECharts 渲染函数
+                        let arrList = []
+                        for(var i in result) {
+                            this.allListData.costList[i].departmentName = result[i].data
+                        }
+                        console.log(this.allListData, '最终的数据')
+                        this.jieliu_echarts()
+                    }
+                    
+                    myFunOne()
+            },
             jieliu_echarts(){
             jieliu_echarts(){
                 var _this = this;
                 var _this = this;
                 // 更具数据的长度去加每个柱子的间距
                 // 更具数据的长度去加每个柱子的间距
-                        
-
                         var xList = []
                         var xList = []
                         var yList = []
                         var yList = []
                         var list
                         var list

+ 18 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -1011,11 +1011,25 @@
                 <el-scrollbar style="height:100%">
                 <el-scrollbar style="height:100%">
                     <el-input
                     <el-input
                     :placeholder="$t('keywordfiltering')"
                     :placeholder="$t('keywordfiltering')"
-                    v-model="filterText">
+                    v-model="filterText" v-if="user.userNameNeedTranslate != '1'">
                     </el-input>
                     </el-input>
-                <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
-                    ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
-                    highlight-current  :filter-node-method="filterNode"></el-tree>
+                    <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
+                        ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
+                        highlight-current  :filter-node-method="filterNode">
+                        <span class="custom-tree-node" slot-scope="{ node, data }">
+                            <span v-if="user.userNameNeedTranslate == '1'">
+                                <span v-if="node.data.children">
+                                    <ww-open-data type='departmentName' :openid='node.label'></ww-open-data>
+                                </span>
+                                <span v-else>
+                                    <ww-open-data type='userName' :openid='node.label'></ww-open-data>
+                                </span>
+                            </span>
+                            <span v-if="user.userNameNeedTranslate != '1'">
+                                {{ node.label }}
+                            </span>
+                        </span>
+                    </el-tree>
                 </el-scrollbar>
                 </el-scrollbar>
             </div>
             </div>
             <div>{{ $t('btn.choose') }}&nbsp;{{chosenMembCount}}&nbsp;{{ $t('other.people') }}</div>
             <div>{{ $t('btn.choose') }}&nbsp;{{chosenMembCount}}&nbsp;{{ $t('other.people') }}</div>