flx:提交危险源模块
This commit is contained in:
parent
d837afa7dc
commit
7d77f1f6a7
11
src/assets/js/api/hazardManage.js
Normal file
11
src/assets/js/api/hazardManage.js
Normal file
@ -0,0 +1,11 @@
|
||||
import {get, post } from '../http'
|
||||
|
||||
// 危险源管理
|
||||
// 分页列表查询危险源、环境因素辨识评价表信息
|
||||
export const getDangerEnvironmentEvaluatePage = data => get('xmgl/dangerEnvironmentEvaluate/page', data);
|
||||
//添加危险源、环境因素辨识评价表信息
|
||||
export const getDangerEnvironmentEvaluateAdd = data => post('xmgl/dangerEnvironmentEvaluate/add', data);
|
||||
// 编辑危险源、环境因素辨识评价表信息
|
||||
export const getDangerEnvironmentEvaluateEdit = data => post('xmgl/dangerEnvironmentEvaluate/edit', data);
|
||||
// 删除危险源、环境因素辨识评价表信息
|
||||
export const getDangerEnvironmentEvaluateDelete = data => post('xmgl/dangerEnvironmentEvaluate/delete', data);
|
||||
526
src/views/projectFront/hazardManage/hazardRatingForm.vue
Normal file
526
src/views/projectFront/hazardManage/hazardRatingForm.vue
Normal file
@ -0,0 +1,526 @@
|
||||
<template>
|
||||
<div class="fullHeight">
|
||||
<div class="searchBox whiteBlock">
|
||||
<el-form :inline="true" size="medium" :model="searchForm" ref="searchForm">
|
||||
<el-form-item label="编制人" prop="preparer">
|
||||
<el-input v-model="searchForm.preparer"
|
||||
:placeholder="$t('message.personnelPosition.please_enter')" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="exampleProjectName">
|
||||
<el-radio-group v-model="searchForm.exampleProjectName">
|
||||
<el-radio :label="1">动态风险</el-radio>
|
||||
<el-radio :label="2">静态风险</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- v-permission="{key: 'renovate', menuPath: '/project/constructionManage/deviceManage'}" -->
|
||||
<el-button type="primary" plain @click="loadCardData">
|
||||
{{ $t("message.personnelPosition.beaconManage.query") }}
|
||||
</el-button>
|
||||
<el-button type="warning" plain @click="resetForm">
|
||||
{{ $t("message.personnelPosition.beaconManage.refresh") }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="isAddPoint(1)"> 新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="table_wrap whiteBlock">
|
||||
<el-table class="tables" :data="pointList">
|
||||
<el-table-column type="index" width="50" align="center"
|
||||
:label="$t('message.personnelPosition.beaconManage.table.index')"></el-table-column>
|
||||
<el-table-column prop="projectGroupName" label="项目组" align="center"></el-table-column>
|
||||
<el-table-column prop="projectGroupName" label="辨识日期" align="center"></el-table-column>
|
||||
<el-table-column prop="epcContractorName" label="编制人" align="center"></el-table-column>
|
||||
<el-table-column prop="constructionUnitName" label="审批人" align="center"></el-table-column>
|
||||
<el-table-column prop="attendanceSheetAttachment" label="附件(危险源、环境因素)" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="download" @click="downloadFn(item)" v-for="item in scope.row.attendanceSheetAttachment"
|
||||
:key="item.uid">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="attendanceSheetAttachment" label="签到表附件" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="download" @click="downloadFn(item)" v-for="item in scope.row.attendanceSheetAttachment"
|
||||
:key="item.uid">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="meetingPictures" label="会议图片" align="center">
|
||||
<template slot-scope="scope">
|
||||
<div class="download" @click="downloadFn(item)" v-for="item in scope.row.meetingPictures"
|
||||
:key="item.uid">{{ item.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('message.personnelPosition.beaconManage.table.operation')" align="center"
|
||||
width="250">
|
||||
<template slot-scope="scope">
|
||||
<div class="tableBtns">
|
||||
<div @click="isAddPoint(2, scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-edit.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.edit")
|
||||
}}</span>
|
||||
</div>
|
||||
<div @click="removePoint(scope.row)" class="operationText">
|
||||
<img src="@/assets/images/icon-delete.png" width="15px" height="15px" />
|
||||
<span>{{
|
||||
$t("message.personnelPosition.beaconManage.table.delete")
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <div slot="empty">{{$t('message.personnelPosition.empty')}}</div> -->
|
||||
</el-table>
|
||||
<el-pagination class="pagerBox" @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page="pageNo" :page-sizes="$store.state.PAGESIZRS" :page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next" :total="Number(total)" background></el-pagination>
|
||||
</div>
|
||||
<!-- 添加卡片弹框 -->
|
||||
<el-dialog :modal-append-to-body="false" :title="cardDialogTitle" :visible.sync="cardDialog" width="667px"
|
||||
:before-close="handleClose">
|
||||
<div class="dialog_content">
|
||||
<el-form size="medium" :model="cardForm" ref="cardForm" :rules="cardFormRules" label-width="125px"
|
||||
class="dialogFormBox">
|
||||
<el-form-item label="项目组" prop="projectTeam">
|
||||
<el-select v-model="cardForm.projectTeam"
|
||||
:placeholder="$t('message.personnelPosition.please_select')" filterable>
|
||||
<el-option :label="item.projectGroupName" :value="item.id"
|
||||
v-for="(item, index) in enterpriseTypeList" :key="index">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="辨识日期" prop="identificationDate">
|
||||
<el-date-picker v-model="cardForm.identificationDate" type="date" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="编辑人" prop="preparer">
|
||||
<el-select v-model="cardForm.preparer"
|
||||
: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="approver">
|
||||
<el-select v-model="cardForm.approver"
|
||||
: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="attachmentsFile">
|
||||
<el-upload class="upload-demo" name="files" :action="$store.state.UPLOADURL"
|
||||
:on-remove="(file, fileList) => handleRemove(file, fileList, 3)" :multiple="false"
|
||||
:on-success="(res, file) => handleSuccess(res, file, 3)"
|
||||
:file-list="cardForm.attachmentsFile" accept="*">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="签到表附件" prop="attendanceSheetAttachment">
|
||||
<el-upload class="upload-demo" name="files" :action="$store.state.UPLOADURL"
|
||||
:on-remove="(file, fileList) => handleRemove(file, fileList, 1)" :multiple="false"
|
||||
:on-success="(res, file) => handleSuccess(res, file, 1)"
|
||||
:file-list="cardForm.attendanceSheetAttachment" accept="*">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="会议图片" prop="meetingPictures">
|
||||
<el-upload class="upload-demo" name="files" :action="$store.state.UPLOADURL"
|
||||
:on-remove="(file, fileList) => handleRemove(file, fileList, 2)" :multiple="false"
|
||||
:on-success="(res, file) => handleSuccess(res, file, 2)"
|
||||
:file-list="cardForm.meetingPictures" accept=".png,.jpg,.jpeg">
|
||||
<!-- .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf -->
|
||||
<el-button type="primary"> 上传附件 </el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getDeviceUnitPage,
|
||||
getProjectGroupPage,
|
||||
} from "@/assets/js/api/project";
|
||||
import {
|
||||
getDangerEnvironmentEvaluatePage,
|
||||
getDangerEnvironmentEvaluateAdd,
|
||||
getDangerEnvironmentEvaluateEdit,
|
||||
getDangerEnvironmentEvaluateDelete,
|
||||
} from "@/assets/js/api/hazardManage";
|
||||
import { getWorkerInfoList } from '@/assets/js/api/laborPerson.js'
|
||||
import { getCooperatorListApi } from "@/assets/js/api/cooperationUnit";
|
||||
import { isJSON } from "@/util/nowDate/index";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
searchForm: {
|
||||
preparer: "",
|
||||
exampleProjectName: "",
|
||||
},
|
||||
pointList: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
cardDialogTitle: "",
|
||||
cardDialog: false,
|
||||
cardForm: {},
|
||||
contractingTypeList: [{
|
||||
id: 1,
|
||||
contractingName: "EPC",
|
||||
}, {
|
||||
id: 2,
|
||||
contractingName: "E+P+C",
|
||||
}], // 承包方式
|
||||
technicalOperationList: [{
|
||||
id: 1,
|
||||
operationName: "土建",
|
||||
}, {
|
||||
id: 2,
|
||||
operationName: "动设备",
|
||||
}, {
|
||||
id: 3,
|
||||
operationName: "静设备",
|
||||
}, {
|
||||
id: 4,
|
||||
operationName: "管道",
|
||||
}, {
|
||||
id: 5,
|
||||
operationName: "电气",
|
||||
}, {
|
||||
id: 6,
|
||||
operationName: "仪表",
|
||||
}, {
|
||||
id: 7,
|
||||
operationName: "其它",
|
||||
}], // 技术操作
|
||||
cardFormRules: {
|
||||
deviceUnitId: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "changer",
|
||||
},
|
||||
],
|
||||
deviceUnitNo: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
exampleProjectName: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.required"),
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
technicalOperation: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
contractingType: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
projectTeam: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
identificationDate: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
preparer: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
approver: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t("message.personnelPosition.mandatory"),
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
isAdd: -1,
|
||||
deviceUnitList: [], // 设备信息
|
||||
enterpriseTypeList: [], // 项目组
|
||||
cooperatorList: [], // 所有企业信息
|
||||
projectGroupUnitList: [], // 项目组下的所有承包商
|
||||
supervisingUnitList: [], // 当前项目组下的监理单位
|
||||
epcContractorList: [], // 当前项目组下的承包商
|
||||
constructionUnitList: [], // 当前epc承包商下的施工承包商
|
||||
initialFlag: true, // 初始化标识首次进入
|
||||
workerListOptions: [], // 人员列表
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
this.projectGroupListFn();
|
||||
this.getDutyPerson();
|
||||
},
|
||||
mounted() {
|
||||
this.loadList();
|
||||
this.loadCardData();
|
||||
this.getCooperatorList();
|
||||
},
|
||||
methods: {
|
||||
// 删除文件
|
||||
handleRemove(file, fileList, type) {
|
||||
const fileTypeMap = {
|
||||
1: 'attendanceSheetAttachment',
|
||||
2: 'meetingPictures',
|
||||
3: 'attachmentsFile',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key] = fileList;
|
||||
}
|
||||
},
|
||||
handleSuccess(res, file, type) {
|
||||
if (res.status == "SUCCESS") {
|
||||
const fileTypeMap = {
|
||||
1: 'attendanceSheetAttachment',
|
||||
2: 'meetingPictures',
|
||||
3: 'attachmentsFile',
|
||||
};
|
||||
const key = fileTypeMap[type];
|
||||
if (key) {
|
||||
this.cardForm[key].push({
|
||||
name: file.name,
|
||||
url: this.$store.state.FILEURL + file.response.data[0].imageUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
initData() {
|
||||
this.cardForm = {
|
||||
preparer: "",
|
||||
identificationDate: "",
|
||||
approver: "",
|
||||
projectTeam: "",
|
||||
attachmentsFile: [],
|
||||
attendanceSheetAttachment: [],
|
||||
meetingPictures: [],
|
||||
projectSn: this.$store.state.projectSn,
|
||||
};
|
||||
},
|
||||
isAddPoint(type, item) {
|
||||
this.isAdd = type;
|
||||
this.initialFlag = true;
|
||||
if (type == 1) {
|
||||
this.initData();
|
||||
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(item);
|
||||
this.cardForm = {
|
||||
...item,
|
||||
attendanceSheetAttachment: item.attendanceSheetAttachment.map(ele => ele),
|
||||
meetingPictures: item.meetingPictures.map(ele => ele),
|
||||
attachmentsFile: item.attachmentsFile.map(ele => ele),
|
||||
};
|
||||
}
|
||||
|
||||
this.cardDialog = true;
|
||||
},
|
||||
removePoint(item) {
|
||||
this.$confirm(
|
||||
this.$t("message.personnelPosition.beaconManage.table.confirmText") +
|
||||
"【" +
|
||||
item.exampleProjectName +
|
||||
"】?",
|
||||
this.$t("message.personnelPosition.beaconManage.table.Tips"),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
getDangerEnvironmentEvaluateDelete({ id: item.id }).then((res) => {
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.delete_success")
|
||||
); //删除成功!
|
||||
});
|
||||
});
|
||||
},
|
||||
loadList() {
|
||||
let param = {
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: 1,
|
||||
pageSize: -1,
|
||||
};
|
||||
getDeviceUnitPage(param).then((res) => {
|
||||
this.deviceUnitList = res.result.records;
|
||||
});
|
||||
},
|
||||
//获取卡片列表
|
||||
loadCardData() {
|
||||
getDangerEnvironmentEvaluatePage({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
preparer: this.searchForm.preparer,
|
||||
exampleProjectName: this.searchForm.exampleProjectName,
|
||||
}).then((res) => {
|
||||
this.pointList = res.result.records.map(item => {
|
||||
return {
|
||||
...item,
|
||||
attendanceSheetAttachment: isJSON(item.attendanceSheetAttachment) ? JSON.parse(item.attendanceSheetAttachment) : [],
|
||||
meetingPictures: isJSON(item.meetingPictures) ? JSON.parse(item.meetingPictures) : [],
|
||||
}
|
||||
});
|
||||
this.total = res.result.total;
|
||||
});
|
||||
},
|
||||
//添加或编辑卡片
|
||||
saveCardFn() {
|
||||
this.$refs["cardForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const result = {
|
||||
...this.cardForm,
|
||||
attendanceSheetAttachment: JSON.stringify(this.cardForm.attendanceSheetAttachment),
|
||||
meetingPictures: JSON.stringify(this.cardForm.meetingPictures),
|
||||
attachmentsFile: JSON.stringify(this.cardForm.attachmentsFile),
|
||||
}
|
||||
console.log(result, this.cardForm.attendanceSheetAttachment);
|
||||
if (this.isAdd == 1) {
|
||||
// this.cardForm.floorId = this.currentFloorDetail.floorId
|
||||
getDangerEnvironmentEvaluateAdd(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.add_success")
|
||||
); //添加成功!
|
||||
});
|
||||
} else if (this.isAdd == 2) {
|
||||
getDangerEnvironmentEvaluateEdit(result).then((res) => {
|
||||
this.cardDialog = false;
|
||||
this.loadCardData();
|
||||
this.$message.success(
|
||||
this.$t("message.personnelPosition.edit_success")
|
||||
); //编辑成功!
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
downloadFn(row) {
|
||||
// "http://42.180.188.17:11211/image/669b96b66b90a34a1aa4ec9c.jpg"
|
||||
fetch(row.url).then((response) => {
|
||||
// 处理响应
|
||||
if (!response.ok) {
|
||||
throw new Error("导出失败");
|
||||
}
|
||||
return response.blob();
|
||||
}).then((blob) => {
|
||||
console.log("导出成功");
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = row.name; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch((error) => {
|
||||
// 处理错误
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["searchForm"].resetFields();
|
||||
this.loadCardData();
|
||||
},
|
||||
//查询选择人员下拉
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
//查看条数
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
//查看页
|
||||
handleCurrentChange(val) {
|
||||
this.pageNo = val;
|
||||
this.loadCardData();
|
||||
},
|
||||
// 关闭前执行
|
||||
handleClose(done) {
|
||||
this.$refs["cardForm"].resetFields();
|
||||
this.epcContractorList = [];
|
||||
this.constructionUnitList = [];
|
||||
this.cardDialog = false;
|
||||
},
|
||||
//获取监理单位
|
||||
projectGroupListFn() {
|
||||
getProjectGroupPage({
|
||||
projectSn: this.$store.state.projectSn,
|
||||
pageNo: 1,
|
||||
pageSize: -1,
|
||||
}).then((res) => {
|
||||
this.enterpriseTypeList = res.result.records;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.download {
|
||||
color: #1684FC;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user