Browse Source

首页翻译

Shan9312 1 year ago
parent
commit
8a106657a4
5 changed files with 131 additions and 57 deletions
  1. 1 1
      src/i18n.js
  2. 33 1
      src/lang/cn.js
  3. 34 1
      src/lang/en.js
  4. 1 1
      src/layout/components/Navbar.vue
  5. 62 53
      src/views/dashboard/pasture/index.vue

+ 1 - 1
src/i18n.js

@@ -11,7 +11,7 @@ Vue.use(VueI18n)
 
 const i18n = new VueI18n({
   locale: 'EN', // set locale
-  fallbackLocale: 'EN', // 默认语言设置,当其他语言没有的情况下,使用en作为默认语言
+  fallbackLocale: 'CN', // 默认语言设置,当其他语言没有的情况下,使用en作为默认语言
   messages: {
     EN: {
       ...enLocale,

+ 33 - 1
src/lang/cn.js

@@ -83,6 +83,38 @@ export default {
     spreadAc:'撒料准确率',
     yestday30S:'近30天的撒料准确率',
     SpreadingCR:'撒料正确率',
+    yestday30SD:'近30天撒料偏差',
+    spreadSD:'撒料偏差',
+    mtime:'分钟',
+    todayTps:'今日计划统计',
+    StatisType:"统计类型",
+    typeAll:'全部',
+    Fixed:'固定式',
+    struck:'抛料车',
+    bout:"次",
+    cTrip:"完成车次",
+    pTrip:"计划车次",
+    cWeight:'完成重量',
+    pWeight:"计划重量",
+    costSts:'成本统计',
+    Export:'导出',
+    sTable:'切换表格',
+    tripCp:'车次完成率',
+    tripCpFont:'20',
+    WeightP:'重量完成率',
+    taskT:"任务进度",
+    table:{
+      date:"日期",
+      signOx:'单头牛饲料成本',
+      feedCow:'公斤奶饲料成本(元)'
+    },
+    feedCow:'公斤奶饲料成本',
+    tHeader:['日期', '单头牛饲料成本', '公斤奶饲料成本(元)'],
+    CostStatistics:'成本统计',
+    feedCows:'公斤奶\n饲料成本(元)',
+    signOxs:'单头牛\n饲料成本(元)',
+
+
 
 
   },
@@ -218,7 +250,7 @@ export default {
       值班记录:'值班记录',
       栏舍剩料记录:"栏舍剩料记录",
      //
-     库存管理:'库存管理t',
+     库存管理:'库存管理',
      入库管理:'入库管理',
      系统用量:'系统用量',
      人工用量:'人工用量',

+ 34 - 1
src/lang/en.js

@@ -85,7 +85,40 @@ export default {
     spreadAc:'Spreading Accuracy',
     yestday30S:'Blending Accuracy of Mixed Feed in the Last 30 Days',
     SpreadingCR:'Spreading Correctness Rate',
-    
+    yestday30SD:'Spreading Deviation Over the Last 30 Days',
+    spreadSD:'Spreading Deviation',
+    mtime:'min',
+    todayTps:"Today's Plan Statistics",
+    StatisType:"Statistical Type",
+    typeAll:'All',
+    Fixed:'Fixed',
+    struck:'Spreader Truck',
+    bout:'bout',
+    cTrip:'Complete the trip',
+    pTrip:"Planned trip",
+    cWeight:"Completed Weight",
+    pWeight:"Planned Weight",
+    costSts:'Cost Statistics',
+    Export:"Export",
+    sTable:'Switch Table',
+    tripCp:'Trip completion rate',
+    tripCpFont:'14',
+    WeightP:'Weight completion rate',
+    taskT:"task progress",
+    table:{
+      date:"Date",
+      signOx:'Feed Cost per Cow',
+      feedCow:'Feed Cost per Kilogram of Milk'
+    },
+    feedCow:'Feed Cost per Kilogram of Milk',
+    tHeader:['Date', 'Feed Cost per Cow', 'Feed Cost per Kilogram of Milk'],
+    CostStatistics:'Cost Statistics',
+    feedCows:'ilogram of milk \n cost of feed per',
+    signOxs:'per Cow \n Feed Cost',
+
+
+
+
   },
   chart: {
     myChart: 'My Chart',

+ 1 - 1
src/layout/components/Navbar.vue

@@ -170,7 +170,7 @@ export default {
     }
   }
   h3 {
-    margin-top: 13px;
+    margin-top: 11px;
   }
   .breadcrumb-container {
     float: left;

+ 62 - 53
src/views/dashboard/pasture/index.vue

@@ -19,14 +19,14 @@
                 </div>
                 <span class="content">{{$t('dashboard.pureBlend')}}</span>
               </div>
-              <div class="row1-c-l-c">
+              <div class="row1-c-l-c" >
                 <span>
                   <b>{{ row1.list.yesRateHL }}</b>
                   <br>{{$t('dashboard.yestday')}}
                 </span>
               </div>
-              <div class="row1-c-l-b">
-                <div><span>{{$t('dashboard.yestday30')}}</span><b>{{ row1.list.monRateHL }}</b></div>
+              <div class="row1-c-l-b" :lang="$i18n.locale">
+                <div><span>{{$t('dashboard.yestday30')}}:</span><b>{{ row1.list.monRateHL }}</b></div>
               </div>
             </div>
             <div class="row1-c-r">
@@ -42,7 +42,7 @@
                   <br>{{$t('dashboard.yestday')}}
                 </span>
               </div>
-              <div class="row1-c-l-b">
+              <div class="row1-c-l-b" :lang="$i18n.locale">
                 <div><span>{{$t('dashboard.yestday30S')}}:</span><b>{{ row1.list.monRateSL }}</b></div>
               </div>
             </div>
@@ -61,8 +61,8 @@
                   <br>{{$t('dashboard.yestday')}}
                 </span>
               </div>
-              <div class="row1-c-l-b">
-                <div><span>近30天撒料正确率:</span><b>{{ row1.list.monRateSLR }}</b></div>
+              <div class="row1-c-l-b" :lang="$i18n.locale">
+                <div><span>{{$t('dashboard.yestday30S')}}:</span><b>{{ row1.list.monRateSLR }}</b></div>
               </div>
             </div>
             <div class="row1-b-r">
@@ -70,7 +70,7 @@
                 <div class="img-title">
                   <img src="../../../assets/images/index/l2.png">
                 </div>
-                <span class="content">撒料偏差</span>
+                <span class="content">{{$t('dashboard.spreadSD')}}</span>
               </div>
               <div class="row1-c-l-c">
                 <span>
@@ -78,8 +78,8 @@
                   <br>{{$t('dashboard.yestday')}}
                 </span>
               </div>
-              <div class="row1-c-l-b">
-                <div><span>近30天撒料偏差:</span><b>{{ row1.list.montime }}</b>分钟</div>
+              <div class="row1-c-l-b" :lang="$i18n.locale">
+                <div><span>{{ $t('dashboard.yestday30SD') }}:</span><b>{{ row1.list.montime }} </b>{{ $t('dashboard.mtime') }}</div>
               </div>
             </div>
           </div>
@@ -87,30 +87,30 @@
         <div class="row2">
           <div class="title">
             <div class="img-title" />
-            <span class="content">今日计划统计</span>
+            <span class="content">{{$t('dashboard.todayTps')}}</span>
           </div>
-          <b style="margin-left: 20px;">统计类型:</b>
+          <b style="margin-left: 20px;">{{$t('dashboard.StatisType')}}:</b>
           <el-select v-model="row2.value" size="mini" placeholder="请选择" style="width: 100px;" @change="changeType">
-            <el-option v-for="item in row2.typeList" :key="item.id" :label="item.name" :value="item.id" />
+            <el-option v-for="item in row2.typeList" :key="item.id" :label="$t('dashboard.'+item.name)" :value="item.id" />
           </el-select>
           <div class="todayPlan">
             <div>
               <div id="row2chartLine1" style="height: 185px;" v-loading="row1.listLoading" />
-              <div class="bottom">
+              <div class="bottom" :lang="$i18n.locale">
                 <div class="bottom-l">
                   <div class="bottom-l-t">
-                    <b>{{ row2.chart1.chartLine_data.data1 }}</b>
+                    <b>{{ row2.chart1.chartLine_data.data1 }}</b>{{$t('dashboard.bout')}}
                   </div>
                   <div class="bottom-l-b">
-                    完成车次
+                    {{$t('dashboard.cTrip')}}
                   </div>
                 </div>
                 <div class="bottom-r">
                   <div class="bottom-r-t">
-                    <b>{{ row2.chart1.chartLine_data.data2 }}</b>
+                    <b>{{ row2.chart1.chartLine_data.data2 }}</b>{{$t('dashboard.bout')}}
                   </div>
                   <div class="bottom-r-b">
-                    计划车次
+                    {{$t('dashboard.pTrip')}}
                   </div>
                 </div>
               </div>
@@ -123,7 +123,7 @@
                     <b>{{ row2.chart2.chartLine_data.data1 }}</b>kg
                   </div>
                   <div class="bottom-l-b">
-                    完成重量
+                    {{$t('dashboard.cWeight')}}
                   </div>
                 </div>
                 <div class="bottom-r">
@@ -131,7 +131,7 @@
                     <b>{{ row2.chart2.chartLine_data.data2 }}</b>kg
                   </div>
                   <div class="bottom-r-b">
-                    计划重量
+                    {{$t('dashboard.pWeight')}}
                   </div>
                 </div>
               </div>
@@ -142,17 +142,17 @@
         <div class="row3" style="position: relative;">
           <div class="title">
             <div class="img-title" />
-            <span class="content">成本统计</span>
+            <span class="content"> {{$t('dashboard.costSts')}}</span>
           </div>
           <div v-if="row4.chart1.isChart" class="button">
-            <div class="exportTable" @click="handleExport('row4chartLine1')">导出</div>
-            <div class="exportTable" @click="handleTable('row4chartLine1')">切换表格</div>
+            <div class="exportTable" @click="handleExport('row4chartLine1')">{{$t('dashboard.Export')}}</div>
+            <div class="exportTable" @click="handleTable('row4chartLine1')">{{$t('dashboard.sTable')}}</div>
           </div>
           <div v-if="row4.chart1.isChart" id="row4chartLine1" v-loading="row4.chart1.listLoading" style="background: #fff;height:310px;" />
           <div v-if="row4.chart1.isTable" class="table" style="position: absolute;width: 100%;">
             <div class="button">
-              <div class="exportTable" @click="handleExport('row4chartLine1')">导出</div>
-              <div class="exportTable" @click="handleChart('row4chartLine1')">切换图表</div>
+              <div class="exportTable" @click="handleExport('row4chartLine1')">{{$t('dashboard.Export')}}</div>
+              <div class="exportTable" @click="handleChart('row4chartLine1')">{{$t('dashboard.sTable')}}</div>
             </div>
             <el-table
               :key="row4.chart1.table.tableKey"
@@ -168,9 +168,9 @@
               :cell-style="cellStyle"
               class="elTable table-fixed"
             >
-              <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
-              <el-table-column label="单头牛饲料成本" sortable min-width="110px" align="center" prop="field2" />
-              <el-table-column label="公斤奶饲料成本(元)" sortable min-width="120px" align="center" prop="field1" />
+              <el-table-column :label="$t('dashboard.table.date')" sortable min-width="110px" align="center" prop="日期" />
+              <el-table-column :label="$t('dashboard.table.signOx')" sortable min-width="110px" align="center" prop="field2" />
+              <el-table-column label="$t('dashboard.table.feedCow')" sortable min-width="120px" align="center" prop="field1" />
             </el-table>
           </div>
         </div>
@@ -265,14 +265,14 @@
               <span class="content">计划统计</span>
             </div>
             <div v-if="row3.chart1.isChart" class="button">
-              <div class="exportTable" @click="handleExport('row3chartLine1')">导出</div>
-              <div class="exportTable" @click="handleTable('row3chartLine1')">切换表格</div>
+              <div class="exportTable" @click="handleExport('row3chartLine1')">{{$t('dashboard.Export')}}</div>
+              <div class="exportTable" @click="handleTable('row3chartLine1')">{{$t('dashboard.sTable')}}</div>
             </div>
             <div v-if="row3.chart1.isChart" id="row3chartLine1" v-loading="row3.chart1.listLoading" style="background: #fff;height:310px;" />
             <div v-if="row3.chart1.isTable" class="table" style="position: absolute;width: 100%;">
               <div class="button">
-                <div class="exportTable" @click="handleExport('row3chartLine1')">导出</div>
-                <div class="exportTable" @click="handleChart('row3chartLine1')">切换图表</div>
+                <div class="exportTable" @click="handleExport('row3chartLine1')">{{$t('dashboard.Export')}}</div>
+                <div class="exportTable" @click="handleChart('row3chartLine1')">{{$t('dashboard.sTable')}}</div>
               </div>
               <el-table
                 :key="row3.chart1.table.tableKey"
@@ -307,14 +307,14 @@
               <span class="content">混料实际重量统计</span>
             </div>
             <div v-if="row4.chart2.isChart" class="button">
-              <div class="exportTable" @click="handleExport('row4chartLine2')">导出</div>
-              <div class="exportTable" @click="handleTable('row4chartLine2')">切换表格</div>
+              <div class="exportTable" @click="handleExport('row4chartLine2')">{{$t('dashboard.Export')}}</div>
+              <div class="exportTable" @click="handleTable('row4chartLine2')">{{$t('dashboard.sTable')}}</div>
             </div>
             <div v-if="row4.chart2.isChart" id="row4chartLine2" v-loading="row4.chart2.listLoading" style="background: #fff;height:310px;" />
             <div v-if="row4.chart2.isTable" class="table" style="position: absolute;width:100%;">
               <div class="button">
-                <div class="exportTable" @click="handleExport('row4chartLine2')">导出</div>
-                <div class="exportTable" @click="handleChart('row4chartLine2')">切换图表</div>
+                <div class="exportTable" @click="handleExport('row4chartLine2')">{{$t('dashboard.Export')}}</div>
+                <div class="exportTable" @click="handleChart('row4chartLine2')">{{$t('dashboard.sTable')}}</div>
               </div>
               <el-table
                 :key="row4.chart2.table.tableKey"
@@ -348,14 +348,14 @@
               <span class="content">泌乳牛干物质采食量</span>
             </div>
             <div v-if="row3.chart2.isChart" class="button">
-              <div class="exportTable" @click="handleExport('row3chartLine2')">导出</div>
-              <div class="exportTable" @click="handleTable('row3chartLine2')">切换表格</div>
+              <div class="exportTable" @click="handleExport('row3chartLine2')">{{$t('dashboard.Export')}}</div>
+              <div class="exportTable" @click="handleTable('row3chartLine2')">{{$t('dashboard.sTable')}}</div>
             </div>
             <div v-if="row3.chart2.isChart" id="row3chartLine2" v-loading="row3.chart2.listLoading" style="background: #fff;height:310px;" />
             <div v-if="row3.chart2.isTable" class="table" style="position: absolute;width: 100%;">
               <div class="button">
-                <div class="exportTable" @click="handleExport('row3chartLine2')">导出</div>
-                <div class="exportTable" @click="handleChart('row3chartLine2')">切换图表</div>
+                <div class="exportTable" @click="handleExport('row3chartLine2')">{{$t('dashboard.Export')}}</div>
+                <div class="exportTable" @click="handleChart('row3chartLine2')">{{$t('dashboard.sTable')}}</div>
               </div>
               <el-table
                 :key="row3.chart2.table.tableKey"
@@ -452,7 +452,7 @@ export default {
       },
       row2: {
         value:0,
-        typeList:[{id:0,name:'全部'},{id:1,name:'固定式'},{id:2,name:'抛料车'}],
+        typeList:[{id:0,name:'typeAll'},{id:1,name:'Fixed'},{id:2,name:'struck'}],
         chart1: {
           chartLine: null,
           chartLine_data: {}
@@ -765,10 +765,10 @@ export default {
         tooltip: { show: false, trigger: 'item', formatter: '{a} <br/>{b}: {c} ({d}%)' },
         color: ['#1bbe89', '#e4e7ec'],
         series: [{
-          name: '任务进度', type: 'pie', radius: ['80%', '70%'], avoidLabelOverlap: false, hoverAnimation: false, labelLine: { normal: { show: false }},
+          name: this.$t('dashboard.taskT'), type: 'pie', radius: ['80%', '70%'], avoidLabelOverlap: false, hoverAnimation: false, labelLine: { normal: { show: false }},
           data: [{
-            value: chartLine_data.data1, name: '车次完成率', selected: false, // 单个扇区的标签配置
-            label: { normal: { show: true, position: 'center', fontSize: 20, formatter: '{b}\n{d}%' }}
+            value: chartLine_data.data1, name: this.$t('dashboard.tripCp'), selected: false, // 单个扇区的标签配置
+            label: { normal: { show: true, position: 'center', fontSize: this.$t('dashboard.tripCpFont'), formatter: '{b}\n{d}%' }}
           }, {
             value: chartLine_data.data2 - chartLine_data.data1,
             label: { normal: { show: false }
@@ -808,10 +808,10 @@ export default {
         title: { show: true, x: 'center', textStyle: { fontSize: '15', color: 'green', fontWeight: 'bold' }},
         tooltip: { show: false, trigger: 'item', formatter: '{a} <br/>{b}: {c} ({d}%)' },
         series: [{
-          name: '任务进度', type: 'pie', radius: ['80%', '70%'], avoidLabelOverlap: false, hoverAnimation: false,
+          name: this.$t('dashboard.taskT'), type: 'pie', radius: ['80%', '70%'], avoidLabelOverlap: false, hoverAnimation: false,
           labelLine: { normal: { show: false }},
           data: [{
-            value: chartLine_data.data1, name: '重量完成率', selected: false, label: { normal: { show: true, position: 'center', fontSize: 20, formatter: '{b}\n{d}%' }}
+            value: chartLine_data.data1, name: this.$t('dashboard.tripCp'), selected: false, label: { normal: { show: true, position: 'center', fontSize: this.$t('dashboard.tripCpFont'), formatter: '{b}\n{d}%' }}
           }, {
             value: chartLine_data.data2 - chartLine_data.data1, label: { normal: { show: false }}
           }]
@@ -1315,18 +1315,18 @@ export default {
         title: { text: chartLine_data.title, x: 'center', y: 'center', textStyle: { color: '#909399', fontWeight: 'normal', fontSize: 12 }},
         grid: { left: '10%', right: '12%', bottom: '3%', containLabel: true },
         tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' }}},
-        legend: { data: ['公斤奶饲料成本', '单头牛饲料成本'], itemHeight: 7, itemWidth: 15 },
-        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }, name: '日期' }],
+        legend: { data: [this.$t('dashboard.feedCow'), this.$t('dashboard.table.signOx')], itemHeight: 4, itemWidth: 15 ,},
+        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }, name: this.$t('dashboard.table.date') }],
         yAxis: [{
-          splitLine: { show: false }, type: 'value', name: '公斤奶\n饲料成本(元)', axisLabel: { formatter: '{value}' }
+          splitLine: { show: false }, type: 'value', name: this.$t('dashboard.feedCows'), axisLabel: { formatter: '{value}' }
         }, {
-          splitLine: { show: false }, type: 'value', name: '单头牛\n饲料成本(元)', axisLabel: { formatter: '{value}' }
+          splitLine: { show: false }, type: 'value', name: this.$t('dashboard.signOxs'), axisLabel: { formatter: '{value}' }
         }
         ],
         series: [{
-          name: '公斤奶饲料成本', type: 'bar', itemStyle: { normal: { color: '#1abd88' }}, data: chartLine_data.data2
+          name: this.$t('dashboard.feedCow'), type: 'bar', itemStyle: { normal: { color: '#1abd88' }}, data: chartLine_data.data2
         }, {
-          name: '单头牛饲料成本', type: 'line', yAxisIndex: 1, itemStyle: { normal: { color: '#ff8d78' }}, data: chartLine_data.data3
+          name: this.$t('dashboard.table.signOx'), type: 'line', yAxisIndex: 1, itemStyle: { normal: { color: '#ff8d78' }}, data: chartLine_data.data3
         }]
       }
       this.row4.chart1.chartLine.setOption(option)
@@ -1446,10 +1446,10 @@ export default {
         console.log('成本统计')
         var excelDatasTabChart2 = [
           {
-            tHeader: ['日期', '单头牛饲料成本', '公斤奶饲料成本(元)'],
+            tHeader: this.$t('dashboard.tHeader'),
             filterVal: ['日期', 'field1', 'field2'],
             tableDatas: this.row4.chart1.table.list,
-            sheetName: '成本统计'
+            sheetName:this.$t('dashboard.CostStatistics')
           }
         ]
         json2excel(excelDatasTabChart2, '成本统计', true, 'xlsx')
@@ -1672,6 +1672,7 @@ export default {
   .img-t{position: absolute;left: 0;right: 0;margin: 30px auto;width: 31%;height: 31%;background-size: 100% 100%;}
   .row1-c-l-c{
     margin: 30px auto;border: 1px solid #eee;height: 40%;width: 50%;border-radius: 50%;text-align: center;display:table;
+
     span{
       height:100%;display:table-cell;vertical-align: middle;font-size:14px;color: #009C69;
       b{padding-bottom: 10px;font-size: 16px;}
@@ -1679,6 +1680,11 @@ export default {
   }
   .row1-c-l-b{
     width: 100%;text-align: center;display:table;font-size: 12px;
+
+    &:lang(en){
+      margin: -20px auto;
+    }
+
     // div{
     //   font-size: 12px;height:100%;display:table-cell;vertical-align: middle;color: #323232;padding: 0 10px;width: 100%;
     //   span{text-align: right;width: 75%;display: block;float: left;}
@@ -1760,6 +1766,9 @@ export default {
             flex: 1;position: relative;
             .bottom{
               width: 99%;height: 70px;background: #f9f9f9;margin: 30px auto 5px;display: flex; flex-direction: row;text-align: center;
+              &:lang(en){
+                height: 84px;
+              }
               div{
                 flex: 1;height: 42px;color: #333333;
               }