|
@@ -0,0 +1,213 @@
|
|
|
+<template>
|
|
|
+ <div class="hum-page-container">
|
|
|
+ <div class="hum-page-title">测流设置</div>
|
|
|
+ <el-form :model="form" :rules="rules" size="large" ref="form" label-position="top">
|
|
|
+ <div class="hum-page-form">
|
|
|
+ <el-row :gutter="30">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="当前站点" prop="siteId">
|
|
|
+ <el-input
|
|
|
+ v-model="form.siteName"
|
|
|
+ disabled
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="策略编号" prop="planid">
|
|
|
+ <el-input
|
|
|
+ v-model="form.planid"
|
|
|
+ placeholder="请输入策略编号"
|
|
|
+ clearable
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="起测水位" prop="wlevel">
|
|
|
+ <el-input-number
|
|
|
+ placeholder="请输入起测水位"
|
|
|
+ v-model="form.wlevel"
|
|
|
+ @change="wlevel => plain.wlevel = wlevel"
|
|
|
+ :precision="2"
|
|
|
+ :step="0.1"
|
|
|
+ :min="plain.wlevelmin"
|
|
|
+ :max="plain.wlevelmax" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <div class="hum-page-title" style="margin-top: 30px">断面图</div>
|
|
|
+ <div class="hum-page-section">
|
|
|
+ <SectionChart :plain="plain" />
|
|
|
+ </div>
|
|
|
+ <div class="hum-page-title" style="margin-top: 30px">
|
|
|
+ <span>时间点</span>
|
|
|
+ <el-button type="primary" @click="addTime">新增</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="hum-page-section">
|
|
|
+ <el-table v-loading="loading" :data="times" border>
|
|
|
+ <el-table-column label="序号" type="index" />
|
|
|
+ <el-table-column label="时间点">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-time-picker
|
|
|
+ v-model="scope.row.time"
|
|
|
+ value-format="HH:mm"
|
|
|
+ :picker-options="{ format: 'HH:mm' }"
|
|
|
+ placeholder="请选择时间点">
|
|
|
+ </el-time-picker>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="deleteTime(scope.$index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="hum-page-form-action">
|
|
|
+ <el-button @click="$router.back()">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm" :loading="loading">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getSite, getConfig } from '@/api/site/site'
|
|
|
+import { savePlainTime, getSiteSection, getPlainTime } from '@/api/site/berthing'
|
|
|
+import SectionChart from './chart';
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ SectionChart,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ timeId: 0,
|
|
|
+ siteId: 0,
|
|
|
+ site: {},
|
|
|
+ loading: false,
|
|
|
+ times: [],
|
|
|
+ plain: {
|
|
|
+ sections: [],
|
|
|
+ wlevelmax: 0,
|
|
|
+ wlevelmin: 0,
|
|
|
+ wlevel: 0,
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ timeId: '',
|
|
|
+ id: '',
|
|
|
+ berthingId: '',
|
|
|
+ siteId: '',
|
|
|
+ siteName: '',
|
|
|
+ type: '',
|
|
|
+ planid: '',
|
|
|
+ wlevel: 0,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ planid: [
|
|
|
+ {required: true, message: "策略编号不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ wlevel: [
|
|
|
+ {required: true, message: "起测水位不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ title() {
|
|
|
+ return this.timeId ? '编辑时间点策略' : '新增时间点策略';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ loadPlainTime() {
|
|
|
+ getPlainTime(this.timeId).then((res) => {
|
|
|
+ const { timeId, planid, siteId, wlevel, times } = res.data || {};
|
|
|
+
|
|
|
+ this.plain.wlevel = wlevel;
|
|
|
+
|
|
|
+ this.form.timeId = timeId;
|
|
|
+ this.form.planid = planid;
|
|
|
+
|
|
|
+ this.times = (JSON.parse(times) || []).map((time) => ({ time }));
|
|
|
+
|
|
|
+ this.siteId = siteId;
|
|
|
+ this.loadSite();
|
|
|
+ this.loadSection();
|
|
|
+ this.loadConfig();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadSection() {
|
|
|
+ getSiteSection(this.siteId).then((res) => {
|
|
|
+ const { positions, berthingId } = res.data || {};
|
|
|
+ this.form.berthingId = berthingId;
|
|
|
+ this.plain.sections = JSON.parse(positions) || [];
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadConfig() {
|
|
|
+ getConfig(this.siteId).then((res) => {
|
|
|
+ const { wlevelmax, wlevelmin, type } = res.data || {};
|
|
|
+ this.plain.wlevelmax = wlevelmax;
|
|
|
+ this.plain.wlevelmin = wlevelmin;
|
|
|
+ this.form.wlevel = this.plain.wlevel;
|
|
|
+ this.form.type = type;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadSite() {
|
|
|
+ getSite(this.siteId).then((res) => {
|
|
|
+ const site = res.data || {};
|
|
|
+ this.form.id = this.id;
|
|
|
+ this.form.siteId = this.siteId;
|
|
|
+ this.form.siteName = site.siteName;
|
|
|
+ this.site = site;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addTime() {
|
|
|
+ this.times = [...this.times, { time: '' }];
|
|
|
+ },
|
|
|
+ deleteTime(index) {
|
|
|
+ this.times.splice(index, 1);
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (!valid) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ const data = {
|
|
|
+ ...this.form,
|
|
|
+ wlevelmax: this.plain.wlevelmax,
|
|
|
+ wlevelmin: this.plain.wlevelmin,
|
|
|
+ times: this.times.map(({ time }) => time).sort(),
|
|
|
+ }
|
|
|
+ savePlainTime(data).then(response => {
|
|
|
+ this.$modal.msgSuccess(this.timeId ? "编辑成功" : "新增成功");
|
|
|
+ this.$router.back();
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ download() {
|
|
|
+ window.open(`${process.env.VUE_APP_BASE_API}/berthing/downFile/${this.id}`, '_blank')
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.timeId = this.$route.params.id;
|
|
|
+ this.siteId = this.$route.query.siteId;
|
|
|
+ if (this.siteId) {
|
|
|
+ this.loadSite();
|
|
|
+ this.loadSection();
|
|
|
+ this.loadConfig();
|
|
|
+ }
|
|
|
+ if (this.timeId) {
|
|
|
+ this.loadPlainTime()
|
|
|
+ }
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.el-input-number {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+</style>
|