| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <template>
- <div class="app-container customer">
- <div class="filter-container">
- <el-date-picker
- v-model="searchDate"
- :picker-options="pickerOptions"
- class="filter-item"
- type="daterange"
- format="yyyy年MM月dd日"
- value-format="yyyy-MM-dd"
- align="left"
- unlink-panels
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"/>
- <el-input v-model="keyword" placeholder="请输入姓名,手机号码,固话" class="filter-item"/>
- <el-button type="primary" class="filter-item" icon="el-icon-search" @click="btn_search">搜索</el-button>
- <el-button type="primary" class="filter-item" icon="el-icon-plus" @click="btn_add">添加</el-button>
- <el-button v-permission="'HY_deletes'" type="primary" class="filter-item" icon="el-icon-delete" @click="btn_deletes">批量删除</el-button>
- </div>
- <el-table v-loading="loading" :data="dataLists" border stripe @selection-change="changeSelects">
- <el-table-column type="selection" width="40"/>
- <el-table-column type="index" label="编号" align="center" fixed width="80"/>
- <el-table-column prop="name" label="姓名" align="center" min-width=""/>
- <el-table-column prop="mobilephone" label="手机号码" align="center" min-width="110"/>
- <el-table-column prop="telephone" label="固话" align="center" min-width="110"/>
- <!-- <el-table-column prop="manager" label="转接经理" align="center" min-width="80"/> -->
- <el-table-column prop="provincename" label="所在省" align="center" min-width=""/>
- <el-table-column prop="cityname" label="所在市" align="center" min-width=""/>
- <el-table-column prop="address" label="具体地址" align="center" min-width=""/>
- <el-table-column label="创建人" align="center" min-width="110">
- <template slot-scope="scope">
- {{ scope.row.createuser + '-' + scope.row.createusername }}
- </template>
- </el-table-column>
- <el-table-column prop="createtime" label="创建时间" align="center" min-width="130"/>
- <el-table-column label="操作" width="240" align="center" class-name="oparate_btn" fixed="right">
- <template slot-scope="scope">
- <el-button v-show="scope.row.usercode !== null && scope.row.usercode !=='' " size="mini" plain type="primary" @click="btn_transfer(scope.row.id)">转移</el-button>
- <el-button size="mini" plain type="primary" @click="btn_edit(scope.row.id)">编辑</el-button>
- <el-button size="mini" plain type="danger" @click="btn_delete(scope.row.id)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="pageParams.total > 0"
- :total="pageParams.total"
- :pageindex.sync="pageParams.pageindex"
- :pagesize.sync="pageParams.pagesize"
- class="pagination"
- @pagination="getList" />
- </div>
- </template>
- <script>
- import { getCusUserLists, deleteCusUser } from '@/api/customer/customerManage'
- import addOrEdit from './addOrEdit'
- import transfer from './transfer'
- import { pickerOptions } from '@/utils'
- import Pagination from '@/components/Pagination' // 对el-pagination 二次封装
- export default {
- name: 'CustomerManage',
- components: {
- Pagination
- },
- data() {
- return {
- loading: false,
- keyword: '',
- searchDate: '',
- pickerOptions,
- pageParams: {
- pageindex: 1, // 当前第几页
- pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
- total: 0// 总共多少数据
- },
- multipleSelection: [], // 选中的数据
- dataLists: []// 列表数据
- }
- },
- created() {
- this.getList()
- document.onkeyup = (e) => {
- if (e.keyCode === 13) {
- this.getList()
- }
- }
- },
- methods: {
- getList() {
- this.loading = true
- return new Promise(resolve => {
- const params = {
- pageindex: this.pageParams.pageindex, // 第几页
- pagesize: this.pageParams.pagesize, // 每页几条信息
- key: this.keyword, // 否 string 模糊查询(姓名,手机号码,固话)
- stime: this.searchDate && this.searchDate[0], // 开始时间
- etime: this.searchDate && this.searchDate[1]// 结束时间
- }
- getCusUserLists(params).then(response => {
- this.loading = false
- if (response.state.toLowerCase() === 'success') {
- this.pageParams.total = response.data.total
- this.dataLists = response.data.rows
- }
- })
- resolve()
- })
- },
- // 复选框状态改变
- changeSelects(val) {
- this.multipleSelection = val
- },
- btn_search() {
- this.pageParams.pageindex = 1
- this.getList()
- },
- btn_add() {
- this.$layer.iframe({
- content: {
- content: addOrEdit, // 传递的组件对象
- parent: this, // 当前的vue对象
- data: { 'rowid': '' }// props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
- },
- area: ['60%', '90%'],
- title: '添加客户信息'
- })
- },
- btn_edit(editId) {
- this.$layer.iframe({
- content: {
- content: addOrEdit, // 传递的组件对象
- parent: this, // 当前的vue对象
- data: { 'rowid': editId }// props
- },
- area: ['60%', '90%'],
- title: '编辑客户信息'
- })
- },
- btn_delete(editId) {
- this.$confirm('您确定要将此客户信息删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteCusUser(editId).then(response => {
- if (response.state.toLowerCase() === 'success') {
- this.getList()
- this.$message.success('删除成功!')
- }
- })
- }).catch(() => {
- this.$message.info('已取消删除')
- })
- },
- btn_transfer(editId) {
- this.$layer.iframe({
- content: {
- content: transfer, // 传递的组件对象
- parent: this, // 当前的vue对象
- data: { 'rowid': editId }// props
- },
- area: ['30%', '30%'],
- title: '编辑客户信息'
- })
- },
- btn_deletes() {
- const ids = []
- for (let i = 0, len = this.multipleSelection.length; i < len; i++) {
- ids.push(this.multipleSelection[i].id)
- }
- if (ids.length <= 0) {
- this.$message.warning('没有可删除的选项')
- return
- }
- this.btn_delete(ids)
- }
- }
- }
- </script>
- <style rel="stylesheet/scss" lang="scss">
- .customer .filter-item.el-input{
- width: 260px;
- }
- </style>
|