<template>
|
<div class="home-container">
|
<div style="height: 100%">
|
<el-form :model="form" label-width="150px" :rules="applyRules" ref="ruleFormRef">
|
<div class="homeCard">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="作业人" prop="operatorUids">
|
<el-select v-model="form.operatorUids" multiple>
|
<el-option
|
v-for="item in workerList"
|
:key="item.id"
|
:label="item.realname + '(' + item.username.toString().replace(/^(\d{3})\d{4}(\d{4})$/,'$1****$2') + ')'"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="危险辨识" prop="hazardIdentification">
|
<el-input
|
v-model="form.hazardIdentification"
|
autosize
|
type="textarea"
|
placeholder="请输入危险辨识"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="作业等级" prop="workLevel">
|
<el-select v-model="form.workLevel">
|
<el-option
|
v-for="item in workLevelList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="作业时间" prop="workTimeLine">
|
<el-date-picker
|
v-model="form.workTimeLine"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
type="datetimerange"
|
range-separator="至"
|
start-placeholder="开始时间"
|
end-placeholder="结束时间"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="作业内容" prop="workContent">
|
<el-input
|
v-model="form.workContent"
|
autosize
|
type="textarea"
|
placeholder="请输入作业内容"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="作业地址" prop="workLocation">
|
<el-input
|
v-model="form.workLocation"
|
autosize
|
type="textarea"
|
placeholder="请输入作业地址"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="盲板编号" prop="workDetail.bpCode">
|
<el-input
|
v-model="form.workDetail.bpCode"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="主要介质" prop="workDetail.mainMedia">
|
<el-input
|
v-model="form.workDetail.mainMedia"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="温度" prop="workDetail.temperature">
|
<el-input
|
v-model="form.workDetail.temperature"
|
type="number"
|
placeholder="请输入"
|
>
|
<template #append>摄氏度(℃)</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="压力" prop="workDetail.pressure">
|
<el-input
|
v-model="form.workDetail.pressure"
|
type="number"
|
placeholder="请输入"
|
>
|
<template #append>千帕(kPa)</template>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="盲板材质" prop="workDetail.bpMaterialQuality">
|
<el-input
|
v-model="form.workDetail.bpMaterialQuality"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="盲板规格" prop="workDetail.bpSpecification">
|
<el-input
|
v-model="form.workDetail.bpSpecification"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="盲板时间" prop="workDetail.installLine">
|
<el-date-picker
|
v-model="form.workDetail.installLine"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
type="datetimerange"
|
range-separator="--"
|
start-placeholder="装盲板时间"
|
end-placeholder="拆盲板时间"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="盲板位置" prop="workDetail.bpLocation">
|
<el-input
|
v-model="form.workDetail.bpLocation"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
|
<el-col :span="12">
|
<el-form-item label="关联作业" prop="workDetail.otherSpecialWork">
|
<el-select v-model="form.workDetail.otherSpecialWork" multiple>
|
<el-option
|
v-for="item in otherWorkList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
<el-form-item label="隐患上报图" prop="img">
|
<el-upload
|
accept=".pdf,.jpg,.png"
|
:action="fileRoad"
|
class="upload-demo"
|
ref="upload"
|
:headers="header"
|
:data="uploadForm"
|
list-type="picture-card"
|
:file-list="fileList"
|
v-model="form.workDetail.bpLocationMapPath"
|
:on-change="handleChangeFile"
|
:on-success="onFileSuccess"
|
:multiple="false"
|
:auto-upload="true">
|
<i slot="default" class="el-icon-plus"></i>
|
<div slot="file" slot-scope="{file}">
|
<img
|
class="el-upload-list__item-thumbnail"
|
:src="file.url" alt=""
|
>
|
<span class="el-upload-list__item-actions">
|
<span
|
class="el-upload-list__item-preview"
|
@click="handleFile(file)"
|
>
|
<i class="el-icon-zoom-in"></i>
|
</span>
|
<span
|
v-if="!disabled"
|
class="el-upload-list__item-delete"
|
@click="handleRemove(file,file.$index)"
|
>
|
<i class="el-icon-delete"></i>
|
</span>
|
</span>
|
</div>
|
</el-upload>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
</el-form>
|
<div class="applyBtn">
|
<el-button type="primary" size="large" plain @click="submitForm()">发起申请</el-button>
|
</div>
|
</div>
|
<el-dialog v-model="dialogVisible">
|
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {workApplyApi} from "../../../../../api/workApply";
|
import Cookies from "_js-cookie@2.2.0@js-cookie";
|
|
export default{
|
name: 'brokenForm',
|
components: {},
|
props:['workerList'],
|
data(){
|
return{
|
fileRoad:process.env.BASE_API + '/task/web/upload',
|
uploadForm:{
|
},
|
header:{Authorization:''},
|
disabled:false,
|
form: {
|
fileRoad:process.env.BASE_API + '/task/web/upload',
|
uploadForm:{
|
},
|
header:{Authorization:''},
|
disabled:false,
|
operatorUids: [],
|
workType: 8,
|
workLevel: null,
|
workContent: '',
|
workLocation: '',
|
workDetail:{
|
bpCode: '',
|
mainMedia: '',
|
temperature: null,
|
pressure: null,
|
bpMaterialQuality: '',
|
bpSpecification: '',
|
bpLocation: '',
|
bpLocationMapPath: [],
|
installLine: [],
|
installBpTime: '',
|
uninstallBpTime: '',
|
hazardIdentification: '',
|
otherSpecialWork: []
|
},
|
workTimeLine: [],
|
expStartTime: '',
|
expEndTime: ''
|
},
|
fileList: [],
|
imgLimit: 5,
|
uploadUrl: '',
|
dialogVisible: false,
|
dialogImageUrl: null,
|
workLevelList: [
|
{
|
label: "抽盲板作业",
|
value: 11
|
},
|
{
|
label: "堵盲板作业",
|
value: 12
|
}
|
],
|
csDepList: [
|
{
|
label: "单位一",
|
value: 1
|
},
|
{
|
label: "单位二",
|
value: 2
|
},
|
{
|
label: "单位三",
|
value: 3
|
},
|
{
|
label: "单位四",
|
value: 4
|
},
|
{
|
label: "单位五",
|
value: 5
|
},
|
{
|
label: "单位六",
|
value: 6
|
}
|
],
|
otherWorkList: [
|
{
|
label: "动火作业",
|
value: 1
|
},
|
{
|
label: "受限空间作业",
|
value: 2
|
},
|
{
|
label: "吊装作业",
|
value: 3
|
},
|
{
|
label: "动土作业",
|
value: 4
|
},
|
{
|
label: "断路作业",
|
value: 5
|
},
|
{
|
label: "高处作业",
|
value: 6
|
},
|
{
|
label: "临时用电作业",
|
value: 7
|
},
|
{
|
label: "盲板抽堵作业",
|
value: 8
|
}
|
],
|
applyRules:{
|
operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'change' }],
|
workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
workLevel: [{ required: true, message: '该内容不能为空', trigger: 'change' }],
|
workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.bpCode": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.mainMedia": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.temperature": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.pressure": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.bpMaterialQuality": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.bpSpecification": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.installLine": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.bpLocation": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.bpLocationMapPath": [{ required: true, message: '该内容不能为空', trigger: 'blur' }]
|
},
|
}
|
},
|
methods:{
|
submitForm(formEl) {
|
this.$refs["ruleFormRef"].validate(async (valid, fields) => {
|
if (valid) {
|
this.form.expStartTime = JSON.parse(JSON.stringify(this.form.workTimeLine))[0]
|
this.form.expEndTime = JSON.parse(JSON.stringify(this.form.workTimeLine))[1]
|
this.form.workDetail.installBpTime = JSON.parse(JSON.stringify(this.form.workDetail.installLine))[0]
|
this.form.workDetail.uninstallBpTime = JSON.parse(JSON.stringify(this.form.workDetail.installLine))[1]
|
let { workTimeLine, ...data } = JSON.parse(JSON.stringify(this.form))
|
let { installLine, ...data2 } = JSON.parse(JSON.stringify(this.form.workDetail))
|
data.workDetail = data2
|
data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',')
|
data.workDetail.bpLocationMapPath = JSON.stringify(this.fileList.map(item => { return item.url.substring(process.env.IMG_API.length) }))
|
data.workDetail.temperature = Number(data.workDetail.temperature)
|
data.workDetail.pressure = Number(data.workDetail.pressure)
|
const res = await workApplyApi().postPlateApply(data)
|
if (res.data.code === '200') {
|
this.$message({
|
type: 'success',
|
message: '提交成功!'
|
});
|
this.$refs["ruleFormRef"].clearValidate()
|
this.form = {
|
operatorUids: [],
|
workType: 8,
|
workLevel: null,
|
workContent: '',
|
workLocation: '',
|
workDetail:{
|
bpCode: '',
|
mainMedia: '',
|
temperature: null,
|
pressure: null,
|
bpMaterialQuality: '',
|
bpSpecification: '',
|
bpLocation: '',
|
bpLocationMapPath: [],
|
installLine: [],
|
installBpTime: '',
|
uninstallBpTime: '',
|
hazardIdentification: '',
|
otherSpecialWork: []
|
},
|
workTimeLine: [],
|
expStartTime: '',
|
expEndTime: ''
|
}
|
this.fileList = []
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
} else {
|
console.log('error submit!', fields)
|
}
|
})
|
},
|
handleChangeFile(){
|
this.header.Authorization = Cookies.get('token')
|
},
|
onFileSuccess(response){
|
if(response.code === '200'){
|
this.fileList.push({url:process.env.IMG_API + response.result.path})
|
this.$notify({
|
type:'success',
|
duration:2000,
|
message:'上传成功',
|
title:'成功',
|
})
|
}else{
|
this.$message({
|
message:res.data.message,
|
type:'warning'
|
})
|
}
|
},
|
handleFile(file){
|
this.dialogImageUrl = file.url;
|
this.dialogVisible = true;
|
},
|
showImg(file){
|
window.open(file, '_blank')
|
},
|
handleRemove(file,value){
|
return this.$confirm(`确定移除 ${ file.uid }?`,'提示',{
|
confirmButtonText:'确定',
|
cancelButtonText:'取消',
|
type:'warning',
|
}).then(()=> {
|
this.fileList.splice(value,1)
|
})
|
},
|
},
|
};
|
</script>
|
|
<style scoped lang="scss">
|
.home-container {
|
height: 100%;
|
overflow: hidden;
|
position: relative;
|
.homeCard{
|
width: 100%;
|
padding: 20px;
|
box-sizing: border-box;
|
background: #fff;
|
border-radius: 4px;
|
margin-bottom: 20px;
|
}
|
.applyBtn{
|
width: 100%;
|
background: #fff;
|
padding-top: 15px;
|
z-index: 5;
|
box-shadow: 0 -3px 8px rgba(150,150,150,.1);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.el-row{
|
margin-bottom: 20px;
|
}
|
.el-row:last-child {
|
margin-bottom: 0;
|
}
|
.el-input{
|
width: 100% !important;
|
}
|
.el-date-editor::v-deep{
|
width: 100%;
|
}
|
.el-select{
|
width: 100%;
|
}
|
.el-cascader{
|
width: 100% !important;
|
}
|
}
|
</style>
|