 <template>
  <div class="app-container">


  <div class = "search-bx"  >

    <div class="search">

      <el-row :gutter="0">

          <!-- <el-select v-model="tableObj.getdataListParm.parammaps.customerId" placeholder="客户名称" class="filter-item" style="width: 120px;" clearable filterable remote :remote-method="change_custormer_remote" :loading="loading">
              <el-option v-for="(item,index) in customerNameList" :key="index" :label="item.name" :value="item.id" />
            </el-select> -->

            <!-- <el-autocomplete v-model="tableObj.getdataListParm.parammaps.customerName" :fetch-suggestions="customer_search" placeholder="客户名称" style="width: 200px " class="filter-item" @select="change_customer_select" @clear="clear_customer_select" @blur="customer_search_blur" clearable>
              <template slot-scope="{ item }">
                <span class="name">{{ item.name }}</span>
              </template>
            </el-autocomplete> -->
            <el-input v-model="tableObj.getdataListParm.parammaps.customerName" placeholder="客户名称" style="width: 180px;padding-bottom:10px;" class="filter-item" clearable />

            <el-select v-model="tableObj.getdataListParm.parammaps.groupId" placeholder="集团" class="filter-item" style="width: 120px;" clearable filterable>
              <el-option v-for="(item,index) in groupNameList" :key="index" :label="item.name" :value="item.id" />
            </el-select>

            <el-select v-model="tableObj.getdataListParm.parammaps.rangeName" placeholder="客户区域" class="filter-item" style="width: 120px;" clearable filterable>
              <el-option v-for="(item,index) in rangeNameList" :key="index" :label="item.name" :value="item.id" />
            </el-select>

            <el-date-picker v-model="tableObj.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="回访日期" end-placeholder="回访日期" style="width: 250px;" />

            <el-select v-model="tableObj.getdataListParm.parammaps.customeStatusName" placeholder="客户状态" class="filter-item" style="width: 120px;" clearable>
              <el-option v-for="(item,index) in customeStatusList" :key="index" :label="item.name" :value="item.id" />
            </el-select>

            <el-select v-model="tableObj.getdataListParm.parammaps.customeLevelName" placeholder="客户等级" class="filter-item" style="width: 120px;" clearable>
              <el-option v-for="(item,index) in customeLevelList" :key="index" :label="item.name" :value="item.id" />
            </el-select>

            <el-select v-model="tableObj.getdataListParm.parammaps.directorId" placeholder="负责人" class="filter-item" style="width: 100px;" clearable filterable>
              <el-option v-for="(item,index) in directorNameList" :key="index" :label="item.name" :value="item.id" />
            </el-select>

             <el-input v-model="tableObj.getdataListParm.parammaps.beginVisitCycle" placeholder="回访周期" style="width:80px"></el-input>
                -
            <el-input v-model="tableObj.getdataListParm.parammaps.endVisitCycle" placeholder="回访周期" style="width:80px"></el-input>


            <el-button class="successBorder" @click="form_search">查询</el-button>
            <el-button class="successBorder" @click="form_clear">重置</el-button>

            <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="form_add">设置周期</el-button>
            <!--   <el-button  class="success" icon="el-icon-upload2" @click="form_export">导出</el-button> -->


      </el-row>

    </div>
    <!-- <div class="operation">


      <el-row :gutter="0">
        <el-col :span="21">
          <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="form_add">设置回访周期</el-button>
        </el-col>
        <el-col :span="3">
            <el-dropdown>
              <el-button class="export">导出</el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="form_export(1)">导出模板</el-dropdown-item>
                <el-dropdown-item @click.native="form_export(2)">导出数据</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
        </el-col>
      </el-row>


    </div> -->

  </div>

    <div class="table"   >
      <el-table :key="tableObj.tableKey" v-loading="tableObj.listLoading" element-loading-text="给我一点时间" :data="tableObj.list" border fit highlight-current-row style="width: 100%;" :row-style="rowStyle" :cell-style="cellStyle" class="elTable table-fixed"  :max-height="myHeight" @selection-change="change_table_selection">
        <el-table-column type="selection" align="center" width="50" />
        <el-table-column label="序号" align="center" type="index" width="50px" fixed="left">
          <template slot-scope="scope">
            <span>{{ scope.$index + (tableObj.pageNum-1) * tableObj.pageSize + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户名称" min-width="90px" align="center" fixed="left">
          <template slot-scope="scope">
            <span  style = "color:#409EFF; cursor: pointer;" @click="click_customer(scope.row)">{{ scope.row.customerName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="负责人" min-width="90px" align="center" fixed="left">
          <template slot-scope="scope">
            <span>{{ scope.row.directorName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="最近回访时间" min-width="120px" align="center" fixed="left">
          <template slot-scope="scope">
            <span>{{ scope.row.returnVisitDate }}</span>
          </template>
        </el-table-column>
        <el-table-column label="回访周期(天)" min-width="120px" align="center" fixed="left">
          <template slot-scope="scope">
            <span>{{ scope.row.visitCycle }}</span>
          </template>
        </el-table-column>


        <el-table-column label="所属集团" min-width="90px" align="center" >
          <template slot-scope="scope">
            <span>{{ scope.row.groupName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户状态" min-width="110px" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.customeStatusName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户等级" min-width="110px" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.customeLevelName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户区域" min-width="110px" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.rangeName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="省份" min-width="110px" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.province }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户地址" min-width="110px" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.address }}</span>
          </template>
        </el-table-column>


        <el-table-column label="操作" align="center" :width="autoWidth"  fixed="right" v-if="autoWidth !== 0">
          <template slot-scope="{row}">
            <!-- <el-button v-if="isRoleEdit" class="miniSuccess" @click="form_edit(row)">编辑</el-button>
            <el-button v-if="isRoleEdit" class="miniDanger" @click="form_delete(row)">删除</el-button> -->

            <el-button v-if="isRoleEdit" class="miniSuccess" @click="form_edit(row)">设置回访周期</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="tableObj.total>=0" :total="tableObj.total" :page.sync="tableObj.getdataListParm.offset" :limit.sync="tableObj.getdataListParm.pagecount" @pagination="get_table_data" />
    </div>

    <!-- 新增/编辑 -->
    <el-dialog title="设置回访时间" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="40%">
      <div class="app-add">
        <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="150px" style="width: 80%;margin:0 auto 50px">

          <el-form-item label="回访周期：" prop="visitCycle"  >
            间隔<el-input ref="visitCycle" v-model="create.temp.visitCycle" class="filter-item" style="width:80px" />天，回访一次
          </el-form-item>


        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button class="cancelClose" @click="create.dialogFormVisible = false;get_table_data()">关闭</el-button>
          <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="create.dialogStatus==='create'?add_dialog_save():form_edit_save()">确认</el-button>
        </div>
      </div>
    </el-dialog>


    <!-- 客户详情 -->
    <el-dialog  title="客户详情" :visible.sync="seeCustomer.dialogFormVisible" top="10px"  :close-on-click-modal="false" width="95%">
      <div class="app-add">
        <CustomerDetail :customer-data="customerData"  />

        <div slot="footer" class="dialog-footer">
          <el-button class="cancelClose" @click="seeCustomer.dialogFormVisible = false;get_table_data()">关闭</el-button>

        </div>
      </div>
    </el-dialog>


  </div>
</template>

<script>
import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons, calculativeWidth } from '@/api/common'
import Cookies from 'js-cookie'
import {  parseTime , json2excel } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { MessageBox } from 'element-ui'
import { getToken } from '@/utils/auth'


import CustomerDetail from '@/componentView/CustomerDetail.vue'

export default {
  name: 'ReturnVisitManagement',
  components: { Pagination , CustomerDetail},
  data() {
    return {
      myHeight:document.documentElement.clientHeight - 85 - 160,
      hideUpload: false,

      isRoleEdit: [],


      restaurants: [],
      state: '',
      timeout: null,

      // 下拉框请求
      send_select_list: [
        // { name: 'getCustomerSelect', offset: 0, pagecount: 0, parammaps: {} },
        { name: 'getDictListSelect1', offset: 0, pagecount: 0, parammaps: { "pid": "54" } },
        { name: 'getEmployeesSelect', offset: 0, pagecount: 0, parammaps: {} },

      ],


      // 客户名称 - 下拉框
      customerNameList: [
        // {id: 1425, name: "测试12"},
        // {id: 1423, name: "朝日牧场（唯品牧场）"},
        // {id: 1422, name: "富源牧业（眉山）有限公司（眉山富源）"}
      ],
      loading: false,

      //集团 - 下拉框
      groupNameList: [
        {id: 253, name: "无"},
        {id: 207, name: "星连星牧业"},
        {id: 208, name: "海高牧业"},
        {id: 254, name: "完达山"}
      ],
      //客户区域 - 下拉框
      rangeNameList: [
        {id: "华北区域", name: "华北区域"},
        {id: "东北区域", name: "东北区域"},
        {id: "西北区域", name: "西北区域"},
        {id: "南方大区", name: "南方大区"}
       ],

      //客户状态 - 下拉框
      customeStatusList: [
        {id: "普通客户", name: "普通客户"},
        {id:  "欠款客户", name: "欠款客户"},
         {id: "准客户", name: "准客户"}
      ],

      //客户等级 - 下拉框
      customeLevelList:[
        {"id":"1级","name":"1级"},
        {"id":"2级","name":"2级"},
        {"id":"3级","name":"3级"},
      ],
      //负责人 - 下拉框
      directorNameList: [
        // {id: 18, name: "韩佳佳"},
        // {id: 19, name: "多秋阳"},
        // {id: 20, name: "张明星"},
      ],

      typeNameList: [],

      //表格请求参数~~
      tableObj: {
        getdataListParm: {
          name: 'getCustomerReturnVisit',
          page: 1,
          offset: 1,
          pagecount: parseInt(Cookies.get('pagecount')),
          returntype: 'Map',
          parammaps: {
            roleId: Cookies.get('g_roleId'),
            userId: Cookies.get('g_userId'),
            customerName: "",
            customerId: '',
            groupId: '',
            rangeName: '',
            customeStatusName: '',
            customeLevelName: '',
            directorId: '',

            beginVisitCycle: '',
            endVisitCycle: '',

            inputDatetime: '',
            beginDate: '',
            endDate: '',
          }
        },
        tableKey: 0,
        list: [
          // {"address":"1","createrId":"3072707379235128328","createrName":"管理员","createtime":"2022-05-11","customeLevelName":"2级","customeStatusName":"欠款客户","customerName":"测试12","directorId":24,"directorName":"康亮","enable":1,"groupId":207,"groupName":"星连星牧业","id":1425,"province":"1","rangeName":"西北区域","remark":"","scode":"123456789012345678","sort":1},
          // {"address":"山东省烟台市莱阳市沐浴店镇朝日绿源农业园","createrId":"3248184121834865668","createrName":"高占永","createtime":"2022-05-10","customeStatusId":199,"customeStatusName":"普通客户","customerName":"朝日牧场（唯品牧场）","directorId":30,"directorName":"高占永","enable":1,"groupId":253,"groupName":"无","id":1423,"province":"山东省","rangeId":"202","rangeName":"华北区域","remark":"","scode":"******************","sort":2},
          // {"address":"四川省眉山市青神县西龙镇万沟村4组","createrId":"3248184121834865668","createrName":"高占永","createtime":"2022-05-10","customeStatusId":199,"customeStatusName":"普通客户","customerName":"富源牧业（眉山）有限公司（眉山富源）","directorId":30,"directorName":"高占永","enable":1,"groupId":210,"groupName":"富源牧业","id":1422,"province":"四川省","rangeId":"205","rangeName":"南方大区","remark":"","scode":"******************","sort":3},
          // {"address":"","createrId":"3248184121834865667","createrName":"杨文山","createtime":"2022-05-06","customeStatusId":199,"customeStatusName":"普通客户","customerName":"科元克隆牧场","directorId":22,"directorName":"杨文山","enable":1,"groupId":253,"groupName":"无","id":1421,"province":"","rangeId":"","remark":"","scode":"123456789987654321","sort":4},

        ],
        total: 0,
        listLoading: true,
        temp: {}
      },
      download: {
        getdataListParm: {
          name: 'getCustomerReturnVisit',
          page: 1,
          offset: 1,
          pagecount: 0,
          returntype: 'Map',
          parammaps: {
            roleId: Cookies.get('g_roleId'),
            userId: Cookies.get('g_userId'),
            customerName: "",
            customerId: '',
            groupId: '',
            rangeName: '',
            customeStatusName: '',
            customeLevelName: '',
            directorId: '',

            beginVisitCycle: '',
            endVisitCycle: '',

            inputDatetime: '',
            beginDate: '',
            endDate: '',
          }
        },
        tableKey: 0,
        list: [
          // {"address":"1","createrId":"3072707379235128328","createrName":"管理员","createtime":"2022-05-11","customeLevelName":"2级","customeStatusName":"欠款客户","customerName":"测试12","directorId":24,"directorName":"康亮","enable":1,"groupId":207,"groupName":"星连星牧业","id":1425,"province":"1","rangeName":"西北区域","remark":"","scode":"123456789012345678","sort":1},
          // {"address":"山东省烟台市莱阳市沐浴店镇朝日绿源农业园","createrId":"3248184121834865668","createrName":"高占永","createtime":"2022-05-10","customeStatusId":199,"customeStatusName":"普通客户","customerName":"朝日牧场（唯品牧场）","directorId":30,"directorName":"高占永","enable":1,"groupId":253,"groupName":"无","id":1423,"province":"山东省","rangeId":"202","rangeName":"华北区域","remark":"","scode":"******************","sort":2},
          // {"address":"四川省眉山市青神县西龙镇万沟村4组","createrId":"3248184121834865668","createrName":"高占永","createtime":"2022-05-10","customeStatusId":199,"customeStatusName":"普通客户","customerName":"富源牧业（眉山）有限公司（眉山富源）","directorId":30,"directorName":"高占永","enable":1,"groupId":210,"groupName":"富源牧业","id":1422,"province":"四川省","rangeId":"205","rangeName":"南方大区","remark":"","scode":"******************","sort":3},
          // {"address":"","createrId":"3248184121834865667","createrName":"杨文山","createtime":"2022-05-06","customeStatusId":199,"customeStatusName":"普通客户","customerName":"科元克隆牧场","directorId":22,"directorName":"杨文山","enable":1,"groupId":253,"groupName":"无","id":1421,"province":"","rangeId":"","remark":"","scode":"123456789987654321","sort":4},

        ],
        total: 0,
        listLoading: true,
        temp: {}
      },

      //客户资料详情组件
      customerData:{ id:"" },

      dialogVisible: false,
      // 新增/编辑
      create: {
        dialogFormVisible: false,
        dialogStatus: '',
        temp: { pastureid: Cookies.get('pastureid'), visitCycle: '',id: '' },
        rules: {
          visitCycle: [{ required: true, message: '必填', trigger: 'blur' }],
        },
      },


      // 新增/编辑
      seeCustomer: {
        dialogFormVisible: false,
      },


      textMap: {
        create: '新增',
        see: '查看',
        update: '编辑'
      },

      autoWidth: 130,
      requestParam: {},
      isokDisable: false,
      selectList: [],
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' }
    }
  },

  created() {
    this.get_table_data()
    this.get_select_list()
    // this.get_auto_buttons()


  },

  methods: {

    //获取按钮权限
    get_auto_buttons() {
      const Edit = 'customerInformation:return:set'
      const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
      this.isRoleEdit = isRoleEdit


      //操作的宽度
      var widthCount = calculativeWidth(isRoleEdit) + 30
      this.autoWidth = widthCount
    },
    //获取所有下拉框的内容
    get_select_list() {
      GetDataByNames(this.send_select_list).then(response => {
        // this.customerNameList = response.data.getCustomerSelect.list
        // console.log("客户名称下拉框", this.customerNameList)
        this.groupNameList = response.data.getDictListSelect1.list
        console.log("集团下拉框", this.groupNameList)


        this.directorNameList = response.data.getEmployeesSelect.list
        console.log("负责人下拉框", this.directorNameList)

      })


    },


    //加载表格
    get_table_data() {
      this.tableObj.listLoading = true
      GetDataByName(this.tableObj.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {

          this.tableObj.list = response.data.list
          this.tableObj.pageNum = response.data.pageNum
          this.tableObj.pageSize = response.data.pageSize
          this.tableObj.total = response.data.total
        } else {
          this.tableObj.list = []
        }
        setTimeout(() => {
          this.tableObj.listLoading = false
        }, 100)
      })
    },


    //模糊查询客户
    customer_search(queryString, cb) {
      console.log('模糊查询输入值', queryString)
      GetDataByName({ name: 'getCustomerNameFuzzy', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputvalue: queryString } }).then(response => {
        this.customerNameList = response.data.list
        console.log("客户名称下拉框", response)
        cb(response.data.list)
        // this.$refs.elautocomplete.handleFocus()
      })
    },

    //模糊查询客户选择
    change_customer_select(item) {
      console.log('客户名称模糊查询选中值', item)
      this.tableObj.getdataListParm.parammaps.customerId = item.id
      this.tableObj.getdataListParm.parammaps.customerName = item.name

      this.$forceUpdate()

    },
    //清空客户选择
    clear_customer_select(item) {
      document.activeElement.blur()
      this.tableObj.getdataListParm.parammaps.customerId = ""
      this.tableObj.getdataListParm.parammaps.customerName = ""
      this.customerNameList = []
    },

    //客户失去焦点
    customer_search_blur(item) {
      console.log("客户失去焦点")
      this.tableObj.getdataListParm.parammaps.customerId = ""
      this.tableObj.getdataListParm.parammaps.customerName = ""
      this.customerNameList = []

    },


    //监听 - 表单查询
    form_search() {
      console.log('点击了查询', this.tableObj.getdataListParm.parammaps)
      if (this.tableObj.getdataListParm.parammaps.inputDatetime !== '' && this.tableObj.getdataListParm.parammaps.inputDatetime !== null) {
        this.tableObj.getdataListParm.parammaps.beginDate = parseTime(this.tableObj.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
        this.tableObj.getdataListParm.parammaps.endDate = parseTime(this.tableObj.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
      } else {
        this.tableObj.getdataListParm.parammaps.inputDatetime = ''
        this.tableObj.getdataListParm.parammaps.beginDate = ''
        this.tableObj.getdataListParm.parammaps.endDate = ''
      }

      this.tableObj.getdataListParm.offset = 1
      this.get_table_data()
    },

    //事件 - 清空查询信息
    form_clear() {
      console.log('点击了重置')
      this.tableObj.getdataListParm.parammaps.beginDate = ''
      this.tableObj.getdataListParm.parammaps.endDate = ''
      this.tableObj.getdataListParm.parammaps.inputDatetime = ''

      this.tableObj.getdataListParm.parammaps.customerName = ''
      this.tableObj.getdataListParm.parammaps.beginVisitCycle = ''
      this.tableObj.getdataListParm.parammaps.endVisitCycle = ''
      this.tableObj.getdataListParm.parammaps.customerId = ''
      this.tableObj.getdataListParm.parammaps.groupId = ''
      this.tableObj.getdataListParm.parammaps.rangeName = ''
      this.tableObj.getdataListParm.parammaps.customeStatusName = ''
      this.tableObj.getdataListParm.parammaps.customeLevelName = ''

      this.tableObj.getdataListParm.parammaps.directorId = ''
      this.tableObj.getdataListParm.offset = 1
      this.get_table_data()
    },

    //事件 - 清空所有表单信息
    form_reset() {
      this.create.temp = { pastureid: Cookies.get('pastureid'), customerName: '', groupId: '', customeStatusName: '', customeLevelName: '', rangeName: '', province: '', address: '', directorId: '',createrName: Cookies.get('employename'), director: '', creater: '', createtime: parseTime(new Date(), '{y}-{m}-{d}'), remark: '', scode: '' }
    },
    //监听 - 表格 - 勾选
    change_table_selection(val) {
      console.log('勾选数据', val)
      this.selectList = val
    },


    //监听 - 弹窗 - 新增
    form_add() {
      console.log('点击了新增',this.selectList)
      if (this.selectList.length == 0) {
        this.$message({ type: 'error', message: '请选择客户信息', duration: 2000 })
      } else {
        this.form_reset()
        this.create.dialogStatus = 'create'
        this.create.dialogFormVisible = true
      }

    },
    //监听 - 弹窗 - 新增保存
    add_dialog_save() {
      console.log('点击了新增保存')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['temp'].validate(valid => {
        if (valid) {
          this.isokDisable = true
          setTimeout(() => {
            this.isokDisable = false
          }, 1000)


           var idArr = []
           this.selectList.forEach(function(item){
             idArr.push(item.id)
           })

           var send_data = {
            name: 'updateCustomerVisitCycle',
            parammaps: {
              visitCycle: this.create.temp.visitCycle,
              id: idArr.join()
            }
          }

          PostDataByName(send_data).then(response => {
                console.log('新增保存发送参数', send_data)
                if (response.msg !== 'fail') {
                  this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
                  this.create.dialogFormVisible = false
                  this.get_table_data()
                } else {
                  this.$notify({ title: '失败', message: '保存失败', type: 'error', duration: 2000 })
                }
          })


        }
      })
    },

    //查看客户信息
    click_customer(row) {
      console.log('查看客户信息卡片', row)

      this.customerData.id = row.id
      this.seeCustomer.dialogFormVisible = true

    },


    //监听 - 弹窗 - 编辑
    form_edit(row) {
      console.log('点击了编辑', row)

      this.create.temp = Object.assign({}, row)
      this.create.temp.id = row.id

      this.create.dialogStatus = 'update'
      this.create.dialogFormVisible = true
    },

    //监听 - 弹窗 - 编辑保存
    form_edit_save() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['temp'].validate(valid => {
        if (valid) {
          this.isokDisable = true
          setTimeout(() => {
            this.isokDisable = false
          }, 1000)
          //验证名字是否存在
          this.create.temp.type = "update"
          var send_data = {
            name: 'updateCustomerVisitCycle',
            parammaps: {
              visitCycle: this.create.temp.visitCycle,
              id: this.create.temp.id
            }
          }

          PostDataByName(send_data).then(response => {
                console.log('编辑保存发送参数', send_data)
                if (response.msg !== 'fail') {
                  this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
                  this.create.dialogFormVisible = false
                  this.get_table_data()
                } else {
                  this.$notify({ title: '失败', message: '保存失败', type: 'error', duration: 2000 })
                }
          })


        }
      })
    },


    // 导出
    form_export(item) {
      GetDataByName(this.download.getdataListParm).then(response => {
        if (response.data.list !== null) {
          this.download.list = response.data.list
        } else {
          this.download.list = []
        }
        var excelDatas = [
          {
            tHeader: ['序号', '客户名称', '负责人', '最近回访时间', '回访周期', '所属集团', '客户状态', '客户等级', '客户区域', '省份', '客户地址'],
            filterVal: ['sort', 'customerName', 'directorName', 'returnVisitDate', 'visitCycle', 'groupName', 'customeStatusName', 'customeLevelName', 'rangeName', 'province', 'address'],
            tableDatas: this.download.list,
            sheetName: 'Sheet1'
          }
        ]
        json2excel(excelDatas, '回访管理', true, 'xlsx')
      })
    },

    // 导入
    form_inport() {
      console.log('点击了导入')
    }

  }
}
</script>


<style lang="scss" scoped>
.search {
  padding-top: 10px;
  clear: both;
}
.table {
  margin-top: 10px;
}
#uploadPic1 {
  width: 900px;
}
#uploadPic2 {
  width: 900px;
}
#uploadPic {
  width: 900px;
}
</style>


<style>
.hide .el-upload--picture-card {
  display: none;
}
</style>
