123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <div>
- <el-dialog
- title="报告模板"
- :visible.sync="visible"
- width="600px"
- append-to-body
- :close-on-click-modal="false"
- :modal="false"
- v-loading="loading"
- :before-close="close">
- <div style="height: calc(100vh - 300px)">
-
- <el-container>
- <el-main class="height_100" :loading="loading">
- <el-table
- class="copyTable"
- :data="tableData"
- style="width: 100%"
- row-key="id"
- >
- <el-table-column prop="index" label="序号" width="100px">
- <template slot-scope="scope">
- <div>
- {{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" label="名称">
- <template slot-scope="scope">
- <div>
- <el-link type="primary" @click="chooseReportTemplate(scope.row)">{{ scope.row.templateName }}</el-link>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-main>
- <el-footer class="pagination">
- <el-pagination
- background
- layout="total, sizes, prev, pager, next, jumper"
- :current-page.sync="queryParams.current"
- :page-size.sync="queryParams.size"
- @current-change="handleCurrentChange"
- @size-change="changeSize"
- :total="total"
- >
- </el-pagination>
- </el-footer>
- </el-container>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- components: {},
- props: {
- },
- data() {
- return {
- visible:false,
- tableData:[],
- loading:false,
- queryParams:{
- current:1,
- size:10
- },
- total:0,
- projectId:null,
- };
- },
- watch: {},
- computed: {},
- created() {},
- mounted() {},
- methods: {
- otherTemplate(){
- let router = this.$router.resolve({
- path: '/exportReportByFile',
- query: {
- }
- })
- window.open(router.href, '_blank')
- },
- open(projectId){
- this.projectId = projectId
- this.queryParams.current = 1
- this.getReportTemplate()
- this.visible = true
- },
- //获取模板
- getReportTemplate(){
- this.loading = true
- this.$api.queryNoveltyTemplate({}).then(response=>{
- if(response.code = 200){
- this.tableData = response.data.data
- this.total = response.data.total
- this.loading = false
- }
- }).catch(error=>{
- this.tableData = []
- this.total = 0
- this.loading = false
- })
- },
- close(){
- this.visible = false
- },
- handleCurrentChange(val){
- this.queryParams.current = val
- this.getReportTemplate()
- },
- changeSize(val){
- this.queryParams.current = 1
- this.queryParams.size = val
- this.getReportTemplate()
- },
- chooseReportTemplate(row){
- var params = {
- projectId:this.projectId,
- templateId:row.id,
- }
- var message = this.$message({
- message: '报告生成中...',
- type: 'warning',
- duration:0
- });
- this.loading = true
- this.$api.editNoveltyReport(params).then(response=>{
- if(response.code == 200){
- message.close()
- this.$message.success('报告生成成功')
- this.loading = false
- this.toEdit(response.data)
- }
- }).catch(error=>{
- message.close()
- this.$message.error('报告生成失败')
- })
- // let router = this.$router.resolve({
- // path: '/exportReport',
- // query: {
- // reportTemplateId: row.id,
- // // path:row.configMessage,
- // projectId: this.projectId,
- // }
- // })
- // window.open(router.href, '_blank')
- },
- toEdit(id){
- let params = {
- projectId: this.projectId,
- current:1,
- size:1,
- id:id
- }
- var api = 'queryNoveltyReport'
- this.$api[api](params).then(res => {
- if (res.code == 200) {
- var data = res.data.data
- if(data && data.length){
- let router = this.$router.resolve({
- path: '/onlyOffice',
- query: {
- projectId:this.projectId,
- guid:data[0].fileGuid,
- title:data[0].referencesName
- }
- })
- window.open(router.href, '_blank')
- }
- this.loading = false
- }
- }).catch(error => {
- this.loading = false
- })
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .head{
- display: flex;
- justify-content: flex-end;
- }
- </style>
|