| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779 |
- <template>
- <scroll-view class="entry-page" scroll-y>
- <view class="hero">
- <image class="hero-bg" src="/static/entry/bg.png" mode="widthFix" />
- <view class="hero-mask"></view>
- <view class="hero-content">
- <view class="status-row"> </view>
- <view class="profile-row">
- <view class="avatar-wrap">
- <text class="avatar-text">{{ avatarText }}</text>
- </view>
- <view class="profile-main">
- <view class="greeting">{{ greetingText }},{{ displayName }}</view>
- <view class="project-pill">
- <text class="project-name">{{ projectName }}</text>
- <uni-icons type="down" size="13" color="#ffffff" />
- </view>
- </view>
- <view
- class="notice-wrap"
- @click="navigatorTo('/pages/message/index')"
- >
- <uni-badge :text="messageCount" absolute="rightTop" size="small">
- <view class="notice-button">
- <image
- src="~@/static/home/message.png"
- style="
- width: 15px;
- height: 15px;
- background-color: transparent;
- "
- @click="navigatorTo('/pages/message/index')"
- />
- </view>
- </uni-badge>
- </view>
- <view class="hero-title"> 工作台 </view>
- </view>
- </view>
- </view>
- <view class="content-shell">
- <view class="section-card">
- <view class="section-title">核心功能</view>
- <scroll-view class="core-scroll" scroll-x show-scrollbar="false">
- <view class="core-list">
- <view
- v-for="item in coreFeatures"
- :key="item.title"
- class="core-item"
- :class="{ active: item.active }"
- >
- <view class="core-icon">
- <image
- :src="item.iconText"
- mode="aspectFit"
- style="
- width: 40px;
- height: 40px;
- background-color: transparent;
- "
- />
- </view>
- <view class="core-name">{{ item.title }}</view>
- <view class="core-desc">{{ item.desc }}</view>
- <view class="core-indicator" v-if="item.active"></view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="section-card">
- <view class="section-title">PMS常用</view>
- <view class="tool-grid">
- <view
- v-for="item in commonTools"
- :key="item.title"
- class="tool-item"
- @click="navigatorTo(item.path)"
- >
- <image class="tool-icon" :src="item.icon" mode="aspectFit" />
- <view class="tool-title">{{ item.title }}</view>
- </view>
- </view>
- </view>
- <view class="section-card">
- <view class="section-head">
- <view class="section-title">日报入口</view>
- <view class="section-tip">
- <uni-icons type="personadd" size="16" color="#246BFF" />
- <text>按角色显示</text>
- </view>
- </view>
- <view class="daily-list">
- <view
- v-for="item in visibleDailyEntries"
- :key="item.title"
- class="daily-item"
- @click="navigatorTo(item.path)"
- >
- <image class="daily-icon" :src="item.icon" mode="aspectFit" />
- <view class="daily-content">
- <view class="daily-title">{{ item.title }}</view>
- <view class="daily-subtitle-wrap">
- <view class="daily-subtitle">{{ item.subtitle }}</view>
- <uni-icons type="right" size="12" color="#8090a8" />
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </template>
- <script setup>
- import { computed, ref } from "vue";
- import { onShow } from "@dcloudio/uni-app";
- import dayjs from "dayjs";
- import { getLoginUserInfo } from "@/api/login";
- import { getUnreadMessageCount } from "@/api/message";
- import { getOvertimeTaskList } from "@/api/task";
- import { getUserInfo } from "@/utils/auth";
- const userInfo = ref({});
- const messageCount = ref(0);
- const todoStats = ref({
- maintenance: 0,
- fault: 0,
- });
- const coreFeatures = [
- {
- title: "PMS",
- desc: "设备生命周期管理",
- iconText: "/static/entry/pms.png",
- iconBg: "linear-gradient(135deg, #eaf2ff 0%, #d8e7ff 100%)",
- iconColor: "#246BFF",
- active: true,
- },
- {
- title: "QHSE",
- desc: "质量健康安全环保",
- iconText: "/static/entry/qhse.png",
- iconBg: "linear-gradient(135deg, #ecfff7 0%, #d8f8ea 100%)",
- iconColor: "#1eb980",
- },
- {
- title: "组态管理",
- desc: "流程与仪表组态",
- iconText: "/static/entry/zutai.png",
- iconBg: "linear-gradient(135deg, #f1edff 0%, #e0d9ff 100%)",
- iconColor: "#6d5efc",
- },
- {
- title: "智慧连油",
- desc: "润滑管理平台",
- iconText: "/static/entry/lianyou.png",
- iconBg: "linear-gradient(135deg, #e7fbff 0%, #d4f7fb 100%)",
- iconColor: "#10a8c6",
- },
- {
- title: "生产运营双周会",
- desc: "双周会管理与跟踪",
- iconText: "/static/entry/yunying.png",
- iconBg: "linear-gradient(135deg, #fff3e8 0%, #ffe3cc 100%)",
- iconColor: "#ff8a1f",
- },
- ];
- const commonTools = [
- {
- title: "运行记录",
- icon: "/static/entry/record.png",
- path: "/pages/recordFilling/list",
- },
- {
- title: "保养工单",
- icon: "/static/entry/baoyang.png",
- path: "/pages/maintenance/index",
- },
- {
- title: "设备维修",
- icon: "/static/entry/weixiu.png",
- path: "/pages/repair/index",
- },
- {
- title: "巡检工单",
- icon: "/static/entry/xunjian.png",
- path: "/pages/inspection/index",
- },
- {
- title: "故障上报",
- icon: "/static/entry/guzhang.png",
- path: "/pages/fault/index",
- },
- {
- title: "库存管理",
- icon: "/static/entry/kucun.png",
- path: "/pages/inventory/index",
- },
- {
- title: "保养查询",
- icon: "/static/entry/byquery.png",
- path: "/pages/maintenance/search",
- },
- {
- title: "设备台账",
- icon: "/static/entry/taizhang.png",
- path: "/pages/ledger/index",
- },
- {
- title: "设备状态变更",
- icon: "/static/entry/status.png",
- path: "/pages/statusChange/index",
- },
- {
- title: "设备责任人",
- icon: "/static/entry/zeren.png",
- path: "/pages/deviceUser/index",
- },
- ];
- const dailyEntries = computed(() => [
- {
- title: "瑞恒日报",
- subtitle: "进入瑞恒日报",
- path: "/pages/ruihen/index?type=edit",
- icon: "/static/entry/ruiheng.png",
- visible: !!userInfo.value.rhReportFlag,
- },
- {
- title: "瑞都日报",
- subtitle: "进入瑞都日报",
- path: "/pages/ruiDu/index",
- icon: "/static/entry/ruidu.png",
- visible: !!userInfo.value.rdReportFlag,
- },
- {
- title: "瑞鹰日报",
- subtitle: "进入瑞鹰日报",
- path: "/pages/ruiying/index?type=edit",
- icon: "/static/entry/ruiying.png",
- visible: !!userInfo.value.ryReportFlag,
- },
- ]);
- const visibleDailyEntries = computed(() => {
- const list = dailyEntries.value.filter((item) => item.visible);
- if (list.length) return list.slice(0, 3);
- return dailyEntries.value
- .map((item) => ({ ...item, visible: true }))
- .slice(0, 3);
- });
- const todoCards = computed(() => [
- {
- title: "保养工单",
- icon: "/static/home/baoyang.png",
- count: todoStats.value.maintenance,
- color: "#1eb980",
- },
- {
- title: "故障上报",
- icon: "/static/home/guzhang.png",
- count: todoStats.value.fault,
- color: "#ff4d4f",
- },
- ]);
- const currentTimeText = computed(() => dayjs().format("H:mm"));
- const greetingText = computed(() => {
- const hour = dayjs().hour();
- if (hour < 12) return "上午好";
- if (hour < 18) return "下午好";
- return "晚上好";
- });
- const displayName = computed(
- () => userInfo.value.nickname || userInfo.value.username || "张工",
- );
- const avatarText = computed(() =>
- String(displayName.value || "张").slice(0, 1),
- );
- const projectName = computed(
- () =>
- userInfo.value.deptName ||
- userInfo.value.postGroup ||
- userInfo.value.stationName ||
- "智慧工厂示例项目",
- );
- const parseCachedUserInfo = () => {
- const cache = getUserInfo();
- if (!cache) return {};
- try {
- const parsed = typeof cache === "string" ? JSON.parse(cache) : cache;
- if (typeof parsed === "string") {
- return JSON.parse(parsed)?.user || {};
- }
- return parsed?.user || parsed || {};
- } catch (error) {
- return {};
- }
- };
- const buildTodoStats = (list) => {
- const stats = {
- maintenance: 0,
- fault: 0,
- };
- list.forEach((item) => {
- const typeText = String(item?.type || "");
- if (typeText.includes("保养")) {
- stats.maintenance += 1;
- }
- if (typeText.includes("故障")) {
- stats.fault += 1;
- }
- });
- return stats;
- };
- const loadPageData = async () => {
- userInfo.value = parseCachedUserInfo();
- try {
- const [userRes, messageRes, todoRes] = await Promise.all([
- getLoginUserInfo(),
- getUnreadMessageCount(),
- getOvertimeTaskList({ pageNo: 1, pageSize: 50 }),
- ]);
- if (userRes?.code === 0 && userRes.data) {
- userInfo.value = userRes.data;
- }
- if (messageRes?.code === 0) {
- messageCount.value = messageRes.data || 0;
- }
- if (todoRes?.code === 0) {
- const todoList = todoRes.data?.list || [];
- todoStats.value = buildTodoStats(todoList);
- }
- } catch (error) {
- messageCount.value = messageCount.value || 0;
- }
- };
- const navigatorTo = (url) => {
- if (!url) return;
- uni.navigateTo({ url });
- };
- onShow(() => {
- loadPageData();
- });
- </script>
- <style lang="scss" scoped>
- .entry-page {
- height: 100vh;
- background: linear-gradient(180deg, #edf4ff 0%, #f7f9fc 28%, #f6f8fb 100%);
- }
- .hero {
- position: relative;
- height: 640rpx;
- overflow: hidden;
- }
- .hero-bg {
- position: absolute;
- inset: 0;
- width: 100%;
- height: 100%;
- }
- .hero-mask {
- position: absolute;
- inset: 0;
- height: 55%;
- background: linear-gradient(
- to bottom,
- rgba(255, 255, 255, 0) 0%,
- rgb(45, 114, 212, 0.4) 88%,
- rgb(45, 114, 212, 0.4) 89%,
- rgb(45, 114, 212, 0.7) 91%,
- rgb(41, 113, 214, 0.2) 95%,
- #f9fbfd 100%
- );
- pointer-events: none;
- }
- .hero-content {
- position: relative;
- z-index: 2;
- padding: calc(var(--status-bar-height) + 24rpx) 28rpx 0;
- }
- .hero-title {
- position: absolute;
- left: 0%;
- bottom: -110%;
- // background: #f7f9fc;
- background: linear-gradient(
- to right,
- #f7f9fc 0%,
- #f7f9fc 50%,
- rgba(253, 253, 254, 0.3) 85%,
- rgba(253, 253, 254, 0.2) 90%,
- rgba(253, 253, 254, 0) 100%
- );
- border-radius: 16rpx 0rpx 0rpx 0rpx;
- padding-top: 20rpx;
- padding-bottom: 50rpx;
- padding-left: 28rpx;
- width: 50%;
- height: 80rpx;
- font-size: 40rpx;
- font-weight: 700;
- }
- .status-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 42rpx;
- }
- .profile-row {
- display: flex;
- align-items: center;
- }
- .avatar-wrap {
- width: 82rpx;
- height: 82rpx;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.3);
- border: 2rpx solid rgba(255, 255, 255, 0.7);
- display: flex;
- align-items: center;
- justify-content: center;
- backdrop-filter: blur(8px);
- }
- .avatar-text {
- color: #ffffff;
- font-size: 34rpx;
- font-weight: 700;
- }
- .profile-main {
- flex: 1;
- min-width: 0;
- margin-left: 22rpx;
- }
- .greeting {
- color: #ffffff;
- font-size: 30rpx;
- font-weight: 700;
- line-height: 1.2;
- text-shadow: 0 6rpx 18rpx rgba(0, 31, 90, 0.18);
- }
- .project-pill {
- display: inline-flex;
- align-items: center;
- gap: 12rpx;
- max-width: 100%;
- margin-top: 18rpx;
- padding: 12rpx 18rpx;
- border-radius: 18rpx;
- background: rgba(255, 255, 255, 0.18);
- color: #ffffff;
- backdrop-filter: blur(8px);
- }
- .project-name {
- max-width: 360rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: 20rpx;
- }
- .notice-wrap {
- margin-left: 12rpx;
- padding-right: 28rpx;
- }
- .notice-button {
- width: 30rpx;
- height: 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .notice-glyph {
- font-size: 32rpx;
- line-height: 1;
- }
- .content-shell {
- position: relative;
- z-index: 2;
- margin-top: -325rpx;
- padding: 0 24rpx calc(env(safe-area-inset-bottom) + 34rpx);
- }
- .page-title {
- margin: 0 6rpx 22rpx;
- color: #071426;
- font-size: 72rpx;
- font-weight: 800;
- letter-spacing: 1rpx;
- }
- .section-card {
- margin-bottom: 22rpx;
- padding: 26rpx 22rpx 24rpx;
- border-radius: 20rpx;
- background: rgba(255, 255, 255, 0.94);
- box-shadow: 0 14rpx 24rpx rgba(13, 43, 91, 0.02);
- border: 1rpx solid #eef3fc;
- }
- .section-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 16rpx;
- }
- .section-title {
- color: #101c2e;
- font-size: 36rpx;
- font-weight: 700;
- }
- .section-tip {
- display: flex;
- align-items: center;
- gap: 8rpx;
- color: #5572a3;
- font-size: 24rpx;
- }
- .core-scroll {
- margin-top: 22rpx;
- white-space: nowrap;
- }
- .core-list {
- display: inline-flex;
- gap: 18rpx;
- padding-bottom: 4rpx;
- }
- .core-item {
- position: relative;
- width: 188rpx;
- min-height: 238rpx;
- padding: 24rpx 18rpx 20rpx;
- border-radius: 22rpx;
- background: #f9fbfd;
- border: 1rpx solid #e5edf8;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .core-item.active {
- border-color: #246bff;
- background: linear-gradient(180deg, #ffffff 0%, #dfebfd 100%);
- box-shadow: inset 0 0 0 2rpx rgba(36, 107, 255, 0.08);
- .core-name {
- color: #0b57f6;
- }
- }
- .core-icon {
- width: 84rpx;
- height: 84rpx;
- border-radius: 24rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- text {
- font-size: 42rpx;
- font-weight: 800;
- }
- }
- .core-name {
- margin-top: 22rpx;
- color: #111d2f;
- font-size: 20rpx;
- font-weight: 700;
- white-space: normal;
- }
- .core-desc {
- margin-top: 10rpx;
- color: #6f7f96;
- font-size: 18rpx;
- line-height: 1.5;
- white-space: normal;
- }
- .core-indicator {
- position: absolute;
- left: 50%;
- bottom: 16rpx;
- width: 34rpx;
- height: 8rpx;
- margin-left: -17rpx;
- border-radius: 999rpx;
- background: #246bff;
- }
- .tool-grid {
- display: grid;
- grid-template-columns: repeat(5, minmax(0, 1fr));
- gap: 18rpx;
- margin-top: 22rpx;
- }
- .tool-item {
- min-height: 140rpx;
- padding: 22rpx 10rpx 18rpx;
- border-radius: 20rpx;
- background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
- border: 1rpx solid #e5edf8;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- }
- .tool-icon {
- width: 54rpx;
- height: 54rpx;
- }
- .tool-title {
- margin-top: 16rpx;
- color: #111d2f;
- font-size: 22rpx;
- line-height: 1.3;
- text-align: center;
- }
- .daily-list {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 5rpx;
- margin-top: 22rpx;
- }
- .daily-item {
- padding: 30rpx 0rpx;
- border-radius: 16rpx;
- background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
- border: 1rpx solid #e5edf8;
- display: flex;
- // flex-direction: column;
- // align-items: center;
- gap: 10rpx;
- // min-width: 0;
- }
- .daily-subtitle-wrap {
- display: flex;
- align-items: center;
- margin-top: 8rpx;
- gap: 8rpx;
- }
- .daily-icon {
- width: 64rpx;
- height: 64rpx;
- flex-shrink: 0;
- }
- .daily-content {
- flex: 1;
- min-width: 0;
- }
- .daily-title {
- color: #111d2f;
- font-size: 22rpx;
- font-weight: 700;
- }
- .daily-subtitle {
- // margin-top: 8rpx;
- color: #6f7f96;
- font-size: 16rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .todo-list {
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: 18rpx;
- margin-top: 22rpx;
- }
- .todo-item {
- min-width: 0;
- padding: 22rpx 20rpx;
- border-radius: 22rpx;
- background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
- border: 1rpx solid #e5edf8;
- display: flex;
- align-items: center;
- gap: 16rpx;
- }
- .todo-icon {
- width: 58rpx;
- height: 58rpx;
- flex-shrink: 0;
- }
- .todo-content {
- flex: 1;
- min-width: 0;
- }
- .todo-title {
- color: #111d2f;
- font-size: 26rpx;
- font-weight: 700;
- }
- .todo-subtitle {
- margin-top: 8rpx;
- color: #6f7f96;
- font-size: 22rpx;
- }
- .todo-right {
- display: flex;
- align-items: flex-end;
- gap: 6rpx;
- }
- .todo-count {
- font-size: 48rpx;
- font-weight: 800;
- line-height: 1;
- }
- .todo-unit {
- margin-bottom: 6rpx;
- color: #6f7f96;
- font-size: 22rpx;
- }
- </style>
|