kimi
2020-01-23 3453eed4c505a5ffe765cc702836f5f5d9d5d5da
src/views/Overview.vue
@@ -3,20 +3,29 @@
      <div style="float: left; width: 100%; height: 50px;">
         <span>请选择项目:</span>
         <el-select @change="selectChange_" filterable v-model="value" placeholder="请选择" size="small">
            <el-option
               v-for="item in options"
               :key="item.value"
               :label="item.label"
               :value="item.value">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
         </el-select>
         
         
      </div>
      <div style="float: left; margin-left: 1%; width: 69%; height: 80vh; ">
         <div class="z_shadow" style="float: left; margin: 10px; margin-top: 0px; width: 46%; height: 43%; border: 1px solid #e4eef9;"></div>
         <div class="z_shadow" style="float: left; margin: 10px; margin-top: 0px; width: 46%; height: 43%; border: 1px solid #e4eef9;"></div>
         <div class="z_shadow" style="float: left; margin: 10px; width: 46%; height: 43%; border: 1px solid #e4eef9;"></div>
         <div class="z_shadow" style="float: left; margin: 10px; margin-top: 0px; width: 46%; height: 43%; border: 1px solid #e4eef9;">
            <div id="myChart" :style="{width: '100%', height: '100%'}"></div>
         </div>
         <div class="z_shadow" style="float: left; margin: 10px; margin-top: 0px; width: 46%; height: 43%; border: 1px solid #e4eef9;overflow: auto;padding: 5px;">
            <el-timeline :reverse="reverse">
               <el-timeline-item v-for="(deal, index) in deals" :key="index" :timestamp="deal.createTime">
                  {{deal.desp}}
               </el-timeline-item>
            </el-timeline>
         </div>
         <div class="z_shadow" style="float: left; margin: 10px; width: 46%; height: 43%; border: 1px solid #e4eef9;">
            <el-row :gutter="20">
              <el-col :span="6"  v-for="(user, index) in userList" :key="index">111</el-col>
            </el-row>
         </div>
         <div class="z_shadow" style="float: left; margin: 10px; padding: 10px; box-sizing: border-box; width: 46%; height: 43%; border: 1px solid #e4eef9;">
            <h3 style="margin: 0px;">文档库</h3>
            <div class="files_div">
@@ -44,45 +53,42 @@
</template>
<script>
   export default {
      
      data() {
         return {
            options: [
               {
                  value: '选项1',
                  label: '项目1'
               }, {
                  value: '选项2',
                  label: '项目2'
               }, {
                  value: '选项3',
                  label: '项目3'
               }, {
                  value: '选项4',
                  label: '项目4'
               }, {
                  value: '选项5',
                  label: '项目5'
               }
            ],
            options: [],
            deals: [],
            value: '',
            dialog_1: false,
            fileLevel: 0,
            fileList: [],
            myChart: undefined,
            userList: [],
            grandPa:"",
         }
      },
      mounted() {
         this.initSelect();
         let fileList1 = [
               {name: "文件名称1", type: "isfile", path: ""},
               {name: "文件名称2", type: "isfile", path: ""},
               {name: "文件夹名称", type: "isfiles", path: ""},
         this.myChart = this.$echarts.init(document.getElementById('myChart'))
         let fileList1 = [{
               name: "文件名称1",
               type: "isfile",
               path: ""
            },
            {
               name: "文件名称2",
               type: "isfile",
               path: ""
            },
            {
               name: "文件夹名称",
               type: "isfiles",
               path: ""
            },
            ];
         this.fileList = fileList1;
         this.initChart();
      },
      
      methods: {
@@ -107,52 +113,269 @@
               })
         },
         file_click(file) {
            if (file.type == 'isfiles') {
               let fileList2 = [
                  {name: "子文件名称1", type: "isfile", path: ""},
                  {name: "子文件名称2", type: "isfile", path: ""},
                  {name: "子文件夹名称", type: "isfiles", path: ""},
               ];
               this.fileList = fileList2;
            if (!file.file) {
               let url = "/api/file/child" ;
               this.$axios.get(url,{
                  params:{
                     path:encodeURI(file.path)
                  }
               })
                  .then(data_ => {
                     console.log(data_);
                     if (data_.data.success) {
                        var datas = data_.data.data;
                        this.fileList = datas;
                        if(datas.length > 0) {
                           this.grandPa = datas[0].grandPa;
                        }
               this.fileLevel ++;
            }
            else {
                  }).catch(error => {
                     console.log(error);
                  })
            } else {
               //下载
               this.$refs.frame_export.src = "";
               if (file.path) {
                  let url = "/api/api/file/downloadPath?path=" + encodeURI(file.path);
                  this.$refs.frame_export.src = url;
               }
            }
         },
         upFile_click() {
            this.fileLevel --;
            if(!this.grandPa) {
               this.$message({message:'请刷新界面后重试', type: 'warning'});
               return;
            }
            let url = "/api/file/child" ;
            this.$axios.get(url,{
               params:{
                  path:encodeURI(this.grandPa)
               }
            })
               .then(data_ => {
                  console.log(data_);
                  if (data_.data.success) {
            
            let fileList2 = [
               {name: "文件名称1", type: "isfile", path: ""},
               {name: "文件名称2", type: "isfile", path: ""},
               {name: "文件夹名称", type: "isfiles", path: ""},
            ];
            this.fileList = fileList2;
                     var datas = data_.data.data;
                     this.fileList = datas;
                     this.fileLevel--;
                  }
               }).catch(error => {
                  console.log(error);
               })
         },
         
         Cancel() {
            
         },
         selectChange_(val) {
            let me = this;
            let url = "/api/scheme/getSchemeInfo/" + this.value;
            this.$axios.get(url,{
              
            }).then(data_ => {
              console.log(data_);
               // 图
               // 记录
               // 人员
               // 详情
               //目录
               if (data_.data.success) {
                  let result = data_.data.data;
                  me.initChart(result.option);
                  me.userList = result.users;
                  result.paths = result.paths.map(el => {
                     el.path = decodeURI(el.path);
                     return el;
                  });
                  result.record = result.record.map(el => {
                     var imoment = this.$moment(el.createTime);
                     // 格式化成,年月日
                     let iformat = imoment.format('YYYY-MM-DD');
                     el.createTime = iformat;
                     if(!el.desp) {
                        el.desp = "暂无描述";
                     }
                     return el;
                  });
                  me.fileList = result.paths;
                  me.scheme = result.scheme;
                  me.deals = result.record;
               }
            }).catch(error =>{
                console.log(error);
            })
            
         },
         initChart(datas) {
            this.myChart.setOption({
               backgroundColor: '#FFF',
               grid: {
                  top: '12%',
                  bottom: '19%',
                  left: '8%',
                  right: '8%'
               },
               tooltip: {
                  trigger: 'axis',
                  label: {
                     show: false
                  }
               },
               legend: {
                  data: ["参考", "实际"],
               },
               xAxis: {
                  boundaryGap: false, //默认,坐标轴留白策略
                  axisLine: {
                     show: false
                  },
                  splitLine: {
                     show: false
                  },
                  axisLabel: {
                     interval: 0, //隔几个显示
                     rotate: 30,
                     showMinLabel: true,
                     color: "#393C40"
                  },
                  axisTick: {
                     show: false,
                     alignWithLabel: true
                  },
                  data: [
                     '12-3', '12-4', '12-5', '12-6', '12-7', '12-8', '12-9', '12-10', '12-11'
                  ]
               },
               yAxis: {
                  axisLine: {
                     show: false
                  },
                  splitLine: {
                     show: true,
                     lineStyle: {
                        type: 'dashed',
                        color: 'rgba(33,148,246,0.2)'
                     }
                  },
                  axisTick: {
                     show: false
                  },
                  splitArea: {
                     show: true,
                     areaStyle: {
                        color: 'rgb(245,250,254)'
                     }
                  }
               },
               series: [{
                     name: "实际",
                     type: 'line',
                     symbol: 'circle',
                     symbolSize: 7,
                     lineStyle: {
                        color: '#0c64eb',
                        shadowBlur: 12,
                        shadowColor: '#0c64eb',
                        shadowOffsetX: 1,
                        shadowOffsetY: 1
                     },
                     itemStyle: {
                        color: '#0c64eb',
                        borderWidth: 1,
                        borderColor: '#FFF'
                     },
                     label: {
                        show: false,
                        distance: 1,
                        emphasis: {
                           show: true,
                           offset: [25, -2],
                           //borderWidth:1,
                           // borderColor:'rgb(33,148,246)',
                           //formatter:'{bg|{b}\n数据量:{c}}',
                           color: '#FFF',
                           padding: [8, 20, 8, 6],
                           //width:60,
                           height: 36,
                           formatter: function(params) {
                              var name = params.name;
                              var value = params.data;
                              var str = name + '\n实际:' + value;
                              return str;
                           },
                           rich: {
                              bg: {
                                 width: 78,
                                 //height:42,
                                 color: '#FFF',
                                 padding: [20, 0, 20, 10]
                              },
                              br: {
                                 width: '100%',
                                 height: '100%'
         }
         
      }
                        }
                     },
                     data: [
                        20, 18, 17, 10, 7, 4,
                     ]
                  },
                  {
                     name: "参考",
                     type: 'line',
                     symbol: 'circle',
                     symbolSize: 7,
                     lineStyle: {
                        color: '#a6a8b6',
                        shadowBlur: 12,
                        shadowColor: '#a6a8b6',
                        shadowOffsetX: 1,
                        shadowOffsetY: 1
                     },
                     itemStyle: {
                        color: '#a6a8b6',
                        borderWidth: 1,
                        borderColor: '#FFF'
                     },
                     label: {
                        show: false,
                        distance: 1,
                        emphasis: {
                           show: true,
                           offset: [25, -2],
                           //borderWidth:1,
                           // borderColor:'rgb(33,148,246)',
                           //formatter:'{bg|{b}\n数据量:{c}}',
                           color: '#FFF',
                           padding: [8, 20, 8, 6],
                           //width:60,
                           height: 36,
                           formatter: function(params) {
                              var name = params.name;
                              var value = params.data;
                              var str = name + '\n参考:' + value;
                              return str;
                           },
                        }
                     },
                     data: [
                        20, 17.5, 15, 12.5, 10,
                        7.5, 5, 2.5, 0
                     ]
                  }
               ]
            });
         },
      },
      
   }
</script>
@@ -167,11 +390,13 @@
      height: 90%;
      overflow: auto;
   }
   .file_div {
      width: 30%;
      height: 20px;
      float: left;
   }
   .file_div :hover {
      cursor: pointer;
      font-weight: bold;