2024-09-05 18:02:21 +08:00

1448 lines
63 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="qualityProblemBank" :class="{ 'qualityProblemBank2': !dialogFormVisible }">
<vue-scroll v-if="dialogFormVisible" style="height: 100%; width: 100%" class="scroll">
<div class="flex content">
<div class="left">
<div class="btn_wrap_box">
<div class="btn_wrap">
<el-button size="small" @click="setCheckedNodes">{{ $t('message.quality.add')
}}{{ $t('message.quality.unfold') }}</el-button>
<el-button size="small" @click="setCheckedKeys">{{ $t('message.quality.add')
}}{{ $t('message.quality.close') }}</el-button>
</div>
<el-button style="margin-left: 15px" type="primary" size="small" @click.stop="isAddPoint(1)">
添加
</el-button>
</div>
<div style="margin-bottom: 15px; display:flex; align-items: center">
<el-input placeholder="请输入检查项名称" prefix-icon="el-icon-search" size="small"
v-model="classificationName" clearable>
</el-input>
</div>
<vue-scroll style="height: 88%; width: 100%; font-size: 14px; background-color: #F7F7F7;">
<el-tree class="filter-tree" :highlight-current="true" :data="listData" :props="defaultProps"
@node-click="getCheckedNode" :default-expand-all="showExpand" :filter-node-method="filterNode"
node-key="id" ref="tree">
<span class="custom-tree-node flex3" slot-scope="{ node, data }">
<span v-if="node.label.length <= 10">{{ node.label }}</span>
<el-tooltip v-else class="item" effect="dark" :content="node.label" placement="top">
<span class="ellipsis">{{ node.label }}</span>
</el-tooltip>
<div class="icon-box">
<!-- <el-button type="text" size="mini" >
新增子级
</el-button>
<el-button type="text" size="mini" >
编辑
</el-button>
<el-button type="text" size="mini" >
删除
</el-button> -->
<i class="el-icon-plus" @click.stop="() => isAddPoint(1, node, data)"></i>
<i class="el-icon-edit" @click.stop="() => isAddPoint(2, node, data)"></i>
<i class="el-icon-delete" @click.stop="() => deleteTreeRow(data)"></i>
</div>
<!-- v-permission="{key: 'criterion_stop_open', menuPath: '/project/quality/criterion'}" -->
</span>
</el-tree>
</vue-scroll>
</div>
<div class="right">
<div class="title">
<div style="line-heihgt: 25px; height: 30px">
{{ checkedNodeData && checkedNodeData.dangerName }}
</div>
<div>
<el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
<el-form-item label="编码:">
<el-input :placeholder="
$t('message.quality.pleaseEnter')
" v-model="formInline.projectEquipmentNumber" clearable style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="名称:">
<el-input :placeholder="
$t('message.quality.pleaseEnter')
" v-model="formInline.commonDiseasePhenomena" clearable style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="规格编号:">
<el-input :placeholder="
$t('message.quality.pleaseEnter')
" v-model="formInline.specificationModel" clearable style="width: 200px">
</el-input>
</el-form-item>
<!-- <el-form-item :label="$t('message.quality.displayEnabledOnly') + ''">
<el-select v-model="formInline.recordStatus" :placeholder="$t('message.quality.pleaseSelect')">
<el-option :label="$t('message.quality.no')" :value="0"></el-option>
<el-option :label="$t('message.quality.yes')" :value="1"></el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="onSubmit">{{
$t('message.quality.inquire')
}}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="isAddPoint(3)">新增</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="bulkPrint()">批量打印</el-button>
</el-form-item>
</el-form>
</div>
</div>
<el-table :data="tableData" @cell-click="previewDetail" ref="multipleTable" class="tables"
max-height="590px" @selection-change="handleSelectionChangeTable">
<el-table-column align="center" type="selection" width="55">
</el-table-column>
<el-table-column label="序号" type="index" width="50">
</el-table-column>
<el-table-column align="center" prop="commonDiseasePhenomena" label="设备名称">
<template slot-scope="scope">{{
scope.row.equipmentName
}}</template>
</el-table-column>
<el-table-column align="center" prop="commonDiseasePicture" label="规格型号">
<template slot-scope="scope">
{{ scope.row.specificationModel }}
</template>
</el-table-column>
<el-table-column align="center" prop="isSpecial" label="是否特种设备">
<template slot-scope="scope">{{ scope.row.isSpecial == 1 ? '是' : '否' }}</template>
</el-table-column>
<el-table-column align="center" prop="projectEquipmentNumber" label="项目设备编码">
<template slot-scope="scope">{{
scope.row.projectEquipmentNumber
}}</template>
</el-table-column>
<el-table-column align="center" prop="equipmentManagerName" label="设备管理员">
<template slot-scope="scope">{{
scope.row.equipmentManagerName
}}</template>
</el-table-column>
<!-- <el-table-column align="center" prop="deviceUsed" label="使用装置">
<template slot-scope="scope">{{
scope.row.deviceUsed
}}</template>
</el-table-column> -->
<!-- <el-table-column align="center" prop="commonDiseasePreventionMethodPicture" label="通病防治做法图片">
<template slot-scope="scope">
<div style="display: flex; align-items: center; justify-content:center">
<el-image style="width: 20px; height: 20px"
:src="require('@/assets/images/image-pre.png')" fit="cover"
:preview-src-list="srcListUp(scope.row.commonDiseasePreventionMethodPicture)"></el-image>
{{ scope.row.commonDiseasePreventionMethodPicture.length }}
</div>
</template>
</el-table-column> -->
<!-- 操作 -->
<el-table-column align="center" :label="$t('message.dangerousBigProject.operation')">
<template slot-scope="scope">
<!-- v-permission="{
key: 'fireWork_delete',
menuPath: '/project/operationManage/heightsWorks',
}" -->
<div class="tableBtns">
<div @click.stop="isAddPoint(4, scope.row)" class="operationText">
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
<span>编辑</span>
</div>
<div @click.stop="deleteRow(scope.row)" class="operationText">
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
<span>删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top: 20px" class="pagerBox" background @size-change="handleSizeChange"
@current-change="handleCurrentChange" :current-page.sync="pageNo" layout="sizes, prev, pager, next"
:page-sizes="[10, 20, 30, 40]" :page-size="pageSize" :total="Number(total)">
</el-pagination>
</div>
<!-- 添加卡片弹框 -->
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" :title="cardDialogTitle"
:visible.sync="cardDialog" :width="isAdd == 1 || isAdd == 2 ? '600px' : '1100px'"
:before-close="handleClose">
<div class="dialog_content">
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="170px"
class="dialogFormBox">
<!-- <el-form-item label="申请单位" prop="applicant">
<el-select v-model="cardForm.applicant"
:placeholder="$t('message.personnelPosition.please_select')" filterable>
<el-option :label="item.enterpriseName" :value="item.id"
v-for="(item, index) in cooperatorList" :key="index">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item v-if="isAdd == 1 || isAdd == 2" label="施工机具名称" prop="classificationName">
<el-input v-model="cardForm.classificationName"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<div class="addbox" v-if="isAdd == 3 || isAdd == 4">
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="cardForm.equipmentName"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="规格型号" prop="specificationModel">
<el-input v-model="cardForm.specificationModel"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="项目设备编号" prop="projectEquipmentNumber">
<el-input v-model="cardForm.projectEquipmentNumber"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="设备管理员" prop="equipmentManager">
<el-select filterable v-model="cardForm.equipmentManager"
:placeholder="$t('message.personnelPosition.please_select')" filterable>
<el-option :label="item.workerName" :value="item.id"
v-for="(item, index) in workerListOptions" :key="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否特种设备" prop="isSpecial">
<el-select filterable v-model="cardForm.isSpecial"
:placeholder="$t('message.personnelPosition.please_select')" filterable>
<el-option :label="item.specialEquipmentName" :value="item.id"
v-for="(item, index) in specialEquipmentList" :key="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="进场经办人" prop="onSiteHandler">
<el-select filterable v-model="cardForm.onSiteHandler"
:placeholder="$t('message.personnelPosition.please_select')" filterable>
<el-option :label="item.workerName" :value="item.id"
v-for="(item, index) in workerListOptions" :key="index">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="实际进场日期" prop="actualOnSiteDate">
<el-date-picker v-model="cardForm.actualOnSiteDate" type="date"
value-format="yyyy-MM-dd" placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="出厂日期" prop="shipmentDate">
<el-date-picker v-model="cardForm.shipmentDate" type="date" value-format="yyyy-MM-dd"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input v-model="cardForm.status"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="生产厂商" prop="manufacturer">
<el-input v-model="cardForm.manufacturer"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="所属单位" prop="equipmentSourceUnit">
<el-input v-model="cardForm.equipmentSourceUnit"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="安装拆除单位" prop="installationRemovalUnit">
<el-input v-model="cardForm.installationRemovalUnit"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<!-- <el-form-item label="使用装置" prop="deviceUsed">
<el-input v-model="cardForm.deviceUsed"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item> -->
<el-form-item label="设备位置" prop="equipmentLocation">
<el-input v-model="cardForm.equipmentLocation"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="产权编号" prop="ownershipNumber">
<el-input v-model="cardForm.ownershipNumber"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<el-form-item label="使用年限" prop="serviceLife">
<el-input v-model="cardForm.serviceLife"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</el-form-item>
<div class="gasanalysis-table1" style="margin-bottom: 20px">
<table>
<thead>
<tr>
<th>序号</th>
<th>附件名称</th>
<th>上传附件</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(ele, eIndex) in cardForm.tableList" :key="ele.id">
<td>
{{ eIndex + 1 }}
</td>
<td>
<el-input v-model="ele.fileName"
:placeholder="$t('message.personnelPosition.please_enter')"></el-input>
</td>
<td>
<el-upload style="display:flex; justify-content: center;"
class="upload-demo" name="files" :action="$store.state.UPLOADURL"
:on-remove="(file, fileList) => handleRemove(file, fileList, ele.id)"
:multiple="false"
:on-success="(res, file) => handleSuccess(res, file, ele.id)"
:file-list="ele.fileList" :on-exceed="handleExceed" :limit="1"
accept="*">
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
<el-button type="primary"> 上传附件 </el-button>
</el-upload>
</td>
<td>
<el-button type="text" @click="onDeleteTable(ele)">删除</el-button>
</td>
</tr>
</tbody>
</table>
<el-button icon="el-icon-plus" plain @click="onAddTable">添加数据</el-button>
</div>
</div>
</el-form>
<div class="dialog-footer">
<el-button class="cancleBtn" @click="handleClose" icon="el-icon-circle-close" size="medium">{{
$t("message.personnelPosition.cancel") }}
</el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="saveCardFn" size="medium">{{
$t("message.personnelPosition.determine") }}
</el-button>
</div>
</div>
</el-dialog>
<!-- 添加卡片弹框 -->
<el-dialog :destroy-on-close="true" :modal-append-to-body="false" title="" :visible.sync="cardDialog2"
width="900px">
<div class="dialog_content">
<div class="percentage_title">
{{ this.percentageTitle }}
</div>
<el-progress :percentage="percentage"></el-progress>
<!-- <div class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="getProgress" size="medium">{{
$t("message.personnelPosition.determine") }}
</el-button>
</div> -->
</div>
</el-dialog>
</div>
</vue-scroll>
<div style="height: 100%" v-else>
<el-page-header @back="goBack" :content="dialogTitle" class="backText"
:class="{ dark: styleType == 2 }"></el-page-header>
<!-- <addPlan @cancleSave="goBack" v-if="isAdd"></addPlan> -->
<detail :id="detailId" :isSuperDanger="isSuperDanger" :workType="2" @cancleSave="goBack"
:workDetail="workDetail" v-if="isEdit">
<template v-slot:basicinfo>
<div class="info-content">
<div style="width: 75%">
<div class="info-title">
<div>
{{ workDetail.equipmentName }}
</div>
<div class="info-title_right" v-if="workDetail.isSpecial == 1">
特种设备
</div>
</div>
<el-form class="form-box" :model="workDetail">
<el-form-item label="规格型号:" :label-width="formLabelWidthDetail">
{{ workDetail.specificationModel }}
</el-form-item>
<el-form-item label="项目设备编号:" :label-width="formLabelWidthDetail">
{{ workDetail.projectEquipmentNumber ? workDetail.projectEquipmentNumber : '--' }}
</el-form-item>
<el-form-item label="设备管理员:" :label-width="formLabelWidthDetail">
{{ workDetail.equipmentManagerName }}
</el-form-item>
<el-form-item label="进场经办人:" :label-width="formLabelWidthDetail">
{{ workDetail.onSiteHandlerName }}
</el-form-item>
<el-form-item label="实际进场时间:" :label-width="formLabelWidthDetail">
{{ workDetail.actualOnSiteDate }}
</el-form-item>
<el-form-item label="出厂日期:" :label-width="formLabelWidthDetail">
{{ workDetail.shipmentDate }}
</el-form-item>
<el-form-item label="状态:" :label-width="formLabelWidthDetail">
<span style="color:#EA3941;">{{ workDetail.status }}</span>
</el-form-item>
<el-form-item label="生产厂商:" :label-width="formLabelWidthDetail">
{{ workDetail.manufacturer }}
</el-form-item>
<el-form-item label="所属单位:" :label-width="formLabelWidthDetail">
{{ workDetail.equipmentSourceUnit }}
<!-- <el-tooltip class="item" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;" effect="dark" :content="workDetail.jobContent"
placement="top-start">
<div>{{ workDetail.jobContent }}</div>
</el-tooltip> -->
</el-form-item>
<el-form-item label="安装拆除单位:" :label-width="formLabelWidthDetail">
{{ workDetail.installationRemovalUnit }}
</el-form-item>
<!-- <el-form-item label="使用装置:" :label-width="formLabelWidthDetail">
{{ workDetail.deviceUsed }}
</el-form-item> -->
<el-form-item label="设备位置:" :label-width="formLabelWidthDetail">
{{ workDetail.equipmentLocation }}
</el-form-item>
<el-form-item label="产权编号:" :label-width="formLabelWidthDetail">
{{ workDetail.ownershipNumber }}
</el-form-item>
<el-form-item label="使用年限:" :label-width="formLabelWidthDetail">
{{ workDetail.serviceLife }}
</el-form-item>
<!-- <el-form-item label="现场作业环境:" :label-width="formLabelWidthDetail">
<div class="img-show">
<el-image v-for="(item, index) in workDetail.fieldWorkingEnvironment" :key="index"
style="width: 100px; height: 100px; margin-right: 10px;margin-bottom: 10px"
:src="item.url" :preview-src-list="[item.url]">
</el-image>
</div>
</el-form-item> -->
</el-form>
</div>
<div
style="display: flex;flex-direction: column;justify-content: center;align-items: center; width: 25%">
<div ref="qrCodeDiv" id="qrCodeDiv">
<img width="200" height="200" :src="$store.state.FILEURL + workDetail.qrCode" alt="">
</div>
<!-- <div style="display: none" class="equipment_bg_img">
<div class="equipment_box">
<div>
{{ workDetail.equipmentName ? workDetail.equipmentName : '--' }}
</div>
<div>
{{ workDetail.projectEquipmentNumber ? workDetail.projectEquipmentNumber : '--' }}
</div>
<div>
{{ workDetail.specificationModel ? workDetail.specificationModel : '--' }}
</div>
<div>
{{ workDetail.equipmentSourceUnit ? workDetail.equipmentSourceUnit : '--' }}
</div>
<div>
{{ workDetail.equipmentLocation ? workDetail.equipmentLocation : '--' }}
</div>
</div>
<div id="qrCode" ref="qrCodeDiv1"></div>
</div> -->
<div style="display: none" id="qrCodeDiv2">
<img width="100%" height="400" :src="equipmentBgImg" alt="">
</div>
<el-button style="margin-top: 20px" type="primary" @click="printBtn()" size="medium">打印方案二维码
</el-button>
</div>
<!-- <div v-if="COMPANY != 'longguang'" class="qr-box">
<div id="qrCode" ref="qrCodeDiv"></div>
<el-button size="medium" class="print-btn" @click="printBtn">打印危大工程标识</el-button>
</div> -->
</div>
</template>
</detail>
</div>
</div>
</template>
<script>
import detail from "./detail.vue";
import {
getConstructionEquipmentCategoryTreeApi,
addConstructionEquipmentCategoryApi,
editConstructionEquipmentCategoryApi,
deleteConstructionEquipmentCategoryApi,
getConstructionEquipmentPageApi,
saveWithFileConstructionEquipmentApi,
editConstructionEquipmentApi,
deleteConstructionEquipmentApi,
getConstructionEquipmentByIdApi,
getConstructionEquipmentFileListApi,
downloadConstructionEquipmentCheckFileApi,
} from '@/assets/js/api/buildEquipToolManage'
import { getWorkerInfoList } from '@/assets/js/api/laborPerson.js'
import { isJSON } from "@/util/nowDate/index";
import QRCode from "qrcodejs2";
export default {
name: 'qualityProblemBank',
components: {
detail,
},
data() {
return {
percentage: 0,
percentageTitle: "正在下载中,请稍后",
cardDialog2: false,
formLabelWidthDetail: "140px",
styleType: 1,
classificationName: '',
defaultProps: {
children: 'children',
label: 'classificationName',
id: 'id'
},
projectSn: '',
checkedNodeData: {},
showExpand: true,
listData: [],
formInline: {
projectEquipmentNumber: '',
commonDiseasePhenomena: '',
specificationModel: '',
recordStatus: 0
},
tableData: [],
multipleSelection: [],
checkboxId: [],
showBatch: true,
projectInfo: {},
cardDialogTitle: "",
cardDialog: false,
cardForm: {},
cardFormRules: {
equipmentName: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
specificationModel: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
projectEquipmentNumber: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
equipmentManager: [
{
required: true,
message: this.$t("message.personnelPosition.mandatory"),
trigger: "change",
},
],
actualOnSiteDate: [
{
required: true,
message: this.$t("message.personnelPosition.mandatory"),
trigger: "change",
},
],
// shipmentDate: [
// {
// required: true,
// message: this.$t("message.personnelPosition.mandatory"),
// trigger: "change",
// },
// ],
status: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
equipmentSourceUnit: [
{
required: true,
message: this.$t("message.personnelPosition.required"),
trigger: "blur",
},
],
},
specialEquipmentList: [{
id: 1,
specialEquipmentName: "是",
}, {
id: 2,
specialEquipmentName: "否",
}],
isAdd: -1,
pageNo: 1,
pageSize: 10,
total: 10,
workerListOptions: [],
isSuperDanger: "",
workDetail: {},
detailId: '',
dialogTitle: '',
isEdit: false,
dialogFormVisible: true,
downloadPicInfoList: [],
equipmentBgImg: "",
}
},
watch: {
classificationName(val) {
this.$refs.tree.filter(val)
}
},
created() {
this.projectSn = this.$store.state.projectSn;
this.projectInfo = isJSON(localStorage.getItem("projectInfo")) ? JSON.parse(localStorage.getItem("projectInfo")) : {};
this.getDangerTypeRecordList();
this.getDutyPerson();
},
methods: {
getProgress(rowUrl) {
//进度条恢复为 0
this.percentage = 0;
//发起请求
this.$http({
//下载文件的远端地址。
url: rowUrl,
//请求方式 get post。
method: "get",
//设置返回数据类型为base64的数据这样才可以被new Blob() 解析。
responseType: "blob",
//请求参数 get-->params post-->data 。
params: {},
//xml返回数据的钩子函数可以用来获取数据的进度 具体可查看axios的官网
onDownloadProgress: (progressEvent) => {
//progressEvent.loaded 下载文件的当前大小
//progressEvent.total 下载文件的总大小 如果后端没有返回 请让他加上!
let progressBar = Math.round(progressEvent.loaded / progressEvent.total * 100);
//接收进度为99%的时候需要留一点前端编译的时间
if (progressBar >= 99) {
this.percentage = 99;
this.percentageTitle = '下载完成,文件正在编译。';
} else {
this.percentage = progressBar;
this.percentageTitle = '正在下载,请耐心等待...';
}
}
}).then(res => {
//当前定义res.message 出现的时候说明后端文件返回出现了问题 不然应该直接是个文件流
if (res.status != 200) {
this.percentageTitle = '下载失败,请重试。';
return
}
console.log(res.data)
// return;
// 创建一个下载链接
const url = window.URL.createObjectURL(res.data);
// 创建一个<a>元素
const link = document.createElement("a");
link.href = url;
link.download = "施工设备机具二维码"; // 指定下载文件的文件名
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// 释放URL对象
window.URL.revokeObjectURL(url);
this.percentageTitle = '下载完成';
//编译文件完成后进度条展示为100%100
this.percentage = 100;
})
},
printBtn() {
const printContentHtml = document.getElementById("qrCodeDiv2").innerHTML;
// console.log(printContentHtml);
const iframe = document.createElement("iframe");
// iframe.setAttribute(
// "style",
// "position:absolute;width:0px;height:0px;left:-500px;top:-500px;"
// );
document.body.appendChild(iframe);
iframe.contentDocument.write(printContentHtml);
iframe.contentDocument.close();
iframe.onload = function(){ //解决图片显示不了的问题
iframe.contentWindow.print();
document.body.removeChild(iframe);
};
},
//生成 二维码
bindQRCode(id) {
document.getElementById("qrCode").innerHTML = "";
let httpUrl = window.location.origin;
let userId = this.$store.state.userInfo.userId;
let projectSn = this.$store.state.projectSn;
let data = {
id: id,
type: "wdgc",
};
// `${httpUrl}/doc/h5Entry/index.html?userId=${userId}&projectSn=${projectSn}`
new QRCode(this.$refs.qrCodeDiv1, {
text: `/pages/projectEnd/buildEquipToolManage/equipmentManage/detail?id=${id}`,
width: 120,
height: 120,
colorDark: "#333333", //二维码颜色
colorLight: "#ffffff", //二维码背景色
correctLevel: QRCode.CorrectLevel.L, //容错率L/M/H
});
},
// 批量打印
bulkPrint() {
downloadConstructionEquipmentCheckFile(1)
},
downloadConstructionEquipmentCheckFile(type) {
const ids = type == 1 ? this.downloadPicInfoList.map((item) => item.id).join(",") : this.detailId;
downloadConstructionEquipmentCheckFileApi({
projectSn: this.projectSn,
ids: ids,
}).then((res) => {
if (res.code == 200) {
const url = res.result.file.includes("http://") ? res.result.file : this.$store.state.FILEURL + res.result.file;
if (type == 1) {
this.getProgress(url);
this.cardDialog2 = true;
} else {
this.equipmentBgImg = url;
}
} else {
this.$message.error(res.msg);
}
});
},
handleSelectionChangeTable(selection) {
this.downloadPicInfoList = selection;
console.log(selection);
},
//获取左侧---列表信息
getDangerTypeRecordList() {
console.log(22)
let data = {
projectSn: this.projectSn,
classificationName: this.classificationName
}
getConstructionEquipmentCategoryTreeApi(data).then((res) => {
if (res.code == 200) {
if (res.result.length > 0) {
if (this.classificationName) {
this.listData = res.result;
this.getCheckedNode(this.listData[0]);
} else {
this.listData = [{
id: "",
children: [],
classificationName: "全部",
}, ...res.result];
this.getCheckedNode(this.listData[0]);
}
} else {
this.listData = []
}
}
})
},
// 删除文件
handleRemove(file, fileList, id) {
const find = this.cardForm.tableList.find((item) => item.id == id);
if (find) {
find.fileList = fileList;
}
},
handleSuccess(res, file, id) {
if (res.status == "SUCCESS") {
const find = this.cardForm.tableList.find((item) => item.id == id);
if (find) {
find.fileList = [{
name: file.name,
url: file.response.data[0].imageUrl,
}]
}
}
},
handleExceed() {
this.$message.warning("文件超出最大限制,请删除上份文件!");
},
//左边节点 输入筛选
filterNode(value, data) {
if (!value) return true
return data.classificationName.indexOf(value) !== -1
},
isAddPoint(type, node, data) {
this.isAdd = type;
this.cardDialog = true;
if (type == 1) {
if (node) {
this.cardForm = {
parentId: data.id,
classificationName: "",
};
this.cardDialogTitle = "新增子级";
} else {
this.initCardFormData();
this.$nextTick(() => {
this.$refs["cardForm"] && this.$refs["cardForm"].resetFields();
});
this.cardDialogTitle = this.$t("message.laborDev.add2");
}
} else if (type == 2) {
this.cardDialogTitle = this.$t("message.laborDev.btn_edit"); //编辑卡片
console.log(node);
this.cardForm = {
...data,
};
} else if (type == 3) {
this.initCardFormData();
this.$nextTick(() => {
this.$refs["cardForm"] && this.$refs["cardForm"].resetFields();
});
this.cardDialogTitle = this.$t("message.laborDev.add2");
} else if (type == 4) {
this.cardDialogTitle = this.$t("message.laborDev.btn_edit"); //编辑卡片
console.log(node);
getConstructionEquipmentFileListApi({
constructionEquipmentToolId: node.id,
// projectSn: this.$store.state.projectSn,
}).then((res) => {
this.cardForm = {
...node,
tableList: res.result ? res.result.map(item => {
return {
id: item.id,
fileName: item.name,
constructionEquipmentToolId: item.constructionEquipmentToolId,
fileList: [{
name: item.originName,
url: item.fileUrl,
}]
}
}) : [],
};
})
}
},
//添加或编辑卡片
saveCardFn() {
this.$refs["cardForm"].validate((valid) => {
if (valid) {
const result = {
...this.cardForm,
projectSn: this.$store.state.projectSn,
}
if (this.isAdd == 3 || this.isAdd == 4) {
const everyFlag = this.cardForm.tableList.every(item => item.fileName && item.fileList.length > 0);
console.log(everyFlag, this.cardForm.tableList);
if (!everyFlag) {
this.$message.error("请上传附件和附件名称");
return false;
}
result.files = this.cardForm.tableList.map(item => {
let obj = {
projectSn: this.$store.state.projectSn,
name: item.fileName,
originName: item.fileList[0].name,
fileUrl: item.fileList[0].url,
};
if (item.constructionEquipmentToolId) {
obj.constructionEquipmentToolId = item.constructionEquipmentToolId;
obj.id = item.id;
}
return {
...obj,
}
})
}
console.log(result);
if (this.isAdd == 1) {
// this.cardForm.floorId = this.currentFloorDetail.floorId
addConstructionEquipmentCategoryApi(result).then((res) => {
this.cardDialog = false;
this.handleClose();
this.getDangerTypeRecordList()
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.add_success")
); //添加成功!
});
} else if (this.isAdd == 2) {
editConstructionEquipmentCategoryApi(result).then((res) => {
this.cardDialog = false;
this.handleClose();
this.getDangerTypeRecordList()
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.edit_success")
); //编辑成功!
});
} else if (this.isAdd == 3 || this.isAdd == 4) {
saveWithFileConstructionEquipmentApi(result).then((res) => {
this.cardDialog = false;
this.handleClose();
this.getDangerItemRecord()
this.$message.success(
this.$t("message.personnelPosition.add_success")
); //添加成功!
});
}
// else if (this.isAdd == 4) {
// editConstructionEquipmentApi(result).then((res) => {
// this.cardDialog = false;
// this.handleClose();
// this.getDangerItemRecord()
// this.$message.success(
// this.$t("message.personnelPosition.edit_success")
// ); //编辑成功!
// });
// }
} else {
console.log("error submit!!");
return false;
}
});
},
// 初始化
initCardFormData() {
if (this.isAdd == 1 || this.isAdd == 2) {
this.cardForm = {
classificationName: "",
}
} else if (this.isAdd == 3 || this.isAdd == 4) {
this.cardForm = {
constructionEquipmentToolClassificationId: this.checkedNodeData.id,
equipmentName: "",
isSpecial: "",
specificationModel: "",
projectEquipmentNumber: "",
equipmentManager: "",
onSiteHandler: "",
actualOnSiteDate: "",
shipmentDate: "",
status: "",
manufacturer: "",
equipmentSourceUnit: "",
installationRemovalUnit: "",
deviceUsed: "",
equipmentLocation: "",
ownershipNumber: "",
serviceLife: "",
tableList: [],
commonDiseasePicture: [],
commonDiseasePreventionMethodPicture: [],
};
}
},
goBack() {
this.dialogFormVisible = true;
// this.initData()
this.isAdd = false;
this.isEdit = false;
this.isUpdate = false;
},
// 关闭前执行
handleClose(done) {
this.initCardFormData();
this.$refs["cardForm"].resetFields();
// console.log(this.$refs["cardForm"].resetFields())
if (done && typeof done === "function") {
done();
} else {
this.cardDialog = false;
}
},
// 添加作业人员数据(起吊作业)
onAddTable() {
this.cardForm.tableList.push({
id: "id-" + Math.random().toString(36).substr(2, 9),
fileName: "",
fileList: [],
});
},
// 删除作业人员数据(起吊作业)
onDeleteTable(row) {
this.$confirm('确定删除该行数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const findIndex = this.cardForm.tableList.findIndex(item => item.id === row.id);
if (findIndex !== -1) {
this.cardForm.tableList.splice(findIndex, 1);
this.$message({
type: 'success',
message: '删除成功!'
});
}
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
},
// 删除作业人员数据(起吊作业)
deleteTreeRow(row) {
console.log(row)
this.$confirm('确定删除该行数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteConstructionEquipmentCategoryApi({
id: row.id,
projectSn: this.projectSn
}).then((res) => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDangerTypeRecordList()
this.getDangerItemRecord()
})
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
},
deleteRow(row) {
console.log(row)
this.$confirm('确定删除该行数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteConstructionEquipmentApi({
id: row.id,
projectSn: this.projectSn
}).then((res) => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDangerItemRecord()
})
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
},
//获取选中的 节点
getCheckedNode(data) {
this.checkedNodeData = data;
console.log(data);
this.getDangerItemRecord()
},
//全部关闭
setCheckedKeys() {
this.defaultExpand = false
for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
this.$refs.tree.store._getAllNodes()[i].expanded = this.defaultExpand
}
},
//全部展开
setCheckedNodes() {
this.defaultExpand = true //展开所有节点
for (var i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
this.$refs.tree.store._getAllNodes()[i].expanded = this.defaultExpand
}
},
//获取列表数据--右侧
getDangerItemRecord() {
let data = {
projectSn: this.projectSn,
constructionEquipmentToolClassificationId: this.checkedNodeData.id,
projectEquipmentNumber: this.formInline.projectEquipmentNumber,
commonDiseasePhenomena: this.formInline.commonDiseasePhenomena,
specificationModel: this.formInline.specificationModel,
pageNo: this.pageNo,
pageSize: this.pageSize,
}
getConstructionEquipmentPageApi(data).then((res) => {
if (res.code == 200) {
this.tableData = res.result.records.map(item => {
return {
...item,
commonDiseasePicture: isJSON(item.commonDiseasePicture) && item.commonDiseasePicture != null ? JSON.parse(item.commonDiseasePicture) : [],
commonDiseasePreventionMethodPicture: isJSON(item.commonDiseasePreventionMethodPicture) && item.commonDiseasePreventionMethodPicture != null ? JSON.parse(item.commonDiseasePreventionMethodPicture) : [],
}
});
this.total = res.result.total;
}
})
},
handleSizeChange() {
this.getDangerItemRecord();
},
handleCurrentChange() {
this.getDangerItemRecord();
},
//列表查询--右侧
onSubmit() {
this.getDangerItemRecord()
},
//表格多选
handleSelectionChange(value) {
if (value.length > 0) {
let arr = []
for (let i = 0; i < value.length; i++) {
arr.push(value[i].id)
}
this.checkboxId = arr
this.showBatch = false
} else {
this.checkboxId = value
this.showBatch = true
}
},
//查询选择人员下拉
getDutyPerson() {
let data = {
projectSn: this.$store.state.projectSn,
// isFilterQualityRegionEnterprise: 1
}
getWorkerInfoList(data).then(res => {
if (res.code == 200) {
this.workerListOptions = res.result.records
console.log('获取施工人员下拉', this.workerListOptions)
} else {
this.$message.error(res.message)
}
})
},
previewDetail(val) {
console.log("!!!!!!!!!!!!!!!!!!", val);
this.dialogFormVisible = false;
this.isEdit = true;
// 详细
this.dialogTitle = this.$t("message.dangerousBigProject.detailed");
this.detailId = val.id;
getConstructionEquipmentByIdApi({
id: val.id,
}).then((res) => {
if (res.result) {
console.log(res.result, 1);
this.workDetail = {
...val,
...res.result,
};
// this.$nextTick(() => {
// this.bindQRCode(val.id);
// })
}
});
this.downloadConstructionEquipmentCheckFile(2);
this.isSuperDanger = val.issuperdanger;
},
},
computed: {
srcListUp() {
return (list) => {
return list.map(item => {
return this.$store.state.FILEURL + item.url
})
}
},
}
}
</script>
<style lang="less" scoped>
.percentage_title {
display: flex;
justify-content: center;
padding: 10px 0;
}
.equipment_bg_img {
width: 350px;
height: 220px;
background-image: url("~@/assets/images/equipment_bg_img.png");
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
.equipment_box {
// position: absolute;
// top: 29%;
// left: 23%;
width: 40%;
font-size: 12px;
color: #2E4070;
// line-height: 29px;
>div:nth-child(1) {
position: absolute;
top: 32%;
left: 23%;
}
>div:nth-child(2) {
position: absolute;
top: 45%;
left: 23%;
}
>div:nth-child(3) {
position: absolute;
top: 58%;
left: 23%;
}
>div:nth-child(4) {
position: absolute;
top: 72%;
left: 23%;
}
>div:nth-child(5) {
position: absolute;
top: 85%;
left: 23%;
}
}
#qrCode {
position: absolute;
right: 8%;
bottom: 8%;
}
}
.info-content {
display: flex;
}
.info-title {
display: flex;
align-items: center;
font-size: 18px;
margin-left: 10px;
.info-title_right {
margin-left: 10px;
background-color: #EA3941;
color: #fff;
font-size: 14px;
border-radius: 4px;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
}
}
.gasanalysis-table1 {
width: 100%;
table {
width: 100%;
// height: 100%;
font-size: 16px;
margin-bottom: 20px;
}
tr {
height: 50px;
}
td {
text-align: center;
min-width: 50px;
.el-select,
/deep/ .el-input {
width: 150px !important;
}
}
table,
td,
th {
border: 1px solid #CDCDCD;
border-collapse: collapse;
// color: white;
}
th {
background-color: #EEEEEE;
}
}
.form-box {
width: 100%;
display: flex;
flex-wrap: wrap;
/deep/.el-form-item {
width: 25%;
padding-right: 10px;
box-sizing: border-box;
}
// /deep/.el-col-12{
// padding-left: 20px;
// }
/deep/.el-input__inner {
width: 100%;
}
/deep/.el-select {
width: 100%;
}
/deep/.el-cascader {
width: 100%;
}
}
.dialogFormBox {
width: initial;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.addbox {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
.icon-box {
>i:not(:first-child) {
margin-left: 10px;
}
}
.flex {
display: flex;
}
.flex2 {
display: flex;
align-items: center;
}
.flex3 {
display: flex;
align-items: center;
justify-content: space-between;
}
.backText {
padding: 0;
padding-left: 10px;
/deep/.el-page-header__content {
font-size: 14px;
}
}
.qualityProblemBank2 {
padding-bottom: 20px;
height: 100%;
background: #fff;
padding: 0 10px;
padding-top: 10px;
box-sizing: border-box;
}
.qualityProblemBank {
width: 100%;
height: 100%;
box-sizing: border-box;
// padding: 16px 20px;
.scroll /deep/ .__view {
height: 100%;
}
.content {
height: 100%;
width: 100%;
}
.left {
width: 20%;
height: 100%;
position: relative;
padding: 16px 20px;
box-sizing: border-box;
background-color: white;
.btn_wrap_box {
margin-bottom: 10px;
display: flex;
justify-content: space-between;
.btn_wrap {
// border-top: 1px solid @borderColor;
// padding-top: 10px;
text-align: center;
// position: absolute;
// bottom: 16px;
// right: 0;
// left: 0;
display: flex;
>.el-button {
margin: 0;
}
>.el-button:first-child {
border-radius: 2px 0 0 2px;
}
>.el-button:last-child {
border-radius: 0 2px 2px 0;
border-left: none;
}
}
}
.ellipsis {
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.right {
width: 78.8%;
height: 100%;
box-sizing: border-box;
// border-left: 1px solid @borderColor;
padding: 10px 0 16px 20px;
margin-left: 20px;
background-color: white;
.tab_btn_wrap {
margin-top: 15px;
}
}
// .filter-tree {
// color: #606266;
// }
.custom-tree-node {
width: 100%;
}
.stop {
color: #ff0000;
}
}
.el-button--text {
padding-right: 10px;
}
</style>