eight
2024-08-13 b10adc8a3fd000901836e2219fa83462694e9866
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
<template>
  <el-table :data="contacts" :show-overflow-tooltip="true" :stripe="true" height="150">
    <el-table-column label="姓名" fixed="left" align="center" prop="name">
      <template #default="scope">
        <el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
          {{ scope.row.name }}
        </el-link>
      </template>
    </el-table-column>
    <el-table-column label="手机号" align="center" prop="mobile" />
    <el-table-column label="职位" align="center" prop="post" />
    <el-table-column label="直属上级" align="center" prop="parentName" />
    <el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
      <template #default="scope">
        <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
      </template>
    </el-table-column>
    <el-table-column align="center" fixed="right" label="操作" width="130">
      <template #default="scope">
        <el-button link type="danger" @click="handleDelete(scope.row.id)"> 移除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>
 
<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
 
const props = defineProps<{
  contacts: undefined
}>()
const formData = ref([])
 
/** 初始化联系人列表 */
watch(
  () => props.contacts,
  async (val) => {
    formData.value = val
  },
  { immediate: true }
)
 
/** 删除按钮操作 */
const handleDelete = (index: number) => {
  formData.value.splice(index, 1)
}
</script>