jiangping
2023-08-21 2837bdd57f72e386bbf9a725e7b3a13e5eb9e930
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
<template>
  <!-- :permissions="['business:appliancechange:query']" -->
  <TableLayout>
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" label-suffix=":" inline>
      <el-form-item label="客户名称" prop="userName">
        <el-input v-model="searchForm.userName" placeholder="请输入客户名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
 
      <el-form-item label="操作类型" prop="updateType">
        <el-select v-model="searchForm.updateType" filterable clearable placeholder="请选择类型">
          <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value"></el-option>
        </el-select>
      </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>
      <el-table v-loading="isWorking.search" :data="tableData.list" stripe border>
        <el-table-column prop="companyId" label="客户编码" fixed="left" align="center" min-width="80px"></el-table-column>
        <el-table-column prop="shortName" label="客户简称" align="center" show-overflow-tooltip min-width="140px">
          <template slot-scope="{ row }">
            <el-button type="text" @click="showDetail(row)">{{ row.shortName }}</el-button>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="操作类型" align="center" min-width="100px">
          <template slot-scope="{ row }">
            <span>{{ typeToStr(row.updateType) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="detail" label="备注" align="center" min-width="180px"></el-table-column>
        <el-table-column prop="updateUser" label="操作人" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="createTime" label="操作时间" align="center" min-width="140px"></el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
    </template>
    <OperaClientDetailWindow ref="operaClientDetailWindow" />
  </TableLayout>
</template>
  
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaClientDetailWindow from '@/components/business/OperaClientDetailWindow'
import { findCompanyInfo } from '@/api/business/clientManger'
export default {
  name: 'ApplianceChange',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaClientDetailWindow },
  data() {
    return {
      // 搜索
      searchForm: {
        userName: '',
        updateType: '',
      },
      types: [
        { label: '启用', value: 1 },
        { label: '禁用', value: 2 },
        { label: '调整有效期', value: 3 },
        { label: '数据内容调整', value: 4 },
      ],
    }
  },
  created() {
    this.config({
      module: '客户管理',
      api: '/business/companyLog',
      'field.id': 'id',
      'field.main': 'id'
    })
 
    this.search()
  },
  methods: {
    typeToStr(v) {
      const tempType = this.types.find(item => item.value == v)
      return !!tempType ? tempType.label : '-'
    },
    showDetail(row) {
      // this.$refs.operaApplianceChangeDetailWindow.open('更换单详情', row)
      findCompanyInfo({ CompanyId: row.companyId })
        .then(res => {
          this.$refs.operaClientDetailWindow.open(res)
        })
        .catch(err => {
          this.$tip.error(err)
        })
    },
  }
}
/**
 *  
 */
</script>