|
@@ -0,0 +1,369 @@
|
|
|
+<template>
|
|
|
+ <div class="main-data data-weeks-foods">
|
|
|
+ <div class="title-area">楼宇中当前告警设备情况</div>
|
|
|
+
|
|
|
+ <div class="close-btn" @click="close"></div>
|
|
|
+ <div class="content-area">
|
|
|
+ <div class="content">
|
|
|
+ <div class="data-list">
|
|
|
+ <div class="table-cont">
|
|
|
+ <div class="table-top">
|
|
|
+ <div class="flo">抽屉柜编号</div>
|
|
|
+ <div class="pot">设备名称</div>
|
|
|
+ <div class="spa">类别</div>
|
|
|
+ </div>
|
|
|
+ <div class="table-bot">
|
|
|
+ <div class="table-list" v-for="(item,index) in floorDataList" :key="index">
|
|
|
+ <div class="fir">{{item.number}}</div>
|
|
|
+ <div class="snd">{{item.name}}</div>
|
|
|
+ <div class="thr">{{item.type}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ import { getFoodsList } from "@/api/screen/service";
|
|
|
+ import pinyin from "../data/pinyin.js";
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "WeekFoods",
|
|
|
+ props: {
|
|
|
+ week: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+ appOrg: {
|
|
|
+ type: String,
|
|
|
+ default: "10001",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ floorDataList: [
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+ { number: '1# 1-3', name: '消火栓泵' ,type:'消防'},
|
|
|
+
|
|
|
+
|
|
|
+ ],
|
|
|
+ dataList: [],
|
|
|
+ weeks: ["周一", "周二", "周三", "周四", "周五"],
|
|
|
+ list: [],
|
|
|
+ foodsList: [],
|
|
|
+
|
|
|
+ food: "早餐",
|
|
|
+ foods: ["早餐", "中餐", "晚餐"],
|
|
|
+ lists: [],
|
|
|
+ appOrgs:['10001','1D001','1K003','1J001','1E001','1J003','1K002','1J002','1K001','1A001']
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getFoodsList();
|
|
|
+ },
|
|
|
+ destroyed() {},
|
|
|
+ beforeDestroy() {},
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ //获取数据概况
|
|
|
+ getFoodsList() {
|
|
|
+ let appOrg = this.$props.appOrg == '0000' ? '10001' : this.$props.appOrg;
|
|
|
+ if(this.appOrgs.indexOf(appOrg) == -1){
|
|
|
+ appOrg = "1J001";
|
|
|
+ }
|
|
|
+ getFoodsList(appOrg).then((res) => {
|
|
|
+ if (Number(res.code) === 200) {
|
|
|
+ let foodsList = JSON.parse(res.data.foodInfo);
|
|
|
+ this.foodsList = foodsList;
|
|
|
+ // 转换后的数据
|
|
|
+ const transformedData = {};
|
|
|
+
|
|
|
+ // 映射关系
|
|
|
+ const dayMap = {"monday": "1","tuesday": "2","wednesday": "3","thursday": "4","friday": "5",};
|
|
|
+ const mealTypeMap = {"breakfast": "1", "lunch": "2", "dinner": "3"};
|
|
|
+
|
|
|
+ // 遍历原始数据并转换
|
|
|
+ for (const day in foodsList) {
|
|
|
+ if (foodsList.hasOwnProperty(day)) {
|
|
|
+ const dayNumber = dayMap[day];
|
|
|
+ transformedData[dayNumber] = [];
|
|
|
+ for (const mealTypeKey in foodsList[day]) {
|
|
|
+ if (foodsList[day].hasOwnProperty(mealTypeKey)) {
|
|
|
+ const mealTypeNumber = mealTypeMap[mealTypeKey];
|
|
|
+ foodsList[day][mealTypeKey].forEach(meal => {
|
|
|
+ const newDishes = [
|
|
|
+ {"name": meal.name, "type": mealTypeNumber},
|
|
|
+ ];
|
|
|
+ transformedData[dayNumber] = transformedData[dayNumber].concat(newDishes);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //console.log('888888888',JSON.parse(JSON.stringify(transformedData)));
|
|
|
+ this.foodsList=JSON.parse(JSON.stringify(transformedData))
|
|
|
+ let index = parseInt(this.weeks.indexOf(this.$props.week)) + 1;
|
|
|
+ let lists =JSON.parse(JSON.stringify(transformedData[index]));
|
|
|
+
|
|
|
+ this.lists = lists;
|
|
|
+ // let list = foodsList[index];
|
|
|
+ // this.list = list;
|
|
|
+ //区分早中晚
|
|
|
+ let list = [];
|
|
|
+ let type = parseInt(this.foods.indexOf(this.food)) + 1;
|
|
|
+ let that = this;
|
|
|
+ // 用于存储所有的"name"字段及其对应的餐次编号
|
|
|
+ lists.forEach((item) => {
|
|
|
+ if (item.type == type) {
|
|
|
+ //处理图片
|
|
|
+ // item.img = require('../../../assets/caidanImgs/'+ pinyin.chineseToPinYin(item.name) +'.jpg');
|
|
|
+ that.loadImage(item);
|
|
|
+ list.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.list = list;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //默认显示暂无菜品
|
|
|
+ errorImg(item) {
|
|
|
+ item.img = require("@/assets/images/main/no-data.jpg");
|
|
|
+ },
|
|
|
+
|
|
|
+ loadImage(item) {
|
|
|
+ try {
|
|
|
+ // 尝试加载图片
|
|
|
+ item.img = require("@/assets/caidanImgs/" +
|
|
|
+ pinyin.chineseToPinYin(item.name) +
|
|
|
+ ".jpg");
|
|
|
+ } catch (e) {
|
|
|
+ // 处理图片不存在的情况
|
|
|
+ item.img = require("@/assets/images/main/no-data.jpg"); // 使用默认图片
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ close() {
|
|
|
+ this.$emit("closeFoods");
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <style lang="scss">
|
|
|
+
|
|
|
+ .data-weeks-foods {
|
|
|
+ position: relative;
|
|
|
+ width: 694px;
|
|
|
+ height: 620px;
|
|
|
+ background: url("../../../assets/images/main/dialog-bg-high.png") no-repeat;
|
|
|
+ background-size: cover;
|
|
|
+ .close-btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .choose-area {
|
|
|
+ position: absolute;
|
|
|
+ right: 100px;
|
|
|
+ top: 7px;
|
|
|
+ width: 80.05px;
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ padding-left: 15px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #00ffff;
|
|
|
+ background: url("../../../assets/images/main/choose_short.png") no-repeat;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .choose-area.choose-week{
|
|
|
+ right: 200px;
|
|
|
+ }
|
|
|
+ .content-area {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ padding: 15px 20px 0 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .content-title {
|
|
|
+ width: 515px;
|
|
|
+ height: 26px;
|
|
|
+ background: url("../../../assets/images/main/title_pro_long.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ font-family: "PingFangSC";
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #00ffff;
|
|
|
+ padding-left: 17px;
|
|
|
+ .title {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .content {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ .data-list {
|
|
|
+ background: radial-gradient(
|
|
|
+ 190% 71% at 50% 49%,
|
|
|
+ rgba(21, 105, 107, 0.54) 0%,
|
|
|
+ rgba(27, 95, 97, 0) 100%
|
|
|
+ );
|
|
|
+ width: 100%;
|
|
|
+ height: 600px;
|
|
|
+ padding: 10px;
|
|
|
+ // overflow: auto;
|
|
|
+ white-space: pre-wrap;
|
|
|
+ .table-cont{
|
|
|
+ width:100%;
|
|
|
+
|
|
|
+ .table-top{
|
|
|
+ width:100%;
|
|
|
+ height: 50px;
|
|
|
+ background-color: #092B2C;
|
|
|
+ padding:0 25px 0 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ font-size:18px;
|
|
|
+ color:#00FFFF;
|
|
|
+ }
|
|
|
+ .table-bot{
|
|
|
+ width:100%;
|
|
|
+ // height: 165px;
|
|
|
+ overflow: auto;
|
|
|
+
|
|
|
+ .table-list{
|
|
|
+ width:100%;
|
|
|
+ height:45px;
|
|
|
+ padding:15px 25px 15px 0px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ font-size:16px;
|
|
|
+ color:#FFFFFF;
|
|
|
+ font-weight: 500;
|
|
|
+ //border: 1px dotted #14302F;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .flo{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .pot{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .spa{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .fir{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ border-left: 1px solid #40E5F2;
|
|
|
+ }
|
|
|
+ .snd{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .thr{
|
|
|
+ width:33%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ // .color{
|
|
|
+ // color:#FF8C00;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .title-format {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ img {
|
|
|
+ width: 6px;
|
|
|
+ height: 24px;
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+ .title-info {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ffffff;
|
|
|
+ .title-en {
|
|
|
+ font-size: 8px;
|
|
|
+ color: #ffffff;
|
|
|
+ opacity: 0.4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .choose-area {
|
|
|
+ .el-select {
|
|
|
+ width: 90%;
|
|
|
+ }
|
|
|
+ .el-input {
|
|
|
+ input {
|
|
|
+ background: rgba(255, 255, 255, 0);
|
|
|
+ color: #00ffff;
|
|
|
+ border: none;
|
|
|
+ padding: 0;
|
|
|
+ width: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .no-data{
|
|
|
+ text-align: center;
|
|
|
+ color: #62ffe5;
|
|
|
+ font-size: 25px;
|
|
|
+ margin-top: 150px;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::-webkit-scrollbar {
|
|
|
+ width: 3px;
|
|
|
+ height: 3px;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::-webkit-scrollbar-thumb {
|
|
|
+ //滑块部分
|
|
|
+ // border-radius: 5px;
|
|
|
+ background-color: #58cbbb;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::-webkit-scrollbar-track {
|
|
|
+ //轨道部分
|
|
|
+ // box-shadow: inset 0 0 5px #ddd;
|
|
|
+ background: #ddd;
|
|
|
+ // border-radius: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+
|
|
|
+
|