"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
|
|
const _sfc_main = {
|
|
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
|
|
data() {
|
|
return {
|
|
staffList: [
|
|
{ name: "冯启彬", role: "质检员" },
|
|
{ name: "周琪", role: "质检员" },
|
|
{ name: "王凡玄", role: "质检员" },
|
|
{ name: "李世海", role: "质检员" },
|
|
{ name: "李娅", role: "质检员" },
|
|
{ name: "郑婷雅", role: "质检员" },
|
|
{ name: "冯思钰", role: "质检员" }
|
|
],
|
|
statusBarHeight: 0,
|
|
navBarRealHeight: 0,
|
|
refreshing: false
|
|
};
|
|
},
|
|
computed: {
|
|
navbarStyle() {
|
|
return `padding-top: ${this.statusBarHeight}px;`;
|
|
}
|
|
},
|
|
onLoad() {
|
|
common_vendor.index.getSystemInfo({
|
|
success: (res) => {
|
|
this.statusBarHeight = res.statusBarHeight || 20;
|
|
}
|
|
});
|
|
this.$nextTick(() => {
|
|
common_vendor.index.createSelectorQuery().select(".navbar").boundingClientRect((rect) => {
|
|
if (rect) {
|
|
this.navBarRealHeight = rect.height;
|
|
}
|
|
}).exec();
|
|
});
|
|
this.fetchStaffList();
|
|
common_vendor.index.$on("refreshStaffList", this.fetchStaffList);
|
|
},
|
|
onUnload() {
|
|
common_vendor.index.$off("refreshStaffList", this.fetchStaffList);
|
|
},
|
|
methods: {
|
|
goBack() {
|
|
common_vendor.index.navigateBack();
|
|
},
|
|
goStaffDetail(staff) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/manager/staff-detail",
|
|
success: (res) => {
|
|
res.eventChannel.emit("staffDetail", staff);
|
|
}
|
|
});
|
|
},
|
|
refreshData() {
|
|
},
|
|
async onRefresh() {
|
|
await this.refreshData && this.refreshData();
|
|
},
|
|
async fetchStaffList() {
|
|
try {
|
|
const res = await this.$api("getMyTeamList", { pageSize: 1e3, current: 1 });
|
|
if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
|
|
this.staffList = res.result.records.filter((user) => user.role == 1 || user.role == 0 || user.role == 2).map((user) => ({
|
|
id: user.id,
|
|
name: user.nickName || "-",
|
|
role: user.role == 1 ? "质检员" : user.role == 2 ? "管理员" : "用户"
|
|
}));
|
|
}
|
|
} catch (e) {
|
|
common_vendor.index.showToast({ title: "获取员工列表失败", icon: "none" });
|
|
}
|
|
}
|
|
},
|
|
onPullDownRefresh() {
|
|
this.refreshing = true;
|
|
Promise.resolve(this.fetchStaffList()).finally(() => {
|
|
this.refreshing = false;
|
|
common_vendor.index.stopPullDownRefresh();
|
|
});
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
_easycom_uni_icons2();
|
|
}
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
if (!Math) {
|
|
_easycom_uni_icons();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: $data.refreshing
|
|
}, $data.refreshing ? {
|
|
b: common_vendor.p({
|
|
type: "loading",
|
|
size: "22",
|
|
color: "#ffb400"
|
|
})
|
|
} : {}, {
|
|
c: common_vendor.p({
|
|
type: "back",
|
|
size: "24",
|
|
color: "#222"
|
|
}),
|
|
d: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
|
|
e: common_vendor.s($options.navbarStyle),
|
|
f: common_vendor.f($data.staffList, (staff, idx, i0) => {
|
|
return {
|
|
a: common_vendor.t(staff.name),
|
|
b: common_vendor.t(staff.role),
|
|
c: idx,
|
|
d: common_vendor.o(($event) => $options.goStaffDetail(staff), idx)
|
|
};
|
|
}),
|
|
g: $data.navBarRealHeight + "px"
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9b5c981c"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/staff.js.map
|