Blame view

src/components/resource/selectStaff.vue 3.77 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
325bf296   wuxw   测试完成采购流程
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
    <el-dialog
      :title="$t('transferGoodsManage.selectRecipient')"
      :visible.sync="visible"
      width="60%"
    >
      <el-row :gutter="20">
        <el-col :span="12" class="border-right">
          <div class="text-center title">
            {{ $t('transferGoodsManage.orgInfo') }}
          </div>
          <div class="org-tree-container">
            <el-tree
              :data="orgs"
              :props="defaultProps"
              @node-click="handleNodeClick"
              node-key="id"
              default-expand-all
              highlight-current
            ></el-tree>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="text-center title">
            {{ $t('transferGoodsManage.staffInfo') }}
          </div>
          <div class="staff-list-container">
            <el-scrollbar style="height: 400px">
              <div
                v-for="item in staffs"
                :key="item.userId"
                class="staff-item"
                :class="{ active: currentStaffId === item.userId }"
                @click="selectStaff(item)"
              >
                <div>
                  <i class="el-icon-user"></i>
                  {{ item.userName }}
1cad66ad   wuxw   完成采购申请
39
                </div>
325bf296   wuxw   测试完成采购流程
40
41
42
43
                <div>{{ item.tel }}</div>
              </div>
            </el-scrollbar>
          </div>
1cad66ad   wuxw   完成采购申请
44
45
46
        </el-col>
      </el-row>
  
325bf296   wuxw   测试完成采购流程
47
48
49
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('common.cancel') }}
1cad66ad   wuxw   完成采购申请
50
        </el-button>
325bf296   wuxw   测试完成采购流程
51
52
        <el-button type="primary" @click="confirmSelection">
          {{ $t('common.confirm') }}
1cad66ad   wuxw   完成采购申请
53
54
55
56
57
58
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
325bf296   wuxw   测试完成采购流程
59
  import { getCommunityId } from '@/api/community/communityApi'
1cad66ad   wuxw   完成采购申请
60
61
62
  
  export default {
    name: 'SelectStaff',
1cad66ad   wuxw   完成采购申请
63
64
65
    data() {
      return {
        visible: false,
325bf296   wuxw   测试完成采购流程
66
67
68
69
70
71
72
73
        orgs: [],
        staffs: [],
        currentOrgId: '',
        currentStaffId: '',
        selectedStaff: null,
        defaultProps: {
          children: 'children',
          label: 'text'
1cad66ad   wuxw   完成采购申请
74
75
76
77
        }
      }
    },
    methods: {
325bf296   wuxw   测试完成采购流程
78
      open() {
1cad66ad   wuxw   完成采购申请
79
        this.visible = true
325bf296   wuxw   测试完成采购流程
80
81
82
83
        this.currentOrgId = ''
        this.currentStaffId = ''
        this.selectedStaff = null
        this.loadOrgs()
1cad66ad   wuxw   完成采购申请
84
      },
325bf296   wuxw   测试完成采购流程
85
86
87
88
89
90
91
92
93
94
95
96
      async loadOrgs() {
        try {
          const params = {
            communityId: getCommunityId()
          }
  
          const res = await this.$api.resource.transferGoodsManageApi.listOrgTree(
            params
          )
          this.orgs = res.data
        } catch (error) {
          this.$message.error(this.$t('common.loadFailed'))
1cad66ad   wuxw   完成采购申请
97
98
        }
      },
325bf296   wuxw   测试完成采购流程
99
100
101
102
103
      handleNodeClick(data) {
        this.currentOrgId = data.id
        this.loadStaffs(data.id)
      },
      async loadStaffs(orgId) {
1cad66ad   wuxw   完成采购申请
104
        try {
325bf296   wuxw   测试完成采购流程
105
          const params = {
1cad66ad   wuxw   完成采购申请
106
107
            page: 1,
            row: 50,
325bf296   wuxw   测试完成采购流程
108
            orgId: orgId
1cad66ad   wuxw   完成采购申请
109
          }
325bf296   wuxw   测试完成采购流程
110
111
112
113
114
  
          const res = await this.$api.resource.transferGoodsManageApi.queryStaffInfos(
            params
          )
          this.staffs = res.staffs
1cad66ad   wuxw   完成采购申请
115
        } catch (error) {
325bf296   wuxw   测试完成采购流程
116
          this.$message.error(this.$t('common.loadFailed'))
1cad66ad   wuxw   完成采购申请
117
118
        }
      },
325bf296   wuxw   测试完成采购流程
119
120
121
      selectStaff(staff) {
        this.currentStaffId = staff.userId
        this.selectedStaff = staff
1cad66ad   wuxw   完成采购申请
122
      },
325bf296   wuxw   测试完成采购流程
123
124
125
126
127
128
129
      confirmSelection() {
        if (!this.selectedStaff) {
          this.$message.warning(this.$t('transferGoodsManage.selectStaffFirst'))
          return
        }
        this.$emit('chooseStaff', this.selectedStaff)
        this.visible = false
1cad66ad   wuxw   完成采购申请
130
131
132
133
134
135
136
      }
    }
  }
  </script>
  
  <style scoped>
  .border-right {
325bf296   wuxw   测试完成采购流程
137
    border-right: 1px solid #ebeef5;
1cad66ad   wuxw   完成采购申请
138
139
  }
  
325bf296   wuxw   测试完成采购流程
140
141
142
143
  .title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
1cad66ad   wuxw   完成采购申请
144
145
  }
  
325bf296   wuxw   测试完成采购流程
146
147
148
  .org-tree-container {
    height: 400px;
    overflow: auto;
1cad66ad   wuxw   完成采购申请
149
150
  }
  
325bf296   wuxw   测试完成采购流程
151
152
153
154
155
156
157
158
159
160
161
162
  .staff-list-container {
    height: 400px;
  }
  
  .staff-item {
    padding: 10px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
  }
  
  .staff-item:hover {
1cad66ad   wuxw   完成采购申请
163
164
165
    background-color: #f5f7fa;
  }
  
325bf296   wuxw   测试完成采购流程
166
167
168
169
170
171
  .staff-item.active {
    background-color: #ecf5ff;
    color: #409eff;
  }
  
  .el-icon-user {
1cad66ad   wuxw   完成采购申请
172
173
174
    margin-right: 5px;
  }
  </style>