|
|
@@ -4,14 +4,23 @@
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="上传时间">
|
|
|
- <el-date-picker v-model="rangeDate" popper-class="v-date-picker" type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" @change="handleDateChange"> </el-date-picker>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="rangeDate"
|
|
|
+ popper-class="v-date-picker"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ @change="handleDateChange"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row justify="space-between" class="mb20">
|
|
|
<el-col :span="12" style="text-align: left">
|
|
|
<el-button size="small" icon="el-icon-plus" class="primaryBtn" @click="toAdd">新增监测数据</el-button>
|
|
|
- <input type="file" ref="fileInput" style="display:none;" @change="importData"/>
|
|
|
+ <input type="file" ref="fileInput" style="display: none" @change="importData" />
|
|
|
<el-button class="primaryBtn ml10" size="small" @click="toImportData"><img src="@/assets/image/common/u88.png" class="vIcon" /> 导入</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="12" style="text-align: right">
|
|
|
@@ -29,12 +38,10 @@
|
|
|
<el-table-column prop="realTimeVelocity" label="实时流速(m/s)" align="center"> </el-table-column>
|
|
|
<el-table-column prop="createTime" label="上传时间" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ formatDate(scope.row.createTime) }}
|
|
|
+ {{ formatDate(scope.row.createTime) }}
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="createrName" label="上传人" align="center">
|
|
|
-
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="createrName" label="上传人" align="center"> </el-table-column>
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="small" type="text" @click="handleEdit(scope.row)"><i class="el-icon-edit"></i> 编辑</el-button>
|
|
|
@@ -61,13 +68,16 @@
|
|
|
</div>
|
|
|
<el-dialog :title="title" :visible.sync="addDialogVisible">
|
|
|
<el-form ref="form" :rules="rules" :model="form" label-width="140px" class="addJcForm">
|
|
|
- <el-form-item label="实时高程:" prop="realTimeElevation"> <el-input v-model="form.realTimeElevation" type="number" :min="380" :max="420"></el-input> <span>m</span> </el-form-item>
|
|
|
- <el-form-item label="昨日最高高程:" prop="maxElevationYesterday"> <el-input v-model="form.maxElevationYesterday" type="number" :min="380" :max="420"> </el-input><span>m</span> </el-form-item>
|
|
|
+ <el-form-item label="实时高程:" prop="realTimeElevation">
|
|
|
+ <el-input v-model="form.realTimeElevation" type="number" :min="380" :max="420"></el-input> <span>m</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="昨日最高高程:" prop="maxElevationYesterday">
|
|
|
+ <el-input v-model="form.maxElevationYesterday" type="number" :min="380" :max="420"> </el-input><span>m</span>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="1小时雨量:"> <el-input v-model="form.precipitationOneH" type="number" :min="0"> </el-input> <span>mm</span> </el-form-item>
|
|
|
<el-form-item label="当天雨量:"> <el-input v-model="form.precipitationToday" type="number" :min="0"> </el-input> <span>mm</span> </el-form-item>
|
|
|
<el-form-item label="实时流量:" prop="realTimeDischarge"> <el-input v-model="form.realTimeDischarge" type="number" :min="0"> </el-input> <span>m³/s</span> </el-form-item>
|
|
|
<el-form-item label="实时流速:"> <el-input v-model="form.realTimeVelocity" type="number" :min="0"> </el-input><span>m/s</span> </el-form-item>
|
|
|
- <el-form-item label="创建人:"> <el-input v-model="form.createrName"> </el-input></el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="confirmSubmit" size="small" class="primaryBtn" v-loading="loading">确 定</el-button>
|
|
|
@@ -78,63 +88,62 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getMonitoringList, toAddMonitoring, toUpdateMonitoring,toDelete,toImport} from '@/api/monitoringDataApi'
|
|
|
+import { getMonitoringList, toAddMonitoring, toUpdateMonitoring, toDelete, toImport } from '@/api/monitoringDataApi'
|
|
|
import moment from 'moment'
|
|
|
export default {
|
|
|
- props:{
|
|
|
- id:Number
|
|
|
+ props: {
|
|
|
+ id: Number
|
|
|
},
|
|
|
data() {
|
|
|
const validateNumber = (rule, value, callback) => {
|
|
|
- // 确保是数字
|
|
|
- if (isNaN(value)) {
|
|
|
- return callback(new Error('请输入有效的数字'));
|
|
|
- }
|
|
|
-
|
|
|
- // 转换为数字类型
|
|
|
- const numValue = Number(value);
|
|
|
-
|
|
|
- if (numValue < 380) {
|
|
|
- return callback(new Error('数值不能小于380'));
|
|
|
- } else if (numValue > 420) {
|
|
|
- return callback(new Error('数值不能大于420'));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- };
|
|
|
+ // 确保是数字
|
|
|
+ if (isNaN(value)) {
|
|
|
+ return callback(new Error('请输入有效的数字'))
|
|
|
+ }
|
|
|
+
|
|
|
+ // 转换为数字类型
|
|
|
+ const numValue = Number(value)
|
|
|
+
|
|
|
+ if (numValue < 380) {
|
|
|
+ return callback(new Error('数值不能小于380'))
|
|
|
+ } else if (numValue > 420) {
|
|
|
+ return callback(new Error('数值不能大于420'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
searchForm: {
|
|
|
- stationId:this.id,
|
|
|
+ stationId: this.id,
|
|
|
pageSize: 10,
|
|
|
- pageNum:1,
|
|
|
+ pageNum: 1,
|
|
|
createUser: '',
|
|
|
startTime: '',
|
|
|
- endTime:''
|
|
|
+ endTime: ''
|
|
|
},
|
|
|
- loading:false,
|
|
|
- rangeDate:[],
|
|
|
+ loading: false,
|
|
|
+ rangeDate: [],
|
|
|
imageUrl: '',
|
|
|
form: {
|
|
|
stationId: this.id,
|
|
|
realTimeElevation: '',
|
|
|
- maxElevationYesterday:'',
|
|
|
- precipitationOneH:'',
|
|
|
- precipitationToday:'',
|
|
|
- realTimeDischarge:'',
|
|
|
- realTimeVelocity:'',
|
|
|
- createrName:''
|
|
|
+ maxElevationYesterday: '',
|
|
|
+ precipitationOneH: '',
|
|
|
+ precipitationToday: '',
|
|
|
+ realTimeDischarge: '',
|
|
|
+ realTimeVelocity: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- realTimeElevation: [
|
|
|
- { required: true, message: '请输入实时高程', trigger: 'blur' },
|
|
|
- { validator: validateNumber, trigger: ['blur', 'change'] }
|
|
|
- ],
|
|
|
- maxElevationYesterday: [
|
|
|
- { required: true, message: '请输入昨日最高高程', trigger: 'blur' },
|
|
|
- { validator: validateNumber, trigger: ['blur', 'change'] }
|
|
|
- ],
|
|
|
- realTimeDischarge:[{ required: true, message: '请输入实时流量', trigger: 'blur' }]
|
|
|
- },
|
|
|
+ realTimeElevation: [
|
|
|
+ { required: true, message: '请输入实时高程', trigger: 'blur' },
|
|
|
+ { validator: validateNumber, trigger: ['blur', 'change'] }
|
|
|
+ ],
|
|
|
+ maxElevationYesterday: [
|
|
|
+ { required: true, message: '请输入昨日最高高程', trigger: 'blur' },
|
|
|
+ { validator: validateNumber, trigger: ['blur', 'change'] }
|
|
|
+ ],
|
|
|
+ realTimeDischarge: [{ required: true, message: '请输入实时流量', trigger: 'blur' }]
|
|
|
+ },
|
|
|
tableData: [],
|
|
|
currentPage: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -144,14 +153,14 @@ export default {
|
|
|
type: 1
|
|
|
}
|
|
|
},
|
|
|
- mounted(){
|
|
|
+ mounted() {
|
|
|
this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
formatDate(date) {
|
|
|
return moment(date).format('YYYY-MM-DD HH:mm:ss')
|
|
|
},
|
|
|
- handleDateChange(val){
|
|
|
+ handleDateChange(val) {
|
|
|
if (val && val.length === 2) {
|
|
|
this.searchForm.startTime = this.formatDate(val[0])
|
|
|
this.searchForm.endTime = this.formatDate(val[1])
|
|
|
@@ -166,12 +175,12 @@ export default {
|
|
|
resetForm() {
|
|
|
this.rangeDate = []
|
|
|
this.searchForm = {
|
|
|
- stationId:this.id,
|
|
|
+ stationId: this.id,
|
|
|
pageSize: 10,
|
|
|
- pageNum:1,
|
|
|
+ pageNum: 1,
|
|
|
createUser: '',
|
|
|
startTime: '',
|
|
|
- endTime:''
|
|
|
+ endTime: ''
|
|
|
}
|
|
|
this.fetchData()
|
|
|
},
|
|
|
@@ -185,19 +194,26 @@ export default {
|
|
|
this.addDialogVisible = true
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
- toDelete({ id: row.id }).then((res) => {
|
|
|
- if (res.data) {
|
|
|
- this.$message({
|
|
|
- message: '删除成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.fetchData()
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: '删除失败',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- }
|
|
|
+ this.$confirm('是否删除监测数据?', '警告', {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonClass: 'primaryBtn'
|
|
|
+ }).then(() => {
|
|
|
+ toDelete({ id: row.id }).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.fetchData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '删除失败',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
@@ -209,7 +225,7 @@ export default {
|
|
|
this.fetchData()
|
|
|
},
|
|
|
fetchData() {
|
|
|
- getMonitoringList(this.searchForm).then((res)=>{
|
|
|
+ getMonitoringList(this.searchForm).then((res) => {
|
|
|
this.tableData = res.data.records
|
|
|
this.total = res.data.total
|
|
|
})
|
|
|
@@ -220,84 +236,82 @@ export default {
|
|
|
this.form = {
|
|
|
stationId: this.id,
|
|
|
realTimeElevation: '',
|
|
|
- maxElevationYesterday:'',
|
|
|
- precipitationOneH:'',
|
|
|
- precipitationToday:'',
|
|
|
- realTimeDischarge:'',
|
|
|
- realTimeVelocity:'',
|
|
|
- createrName:''
|
|
|
+ maxElevationYesterday: '',
|
|
|
+ precipitationOneH: '',
|
|
|
+ precipitationToday: '',
|
|
|
+ realTimeDischarge: '',
|
|
|
+ realTimeVelocity: ''
|
|
|
}
|
|
|
this.addDialogVisible = true
|
|
|
},
|
|
|
- confirmSubmit() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
+ confirmSubmit() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
- if (this.titleType == 'add') {
|
|
|
- toAddMonitoring(this.form).then((res) => {
|
|
|
- this.loading = false
|
|
|
- if (res.data) {
|
|
|
- this.$message({
|
|
|
- message: '新增成功',
|
|
|
- type: 'success'
|
|
|
+ if (this.titleType == 'add') {
|
|
|
+ toAddMonitoring(this.form).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.data) {
|
|
|
+ this.$message({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.closeModal()
|
|
|
+ this.fetchData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '新增失败',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
- this.closeModal()
|
|
|
- this.fetchData()
|
|
|
} else {
|
|
|
- this.$message({
|
|
|
- message: '新增失败',
|
|
|
- type: 'error'
|
|
|
+ toUpdateMonitoring(this.form).then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.data) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.closeModal()
|
|
|
+ this.fetchData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '修改失败',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
- } else {
|
|
|
- toUpdateMonitoring(this.form).then((res) => {
|
|
|
- this.loading = false
|
|
|
- if (res.data) {
|
|
|
- this.$message({
|
|
|
- message: '修改成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.closeModal()
|
|
|
- this.fetchData()
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: '修改失败',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- toImportData(){
|
|
|
+ toImportData() {
|
|
|
this.$refs.fileInput.click()
|
|
|
},
|
|
|
- importData(event){
|
|
|
- const file = event.target.files[0];
|
|
|
- toImport({file:file,stationId: this.id}).then((res)=>{
|
|
|
- if(res.data && res.data.errorCount == 0){
|
|
|
+ importData(event) {
|
|
|
+ const file = event.target.files[0]
|
|
|
+ toImport({ file: file, stationId: this.id }).then((res) => {
|
|
|
+ if (res.data && res.data.errorCount == 0) {
|
|
|
this.$message.success('导入成功')
|
|
|
this.fetchData()
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.$message.error('导入失败')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- closeModal(){
|
|
|
+ closeModal() {
|
|
|
this.addDialogVisible = false
|
|
|
- this.form={
|
|
|
+ this.form = {
|
|
|
stationId: this.id,
|
|
|
realTimeElevation: '',
|
|
|
- maxElevationYesterday:'',
|
|
|
- precipitationOneH:'',
|
|
|
- precipitationToday:'',
|
|
|
- realTimeDischarge:'',
|
|
|
- realTimeVelocity:'',
|
|
|
- createrName:''
|
|
|
+ maxElevationYesterday: '',
|
|
|
+ precipitationOneH: '',
|
|
|
+ precipitationToday: '',
|
|
|
+ realTimeDischarge: '',
|
|
|
+ realTimeVelocity: ''
|
|
|
}
|
|
|
- this.$refs.form.resetFields();
|
|
|
+ this.$refs.form.resetFields()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -323,7 +337,7 @@ export default {
|
|
|
.el-upload__tip {
|
|
|
color: #ff6a6c;
|
|
|
}
|
|
|
-.ml10{
|
|
|
+.ml10 {
|
|
|
margin-left: px-to-rem(10);
|
|
|
}
|
|
|
.vIcon {
|
|
|
@@ -345,4 +359,4 @@ export default {
|
|
|
:deep(.el-pager li.active) {
|
|
|
background-color: rgba(240, 105, 106, 1) !important;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|