index.vue 17.5 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
      <el-divider></el-divider>
yaqizhang's avatar
yaqizhang committed
24
      <el-row style="width: 100%;margin-top: -15px;margin-bottom: -5px;">
25 26
        <el-col :span="24">
          <div style="color: #31EAEA;height: 25px;">
yaqizhang's avatar
yaqizhang committed
27 28 29
            <ul>
              <li>详细信息</li>
            </ul>
30
          </div>
31
        </el-col>
32 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
            <el-form-item label="设备名称:" prop="deviceName">
              <font>{{form.deviceName}}</font>
            </el-form-item>
            <el-form-item label="设备编号:" prop="deviceCode">
              <font>{{form.deviceCode}}</font>
            </el-form-item>
            <el-form-item label="设备类型:" prop="deviceType">
              <font v-if="form.deviceType == 1">调压阀</font>
              <font v-if="form.deviceType == 2">阀门井</font>
              <font v-if="form.deviceType == 3">流量计</font>
              <font v-if="form.deviceType == 4">压力表</font>
            </el-form-item>
            <el-form-item label="设备型号:" prop="deviceModel">
              <font>{{form.deviceModel}}</font>
            </el-form-item>
yaqizhang's avatar
yaqizhang committed
52 53 54
            <el-form-item label="所属管道:" prop="pipeName">
              <font>{{form.pipeName}}</font>
            </el-form-item>
55
            <el-form-item label="物联网编号:" prop="iotNo">
56 57 58 59 60 61 62 63
              <font>{{form.iotNo}}</font>
            </el-form-item>
            <el-form-item label="联系人:" prop="linkman">
              <font>{{form.linkman}}</font>
            </el-form-item>
            <el-form-item label="联系电话:" prop="phone">
              <font>{{form.phone}}</font>
            </el-form-item>
yaqizhang's avatar
yaqizhang committed
64
            <el-form-item label="备注信息:" prop="remarks" style="width: 170%;">
65 66 67
              <font>{{form.remarks}}</font>
            </el-form-item>
          </el-form>
68 69
        </el-col>
        <el-col :span="6">
yaqizhang's avatar
yaqizhang committed
70
          <el-form ref="form" v-model="form" label-width="100px" style="width: 100%;">
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
            <el-form-item label="所在地址:" prop="deviceAddr">
              <font>{{form.deviceAddr}}</font>
            </el-form-item>
            <el-form-item label="经度:" prop="longitude">
              <font>{{form.longitude}}</font>
            </el-form-item>
            <el-form-item label="经度:" prop="latitude">
              <font>{{form.latitude}}</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>
86
            <!--<el-form-item label="设备图片:" prop="iconUrl">
王晓倩's avatar
王晓倩 committed
87 88 89
              <div style="width: 20%;">
                <el-image :src="form.iconUrl" :preview-src-list="[form.iconUrl]" style="width: auto;height: auto;"></el-image>
              </div>
90
            </el-form-item>-->
91
          </el-form>
92
        </el-col>
93 94


95
        <el-col :span="11">
yaqizhang's avatar
yaqizhang committed
96
          <div id="marbox"
yaqizhang's avatar
yaqizhang committed
97
            style="width: 100%;height: 390px;margin-top: -25px; border: 1px solid rgb(218, 213, 213);margin-bottom: 10px;">
98 99 100
            <div style="width: 100%;height: 100%" id="container"></div>
          </div>
        </el-col>
101 102 103 104 105 106 107 108 109 110 111 112


        <el-row style="width: 100%;height: 40px;">
          <el-col :span="24">
            <div style="">
              <ul>
                <li style="list-style: none;font-weight: 900;font-size: 20px;color: #053b6a;">已安装设备</li>
              </ul>
            </div>
          </el-col>
        </el-row>
        <el-col :span="10">
113 114 115 116 117
        <el-table height="250"border   :data="equipmentList">
          <el-table-column label="设备名称" align="center" prop="deviceNames" />
          <el-table-column label="设备编号" align="center" prop="deviceCodes" />

        </el-table>
118
        </el-col>
119
      </el-row>
120

yaqizhang's avatar
yaqizhang committed
121
      <div class="" style="width: 95%; height: 60px;margin-left: 50px;text-align: center;margin-top: 5px;">
yaqizhang's avatar
yaqizhang committed
122 123 124 125
        <el-button size="normal" type="primary" icon="el-icon-edit" @click="handleUpdate(form)"
          v-hasPermi="['device:deviceInfo:edit']">修改</el-button>
        <el-button size="normal" type="primary" icon="el-icon-delete" @click="handleDelete(form)"
          v-hasPermi="['device:deviceInfo:remove']">删除</el-button>
126 127 128 129 130

        <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="11">
              <el-form-item label="所属管道" prop="pipeId">
yaqizhang's avatar
yaqizhang committed
131 132
                <el-select v-model="editForm.pipeId" placeholder="请选择所属管道" filterable style="width: 100%">
                  <el-option v-for="item in options" :key="item.pipeId" :label="item.pipeName" :value="item.pipeId">
133 134 135 136 137 138 139 140 141 142 143 144 145
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="设备编号" prop="deviceCode">
                <el-input v-model="editForm.deviceCode" placeholder="请输入设备编号" />
              </el-form-item>
            </el-col>

            <el-col :span="11">
              <el-form-item label="设备类型" prop="deviceType">
yaqizhang's avatar
yaqizhang committed
146 147 148
                <el-select v-model="editForm.deviceType" placeholder="请选择设备类型" filterable style="width: 100%">
                  <el-option v-for="dict in typeOptions" :key="dict.dictValue" :label="dict.dictLabel"
                    :value="dict.dictValue"></el-option>
149 150 151 152 153 154
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="设备名称" prop="deviceName">
yaqizhang's avatar
yaqizhang committed
155
                <el-input v-model="editForm.deviceName" placeholder="请输入设备名称" />
156 157 158 159 160
              </el-form-item>
            </el-col>

            <el-col :span="11">
              <el-form-item label="设备型号" prop="deviceModel">
yaqizhang's avatar
yaqizhang committed
161
                <el-input v-model="editForm.deviceModel" placeholder="请输入设备型号" />
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="物联网编号" prop="iotNo">
                <el-input v-model="editForm.iotNo" placeholder="请输入物联网编号" />
              </el-form-item>
            </el-col>

            <el-col :span="23">
              <el-form-item label="所在地址" prop="deviceAddr">
                <el-input v-model="editForm.deviceAddr" placeholder="请输入所在地址" />
              </el-form-item>
            </el-col>

            <el-col :span="23">
              <el-form-item label="经纬度坐标" prop="longitude">
                <el-row>
                  <el-col :span="8">
                    <el-input v-model.number="editForm.longitude" placeholder="请输入经度" />
                  </el-col>
                  <el-col :span="8" style="margin-left: 10px">
yaqizhang's avatar
yaqizhang committed
184
                    <el-input v-model.number="editForm.latitude" placeholder="请输入纬度" />
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
                  </el-col>
                  <el-col :span="5" style="margin-left: 10px">
                    <el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>

            <el-col :span="11">
              <el-form-item label="联系人" prop="linkman">
                <el-input v-model="editForm.linkman" placeholder="请输入联系人" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="联系电话" prop="phone">
yaqizhang's avatar
yaqizhang committed
201
                <el-input type="number" maxlength="12" v-model="editForm.phone" placeholder="请输入联系电话" />
202 203 204 205 206
              </el-form-item>
            </el-col>

            <el-col>
              <el-form-item label="设备图片上传" prop="iconUrl">
yaqizhang's avatar
yaqizhang committed
207
                <MyFileUpload listType="picture-card" @resFun="getFileInfo" @remove="listRemove" :fileArr="fileList" />
208 209 210 211 212 213 214
                <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
215 216
                  <el-date-picker clearable size="small" style="width: 100%" v-model="editForm.installationTime"
                    type="date" value-format="yyyy-MM-dd" placeholder="请选择安装日期">
217 218 219 220 221 222 223 224 225 226 227
                  </el-date-picker>
                </el-col>
              </el-form-item>
            </el-col>

            <el-col :span="23">
              <el-form-item label="备注信息" prop="remarks">
                <el-input type="textarea" v-model="editForm.remarks" placeholder="请输入备注信息" />
              </el-form-item>
            </el-col>
          </el-form>
228

229 230 231 232 233 234
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>

yaqizhang's avatar
yaqizhang committed
235 236
        <Mapdialog v-if="loadmap" :dialogTableVisible="dialogTableVisible" @dialogcancelFun="dialogcancelFun"
          :slat="editForm.latitude" :slng="editForm.longitude" @confirmFun="confirmFun($event)"></Mapdialog>
237
      </div>
238 239 240 241 242
    </div>
  </div>
</template>

<script>
243
  import { updateDeviceInfo, getDeviceInfo,getDevice } from "@/api/device/deviceInfo";
244 245 246
  import { pipeAllInfoList } from "@/api/device/pipe";
  import MyFileUpload from '@/components/MyFileUpload';
  import Mapdialog from "@/components/mapDialog/checkDeviceLoaction.vue";
247 248 249 250 251 252
  import gaodeMap from "utils/gaodeMap.js";
  import { DEVICE_TYPE } from "utils/gaodeMap.js";

  export default {
    name: "DeviceInfoDetail",
    components: {
253 254
      MyFileUpload,
      Mapdialog
255 256 257
    },
    data() {
      return {
258 259 260 261 262 263 264 265 266 267 268 269 270
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 管道列表
        options: [],
        // 上传文件列表
        fileList: [],
        // 地图
        loadmap: false,
        dialogTableVisible: false,
        // 设备类型字典
        typeOptions: [],
271 272
        //下级绑定设备数据
        equipmentList:[],
273
        // 表单参数
yaqizhang's avatar
yaqizhang committed
274
        form: {},
275
        editForm: {},
276
        // 表单校验
yaqizhang's avatar
yaqizhang committed
277
        rules: {
278 279 280
          pipeId: [
            { required: true, message: "请选择所属管道", trigger: "blur" },
          ],
yaqizhang's avatar
yaqizhang committed
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 311 312 313 314 315
          deviceType: [
            { required: true, message: "请选择设备类型", trigger: "blur" },
          ],
          deviceName: [
            { required: true, message: "请输入设备名称", trigger: "blur" },
          ],
          deviceCode: [
            { required: true, message: "请输入设备编号", trigger: "blur" },
          ],
          deviceModel: [
            { required: true, message: "请输入设备型号", trigger: "blur" },
          ],
          deviceAddr: [
            { required: true, message: "请输入所在地址", trigger: "blur" },
          ],
          longitude: [
            { required: true, message: "请输入经纬度", trigger: "blur" },
          ],
          iotNo: [
            { required: true, message: "请输入物联网编号", trigger: "blur" },
          ],
          linkman: [
            { required: true, message: "请输入联系人", trigger: "blur" }
          ],
          phone: [
            { required: true, message: "请输入联系电话", trigger: "blur" },
            { min: 11, max: 11, message: "长度11个数字", trigger: "blur" },
          ],
          iconUrl: [
            { required: true, message: "请上传图片", trigger: "change" }
          ],
          installationTime: [
            { required: true, message: "请选择日期", trigger: "change" },
          ],
        }
316 317 318 319 320
      };
    },
    created() {
      // 如果是跳转来的,则接受初始化参数
      this.deviceId = this.$route.query.deviceId;
321

322 323 324
      this.getDicts("t_device_type").then(response => {
        this.typeOptions = response.data;
      });
325
    },
yaqizhang's avatar
yaqizhang committed
326 327 328 329
    mounted() {
      this.getDetail();
      // let gaoMap = new gaodeMap("石家庄");
      // this.gaoMap = gaoMap;
330 331
    },
    methods: {
yaqizhang's avatar
yaqizhang committed
332
      getDetail() {
333 334 335
        getDevice(this.deviceId).then(response => {
          this.equipmentList=response.data
        });
yaqizhang's avatar
yaqizhang committed
336
        getDeviceInfo(this.deviceId).then(response => {
337
          this.form = response.data;
yaqizhang's avatar
yaqizhang committed
338 339 340
          console.log(this.form, "this.form")
          const obj =this.form;
          // this.gaoMap.resetMapCenter([this.form.longitude, this.form.latitude]);let obj = this.form.deviceList[0];
341
          let gaoMap = new gaodeMap(process.env.VUE_APP_MAP_CENTER, [obj.longitude, obj.latitude]);
yaqizhang's avatar
yaqizhang committed
342
          this.gaoMap = gaoMap;
yaqizhang's avatar
yaqizhang committed
343 344 345 346 347 348 349 350 351 352 353 354 355
          if("1" == obj.deviceType){
            this.gaoMap.addMarker(DEVICE_TYPE.REGEULATORBOX, obj,"false")
          }
          if("2" == obj.deviceType){
            this.gaoMap.addMarker(DEVICE_TYPE.VALUEWELL, obj,"false")
          }
          if("3" == obj.deviceType){
            this.gaoMap.addMarker(DEVICE_TYPE.FLOWMETER, obj,"false")
          }
          if("4" == obj.deviceType){
            this.gaoMap.addMarker(DEVICE_TYPE.PRESSUREGAGE, obj,"false")
          }
          // this.gaoMap.addMarker(DEVICE_TYPE.WORKORDER, this.form)
356 357
        });
      },
358

yaqizhang's avatar
yaqizhang committed
359
      getFileInfo(res) {
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
        this.editForm.iconUrl = res.url;
      },
      listRemove(e) {
        this.editForm.iconUrl = "";
        this.fileList = [];
      },
      confirmFun(res) {
        //确认选择经纬度
        this.editForm.longitude = res.lng;
        this.editForm.latitude = res.lat;
      },
      MapdialogFun() {
        this.loadmap = true;
        this.dialogTableVisible = true;
      },
      dialogcancelFun() {
        this.loadmap = false;
        this.dialogTableVisible = false;
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.fileList = [];
      },
      /** 修改按钮操作 */
      handleUpdate(res) {
        pipeAllInfoList().then(response => {
          this.options = response.data;
        });
        getDeviceInfo(res.deviceId).then(response => {
          this.editForm = response.data;
          if (this.editForm.iconUrl) {
            this.fileList.push({
              url: this.editForm.iconUrl,
            });
          }
          this.open = true;
          this.title = "修改设备信息";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["editForm"].validate(valid => {
          if (valid) {
            console.log(this.editForm);
            updateDeviceInfo(this.editForm).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              location.reload();
            });
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(res) {
        res.isDel = "1";
        this.$confirm('是否确认删除设备名称为"' + res.deviceName + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function () {
          return updateDeviceInfo(res);
        }).then(() => {
          this.$router.go(-1);
          this.msgSuccess("已删除");
        }).catch(() => {
        });
      },
428 429 430 431 432 433 434 435 436 437
    }
  }
</script>
<style>
  .el-divider--horizontal {
    display: block;
    height: 1px;
    width: 100%;
    margin: 20px 0;
  }
yaqizhang's avatar
yaqizhang committed
438 439 440 441 442

  .feedbackTime-div {
    float: left;
    margin-left: 150px;
    margin-top: 10px;
443
  }
yaqizhang's avatar
yaqizhang committed
444 445

  .feedbackTime {
446 447 448 449 450 451 452 453 454 455
    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
456

457 458 459
  .el-card__body {
    padding: 5px 20px 20px 20px;
  }
yaqizhang's avatar
yaqizhang committed
460 461

  .detail .el-form {
462 463
    width: 20%;
  }
yaqizhang's avatar
yaqizhang committed
464 465

  .detail .el-form-item {
466 467
    margin-bottom: 0px;
  }
yaqizhang's avatar
yaqizhang committed
468 469

  .avatar-uploader {
470 471 472
    width: 25%;
    float: left;
  }
yaqizhang's avatar
yaqizhang committed
473

474 475 476 477 478 479 480
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
yaqizhang's avatar
yaqizhang committed
481

482 483 484
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
yaqizhang's avatar
yaqizhang committed
485

486 487 488 489 490 491 492 493
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
yaqizhang's avatar
yaqizhang committed
494

495 496 497 498 499
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
yaqizhang's avatar
yaqizhang committed
500 501

  li {
502 503 504
    font-size: 15px;
    font-weight: 900;
  }
505
</style>