<template> 
 | 
  <TableLayout :permissions="['business:jkcustomer:query']"> 
 | 
    <!-- 搜索表单 --> 
 | 
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> 
 | 
      <el-form-item label="客户简码" prop="code"> 
 | 
        <el-input v-model="searchForm.code" placeholder="请输入客户简码" clearable @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="客户名称" prop="name"> 
 | 
        <el-input v-model="searchForm.name" placeholder="请输入客户名称" clearable @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="地址" prop="location"> 
 | 
        <el-input v-model="searchForm.location" placeholder="请输入地址"  clearable @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="配送周期" prop="lineWeeks"> 
 | 
        <el-select v-model="searchForm.lineWeeks" clearable filterable placeholder="请选择配送周期"  @change="search"> 
 | 
          <el-option v-for="item in weeksList" :key="item" :label="item" :value="item"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="所属主线路" prop="categoryId"> 
 | 
        <el-select v-model="searchForm.categoryId" clearable filterable placeholder="请选择所属主线路"  @change="loadLines();search()"> 
 | 
          <el-option v-for="item in categoryList" :key="item.id" :label="item.name" :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="送货线路" prop="lineId"> 
 | 
        <el-select v-model="searchForm.lineId" clearable filterable placeholder="请选择送货线路"  @change="search"> 
 | 
          <el-option v-for="item in lineList" :key="item.id" :label="item.name" :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="交通规划状态" prop="distanceStatus"> 
 | 
        <el-select v-model="searchForm.distanceStatus" clearable filterable placeholder="请选择交通规划状态"  @change="search"> 
 | 
          <el-option  :value="2" label="未定位"></el-option> 
 | 
          <el-option  :value="0" label="未规划"></el-option> 
 | 
          <el-option  :value="1" label="已规划"></el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <section> 
 | 
        <el-button type="primary" @click="search">搜索</el-button> 
 | 
        <el-button type="primary" :loading="isWorking.export" v-permissions="['business:jkcustomer:exportExcel']" @click="exportExcel">导出</el-button> 
 | 
        <el-button @click="reset">重置</el-button> 
 | 
      </section> 
 | 
    </el-form> 
 | 
    <!-- 表格和分页 --> 
 | 
    <template v-slot:table-wrap> 
 | 
      <ul class="toolbar" v-permissions="['business:jkcustomer:create', 'business:jkcustomer:delete']"> 
 | 
<!-- 
 | 
        <li><el-button type="primary" @click="$refs.operaJkCustomerWindow.open('新建交控-客户信息表')" icon="el-icon-plus" v-permissions="['business:jkcustomer:create']">新建</el-button></li> 
 | 
--> 
 | 
        <li><el-button icon="el-icon-upload"  type="primary" @click="$refs.OperaJkCustomerImportWindowRef.open('客户导入')"  v-permissions="['business:jkcustomer:create']">客户导入</el-button></li> 
 | 
        <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:jkcustomer:delete']">删除</el-button></li> 
 | 
      </ul> 
 | 
      <el-table 
 | 
          :height="tableHeightNew" 
 | 
        v-loading="isWorking.search" 
 | 
        :data="tableData.list" 
 | 
        stripe 
 | 
        @selection-change="handleSelectionChange" 
 | 
      > 
 | 
        <el-table-column type="selection" width="55"></el-table-column> 
 | 
        <el-table-column prop="code" label="客户简码" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="name" label="客户名称" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="location" label="地址" min-width="200px" show-tooltip-when-overflow></el-table-column> 
 | 
        <el-table-column prop="locationInfo" label="经纬度" min-width="150px">  </el-table-column> 
 | 
        <el-table-column prop="lineWeeks" label="配送周期" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="lineName" label="送货线路" min-width="200px" show-tooltip-when-overflow></el-table-column> 
 | 
        <el-table-column prop="categoryName" label="所属主线路" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="sortno" label="序号" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="distanceStatus" label="交通规划状态" min-width="100px" align="center"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span v-if="row.distanceStatus === 2" class="red">未定位</span> 
 | 
            <span v-else-if="row.distanceStatus === 1" class="green">已规划</span> 
 | 
            <span v-else class="blue">未规划</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="editDate" label="更新时间" min-width="140px"></el-table-column> 
 | 
        <el-table-column 
 | 
          v-if="containPermissions(['business:jkcustomer:update', 'business:jkcustomer:delete'])" 
 | 
          label="操作" 
 | 
          min-width="120" 
 | 
          fixed="right" 
 | 
        > 
 | 
          <template slot-scope="{row}"> 
 | 
            <el-button type="text" @click="$refs.operaJkCustomerWindow.open('编辑客户信息', row)" icon="el-icon-edit" v-permissions="['business:jkcustomer:update']">编辑</el-button> 
 | 
            <el-button type="text" style="color: red" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:jkcustomer:delete']">删除</el-button> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
      </el-table> 
 | 
      <pagination 
 | 
        @size-change="handleSizeChange" 
 | 
        @current-change="handlePageChange" 
 | 
        :pagination="tableData.pagination" 
 | 
      > 
 | 
      </pagination> 
 | 
    </template> 
 | 
    <!-- 新建/修改 --> 
 | 
    <OperaJkCustomerWindow ref="operaJkCustomerWindow" @success="handlePageChange"/> 
 | 
    <OperaJkCustomerImportWindow ref="OperaJkCustomerImportWindowRef" @success="handlePageChange" /> 
 | 
  </TableLayout> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import BaseTable from '@/components/base/BaseTable' 
 | 
import TableLayout from '@/layouts/TableLayout' 
 | 
import Pagination from '@/components/common/Pagination' 
 | 
import OperaJkCustomerWindow from '@/components/business/OperaJkCustomerWindow' 
 | 
import OperaJkCustomerImportWindow from '@/components/business/OperaJkCustomerImportWindow' 
 | 
import { fetchCateList } from '@/api/business/category' 
 | 
import { allList } from '@/api/business/jkLine' 
 | 
export default { 
 | 
  name: 'JkCustomer', 
 | 
  extends: BaseTable, 
 | 
  components: { TableLayout, Pagination, OperaJkCustomerWindow, OperaJkCustomerImportWindow }, 
 | 
  data () { 
 | 
    return { 
 | 
      // 搜索 
 | 
      searchForm: { 
 | 
        id: '', 
 | 
        categoryId: '', 
 | 
        name: '', 
 | 
        code: '', 
 | 
        distanceStatus: '', 
 | 
        location: '', 
 | 
        lineWeeks: '', 
 | 
        lineId: '', 
 | 
        status: '', 
 | 
        sortnum: '' 
 | 
      }, 
 | 
      categoryList: [], 
 | 
      lineList: [], 
 | 
      weeksList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] 
 | 
    } 
 | 
  }, 
 | 
  created () { 
 | 
    this.config({ 
 | 
      module: '交控-客户信息表', 
 | 
      api: '/business/jkCustomer', 
 | 
      'field.id': 'id', 
 | 
      'field.main': 'id' 
 | 
    }) 
 | 
    this.search() 
 | 
    this.loadCategory() 
 | 
    this.loadLines() 
 | 
  }, 
 | 
  methods: { 
 | 
    loadCategory () { 
 | 
      fetchCateList({ 
 | 
        type: 4 
 | 
      }).then(res => { 
 | 
        this.categoryList = res 
 | 
      }) 
 | 
    }, 
 | 
    loadLines () { 
 | 
      this.searchForm.lineId ='' 
 | 
      allList({ 
 | 
        categoryId: this.searchForm.categoryId 
 | 
      }).then(res => { 
 | 
        this.lineList = res 
 | 
      }) 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</script> 
 |