2022-06-08 14:51:11 +08:00

1742 lines
58 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- 设备管理 -->
<div class="cooperator flex">
<div class="left whiteBlock" :class="{'dark-left': styleType == 2}">
<!-- <div class="title">全部塔吊</div> -->
<vue-scroll style="height: 94%">
<el-menu
:default-active="String(checkedId)"
class="el-menu-vertical-demo whiteBlock"
:class="{'dark-menu': styleType == 2}"
>
<el-menu-item
index="0"
class="el-menu-item"
:class="checkedId == 0 ? 'checked_item' : ''"
@click="selectMenu(0)"
>
<!-- 全部升降机 -->
<span slot="title">{{ $t('message.lifter.allLifts') }}</span>
</el-menu-item>
<div v-if="towerList.length > 0">
<el-menu-item
:index="String(item.id)"
class="el-menu-item"
:class="checkTowerId == item.id ? 'checked_item' : ''"
v-for="(item, index) in towerList"
@click="selectMenu(index + 1)"
:key="index"
>
<span slot="title" class="flex3 "
><span class="title_index">{{ index + 1 }}</span
><span class="title_name">{{ item.devName }}</span>
<i class="el-icon-delete" style="color: #F56C6C;font-size: 14px" @click="deleteOrCancel"></i></span
>
</el-menu-item>
</div>
</el-menu>
</vue-scroll>
<div class="flex2 btn_pack" :class="{'dark-btn': styleType == 2}">
<el-button v-if="isDevBackEnd" size="small" type="primary" @click="newTowerBtn"
>
<!-- 新增升降机 -->
<i class="el-icon-plus" style="margin-right: 6px"></i>{{ $t('message.lifter.newElevator') }}</el-button
>
<!-- <el-button v-if="isDevBackEnd"
size="small"
type="danger"
@click="deleteOrCancel"
:disabled="checkedId == 0"
>{{ checkedId != -1 ? "删除塔吊" : "取消新增" }}</el-button
> -->
</div>
</div>
<div class="right" :class="{'dark-right': styleType == 2}">
<!-- <div class="pageTitle title flex2 whiteBlock" style="margin-bottom: 0">
{{ rightTitle }}
<span v-show="isDevBackEnd" class="downloadBtn primaryText" @click="downloadFn">对接协议下载</span>
</div> -->
<div class="content whiteBlock" v-if="!showTowerInfo">
<div class="sava-adress" :class="{'dark-btn': styleType == 2}" v-if="!showTowerInfo">
<el-button
size="small"
type="success"
style="width: 110px;height: 32px;"
@click="saveTowerLocationBtn"
:disabled="checkedId != 0"
>
<!-- 保存点位 -->
{{ $t('message.lifter.savePoint') }}</el-button
>
</div>
<div class="bgPack">
<img :src="bgUrl" style="width: auto; height: auto" ref="bgPackImg" />
<!-- 塔吊点位 -->
<div
v-for="(item, index) in towerList"
class="point"
:key="index"
:style="{ top: item.mapY + 'px', left: item.mapX + 'px' }"
@mousedown="(e) => mousedown(e, index)"
>
{{ index + 1 }}
</div>
</div>
</div>
<div class="content whiteBlock" v-else>
<vue-scroll :ops="ops2">
<div class="form-wrap">
<div class="form-top-box">
<div class="form-left-box">
<div class="form-h2" :class="{'dark-h2': styleType == 2}">
<!-- 设备信息 -->
{{ $t('message.lifter.equipmentInfo') }}
<span v-show="isDevBackEnd" class="downloadBtn primaryText" @click="downloadFn">
<!-- 对接协议下载 -->
{{ $t('message.lifter.protocolDownload') }}
</span>
</div>
<el-form size="medium"
:model="facilityForm"
:rules="rules"
ref="facilityForm"
label-width="260px"
class="demo-facilityForm"
:class="{'dark-form': styleType == 2}"
:inline="true"
>
<!-- 设备名称 -->
<el-form-item :label="$t('message.lifter.devName')" prop="devName">
<el-input
:class="{'dark-style': styleType == 2}"
v-model="facilityForm.devName"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
<el-button :class="{'dark-btn2': styleType == 2}" slot="append">
<!-- 绑定 -->
{{ $t('message.lifter.binding') }}
</el-button>
</el-form-item>
<!-- 安装时间 -->
<el-form-item :label="$t('message.lifter.installationTime')" prop="installationTime">
<el-date-picker
v-model="facilityForm.installationTime"
type="date"
:placeholder="$t('message.lifter.selectTime')">
</el-date-picker>
</el-form-item>
<!-- 设备备案编号 -->
<el-form-item :label="$t('message.lifter.equipmentRecordNo')" prop="filingNo">
<el-input
v-model="facilityForm.filingNo"
:placeholder="$t('message.lifter.pleaseEnter')"
>
</el-input>
</el-form-item>
<!-- 安装照片 -->
<el-form-item class="upload-box" :label="$t('message.lifter.installationPhotos')" prop="installImg">
<el-upload
class="upload-demo"
:action="$store.state.UPLOADURL"
multiple
name="files"
:show-file-list="false"
:before-upload="handleBeforeUpload"
:on-success="(res)=>handleUploadSuccess(res, 1)"
:file-list="facilityForm.installImg">
<el-button size="small" type="primary" :class="{'dark-upImg': styleType == 2}"><i class="el-icon-picture-outline"></i></el-button>
<div slot="tip" class="el-upload__tip" :class="{'dark-tip': styleType == 2}">
<!-- 支持jpgpngjpeg格式 -->
{{ $t('message.lifter.supportedFormats') }}
</div>
</el-upload>
<div class="file-list">
<div class="file-item" v-for="(item,index) in facilityForm.installImg" :key="index">
<img :src="$store.state.FILEURL+item.url"/>
<i class="el-icon-error" :class="{'dark-close': styleType == 2}" @click="removeImg(index, 1)"></i>
</div>
</div>
</el-form-item>
<!-- 设备型号 -->
<el-form-item :label="$t('message.lifter.equipmentModel')" prop="devModel">
<el-input
v-model="facilityForm.devModel"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 产权单位 -->
<el-form-item :label="$t('message.lifter.propertyRightUnit')" prop="propertyUnit">
<el-input
v-model="facilityForm.propertyUnit"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 检测单位 -->
<el-form-item :label="$t('message.lifter.dsetectionUnit')" prop="testingOrganization">
<el-input
v-model="facilityForm.testingOrganization"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 检测合格时间 -->
<el-form-item :label="$t('message.lifter.testQualifiedTime')" prop="testQualifiedTime">
<el-date-picker
v-model="facilityForm.testQualifiedTime"
type="date"
:placeholder="$t('message.lifter.selectTime')">
</el-date-picker>
</el-form-item>
<!-- 制造单位 -->
<el-form-item :label="$t('message.lifter.manufacturingUnit')" prop="factoryName">
<el-input
v-model="facilityForm.factoryName"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 检测编号 -->
<el-form-item :label="$t('message.lifter.testNumber')" prop="testNumber">
<el-input
v-model="facilityForm.testNumber"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 拆除单位 -->
<el-form-item :label="$t('message.lifter.demolitionUnit')" prop="demolitionUnit">
<el-input
v-model="facilityForm.demolitionUnit"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 检测证书照片 -->
<el-form-item class="upload-box" :label="$t('message.lifter.photoOfTestCertificate')" prop="testtingImg">
<el-upload
class="upload-demo"
:action="$store.state.UPLOADURL"
multiple
name="files"
accept=".jpg, .png, .jpeg"
:show-file-list="false"
:before-upload="handleBeforeUpload"
:on-success="(res)=>handleUploadSuccess(res, 2)"
:file-list="facilityForm.testtingImg">
<el-button size="small" type="primary" :class="{'dark-upImg': styleType == 2}"><i class="el-icon-picture-outline"></i></el-button>
<div slot="tip" class="el-upload__tip" :class="{'dark-tip': styleType == 2}">
<!-- 支持jpgpngjpeg格式 -->
{{ $t('message.lifter.supportedFormats') }}
</div>
</el-upload>
<div class="file-list">
<div class="file-item" v-for="(item, index) in facilityForm.testtingImg" :key="index">
<img :src="$store.state.FILEURL+item.url"/>
<i class="el-icon-error" :class="{'dark-close': styleType == 2}" @click="removeImg(index, 2)"></i>
</div>
</div>
</el-form-item>
<!-- 设备状态 -->
<el-form-item :label="$t('message.lifter.equipmentStatus')" prop="devState">
<el-select
v-model="facilityForm.devState"
style="width: 100%"
:placeholder="$t('message.lifter.pleaseSelect')"
>
<el-option
v-for="item in devStateList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<!-- 产权编号 -->
<el-form-item :label="$t('message.lifter.titleNumber')" prop="propertyNumber">
<el-input
v-model="facilityForm.propertyNumber"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 使用登记办理时间 -->
<el-form-item :label="$t('message.lifter.registrationTime')" prop="useRegistrationTime">
<el-date-picker
v-model="facilityForm.useRegistrationTime"
type="date"
:placeholder="$t('message.lifter.selectTime')">
</el-date-picker>
</el-form-item>
<!-- 出产日期 -->
<el-form-item :label="$t('message.lifter.dateOfManufacture')" prop="factoryTime">
<el-date-picker
v-model="facilityForm.factoryTime"
type="date"
:placeholder="$t('message.lifter.selectTime')">
</el-date-picker>
</el-form-item>
<!-- 使用登记办理编号 -->
<el-form-item :label="$t('message.lifter.useRegistrationNo')" prop="useRegistrationNumber">
<el-input
v-model="facilityForm.useRegistrationNumber"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 安装单位名称 -->
<el-form-item :label="$t('message.lifter.nameOfInstallUnit')" prop="installationUnit">
<el-input
v-model="facilityForm.installationUnit"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 登记证书照片 -->
<el-form-item class="upload-box" :label="$t('message.lifter.registrationPhotos')" prop="registerImg">
<el-upload
class="upload-demo"
:action="$store.state.UPLOADURL"
multiple
name="files"
:show-file-list="false"
:before-upload="handleBeforeUpload"
:on-success="(res)=>handleUploadSuccess(res, 3)"
:file-list="facilityForm.registerImg">
<el-button size="small" type="primary" :class="{'dark-upImg': styleType == 2}"><i class="el-icon-picture-outline"></i></el-button>
<div slot="tip" class="el-upload__tip" :class="{'dark-tip': styleType == 2}">
<!-- 支持jpgpngjpeg格式 -->
{{ $t('message.lifter.supportedFormats') }}
</div>
</el-upload>
<div class="file-list">
<div class="file-item" v-for="(item,index) in facilityForm.registerImg" :key="index">
<img :src="$store.state.FILEURL + item.url"/>
<i class="el-icon-error" :class="{'dark-close': styleType == 2}" @click="removeImg(index, 3)"></i>
</div>
</div>
</el-form-item>
<!-- 安装单位代码 -->
<el-form-item :label="$t('message.lifter.installUnitCode')" prop="installationUnitCode">
<el-input
v-model="facilityForm.installationUnitCode"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 升降机类型 -->
<el-form-item :label="$t('message.lifter.liftType')" prop="elevatorType">
<el-select
v-model="facilityForm.elevatorType"
style="width: 100%"
:placeholder="$t('message.lifter.pleaseSelect')"
>
<el-option
v-for="item in elevatorOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<!-- 笼2设备编号 -->
<el-form-item v-if="facilityForm.elevatorType == 1" :label="$t('message.lifter.equipmentNumber')" prop="otherDevSn">
<el-input
v-model="facilityForm.otherDevSn"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<br>
<!-- <el-form-item label="" prop="recordNumber">
<el-button style="width:200px;margin:30px 0 0 200px" type="primary" size="medium" @click="submit"
>保存</el-button
>
<el-button v-if="isDevBackEnd"
style="width:200px;margin:30px 0 0 200px"
size="medium"
type="danger"
@click="deleteOrCancel"
:disabled="checkedId == 0"
>{{ checkedId != -1 ? "删除塔吊" : "取消新增" }}</el-button
>
</el-form-item> -->
</el-form>
</div>
</div>
<div class="form-bottom-box">
<div class="form-left-box">
<div class="form-h2" :class="{'dark-h2': styleType == 2}">
<!-- 功能信息 -->
{{$t('message.lifter.functionInformation')}}
</div>
<el-form size="medium"
:model="facilityForm"
ref="facilityForm2"
:rules="rules"
label-width="260px"
class="demo-facilityForm"
:class="{'dark-form': styleType == 2}"
:inline="true">
<!-- 额定载重kg -->
<el-form-item :label="$t('message.lifter.ratedLoadKg')" prop="maxLoad">
<el-input
v-model="facilityForm.maxLoad"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 额定人数(人) -->
<el-form-item :label="$t('message.lifter.ratedPeople')" prop="ratedPeopleNum">
<el-input
v-model="facilityForm.ratedPeopleNum"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
<!-- 升降机高度m -->
<el-form-item :label="$t('message.lifter.liftHeight')" prop="maxHeight">
<el-input
v-model="facilityForm.maxHeight"
:placeholder="$t('message.lifter.pleaseEnter')"
></el-input>
</el-form-item>
</el-form>
</div>
</div>
<div class="form-right-box">
<div class="form-h2" :class="{'dark-h2': styleType == 2}">
<!-- 司机信息 -->
{{ $t('message.lifter.driverInfo') }}
<!-- <el-button
size="small"
type="primary"
@click="showDialog"
>绑定司机</el-button> -->
</div>
<vue-scroll :ops="ops" style="height: 200px">
<ul class="driver-list">
<li class="driver-item add-btn" @click="showDialog">
<i class="el-icon-plus"></i>
<!-- 绑定司机 -->
{{ $t('message.lifter.bindDriver') }}
</li>
<li class="driver-item" :class="{'dark-item': styleType == 2}" v-for="(item, index) in allSelectData" :key="index">
<img :src="fileUrl + item.fieldAcquisitionUrl"/>
<div class="people-info">
<h3>{{item.workerName}}</h3>
<div class="people-year">
<!-- 年龄 -->
<p>{{ $t('message.lifter.age') }}<span>{{item.age}}</span></p>
<!-- <p>工作年限:<span>2年</span></p> -->
</div>
<!-- 身份证号 -->
<p>{{ $t('message.lifter.idNumber') }}{{item.idCard}}</p>
<!-- 特种资格证书编号 -->
<p>{{ $t('message.lifter.specialNumber') }}{{item.specialCertificateNumber}}</p>
</div>
<div class="driver-sex">
<i>
<img v-if="item.sex == 1" src="./../../../assets/images/operationInfo/man.png">
<img v-else src="./../../../assets/images/operationInfo/woman.png">
</i>
{{item.sex == 1 ? $t('message.lifter.male') : $t('message.lifter.female') }}
</div>
<div class="delete-btn">
<el-button
style="width:60px;"
size="small"
type="danger"
@click="deleteDriver(index)"
:disabled="checkedId == 0"
>
<!-- 删除 -->
{{ $t('message.lifter.delete') }}</el-button
>
</div>
</li>
</ul>
<!-- <div class="no-data" v-else>
<img style="height: 120px;display: block;margin: 0 auto;" src="./../../../assets/images/noData2-dark.png">
</div> -->
</vue-scroll>
</div>
<div class="form-right-box">
<div class="form-h2" :class="{'dark-h2': styleType == 2}">
<!-- 视频信息 -->
{{ $t('message.lifter.videoInfo') }}
</div>
<el-form size="medium"
:model="facilityForm"
ref="facilityForm3"
:rules="rules"
label-width="80px"
style="padding-left: 20px;"
class="demo-facilityForm" :inline="true">
<!-- 视频类型 -->
<el-form-item :label="$t('message.lifter.videoType')" prop="enableVideoUrl">
<el-radio-group v-model="facilityForm.enableVideoUrl" style="width:300px">
<el-radio :label="1">
<!-- 从视频列表选 -->
{{ $t('message.lifter.selectFromvideoList') }}
</el-radio>
<el-radio :label="2">
<!-- 自定义(只支持萤石云) -->
{{ $t('message.lifter.custom') }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- 摄像头 -->
<el-form-item :label="$t('message.lifter.camera')" prop="recordNumber" v-show="facilityForm.enableVideoUrl==1">
<el-select
v-model="facilityForm.videoList"
multiple
collapse-tags
style="width: 100%"
:placeholder="$t('message.lifter.pleaseSelect')"
>
<el-option
v-for="item in videoList"
:key="item.itemId"
:label="item.videoName"
:value="item.itemId"
>
</el-option>
</el-select>
</el-form-item>
<br>
<!-- 视频 -->
<el-form-item :label="$t('message.lifter.video')" prop="videoUrl " v-show="facilityForm.enableVideoUrl==2">
<div v-for="(item,index) in videoList2" :key="index" class="personItem">
<!-- videoUrl 视频url格式ezopen://... -->
<el-input v-model="item.url" style="margin-bottom: 6px" :placeholder="$t('message.lifter.videoUrl')" class="phone"></el-input>
<el-input v-model="item.accessToken" :placeholder="'accessToken'" class="phone"></el-input>
<el-input v-model="item.videoName" :placeholder="$t('message.lifter.videoName')" class="name"></el-input>
<i class="redText el-icon-remove" @click="operateAddPerson(1,false,index)"></i>
</div>
<el-button plain type="primary" size="mini" style="margin: 10px 0" @click="operateAddPerson(1,true)">
<!-- 新增视频 -->
{{ $t('message.lifter.addVideo') }}
</el-button>
</el-form-item>
</el-form>
</div>
<div style="padding-bottom: 60px">
<el-button style="width:200px;margin:30px 0 0 200px" type="primary" size="medium" @click="submit"
>
<!-- 保存 -->
{{ $t('message.lifter.preservation') }}
</el-button
>
<el-button v-if="isDevBackEnd && checkedId == -1"
style="width:200px;margin:30px 0 0 200px"
size="medium"
type="danger"
@click="deleteOrCancel"
:disabled="checkedId == 0"
>
<!-- 取消新增 -->
{{ $t('message.lifter.cancelAdding') }}
</el-button
>
</div>
</div>
</vue-scroll>
</div>
<!-- bindDriver 绑定司机 -->
<el-dialog @close="closeMap"
:title="$t('message.lifter.bindDriver')"
:visible.sync="dialogVisible"
:modal-append-to-body="false"
width="678px">
<div class="search-box">
<el-input size="medium" style="width: 156px; margin-right: 15px" v-model="searchName" :placeholder="$t('message.lifter.nameSelect')"></el-input>
<el-button size="medium" type="primary" @click="getWorkerInfoList">
<!-- 搜索 -->
{{$t('message.lifter.search')}}
</el-button>
</div>
<div class="dialog-table">
<vue-scroll>
<el-table
class="tables"
ref="multipleTable"
:data="driverList2"
tooltip-effect="dark"
height="378"
style="width: 100%;"
@selection-change="handleSelectionChange"
@select="selectCheckBox"
>
<el-table-column type="selection" width="60"> </el-table-column>
<!-- 姓名 -->
<el-table-column :label="$t('message.lifter.fullName')">
<template slot-scope="scope">{{ scope.row.workerName }}</template>
</el-table-column>
<!-- 性别 -->
<el-table-column prop="sex" :label="$t('message.lifter.gender')" width="60">
<template slot-scope="scope">{{ scope.row.sex==1? $t('message.lifter.male') : $t('message.lifter.female') }}</template>
</el-table-column>
<!-- 身份证号 -->
<el-table-column prop="idCard" :label="$t('message.lifter.idNumber')">
</el-table-column>
<!-- 特种资格证书编号 -->
<el-table-column prop="specialCertificateNumber" :label="$t('message.lifter.specialNumber')">
</el-table-column>
</el-table>
</vue-scroll>
</div>
<!-- <div class="select-btn">
<el-button style="width:81px;margin:30px 100px 30px 0" type="primary" size="medium" @click="chekDriver"
>确定</el-button
>
<el-button
style="width:81px;margin:30px 0 30px 0"
size="medium"
type="danger"
@click="closeMap"
:disabled="checkedId == 0"
>取消</el-button
>
</div> -->
</el-dialog>
</div>
</div>
</template>
<script>
import {
getWorkerInfoListApi,
getVideoItemListApi,
addLifterApi,
getLifterListApi,
getLifterDetailApi,
deleteLifterApi,
editLifterApi,
updateLifterCoordinateApi
} from "@/assets/js/api/lifter";
import {
// getWorkerInfoListApi,
// getVideoItemListApi,
// getTowerListApi,
} from "@/assets/js/api/towerCrane";
import {
getProjectChilderSystemUserListApi
} from "@/assets/js/api/configManage";
export default {
data() {
return {
dialogVisible: false,
projectSn: "",
uploadUrl: "",
fileUrl: "",
searchName: "",
elevatorOptions:[{
value: 0,
label: this.$t('message.lifter.singleCage') //单笼
},{
value: 1,
label: this.$t('message.lifter.doubleCage') // 双笼
}],
//校验设备详情信息
rules: {
installationTime: [
{
required: true,
message: this.$t('message.lifter.rules1'), // 请选择安装时间
trigger: "blur",
},
],
factoryTime: [
{
required: true,
message: this.$t('message.lifter.rules2'), // 请选择出产日期
trigger: "blur",
},
],
devState:[
{
required: true,
message: this.$t('message.lifter.rules3'), // 请选择设备状态
trigger: "blur",
},
],
devModel:[
{
required: true,
message: this.$t('message.lifter.rules4'), // 请输入设备型号
trigger: "blur",
},
],
maxHeight:[
{
required: true,
message: this.$t('message.lifter.rules5'), // 请输入升降机高度
trigger: "blur",
},
],
devName: [
{
required: true,
message: this.$t('message.lifter.rules08'), // 请输入设备名称
trigger: "blur",
},
],
factoryName:[
{
required: true,
message: this.$t('message.lifter.rules6'), // 请输入制造单位
trigger: "blur",
},
],
productionDate:[
{
required: true,
message: this.$t('message.lifter.rules2'), // 请选择出产日期
trigger: "blur",
},
]
},
devStateList:[{
id: 1,
name: this.$t('message.lifter.names1') // 设备进场
},{
id: 2,
name: this.$t('message.lifter.names2') // 设备安装
},{
id: 3,
name: this.$t('message.lifter.names3') // 设备验收
},{
id: 4,
name: this.$t('message.lifter.names4') // 设备使用
},{
id: 5,
name: this.$t('message.lifter.names5') // 设备拆除
},{
id: 6,
name: this.$t('message.lifter.names6') // 设备退场
}],
//设备详情信息
facilityForm: {
devName: "",
driverList: "",
videoList: "",
installationTime: "", //安装时间
installImg: [], //安装照片
propertyUnit: "", //产权单位
devModel: "", //设备型号
testingUnit: "", //检测单位
testQualifiedTime: "", //检测合格时间
factoryName: "", //制造单位
testNumber: "", //检测编号
demolitionUnit: "", //拆除单位
testtingImg: [], //检测证书照片
devState: "", //设备状态
propertyNumber: "", //产权编号
useRegistrationTime: "", //使用登记办理时间
factoryTime: "", //出产日期
useRegistrationNumber: "", //使用登记办理编号
installationUnit: "", //安装单位名称
registerImg: [], //登记证书照片
installationUnitCode: "", //安装单位代码
maxLoad: "", //额定载重
ratedPeopleNum: "", //额定人数
elevatorType: 0, //升降机类型
otherDevSn: "", //多笼设备另一个设备编号
maxHeight: "" //升降机高度
},
checkTowerId: "", //选中的塔吊id 只作为列表选中状态切换
checkedId: 0, //选中的设备 -1 新增状态 控制取消按钮 获取选中设备
towerList: [], //设备列表
rightTitle: this.$t('message.lifter.constructionPlans'), // 现场施工图
driverList: [], //司机列表
videoList: [],
showTowerInfo: false, //显示施工图或塔吊信息
bgUrl: "", //施工图
isDevBackEnd:false,
videoList2: [],
styleType: 1,
multipleSelection: [],
allSelectData: [],
driverList2: [],
ops: {
vuescroll: {
// wheelScrollDuration: 0,
wheelDirectionReverse: true,
},
},
ops2:{
scrollPanel: {
scrollingX: false,
},
},
};
},
created() {
this.uploadUrl = this.$store.state.UPLOADURL;
this.fileUrl = this.$store.state.FILEURL;
console.log(this.fileUrl)
this.projectSn = this.$store.state.projectSn;
// console.log(this.$store.state.projectSn);
this.styleType = this.$store.state.userInfo.styleType
// console.log(this.$store.state.userInfo.styleType)
this.getTowerList(1);
this.getWorkerInfoList();
this.getVideoItemList();
this.bgUrl = this.$store.state.currentProDetail.constructionMapUrl;
if(this.$route.path.indexOf('equipmentCenter')!=-1 || this.styleType == 2){
this.isDevBackEnd=true
}
// this.isDevBackEnd=true
},
methods: {
chekDriver(){
},
deleteDriver(index){
this.allSelectData.splice(index,1)
},
closeMap(){
this.dialogVisible = false
},
showDialog(){
this.dialogVisible = true
this.searchName = ""
this.driverList2 = []
},
selectCheckBox(selection, row){
console.log(selection, row)
},
handleSelectionChange(val){
// console.log(val, this.allSelectData)
this.multipleSelection = val
console.log(this.multipleSelection)
for(let i = 0;i<this.multipleSelection.length; i++){
let flag = true;
for(let j = 0; j<this.allSelectData.length; j++){
if(this.multipleSelection[i].id == this.allSelectData[j].id){
flag = false
// this.$message.info("已添加")
break;
}
}
if(flag){
this.allSelectData.push(this.multipleSelection[i])
this.$message.success(this.$t('message.lifter.addSuccess')+"!")
}
}
},
handleBeforeUpload(file){
console.log(file.type)
if(file.type == "image/png" || file.type == "image/jpg" || file.type == "image/jpeg"){
return true;
} else {
return false;
}
},
handleUploadSuccess(res, type){
console.log(this.facilityForm)
if(res.status = "SUCCESS"){
if(type == 1){
if(!this.facilityForm.installImg){
this.facilityForm.installImg = []
}
this.facilityForm.installImg.push({
name: res.data[0].filename,
url: res.data[0].imageUrl
})
} else if(type == 2){
if(!this.facilityForm.testtingImg){
this.facilityForm.testtingImg = []
}
this.facilityForm.testtingImg.push({
name: res.data[0].filename,
url: res.data[0].imageUrl
})
} else if(type == 3){
if(!this.facilityForm.registerImg){
this.facilityForm.registerImg = []
}
this.facilityForm.registerImg.push({
name: res.data[0].filename,
url: res.data[0].imageUrl
})
}
this.$forceUpdate()
}
},
removeImg(id, type){
this.$confirm(this.$t('message.lifter.permanentlyDelete'), this.$t('message.lifter.tips'), {
confirmButtonText: this.$t('message.lifter.determine'),
cancelButtonText: this.$t('message.lifter.cancel'),
type: 'warning'
}).then(() => {
// console.log(this.facilityForm.installImg)
if(type == 1 && this.facilityForm.installImg){
this.facilityForm.installImg.splice(id,1)
} else if(type == 2 && this.facilityForm.testtingImg){
this.facilityForm.testtingImg.splice(id,1)
} else if(type == 3 && this.facilityForm.registerImg){
this.facilityForm.registerImg.splice(id,1)
}
this.$forceUpdate()
this.$message({
type: 'success',
message: this.$t('message.lifter.deleteSucceeded')+'!' // 删除成功
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('message.lifter.deletionCancelled') // 已取消删除
});
});
},
//操作视频的添加和删除
operateAddPerson(hour,isAdd,index){
console.log(this.videoList2)
let a = this.videoList2.length
let json = {
videoName:'',url:'',videoType:1,playType:5,accessToken:''
}
if(isAdd){
if(a>0){
json.accessToken=this.videoList2[0].accessToken
}
json.id=a++
this.videoList2.push(json)
}else{
this.videoList2.splice(index,1)
}
},
// 获取所有塔吊
getTowerList(type) {
let data = {
projectSn: this.projectSn,
};
getLifterListApi(data).then((res) => {
if (res.code == 200) {
this.towerList = res.result;
if (type == 1) {
// this.checkedId = 0;
// this.checkTowerId = "";
} else {
this.checkedId = this.towerList.length;
this.checkTowerId = this.towerList[this.towerList.length - 1].id;
//详情
this.selectMenu(this.checkedId);
}
}
});
},
//切换塔吊
selectMenu(val) {
this.checkedId = val;
// this.multipleSelection = []
// this.$nextTick(()=>{
// this.$refs.multipleTable.clearSelection();
// })
// console.log(this.multipleSelection)
if (val == 0) {
this.rightTitle = this.$t('message.lifter.constructionPlans'); // 现场施工图
this.showTowerInfo = false; //显示施工图
this.checkTowerId = "";
} else {
this.showTowerInfo = true;
if (this.towerList[val - 1].id) {
this.rightTitle = this.towerList[val - 1].devName;
this.facilityForm = this.towerList[val - 1];
this.checkTowerId = this.towerList[val - 1].id;
this.getDetailsData(this.towerList[val - 1].id);
}
}
},
// 查询设备详情
getDetailsData(id) {
let data = {
id,
};
getLifterDetailApi(data).then((res) => {
if (res.code == 200) {
console.log(res.result)
this.facilityForm = res.result;
if(this.facilityForm.installationImage){
this.facilityForm.installImg = []
this.facilityForm.installationImage.split(",").forEach(item=>{
this.facilityForm.installImg.push({
name: item,
url: item
})
})
}
if(this.facilityForm.registrationCertificate){
this.facilityForm.registrationCertificate.split(",").forEach(item=>{
this.facilityForm.registerImg = []
this.facilityForm.registrationCertificate.split(",").forEach(item=>{
this.facilityForm.registerImg.push({
name: item,
url: item
})
})
})
}
if(this.facilityForm.testCertificate){
this.facilityForm.testCertificate.split(",").forEach(item=>{
this.facilityForm.testtingImg = []
this.facilityForm.testCertificate.split(",").forEach(item=>{
this.facilityForm.testtingImg.push({
name: item,
url: item
})
})
})
}
let workerIdArr = [];
let videoItemIdArr = [];
for (let i = 0; i < res.result.driverList.length; i++) {
workerIdArr.push(res.result.driverList[i].workerId);
}
for (let i = 0; i < res.result.videoList.length; i++) {
videoItemIdArr.push(res.result.videoList[i].videoItemId);
}
this.facilityForm.driverList = workerIdArr;
this.multipleSelection = []
this.allSelectData = []
console.log(this.facilityForm.driverList,this.driverList)
if(this.facilityForm.driverList && this.facilityForm.driverList.length>0){
// console.log(this.facilityForm.driverList,this.driverList)
this.facilityForm.driverList.forEach(item=>{
for(let i = 0;i< this.driverList.length; i++){
// console.log(item,this.driverList[i].id)
if(item == this.driverList[i].id){
// this.multipleSelection.push(this.driverList[i])
this.allSelectData.push(this.driverList[i])
}
}
})
}
this.facilityForm.videoList = videoItemIdArr;
//
if(this.facilityForm.videoUrl&&this.facilityForm.videoUrl!='null'){
this.videoList2=JSON.parse(this.facilityForm.videoUrl)
}else{
this.videoList2=[]
}
}
});
},
//新增塔吊按钮
newTowerBtn() {
this.searchName = []
this.allSelectData = []
this.facilityForm = {
devName: "",
workerId: "",
videoItemId: "",
videoList:[],
driverList:[],
filingNo: "", //设备备案监督编号
installationTime: "", //安装时间
installImg: [], //安装照片
propertyUnit: "", //产权单位
devModel: "", //设备型号
testingUnit: "", //检测单位
testQualifiedTime: "", //检测合格时间
factoryName: "", //制造单位
testNumber: "", //检测编号
demolitionUnit: "", //拆除单位
testtingImg: [], //检测证书照片
devState: "", //设备状态
propertyNumber: "", //产权编号
useRegistrationTime: "", //使用登记办理时间
factoryTime: "", //出产日期
useRegistrationNumber: "", //使用登记办理编号
installationUnit: "", //安装单位名称
registerImg: [], //登记证书照片
installationUnitCode: "", //安装单位代码
maxLoad: "", //额定载重
ratedPeopleNum: "", //额定人数
elevatorType: 0, //升降机类型
otherDevSn: "", //多笼设备另一个设备编号
maxHeight: "" //升降机高度
};
this.showTowerInfo = true;
this.checkedId = -1;
this.checkTowerId = "";
this.rightTitle = this.$t('message.lifter.newTowerCrane');// 新增塔吊
},
//删除或取消按钮
deleteOrCancel() {
//新增状态 this.checkedId=-1 为取消按钮
if (this.checkedId == -1) {
this.rightTitle = this.$t('message.lifter.constructionPlans'); // 现场施工图
this.checkedId = 0;
this.showTowerInfo = false;
} else {
// 删除按钮
this.$confirm(this.$t('message.lifter.permanentlyDeleteDevice'), this.$t('message.lifter.tips'), {
confirmButtonText: this.$t('message.lifter.determine'),
cancelButtonText: this.$t('message.lifter.cancel'),
type: "warning",
})
.then(() => {
let data = {
id: this.towerList[this.checkedId - 1].id,
};
deleteLifterApi(data).then((res) => {
if (res.code == 200) {
this.checkedId = 0;
this.checkTowerId = "";
this.getTowerList(1);
this.showTowerInfo = false;
this.rightTitle = this.$t('message.lifter.constructionPlans'); // 现场施工图
this.$message({
type: "success",
message: this.$t('message.lifter.deleteSucceeded')+"!",
});
} else {
this.$message.error(res.message);
}
});
})
.catch(() => {
this.$message({
type: "info",
message: this.$t('message.lifter.deletionCancelled'),
});
});
}
},
//移动塔吊位置
mousedown(e, index) {
let bgPackImg = this.$refs.bgPackImg; //获取背景图
let maxH = bgPackImg.scrollHeight - 30; //可移动的最大高度
let maxW = bgPackImg.scrollWidth - 30; //可移动的最大宽度
let objDiv = e.target;
//算出鼠标相对元素的位置
let disX = e.clientX - objDiv.offsetLeft;
let disY = e.clientY - objDiv.offsetTop;
//鼠标移动时
document.onmousemove = (e) => {
//用鼠标的位置减去鼠标相对元素的位置,得到元素的位置
let left = e.clientX - disX;
let top = e.clientY - disY;
if (left < 0 || top < 0 || top > maxH || left > maxW) {
return;
} else {
this.towerList[index].mapX = left;
this.towerList[index].mapY = top;
}
};
//鼠标松开时
document.onmouseup = (e) => {
document.onmousemove = null;
document.onmouseup = null;
};
},
//获取司机列表
getWorkerInfoList() {
console.log(this.multipleSelection)
let data = {
projectSn: this.projectSn,
workerName: this.searchName
};
getWorkerInfoListApi(data).then((res) => {
if (res.code == 200) {
this.driverList = res.result;
this.driverList2 = res.result;
}
})
},
//获取摄像机列表
getVideoItemList() {
let data = {
projectSn: this.projectSn,
};
getVideoItemListApi(data).then((res) => {
if (res.code == 200) {
this.videoList = res.result.list;
}
});
},
//保存新增
submit() {
let flag = true
this.$refs["facilityForm2"].validate((valid) => {
if (!valid) {
flag = false
return;
}
})
this.$refs["facilityForm3"].validate((valid) => {
if (!valid) {
flag = false
return;
}
})
if(this.facilityForm.elevatorType == 1 && !this.facilityForm.otherDevSn){
this.$message.error(this.$t('message.lifter.inputEquipmentNumberTwo')) // 请输入笼2设备编号
return;
}
if(this.facilityForm.elevatorType == 0){
this.facilityForm.otherDevSn = ""
}
// console.log(flag)
this.$refs["facilityForm"].validate((valid) => {
if (valid && flag) {
let data = JSON.parse(JSON.stringify(this.facilityForm));
data.projectSn = this.projectSn;
// if(!data.mapX){
// data.mapX = "0";
// }
// if(!data.mapY){
// data.mapY = "0";
// }
let driverArr = [];
let videoArr = [],person1=[],person2=[],person3=[],person4=[];
//循环选中的司机
data.driverList = this.allSelectData
for (let i = 0; i < data.driverList.length; i++) {
let obj = { workerId: data.driverList[i].id };
driverArr.push(obj);
}
//循环选中的摄像头
// if(this.facilityForm.enableVideoUrl==1){
for (let i = 0; i < data.videoList.length; i++) {
let obj = { videoItemId: data.videoList[i] };
videoArr.push(obj);
}
data.videoList = videoArr;
// }else{
if(this.videoList2.length>0){
data.videoUrl = JSON.stringify(this.videoList2);
}else{
data.videoUrl = []
}
// }
data.driverList = driverArr;
// console.log(data,this.checkedId)
let arr1 = [],
arr2 = [],
arr3 = [];
if(data.installImg && data.installImg.length>0){
data.installImg.forEach(item=>{
arr1.push(item.url)
})
}
if(data.testtingImg && data.testtingImg.length>0){
data.testtingImg.forEach(item=>{
arr2.push(item.url)
})
}
if(data.registerImg && data.registerImg.length>0){
data.registerImg.forEach(item=>{
arr3.push(item.url)
})
}
data.installationImage = arr1.join(",")
data.testCertificate = arr2.join(",")
data.registrationCertificate = arr3.join(",")
// console.log(data,this.checkedId)
if (this.checkedId == -1) {
// 新增
addLifterApi(data).then((res) => {
if (res.code == 200) {
this.getTowerList(2);
this.$message.success(this.$t('message.lifter.successfullyAdded')); // 新增成功
} else {
this.$message.error(res.message);
}
});
} else {
console.log(data)
editLifterApi(data).then((res) => {
if (res.code == 200) {
this.getTowerList(1);
this.$message.success(this.$t('message.lifter.editSucceeded')); // 编辑成功
}
});
}
} else {
console.log("error submit!!");
return false;
}
});
},
//保存塔吊位置
saveTowerLocationBtn() {
console.log(this.towerList);
let data = [];
for (let i = 0; i < this.towerList.length; i++) {
let obj = {
id: this.towerList[i].id,
mapX: this.towerList[i].mapX,
mapY: this.towerList[i].mapY,
};
data.push(obj);
}
updateLifterCoordinateApi(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$message.success(this.$t('message.lifter.keepSuccess')); // 保存成功
this.getTowerList(1);
}
});
},
downloadFn(){
// dockingProtocol 升降机对外对接协议
window.open('/doc/'+$t('message.lifter.dockingProtocol')+'.docx')
},
},
};
</script>
<style lang="less" scoped>
.flex {
display: flex;
}
.flex2 {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex3 {
display: flex;
align-items: center;
}
.cooperator {
width: 100%;
height: 100%;
.left {
height: 100%;
width: 220px;
margin-right: 15px;
font-size: 15px;
.title {
height: 41px;
line-height: 41px;
box-sizing: border-box;
padding: 0 22px;
margin-bottom: 0;
// color: #282e49;
// border-bottom: 2px #ebf0fc solid;
font-weight: 600;
}
.title_index {
display: inline-block;
width: 30px;
text-align: center;
background: #ec7e2e;
height: 20px;
line-height: 20px;
font-size: 14px;
margin-right: 10px;
border-radius: 25px;
color: #fff;
}
.title_name {
width: 68%;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.el-menu-item {
border-bottom: 1px #ebf0fc solid;
border-left: 3px solid white;
height: 50px;
line-height: 50px;
padding: 0 20px !important;
font-size: 16px;
}
.checked_item {
border-left: 3px solid #5181f6;
// padding: 0 27px !important;
background-color: #e1e8fa !important;
}
.btn_pack {
padding: 5px 15px 0;
box-sizing: border-box;
justify-content: center;
button {
height: 34px;
}
}
}
.dark-left{
width: 170px;
border-right: 1px solid #12294F;
.dark-menu{
.checked_item{
background: linear-gradient(to right, rgba(136, 231, 240, 0.2), rgba(21, 49, 95, 0.2)) !important;
}
}
}
.right {
height: 100%;
width: calc(100% - 220px);
.title {
font-size: 15px;
height: 41px;
line-height: 41px;
// background-color: #ffffff;
box-sizing: border-box;
padding: 0 22px;
// color: #282e49;
border-bottom: 2px #ebf0fc solid;
font-weight: 600;
.right_value {
color: rgba(115, 121, 150, 100);
font-size: 14px;
font-weight: 100;
.value {
color: #5181f6;
}
}
}
.content {
height: calc(100% - 41px);
// background-color: #fff;
box-sizing: border-box;
padding: 30px 20px;
.demo-facilityForm {
// width: 50%;
.el-input,/deep/.el-select .el-input{
width: 300px;
}
}
.dark-form{
.el-input,/deep/.el-select .el-input{
width: 250px;
}
.upload-demo{
width: 250px;
}
}
}
}
}
/deep/ .__view {
min-height: calc(100% - 41px) !important;
}
/deep/ .el-checkbox__label {
display: none;
}
.el-menu-vertical-demo {
width: 100%;
}
.cooperatorDetail {
width: 100%;
height: 100%;
// background: #ffffff;
box-sizing: border-box;
.navigationTitle {
// border-bottom: 2px solid #ebf0fc;
// margin-bottom: 15px;
}
}
.nodata_wrap {
width: 100%;
text-align: center;
height: 80%;
padding-top: 20%;
box-sizing: border-box;
// color: #c3d4fd;
div {
margin-top: 10px;
}
}
.bgPack {
width: 100%;
height: 100%;
background-repeat: no-repeat;
position: relative;
overflow: auto;
.point {
position: absolute;
display: inline-block;
width: 30px;
height: 30px;
border-radius: 50%;
background: rgb(236, 126, 46);
text-align: center;
line-height: 30px;
color: #fff;
cursor: pointer;
user-select: none;
}
.point:hover {
background: rgb(241, 191, 24);
}
}
.downloadBtn{
top: 0;
}
.personItem{
margin-top: 10px;
// width: 300px;
.phone{
width: 300px!important;
margin-right: 10px;
}
.name{
width: 100px!important;
}
}
.el-icon-remove{
font-size: 22px;
margin-left: 10px;
margin-top: 7px;
vertical-align: top;
cursor: pointer;
}
.sava-adress{
// padding-left: 50px;
// padding-top: 20px;
padding-bottom: 10px;
width: 100%;
box-sizing: border-box;
// background: #fff;
// /deep/.el-button{
// margin: 0 auto;
// display: block;
// }
}
.dark-btn{
/deep/ .el-button--success{
background: #0D2C54;
color: #fff;
border-color: #0080F3;
border-radius: 4px;
}
/deep/ .el-button--primary{
background: #0D2C54;
color: #fff;
border-color: #0D2B53;
}
}
.dark-btn2{
background: #153E7D 1% !important;
color: #fff !important;
border-color: #0D2B53 !important;
}
.dark-style{
/deep/.el-input-group__append{
background-color: #153E7D;
border: 0;
}
}
.left{
.dark-menu{
.checked_item{
border-left: 0;
background-color: transparent !important;
}
/deep/.el-menu-item.is-active {
color: #88E7F0;
}
/deep/ .el-menu-item{
border: 0;
color: #fff;
}
/deep/.el-menu-item:hover, .el-menu-item:focus {
outline: none;
background-color: transparent;
color: #88E7F0;
}
}
}
.cooperator{
.dark-right{
margin-left: 0;
/deep/.el-dialog__title::before, .pageTitle::before{
background-color: #88E7F0;
border-bottom: 1px;
}
.title{
border-bottom: 1px solid #ebf0fc;
}
.bgPack{
background: #091225;
img{
display: block;
margin: 0 auto;
}
}
}
}
.form-top-box{
// width: 100%;
display: flex;
}
.form-bottom-box{
// width: 100%;
display: flex;
}
.form-wrap{
// display: flex;
.form-left-box{
width: 100%;
margin-right: 10px;
}
.form-right-box{
width: 100%;
.driver-list{
display: flex;
width: 100%;
}
.driver-item{
width: 480px;
margin-right: 20px;
padding: 18px 19px 24px 19px;
box-sizing: border-box;
border-radius: 8px;
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.1);
background:rgba(0,0,0,0.04);
display: flex;
margin-bottom: 23px;
img{
height: 118px;
width: 97px;
margin-right: 18px;
}
h3{
margin: 6px 0 12px 0;
}
.people-info{
width: 250px;
}
p{
line-height: 24px;
}
.people-year{
display: flex;
justify-content: space-between;
}
.driver-sex{
display: flex;
height: 20px;
align-items: center;
i{
display: block;
width: 16px;
height: 16px;
margin-right: 3px;
img{
width: 100%;
height: 100%;
}
}
}
}
.add-btn{
width: 200px;
height: 160px;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: 1px dashed rgba(255,255,255,0.6);
font-size: 18px;
i{
margin-right: 20px;
}
}
.dark-item{
background:#0D2B53;
.driver-sex{
margin-left: -46px;
}
}
}
.form-h2{
height: 30px;
line-height: 30px;
position: relative;
padding-left: 20px;
box-sizing: border-box;
margin-bottom: 36px;
display: flex;
justify-content: space-between;
}
.form-h2::before{
content: "";
background: #4181FE;
height: 30px;
width: 2px;
position: absolute;
left: 0;
top: 0;
}
.dark-h2::before{
background: linear-gradient(to bottom,#88E7F0,#15315F);
}
}
.upload-demo{
width: 300px;
/deep/ .el-button--small{
padding: 0;
background: #eee;
border: 0;
color: #ccc;
width: 58px;
height: 40px;
font-size: 22px;
}
.dark-upImg{
background: #19263E;
}
/deep/.el-upload__tip{
margin: 0;
}
.dark-tip{
color: #fff;
}
}
.file-list{
display: flex;
align-items: center;
.file-item{
width: 58px;
height: 40px;
position: relative;
margin-right: 6px;
img{
width: 100%;
height: 100%;
}
i{
position: absolute;
right: -6px;
top: -6px;
cursor: pointer;
}
}
}
.select-btn{
display: flex;
align-items: center;
justify-content: center;
}
.delete-btn{
display: flex;
align-items: center;
margin-left: 20px;
}
.dark-close{
// color: #F56C6C;
}
</style>