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
<template>
  <CompInfoSearch
    label="监管用户"
    placeholder="输入用户名称"
    @search="searchSVUser"
  >
    <template #selected="{ row }">
      <div>
        <el-text>编号:{{ row?.svUserId }}</el-text>
      </div>
      <el-space>
        <el-text>名称:{{ row?.svUserName }}</el-text>
        <el-button
          v-show="row?.svUserName"
          type="primary"
          icon="DocumentCopy"
          text
          circle
          @click="copySVUser(row?.svUserName)"
        />
      </el-space>
    </template>
    <template #default="{ row, click }">
      <ItemUser :item="row" @add="selectSVUser(row, click)" />
    </template>
  </CompInfoSearch>
</template>
<script setup>
import CompInfoSearch from './CompInfoSearch.vue';
import { useCloned } from '@vueuse/core';
import svUserApi from '@/api/fysp/userApi';
 
const props = defineProps({
  // 检索范围(包含行政区划、场景类型)
  area: Object
});
 
// 查询监管用户
function searchSVUser(param, callback) {
  const { text, page, pageSize } = param;
  const { cloned: area } = useCloned(props.area);
  area.value.sceneName = text;
  return svUserApi
    .searchUser(area.value, text, page, pageSize)
    .then((res) => {
      if (res.success) {
        const l = res.data.map((value) => {
          return {
            ...value,
            district: value.remark
          };
        });
        callback({
          data: l,
          total: res.head.totalCount
        });
      }
    })
    .finally(() => {
      callback();
    });
}
 
function selectSVUser(row, click) {
  const p = {
    svUserId: row.guid,
    svUserName: row.realname,
    ...row
  };
  click(p);
}
</script>