瀏覽代碼

LY 表单验证

ly 2 年之前
父節點
當前提交
058baf6c3c
共有 1 個文件被更改,包括 48 次插入36 次删除
  1. 48 36
      ui/src/views/invoice/bookingworkticket/index.vue

+ 48 - 36
ui/src/views/invoice/bookingworkticket/index.vue

@@ -200,23 +200,23 @@
       </el-table-column>
       <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            v-if="scope.row.bookingworkticket.status== 0"
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['invoice:bookingworkticket:edit']"
-          >修改
-          </el-button>
-          <el-button
-            v-if="scope.row.bookingworkticket.status== 0"
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-          >删除
-          </el-button>
+<!--          <el-button-->
+<!--            v-if="scope.row.bookingworkticket.status== 0"-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-edit"-->
+<!--            @click="handleUpdate(scope.row)"-->
+<!--            v-hasPermi="['invoice:bookingworkticket:edit']"-->
+<!--          >修改-->
+<!--          </el-button>-->
+<!--          <el-button-->
+<!--            v-if="scope.row.bookingworkticket.status== 0"-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-delete"-->
+<!--            @click="handleDelete(scope.row)"-->
+<!--          >删除-->
+<!--          </el-button>-->
           <el-button
             v-if="scope.row.bookingworkticket.status== 3 && scope.row.xpxp == 10"
             size="mini"
@@ -420,7 +420,7 @@
     </el-dialog>
     <!-- 预约续票 -->
     <el-dialog title="预约续票" :visible.sync="xpVisible" width="30%" center>
-      <el-form :model="xpForm" ref="xpForm" label-width="60px">
+      <el-form :model="xpForm" :rules="rulesXp" ref="xpForm" label-width="60px">
         <el-form-item label="作业时间" prop="workStartTime">
           <el-date-picker clearable size="small" style="width: 190px"
                           v-model="xpForm.workStartTime"
@@ -436,7 +436,6 @@
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitXp">确 定</el-button>
         <el-button @click="xpVisible=false">取 消</el-button>
-
       </div>
     </el-dialog>
 
@@ -683,7 +682,7 @@ export default {
           {required: true, message: "楼层位置不能为空", trigger: "blur"}
         ],
         workStartTime: [
-          {required: true, message: "作业开始时间不能为空", trigger: "blur"}
+          {required: true, message: "作业时间不能为空", trigger: "blur"}
         ],
         workEndTime: [
           {required: true, message: "作业结束时间不能为空", trigger: "blur"}
@@ -710,6 +709,15 @@ export default {
         estimateWorktime: [
           {required: true, message: "预计作业时间不能为空", trigger: "change"}
         ],
+      },
+      // 表单校验
+      rulesXp: {
+        yqxkzh: [
+          {required: true, message: "票号不能为空", trigger: "blur"}
+        ],
+        workStartTime: [
+          {required: true, message: "作业时间不能为空", trigger: "blur"}
+        ],
       }
     };
   },
@@ -1241,22 +1249,26 @@ export default {
     },
     //提交预约续票
     submitXp() {
-      this.form = this.xpForm.bookingworkticket
-      this.form.tInvoiceWorkcontentList = []
-      this.xpForm.bookingworkticket = null
-      this.form.tInvoiceWorkcontentList[0] = this.xpForm
-      this.form.workStartTime = this.xpForm.workStartTime
-      this.form.tInvoiceWorkcontentList[0].xpxp = 12    //续票
-      this.form.status = 0
-      addBookingworkticket(this.form).then(response => {
-        this.approveForm.invoiceId = response.data
-        this.approveForm.userSupId = this.form.userMg
-        addInvoice(this.approveForm).then(response => {
-          this.msgSuccess("已提交申请");
-          this.getList();
-          this.xpVisible = false
-        })
-      });
+      this.$refs["xpForm"].validate(valid => {
+        if (valid) {
+          this.form = this.xpForm.bookingworkticket
+          this.form.tInvoiceWorkcontentList = []
+          this.xpForm.bookingworkticket = null
+          this.form.tInvoiceWorkcontentList[0] = this.xpForm
+          this.form.workStartTime = this.xpForm.workStartTime
+          this.form.tInvoiceWorkcontentList[0].xpxp = 12    //续票
+          this.form.status = 0
+          addBookingworkticket(this.form).then(response => {
+            this.approveForm.invoiceId = response.data
+            this.approveForm.userSupId = this.form.userMg
+            addInvoice(this.approveForm).then(response => {
+              this.msgSuccess("已提交申请");
+              this.getList();
+              this.xpVisible = false
+            })
+          });
+        }
+      })
     },
     //关联票号
     association(row) {