marketingPlan.vue 3.83 KB
<template>
  <div class="scrm-sub-client-container">
    <div class="pageContent">
      <GLCombiForm :formObj="searchForm" :formData="searchFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
      <GLTable v-loading="loading" :hasNum="true" @setTableHeightEvent="setTableHeightEvent" @setTableFinishFun="setTableFinishFun" ref="marketingPlan" :getListApi="getListApi" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" :tableParams="tableParams">
        <template slot="options" slot-scope="scope">
          <el-button class="blue-text" type="text" @click="goBasicInfo(scope.scope)">SOP分析</el-button>
          <el-button class="blue-text" type="text" @click="goBasicInfo(scope.scope)">编辑</el-button>
          <el-button class="blue-text" type="text" @click="confirm('delete')">删除</el-button>
          <el-button class="blue-text" type="text" @click="confirm(scope.scope)">结束</el-button>
        </template>
      </GLTable>
    </div>
  </div>
</template>

<script>
import { getTableList } from '@/api/modules/clientManage'
export default {
  data() {
    return {
      searchForm: {},
      searchFormList: [
        {
          type: 'input',
          inputType: 'text',
          // name: 'keyword',
          label: '人群名称'
        },
        {
          type: 'select',
          // name: 'type',
          label: '营销状态',
          optionLabel: 'label',
          optionId: 'value',
          optionList: [
            {
              label: '全部',
              value: ''
            }
          ],
          placeholder: '请选择'
        }
      ],
      getListApi: getTableList,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      tableParams: {
        listName: 'data',
        tableColumns: [
          {
            label: '人群名称',
            prop: 'orderNo'
          },
          {
            label: 'SOP名称',
            prop: 'name'
          },
          {
            label: '营销时间',
            prop: 'phone'
          },
          {
            label: '完成度',
            prop: 'dsdasd'
          },
          {
            label: '营销状态',
            prop: 'dsdasds'
          },
          {
            label: '操作',
            prop: 'options',
            addHtml: 'options'
          }
        ]
      }
    }
  },
  mounted() {
    //没数据的时候要算高度
    setTimeout(() => {
      if (!this.$refs.marketingPlan.data.length) {
        this.loading = true
        this.$refs.marketingPlan.setTableHeightFun()
        this.loading = false
      }
    }, 200)
  },
  methods: {
    // 确认删除或结束
    confirm(type) {
          this.$confirm(`是否确认${type == 'delete' ? '删除' : '结束'}?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.$message({
            type: 'success',
            message: '操作成功!'
          })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消操作'
          })
        })
    },
    setTableFinishFun() {
      this.$refs.marketingPlan.data.length ? (this.$refs.marketingPlan.tableHeightValues = '') : this.$refs.marketingPlan.setTableHeightFun()
    },
    setTableHeightEvent() {
      this.$refs.marketingPlan.setTableHeightFun()
    },
    // 搜索表格
    searchTable() {
      console.log(this.searchForm)
      this.$refs.marketingPlan.refreshTable()
    },
    //重置表格
    resetTable() {
      this.searchForm = {
        status: '',
        type: ''
      }
      this.$refs.marketingPlan.refreshTable()
    }
  }
}
</script>

<style lang="scss" scoped>
.pageContent {
  padding: 20px 20px 30px;
  box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
  background-color: #fff;
}
</style>