<template>
  <div class="pt32l24">
    <div class="gotoButton pb24" @click="gotoBack"><i class="gotoIcon"></i>返回</div>
    <div class="gjhqTitle pb24">消息详情</div>
    <div v-if="types == 1">
      <div class="messTitles"><span class="topTime">{{ this.$gshDateTime(new Date(zgSetDatas.created_at)) }} </span>整改消息</div>
      <div class="messTitlesSaml" v-if="zgSetDatas.content != null">{{ zgSetDatas.content }}，如下：</div>
      <div class="messTitlesSaml" v-else>-</div>
      <div class="messTimes">{{ this.$gshDateTime(new Date(zgSetDatas.created_at)) }} 整改汇总</div>
      <div class="supTimes"><span>上报日期：{{ this.$gshDateTime(new Date(zgSetDatas.report_time)) }}</span><span>整改日期：{{ this.$gshDateTime(new Date(zgSetDatas.created_at)) }}</span></div>      
      <div class="zgMain">
        <div class="zgw33 lf">
          <div class="zgPad12">
            <div class="zgMainList">基础信息采集</div>
            <div v-for="(item, i) in basiDatas" :key="i">
              <div class="zgMainli" :class="item.current==true?'cur':''" @click="zgClickHandle(item)" v-if="clickShow == true"><span class="rf">{{ item.wcd }}%</span>{{ item.titles }}</div>
              <div class="zgMainli" :class="item.current==true?'cur':''" v-else><span class="rf">{{ item.wcd }}%</span>{{ item.titles }}</div>
            </div>
            <div class="zgMainList mt20">常态工作记录</div>
            <div v-for="(item, i) in basiDatasTwe" :key="i">
              <div class="zgMainli" :class="item.current==true?'cur':''" @click="ctClickHandle(item, i)" v-if="clickShow == true"><span class="rf">{{ item.wcd }}%</span>{{ item.titles }}</div>
              <div class="zgMainli" :class="item.current==true?'cur':''" v-else><span class="rf">{{ item.wcd }}%</span>{{ item.titles }}</div>
            </div>
          </div>
        </div>
        <div class="zgw33 lf">
          <div class="zgPad12">
            <div class="warpMain">
              <div style="position:relative;">
                <div class="schoolBox">
                  <div v-for="(item, i) in dataObjs" :key="i" class="schoolmainBox">
                    <div class="sTitle">{{ item.table_name }}</div>
                    <div v-if="item.scale_field.length !=0">
                      <div v-for="(subItem, index) in item.scale_field" :key="index">
                        <div class="smalT"><div class="lf titleslsllsls">{{index + 1}}、{{ subItem.name }}: </div>
                          <div v-if="subItem.type == '1'" class="sigShool">
                            <span class="zgtitlesli">{{ subItem.fromVal }}</span>
                          </div>
                          <div v-if="subItem.type == '2'" class="sigShool">
                            <span v-for="(fromItem, idx) in subItem.values" :key="idx">
                              <i class="zgtitlesli" v-if="subItem.fromVal == fromItem.key">{{ fromItem.value }}</i>
                            </span>
                          </div>
                          <div v-if="subItem.type == '3'" class="sigShool">
                            <span class="zgtitlesli" v-for="(chitme, chi) in subItem.values" :key="chi">
                              <i v-for="(chitmet, chii) in subItem.fromVal" :key="chii">
                                <i v-show="chitmet == chitme.key">{{ chitme.value }}</i>
                                </i>
                            </span>
                          </div>
                          <div v-if="subItem.type == '4'" class="sigShool">
                            <span class="zgtitlesli" v-for="(itemsList, imglist) in subItem.fromVal" :key="imglist">{{ itemsList.name }};</span>
                          </div>
                          <div v-if="subItem.type == '6'" class="sigShool">
                            <span class="zgtitlesli">{{ subItem.fromVal }}</span>
                          </div>
                          <div v-if="subItem.type == '7'" class="sigShool">
                            <span class="zgtitlesli">{{ subItem.fromVal }}</span>
                          </div>
                          <div v-if="subItem.type == '9'" class="sigShool">
                            <span class="zgtitlesli">{{ subItem.fromVal }}</span>
                          </div>
                          <div class="clear"></div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="zgw33 zgbor0 lf">
          <div class="zgPad12">
            <div class="imgsTitle"><img src="../../assets/icon33.png" width="354" height="32"></div>
            <div class="sTitleTwe">督办反馈信息</div>
            <div class="dbxxTimes">保定市公安局 {{ this.$gshDateTime(new Date(zgSetDatas.created_at)) }}</div>
            <!-- <div v-for="(item, i) in fkDetailDatas" :key="i">
              <div v-if="item.feedback_info != false" class="sTitleThr">
                <span v-if="item.feedback_info.is_zhenggai == 'yes'">{{ item.table_name }}</span></div>
              <div v-if="item.feedback_info != false">
                <div class="sTitleFor">{{ item.feedback_info.content }}</div>
              </div>
            </div> -->
            <div v-if="fkDetailDatas.length > 0">
              <div v-for="(item, i) in fkDetailDatas" :key="i">
                <div v-if="item.is_zhenggai == 'yes'" class="sTitleThr">{{ item.table_name }}</div>
                <div class="sTitleFor" v-if="item.content != null" v-html="item.content"></div>
              </div>
            </div>
          </div>
        </div>
        <div class="clear"></div>
      </div>
    </div>
    <div v-else-if="types == 2">
      <div class="messTitles">系统消息</div>
      <div class="operateLi">
        <span class="color00"><span class="rf operateLitiem">{{ operateDatas.updated_at }}</span></span><span class="color00">{{ operateDatas.content }} 更新了</span>
      </div>
    </div>
    <div v-else-if="types == 3">
      <div class="messTitles">操作记录</div>
      <div v-for="(item, i) in sysDatas" :key="i" class="systemLi">
        <span>{{ item.timers }}</span>将进行系统升级，<span class="color00">升级期间请保持电源开启，切勿进行任何填写，上报操作。</span>
      </div>
    </div>
  </div>
</template>
<script>
import { adminMessageDetails, adminLoginqx, adminScaleFieldMessage, adminScalelvlTwe, adminmessageGet, adminsumfenzhi, adminreport } from '../../axios/api'
import { adminfoundationscale, adminscalesubmitinfo, adminscalesubmitinfoGet } from '../../axios/apiliangbiao'
export default {
  name: 'messagedetails',
  data () {
    return {
      dataObjs: '',
      types: '',
      zgDatas: {
        title: '',
        times: '',
        upTime: '',
        zgTime: ''
      },
      operateDatas: '',
      sysDatas: [
        {
          timers: '2025年5月12日12:22:21'
        },
        {
          timers: '2025年5月12日12:22:21'
        },
        {
          timers: '2025年5月12日12:22:21'
        }
      ],
      clickShow: false,
      basiDatas: [
        {
          titles: '1.1 学校基础信息采集量表',
          wcd: 100,
          dbfk: 0,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:school',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.2 学校设备信息采集量表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:school-equipment',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.3 学校人员基础信息采集量表',
          wcd: 100,
          dbfk: 0,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:school_people_info',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.4 学生欺凌委员会信息采集量表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:ql_committee_collection',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.5 学校规章制度采集量表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '2',
          name: 'admin:regulations_system_collection',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.6 常态工作-事前预防工作统计表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:preventive-work-advance',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.7 常态工作-事中发现工作统计表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:discover-work-statistics',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '1.8  常态工作-事后处理工作统计表',
          wcd: 50,
          dbfk: 10,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:handle-work-statistics',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        }
      ],
      basiDatasTwe: [
        {
          titles: '1常态工作-日常预防行为记录表',
          wcd: 50,
          dbfk: 2,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:record-preventive-behaviors',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '2常态工作-欺凌发现工作记录表',
          wcd: 50,
          dbfk: 2,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:bullying-discovery-record',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        },
        {
          titles: '3常态工作-事后处理工作记录表',
          wcd: 50,
          dbfk: 2,
          url: 'schoolscale',
          showV: '1',
          name: 'admin:handle-work-records',
          role: [],
          meun: false,
          if_insert: 1,
          current: false
        }
      ],
      quanxian: '',
      zgSetDatas: {
        updated_at: '2025-11-12',
        created_at: '2025-11-12',
        content: '2025-11-12'
      },
      fkDetailDatas: '',
      schoolcode: '',
      repotCode: '',
      subId: '',
      markdownContent: '# Hello &zwnj;**World**&zwnj;\nThis is a *test*.'
    }
  },
  props: {
    typeVals: ''
  },
  created () {
    let that = this
    let datas = that.typeVals
    console.log(datas)
    that.types = datas.type
    that.repotCode = datas.report_code
    if (that.types == 2) {
      let id = that.typeVals.id
      adminMessageDetails(id).then(res => {
        if (res.code == 10000) {
          let datas = new Date(res.updated_at)
          res.updated_at = that.$gshDateTime(datas)
          that.operateDatas = res
          // 页面加载完成后立即更新时间，然后每1000毫秒（1秒）更新一次时间
        } else {
          that.$messageOne({message: res.message, type: 'error', duration: 3000})
        }
      }).catch(error => {
        that.$messageOne({message: error, type: 'error', duration: 3000})
      })
    }
    setTimeout(() => {
      that.clickShow = true
    }, 4000)
    if (that.types == 1) {
      adminmessageGet(datas.id).then(res => {
        if (res.code == 10000) {
          that.zgSetDatas = res
        } else {
          that.$messageOne({message: res.message, type: 'error', duration: 3000})
        }
      }).catch(error => {
        that.$messageOne({message: error, type: 'error', duration: 3000})
      })
      adminLoginqx().then(res => {
        if (res.code == 10000) {
          if (res.role != null) {
            that.quanxian = res.role.id
          } else {
            that.quanxian = 0
          }
          if (res.system == 1) {
            setTimeout(() => {
              let menulist = that.basiDatas
              let menulistTwe = that.basiDatasTwe
              for (var i = 0; i < menulist.length; i++) {
                menulist[i].meun = true
              }
              for (var i = 0; i < menulistTwe.length; i++) {
                menulistTwe[i].meun = true
              }
            }, 500)
          } else {
            setTimeout(() => {
              let permissonListDatas = JSON.parse(localStorage.getItem('permissonListDatas'))
              let meunsArray = that.basiDatas
              for (var i = 0; i < meunsArray.length; i++) {
                let names = meunsArray[i].name
                for (var j = 0; j < permissonListDatas.length; j++) {
                  let arrNames = permissonListDatas[j].name
                  if (names == arrNames) {
                    meunsArray[i].role = permissonListDatas[j].roles
                  }
                }
              }
              that.meuns = meunsArray
              let menulist = that.basiDatas
              let qxVal = that.quanxian
              for (var i = 0; i < menulist.length; i++) {
                var qx = menulist[i].role
                for (var j = 0; j < qx.length; j++) {
                  if (qxVal == qx[j]) {
                    menulist[i].meun = true
                  }
                }
              }
              let meunsArrayTwe = that.basiDatasTwe
              for (var i = 0; i < meunsArrayTwe.length; i++) {
                let names = meunsArrayTwe[i].name
                for (var j = 0; j < permissonListDatas.length; j++) {
                  let arrNames = permissonListDatas[j].name
                  if (names == arrNames) {
                    meunsArrayTwe[i].role = permissonListDatas[j].roles
                  }
                }
              }
              that.basiDatasTwe = meunsArrayTwe
              let menulistTwe = that.basiDatasTwe
              for (var k = 0; k < menulistTwe.length; k++) {
                var qxs = menulistTwe[k].role
                for (var m = 0; m < qxs.length; m++) {
                  if (qxVal == qxs[m]) {
                    menulistTwe[k].meun = true
                  }
                }
              }
              that.basiDatas[0].current = true
            }, 1000)
          }
        } else if (res.code == 10002) {
          that.$router.push({name: 'Login'})
        } else {
          that.$messageOne({message: res.message, type: 'error', duration: 3000})
        }
      }).catch(error => {
        that.$messageOne({message: error, type: 'error', duration: 3000})
      })
    }
  },
  mounted () {
    let that = this
    if (that.types == 1) {
      setTimeout(() => {
        adminScalelvlTwe(1, that.zgSetDatas.created_at).then(res => {
          if (res.code == 10000) {
            let datas = res.data
            for (var i = 0; i < datas.length; i++) {
              let completeness = res.data[i].completeness
              that.basiDatas[i].titles = res.data[i].name
              that.basiDatas[i].id = res.data[i].id
              that.basiDatas[i].dbfk = res.data[i].feedbacks
              that.basiDatas[i].wcd = completeness.toFixed(0)
              that.basiDatas[i].if_insert = res.data[i].if_insert
              that.basiDatas[i].type = res.data[i].type
            }
          } else {
            that.$messageOne({message: res.message, type: 'error', duration: 3000})
          }
        }).catch(error => {
          that.$messageOne({message: error, type: 'error', duration: 3000})
        })
        adminScalelvlTwe(2, that.zgSetDatas.created_at).then(res => {
          if (res.code == 10000) {
            let datas = res.data
            for (var i = 0; i < datas.length; i++) {
              let completeness = res.data[i].completeness
              that.basiDatasTwe[i].titles = res.data[i].name
              that.basiDatasTwe[i].id = res.data[i].id
              that.basiDatasTwe[i].dbfk = res.data[i].feedbacks
              that.basiDatasTwe[i].wcd = completeness.toFixed(0)
              that.basiDatasTwe[i].if_insert = res.data[i].if_insert
              that.basiDatasTwe[i].type = res.data[i].type
            }
          } else {
            that.$messageOne({message: res.message, type: 'error', duration: 3000})
          }
        }).catch(error => {
          that.$messageOne({message: error, type: 'error', duration: 3000})
        })
      }, 1000)
      setTimeout(() => {
        that.basiDatas[0].current = true
        that.basiDatas[0].timer = that.zgSetDatas.updated_at
        that.queryData(that.basiDatas[0])

        let objTwe = {}
        objTwe.report_code = that.repotCode
        objTwe.id = that.basiDatas[0].id
        objTwe.subid = ''
        adminsumfenzhi(objTwe).then(res => {
          if (res.code == 10000) {
            let datas = res.data
            that.fkDetailDatas = datas
            for (var i = 0; i < that.fkDetailDatas.length; i++) {
              let cont = that.fkDetailDatas[i].content
              if (cont != null) {
                that.fkDetailDatas[i].content = that.simpleMarkdownToHtml(cont)
              }
            }
          } else {
            that.$messageOne({message: res.message, type: 'error', duration: 3000})
          }
        }).catch(error => {
          that.$messageOne({message: error, type: 'error', duration: 3000})
        })
      }, 2000)
    }
  },
  methods: {
    simpleMarkdownToHtml (text) {
      // 简单的 Markdown 到 HTML 的转换逻辑，只支持基本的 Markdown 语法。
      let html = text.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // 加粗 &zwnj;**bold**&zwnj; -> <strong>bold</strong>
        .replace(/\*(.*?)\*/g, '<em>$1</em>') // 斜体 *italic* -> <em>italic</em>
        .replace(/# (.*)/g, '<h1>$1</h1>') // 标题 # Heading -> <h1>Heading</h1>
        .replace(/#/g, '')
        .replace(/-/g, '')
      return html
    },
    async queryData (obj) {
      let that = this
      let datas = obj
      that.Bigtitle = datas.titles
      that.lbID = datas.id
      that.wzdNum = datas.wcd
      let objs = {}
      objs.id = datas.id
      objs.timer = that.zgSetDatas.report_time
      const res = await adminScaleFieldMessage(objs)
      if (res.code == 10000) {
        let datas = res.data
        if (datas.length > 0) {
          for (var i = 0; i < datas.length; i++) {
            let scalefield = datas[i].scale_field
            for (var j = 0; j < scalefield.length; j++) {
              if (scalefield[j].type == 3) {
                scalefield[j].fromVal = []
                scalefield[j].fileList = []
              } else if (scalefield[j].type == 4) {
                scalefield[j].fromVal = []
                scalefield[j].fileList = []
              } else {
                scalefield[j].fromVal = ''
                scalefield[j].fileList = []
              }
              scalefield[j].values = JSON.parse(scalefield[j].values)
            }
          }
          that.dataObjs = datas
          that.fkDetailDatas = datas
        }
        that.$forceUpdate()
      } else if (res.code == 10002) {
        that.$router.push({name: 'Login'})
      } else {
        that.$messageOne({message: res.message, type: 'error', duration: 3000})
      }
      this.$forceUpdate()
      if (datas.type == 2) {
        that.lsShow = true
        // const today = new Date()
        // const year = today.getFullYear()
        // const month = (today.getMonth() + 1).toString().padStart(2, '0') // 月份是从0开始的，所以加1
        // const day = today.getDate().toString().padStart(2, '0')
        // let objs = {}
        // objs.id = obj.id
        // objs.timer = that.zgSetDatas.report_time
        // // objs.timer = year + '-' + month + '-' + day
        // adminscalesubmitinfo(objs).then(res => {
        //   if (res.code == 10000) {
        //     if (res.data.length > 0) {
        //       for (var i = 0; i < res.data.length; i++) {
        //         let timers = new Date(res.data[i].updated_at)
        //         const hours = timers.getHours().toString().padStart(2, '0') // 获取小时，并确保是两位数
        //         const minutes = timers.getMinutes().toString().padStart(2, '0') // 获取分钟，并确保是两位数
        //         // 格式化时间字符串，例如 "2023-04-01 15:30:45"
        //         const datetimeString = `${timers.getFullYear()}-${(timers.getMonth() + 1).toString().padStart(2, '0')}-${timers.getDate().toString().padStart(2, '0')} ${hours}:${minutes}`
        //         res.data[i].updated_at = datetimeString
        //       }
        //       let len = res.data.length - 1
        //       that.subId = res.data[len].sub_id
        //     } else {
        //       that.subId = ''
        //     }
        //   }
        // }).catch(error => {
        //   that.$messageOne({message: error, type: 'error', duration: 3000})
        // })
      }
      setTimeout(() => {
        if (datas.type == 1) {
          let objs = {}
          objs.id = obj.id
          objs.timer = that.zgSetDatas.report_time
          adminfoundationscale(objs).then(res => {
            if (res.code == 10000) {
              let datasDetails = that.dataObjs
              let resData = res.data
              if (resData.length > 0) {
                for (var i = 0; i < datasDetails.length; i++) {
                  let scaletable = datasDetails[i].scale_table
                  let scalefield = datasDetails[i].scale_field
                  for (var j = 0; j < resData.length; j++) {
                    let scaletableVal = resData[j].scale_table
                    let scaletableinfo = resData[j].info
                    if (scaletable == scaletableVal) {
                      for (var k = 0; k < scalefield.length; k++) {
                        let codeName = scalefield[k].field
                        for (var n = 0; n < scaletableinfo.length; n++) {
                          let codeNameVal = scaletableinfo[n].field
                          if (codeName == codeNameVal) {
                            if (scaletableinfo[n].type == 1 || scaletableinfo[n].type == 2 || scaletableinfo[n].type == 5 || scaletableinfo[n].type == 6) {
                              if (scaletableinfo[n].va != null) {
                                scalefield[k].fromVal = scaletableinfo[n].va
                              } else {
                                scalefield[k].fromVal = ''
                              }                              
                            } else if (scaletableinfo[n].type == 7) {
                              if (scaletableinfo[n].va != null) {
                                scalefield[k].fromVal = parseInt(scaletableinfo[n].va)
                              } else {
                                scalefield[k].fromVal = ''
                              }
                            } else if (scaletableinfo[n].type == 9) {
                              if (scaletableinfo[n].va != null) {
                                scalefield[k].fromVal = parseInt(scaletableinfo[n].va)
                              } else {
                                scalefield[k].fromVal = ''
                              }
                            } else if (scaletableinfo[n].type == 3) {
                              if (scaletableinfo[n].va != null) {
                                scalefield[k].fromVal = JSON.parse(scaletableinfo[n].va)
                              } else {
                                scalefield[k].fromVal = []
                              }
                            } else if (scaletableinfo[n].type == 4) {
                              if (scaletableinfo[n].va != null) {
                                let fleslit = JSON.parse(scaletableinfo[n].va)
                                let fleslitAr = []
                                if (fleslit != null) {
                                  for (var s = 0; s < fleslit.length; s++) {
                                    let obj = {}
                                    obj.name = fleslit[s]
                                    let response = {}
                                    response.path = fleslit[s]
                                    obj.response = response
                                    fleslitAr.push(obj)
                                  }
                                  scalefield[k].fromVal = fleslitAr
                                  scalefield[k].fileList = fleslitAr
                                }
                              } else {
                                scalefield[k].fromVal = []
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }).catch(error => {
            that.$messageOne({message: error, type: 'error', duration: 3000})
          })
        }
        if (datas.type == 2) {
          let objs = {}
          objs.id = obj.id
          objs.timer = obj.timer
          console.log('22222222', objs)
          if (that.subId != '') {
            adminscalesubmitinfoGet(that.subId).then(res => {
              if (res.code == 10000) {
                let datasDetails = that.dataObjs
                let resDataTwe = res.data
                if (resDataTwe.length > 0) {
                  for (var i = 0; i < datasDetails.length; i++) {
                    let scaletable = datasDetails[i].scale_table
                    let scalefield = datasDetails[i].scale_field
                    for (var j = 0; j < resDataTwe.length; j++) {
                      let scaletableVal = resDataTwe[j].scale_table
                      let scaletableinfo = resDataTwe[j].info
                      if (scaletable === scaletableVal) {
                        for (var k = 0; k < scalefield.length; k++) {
                          let codeName = scalefield[k].field
                          for (var n = 0; n < scaletableinfo.length; n++) {
                            let codeNameVal = scaletableinfo[n].field
                            if (codeName == codeNameVal) {
                              if (scaletableinfo[n].type == 1 || scaletableinfo[n].type == 2 || scaletableinfo[n].type == 5 || scaletableinfo[n].type == 6) {
                                if (scaletableinfo[n].va != null) {
                                  scalefield[k].fromVal = scaletableinfo[n].va
                                } else {
                                  scalefield[k].fromVal = ''
                                }                              
                              } else if (scaletableinfo[n].type == 7) {
                                if (scaletableinfo[n].va != null) {
                                  scalefield[k].fromVal = parseInt(scaletableinfo[n].va)
                                } else {
                                  scalefield[k].fromVal = ''
                                }
                              } else if (scaletableinfo[n].type == 9) {
                                if (scaletableinfo[n].va != null) {
                                  scalefield[k].fromVal = parseInt(scaletableinfo[n].va)
                                } else {
                                  scalefield[k].fromVal = ''
                                }
                              } else if (scaletableinfo[n].type == 3) {
                                if (scaletableinfo[n].va != null) {
                                  scalefield[k].fromVal = JSON.parse(scaletableinfo[n].va)
                                } else {
                                  scalefield[k].fromVal = []
                                }
                              } else if (scaletableinfo[n].type == 4) {
                                if (scaletableinfo[n].va != null) {
                                  let fleslit = JSON.parse(scaletableinfo[n].va)
                                  let fleslitAr = []
                                  if (fleslit != null) {
                                    for (var s = 0; s < fleslit.length; s++) {
                                      let obj = {}
                                      obj.name = fleslit[s]
                                      let response = {}
                                      response.path = fleslit[s]
                                      obj.response = response
                                      fleslitAr.push(obj)
                                    }
                                    scalefield[k].fromVal = fleslitAr
                                    scalefield[k].fileList = fleslitAr
                                  }
                                } else {
                                  scalefield[k].fromVal = []
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }).catch(error => {
              that.$messageOne({message: error, type: 'error', duration: 3000})
            })
          }
        }
      }, 1000)
    },
    gotoBack () {
      this.$emit('gotoBzck', true)
    },
    zgClickHandle (item) {
      let that = this
      let basiDatas = that.basiDatas
      let basiDatasTwe = that.basiDatasTwe
      for (var i = 0; i < basiDatas.length; i++) {
        basiDatas[i].current = false
      }
      for (var i = 0; i < basiDatasTwe.length; i++) {
        basiDatasTwe[i].current = false
      }
      item.current = true
      item.timer = that.zgSetDatas.updated_at
      that.clickShow = false
      setTimeout(() => {
        that.clickShow = true
      }, 2000)
      that.queryData(item)
      setTimeout(() => {
        let objTwe = {}
        objTwe.report_code = that.repotCode
        objTwe.id = item.id
        objTwe.subid = ''
        adminsumfenzhi(objTwe).then(res => {
          if (res.code == 10000) {
            let datas = res.data
            that.fkDetailDatas = datas
            for (var i = 0; i < that.fkDetailDatas.length; i++) {
              let cont = that.fkDetailDatas[i].content
              if (cont != null) {
                that.fkDetailDatas[i].content = that.simpleMarkdownToHtml(cont)
              }
            }            
          }
        }).catch(error => {
          that.$messageOne({message: error, type: 'error', duration: 3000})
        })
      }, 1000)
    },
    ctClickHandle (item) {
      let that = this
      let basiDatas = that.basiDatas
      let basiDatasTwe = that.basiDatasTwe
      for (var i = 0; i < basiDatas.length; i++) {
        basiDatas[i].current = false
      }
      for (var i = 0; i < basiDatasTwe.length; i++) {
        basiDatasTwe[i].current = false
      }
      item.current = true
      item.timer = that.zgSetDatas.report_time
      that.clickShow = false
      adminreport().then(res => {
        if (res.code == 10000) {
          let objs = {}
          objs.id = item.id
          objs.timer = that.zgSetDatas.report_time
          adminscalesubmitinfo(objs).then(res => {
            if (res.code == 10000) {
              if (res.data.length > 0) {
                let len = res.data.length - 1
                that.subId = res.data[len].sub_id
              } else {
                that.subId = ''
              }
            }
          }).catch(error => {
            that.$messageOne({message: error, type: 'error', duration: 3000})
          })
        }
      }).catch(error => {
        that.$messageOne({message: error, type: 'error', duration: 3000})
      })
      
      that.queryData(item)
      setTimeout(() => {
        that.clickShow = true
        let objTwe = {}
        objTwe.report_code = that.repotCode
        objTwe.id = item.id
        objTwe.subid = that.subId
        adminsumfenzhi(objTwe).then(res => {
          if (res.code == 10000) {
            let datas = res.data
            that.fkDetailDatas = datas
            for (var i = 0; i < that.fkDetailDatas.length; i++) {
              let cont = that.fkDetailDatas[i].content
              if (cont != null) {
                that.fkDetailDatas[i].content = that.simpleMarkdownToHtml(cont)
              }
            }
          }
        }).catch(error => {
          that.$messageOne({message: error, type: 'error', duration: 3000})
        })
      }, 2000)
    }
  }
}
</script>
<style scoped>
.messTitles{height: 24px;font-weight: bold;font-size: 16px;color: #000000;line-height: 24px;margin-bottom:8px;}
.messTitlesSaml{height: 22px;font-size: 14px;color: #000000;line-height: 22px;margin-bottom:24px;}
.messTimes{height: 33px;font-weight: 600;font-size: 24px;color: #000000;line-height: 33px;overflow:hidden;margin-bottom:8px;}
.supTimes{height: 22px;font-size: 14px;color: #595959;line-height: 22px;overflow:hidden;margin-bottom:20px;}
.supTimes span{padding-right:24px}
.imgsTitle{height:32px;margin:0 0 12px;}
.zgMain{border:1px solid #e6e6e6;}
.zgMain .zgw33{width:33.1%;border-right:1px solid #e6e6e6;overflow:hidden;}
.zgMain .zgw33.zgbor0{border:0;}
.zgMainList{font-weight: bold;font-size: 16px;color: #161617;line-height: 24px;margin-bottom:12px;padding:0 8px;}
.zgMainList.pb10{margin:0 0 4px 0;}
.zgMainli{height: 30px;border-radius: 2px;font-size: 14px;color: #161617;line-height: 30px;cursor:pointer;padding:0 12px;}
.zgMainli.cur{background: #EDF4FF;border-radius: 2px;font-weight: bold;font-size: 14px;color: #0071DB;line-height: 30px;}
.zgPad12{padding:24px 12px;height:432px;overflow:hidden;overflow-y:auto;}
.zgPad16{padding-bottom:16px;}
.zgtitles{font-weight: bold;font-size: 14px;color: #161617;line-height: 22px;margin-bottom:8px;padding:0 8px;}
.zgtitlesTwe{font-weight: bold;font-size: 16px;color: #161617;line-height: 22px;margin-bottom:8px;padding:0 8px;}
.zgtitlesli{font-size: 14px;color: #161617;line-height: 22px;margin-bottom:8px;padding-left:8px;}
.zgtoimes{font-size: 14px;color: #161617;line-height: 22px;padding:0 8px;margin-bottom:12px;}
.zginfo{font-size: 14px;color: #E94A1E;line-height: 22px;padding:0 8px 8px;}
.zgtitlesliTwe{font-size: 14px;color: #161617;line-height: 22px;margin-bottom:8px;padding:0 8px;font-weight:bold;}
.operateLi{font-size: 14px;color: #000000;line-height: 22px;margin-bottom:8px;}
.operateLi span{padding-right:8px;}
.operateLi span.color00{color:#0071DB;}
.systemLi{font-size: 14px;color: #000000;line-height: 22px;margin-bottom:8px;}
.systemLi span{padding-right:8px;}
.systemLi span.color00{color:#E94A1E;}
.operateLitiem{color:#787A80}
.warpMain{width:100%;overflow:hidden;}
.schoolBox{background:#fff;}
.pa24{padding:32px 10px 32px 24px;}
.schoolTil{height: 30px;line-height:30px;font-size: 24px;color: #161617;text-align: left;font-style: normal;margin-bottom:20px;padding-right:24px;}
.schoolTil .wcd{padding-left:24px;}
.schoolTil .wcd .wcdtxt{font-size:14px;font-weight:normal;}
.schoolTil .opdb{font-size: 20px;color: #0071DB;line-height: 28px;font-style: normal;cursor:pointer;}
.schoolTil .opdb .opIcon{background:url('../../assets/icon22.png') no-repeat 0 0/100%;width:20px;height:16px;margin-right:7px;display:inline-block;}
.w50{width:50%;}
.w800Sig{width:900px;margin:0 auto;}
.schoolRight{display:none;}
.schoolRight.current{display:block;}
.schoolmainBox{padding:0 0 0 20px;margin-bottom:24px;}
.schoolmainBox .sTitle{font-weight: bold;font-size: 24px;color: #161617;line-height: 28px;text-align: left;font-style: normal;margin-bottom:12px;}
.schoolmainBox .sTitle span{font-size: 14px;font-weight:normal;}
.schoolmainBox .smalT{font-size: 16px;color: #161617;line-height: 24px;text-align: left;font-style: normal;margin-bottom:8px;}
.schoolmainBox .smalT em{color:#FF2A00;position:relative;top:3px;}
.sigShoolTwe{margin-bottom:10px;width:100%;}
.sigShoolTwe .sigW25{width:24%;height:22px;margin-bottom:15px;line-height:22px;display:inline-block;margin-right:0;}
.sigShoolTwe .sigW30{width:30%;height:22px;margin-bottom:15px;line-height:22px;display:inline-block;margin-right:0;}
.sigShoolTwe .sigW50{width:50%;height:22px;margin-bottom:15px;line-height:22px;display:inline-block;margin-right:0;}
.sigShoolTwe .sigW100{width:100%;height:22px;margin-bottom:15px;line-height:22px;display:inline-block;margin-right:0;}

.sigShool{width:100%;}
.scholBtnbox{text-align:center;padding:16px 0;position:absolute;bottom:0;left:0;width:100%;background-color:#fff;z-index:999;border-top:1px solid #E6E6E6;z-index:999;}
.scholBtnbox.current{bottom:53px;}
.scholBtnboxTile{font-weight:bold;font-size: 20px;color: #161617;line-height: 28px;padding:0 20px;margin-bottom:24px;}
.scholBtnboxSig{font-weight: bold;font-size: 14px;color: #161617;line-height: 22px;margin-bottom:12px;padding:0 20px;font-weight: normal;}
.scholBtnboxSig i{color:#E94A1E;margin-right:4px;}
.scholBtnboxSig strong{display:inline-block;width:70px;font-weight: bold;}
.uploadIcon{height:20px;line-height:20px;font-size: 12px;color: #8D8F99;text-align: left;font-style: normal;float:left;margin-right:8px;}
.uploadIcon .uploadButton{display:block;background:url('../../assets/icon23.png') no-repeat 0 0/100%;width:20px;height:20px;margin-right:8px;float:left;}
.uploadIcon .uploadTxt{color:#0071DB}
.uploadtip{float:left;height:20px;line-height:20px;font-size: 12px;color: #8D8F99;text-align: left;font-style: normal;}
.dbxxTil{height: 30px;line-height:30px;font-size: 24px;color: #161617;text-align: left;font-style: normal;margin-bottom:4px;}
.dbxxTimes{height: 22px;font-size: 14px;color: #161617;line-height: 22px;text-align: left;font-style: normal;margin-bottom:16px;}
.detailesTile{font-size: 20px;color: #161617;line-height: 28px;text-align: left;font-style: normal;margin-bottom:16px;}
.detailesTips{font-size: 16px;color: #E94A1E;line-height: 22px;text-align: left;font-style: normal;margin-bottom:12px;}
.detailessTile{font-size: 14px;color: #161617;line-height: 22px;text-align: left;font-style: normal;font-weight:bold;}
.detailessli{font-size: 14px;color: #161617;line-height: 22px;text-align: left;font-style: normal;}
.detailesul{margin-bottom:12px;}
.schoolSee{display:block;position:relative;}
.schoolSee .yuan{width: 8px;height: 8px;background: #FF0000;border: 2px solid #FFFFFF;position:absolute;top:2px;right:-12px;border-radius: 50%;}
.schoolSee.current{display: none;}
.jindutiao{height: 8px;background: #E6E6E6;border-radius: 2px;overflow:hidden;margin:24px 0;width:100%;}
.jindutiao .cur{height: 8px;background: #3384E2;;border-radius: 2px;overflow:hidden;}
.filelistUplad{font-size: 14px;color: #303133;margin-bottom:16px;}
.filesListItem{height:24px;line-height:24px;margin-bottom:2px;padding:0 15px;background:#f9f9f9;color:#8D8F99;}
.filesListItem .closeIconfilesList{cursor:pointer;width:16px;height:16px;text-align:center;float:right;background:url('../../assets/icon8.png') no-repeat 0 0/100%;text-indent:-9999px;position:relative;top:4px;}
.titleslsllsls{padding-right:10px;}
.sTitleTwe{font-weight: bold;font-size: 24px;color: #161617;line-height: 28px;text-align: left;font-style: normal;margin-bottom:12px;}
.sTitleThr{font-weight: normal;font-size: 16px;color: #161617;line-height: 28px;margin-bottom:8px;}
.sTitleFor,.sTitleFiv{font-size:14px;font-size: 16px;color: #161617;line-height:24px;margin-bottom:8px;padding:0 0 0 12px;}
.topTime{float:right;font-size: 14px;color: #595959;line-height: 22px;font-weight:normal;}
</style>
