<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="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-row>
|
<el-row>
|
<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-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.hoistingToolName">
|
<el-input
|
v-model="form.workDetail.hoistingToolName"
|
autosize
|
type="textarea"
|
placeholder="请输入"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="起吊物体质量" prop="workDetail.weightMass">
|
<el-input
|
v-model="form.workDetail.weightMass"
|
type="number"
|
placeholder="请输入"
|
>
|
<template #append>吨(t)</template>
|
</el-input>
|
</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>
|
</div>
|
</template>
|
|
<script>
|
|
import {workApplyApi} from "../../../../../api/workApply";
|
|
export default{
|
name: 'hoistForm',
|
components: {},
|
props:['workerList'],
|
data(){
|
return{
|
form: {
|
operatorUids: [],
|
workType: 3,
|
workLevel: null,
|
workContent: '',
|
workLocation: '',
|
workDetail:{
|
hoistingToolName: '',
|
weightMass: null
|
},
|
workTimeLine: [],
|
expStartTime: '',
|
hazardIdentification: '',
|
expEndTime: ''
|
},
|
workLevelList: [
|
{
|
label: "一级吊装作业",
|
value: 8
|
},
|
{
|
label: "二级吊装作业",
|
value: 9
|
},
|
{
|
label: "三级吊装作业",
|
value: 10
|
}
|
],
|
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' }],
|
hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.hoistingToolName": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
|
"workDetail.weightMass": [{ 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]
|
let { workTimeLine, ...data } = JSON.parse(JSON.stringify(this.form))
|
data.workDetail.weightMass = Number(data.workDetail.weightMass)
|
const res = await workApplyApi().postHoistApply(data)
|
if (res.data.code === '200') {
|
this.$message({
|
type: 'success',
|
message: '提交成功!'
|
});
|
this.$refs["ruleFormRef"].clearValidate()
|
this.form = {
|
operatorUids: [],
|
workType: 3,
|
workLevel: null,
|
workContent: '',
|
workLocation: '',
|
workDetail:{
|
hoistingToolName: '',
|
weightMass: null
|
},
|
workTimeLine: [],
|
expStartTime: '',
|
hazardIdentification: '',
|
expEndTime: ''
|
}
|
} else {
|
this.$message({
|
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>
|