yangfeng
2023-08-09 acdff03246ce648082192dfb069c3a006a7fbee6
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
<template>
  <div class="edit-selClient-box">
    <el-dialog
      :title="'销售线索'"
      :visible.sync="editConfig.editVisible"
      :width="dialogWidth"
      :before-close="handleClose"
      :append-to-body="true"
      :close-on-click-modal="false"
    >
      <div class="bg-view">
        <div class="query-bg">
          <el-input placeholder="请输入内容" v-model="queryInput" size="mini" class="input-with-select">
            <el-select v-model="select" slot="prepend" placeholder="请选择">
              <el-option label="全部字段" value="1"></el-option>
              <el-option label="客户名称" value="2"></el-option>
              <el-option label="商机状态" value="3"></el-option>
              <el-option label="商机来源" value="4"></el-option>
            </el-select>
          </el-input>
          <div class="btn">
            <el-button type="primary" size="mini" disabled>设置字段</el-button>
            <el-button type="primary" size="mini" disabled>快速创建</el-button>
          </div>
        </div>
        <el-table
          :data="tableData"
          border
          size="mini"
          v-loading="loading"
          :header-cell-style="{ background: '#f7f7f7' }"
        >
          <el-table-column label="客户名称" prop="name" show-overflow-tooltip>
            <template slot-scope="scope">
              <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商机状态" prop="businessStatus"></el-table-column>
          <el-table-column label="商机来源" prop="sales_sources_id"></el-table-column>
          <div slot="empty">
            <el-empty :image-size="100"></el-empty>
          </div>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { getSalesLeadsList } from "@/api/client/salesLead"
export default {
  name: "EditSelChanceDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          editVisible: false,
          title: "",
          infomation: {}
        }
      }
    }
  },
  components: {},
  computed: {},
  data() {
    return {
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
      tableData: [],
      searchSelOptions: [],
      loading: false
    }
  },
  created() {
    this.getData()
  },
  methods: {
    handleClose() {
      this.editConfig.editVisible = false
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSalesLeadsList()
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item
                }
              })
              this.tableData = list.slice(0, 5) || []
            } else {
              this.tableData = []
            }
          } else {
            this.tableData = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableData = []
          this.loading = false
        })
    },
    selNameClick(row) {
      this.editConfig.editVisible = false
      console.log(row)
      this.$emit("selClient", row, "lead")
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.bg-view {
  margin: 10px;
  .query-bg {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .el-input {
      width: 310px;
      .el-select {
        width: 100px;
      }
    }
    .btn {
      float: right;
    }
  }
}
.sel-name {
  color: $color-primary;
  cursor: pointer;
}
.dialog-footer {
  height: 40px;
  line-height: 40px;
  color: red;
}
::v-deep {
  .input-with-select .el-input-group__prepend {
    background-color: #fff;
  }
}
</style>