zhangwencui
9 天以前 91c0cd2e0220472f9866479b218be72924b2aefa
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
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
98
99
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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// 审批管理主页面
<template>
  <view class="sales-account">
    <!-- 使用通用页面头部组件 -->
    <PageHeader title="会议发布"
                @back="goBack" />
    <!-- 搜索和筛选区域 -->
    <view class="search-section">
      <view class="search-bar">
        <view class="search-input">
          <up-input class="search-text"
                    placeholder="请输入会议主题"
                    v-model="searchForm.title"
                    clearable />
        </view>
        <view class="search-button"
              @click="getList">
          <up-icon name="search"
                   size="24"
                   color="#999"></up-icon>
        </view>
      </view>
    </view>
    <!-- 审批列表 -->
    <view class="ledger-list"
          v-if="ledgerList.length > 0">
      <view v-for="(item, index) in ledgerList"
            :key="index">
        <view class="ledger-item">
          <view class="item-header">
            <view class="item-left">
              <view class="document-icon">
                <up-icon name="file-text"
                         size="16"
                         color="#ffffff"></up-icon>
              </view>
              <text class="item-id">{{ item.title }}</text>
            </view>
            <view class="item-tag">
              <u-tag :type="getTagClass(item.status)">{{ formatReceiptType(item.status) }}</u-tag>
            </view>
          </view>
          <up-divider></up-divider>
          <view class="item-details">
            <view class="detail-row">
              <text class="detail-label">申请人</text>
              <text class="detail-value">{{ item.applicant }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">主理人</text>
              <text class="detail-value">{{ item.host }}</text>
            </view>
            <view class="detail-row-approveReason">
              <text class="detail-label">会议时间</text>
              <text class="detail-value highlightBlue">{{ formatDateTime(item.meetingTime) }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">会议地点</text>
              <text class="detail-value">{{ item.location }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">参会人数</text>
              <text class="detail-value">{{ item.participants.length }}</text>
            </view>
            <up-divider></up-divider>
            <view class="actions">
              <u-button type="primary"
                        size="small"
                        class="action-btn view"
                        @click="viewDetail(item)">
                详情
              </u-button>
              <u-button type="success"
                        size="small"
                        class="action-btn approve"
                        :disabled="item.status != 0"
                        @click="approve(item)">
                发布
              </u-button>
            </view>
            <!-- <view class="detail-info"
                  style="align-items: flex-end;">
              <view class="detail-row">
               
              </view>
            </view> -->
          </view>
        </view>
      </view>
    </view>
    <view v-else
          class="no-data">
      <text>暂无数据</text>
    </view>
  </view>
</template>
 
<script setup>
  import { ref, toRefs, reactive } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    getMeetingPublish,
    getRoomEnum,
  } from "@/api/managementMeetings/meetExamine";
  import { getStaffOnJob } from "@/api/personnelManagement/onboarding";
  import { onShow } from "@dcloudio/uni-app";
  import useUserStore from "@/store/modules/user";
  import dayjs from "dayjs";
 
  const userStore = useUserStore();
  // 数据
  const ledgerList = ref([]);
  const data = reactive({
    searchForm: {
      title: "",
    },
  });
  const { searchForm } = toRefs(data);
 
  // 返回上一页
  const goBack = () => {
    uni.navigateBack();
  };
  // 房间枚举
  const roomEnum = ref([]);
  // 房间枚举查询
  const getRoomEnumList = () => {
    return getRoomEnum()
      .then(res => {
        console.log(res.data, "res.data");
        roomEnum.value = res.data;
      })
      .catch(() => {
        closeToast();
      });
  };
  // 员工列表
  const staffList = ref([]);
  // 员工列表查询
  const getStaffOnJobList = () => {
    return getStaffOnJob()
      .then(res => {
        console.log(res.data, "res.data");
        staffList.value = res.data;
      })
      .catch(() => {
        closeToast();
      });
  };
  // 查询列表
  const getList = () => {
    showLoadingToast("加载中...");
    const page = {
      current: -1,
      size: -1,
    };
    getMeetingPublish({
      ...page,
      ...searchForm.value,
    })
      .then(res => {
        console.log(res.data.records, "res.data.records");
        ledgerList.value = res.data.records.map(it => {
          console.log(it, "it1");
          let room = roomEnum.value.find(room => it.roomId === room.id);
          it.location = `${room.name}(${room.location})`;
          let staffs = JSON.parse(it.participants);
          it.staffCount = staffs.size;
          it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format(
            "HH:mm:ss"
          )} ~ ${dayjs(it.endTime).format("HH:mm:ss")}`;
          it.participants = staffList.value
            .filter(staff => staffs.some(id => id == staff.id))
            .map(staff => {
              return {
                id: staff.id,
                name: `${staff.staffName}(${staff.postJob})`,
              };
            });
          console.log(it, "it2");
 
          return it;
        });
 
        closeToast();
      })
      .catch(() => {
        closeToast();
      });
  };
  // 显示加载提示
  const showLoadingToast = message => {
    uni.showLoading({
      title: message,
      mask: true,
    });
  };
  const formatDateTime = dateTime => {
    if (!dateTime) return "";
    return dateTime.replace(" ", "\n");
  };
 
  // 关闭提示
  const closeToast = () => {
    uni.hideLoading();
  };
 
  // 格式化回款方式
  const formatReceiptType = params => {
    if (params == 0) {
      return "待发布";
    } else if (params == 1) {
      return "已发布";
    } else if (params == 2) {
      return "已取消";
    } else {
      return "未知";
    }
  };
  // 获取标签样式类
  const getTagClass = type => {
    if (type == 0) {
      return "info";
    } else if (type == 1) {
      return "success";
    } else if (type == 2) {
      return "danger";
    } else {
      return "info";
    }
  };
 
  // 点击审核
  const approve = item => {
    // uni.setStorageSync("approveId", item.approveId);
    uni.navigateTo({
      url:
        "/pages/managementMeetings/meetPublish/approve?item=" +
        JSON.stringify(item) +
        "&edit=true",
    });
  };
  // 查看详情
  const viewDetail = item => {
    uni.navigateTo({
      url:
        "/pages/managementMeetings/meetPublish/approve?item=" +
        JSON.stringify(item) +
        "&edit=false",
    });
  };
 
  onShow(async () => {
    // 页面加载完成后的初始化逻辑
    try {
      // 等待两个异步方法执行完成
      await Promise.all([getRoomEnumList(), getStaffOnJobList()]);
      // 两个方法执行完成后再执行 getList()
      getList();
    } catch (error) {
      console.error("初始化数据失败:", error);
      // 即使出错也执行 getList(),确保页面能正常加载
      getList();
    }
  });
</script>
 
<style scoped lang="scss">
  @import "../../../styles/sales-common.scss";
 
  .u-divider {
    margin: 0 !important;
  }
 
  // 文档图标样式 - 覆盖公共样式中的背景色
  .document-icon {
    background: #ed8d05;
  }
 
  // 浮动按钮样式 - 覆盖公共样式中的背景色
  .fab-button {
    background: #ed8d05;
  }
 
  // 特有样式
  .detail-row-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
 
  .detail-row-approveReason {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
 
  .detail-value.highlightBlue {
    color: #2979ff;
    font-weight: 500;
  }
 
  .detail-value.highlightYellow {
    color: #ed8d05;
    font-weight: 500;
  }
 
  .approver-value {
    display: flex;
    justify-content: flex-end;
  }
 
  .approver-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f6ff;
    color: #2b7cff;
    border: 1px solid #e0efff;
    border-radius: 999px;
    padding: 4px 10px;
    max-width: 100%;
  }
 
  .approver-name {
    font-size: 12px;
    color: #2b7cff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
 
  .actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 18rpx;
  }
 
  .action-btn {
    border-radius: 16px;
    height: 28px;
    line-height: 28px;
    padding: 0 12px;
  }
</style>