5 changed files with 215 additions and 7 deletions
			
			
		@ -0,0 +1,138 @@ | 
				
			|||||
 | 
					<template> | 
				
			||||
 | 
					  <el-dialog | 
				
			||||
 | 
					    :visible.sync="visible" | 
				
			||||
 | 
					    :title="'智能填表'" | 
				
			||||
 | 
					    :close-on-click-modal="true" | 
				
			||||
 | 
					    :close-on-press-escape="true" | 
				
			||||
 | 
					    width="850px" | 
				
			||||
 | 
					    :top="diaTop" | 
				
			||||
 | 
					  > | 
				
			||||
 | 
					    <el-table | 
				
			||||
 | 
					      v-loading="loading" | 
				
			||||
 | 
					      :data="list" | 
				
			||||
 | 
					      row-key="id" | 
				
			||||
 | 
					      border | 
				
			||||
 | 
					      :height="tableHeight" | 
				
			||||
 | 
					      style="width: 100%" | 
				
			||||
 | 
					    > | 
				
			||||
 | 
					      <el-table-column type="index" label="序号" width="50" /> | 
				
			||||
 | 
					      <el-table-column | 
				
			||||
 | 
					        prop="reportName" | 
				
			||||
 | 
					        label="模板名称" | 
				
			||||
 | 
					        header-align="center" | 
				
			||||
 | 
					        min-width="150" | 
				
			||||
 | 
					      ></el-table-column> | 
				
			||||
 | 
					      <el-table-column | 
				
			||||
 | 
					        label="客户配置" | 
				
			||||
 | 
					        fixed="right" | 
				
			||||
 | 
					        header-align="center" | 
				
			||||
 | 
					        align="center" | 
				
			||||
 | 
					        width="150" | 
				
			||||
 | 
					      > | 
				
			||||
 | 
					        <template slot-scope="scope"> | 
				
			||||
 | 
					          <el-button type="text" size="small" @click="fillIn(scope.row)" | 
				
			||||
 | 
					            >填写</el-button | 
				
			||||
 | 
					          > | 
				
			||||
 | 
					        </template> | 
				
			||||
 | 
					      </el-table-column> | 
				
			||||
 | 
					    </el-table> | 
				
			||||
 | 
					  </el-dialog> | 
				
			||||
 | 
					</template> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<script> | 
				
			||||
 | 
					import { Loading } from "element-ui"; // 引入Loading服务 | 
				
			||||
 | 
					import { requestPost, requestGet } from "@/js/dai/request"; | 
				
			||||
 | 
					import { mapGetters } from "vuex"; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					export default { | 
				
			||||
 | 
					  data() { | 
				
			||||
 | 
					    return { | 
				
			||||
 | 
					      loading: false, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      visible: false, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      list: [], //客户列表 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      elseParams: {}, | 
				
			||||
 | 
					    }; | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  computed: { | 
				
			||||
 | 
					    tableHeight() { | 
				
			||||
 | 
					      // return this.resolution === 'small' ? this.clientHeight - 210 : this.clientHeight - 220 | 
				
			||||
 | 
					      return this.clientHeight - 300; | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					    diaWidth() { | 
				
			||||
 | 
					      return this.resolution === "small" ? 60 : 50; | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					    diaHeight() { | 
				
			||||
 | 
					      return this.resolution === "small" ? 350 : 600; | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					    diaTop() { | 
				
			||||
 | 
					      return this.resolution === "small" ? "30px" : "100px"; | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					    ...mapGetters(["clientHeight", "resolution"]), | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  mounted() {}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					  methods: { | 
				
			||||
 | 
					    async init(row) { | 
				
			||||
 | 
					      console.log("1111111111", row); | 
				
			||||
 | 
					      const { elseParams } = row; | 
				
			||||
 | 
					      this.visible = true; | 
				
			||||
 | 
					      this.elseParams = { ...elseParams }; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      this.customerList = []; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      await this.getList(); | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    //获取所有客户列表 | 
				
			||||
 | 
					    async getList() { | 
				
			||||
 | 
					      this.loading = true; | 
				
			||||
 | 
					      const { elseParams } = this; | 
				
			||||
 | 
					      const { data, code, msg } = await requestPost( | 
				
			||||
 | 
					        "/oper/customize/icCustomerReport/report-list", | 
				
			||||
 | 
					        { | 
				
			||||
 | 
					          ...elseParams, | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					      ); | 
				
			||||
 | 
					      this.loading = false; | 
				
			||||
 | 
					      if (code === 0) { | 
				
			||||
 | 
					        this.list = data.map((item) => { | 
				
			||||
 | 
					          return item; | 
				
			||||
 | 
					        }); | 
				
			||||
 | 
					      } else { | 
				
			||||
 | 
					        this.$message.error(msg); | 
				
			||||
 | 
					      } | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    async fillIn(item) { | 
				
			||||
 | 
					      const { reportId } = item; | 
				
			||||
 | 
					      const url = "/oper/customize/icCustomerReport/preview"; | 
				
			||||
 | 
					      const parmas = { | 
				
			||||
 | 
					        ...this.elseParams, | 
				
			||||
 | 
					        reportId, | 
				
			||||
 | 
					      }; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      const { data, code, msg } = await requestPost(url, parmas); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					      if (code === 0) { | 
				
			||||
 | 
					        let token = localStorage.getItem("token"); | 
				
			||||
 | 
					        let prefix = window.SITE_CONFIG["apiURL"].slice(0, -4); | 
				
			||||
 | 
					        window.open( | 
				
			||||
 | 
					          `${prefix}/jmreport/view/${reportId}?token=${token}¶mKey=${data.paramKey}` | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        // this.visible = false; | 
				
			||||
 | 
					        this.$emit("afterFillIn"); | 
				
			||||
 | 
					      } else { | 
				
			||||
 | 
					        this.$message.error(msg); | 
				
			||||
 | 
					      } | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					}; | 
				
			||||
 | 
					</script> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<style lang="scss" scoped></style> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue