<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.uid"
|
:label="item.username"
|
:value="item.uid"
|
/>
|
</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"
|
format="yyyy-MM-dd HH:mm:ss"
|
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"
|
format="YYYY-MM-DD HH:mm"
|
value-format="YYYY-MM-DD HH:mm:00"
|
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="workDetail.bpLocation">
|
<el-input
|
v-model="form.workDetail.bpLocation"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
<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 :span="24">
|
<el-form-item label="盲板位置图" prop="workDetail.bpLocationMapPath">
|
<el-upload accept="image/*" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" :http-request="upload" :action="uploadUrl" list-type="picture-card" :on-remove="handleRemove" :before-remove="beforeRemove" :before-upload="getUploadUrl">
|
<el-icon><Plus /></el-icon>
|
<template #tip>
|
<div class="el-upload__tip">上传jpg/png图片尺寸小于500KB,最多可上传5张</div>
|
</template>
|
</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>
|
export default{
|
name: 'brokenForm',
|
components: {},
|
props:['workerList'],
|
data(){
|
return{
|
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: ''
|
},
|
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:{
|
async submitForm(formEl) {
|
if (!formEl) return
|
await formEl.validate(async (valid, fields) => {
|
if (valid) {
|
state.form.expStartTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[0]
|
state.form.expEndTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[1]
|
state.form.workDetail.installBpTime = JSON.parse(JSON.stringify(state.form.workDetail.installLine))[0]
|
state.form.workDetail.uninstallBpTime = JSON.parse(JSON.stringify(state.form.workDetail.installLine))[1]
|
let { workTimeLine, ...data } = JSON.parse(JSON.stringify(state.form))
|
let { installLine, ...data2 } = JSON.parse(JSON.stringify(state.form.workDetail))
|
data.workDetail = data2
|
data.workDetail.otherSpecialWork = data.workDetail.otherSpecialWork.join(',')
|
data.workDetail.bpLocationMapPath = data.workDetail.bpLocationMapPath.join(',')
|
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') {
|
ElMessage({
|
type: 'success',
|
message: '提交成功!'
|
});
|
formEl.resetFields()
|
state.form.workDetail.bpLocationMapPath = []
|
state.fileList = []
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
} else {
|
console.log('error submit!', fields)
|
}
|
})
|
}
|
},
|
};
|
</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>
|