123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- import { dapingImage } from "@/utils/dapingImage";
- import { ref } from "vue";
- var selectColor = function (value: any, typestr: string, floor: any) {
- if (value === null || value === undefined) return null;
- const {
- yellowlight,
- redlight,
- greenlight,
- bluegreen,
- yellowgreen,
- redyellow,
- bluelight,
- } = dapingImage;
- var colorArr: { [key: string]: Array<any> } = {
- temp: [
- {
- min: Number.NEGATIVE_INFINITY,
- max: 20,
- image: bluelight,
- color: "#52A0FF",
- fcolor: "rgba(0, 95, 163, 0.76)",
- },
- {
- min: 20,
- max: 22,
- image: bluegreen,
- color: "#40DDCE",
- fcolor: "rgba(0, 160, 163, 0.76)",
- },
- {
- min: 22,
- max: 27,
- image: greenlight,
- color: "#7ED874",
- fcolor: "rgba(34, 139, 81, 0.76)",
- },
- {
- min: 27,
- max: 28,
- image: yellowgreen,
- color: "#C4E34F",
- fcolor: "rgba(133, 148, 0, 0.76)",
- },
- {
- min: 28,
- max: 30,
- image: redyellow,
- color: "#EE9F2B",
- fcolor: "rgba(173, 107, 0, 0.8)",
- },
- {
- min: 30,
- max: Number.POSITIVE_INFINITY,
- image: redlight,
- color: "#F5483D",
- fcolor: "rgba(154, 40, 40, 0.8)",
- },
- ],
- humidity: [
- {
- min: 0,
- max: 30,
- image: redlight,
- color: "#F5483D",
- fcolor: "rgba(173, 107, 0, 0.8)",
- },
- {
- min: 30,
- max: 35,
- image: redyellow,
- color: "#EE9F2B",
- fcolor: "rgba(133, 148, 0, 0.76)",
- },
- {
- min: 35,
- max: 65,
- image: greenlight,
- color: "#7ED874",
- fcolor: "rgba(34, 139, 81, 0.76)",
- },
- {
- min: 65,
- max: 95,
- image: bluegreen,
- color: "#40DDCE",
- fcolor: "rgba(0, 160, 163, 0.76)",
- },
- {
- min: 95,
- max: Number.POSITIVE_INFINITY,
- image: bluelight,
- color: "#52A0FF",
- fcolor: "rgba(0, 95, 163, 0.76)",
- },
- ],
- co2: [
- {
- min: 0,
- max: 800,
- image: greenlight,
- color: "#7ED874",
- fcolor: "rgba(34, 139, 81, 0.76)",
- },
- {
- min: 800,
- max: 1000,
- image: yellowgreen,
- color: "#C4E34F",
- fcolor: "rgba(133, 148, 0, 0.76)",
- },
- {
- min: 1000,
- max: 2500,
- image: redyellow,
- color: "#EE9F2B",
- fcolor: "rgba(173, 107, 0, 0.8)",
- },
- {
- min: 2500,
- max: Number.POSITIVE_INFINITY,
- image: redlight,
- color: "#F5483D",
- fcolor: "rgba(154, 40, 40, 0.8)",
- },
- ],
- methanal: [
- {
- min: 0,
- max: 0.08,
- image: greenlight,
- color: "#7ED874",
- fcolor: "rgba(34, 139, 81, 0.76)",
- },
- {
- min: 0.08,
- max: 0.1,
- image: yellowgreen,
- color: "#C4E34F",
- fcolor: "rgba(133, 148, 0, 0.76)",
- },
- {
- min: 0.1,
- max: 0.2,
- image: redyellow,
- color: "#EE9F2B",
- fcolor: "rgba(173, 107, 0, 0.8)",
- },
- {
- min: 0.2,
- max: Number.POSITIVE_INFINITY,
- image: redlight,
- color: "#F5483D",
- fcolor: "rgba(154, 40, 40, 0.8)",
- },
- ],
- pm25: [
- {
- min: 0,
- max: 35,
- image: greenlight,
- color: "#7ED874",
- fcolor: "rgba(34, 139, 81, 0.76)",
- },
- {
- min: 35,
- max: 75,
- image: yellowgreen,
- color: "#C4E34F",
- fcolor: "rgba(133, 148, 0, 0.76)",
- },
- {
- min: 75,
- max: 150,
- image: yellowlight,
- color: "#EFD62E",
- fcolor: "rgba(156, 137, 0, 0.76)",
- },
- {
- min: 150,
- max: 250,
- image: redyellow,
- color: "#EE9F2B",
- fcolor: "rgba(173, 107, 0, 0.8)",
- },
- {
- min: 250,
- max: Number.POSITIVE_INFINITY,
- image: redlight,
- color: "#F5483D",
- fcolor: "rgba(154, 40, 40, 0.8)",
- },
- ],
- };
- var nowColorArr = colorArr[typestr];
- var colorImage = null;
- nowColorArr.forEach((ele: any) => {
- if (value > ele.min && value < ele.max) {
- colorImage = floor ? ele.fcolor : ele.image;
- }
- });
- return colorImage;
- };
- var operateNum = function (num: any) {
- return num.toFixed(1);
- };
- export { selectColor };
|