|
@@ -1,45 +1,57 @@
|
|
|
<template>
|
|
|
<div style="width: 100%; height: 100%; padding:8px;">
|
|
|
<div v-show="showPage=="one"" style="width:100%;height:100%">
|
|
|
- <el-row>
|
|
|
- <el-radio-group v-model="timeType" size="small">
|
|
|
- <el-radio label="1">按日</el-radio>
|
|
|
- <el-radio label="2">按月</el-radio>
|
|
|
- <el-radio label="3">按年</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- <div style="width:1px;height:100%;display:inline-block;margin: 0 20px; height: 28px; vertical-align: middle;" />
|
|
|
- <span class="title2">时间:</span>
|
|
|
- <!-- <div style="display: inline-block; margin-left: 5px; width:300px;">
|
|
|
- <el-date-picker v-if="timeType == '1'" v-model="statisticTime" type="daterange" size="small"
|
|
|
- style="width: 100%;" range-separator="至" start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期" align="right" value-format="yyyy-MM-dd"/>
|
|
|
- <el-date-picker v-if="timeType == '2'" v-model="statisticMonth" type="monthrange" size="small"
|
|
|
- style="width: 100%;" range-separator="至" start-placeholder="开始月份"
|
|
|
- end-placeholder="结束月份" placeholder="选择月份" align="right" value-format="yyyy-MM"/>
|
|
|
- <el-date-picker v-if="timeType == '3'" v-model="statisticYear" type="year" size="small"
|
|
|
- style="width: 100%;" placeholder="选择年份" align="right" value-format="yyyy"/>
|
|
|
- </div> -->
|
|
|
- <el-date-picker v-model="startTime" size="small" :type="dateType" placeholder="请选择开始时间" :picker-options="startOptions" :value-format="dateFormData" />
|
|
|
- <span v-if="this.endShow"> ~</span>
|
|
|
- <el-date-picker v-if="this.endShow" v-model="endTime" size="small" :type="dateType" placeholder="请选择结束时间" :picker-options="endOptions" :value-format="dateFormData" />
|
|
|
- <el-button size="small" type="primary" @click="query()">查询</el-button>
|
|
|
- <export-btn table-id="classficationStatistic" :file="title" />
|
|
|
- </el-row>
|
|
|
- <div style="width:100%;height:calc(100% - 46px);margin-top:8px;">
|
|
|
- <div style="width:350px;height:100%;float:left;">
|
|
|
+ <div style="width:100%;height:calc(100% - 6px);margin-top:8px;">
|
|
|
+ <div style="width:500px;height:100%;float:left;">
|
|
|
<div style="width:100%;height:100%;padding:12px;border:1px solid rgb(232,232,232);background:rgb(248,248,248);border-radius:4px;">
|
|
|
<div style=" display: flex; align-items: center;">
|
|
|
- <span class="title2" style="flex: 1;">查询条件:{{ list.length }} 条</span>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="searchTime"
|
|
|
+ size="small"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ style="margin-right: 5px;"
|
|
|
+ />
|
|
|
+ <el-button size="mini" type="primary" @click="queryTJ()">查询</el-button>
|
|
|
<el-button size="mini" type="primary" plain @click="addMission">添加条件</el-button>
|
|
|
</div>
|
|
|
- <div style="width:100%;height:calc(100% - 36px);overflow-y:auto;margin-top:8px;border:1px solid #bfbfbf;border-radius:4px;padding:0 8px;">
|
|
|
- <el-tag v-for="(tag, index) in list" :key="index" closable type="" style="width:100%;margin-top:8px;" @close="list.splice(index, 1)">
|
|
|
- {{ fixIndex[tag.typeId] + ' ( ' + tag.startBore + ' mm ~ ' + tag.endBore + ' mm )' }}
|
|
|
+ <div style=" display: flex; align-items: center;height: 26px;margin-top: 10px">
|
|
|
+ <span class="title2" style="flex: 1;">查询条件:{{ list.length }} 条</span>
|
|
|
+ </div>
|
|
|
+ <div style="width:100%;height:calc(100% - 70px);overflow-y:auto;margin-top:8px;border:1px solid #bfbfbf;border-radius:4px;padding:0 8px;">
|
|
|
+ <el-tag v-for="(tag, index) in list" :key="index" closable type="" style="width:100%;margin-top:8px;" @close="deleteTj(index)">
|
|
|
+ {{ fixIndex[tag.typeId] + ' ( '+ tag.createTime + ' )' }}
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-loading="loading" style="width:calc(100% - 350px);height:100%;float:left;">
|
|
|
+ <div v-loading="loading" style="width:calc(100% - 500px);height:100%;float:left;">
|
|
|
+ <el-row style="padding-left: 10px;">
|
|
|
+ <el-radio-group v-model="timeType" size="small">
|
|
|
+ <el-radio label="1">按日</el-radio>
|
|
|
+ <el-radio label="2">按月</el-radio>
|
|
|
+ <el-radio label="3">按年</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <div style="width:1px;height:100%;display:inline-block;margin: 0 20px; height: 28px; vertical-align: middle;" />
|
|
|
+ <span class="title2">时间:</span>
|
|
|
+ <!-- <div style="display: inline-block; margin-left: 5px; width:300px;">
|
|
|
+ <el-date-picker v-if="timeType == '1'" v-model="statisticTime" type="daterange" size="small"
|
|
|
+ style="width: 100%;" range-separator="至" start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期" align="right" value-format="yyyy-MM-dd"/>
|
|
|
+ <el-date-picker v-if="timeType == '2'" v-model="statisticMonth" type="monthrange" size="small"
|
|
|
+ style="width: 100%;" range-separator="至" start-placeholder="开始月份"
|
|
|
+ end-placeholder="结束月份" placeholder="选择月份" align="right" value-format="yyyy-MM"/>
|
|
|
+ <el-date-picker v-if="timeType == '3'" v-model="statisticYear" type="year" size="small"
|
|
|
+ style="width: 100%;" placeholder="选择年份" align="right" value-format="yyyy"/>
|
|
|
+ </div> -->
|
|
|
+ <el-date-picker v-model="startTime" size="small" :type="dateType" placeholder="请选择开始时间" :picker-options="startOptions" :value-format="dateFormData" />
|
|
|
+ <span v-if="this.endShow"> ~</span>
|
|
|
+ <el-date-picker v-if="this.endShow" v-model="endTime" size="small" :type="dateType" placeholder="请选择结束时间" :picker-options="endOptions" :value-format="dateFormData" />
|
|
|
+ <el-button size="small" type="primary" @click="query()">查询</el-button>
|
|
|
+ <export-btn table-id="classficationStatistic" :file="title" />
|
|
|
+ </el-row>
|
|
|
<h3 style=" height: 16px; line-height: 16px; font-size: 16px; text-align: center; margin-bottom: 15px;">{{ title }}</h3>
|
|
|
<el-table
|
|
|
id="classficationStatistic"
|
|
@@ -78,7 +90,7 @@
|
|
|
<el-option v-for="item in fixs" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-row>
|
|
|
- <el-row style="margin-top: 8px;">
|
|
|
+ <!-- <el-row style="margin-top: 8px;">
|
|
|
<span class="title2">口径范围:</span>
|
|
|
<el-input-number
|
|
|
v-model="radioFrom"
|
|
@@ -96,6 +108,16 @@
|
|
|
:step="radioTo < 1 ? (Math.pow(10, -(radioTo + '').replace(/\d+\.(\d*)/,'$1').length)) : (Math.pow(10,(Math.floor(radioTo) + '').length - ((radioTo + '')[0] == '1' ? 2 : 1)))"
|
|
|
/>
|
|
|
<span class="title2">(mm)</span>
|
|
|
+ </el-row> -->
|
|
|
+ <el-row style="margin-top: 8px;">
|
|
|
+ <span class="title2">录入时间:</span>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formInfo.createTime"
|
|
|
+ size="small"
|
|
|
+ style="margin-left: 5px;"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ />
|
|
|
</el-row>
|
|
|
<el-row style="margin-top: 8px;">
|
|
|
<span class="title2">维护数量:</span>
|
|
@@ -144,9 +166,11 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import request from '@/utils/request'
|
|
|
+import { getRepairQueryCondition, postRepairQueryCondition, deleteRepairQueryCondition } from '@/api/wxfltj'
|
|
|
import ExportBtn from '../components/ExportBtn'
|
|
|
import baoyang from '../wxWeiXiuBaoYangTaiZhang/widget.vue'
|
|
|
import weixiu from '../wxWeiXiuJiLuTaiZhang/widget.vue'
|
|
|
+import moment from 'moment'
|
|
|
export default {
|
|
|
name: 'WxWeiHuFenLeiTongJi',
|
|
|
components: { ExportBtn, baoyang, weixiu },
|
|
@@ -174,6 +198,7 @@ export default {
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
endShow: true,
|
|
|
+ searchTime: [],
|
|
|
startOptions: {
|
|
|
disabledDate: time => {
|
|
|
if (this.endTime) {
|
|
@@ -322,18 +347,20 @@ export default {
|
|
|
},
|
|
|
addMissionTrue() {
|
|
|
if (!this.fixType) return this.$message.error('请选择维修类型')
|
|
|
- if (this.radioFrom + '' == 'undefined') return this.$message.error('请填写最小口径')
|
|
|
- if (this.radioTo + '' == 'undefined') return this.$message.error('请填写最大口径')
|
|
|
+ // if (this.radioFrom + '' == 'undefined') return this.$message.error('请填写最小口径')
|
|
|
+ // if (this.radioTo + '' == 'undefined') return this.$message.error('请填写最大口径')
|
|
|
var data = {
|
|
|
typeId: this.fixType,
|
|
|
startBore: this.radioFrom,
|
|
|
endBore: this.radioTo,
|
|
|
...this.formInfo
|
|
|
}
|
|
|
- var { typeId, startBore, endBore } = data
|
|
|
- for (var i = 0, il = this.list, ii = il.length; i < ii; i++) {
|
|
|
- var di = il[i]
|
|
|
- if (typeId == di.typeId && startBore == di.startBore && endBore == di.endBore) return this.$message.error('已包含重复条件')
|
|
|
+ // var { typeId, startBore, endBore } = data
|
|
|
+ // startBore == di.startBore && endBore == di.endBore
|
|
|
+ const find = this.list.find(item => item.typeId === data.typeId)
|
|
|
+ if (find) {
|
|
|
+ this.$message.error('已包含重复条件')
|
|
|
+ return
|
|
|
}
|
|
|
switch (this.timeType) {
|
|
|
case '1':
|
|
@@ -355,13 +382,23 @@ export default {
|
|
|
data.endDate = ~~this.startTime + 1 + '-01-01 00:00:00'
|
|
|
break
|
|
|
}
|
|
|
- this.list.push(data)
|
|
|
- this.diaVisiable = false
|
|
|
+ postRepairQueryCondition({
|
|
|
+ 'createDate': moment(this.formInfo.createTime).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ 'description': this.formInfo.maintainContent,
|
|
|
+ 'maintainNumber': this.formInfo.mfNum || 0,
|
|
|
+ 'maintainedNumber': this.formInfo.orderNum || 0,
|
|
|
+ 'type': this.fixType
|
|
|
+ }).then((res) => {
|
|
|
+ // this.list.push(data)
|
|
|
+ this.diaVisiable = false
|
|
|
+ this.$message.success('添加成功')
|
|
|
+ this.queryTJ()
|
|
|
+ })
|
|
|
},
|
|
|
query() {
|
|
|
if (!this.list.length) return this.$message.error('请添加查询条件')
|
|
|
- if (!this.list[0].startDate) return this.$message.error('请选择开始时间')
|
|
|
- if (!this.list[0].endDate) return this.$message.error('请选择结束时间')
|
|
|
+ // if (!this.list[0].startDate) return this.$message.error('请选择开始时间')
|
|
|
+ // if (!this.list[0].endDate) return this.$message.error('请选择结束时间')
|
|
|
switch (this.timeType) {
|
|
|
case '1':
|
|
|
if (!this.startTime || !this.endTime) return this.$message.error('请选择统计时间')
|
|
@@ -369,7 +406,9 @@ export default {
|
|
|
break
|
|
|
case '2':
|
|
|
if (!this.startTime || !this.endTime) return this.$message.error('请选择统计月份')
|
|
|
+ // eslint-disable-next-line no-case-declarations
|
|
|
let endMonth = parseInt(this.endTime.split('-')[1]) + 1
|
|
|
+ // eslint-disable-next-line no-case-declarations
|
|
|
const endYear = this.endTime.split('-')[0]
|
|
|
endMonth = endMonth < 10 ? ('0' + endMonth) : endMonth
|
|
|
this.list.map(e => { e.startDate = this.startTime + '-01 00:00:00', e.endDate = endYear + '-' + endMonth + '-01 00:00:00' })
|
|
@@ -391,6 +430,7 @@ export default {
|
|
|
item.mfNum = this.list[index].mfNum
|
|
|
item.orderNum = this.list[index].orderNum
|
|
|
item.maintainContent = this.list[index].maintainContent
|
|
|
+ item.conditions = item.conditions.split('(')[0]
|
|
|
return item
|
|
|
})
|
|
|
if (this.list.length < 1) return this.title = '维护分类信息统计表'
|
|
@@ -410,6 +450,57 @@ export default {
|
|
|
row.timeType = this.timeType
|
|
|
this.searchData = row
|
|
|
this.showPage = type
|
|
|
+ },
|
|
|
+ // 查询条件
|
|
|
+ queryTJ() {
|
|
|
+ let parmas = {}
|
|
|
+ if (this.searchTime.length) {
|
|
|
+ parmas = {
|
|
|
+ 'startTime': moment(this.searchTime[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ 'endTime': moment(this.searchTime[1]).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ parmas = {
|
|
|
+ 'startTime': moment().subtract(3, 'day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ 'endTime': moment().add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getRepairQueryCondition(parmas).then((res) => {
|
|
|
+ if (res && res.code == 1) {
|
|
|
+ this.list = res.result.map(item => {
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ mfNum: item.maintainNumber,
|
|
|
+ orderNum: item.maintainedNumber,
|
|
|
+ createTime: item.createDate,
|
|
|
+ typeId: item.type,
|
|
|
+ maintainContent: item.description
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除条件
|
|
|
+ deleteTj(index) {
|
|
|
+ this.$confirm('是否要删除选中的数据?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ deleteRepairQueryCondition({
|
|
|
+ id: this.list[index].id
|
|
|
+ }).then((res) => {
|
|
|
+ if (res && res.code == 1) {
|
|
|
+ this.list.splice(index, 1)
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|