田源
2023-07-18 d44134d06fc57865bc8995972e9035dbb90fd8b9
7-18整合代码
已修改2个文件
56 ■■■■■ 文件已修改
Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
@@ -77,7 +77,7 @@
<!--          高级查询-->
          <advanced-query :options="this.options" :visible.sync="findvisible" @echoContion="echoContion"></advanced-query>
<!--          导出-->
          <MasterTransfer :visible.sync="dialogPush" :tableHeadData="tableHeadFindData" :codeClassifyOid="codeClassifyOid"></MasterTransfer>
          <MasterTransfer :visible.sync="dialogPush" :tableHeadData="tableHeadFindData" :codeClassifyOid="codeClassifyOid" :tableData="tableData"></MasterTransfer>
<!--          相似项-->
          <ResembleQueryDialog :codeClassifyOid="codeClassifyOid" :codeRuleOid="this.codeRuleOid" :rowOid="rowOid"
                               :templateOid="templateOid" :visible.sync="similarVisible"></ResembleQueryDialog>
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -1,6 +1,8 @@
<template>
<el-dialog :visible.sync="dialogPush" append-to-body  :close-on-click-modal="false"  @close="recoverPage" title="导出">
  <div style="margin-bottom: 10px">
    <el-button type="success"
               @click="handleExcel">下载 多级表头excel</el-button>
    <el-radio-group v-model="radio">
      <el-radio :label="0">选择</el-radio>
      <el-radio :label="1">全部</el-radio>
@@ -24,7 +26,7 @@
<script>
export default {
name: "MasterTransfer",
  props:['visible','tableHeadData','codeClassifyOid'],
  props:['visible','tableHeadData','codeClassifyOid','tableData'],
  data(){
    return {
      data: [],
@@ -43,13 +45,7 @@
          prop: 'header',
          children: []
        }],
        data: [{
          title1: "测试数据1",
          title2: "测试数据2"
        }, {
          title1: "测试数据2",
          title2: "测试数据2"
        }]
        data: []
      }
    };
  },
@@ -61,7 +57,9 @@
    //表头数据 用来渲染穿梭框
    tableHeadData:{
      handler(newval,oldval){
        console.log(newval)
       if(newval){
         //excel表头数据转换
         this.tableHeadFindData=newval.map(obj => obj.label);
         this.tableHeadFindData.forEach((city, index) => {
           this.data.push({
@@ -69,13 +67,31 @@
             key: index,
           });
         });
         return this.data;
         //excel表格数据转换
         this.option.column[0].children=newval.map(obj => {
           return {
             label: obj.label,
             prop: obj.prop
           }
         })
       }
      }
},
    tableData(){
      // 将值里面的true或false改变为是或否
      this.option.data = this.tableData.map(obj => {
          for (let prop in obj) {
            if (obj[prop] === "true") {
              obj[prop] = "是";
            } else if (obj[prop] === "false") {
              obj[prop] = "否";
            }
          }
        return obj;
      });
    },
    codeClassifyOid:{
      handler(newval,oldval){
        console.log('daochu',newval,oldval)
      }
    }
  },
@@ -83,23 +99,19 @@
  },
  mounted() {
  this.ExportRend()
  },
  methods:{
    //关闭页面
    recoverPage(){
      this.$emit('update:visible', false);
    },
    //导出表格数据转换表头信息
    ExportRend(){
      this.tableExportData=this.tableHeadData.map(obj => {
        return {
          label: obj.label,
          prop: obj.prop
        }
      })
      console.log(this.tableExportData)
    }
    handleExcel(){
      this.$Export.excel({
        title: this.option.title,
        columns: this.option.column,
        data: this.option.data
      });
    },
  }
}
</script>