This commit is contained in:
‘937886381’ 2024-06-20 20:54:34 +08:00
parent cc800eae5d
commit 0eb17fa08b
7 changed files with 183 additions and 277 deletions

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-06-19 15:28:34 * @Date: 2024-06-19 15:28:34
* @LastEditTime: 2024-06-20 20:30:35 * @LastEditTime: 2024-06-20 20:49:07
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -58,7 +58,7 @@ export default {
"<br/>" + "<br/>" +
`<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` + `<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` +
`<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` + `<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].name.search('率') === "综合良率" `<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].seriesName === "综合良率"
? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%"
: params[i].seriesName === "转化效率" : params[i].seriesName === "转化效率"
? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%"

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-06-20 16:13:36 * @Date: 2024-06-20 16:13:36
* @LastEditTime: 2024-06-20 20:30:50 * @LastEditTime: 2024-06-20 20:49:23
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -65,7 +65,7 @@ export default {
"<br/>" + "<br/>" +
`<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` + `<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` +
`<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` + `<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].seriesName.search('率') === "综合良率" `<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].seriesName === "综合良率"
? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%"
: params[i].seriesName === "转化效率" : params[i].seriesName === "转化效率"
? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%"

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-06-20 16:13:52 * @Date: 2024-06-20 16:13:52
* @LastEditTime: 2024-06-20 20:30:53 * @LastEditTime: 2024-06-20 20:49:28
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -58,7 +58,7 @@ export default {
"<br/>" + "<br/>" +
`<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` + `<span style='display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}'></span>` +
`<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` + `<span style='display:inline-block;width:150px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].seriesName.search('率') === "综合良率" `<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${params[i].seriesName === "综合良率"
? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%" ? (params[i].value ? params[i].value.toFixed(2) : 0.0) + "%"
: params[i].seriesName === "转化效率" : params[i].seriesName === "转化效率"
? params[i].value+ "%" ? params[i].value+ "%"

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-15 10:49:13 * @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-20 15:40:06 * @LastEditTime: 2024-06-20 20:46:53
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -13,58 +13,48 @@
</div> </div>
<div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto;"> <div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip"> <el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date"> <el-form-item label="时间维度" prop="type">
<el-select size="small" clearable v-model="listQuery.type" placeholder="请选择"> <el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator="" <el-date-picker size="small" clearable v-model="listQuery.reportTime" type="datetimerange" range-separator=""
start-placeholder="开始日期" value-format="yyyy-MM-dd" @change="changeDayTime" end-placeholder="结束日期"> start-placeholder="开始日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="changeDayTime"
end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="listQuery.start" type="week" format="yyyy 第 WW 周"
style="width: 180px" @change="onValueChange"> placeholder="选择周" style="width: 180px" @change="onValueChange">
</el-date-picker> </el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="listQuery.end" type="week" format="yyyy 第 WW 周"
style="width: 180px" @change="onValueChange"> placeholder="选择周" style="width: 180px" @change="onValueChange">
</el-date-picker>
<!-- <span v-if="listQuery.start && listQuery.end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="monthrange"
value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 3" label="时间范围" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyy-MM-DD" <el-date-picker size="small" clearable v-model="listQuery.start" value-format="yyyy-MM-dd" type="year"
range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间"> placeholder="开始时间">
</el-date-picker> </el-date-picker>
~ ~
<el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year" <el-date-picker size="small" clearable v-model="listQuery.end" value-format="yyyy-MM-dd" type="year"
placeholder="结束时间" @change="getYear"> placeholder="结束时间" @change="getYear">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button> <el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button> <el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
@ -96,8 +86,7 @@ export default {
return { return {
factoryList, factoryList,
factoryArray, factoryArray,
start: undefined,
end: undefined,
listQuery: { listQuery: {
pageNo: 1, pageNo: 1,
pageSize: 999, pageSize: 999,
@ -108,6 +97,8 @@ export default {
type: 2, type: 2,
startDate: undefined, startDate: undefined,
endDate: undefined, endDate: undefined,
start: undefined,
end: undefined,
reportTime: [] reportTime: []
}, },
timeList: [ timeList: [
@ -201,67 +192,40 @@ export default {
// }, // },
mounted() { mounted() {
// this.getOverView() // this.getOverView()
const currentMonth = new Date() const today = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
this.changeTime() this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD')
this.listQuery.endDate = moment(today).format('yyyy-MM-DD')
this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate]
this.getDataList() this.getDataList()
}, },
methods: { methods: {
getYear(e) { getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) { if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) {
this.$message({ this.$message({
message: '年份起止时间不能超过十年', message: '年份起止时间不能超过十年',
type: 'warning' type: 'warning'
}); });
this.start = undefined this.listQuery.reportTime = []
this.end = undefined this.listQuery.start = undefined
this.listQuery.end = undefined
// console.log(); // console.log();
} else { } else {
if (Number(this.end) < Number(this.start)) { this.listQuery.startDate = this.listQuery.start
this.$message({ this.listQuery.endDate = this.listQuery.end
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
// console.log(e); // console.log(e);
}, },
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k onValueChange(picker, k) { // k
if (this.start && this.end) { // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1])
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') if (this.listQuery.start && this.listQuery.end) {
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') console.log(this.listQuery.reportTime)
this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) { if (numDays > 168) {
console.log(numDays) console.log(numDays)
@ -270,20 +234,21 @@ export default {
type: 'warning' type: 'warning'
}); });
} else { } else {
this.listQuery.startDate = this.date1 this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
this.listQuery.endDate = this.date2 this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
} }
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
changeDayTime() { changeDayTime() {
if (this.listQuery.reportTime) { if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000);
if (numDays > 30) { if (numDays > 30) {
this.$message({ this.$message({
message: '时间范围不能超过30天', message: '时间范围不能超过30天',
@ -299,26 +264,26 @@ export default {
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
getOverView() { changeTime(value) {
// getOverView().then(res => { if (this.listQuery.reportTime) {
// this.data = res.data const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0];
// console.log('aa', res.data) if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) {
// }) this.$message({
}, message: '时间范围不能超过24个月',
otherMethods(val) { type: 'warning'
this.detailOrUpdateVisible = true; });
// this.addOrEditTitle = ""; this.listQuery.reportTime = [];
this.$nextTick(() => { } else {
// this.$refs.detailOrUpdate.init(val.data.id); this.listQuery.startDate = this.listQuery.reportTime[0]
}); this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
}, },
async getDataList() { async getDataList() {
this.otherProps = [] this.otherProps = []
console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01'
this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31'
}
let arr = [] let arr = []
this.currentMenu === '邯郸' ? arr.push(1) : arr.push(2) this.currentMenu === '邯郸' ? arr.push(1) : arr.push(2)
this.listQuery.factory = arr this.listQuery.factory = arr

View File

@ -138,6 +138,7 @@ export default {
endDate: undefined, endDate: undefined,
start: undefined, start: undefined,
end: undefined, end: undefined,
reportTime:[],
}, },
timeList: [ timeList: [
{ {
@ -372,9 +373,11 @@ export default {
}, },
mounted() { mounted() {
// this.getOverView() // this.getOverView()
const currentMonth = new Date() const today = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
this.changeTime() this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD')
this.listQuery.endDate = moment(today).format('yyyy-MM-DD')
this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate]
this.getDataList() this.getDataList()
}, },
methods: { methods: {

View File

@ -472,67 +472,40 @@ export default {
}, },
mounted() { mounted() {
// this.getOverView() // this.getOverView()
const currentMonth = new Date() const today = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
this.changeTime() this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD')
this.listQuery.endDate = moment(today).format('yyyy-MM-DD')
this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate]
this.getDataList() this.getDataList()
}, },
methods: { methods: {
getYear(e) { getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) { if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) {
this.$message({ this.$message({
message: '年份起止时间不能超过十年', message: '年份起止时间不能超过十年',
type: 'warning' type: 'warning'
}); });
this.start = undefined this.listQuery.reportTime = []
this.end = undefined this.listQuery.start = undefined
this.listQuery.end = undefined
// console.log(); // console.log();
} else { } else {
if (Number(this.end) < Number(this.start)) { this.listQuery.startDate = this.listQuery.start
this.$message({ this.listQuery.endDate = this.listQuery.end
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
// console.log(e); // console.log(e);
}, },
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k onValueChange(picker, k) { // k
if (this.start && this.end) { // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1])
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') if (this.listQuery.start && this.listQuery.end) {
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') console.log(this.listQuery.reportTime)
this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) { if (numDays > 168) {
console.log(numDays) console.log(numDays)
@ -541,20 +514,21 @@ export default {
type: 'warning' type: 'warning'
}); });
} else { } else {
this.listQuery.startDate = this.date1 this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
this.listQuery.endDate = this.date2 this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
} }
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
changeDayTime() { changeDayTime() {
if (this.listQuery.reportTime) { if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000);
if (numDays > 30) { if (numDays > 30) {
this.$message({ this.$message({
message: '时间范围不能超过30天', message: '时间范围不能超过30天',
@ -570,18 +544,23 @@ export default {
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
getOverView() { changeTime(value) {
// getOverView().then(res => { if (this.listQuery.reportTime) {
// this.data = res.data const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0];
// console.log('aa', res.data) if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) {
// }) this.$message({
}, message: '时间范围不能超过24个月',
otherMethods(val) { type: 'warning'
this.detailOrUpdateVisible = true; });
// this.addOrEditTitle = ""; this.listQuery.reportTime = [];
this.$nextTick(() => { } else {
// this.$refs.detailOrUpdate.init(val.data.id); this.listQuery.startDate = this.listQuery.reportTime[0]
}); this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
}, },
async getDataList() { async getDataList() {
this.otherProps = [] this.otherProps = []
@ -589,10 +568,6 @@ export default {
this.chartMsgTarget.xData = [] this.chartMsgTarget.xData = []
this.chartMsgYearTarget.xData = [] this.chartMsgYearTarget.xData = []
console.log(this.listQuery); console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01'
this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31'
}
let arr = [] let arr = []
this.currentMenu === '邯郸' ? arr.push(1) : arr.push(0) this.currentMenu === '邯郸' ? arr.push(1) : arr.push(0)
this.listQuery.factory = arr this.listQuery.factory = arr

View File

@ -6,61 +6,48 @@
<!-- </div> --> <!-- </div> -->
<div class="search"> <div class="search">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip"> <el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date"> <el-form-item label="时间维度" prop="type">
<el-select size="small" clearable v-model="listQuery.type" placeholder="请选择"> <el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator="" <el-date-picker size="small" clearable v-model="listQuery.reportTime" type="datetimerange" range-separator=""
start-placeholder="开始日期" value-format="yyyy-MM-dd" @change="changeDayTime" end-placeholder="结束日期"> start-placeholder="开始日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="changeDayTime"
end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="listQuery.start" type="week" format="yyyy 第 WW 周"
style="width: 180px" @change="onValueChange"> placeholder="选择周" style="width: 180px" @change="onValueChange">
</el-date-picker> </el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="listQuery.end" type="week" format="yyyy 第 WW 周"
style="width: 180px" @change="onValueChange"> placeholder="选择周" style="width: 180px" @change="onValueChange">
</el-date-picker>6 </el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px"> <!-- <span v-if="listQuery.start && listQuery.end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }} {{ date1 }} {{ date2 }} {{ weekNum }}
</span> --> </span> -->
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 2" label="时间范围" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyy-MM-DD" <el-date-picker size="small" clearable v-model="listQuery.reportTime" type="monthrange"
range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime"> value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.type === 3" label="时间" prop="reportTime"> <el-form-item v-show="listQuery.type === 3" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year" <el-date-picker size="small" clearable v-model="listQuery.start" value-format="yyyy-MM-dd" type="year"
placeholder="开始时间"> placeholder="开始时间">
</el-date-picker> </el-date-picker>
~ ~
<el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year" <el-date-picker size="small" clearable v-model="listQuery.end" value-format="yyyy-MM-dd" type="year"
placeholder="结束时间" @change="getYear"> placeholder="结束时间" @change="getYear">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button> <el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button> <el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -83,11 +70,11 @@
</el-row> </el-row>
<el-row v-else> <el-row v-else>
<!-- <el-col :span="24"> --> <!-- <el-col :span="24"> -->
<div class="blueTip"> <div class="blueTip">
产量及良率对比 产量及良率对比
</div> </div>
<bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId" <bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId"
:chartNum="chartNum" /> :chartNum="chartNum" />
<!-- </el-col> --> <!-- </el-col> -->
<!-- <el-col :span="8"> <!-- <el-col :span="8">
<div class="blueTip"> <div class="blueTip">
@ -127,6 +114,8 @@ export default {
// size: 10, // size: 10,
// current: 1, // current: 1,
factory: null, factory: null,
start: undefined,
end: undefined,
// total: 0, // total: 0,
type: 2, type: 2,
startDate: undefined, startDate: undefined,
@ -431,67 +420,40 @@ export default {
}, },
mounted() { mounted() {
// this.getOverView() // this.getOverView()
const currentMonth = new Date() const today = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD'), moment(currentMonth).format('yyyy-MM-DD')] const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
this.changeTime() this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD')
this.listQuery.endDate = moment(today).format('yyyy-MM-DD')
this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate]
this.getDataList() this.getDataList()
}, },
methods: { methods: {
getYear(e) { getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) { if (this.listQuery.end - this.listQuery.start > 10 * 365 * 24 * 60 * 60 * 1000) {
this.$message({ this.$message({
message: '年份起止时间不能超过十年', message: '年份起止时间不能超过十年',
type: 'warning' type: 'warning'
}); });
this.start = undefined this.listQuery.reportTime = []
this.end = undefined this.listQuery.start = undefined
this.listQuery.end = undefined
// console.log(); // console.log();
} else { } else {
if (Number(this.end) < Number(this.start)) { this.listQuery.startDate = this.listQuery.start
this.$message({ this.listQuery.endDate = this.listQuery.end
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
// console.log(e); // console.log(e);
}, },
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k onValueChange(picker, k) { // k
if (this.start && this.end) { // console.log(this.listQuery.reportTime[0], this.listQuery.reportTime[1])
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD') if (this.listQuery.start && this.listQuery.end) {
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD') console.log(this.listQuery.reportTime)
this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000); const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) { if (numDays > 168) {
console.log(numDays) console.log(numDays)
@ -500,20 +462,21 @@ export default {
type: 'warning' type: 'warning'
}); });
} else { } else {
this.listQuery.startDate = this.date1 this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
this.listQuery.endDate = this.date2 this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
} }
} }
if (!this.start && !this.end) { if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined this.listQuery.startDate = undefined
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
changeDayTime() { changeDayTime() {
if (this.listQuery.reportTime) { if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0]) // this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 3600 * 1000);
if (numDays > 30) { if (numDays > 30) {
this.$message({ this.$message({
message: '时间范围不能超过30天', message: '时间范围不能超过30天',
@ -529,27 +492,27 @@ export default {
this.listQuery.endDate = undefined this.listQuery.endDate = undefined
} }
}, },
getOverView() { changeTime(value) {
// getOverView().then(res => { if (this.listQuery.reportTime) {
// this.data = res.data const numDays = this.listQuery.reportTime[1] - this.listQuery.reportTime[0];
// console.log('aa', res.data) if (numDays > 2 * 365 * 24 * 60 * 60 * 1000) {
// }) this.$message({
}, message: '时间范围不能超过24个月',
otherMethods(val) { type: 'warning'
this.detailOrUpdateVisible = true; });
// this.addOrEditTitle = ""; this.listQuery.reportTime = [];
this.$nextTick(() => { } else {
// this.$refs.detailOrUpdate.init(val.data.id); this.listQuery.startDate = this.listQuery.reportTime[0]
}); this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
}, },
async getDataList() { async getDataList() {
this.otherProps = [] this.otherProps = []
this.chartMsg.xData = [] this.chartMsg.xData = []
console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
let arr = [] let arr = []
this.currentMenu === '邯郸' ? arr.push(1) : arr.push(0) this.currentMenu === '邯郸' ? arr.push(1) : arr.push(0)
this.listQuery.factory = arr this.listQuery.factory = arr