detail.vue 3.27 KB
<template>
  <div>
    <el-dialog :title="$t('button.details')" :visible.sync="isShow" v-if="isShow" :close-on-click-modal='false' width="1000px" class="manage-dialog dialog_lj" :before-close="closeDialog">
      <el-button type="primary" class="search-btn manage-add-btn"  @click="exportFun">{{$t('button.export')}}</el-button>
      <el-table
        :data="tableData"
        :max-height="500"
        style="width: 100%"
        header-row-class-name="manage-tab-head"
      >
        <el-table-column prop="order" :label="$t('table.order')" align="center" width="100"></el-table-column>
        <el-table-column prop="groupName" :label="$t('table.group')" align="center"></el-table-column>
        <el-table-column prop="mallName" :label="$t('table.mall')" align="center"></el-table-column>
        <el-table-column prop="patrolTimes" :label="$t('table.tourNumber')" align="center"></el-table-column>
        <el-table-column prop="unqualifiedNum" :label="$t('table.nonconformities')" align="center"></el-table-column>
        <el-table-column prop="deductPoints" :label="$t('table.deductPoints')" align="center"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeDialog" class="dialog-btn">{{$t('dialog.cancel')}}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        loading:false,
        isShow:false,
        tableData:[],
        parmasObj:{}
      }
    },
    methods: {
      dialogInit(detailObj) {
        this.parmasObj = {
          ...detailObj
        }
        let tabelParams = {
          accountId: this.$cookie.get('accountId'),
          startDate:detailObj.startDate,
          endDate:detailObj.endDate,
          mallIds:detailObj.mallIds,
          sopProjectId:detailObj.sopProjectId,
          patrolType:2
        };
        Object.keys(tabelParams).map(key => (!tabelParams[key] ? delete tabelParams[key] : ''));
        this.$api.videoShopTourReport.checkProblemItemReport(tabelParams, null, true).then(data => {
          this.tableData = [];
          var result = data.data;
          if(result.code==200){
            if(result.data && result.data.length>0){
              result.data.forEach((item, index) => {
                item.order = index + 1;
              });
            }
            this.tableData = result.data;
          }
        })
        this.isShow = true;
      },
      exportFun(){
        let parameter = {
          accountId: this.$cookie.get('accountId'),
          startDate:this.parmasObj.startDate,
          endDate:this.parmasObj.endDate,
          mallIds:this.parmasObj.mallIds,
          sopProjectId:this.parmasObj.sopProjectId
        };
        let Url =window._vionConfig.tourUrl + "/report-form/sop-project/mall/export?";
        let dowloadUrl =`${Url}accountId=${parameter.accountId}&patrolType=2&mallIds=${parameter.mallIds}&sopProjectId=${parameter.sopProjectId}&startDate=${parameter.startDate}&endDate=${parameter.endDate}&authorization=${this.$cookie.get("atoken")}`
        window.open(dowloadUrl);
      },
      closeDialog() {
        this.isShow = false;
      }
    }
  }
</script>
<style lang="less" scoped="scoped">
  .dialog_lj{
    min-height: 500px;
    .search-btn{
      margin-bottom: 15px;
    }
  }
</style>