liukangdong
2025-02-27 e80fb1e51d652d0ccecc27688c72a168c8297075
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<template>
  <div class="main_app">
 
    <div ref="QueryFormRef">
      <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
    </div>
    <div class="query_btns" style="margin: 16px 0 0"
      v-permissions="['business:visits:create', 'business:visits:exportExcel']">
      <el-button type="primary" @click="handleEdit()" icon="el-icon-plus"
        v-permissions="['business:visits:create']">新建</el-button>
      <el-button type="primary" :loading="exLoading" @click="exportExcel"
        v-permissions="['business:visits:exportExcel']">导出</el-button>
    </div>
    <el-table :max-height="tableHeight" v-loading="loading" :data="dataList" stripe row-key="id" default-expand-all>
      <el-table-column type="selection" width="55" align="center"></el-table-column>
      <el-table-column prop="carNos" label="入园车辆" min-width="100px"></el-table-column>
      <el-table-column prop="companyName" label="公司名称" min-width="100px"></el-table-column>
      <el-table-column prop="name" label="联系人信息" min-width="100px"></el-table-column>
      <el-table-column prop="phone" label="手机号" min-width="100px"></el-table-column>
      <el-table-column prop="receptMemberName" label="被访人" min-width="100px"></el-table-column>
      <el-table-column label="拜访时间" min-width="160px">
        <template slot-scope="{ row }">
          <span>起:{{ row.starttime }}</span><br />
          <span>止:{{ row.endtime }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="reason" label="拜访事由" min-width="100"></el-table-column>
      <el-table-column prop="status" fixed="right" label="状态" align="center" min-width="100">
        <template slot-scope="{ row }">
          <span style="color: rgba(245, 154, 35, 0.996)" v-if="row.status === 0">待提交审批</span>
          <span v-if="row.status === 1" style="color: rgba(245, 154, 35, 0.996)">处理中</span>
          <span v-if="row.status === 2" style="color: rgba(245, 154, 35, 0.996)">已同意</span>
          <span style="color: gray" v-if="row.status === 3">已拒绝</span>
          <span v-if="row.status === 4" style="color: gray">取消</span>
          <span v-if="row.status === 5" style="color: green">下发成功</span>
          <span v-if="row.status === 6" style="color: gray">下发失败</span>
          <span v-if="row.status === 7" style="color: green">拜访中</span>
          <span v-if="row.status === 8" style="color: red">已签离</span>
          <span v-if="row.status === 9" style="color: gray">已失效</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="180" fixed="right">
        <template slot-scope="{ row }">
          <el-button type="text" @click="handleDetail(row)" v-permissions="['business:company:update']">查看详情</el-button>
          <el-button type="text" icon="el-icon-delete" @click="deleteById(row)" style="color: red"
            v-permissions="['business:visits:delete']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination class="mt10" @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
    <ReportDetail v-if="isShowReport" ref="VisReportDetailRef" />
    <OperaVisitsReportWindow @close="isShowEdit = false" @success="getList" v-if="isShowEdit"
      ref="operaVisitsWindowRef" />
  </div>
</template>
 
<script>
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
// import ReportDetail from './page-components/ReportDetail.vue'
import ReportDetail from '@/views/task/visReportDetail.vue'
import OperaVisitsReportWindow from '@/components/business/operaVisitsReportWindow.vue'
import { fetchList, exportExcel, deleteById } from '@/api/business/visits'
export default {
  components: {
    ReportDetail,
    QueryForm,
    Pagination,
    OperaVisitsReportWindow
  },
  data() {
    return {
      isShowEdit: false,
      exLoading: false,
      tableHeight: 400,
 
      isShowReport: false,
      activeTab: '0',
      filters: {
        type: 2
      },
      dataList: [],
      queryFormConfig: {
        formItems: [
          {
            filed: 'carNos',
            type: 'input',
            label: '车牌号'
          },
          {
            filed: 'companyName',
            type: 'input',
            label: '公司名称'
          }
        ],
        online: true
      },
      loading: false,
      sorting: false,
      searchForm: {
        // type: 1
      },
      pagination: {
        capacity: 10,
        page: 1,
        total: 0
      },
      total: 0
    }
  },
  created() {
    this.getList()
  },
  mounted() {
    this.$nextTick(() => {
      this.tableHeight = document.body.scrollHeight - this.$refs.QueryFormRef.offsetHeight - 300
    })
  },
  methods: {
    exportExcel() {
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.exLoading = true
          exportExcel({
            page: this.pagination.page,
            capacity: 1000000,
            model: this.filters
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.exLoading = false
            })
        })
    },
    handleEdit() {
      this.isShowEdit = true
      this.$nextTick(() => {
        this.$refs.operaVisitsWindowRef.isShowModal = true
      })
    },
    deleteById(row) {
      this.$confirm('确定删除该记录吗, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteById(row.id)
          .then(res => {
            this.$message.success('操作成功')
            this.page = 1
            this.getList()
          })
      }).catch(() => {
      })
    },
    handleDetail(row) {
      this.isShowReport = true
      this.$nextTick(() => {
        this.$nextTick(() => {
          this.$refs.VisReportDetailRef.id = row.id
          this.$refs.VisReportDetailRef.type = 1
          this.$refs.VisReportDetailRef.getDetail()
          this.$refs.VisReportDetailRef.isShowModal = true
        })
      })
    },
    getList(page) {
      const { pagination, filters } = this
      pagination.page = page || pagination.page
      fetchList({
        model: { ...filters },
        ...pagination
      }).then(res => {
        this.dataList = res.records || []
        this.pagination.total = res.total
      })
    },
    clear() {
      this.filters = {
        type: 2
      }
      this.getList(0)
    },
    handleSizeChange(capacity) {
      this.pagination.capacity = capacity
      this.getList()
    }
  }
}
</script>
 
<style lang="scss" scoped></style>