Blame view

src/components/staff/selectStaffsDiv.vue 3.29 KB
1d73dc48   wuxw   继续晚上巡检功能
1
  <template>
0a06b2d1   wuxw   开发完成投诉建议
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    <el-row :gutter="20">
      <el-col :span="6" class="border-right">
        <div class="text-center">
          <h4>{{ $t('selectStaff.orgInfo') }}</h4>
        </div>
        <div class="tree-container">
          <org-tree-show @org-selected="handleNodeClick" />
        </div>
      </el-col>
  
      <el-col :span="6" class="border-right">
        <div class="text-center">
          <h4>{{ $t('selectStaff.staffInfo') }}</h4>
        </div>
        <div class="staff-list">
          <div v-for="staff in staffList" :key="staff.staffId" class="staff-item"
            :class="{ selected: currentStaffId === staff.userId }" @click="selectStaff(staff)">
            <i class="el-icon-user"></i>
            <span>{{ staff.name }}</span>
            <div>{{ staff.tel }}</div>
1d73dc48   wuxw   继续晚上巡检功能
22
          </div>
0a06b2d1   wuxw   开发完成投诉建议
23
24
25
26
27
28
29
30
31
32
33
        </div>
      </el-col>
  
      <el-col :span="6">
        <div class="text-center">
          <h4>{{ $t('selectStaff.selectedStaff') }}</h4>
        </div>
        <div class="selected-staff">
          <div v-for="staff in selectedStaffs" :key="staff.userId" class="selected-item">
            <span>{{ staff.name }}</span>
            <i class="el-icon-close remove-icon" @click="removeStaff(staff)"></i>
1d73dc48   wuxw   继续晚上巡检功能
34
          </div>
0a06b2d1   wuxw   开发完成投诉建议
35
36
37
38
        </div>
      </el-col>
    </el-row>
  </template>
56c7fec9   wuxw   巡检功能测试完成
39
  
0a06b2d1   wuxw   开发完成投诉建议
40
41
42
43
44
  <script>
  import { listStaffsByOrgId } from '@/api/inspection/inspectionPlanApi'
  import OrgTreeShow from '@/components/org/OrgTreeShow'
  
  export default {
27dcfde5   wuxw   系统全面测试完成
45
    name: 'SelectStaffsDiv',
0a06b2d1   wuxw   开发完成投诉建议
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    components: {
      OrgTreeShow
    },
    data() {
      return {
        staffList: [],
        selectedStaffs: [],
        currentStaffId: null,
        currentOrgId: null
      }
    },
    methods: {
      setStaffs(staffs) {
        this.selectedStaffs = [...staffs]
      },
  
      getSelectedStaffs() {
        return this.selectedStaffs
1d73dc48   wuxw   继续晚上巡检功能
64
      },
0a06b2d1   wuxw   开发完成投诉建议
65
66
67
68
69
70
71
72
73
74
75
76
  
      async handleNodeClick(node) {
        this.currentOrgId = node.id
        try {
          const { staffs } = await listStaffsByOrgId({
            orgId: node.id,
            page: 1,
            row: 100
          })
          this.staffList = staffs
        } catch (error) {
          console.error('Failed to load staffs:', error)
1d73dc48   wuxw   继续晚上巡检功能
77
78
        }
      },
0a06b2d1   wuxw   开发完成投诉建议
79
80
81
82
83
84
85
86
87
88
  
      selectStaff(staff) {
        this.currentStaffId = staff.userId
        // 检查是否已选择
        const isSelected = this.selectedStaffs.some(s => s.userId === staff.userId)
        if (!isSelected) {
          this.selectedStaffs.push({
            userId: staff.userId,
            name: staff.userName
          })
1d73dc48   wuxw   继续晚上巡检功能
89
        }
0a06b2d1   wuxw   开发完成投诉建议
90
91
92
93
94
        this.$emit('selectStaffs', this.selectedStaffs)
      },
  
      removeStaff(staff) {
        this.selectedStaffs = this.selectedStaffs.filter(s => s.staffId !== staff.staffId)
1d73dc48   wuxw   继续晚上巡检功能
95
96
      }
    }
0a06b2d1   wuxw   开发完成投诉建议
97
98
  }
  </script>
56c7fec9   wuxw   巡检功能测试完成
99
  
0a06b2d1   wuxw   开发完成投诉建议
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
  <style scoped>
  .border-right {
    border-right: 1px solid #eee;
  }
  
  .tree-container {
    height: 300px;
    overflow: auto;
    padding: 10px;
  }
  
  .staff-list {
    height: 300px;
    overflow: auto;
    padding: 10px;
  }
  
  .staff-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
  }
  
  .staff-item:hover {
    background-color: #f5f7fa;
  }
  
  .staff-item.selected {
    background-color: #ecf5ff;
  }
  
  .selected-staff {
    height: 300px;
    overflow: auto;
    padding: 10px;
  }
  
  .selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    border: 1px solid #ebeef5;
    border-radius: 4px;
  }
  
  .remove-icon {
    cursor: pointer;
    color: #f56c6c;
  }
  
  .text-center {
    text-align: center;
    padding: 10px 0;
56c7fec9   wuxw   巡检功能测试完成
155
156
  }
  </style>