doum
2025-09-11 7298d5354963a88643a543b51b90192dc9fc934c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<template>
    <TableLayout :permissions="['business:member:query']">
        <!-- 搜索表单 -->
        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="120px" inline>
            <el-form-item label="车牌号" prop="code">
                <el-input v-model="searchForm.code" placeholder="请输入车牌号" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <el-form-item label="员工姓名/手机号" prop="memberName">
                <el-input v-model="searchForm.memberName" placeholder="请输入员工姓名/手机号" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <el-form-item label="部门" prop="companyName">
                <el-input v-model="searchForm.companyName" placeholder="请输入部门" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <section>
                <el-button type="primary" @click="search">搜索</el-button>
                <el-button @click="reset">重置</el-button>
            </section>
        </el-form>
        <!-- 表格和分页 -->
        <template v-slot:table-wrap>
            <ul class="toolbar" v-permissions="['business:member:create', 'business:member:delete']">
<!--                <li><el-button type="primary" @click="$refs.operaCarsWindow.open('新建车辆信息表')" icon="el-icon-plus" v-permissions="['business:member:create']">新建</el-button></li>-->
                <li><el-button type="primary" @click="syncCars"   v-permissions="['business:cars:sync']">同步</el-button></li>
            </ul>
            <el-table
                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 label="用户类型" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="row.memberType === 0">劳务访客</span>
                        <span v-if="row.memberType === 1">普通访客</span>
                        <span v-if="row.memberType === 2">内部人员</span>
                    </template>
                </el-table-column>
                <el-table-column prop="memberName" label="姓名" min-width="100px"></el-table-column>
                <el-table-column prop="memberPhone" label="手机号" min-width="100px"></el-table-column>
                <el-table-column prop="companyName" label="组织" min-width="100px"></el-table-column>
                <el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column>
            </el-table>
            <pagination
                @size-change="handleSizeChange"
                @current-change="handlePageChange"
                :pagination="tableData.pagination"
            >
            </pagination>
        </template>
        <!-- 新建/修改 -->
        <OperaCarsWindow ref="operaCarsWindow" @success="handlePageChange"/>
    </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaCarsWindow from '@/components/business/OperaCarsWindow'
import { sync } from '@/api/business/cars'
export default {
  name: 'Cars',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaCarsWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        code: '',
        memberName: '',
        companyName: ''
      }
    }
  },
  created () {
    this.config({
      module: '车辆信息表',
      api: '/business/cars',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    // 同步信息
    async syncCars () {
      const message = await sync({})
      this.$message.success(message)
      this.search()
    }
  }
}
</script>