index.vue 14.7 KB
Newer Older
1 2 3
<template>
  <div class="app-container detail" style="background-color: rgb(238, 241, 245);">
    <div style="padding-top: 10px;background: #fff;height: 100%;">
4
      <el-row>
yaqizhang's avatar
yaqizhang committed
5
        <el-col :span="24" style="padding-left: 15px;margin-bottom: -10px;">
6 7 8
          <div style="height: 45px;" @click="$router.go(-1)">
            <el-button size="medium" type="text" style="font-size: 18px; color: rgb(7, 63, 112);float: left;">返回
            </el-button>
yaqizhang's avatar
yaqizhang committed
9 10
            <div style="float: left;margin-top: 8px;margin-left: 5px;"><img src="../../../assets/logo/fanhui.png"
                style="width: 25px;" alt=""></div>
11 12 13
          </div>
        </el-col>
      </el-row>
yaqizhang's avatar
yaqizhang committed
14
      <el-row style="width: 100%;height: 40px;">
yaqizhang's avatar
yaqizhang committed
15 16
        <el-col :span="24">
          <div style="">
yaqizhang's avatar
yaqizhang committed
17 18 19
            <ul>
              <li style="list-style: none;font-weight: 900;font-size: 20px;color: #053b6a;">管道管理详情</li>
            </ul>
yaqizhang's avatar
yaqizhang committed
20 21 22
          </div>
        </el-col>
      </el-row>
23 24
      <el-divider></el-divider>

yaqizhang's avatar
yaqizhang committed
25
      <el-row style="width: 100%;margin-top: -15px;margin-bottom: -5px;">
26 27
        <el-col :span="24">
          <div style="color: #31EAEA;height: 25px;">
yaqizhang's avatar
yaqizhang committed
28 29 30
            <ul>
              <li>详细信息</li>
            </ul>
31
          </div>
32
        </el-col>
33
      </el-row>
yaqizhang's avatar
yaqizhang committed
34
      <el-row style="width: 100%;padding: 10px;">
35
        <el-col :span="5">
yaqizhang's avatar
yaqizhang committed
36
          <el-form ref="form" v-model="form" label-width="100px" style="width: 100%;">
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
            <el-form-item label="管道名称:" prop="pipeName">
              <font>{{form.pipeName}}</font>
            </el-form-item>
            <el-form-item label="管道编号:" prop="pipeCode">
              <font>{{form.pipeCode}}</font>
            </el-form-item>
            <el-form-item label="管道类型:" prop="pipeType">
              <font v-if="form.pipeType == 1">地埋管线</font>
              <font v-if="form.pipeType == 2">地表管线</font>
            </el-form-item>
            <el-form-item label="管道压力:" prop="pipePressure">
              <font v-if="form.pipePressure == 1">低压</font>
              <font v-if="form.pipePressure == 2">中压</font>
              <font v-if="form.pipePressure == 3">次高压</font>
              <font v-if="form.pipePressure == 4">高压</font>
            </el-form-item>
            <el-form-item label="管道长度:" prop="pipeLength">
              <font>{{form.pipeLength}}</font>
            </el-form-item>
yaqizhang's avatar
yaqizhang committed
56
            <el-form-item label="备注信息:" prop="remarks" style="width: 170%;">
57 58 59
              <font>{{form.remarks}}</font>
            </el-form-item>
          </el-form>
60 61
        </el-col>
        <el-col :span="6">
yaqizhang's avatar
yaqizhang committed
62
          <el-form ref="form" v-model="form" label-width="100px" style="width: 100%;">
63 64 65 66 67 68 69 70 71
            <el-form-item label="管道地址:" prop="pipeAddr">
              <font>{{form.pipeAddr}}</font>
            </el-form-item>
            <el-form-item label="安装时间:" prop="installationTime">
              <font>{{form.installationTime}}</font>
            </el-form-item>
            <el-form-item label="最后巡检时间:" prop="inspectionTime">
              <font>{{form.inspectionTime}}</font>
            </el-form-item>
王晓倩's avatar
王晓倩 committed
72
            <el-form-item label="管道图片:" prop="iconUrl">
yaqizhang's avatar
yaqizhang committed
73 74 75
              <div style="width: 20%;">
                <el-image :src="form.iconUrl" :preview-src-list="[form.iconUrl]" style="width: auto;height: auto;"></el-image>
              </div>
76 77
            </el-form-item>
          </el-form>
78 79
        </el-col>
        <el-col :span="11">
yaqizhang's avatar
yaqizhang committed
80
          <div id="marbox"
yaqizhang's avatar
yaqizhang committed
81
            style="width: 100%;height: 390px;margin-top: -25px; border: 1px solid rgb(218, 213, 213);margin-bottom: 10px;">
82 83 84 85
            <div style="width: 100%;height: 100%" id="container"></div>
          </div>
        </el-col>
      </el-row>
86

yaqizhang's avatar
yaqizhang committed
87
      <div class="" style="width: 95%; height: 60px;margin-left: 50px;text-align: center;margin-top: 5px;">
yaqizhang's avatar
yaqizhang committed
88 89 90 91
        <el-button size="normal" type="primary" icon="el-icon-edit" @click="handleUpdate(form)"
          v-hasPermi="['device:pipe:edit']">修改</el-button>
        <el-button size="normal" type="primary" icon="el-icon-delete" @click="handleDelete(form)"
          v-hasPermi="['device:pipe:remove']">删除</el-button>
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109


        <!-- 添加或修改管道信息对话框 -->
        <el-dialog :title="title" :visible.sync="open" append-to-body @close="cancel">
          <el-form ref="editForm" :model="editForm" :rules="rules" label-width="135px">
            <el-col :span="23">
              <el-form-item label="管道名称" prop="pipeName">
                <el-input v-model="editForm.pipeName" placeholder="请输入管道名称" />
              </el-form-item>
            </el-col>
            <el-col :span="11">
              <el-form-item label="管道编号" prop="pipeCode">
                <el-input v-model="editForm.pipeCode" placeholder="请输入管道编号" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="管道长度" prop="pipeLength">
                <el-input type="number" min="0" v-model="editForm.pipeLength" placeholder="请输入管道长度">
yaqizhang's avatar
yaqizhang committed
110
                  <i slot="suffix" style="color: #000; font-style: normal; margin-right: 10px"></i>
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="23">
              <el-form-item label="管道所在地址" prop="pipeAddr">
                <el-input v-model="editForm.pipeAddr" placeholder="请输入管道所在地址" />
              </el-form-item>
            </el-col>
            <el-col :span="23">
              <el-form-item label="管道坐标" prop="coordinates">
                <el-col :span="18">
                  <el-input type="textarea" v-model="editForm.coordinates" placeholder="请输入管道坐标" />
                </el-col>
                <el-col :span="5" style="margin-left: 10px">
                  <el-button type="primary" plain @click="MapdialogFun">选择管道坐标</el-button>
                </el-col>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="管道类型" prop="pipeType">
                <el-radio-group v-model="editForm.pipeType">
                  <el-radio label="1">地埋管线</el-radio>
                  <el-radio label="2">地表管线</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="管道压力" prop="pipePressure">
                <!-- select -->
                <el-radio-group v-model="editForm.pipePressure">
                  <!-- 1低压,2中压,3次高压,4高压 -->
                  <el-radio label="1">低压</el-radio>
                  <el-radio label="2">中压</el-radio>
                  <el-radio label="3">次高压</el-radio>
                  <el-radio label="4">高压</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="管道图片上传" prop="iconUrl">
yaqizhang's avatar
yaqizhang committed
151
                <MyFileUpload listType="picture-card" @resFun="getFileInfo" @remove="listRemove" :fileArr="fileList" />
152 153 154 155 156 157
                <el-input v-show="false" disabled v-model="editForm.iconUrl"></el-input>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="安装日期" prop="installationTime">
                <el-col :span="11">
yaqizhang's avatar
yaqizhang committed
158 159
                  <el-date-picker clearable size="small" style="width: 100%" v-model="editForm.installationTime"
                    type="date" value-format="yyyy-MM-dd" placeholder="请选择安装日期">
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
                  </el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>
            <el-col :span="23">
              <el-form-item label="备注信息" prop="remarks">
                <el-input v-model="editForm.remarks" type="textarea" placeholder="请输入备注信息" />
              </el-form-item>
            </el-col>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
175

yaqizhang's avatar
yaqizhang committed
176 177
        <Mapdialog v-if="loadmap" :dialogTableVisible="dialogTableVisible" @dialogcancelFun="dialogcancelFun"
          @confirmFun="confirmFun($event)" :str="str"></Mapdialog>
178 179

      </div>
180 181 182 183 184 185
    </div>
  </div>
</template>

<script>

186
  import { updatePipe, getPipe } from "@/api/device/pipe";
187
  import gaodeMap from "utils/gaodeMap.js";
188 189
  import MyFileUpload from '@/components/MyFileUpload';
  import Mapdialog from "@/components/mapDialog/checkPipeLineLocation.vue";
190 191 192 193

  export default {
    name: "PipeDetail",
    components: {
194 195
      MyFileUpload,
      Mapdialog
196 197 198
    },
    data() {
      return {
199 200 201 202 203 204 205 206 207 208 209 210 211 212
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 上传文件列表
        fileList: [],
        // 地图
        loadmap: false,
        dialogTableVisible: false,
        // 管道类型字典
        typeOptions: [],
        str: "",
        // 管道压力数据字典
        pressureOptions: [],
213
        // 表单参数
214 215 216 217
        form: {
        },
        editForm: {
        },
218
        // 表单校验
yaqizhang's avatar
yaqizhang committed
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
        rules: {
          pipeName: [
            { required: true, message: "请输入管道名称", trigger: "blur" },
          ],
          pipeCode: [
            { required: true, message: "请输入管道编号", trigger: "blur" },
          ],
          pipeLength: [
            { required: true, message: "请输入管道长度", trigger: "blur" },
          ],
          pipeAddr: [
            { required: true, message: "请输入管道所在地址", trigger: "blur" },
          ],
          pipeType: [
            { required: true, message: "请选择管道类型", trigger: "blur" },
          ],
          pipePressure: [
            { required: true, message: "请选择管道压力", trigger: "blur" },
          ],
          coordinates: [
            { required: true, message: "请选择管道坐标", trigger: "blur" },
          ],
          iconUrl: [
            { required: true, message: "请上传图片", trigger: "change" },
          ],
          installationTime: [
yaqizhang's avatar
yaqizhang committed
245
            { required: true, message: "请选择日期", trigger: "change" },
yaqizhang's avatar
yaqizhang committed
246 247
          ],
        }
248 249 250 251 252
      };
    },
    created() {
      // 如果是跳转来的,则接受初始化参数
      this.pipeId = this.$route.query.pipeId;
yaqizhang's avatar
yaqizhang committed
253 254 255

    },
    mounted() {
256
      this.getDetail();
257 258 259 260 261 262
      this.getDicts("t_pipe_type").then(response => {
        this.typeOptions = response.data;
      });
      this.getDicts("t_pipe_pressure").then(response => {
        this.pressureOptions = response.data;
      });
yaqizhang's avatar
yaqizhang committed
263

264 265
    },
    methods: {
yaqizhang's avatar
yaqizhang committed
266 267
      getDetail() {
        getPipe(this.pipeId).then(response => {
268
          this.form = response.data;
yaqizhang's avatar
yaqizhang committed
269 270 271 272
          const { coordinates } = this.form;
          const path1 = eval(coordinates)[0];
          const path2 = eval(coordinates)[1];
          const path3 = [(Number(path1[0]) + Number(path2[0])) / 2, (Number(path1[1]) + Number(path2[1])) / 2];
273
          let gaoMap = new gaodeMap(process.env.VUE_APP_MAP_CENTER, path3);
yaqizhang's avatar
yaqizhang committed
274
          this.gaoMap = gaoMap;
王晓倩's avatar
王晓倩 committed
275
          this.gaoMap.onlyLine(this.form);
276 277
        });
      },
yaqizhang's avatar
yaqizhang committed
278
      getFileInfo(res) {
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
        this.editForm.iconUrl = res.url;
      },
      listRemove(e) {
        this.editForm.iconUrl = "";
        this.fileList = [];
      },
      confirmFun(res) {
        //确认选择坐标
        this.editForm.coordinates = res;
      },
      MapdialogFun() {
        this.loadmap = true;
        this.dialogTableVisible = true;
      },
      dialogcancelFun() {
        this.loadmap = false;
        this.dialogTableVisible = false;
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.fileList = [];
      },
      /** 修改按钮操作 */
      handleUpdate(res) {
        getPipe(res.pipeId).then(response => {
          this.editForm = response.data;
          if (this.editForm.iconUrl) {
            this.fileList.push({
              url: this.editForm.iconUrl,
            });
          }
yaqizhang's avatar
yaqizhang committed
311
          if (this.editForm.coordinates) {
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
            this.str = this.editForm.coordinates;
          }
          this.open = true;
          this.title = "修改管道信息";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["editForm"].validate(valid => {
          if (valid) {
            console.log(this.editForm);
            updatePipe(this.editForm).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              location.reload();
            });
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(res) {
        res.isDel = "1";
        var devices = " ";
yaqizhang's avatar
yaqizhang committed
335 336 337 338 339 340 341 342 343
        var tip = '';
        if(res.deviceInfoList != null){
          for (var i = 0; i < res.deviceInfoList.length; i++) {
            var obj = res.deviceInfoList[i];
            devices = devices + obj.deviceName + " ";
          }
          tip = '该管道下包含的设备(' + devices + ')将一并被删除', "警告"
        }else{
          tip = '请确认是否删除管道名称为"' + res.pipeName + '"的数据项'
344
        }
yaqizhang's avatar
yaqizhang committed
345 346
        
        this.$confirm(tip, {
347 348 349 350 351 352 353 354 355 356 357
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function () {
          return updatePipe(res);
        }).then(() => {
          this.$router.go(-1);
          this.msgSuccess("已删除");
        }).catch(() => {
        });
      },
358 359 360 361 362 363 364 365 366 367
    }
  }
</script>
<style>
  .el-divider--horizontal {
    display: block;
    height: 1px;
    width: 100%;
    margin: 20px 0;
  }
yaqizhang's avatar
yaqizhang committed
368 369 370 371 372

  .feedbackTime-div {
    float: left;
    margin-left: 150px;
    margin-top: 10px;
373
  }
yaqizhang's avatar
yaqizhang committed
374 375

  .feedbackTime {
376 377 378 379 380 381 382 383 384 385
    height: 120px;
    width: 120px;
    float: left;
    margin-left: 15px;
    margin-top: 5px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
yaqizhang's avatar
yaqizhang committed
386

387 388 389
  .el-card__body {
    padding: 5px 20px 20px 20px;
  }
yaqizhang's avatar
yaqizhang committed
390 391

  .detail .el-form {
392 393
    width: 20%;
  }
yaqizhang's avatar
yaqizhang committed
394 395

  .detail .el-form-item {
396 397
    margin-bottom: 0px;
  }
yaqizhang's avatar
yaqizhang committed
398 399

  .avatar-uploader {
400 401 402
    width: 25%;
    float: left;
  }
yaqizhang's avatar
yaqizhang committed
403

404 405 406 407 408 409 410
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
yaqizhang's avatar
yaqizhang committed
411

412 413 414
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
yaqizhang's avatar
yaqizhang committed
415

416 417 418 419 420 421 422 423
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
yaqizhang's avatar
yaqizhang committed
424

425 426 427 428 429
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
yaqizhang's avatar
yaqizhang committed
430 431

  li {
432 433 434
    font-size: 15px;
    font-weight: 900;
  }
王晓倩's avatar
王晓倩 committed
435
</style>