|
@@ -159,7 +159,7 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 添加或修改预约作业票台账对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-bod :before-close="cancel">
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
@@ -251,10 +251,10 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<el-card v-for="(ruleForm, index) in ruleForm" :key="index" shadow="always">
|
|
|
- <el-form :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
<el-row>
|
|
|
<el-col :span="18">
|
|
|
- <el-form-item label="作业内容描述" prop="workDescription">
|
|
|
+ <el-form-item label="作业内容描述" prop="workDescription" >
|
|
|
<el-input v-model="ruleForm.workDescription"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -500,26 +500,26 @@ export default {
|
|
|
workEndTime: [
|
|
|
{ required: true, message: "作业结束时间不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- workType: [
|
|
|
- { required: true, message: "作业类型不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
userMg: [
|
|
|
{ required: true, message: "用户主管不能为空", trigger: "blur" }
|
|
|
],
|
|
|
userUnit: [
|
|
|
{ required: true, message: "用户单位不能为空", trigger: "blur" }
|
|
|
],
|
|
|
+ workType: [
|
|
|
+ { required: true, message: "作业类型不能为空", trigger: "change" }
|
|
|
+ ],
|
|
|
workDescription: [
|
|
|
- { required: true, message: "作业内容不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "作业内容不能为空", trigger: "change" }
|
|
|
],
|
|
|
riskLevel: [
|
|
|
- { required: true, message: "风险等级不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "风险等级不能为空", trigger: "change" }
|
|
|
],
|
|
|
workPeopleNumber: [
|
|
|
- { required: true, message: "作业人数不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "作业人数不能为空", trigger: "change" }
|
|
|
],
|
|
|
estimateWorktime: [
|
|
|
- { required: true, message: "预计作业时间不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "预计作业时间不能为空", trigger: "change" }
|
|
|
],
|
|
|
}
|
|
|
};
|
|
@@ -773,6 +773,21 @@ export default {
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
|
this.reset();
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.ruleForm[0].resetFields();
|
|
|
+ if(this.$refs.ruleForm[1]!=null){
|
|
|
+ this.$refs.ruleForm[1].resetFields();
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[2]!=null){
|
|
|
+ this.$refs.ruleForm[2].resetFields();
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[3]!=null){
|
|
|
+ this.$refs.ruleForm[3].resetFields();
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[4]!=null){
|
|
|
+ this.$refs.ruleForm[4].resetFields();
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
@@ -842,7 +857,7 @@ export default {
|
|
|
this.checkCategoryPromotion(this.form.userUnit);
|
|
|
// console.log(row.floorLocation) 将后台的字符串数组重新转换为el-select要的数组格式
|
|
|
let arr=row.floorLocation.split(",")
|
|
|
- let st=[]
|
|
|
+ let st=[]
|
|
|
// 将字符串数组的每一项转换成Number,生成一个新的数组
|
|
|
for (var arrInt in arr) {
|
|
|
st.push(parseInt(arr[arrInt]))
|
|
@@ -852,11 +867,42 @@ export default {
|
|
|
this.ruleForm.length=response.data.tInvoiceWorkcontentList.length
|
|
|
});
|
|
|
},
|
|
|
+ //校验
|
|
|
+ getFormPromise(formDone) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ formDone.validate(res => {
|
|
|
+ resolve(res);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
/** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id != null) {
|
|
|
+ submitForm() {
|
|
|
+ let arr=[]
|
|
|
+ const basicForm = this.$refs.form;
|
|
|
+ arr.push(basicForm)
|
|
|
+ const genForm = this.$refs.ruleForm[0];
|
|
|
+ arr.push(genForm)
|
|
|
+ if(this.$refs.ruleForm[1]!=null){
|
|
|
+ const genForm1 = this.$refs.ruleForm[1];
|
|
|
+ arr.push(genForm1)
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[2]!=null){
|
|
|
+ const genForm2 = this.$refs.ruleForm[2];
|
|
|
+ arr.push(genForm2)
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[3]!=null){
|
|
|
+ const genForm3 = this.$refs.ruleForm[3];
|
|
|
+ arr.push(genForm3)
|
|
|
+ }
|
|
|
+ if(this.$refs.ruleForm[4]!=null){
|
|
|
+ const genForm4= this.$refs.ruleForm[4];
|
|
|
+ arr.push(genForm4)
|
|
|
+ }
|
|
|
+ //多重校验
|
|
|
+ Promise.all(arr.map(this.getFormPromise)).then(res => {
|
|
|
+ const validateResult = res.every(item => !!item);
|
|
|
+ if (validateResult) {
|
|
|
+ if (this.form.id != null) {
|
|
|
this.form.tInvoiceWorkcontentList=this.ruleForm
|
|
|
this.form.floorLocation=this.form.floorLocation.join(',')
|
|
|
updateBookingworkticket(this.form).then(response => {
|
|
@@ -903,9 +949,11 @@ export default {
|
|
|
|
|
|
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.msgError("表单校验未通过,每项申请内容都必填");
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|