Merge pull request 'feat : 新增历史数据导出csv文件' (#317) from dengjie into dev
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/317
This commit is contained in:
@@ -16,7 +16,7 @@ steps:
|
|||||||
- export NODE_MODULES_PATH=`pwd`/node_modules
|
- export NODE_MODULES_PATH=`pwd`/node_modules
|
||||||
# - npm config set registry https://registry.npm.taobao.org
|
# - npm config set registry https://registry.npm.taobao.org
|
||||||
- set NODE_OPTIONS=--openssl-legacy-provider
|
- set NODE_OPTIONS=--openssl-legacy-provider
|
||||||
# - npm install
|
- npm install
|
||||||
- npm run build
|
- npm run build
|
||||||
- echo $NODE_MODULES_PATH
|
- echo $NODE_MODULES_PATH
|
||||||
- cp -r dist /app/build/$DRONE_REPO_NAME
|
- cp -r dist /app/build/$DRONE_REPO_NAME
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"autofit.js": "^3.0.4",
|
"autofit.js": "^3.0.4",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"csv-exportor": "^1.0.2",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.4.2",
|
||||||
"element-plus": "^2.3.5",
|
"element-plus": "^2.3.5",
|
||||||
"element-resize-detector": "^1.2.4",
|
"element-resize-detector": "^1.2.4",
|
||||||
|
|||||||
@@ -322,13 +322,15 @@ body,
|
|||||||
margin: 520px auto 0 auto !important;
|
margin: 520px auto 0 auto !important;
|
||||||
background: rgba(6, 34, 71, 0.8) !important;
|
background: rgba(6, 34, 71, 0.8) !important;
|
||||||
}
|
}
|
||||||
.alarm-tunnel{
|
|
||||||
|
.alarm-tunnel {
|
||||||
.el-tag {
|
.el-tag {
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail {
|
.detail {
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
@@ -338,6 +340,7 @@ body,
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog {
|
.el-dialog {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -452,6 +455,7 @@ body,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shrink-icon {
|
.shrink-icon {
|
||||||
margin: -36px -20px 0 30px;
|
margin: -36px -20px 0 30px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -459,10 +463,12 @@ body,
|
|||||||
height: 65px;
|
height: 65px;
|
||||||
background-image: url("@/assets/images/fanInfo/shrink.png");
|
background-image: url("@/assets/images/fanInfo/shrink.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
.full-icon {
|
.full-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: -36px -20px 0 30px;
|
margin: -36px -20px 0 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
//弹窗样式
|
//弹窗样式
|
||||||
.digital-tunnel {
|
.digital-tunnel {
|
||||||
.chat-dialog {
|
.chat-dialog {
|
||||||
@@ -574,11 +580,29 @@ body,
|
|||||||
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
.change-screen{
|
|
||||||
position: absolute;
|
.export-btn {
|
||||||
right: 126px;
|
cursor: pointer;
|
||||||
top: 50px;
|
//padding-left: 53px;
|
||||||
}
|
width: 178px;
|
||||||
|
height: 92px;
|
||||||
|
line-height: 92px;
|
||||||
|
border-radius: 11px;
|
||||||
|
border: 2px solid #08B7B8;
|
||||||
|
background: #264A78;
|
||||||
|
//border-radius: 11px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 48px;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.change-screen {
|
||||||
|
position: absolute;
|
||||||
|
right: 126px;
|
||||||
|
top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.time-select {
|
.time-select {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20px;
|
top: 20px;
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<div style="width: 1px;"></div>
|
<div style="width: 1px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time-select">
|
<div class="time-select">
|
||||||
|
<div class="export-btn" @click="handleExport">
|
||||||
|
导出
|
||||||
|
</div>
|
||||||
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
||||||
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
||||||
<time-range-btn
|
<time-range-btn
|
||||||
@@ -64,6 +67,8 @@ import ChooseDay from "@/components/chooseDay/index.vue"
|
|||||||
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
|
|
||||||
|
import {getNowFormatDate} from "@/utils/date.js";
|
||||||
|
import CsvExportor from "csv-exportor";
|
||||||
let myEcharts = reactive({});
|
let myEcharts = reactive({});
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
@@ -90,6 +95,8 @@ const timeList = ref(["年", "月", "日"]);
|
|||||||
const selectTimeButton = ref(2);
|
const selectTimeButton = ref(2);
|
||||||
const isWindSpeedVisited = ref(false);
|
const isWindSpeedVisited = ref(false);
|
||||||
const showSpeedLoading = ref(false)
|
const showSpeedLoading = ref(false)
|
||||||
|
const clickMonth = ref('')
|
||||||
|
const clickDay = ref('')
|
||||||
watch(() => props.list, (now) => {
|
watch(() => props.list, (now) => {
|
||||||
airList.value?.forEach(item => {
|
airList.value?.forEach(item => {
|
||||||
now.forEach(newItem => {
|
now.forEach(newItem => {
|
||||||
@@ -118,7 +125,51 @@ watch(() => props.airData, (now) => {
|
|||||||
// windSpeed.value = 0
|
// windSpeed.value = 0
|
||||||
// }
|
// }
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
|
//导出csv
|
||||||
|
const handleExport = () => {
|
||||||
|
let clickUnit = ''
|
||||||
|
if(dialogTitle.value==='风速'){
|
||||||
|
clickUnit=windSpeedUnit.value
|
||||||
|
}else if(dialogTitle.value==='风向'){
|
||||||
|
clickUnit=windDirectionUnit.value
|
||||||
|
}else {
|
||||||
|
airList.value.forEach(item => {
|
||||||
|
if (item.name=== dialogTitle.value) {
|
||||||
|
clickUnit = item.unit
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const header = ['时间', `${dialogTitle.value}值(${clickUnit})`];
|
||||||
|
let newArray = []
|
||||||
|
chartData.dates.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
dates: chartData.dates[index],
|
||||||
|
values: chartData.values[index]
|
||||||
|
}
|
||||||
|
newArray.push(obj)
|
||||||
|
})
|
||||||
|
let time = ''
|
||||||
|
if (selectTimeButton.value === 1) {
|
||||||
|
if (clickMonth.value) {
|
||||||
|
const index = clickMonth.value.lastIndexOf("\-");
|
||||||
|
time = clickMonth.value.substring(0, index)
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(false)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 2) {
|
||||||
|
if (clickDay.value) {
|
||||||
|
time = clickDay.value
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(true)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 0) {
|
||||||
|
time = new Date().getFullYear() + '年'
|
||||||
|
}
|
||||||
|
const name = dialogTitle.value + '监控数据-' + time
|
||||||
|
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
|
||||||
|
}
|
||||||
const daySelect = (val) => {
|
const daySelect = (val) => {
|
||||||
|
clickDay.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getChartInfo(openDialogId.value, 'day', val)
|
getChartInfo(openDialogId.value, 'day', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -126,6 +177,7 @@ const daySelect = (val) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const monthSelect = (val) => {
|
const monthSelect = (val) => {
|
||||||
|
clickMonth.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getChartInfo(openDialogId.value, 'month', val)
|
getChartInfo(openDialogId.value, 'month', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -204,6 +256,8 @@ const getChartInfo = (equipmentId, type = 'day', time = '', flag) => {
|
|||||||
const handleOpenChart = (id, type) => {
|
const handleOpenChart = (id, type) => {
|
||||||
selectTimeButton.value = 2
|
selectTimeButton.value = 2
|
||||||
isWindSpeedVisited.value = true
|
isWindSpeedVisited.value = true
|
||||||
|
clickMonth.value=''
|
||||||
|
clickDay.value=''
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (chooseMonthRef.value) {
|
if (chooseMonthRef.value) {
|
||||||
chooseMonthRef.value.clearData()
|
chooseMonthRef.value.clearData()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<div class="loading" v-if="loading===0"></div>
|
<div class="loading" v-if="loading===0"></div>
|
||||||
{{ loading === 0 ? '加载中...' : '暂无数据~' }}
|
{{ loading === 0 ? '加载中...' : '暂无数据~' }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="info-list" @click="handleOpenChart">
|
<div v-else class="info-list" @click="handleOpenChart">
|
||||||
<gas-info-item
|
<gas-info-item
|
||||||
v-for="item in badGasList"
|
v-for="item in badGasList"
|
||||||
:key="item.equipmentId"
|
:key="item.equipmentId"
|
||||||
@@ -34,7 +34,10 @@
|
|||||||
<div style="width: 1px"></div>
|
<div style="width: 1px"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time-select">
|
<div class="time-select">
|
||||||
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
<div class="export-btn" @click="handleExport">
|
||||||
|
导出
|
||||||
|
</div>
|
||||||
|
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
||||||
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
||||||
<time-range-btn
|
<time-range-btn
|
||||||
:buttonList="timeList"
|
:buttonList="timeList"
|
||||||
@@ -65,6 +68,9 @@ import ChooseDay from "@/components/chooseDay/index.vue"
|
|||||||
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
|
|
||||||
|
import {getNowFormatDate} from "@/utils/date.js";
|
||||||
|
import CsvExportor from "csv-exportor";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
badGasData: Array,
|
badGasData: Array,
|
||||||
@@ -82,6 +88,8 @@ let chartData = reactive([])
|
|||||||
let dataZoomTop = reactive('87%')
|
let dataZoomTop = reactive('87%')
|
||||||
const badGasList = ref([]);
|
const badGasList = ref([]);
|
||||||
let myEcharts = reactive({});
|
let myEcharts = reactive({});
|
||||||
|
const clickMonth = ref('')
|
||||||
|
const clickDay = ref('')
|
||||||
const bgImage = computed(() => (isBadGasVisited.value ? "sp_active.png" : "bg.png"));
|
const bgImage = computed(() => (isBadGasVisited.value ? "sp_active.png" : "bg.png"));
|
||||||
watch(
|
watch(
|
||||||
() => props.list,
|
() => props.list,
|
||||||
@@ -116,6 +124,68 @@ watch(
|
|||||||
},
|
},
|
||||||
{deep: true}
|
{deep: true}
|
||||||
);
|
);
|
||||||
|
//导出csv
|
||||||
|
const handleExport = () => {
|
||||||
|
console.log(badGasList.value)
|
||||||
|
let dustUnit
|
||||||
|
let carbonUnit
|
||||||
|
let carbonMonoxideUnit
|
||||||
|
let nitrogenUnit
|
||||||
|
let sulfurMonoxideUnit
|
||||||
|
let sulfurDioxideUnit
|
||||||
|
let hydrogenSulfideUnit
|
||||||
|
badGasList.value.forEach((item) => {
|
||||||
|
if(item.name==='粉尘'){
|
||||||
|
dustUnit=item.unit
|
||||||
|
}else if(item.name==='二氧化碳'){
|
||||||
|
carbonUnit=item.unit
|
||||||
|
}else if(item.name==='一氧化碳'){
|
||||||
|
carbonMonoxideUnit=item.unit
|
||||||
|
}else if(item.name==='二氧化氮'){
|
||||||
|
nitrogenUnit=item.unit
|
||||||
|
}else if(item.name==='一氧化氮'){
|
||||||
|
sulfurMonoxideUnit=item.unit
|
||||||
|
}else if(item.name==='二氧化硫'){
|
||||||
|
sulfurDioxideUnit=item.unit
|
||||||
|
}else if(item.name==='硫化氢'){
|
||||||
|
hydrogenSulfideUnit=item.unit
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const header = ['时间', `粉尘(${dustUnit})`, `二氧化碳(${carbonUnit})`, `一氧化碳(${carbonMonoxideUnit})`,`二氧化氮(${nitrogenUnit})`,`一氧化氮(${sulfurMonoxideUnit})`,`二氧化硫(${sulfurDioxideUnit})`,`硫化氢(${hydrogenSulfideUnit})`];
|
||||||
|
let newArray = []
|
||||||
|
chartData.dates.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
dates: chartData.dates[index],
|
||||||
|
dustValues: chartData.dustValues[index],
|
||||||
|
carbonDioxideValues: chartData.carbonDioxideValues[index],
|
||||||
|
carbonMonoxideValues: chartData.carbonMonoxideValues[index],
|
||||||
|
nitrogenDioxideValues: chartData.nitrogenDioxideValues[index],
|
||||||
|
sulfurMonoxideValues: chartData.sulfurMonoxideValues[index],
|
||||||
|
sulfurDioxideValues: chartData.sulfurDioxideValues[index],
|
||||||
|
hydrogenSulfideValues: chartData.hydrogenSulfideValues[index]
|
||||||
|
}
|
||||||
|
newArray.push(obj)
|
||||||
|
})
|
||||||
|
let time = ''
|
||||||
|
if (selectTimeButton.value === 1) {
|
||||||
|
if (clickMonth.value) {
|
||||||
|
const index = clickMonth.value.lastIndexOf("\-");
|
||||||
|
time = clickMonth.value.substring(0, index)
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(false)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 2) {
|
||||||
|
if (clickDay.value) {
|
||||||
|
time = clickDay.value
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(true)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 0) {
|
||||||
|
time = new Date().getFullYear() + '年'
|
||||||
|
}
|
||||||
|
const name = '有害气体监控数据-' + time
|
||||||
|
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
|
||||||
|
}
|
||||||
//放大弹窗
|
//放大弹窗
|
||||||
const handleFullScreen = () => {
|
const handleFullScreen = () => {
|
||||||
const titleName = document.getElementsByClassName('el-dialog__title')[0]
|
const titleName = document.getElementsByClassName('el-dialog__title')[0]
|
||||||
@@ -147,17 +217,19 @@ const shrinkScreen = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const daySelect = (val) => {
|
const daySelect = (val) => {
|
||||||
|
clickDay.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getBadGasChartInfo('day', val)
|
getBadGasChartInfo('day', val)
|
||||||
} else {
|
} else {
|
||||||
getBadGasChartInfo('day', val,true)
|
getBadGasChartInfo('day', val, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const monthSelect = (val) => {
|
const monthSelect = (val) => {
|
||||||
|
clickMonth.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getBadGasChartInfo('month', val)
|
getBadGasChartInfo('month', val)
|
||||||
} else {
|
} else {
|
||||||
getBadGasChartInfo('month', val,true)
|
getBadGasChartInfo('month', val, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const changeDate = (index) => {
|
const changeDate = (index) => {
|
||||||
@@ -174,7 +246,7 @@ const timeSelect = (index) => {
|
|||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getBadGasChartInfo(changeDate(index))
|
getBadGasChartInfo(changeDate(index))
|
||||||
} else {
|
} else {
|
||||||
getBadGasChartInfo(changeDate(index),'',true)
|
getBadGasChartInfo(changeDate(index), '', true)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const getBadGasInfo = (now) => {
|
const getBadGasInfo = (now) => {
|
||||||
@@ -207,7 +279,7 @@ const changeData = (item) => {
|
|||||||
unit: item.unit,
|
unit: item.unit,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const getBadGasChartInfo = (type, time = '',flag) => {
|
const getBadGasChartInfo = (type, time = '', flag) => {
|
||||||
showLoading.value = true
|
showLoading.value = true
|
||||||
let id = props.tunnelId
|
let id = props.tunnelId
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -243,17 +315,19 @@ const getBadGasChartInfo = (type, time = '',flag) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const handleOpenChart = () => {
|
const handleOpenChart = () => {
|
||||||
nextTick(()=>{
|
clickMonth.value = ''
|
||||||
if(chooseMonthRef.value){
|
clickDay.value = ''
|
||||||
|
nextTick(() => {
|
||||||
|
if (chooseMonthRef.value) {
|
||||||
chooseMonthRef.value.clearData()
|
chooseMonthRef.value.clearData()
|
||||||
}
|
}
|
||||||
if(chooseDayRef.value){
|
if (chooseDayRef.value) {
|
||||||
chooseDayRef.value.clearData()
|
chooseDayRef.value.clearData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
isBadGasVisited.value = true
|
isBadGasVisited.value = true
|
||||||
isFullScreen.value = false
|
isFullScreen.value = false
|
||||||
getBadGasChartInfo('day','',true)
|
getBadGasChartInfo('day', '', true)
|
||||||
};
|
};
|
||||||
const getImageUrl = (name) => {
|
const getImageUrl = (name) => {
|
||||||
return new URL(`../../../assets/images/badGasInfo/${name}`, import.meta.url)
|
return new URL(`../../../assets/images/badGasInfo/${name}`, import.meta.url)
|
||||||
@@ -262,7 +336,7 @@ const getImageUrl = (name) => {
|
|||||||
/**
|
/**
|
||||||
* 初始化echarts实例方法
|
* 初始化echarts实例方法
|
||||||
*/
|
*/
|
||||||
const initChart = (type, values,top) => {
|
const initChart = (type, values, top) => {
|
||||||
//3.初始化container容器
|
//3.初始化container容器
|
||||||
myEcharts = echarts.init(document.getElementById("containerBad"));
|
myEcharts = echarts.init(document.getElementById("containerBad"));
|
||||||
//5.传入数据
|
//5.传入数据
|
||||||
@@ -367,7 +441,7 @@ const initChart = (type, values,top) => {
|
|||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 5,
|
width: 5,
|
||||||
},
|
},
|
||||||
},{
|
}, {
|
||||||
name: "二氧化碳",
|
name: "二氧化碳",
|
||||||
// data: [
|
// data: [
|
||||||
// 56, 12, 89, 34, 71, 43, 67, 20, 98, 72, 19, 61, 3, 85, 47, 92, 17, 76,
|
// 56, 12, 89, 34, 71, 43, 67, 20, 98, 72, 19, 61, 3, 85, 47, 92, 17, 76,
|
||||||
|
|||||||
@@ -98,6 +98,9 @@
|
|||||||
<div style="width: 1px;"></div>
|
<div style="width: 1px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time-select">
|
<div class="time-select">
|
||||||
|
<div class="export-btn" @click="handleExport">
|
||||||
|
导出
|
||||||
|
</div>
|
||||||
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
||||||
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
||||||
<time-range-btn
|
<time-range-btn
|
||||||
@@ -134,6 +137,8 @@ import {
|
|||||||
} from "@/api/largeScreen";
|
} from "@/api/largeScreen";
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
|
import CsvExportor from "csv-exportor";
|
||||||
|
import {getNowFormatDate} from "@/utils/date.js";
|
||||||
|
|
||||||
const timeList = ref(["年", "月", "日"]);
|
const timeList = ref(["年", "月", "日"]);
|
||||||
const selectTimeButton = ref(2);
|
const selectTimeButton = ref(2);
|
||||||
@@ -174,6 +179,8 @@ let dataZoomTop = reactive('87%')
|
|||||||
let chartData = reactive([])
|
let chartData = reactive([])
|
||||||
const fanIndex = ref('')
|
const fanIndex = ref('')
|
||||||
const openEquipmentId = ref(0)
|
const openEquipmentId = ref(0)
|
||||||
|
const clickMonth = ref('')
|
||||||
|
const clickDay = ref('')
|
||||||
let myEcharts = reactive({});
|
let myEcharts = reactive({});
|
||||||
watch(() => props.loading, (now) => {
|
watch(() => props.loading, (now) => {
|
||||||
props.loading = now
|
props.loading = now
|
||||||
@@ -214,7 +221,42 @@ watch(() => props.list, (now) => {
|
|||||||
})
|
})
|
||||||
handleOnMounted()
|
handleOnMounted()
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
|
|
||||||
|
//导出csv
|
||||||
|
const handleExport = () => {
|
||||||
|
const header = ['时间', 'A相电流(A)', 'B相电流(A)', 'C相电流(A)'];
|
||||||
|
let newArray = []
|
||||||
|
chartData.dates.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
dates: chartData.dates[index],
|
||||||
|
currentsA: chartData.currentsA[index],
|
||||||
|
currentsB: chartData.currentsB[index],
|
||||||
|
currentsC: chartData.currentsC[index]
|
||||||
|
}
|
||||||
|
newArray.push(obj)
|
||||||
|
})
|
||||||
|
let time = ''
|
||||||
|
if (selectTimeButton.value === 1) {
|
||||||
|
if (clickMonth.value) {
|
||||||
|
const index = clickMonth.value.lastIndexOf("\-");
|
||||||
|
time = clickMonth.value.substring(0, index)
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(false)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 2) {
|
||||||
|
if (clickDay.value) {
|
||||||
|
time = clickDay.value
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(true)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 0) {
|
||||||
|
time = new Date().getFullYear() + '年'
|
||||||
|
}
|
||||||
|
const name = fanIndex.value + '号风机电流监控数据-' + time
|
||||||
|
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
|
||||||
|
}
|
||||||
const daySelect = (val) => {
|
const daySelect = (val) => {
|
||||||
|
clickDay.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getFanInfo(openEquipmentId.value, 'day', val)
|
getFanInfo(openEquipmentId.value, 'day', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -222,6 +264,7 @@ const daySelect = (val) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const monthSelect = (val) => {
|
const monthSelect = (val) => {
|
||||||
|
clickMonth.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getFanInfo(openEquipmentId.value, 'month', val)
|
getFanInfo(openEquipmentId.value, 'month', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -401,12 +444,14 @@ const handleOpenChart = (item) => {
|
|||||||
chooseDayRef.value.clearData()
|
chooseDayRef.value.clearData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
clickMonth.value=''
|
||||||
|
clickDay.value=''
|
||||||
isVisited.value = true
|
isVisited.value = true
|
||||||
selectTimeButton.value = 2
|
selectTimeButton.value = 2
|
||||||
openEquipmentId.value = item.equipmentId
|
openEquipmentId.value = item.equipmentId
|
||||||
isFullScreen.value = false
|
isFullScreen.value = false
|
||||||
getFanInfo(item.equipmentId, 'day', '', true)
|
getFanInfo(item.equipmentId, 'day', '', true)
|
||||||
if (item.equipmentType ==="frequency1") {
|
if (item.equipmentType === "frequency1") {
|
||||||
fanIndex.value = '一'
|
fanIndex.value = '一'
|
||||||
} else {
|
} else {
|
||||||
fanIndex.value = '二'
|
fanIndex.value = '二'
|
||||||
@@ -647,7 +692,6 @@ const initChart = (type, valueA, valueB, valueC, top) => {
|
|||||||
formatter: (params) => {
|
formatter: (params) => {
|
||||||
let res = ` <div style="font-size: 52px;font-family: PingFang SC-Regular, PingFang SC;font-weight: 400;color: #EFEEEE;margin-bottom: -30px;margin-left: 20px">${params[0].name}</div>` + '<br/>'
|
let res = ` <div style="font-size: 52px;font-family: PingFang SC-Regular, PingFang SC;font-weight: 400;color: #EFEEEE;margin-bottom: -30px;margin-left: 20px">${params[0].name}</div>` + '<br/>'
|
||||||
for (let i = 0; i < params.length; i++) {
|
for (let i = 0; i < params.length; i++) {
|
||||||
// console.log('params[i]', params[i])
|
|
||||||
res += `
|
res += `
|
||||||
<div style="font-size: 52px;line-height: 48px;font-family: Bebas Neue-Regular, Bebas Neue;font-weight: 400;margin:0 20px 30px 20px;"><span style="color: #FFFFFF">${params[i].seriesName}: </span><span style="background: linear-gradient(180deg, #F5B85F 0%, #FFFFFF 100%);background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;">${params[i].value}</span></div>
|
<div style="font-size: 52px;line-height: 48px;font-family: Bebas Neue-Regular, Bebas Neue;font-weight: 400;margin:0 20px 30px 20px;"><span style="color: #FFFFFF">${params[i].seriesName}: </span><span style="background: linear-gradient(180deg, #F5B85F 0%, #FFFFFF 100%);background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;">${params[i].value}</span></div>
|
||||||
`;
|
`;
|
||||||
@@ -655,15 +699,6 @@ const initChart = (type, valueA, valueB, valueC, top) => {
|
|||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
toolbox: {
|
|
||||||
show: false,
|
|
||||||
right: 10,
|
|
||||||
feature: {
|
|
||||||
dataZoom: {
|
|
||||||
yAxisIndex: 'none'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dataZoom: [{
|
dataZoom: [{
|
||||||
type: 'inside',
|
type: 'inside',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
|
<div id="used-ele" :style="{ backgroundColor: bgImage }" @click="handleOpenChart">
|
||||||
<!-- <div v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">-->
|
<!-- <div v-if="electricityConsumptionMonthly===0&&monthlySavings===0" class="showNull ">-->
|
||||||
<!-- <div class="loading" v-if="loading===0"></div>-->
|
<!-- <div class="loading" v-if="loading===0"></div>-->
|
||||||
<!-- {{ loading === 0 ? '加载中...' : '暂无数据~' }}-->
|
<!-- {{ loading === 0 ? '加载中...' : '暂无数据~' }}-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="container" ref="length">
|
<div class="container" ref="length">
|
||||||
<div class="value" ref="valueA"></div>
|
<div class="value" ref="valueA"></div>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="digital-tunnel">
|
<div class="digital-tunnel">
|
||||||
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="2175px" :modal="false" id="eleDialog">
|
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="2175px" :modal="false" id="eleDialog">
|
||||||
<div class="left-top-icon"></div>
|
<div class="left-top-icon"></div>
|
||||||
<div class="right-top-icon"></div>
|
<div class="right-top-icon"></div>
|
||||||
<div class="user-select">
|
<div class="user-select">
|
||||||
@@ -72,6 +72,9 @@
|
|||||||
<div style="width: 1px;"></div>
|
<div style="width: 1px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time-select">
|
<div class="time-select">
|
||||||
|
<div class="export-btn" @click="handleExport">
|
||||||
|
导出
|
||||||
|
</div>
|
||||||
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
||||||
<time-range-btn
|
<time-range-btn
|
||||||
:buttonList="timeList"
|
:buttonList="timeList"
|
||||||
@@ -97,6 +100,8 @@ import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
|
|||||||
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
||||||
import {getEleEchartsInfo} from "@/api/largeScreen";
|
import {getEleEchartsInfo} from "@/api/largeScreen";
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
|
import CsvExportor from "csv-exportor";
|
||||||
|
import {getNowFormatDate} from "@/utils/date.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
@@ -147,7 +152,7 @@ watch(() => props.eleData, (now) => {
|
|||||||
})
|
})
|
||||||
getBasicData(now.largeScreenElectricity)
|
getBasicData(now.largeScreenElectricity)
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
setValueA()
|
setValueA()
|
||||||
setValueB()
|
setValueB()
|
||||||
})
|
})
|
||||||
@@ -166,6 +171,33 @@ watch(() => props.eleData, (now) => {
|
|||||||
// setValueA()
|
// setValueA()
|
||||||
// setValueB()
|
// setValueB()
|
||||||
// }, {deep: true});
|
// }, {deep: true});
|
||||||
|
const handleExport = () => {
|
||||||
|
const header = ['月总用电量(kwh)', '月总节省电量(kwh)', '时间', '日用电量(kwh)', '日节省量(kwh)'];
|
||||||
|
let newArray = []
|
||||||
|
chartData.dates.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
totalElectricityConsumption: chartData.totalElectricityConsumption,
|
||||||
|
saveElectricity: chartData.saveElectricity,
|
||||||
|
dates: chartData.dates[index],
|
||||||
|
consumptionValues: chartData.consumptionValues[index],
|
||||||
|
saveElectricityValues: chartData.saveElectricityValues[index]
|
||||||
|
}
|
||||||
|
newArray.push(obj)
|
||||||
|
})
|
||||||
|
let time = ''
|
||||||
|
if (selectTimeButton.value === 1) {
|
||||||
|
if (monthValue.value) {
|
||||||
|
const index = monthValue.value.lastIndexOf("\-");
|
||||||
|
time = monthValue.value.substring(0, index)
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(false)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 0) {
|
||||||
|
time = new Date().getFullYear() + '年'
|
||||||
|
}
|
||||||
|
const name = changeNum(chooseChartFan.value) + '用电量监控数据-' + time
|
||||||
|
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
|
||||||
|
}
|
||||||
//放大弹窗
|
//放大弹窗
|
||||||
const fullScreen = () => {
|
const fullScreen = () => {
|
||||||
const fan = document.getElementById('eleDialog')
|
const fan = document.getElementById('eleDialog')
|
||||||
@@ -204,7 +236,7 @@ const setValueA = () => {
|
|||||||
if (electricityConsumptionMonthly.value === 0 || length.value === null) {
|
if (electricityConsumptionMonthly.value === 0 || length.value === null) {
|
||||||
valueA.value.style.height = `0px`;
|
valueA.value.style.height = `0px`;
|
||||||
}
|
}
|
||||||
let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) /100000;
|
let width = (electricityConsumptionMonthly.value * length.value?.offsetHeight) / 100000;
|
||||||
valueA.value.style.height = `${width}px`;
|
valueA.value.style.height = `${width}px`;
|
||||||
}
|
}
|
||||||
const setValueB = () => {
|
const setValueB = () => {
|
||||||
@@ -243,7 +275,7 @@ const timeSelect = (index) => {
|
|||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getFanInfo(openEquipmentId.value, changeDate(index))
|
getFanInfo(openEquipmentId.value, changeDate(index))
|
||||||
} else {
|
} else {
|
||||||
getFanInfo(openEquipmentId.value, changeDate(index),'',true)
|
getFanInfo(openEquipmentId.value, changeDate(index), '', true)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const changeFanData = (val) => {
|
const changeFanData = (val) => {
|
||||||
@@ -252,7 +284,7 @@ const changeFanData = (val) => {
|
|||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value)
|
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value)
|
||||||
} else {
|
} else {
|
||||||
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value,true)
|
getFanInfo(val, changeDate(selectTimeButton.value), monthValue.value, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const getFanInfo = (equipmentId, type = 'month', time = '', flag) => {
|
const getFanInfo = (equipmentId, type = 'month', time = '', flag) => {
|
||||||
@@ -278,13 +310,13 @@ const getFanInfo = (equipmentId, type = 'month', time = '', flag) => {
|
|||||||
const fanChart = document.getElementById('containerEle')
|
const fanChart = document.getElementById('containerEle')
|
||||||
const erd = elementResizeDetectorMaker();
|
const erd = elementResizeDetectorMaker();
|
||||||
erd.listenTo(document.getElementById('eleDialog'), (element) => {
|
erd.listenTo(document.getElementById('eleDialog'), (element) => {
|
||||||
fanChart.style.height = element.offsetHeight - 280+ 'px'
|
fanChart.style.height = element.offsetHeight - 280 + 'px'
|
||||||
myEcharts.resize();
|
myEcharts.resize();
|
||||||
});
|
});
|
||||||
if(!isFullScreen.value){
|
if (!isFullScreen.value) {
|
||||||
initChart(res.data.dates, res.data.consumptionValues, res.data.saveElectricityValues,'94%')
|
initChart(res.data.dates, res.data.consumptionValues, res.data.saveElectricityValues, '94%')
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
shrinkScreen()
|
shrinkScreen()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -295,6 +327,7 @@ const getFanInfo = (equipmentId, type = 'month', time = '', flag) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const handleOpenChart = () => {
|
const handleOpenChart = () => {
|
||||||
|
monthValue.value=''
|
||||||
selectTimeButton.value = 1
|
selectTimeButton.value = 1
|
||||||
isVisited.value = true
|
isVisited.value = true
|
||||||
openEquipmentId.value = fanList.value[0].value
|
openEquipmentId.value = fanList.value[0].value
|
||||||
@@ -305,7 +338,7 @@ const handleOpenChart = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
isFullScreen.value = false
|
isFullScreen.value = false
|
||||||
getFanInfo(openEquipmentId.value, 'month','',true)
|
getFanInfo(openEquipmentId.value, 'month', '', true)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化echarts实例方法
|
* 初始化echarts实例方法
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
<div style="width: 1px;"></div>
|
<div style="width: 1px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time-select">
|
<div class="time-select">
|
||||||
|
<div class="export-btn" @click="handleExport">
|
||||||
|
导出
|
||||||
|
</div>
|
||||||
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
<choose-day v-if="selectTimeButton===2" ref="chooseDayRef" @select="daySelect"/>
|
||||||
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
<choose-month v-if="selectTimeButton===1" ref="chooseMonthRef" @select="monthSelect"/>
|
||||||
<time-range-btn
|
<time-range-btn
|
||||||
@@ -53,6 +56,8 @@ import {getEchartsInfo} from "@/api/largeScreen";
|
|||||||
import ChooseDay from "@/components/chooseDay/index.vue"
|
import ChooseDay from "@/components/chooseDay/index.vue"
|
||||||
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
import ChooseMonth from "@/components/chooseMonth/index.vue"
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
|
import CsvExportor from "csv-exportor";
|
||||||
|
import {getNowFormatDate} from "@/utils/date.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
@@ -73,6 +78,8 @@ let dataZoomTop = reactive('87%')
|
|||||||
const showLoading = ref(false)
|
const showLoading = ref(false)
|
||||||
let myEcharts = reactive({});
|
let myEcharts = reactive({});
|
||||||
const wpList = ref([]);
|
const wpList = ref([]);
|
||||||
|
const clickMonth = ref('')
|
||||||
|
const clickDay = ref('')
|
||||||
watch(() => props.list, (now) => {
|
watch(() => props.list, (now) => {
|
||||||
wpList.value.forEach(item => {
|
wpList.value.forEach(item => {
|
||||||
now.forEach(newItem => {
|
now.forEach(newItem => {
|
||||||
@@ -86,6 +93,43 @@ watch(() => props.list, (now) => {
|
|||||||
watch(() => props.winData, (now) => {
|
watch(() => props.winData, (now) => {
|
||||||
getScreenInfo(now.windPressureSensorList)
|
getScreenInfo(now.windPressureSensorList)
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
|
//导出csv
|
||||||
|
const handleExport = () => {
|
||||||
|
let clickUnit = ''
|
||||||
|
wpList.value.forEach(item => {
|
||||||
|
if (item.equipmentName === windSort.value) {
|
||||||
|
clickUnit = item.unit
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const header = ['时间', `风压值(${clickUnit})`];
|
||||||
|
let newArray = []
|
||||||
|
chartData.dates.forEach((item, index) => {
|
||||||
|
let obj = {
|
||||||
|
dates: chartData.dates[index],
|
||||||
|
values: chartData.values[index]
|
||||||
|
}
|
||||||
|
newArray.push(obj)
|
||||||
|
})
|
||||||
|
let time = ''
|
||||||
|
if (selectTimeButton.value === 1) {
|
||||||
|
if (clickMonth.value) {
|
||||||
|
const index = clickMonth.value.lastIndexOf("\-");
|
||||||
|
time = clickMonth.value.substring(0, index)
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(false)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 2) {
|
||||||
|
if (clickDay.value) {
|
||||||
|
time = clickDay.value
|
||||||
|
} else {
|
||||||
|
time = getNowFormatDate(true)
|
||||||
|
}
|
||||||
|
} else if (selectTimeButton.value === 0) {
|
||||||
|
time = new Date().getFullYear() + '年'
|
||||||
|
}
|
||||||
|
const name = windSort.value + '监控数据-' + time
|
||||||
|
CsvExportor.downloadCsv(newArray, {header}, `${name}.csv`);
|
||||||
|
}
|
||||||
//放大弹窗
|
//放大弹窗
|
||||||
const handleFullScreen = () => {
|
const handleFullScreen = () => {
|
||||||
const titleName = document.getElementsByClassName('el-dialog__title')[0]
|
const titleName = document.getElementsByClassName('el-dialog__title')[0]
|
||||||
@@ -117,6 +161,7 @@ const shrinkScreen = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const daySelect = (val) => {
|
const daySelect = (val) => {
|
||||||
|
clickDay.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getWindInfo(windSortId.value, 'day', val)
|
getWindInfo(windSortId.value, 'day', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -124,6 +169,7 @@ const daySelect = (val) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const monthSelect = (val) => {
|
const monthSelect = (val) => {
|
||||||
|
clickMonth.value = val
|
||||||
if (isFullScreen.value) {
|
if (isFullScreen.value) {
|
||||||
getWindInfo(windSortId.value, 'month', val)
|
getWindInfo(windSortId.value, 'month', val)
|
||||||
} else {
|
} else {
|
||||||
@@ -173,6 +219,8 @@ const getWindInfo = (equipmentId, type = 'day', time = '', flag) => {
|
|||||||
|
|
||||||
const handleOpenChart = (item) => {
|
const handleOpenChart = (item) => {
|
||||||
selectTimeButton.value = 2
|
selectTimeButton.value = 2
|
||||||
|
clickMonth.value = ''
|
||||||
|
clickDay.value = ''
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (chooseMonthRef.value) {
|
if (chooseMonthRef.value) {
|
||||||
chooseMonthRef.value.clearData()
|
chooseMonthRef.value.clearData()
|
||||||
|
|||||||
@@ -18,9 +18,22 @@ export const dateFormat = (time = new Date().getTime(),flag) => { //YYYY年MM月
|
|||||||
return `${Y}年${M}月${D}日 星期${week}`;
|
return `${Y}年${M}月${D}日 星期${week}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export const getNowFormatDate = (flag) => {
|
||||||
|
let date = new Date(),
|
||||||
|
year = date.getFullYear(), //获取完整的年份(4位)
|
||||||
|
month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
|
||||||
|
strDate = date.getDate() // 获取当前日(1-31)
|
||||||
|
if (month < 10) month = `0${month}` // 如果月份是个位数,在前面补0
|
||||||
|
if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数,在前面补0
|
||||||
|
if(flag){
|
||||||
|
return `${year}-${month}-${strDate}`
|
||||||
|
}else {
|
||||||
|
return `${year}-${month}`
|
||||||
|
}
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
dateFormat
|
dateFormat,
|
||||||
|
getNowFormatDate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user