| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <template>
- <base-form slot="content" ref="ruleForm" :data="searchData">
- <div slot="footer">
- <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
- <el-button :loading="listLoading" icon="el-icon-document" class="xl-form-btn bgc2" @click="toExportExcel">导出</el-button>
- </div>
- </base-form>
- </template>
- <script>
- export default {
- props: {
- listLoading: Boolean
- },
- inject: ['parentData'],
- mixins,
- data() {
- return {
- searchData: []
- }
- },
- mounted () {
- this.getDef()
- },
- methods: {
- subwayLineChange (val) {
- this.getDef('change')
- },
- getDef (str) {
- let params = { ...this.$refs.ruleForm.baseForm }
- this.searchData = [
- { label: '咨询客户', key: 'nickname' },
- { label: '置业经理', key: 'sale_id', type: 'selectRemote',
- remoteParams: { skey: 'sale_name', api: `user.admsaleuserlist?page_size=999`, opKey: 'sale_name', opVal: 'id' }
- },
- { label: '点击类型', key: 'click_type', type: 'select', options: this.$dictData.contact_click_type},
- { label: '目标类型', key: 'target_type', type: 'select', options: this.$dictData.contact_target_type},
- { label: '点击时间', label2: '开始时间', label3: '结束时间', key: 'startEndTime', type: 'datePicker', rules: 1},
- ]
- this.setDefaultValue(params, 'searchData')
- },
- toExportExcel () {
- const oldform = this.$refs.ruleForm.baseForm
- const newForm = { ...oldform }
- if (newForm.startEndTime) {
- newForm.start_at = newForm.startEndTime[0]
- newForm.end_at = newForm.startEndTime[1]
- delete newForm.startEndTime
- } else {
- this.$msgw('请选择导出的时间范围')
- return
- }
- const token = window.sessionStorage.getItem('fp_token')
- window.open(`https://api.honglouplus.com/adm/contact/click/export?token=${encodeURIComponent(token)}&target_type=${newForm.target_type}&start_at=${newForm.start_at}&end_at=${newForm.end_at}&sale_id=${newForm.sale_id}`)
- },
- searchHandle() {
- const oldform = this.$refs.ruleForm.baseForm
- const newForm = { ...oldform }
- if (newForm.startEndTime) {
- newForm.start_at = newForm.startEndTime[0]
- newForm.end_at = newForm.startEndTime[1]
- }
- delete newForm.startEndTime
- this.$emit('change', newForm)
- }
- }
- }
- </script>
|