|
@@ -1,8 +1,13 @@
|
|
|
<template>
|
|
|
- <div class='select-report-example-container'>
|
|
|
- <common-dialog-select v-model='show' :title='title' :list='list' @select='doSelect'>
|
|
|
+ <div class="select-report-example-container">
|
|
|
+ <common-dialog-select
|
|
|
+ v-model="show"
|
|
|
+ :title="title"
|
|
|
+ :list="list"
|
|
|
+ @select="doSelect"
|
|
|
+ >
|
|
|
</common-dialog-select>
|
|
|
- <div class='select-report-example-slot' @click='doShow(true)'>
|
|
|
+ <div class="select-report-example-slot" @click="doShow(true)">
|
|
|
<slot></slot>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -13,36 +18,56 @@ import CommonDialogSelect from '@/ui/dialog-select/select.vue'
|
|
|
import { ajaxGetReportExample } from '@/api/modules'
|
|
|
export default {
|
|
|
name: 'select-report-example',
|
|
|
+ props: {
|
|
|
+ name: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
components: {
|
|
|
- CommonDialogSelect,
|
|
|
+ CommonDialogSelect
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
show: false,
|
|
|
title: '请选择报告样例类型',
|
|
|
list: []
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
this.doInit()
|
|
|
+ console.log(this.name)
|
|
|
},
|
|
|
methods: {
|
|
|
- async doInit () {
|
|
|
+ async doInit() {
|
|
|
const { error_code: code, data } = await ajaxGetReportExample()
|
|
|
if (code === 0 && data) {
|
|
|
this.list = data
|
|
|
}
|
|
|
},
|
|
|
- doSelect (item) {
|
|
|
- console.log('item', item)
|
|
|
+ doSelect(item) {
|
|
|
this.goExample(item)
|
|
|
},
|
|
|
- doShow (type) {
|
|
|
- this.show = type
|
|
|
+ doShow(type) {
|
|
|
+ if (this.name && this.list.length) {
|
|
|
+ const item = this.list.find((v) => v.name.includes(this.name))
|
|
|
+ if (item) {
|
|
|
+ this.doSelect(item)
|
|
|
+ } else {
|
|
|
+ this.show = type
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.show = type
|
|
|
+ }
|
|
|
},
|
|
|
- getType (type) {
|
|
|
- const typeList = [null, '项目分析报告', '竞争对手分析报告', '采购单位分析报告']
|
|
|
- const index = typeList.findIndex(v => type.indexOf(v) !== -1)
|
|
|
+ getType(type) {
|
|
|
+ const typeList = [
|
|
|
+ null,
|
|
|
+ '项目分析报告',
|
|
|
+ '竞争对手分析报告',
|
|
|
+ '采购单位分析报告'
|
|
|
+ ]
|
|
|
+ const index = typeList.findIndex((v) => type.indexOf(v) !== -1)
|
|
|
return index
|
|
|
},
|
|
|
goExample({ url, name }) {
|
|
@@ -60,6 +85,4 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang='scss'>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped lang="scss"></style>
|