| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- // 引入Day.js库
- // const dayjs = require('dayjs');
- // var quarterOfYear = require('dayjs/plugin/quarterOfYear');
- // dayjs.extend(quarterOfYear);
- // // 获取本月日期列表的函数
- // function getDatesInMonth() {
- // let year = dayjs().year()
- // let month = dayjs().month()
- // const dates = [];
- // const startDate = dayjs(new Date(year, month, 1));
- // const endDate = dayjs(new Date(year, month + 1, 1)).subtract(1, 'day');
- // let currentDate = startDate;
- // while (currentDate.isBefore(endDate) || currentDate.isSame(endDate, 'day')) {
- // dates.push(currentDate.format('YYYY-MM-DD'));
- // currentDate = currentDate.add(1, 'day');
- // }
- // return dates;
- // }
- // // 获取当前日期
- // // 获取季度 (1-4)
- // function getQuarter() {
- // const now = dayjs();
- // const quarter = now.quarter();
- // const dates = [];
- // let start = (quarter - 1) * 3 + 1
- // for (let i = 0; i <= 2; i++) {
- // dates.push((start + i) + '月')
- // }
- // console.log(dates)
- // return dates;
- // }
- function getRandomNumber(type) {
- let arr = [];
- let j = type == 1 ? 5 : type == 2 ? 4 : 12;
- for (let i = 0; i < j; i++) {
- arr.push(Math.floor(Math.random() * 60));
- }
- return arr;
- }
- export const repaireOptions = [
- {
- title: '巡点检工单',
- imgUrl: require('../../assets/vector.png'),
- total: 0,
- num: 0
- },
- {
- title: '保养工单',
- imgUrl: require('../../assets/vector.png'),
- total: 0,
- num: 0
- },
- {
- title: '维修工单',
- imgUrl: require('../../assets/vector.png'),
- total: 0,
- num: 0
- },
- {
- title: '校准校验工单',
- imgUrl: require('../../assets/vector.png'),
- total: 0,
- num: 0
- }
- ];
- export const statusList = [
- {
- title: '运行',
- titleUrl: require('../../assets/title3.png'),
- numUrl: require('../../assets/num3.png'),
- color: '#07AF2E ',
- num: 0,
- code: 'runNumber'
- },
- {
- title: '维修',
- color: '#9F9F9F',
- titleUrl: require('../../assets/title1.png'),
- numUrl: require('../../assets/num1.png'),
- code: 'repairNumber',
- num: 0
- },
- {
- title: '故障',
- color: '#C14E4D ',
- titleUrl: require('../../assets/title2.png'),
- numUrl: require('../../assets/num2.png'),
- code: 'faultNumber',
- num: 0
- },
- {
- title: '停机',
- color: '#F4C15E',
- titleUrl: require('../../assets/title4.png'),
- numUrl: require('../../assets/num4.png'),
- code: 'shutdownNumber',
- num: 0
- }
- ];
- export const rankList = [
- {
- label: '排名',
- prop: 'rank',
- width: '20%'
- },
- {
- prop: 'name',
- label: '备品备件名称',
- width: '50%'
- },
- {
- prop: 'num',
- label: '消耗数量',
- width: '30%'
- }
- ];
- // export const planList = [
- // {
- // label: '类型',
- // prop: 'type',
- // width: '13%',
- // },
- // {
- // prop: 'code',
- // label: '编码',
- // width: '30%',
- // },
- // {
- // prop: 'title',
- // label: '标题',
- // width: '30%',
- // },
- // {
- // prop: 'userName',
- // label: '申请人',
- // width: '17%',
- // },
- // {
- // prop: 'action',
- // label: '操作',
- // width: '10%',
- // },
- // ];
- export const barOption = (data, itemStyle = {}) => {
- return {
- tooltip: {
- formatter: '{b}:{c}' + '个',
- trigger: 'item'
- },
- color: ['#398f4e'],
- xAxis: {
- type: 'category',
- data: data.map((item) => item.name),
- axisLabel: {
- fontSize: window.innerHeight * 0.012
- }
- },
- yAxis: {
- type: 'value',
- name: '(个)',
- nameTextStyle: {
- align: 'center',
- color: '#333',
- fontSize: window.innerHeight * 0.012,
- padding: [0, 20, -3, 0]
- }
- },
- series: [
- {
- // showBackground: true,
- barWidth: '20%',
- data: data.map((item) => item.value),
- type: 'bar',
- itemStyle
- }
- ]
- };
- };
- export const pieOption = (data) => {
- return {
- color: ['#398f4e', '#458ef7', '#fdc537', '#fe6869', '#975fe6'],
- tooltip: {
- formatter: '{b}:{c}' + '%',
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'right',
- right: '15%',
- top: '10%',
- itemGap: window.innerHeight * 0.014,
- textStyle: {
- fontSize: window.innerHeight * 0.013
- }
- },
- series: [
- {
- center: ['30%', '50%'],
- label: {
- position: 'inside',
- // show: true,
- formatter: '{c}' + '%',
- fontSize: window.innerHeight * 0.013,
- color: '#fff'
- },
- labelLine: {
- show: false
- },
- type: 'pie',
- radius: '85%',
- itemStyle: {
- borderWidth: 0,
- shadowBlur: 10,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- },
- data
- }
- ]
- };
- };
- export const pieOption1 = (data) => {
- return {
- // color: ['#398f4e', '#458ef7', '#fdc537', '#fe6869', '#975fe6'],
- tooltip: {
- formatter: '{b}:{c}' + '%',
- trigger: 'item'
- },
- legend: {
- orient: 'horizontal',
- left: 'center',
- // right: '15%',
- bottom: '5%',
- itemGap: window.innerHeight * 0.014,
- textStyle: {
- fontSize: window.innerHeight * 0.013
- }
- },
- series: [
- {
- center: ['50%', '45%'],
- label: {
- position: 'outside',
- show: true,
- formatter: (item) => {
- console.log(item,'item')
- return item.name + ':' + item.percent + '%';
- },
- fontSize: window.innerHeight * 0.0125,
- color: '#333'
- },
- labelLine: {
- show: true
- },
- type: 'pie',
- radius: ['50%', '65%'],
- itemStyle: {
- borderWidth: 0,
- shadowBlur: 10,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- },
- data
- }
- ]
- };
- };
- export const lineOption = (data,time) => {
- console.log(time,'time')
- return {
- tooltip: {
- formatter: (item) => {
- return item.name + ' ' + item.seriesName + ':' + item.value + '';
- },
- trigger: 'item'
- },
- legend: {
- // bottom: '2%',
- itemGap: window.innerHeight * 0.014,
- textStyle: {
- fontSize: window.innerHeight * 0.013
- }
- },
- xAxis: {
- type: 'category',
- axisLabel: {
- fontSize: window.innerHeight * 0.012
- },
- data:time
- // type == 1
- // ? [2020, 2021, 2022, 2023, 2024]
- // : type == 2
- // ? ['1季度', '2季度', '3季度', '4季度']
- // : [
- // '1月',
- // '2月',
- // '3月',
- // '4月',
- // '5月',
- // '6月',
- // '7月',
- // '8月',
- // '9月',
- // '10月',
- // '11月',
- // '12月'
- // ]
- },
- yAxis: {
- type: 'value'
- },
- series: data
- // [
- // {
- // name: '班组一',
- // data: getRandomNumber(type),
- // type: 'line',
- // smooth: true
- // },
- // {
- // name: '班组二',
- // data: getRandomNumber(type),
- // type: 'line',
- // smooth: true
- // },
- // {
- // name: '班组三',
- // data: getRandomNumber(type),
- // type: 'line',
- // smooth: true
- // },
- // {
- // name: '班组四',
- // data: getRandomNumber(type),
-
- // }
- // ]
- };
- };
|