<template>
  <view>
    <div class="main" v-if="analyseText">
      <p class="title">分析</p>
      <div class="text">{{ analyseText }}</div>
    </div>
    <view v-else></view>
  </view>
</template>

<script>
import request from '@/util/index.js'
export default {
    name: "analyse",
    data(){
        return {
          time:'',
          serviceInfo:{},
          analyseText:''
        }
    },
    props:{
        analyseInfo:{
            type: Object,
            default:()=>{}
        }
    },
    watch:{
        analyseInfo:{
            handler(value){
                this.getLabelDetail()
            },
            immediate:true,
            deep:true
        }
    },
    onLoad(){
      this.time = uni.getStorageSync('lastDay')
    },
    methods:{
        async getLabelDetail(){
            this.time = uni.getStorageSync('lastDay')
            let id = uni.getStorageSync('currentService')
            let req = {
                    SearchParameter:{
                        ANALYSISINS_TYPE:this.analyseInfo.analysisins_type,
                        ANALYSISINS_FORMAT:this.analyseInfo.analysisins_format,
                        ANALYSISINS_STATE:1,
                        SERVERPART_ID:id.Serverpart_ID,
                    },
                    PageIndex:1,
                    PageSize:10
            }
            const data = await request.$webPost('CommercialApi/Analysis/GetANALYSISINSList',req)
            this.analyseText = data.Result_Data.List[0]?data.Result_Data.List[0].ANALYSIS_CONTENT:''
        },
    }
}
</script>

<style scoped lang="scss">
.main{
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  background: #F1F3F7;
  border-radius: 4px;
  display: flex;
  margin-top: 12px;
  .title{
    width: 28px;
    height: 18px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #160002;
    line-height: 18px;
    padding: 0 4px;
    text-align: center;
    border-radius: 4px;
    background:rgba(6, 93, 255, 0.1);
  }
  .text{
    width: calc(100% - 46px);
    padding-left: 6px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #786B6C;
    line-height: 18px;

  }
}
</style>
