Blame view

src/views/org/orgList.vue 5.02 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
    <div class="org-manage">
      <el-row :gutter="20">
        <el-col :span="6">
          <org-tree @switchOrg="handleSwitchOrg" />
        </el-col>
        <el-col :span="18">
          <div class="search-wrapper">
            <div class="search-title">{{ $t('common.queryCondition') }}</div>
            <div class="search-content">
              <el-input v-model="staffName" :placeholder="$t('org.staffNamePlaceholder')" class="search-item" clearable
                @keyup.enter.native="queryOrgMethod" />
              <el-button type="primary" @click="queryOrgMethod">{{ $t('common.search') }}</el-button>
            </div>
          </div>
  
  
          <div class="list-wrapper">
            <div class="list-header">
              <div class="list-title">{{ $t('org.relatedStaff') }}</div>
              <el-button type="primary" @click="openOrgRelStaff"><i class="el-icon-plus"></i>
                {{ $t('org.relatedStaff') }}</el-button>
            </div>
  
            <el-table :data="staffs" border>
              <el-table-column prop="name" :label="$t('org.name')" align="center" />
              <el-table-column prop="tel" :label="$t('org.phone')" align="center" />
              <el-table-column prop="email" :label="$t('org.email')" align="center" />
              <el-table-column prop="address" :label="$t('org.address')" align="center" />
              <el-table-column prop="sex" :label="$t('org.gender')" align="center">
                <template #default="{ row }">
69e18472   wuxw   v1.9 员工头像不对问题
32
                  {{ row.sex == 0 ? '男' : '女' }}
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
                </template>
              </el-table-column>
              <el-table-column :label="$t('org.operation')" align="center">
                <template #default="{ row }">
                  <el-button v-if="hasPrivilege('502022082955220005') || hasPrivilege('502022092283880005')" type="text"
                    @click="openDeleteOrgRelStaff(row)">
                    {{ $t('common.delete') }}
                  </el-button>
                  <el-button type="text" @click="toStaffDetail(row)">
                    {{ $t('common.detail') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination :current-page="currentPage" :page-size="pageSize" :total="total"
              @current-change="handlePageChange" />
          </div>
  
        </el-col>
      </el-row>
  
      <org-rel-staff ref="orgRelStaff" @refresh="listStaffs" />
      <delete-org-rel-staff ref="deleteOrgRelStaff" @refresh="listStaffs" />
    </div>
  </template>
  
  <script>
  import { listStaffs } from '@/api/org/orgApi';
  import OrgTree from '@/components/org/OrgTree.vue';
  import OrgRelStaff from '@/components/org/OrgRelStaff.vue';
  import DeleteOrgRelStaff from '@/components/org/DeleteOrgRelStaff.vue';
  
  export default {
    name: 'OrgList',
    components: {
      OrgTree,
      OrgRelStaff,
      DeleteOrgRelStaff,
    },
    data() {
      return {
        staffName: '',
        orgName: '',
        orgId: '',
        staffs: [],
        currentPage: 1,
        pageSize: 10,
        total: 0,
      };
    },
    methods: {
      handleSwitchOrg({ orgId, orgName }) {
        console.log(orgId, orgName);
        this.orgId = orgId;
        this.orgName = orgName;
        this.listStaffs();
      },
      async listStaffs() {
        try {
          const params = {
            page: this.currentPage,
            row: this.pageSize,
            orgId: this.orgId,
            staffName: this.staffName.trim(),
          };
27dcfde5   wuxw   系统全面测试完成
98
99
          const {staffs,total} = await listStaffs( params );
          this.staffs = staffs;
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
          this.total = total;
        } catch (error) {
          console.error('Failed to fetch staffs:', error);
        }
      },
      queryOrgMethod() {
        this.currentPage = 1;
        this.listStaffs();
      },
      resetOrgMethod() {
        this.staffName = '';
        this.currentPage = 1;
        this.listStaffs();
      },
      openOrgRelStaff() {
        if (!this.orgId) {
          this.$message.warning('请选择组织');
          return;
        }
        this.$refs.orgRelStaff.show(this.orgId);
      },
      openDeleteOrgRelStaff(staff) {
b550a0c6   wuxw   优化房产导入,错误不提示的bug
122
        this.$refs.deleteOrgRelStaff.show(staff);
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
123
124
      },
      toStaffDetail(staff) {
caba9d96   wuxw   oa 中除了 工作办理没有测试其他...
125
        this.$router.push(`/views/staff/staffDetail?staffId=${staff.userId}`)
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  
      },
      handlePageChange(page) {
        this.currentPage = page;
        this.listStaffs();
      },
    },
  };
  </script>
  
  <style scoped>
  .search-wrapper {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
  
    .search-title {
      font-size: 16px;
      font-weight: bold;
      margin-bottom: 20px;
      text-align: left;
      color: #333;
    }
  
    .search-content {
      display: flex;
      align-items: center;
      gap: 20px;
  
      .search-item {
        width: 200px;
      }
    }
  }
  
  .list-wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 4px;
  
    .list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
  
      .list-title {
        font-size: 16px;
        font-weight: bold;
        color: #333;
      }
    }
  
    .el-pagination {
      margin-top: 20px;
      text-align: right;
    }
  }
  
  .org-manage {
    padding: 20px;
  }
  
  .margin-top-xs {
    margin-top: 10px;
  }
  </style>