付宇航 1 year ago
parent
commit
f8f46a9ede

+ 14 - 9
src/api/rules.js

@@ -9,10 +9,16 @@ export function validPhoneMobile(rule, value, callback){
     if (value === '') {
       callback(new Error('请输入11位手机号'));
     } else {
-      let regPone;
-      regPone = /^1([3456789])\d{9}$/; //最新16手机正则
+      let regPone = null;
+      let mobile = /^1(3|4|5|6|7|8|9)\d{9}$/; //最新16手机正则
+      let tel = /^(0\d{2,3}-){0,1}\d{7,8}$/; //座机
+      if (value.charAt(0) == 0) {    // charAt查找第一个字符方法,用来判断输入的是座机还是手机号
+        regPone = tel;
+      } else {
+        regPone = mobile;
+      }
       if (!regPone.test(value)) {
-        callback(new Error("请填写11位手机号"))
+        callback(new Error("请填写11位手机号或座机号(座机格式为 区号-座机号码)"))
       }
       callback();
     }
@@ -20,12 +26,11 @@ export function validPhoneMobile(rule, value, callback){
     callback();
   }
 }
-/**
- * 验证正数,且小数可2位(包含0及正整数)
- * @param {*} rule
- * @param {*} value
- * @param {*} callback
- */
+//  * 验证正数,且小数可2位(包含0及正整数)
+//  * @param {*} rule
+//  * @param {*} value
+//  * @param {*} callback
+//  *
 export function checkPositiveDecimal(rule, value, callback) {
   if (value) {
     value += ''

+ 20 - 20
src/components/ObsImageUpload/indexFile.vue

@@ -87,26 +87,26 @@ export default {
     };
   },
   watch: {
-    value: {
-      handler(val) {
-        if (val) {
-          // 首先将值转为数组
-          const list = Array.isArray(val) ? val : this.value.split(',');
-          // 然后将数组转为对象数组
-          this.fileList = list.map(item => {
-            if (typeof item === "object") {
-              item = {name: item.fileName, url: item.picUrl};
-            }
-            return item;
-          });
-        } else {
-          this.fileList = [];
-          return [];
-        }
-      },
-      deep: true,
-      immediate: true
-    }
+    // value: {
+    //   handler(val) {
+    //     if (val) {
+    //       // 首先将值转为数组
+    //       const list = Array.isArray(val) ? val : this.value.split(',');
+    //       // 然后将数组转为对象数组
+    //       this.fileList = list.map(item => {
+    //         if (typeof item === "object") {
+    //           item = {name: item.fileName, url: item.picUrl};
+    //         }
+    //         return item;
+    //       });
+    //     } else {
+    //       this.fileList = [];
+    //       return [];
+    //     }
+    //   },
+    //   deep: true,
+    //   immediate: true
+    // }
   },
   computed: {
     // 是否显示提示

+ 1 - 1
src/views/zdsz/engineeringCivil/index.vue

@@ -1457,7 +1457,7 @@ export default {
             })
           }
         } else {
-          this.$message.error(`请完善信息!`);
+          // this.$message.error(`请完善信息!`);
         }
       })
       

+ 3 - 1
src/views/zdsz/engineeringDangerous/index.vue

@@ -213,7 +213,7 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="现场负责人电话" prop="siteHeadPhone">
-              <el-input v-model="form.siteHeadPhone" placeholder="请填写现场负责人电话" maxlength="11"/>
+              <el-input v-model="form.siteHeadPhone" placeholder="请填写现场负责人电话" maxlength="13"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -403,12 +403,14 @@
               <ObsFileUpload ref="obsFileUpload" :file-size="100"
                              :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']" :limit="9999"
                              :value="form.pics"
+                             @input="filesUpload"
               ></ObsFileUpload>
             </el-form-item>
             <el-form-item label="附件" prop="files" v-else>
               <ObsFileUpload ref="obsFileUpload" :file-size="100"
                              :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']" :limit="9999"
                              :value="form.files"
+                             @input="filesUpload"
               ></ObsFileUpload>
             </el-form-item>
           </el-col>

+ 10 - 3
src/views/zdsz/engineeringIndustry/index.vue

@@ -171,7 +171,7 @@
           <el-input v-model="form.designHead" placeholder="请填写现场负责人" maxlength="20"></el-input>
         </el-form-item>
         <el-form-item label="设计联系方式" prop="designPhone">
-          <el-input v-model="form.designPhone" placeholder="请填写设计联系方式" maxlength="11"></el-input>
+          <el-input v-model="form.designPhone" placeholder="请填写设计联系方式" maxlength="13"></el-input>
         </el-form-item>
         <el-form-item label="监理单位" prop="supervisionUnit">
           <el-input v-model="form.supervisionUnit" placeholder="请填写监理单位" maxlength="50"/>
@@ -180,7 +180,7 @@
           <el-input v-model="form.supervisionHead" placeholder="请填写监理负责人" maxlength="20"></el-input>
         </el-form-item>
         <el-form-item label="监理联系电话" prop="supervisionPhone">
-          <el-input v-model="form.supervisionPhone" placeholder="请填写监理联系电话" maxlength="11"></el-input>
+          <el-input v-model="form.supervisionPhone" placeholder="请填写监理联系电话" maxlength="13"></el-input>
         </el-form-item>
         <el-form-item label="工程类型" prop="enginType">
           <el-select v-model="form.enginType" placeholder="请选择工程类型" style="width: 100%">
@@ -209,6 +209,7 @@
                              :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']"
                              :limit="9999"
                              :value="form.pics"
+                             @input="filesUpload"
               ></ObsFileUpload>
             </el-form-item>
             <el-form-item label="附件" prop="files" v-else style="width: 100%">
@@ -216,6 +217,7 @@
                              :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']"
                              :limit="9999"
                              :value="form.files"
+                             @input="filesUpload"
               ></ObsFileUpload>
             </el-form-item>
           </el-col>
@@ -484,7 +486,7 @@ export default {
           {required: false, message: "类型不能为空", trigger: "blur"}
         ],
         files: [
-          {required: false, message: "附件不能为空", trigger: "blur"}
+          {required: true, message: "至少上传一个附件", trigger: "blur"}
         ],
       },
       // 节点规则校验
@@ -520,6 +522,11 @@ export default {
     });
   },
   methods: {
+    filesUpload(url){
+      console.log('upload successfully')
+      this.form.files = url
+      this.$refs.form.validate()
+    },
     validateState(rule, value, callback) {
       console.log(rule)
       console.log(value)

+ 74 - 64
src/views/zdsz/engineeringInfrastructure/index.vue

@@ -167,7 +167,7 @@
           <el-input v-model="queryParams.plannedDuration" placeholder="请输入计划工期" maxlength="50" :disabled="title == '添加用料' "></el-input>
         </el-form-item>
         <el-form-item label="文件" prop="files" v-if="queryParams.id">
-          <ObsFileUpload ref="obsFileUpload" :file-size="100" :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']" :limit="9999"  :value="queryParams.pics" @input="filesUpload"
+          <ObsFileUpload ref="obsFileUpload" :disabled="title != '新增工程'" :file-size="100" :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg','mp4']" :limit="9999"  :value="queryParams.pics" @input="filesUpload"
           ></ObsFileUpload>
         </el-form-item>
         <el-form-item label="文件" prop="files" v-else>
@@ -553,6 +553,9 @@ export default {
         enginContent: [
           { required: true, message: "工程内容不能为空", trigger: "blur" }
         ],
+        files: [
+          { required: true, message: "至少上传一个文件", trigger: "blur" }
+        ],
 
       },
       // 节点规则校验
@@ -720,8 +723,10 @@ export default {
     this.currentId = e.id
     this.$refs.ConstructionDetails.open(this.dict.type.engineering_infrastructure)
   },
-  filesUpload(){
-
+  filesUpload(url){
+    console.log('upload successfully')
+    this.queryParams.files = url
+    this.$refs.form.validate()
   },
   // 添加用料
   addMaterial(data){
@@ -860,68 +865,49 @@ export default {
       this.nodeDetailVisible = false
     },
     toNodeDetail(){
-      let nodeCollection = []
-      // 收集节点信息
-      this.currentCheckList.forEach((e,idx) => {
-         let nodeItem = this.$refs['EnginNodeInfo'+ idx][0].infoCollection()
-        //  console.log(nodeItem)
-         delete nodeItem.zEngiineeringPhotoBoList
-         nodeCollection.push(nodeItem)
-      })
-      this.queryParams.zEngineeringNodeBoList = nodeCollection
-      console.log('queryParams',this.queryParams)
-      if (this.title == '修改基建工程') {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            this.queryParams.files = this.$refs['obsFileUpload'].fileList;
-            if (this.$refs.obsFileUpload.fileList==null||this.$refs.obsFileUpload.fileList.length===0){
-              this.$message.warning('必须上传文件!')
-              return
-            }
-            let param = this.queryParams
-            delete param.zEngineeringNodeBo
-            putEngineeringInfrastructure(param).then(res => {
-              if (res.code == 200) {
-                this.$message({
-                  message: '修改成功',
-                  type: 'success'
-                });
-                this.open = false
-                console.log('选中节点集合', this.currentCheckList)
-                this.currentCheckList = []
-                this.getList()
-                // this.$emit('closeToSucceed')
+      this.$refs.form.validate(valid => { 
+        if(valid){
+          let nodeCollection = []
+          // 收集节点信息
+          this.currentCheckList.forEach((e,idx) => {
+            let nodeItem = this.$refs['EnginNodeInfo'+ idx][0].infoCollection()
+            //  console.log(nodeItem)
+            delete nodeItem.zEngiineeringPhotoBoList
+            nodeCollection.push(nodeItem)
+          })
+          this.queryParams.zEngineeringNodeBoList = nodeCollection
+          console.log('queryParams',this.queryParams)
+          if (this.title == '修改基建工程') {
+            this.$refs["form"].validate(valid => {
+              if (valid) {
+                this.queryParams.files = this.$refs['obsFileUpload'].fileList;
+                if (this.$refs.obsFileUpload.fileList==null||this.$refs.obsFileUpload.fileList.length===0){
+                  this.$message.warning('必须上传文件!')
+                  return
+                }
+                let param = this.queryParams
+                delete param.zEngineeringNodeBo
+                putEngineeringInfrastructure(param).then(res => {
+                  if (res.code == 200) {
+                    this.$message({
+                      message: '修改成功',
+                      type: 'success'
+                    });
+                    this.open = false
+                    console.log('选中节点集合', this.currentCheckList)
+                    this.currentCheckList = []
+                    this.getList()
+                    // this.$emit('closeToSucceed')
+                  }
+                })
               }
-            })
-          }
-        });
-      } else if(this.enginNodeStatus == '添加用料'){
-        this.queryParams.files = this.$refs['obsFileUpload'].fileList;
-        addEngineeringInfrastructure(this.queryParams).then(res => {
-          if(res.code == 200){
-            this.$message({
-              message: '添加成功',
-              type: 'success'
             });
-            this.open = false
-            console.log('选中节点集合',this.currentCheckList)
-            this.currentCheckList = []
-            this.getList()
-            // this.$emit('closeToSucceed')
-          }
-        })
-      }else{
-        this.$refs["form"].validate(valid => {
-          if (valid) {
+          } else if(this.enginNodeStatus == '添加用料'){
             this.queryParams.files = this.$refs['obsFileUpload'].fileList;
-            if (this.$refs.obsFileUpload.fileList==null||this.$refs.obsFileUpload.fileList.length===0){
-              this.$message.warning('必须上传文件!')
-              return
-            }
             addEngineeringInfrastructure(this.queryParams).then(res => {
               if(res.code == 200){
                 this.$message({
-                  message: '新增成功',
+                  message: '添加成功',
                   type: 'success'
                 });
                 this.open = false
@@ -931,9 +917,35 @@ export default {
                 // this.$emit('closeToSucceed')
               }
             })
+          }else{
+            this.$refs["form"].validate(valid => {
+              if (valid) {
+                this.queryParams.files = this.$refs['obsFileUpload'].fileList;
+                if (this.$refs.obsFileUpload.fileList==null||this.$refs.obsFileUpload.fileList.length===0){
+                  this.$message.warning('必须上传文件!')
+                  return
+                }
+                addEngineeringInfrastructure(this.queryParams).then(res => {
+                  if(res.code == 200){
+                    this.$message({
+                      message: '新增成功',
+                      type: 'success'
+                    });
+                    this.open = false
+                    console.log('选中节点集合',this.currentCheckList)
+                    this.currentCheckList = []
+                    this.getList()
+                    // this.$emit('closeToSucceed')
+                  }
+                })
+              }
+            });
           }
-        });
-      }
+        } else {
+
+        }
+      })
+      
       return
       getDictList({enginType:['engineering_infrastructure']}).then(res => {
         this.nodeList = res.data
@@ -1121,10 +1133,8 @@ export default {
       viewEngineeringInfrastructure(row.id).then(res => {
         console.log(res)
         let newData = res.data
-        console.log(newData)
-        console.log(res.data.zEngineeringNodeBoList[0].type)
         let zEngineeringNodeBo = {
-            type:res.data.zEngineeringNodeBoList[0].type,
+            type:res.data.zEngineeringNodeBoList[0].type || null,
             zEngineeringInfoBo:res.data.zEngineeringNodeBoList[0].zEngineeringInfoBo
         }
         newData.zEngineeringNodeBo = zEngineeringNodeBo