From 2fb197b815127613142574351334cb7b4ef5d7e3 Mon Sep 17 00:00:00 2001
From: xiaofajia <1665375861@qq.com>
Date: Mon, 28 Oct 2024 11:28:49 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=BD=E5=B7=A5=E4=BA=BA?=
=?UTF-8?q?=E5=91=98=E3=80=81=E9=94=80=E5=94=AE=E4=BA=BA=E5=91=98=E9=9D=9E?=
=?UTF-8?q?=E7=A9=BA=E9=AA=8C=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../repair/tickets/Components/UserInfo.vue | 42 +++++++++++++++----
1 file changed, 35 insertions(+), 7 deletions(-)
diff --git a/src/views/repair/tickets/Components/UserInfo.vue b/src/views/repair/tickets/Components/UserInfo.vue
index 7cfd367..cee2348 100644
--- a/src/views/repair/tickets/Components/UserInfo.vue
+++ b/src/views/repair/tickets/Components/UserInfo.vue
@@ -201,12 +201,12 @@
-
-
- 工单号
-
-
-
+
+
+
+
+
+
时间
@@ -253,7 +253,7 @@
完成
- 结算
+
@@ -444,6 +444,10 @@ export default {
this.createInit()
this.createItemInit()
try {
+ const count = this.handleValidate()
+ if (count > 0){
+ return
+ }
await createTickets(this.formData)
this.$modal.msgSuccess("新增成功")
this.init()
@@ -532,6 +536,7 @@ export default {
},
// 新增子表信息init
createItemInit() {
+ this.formData.itemList = []
// 项目
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("project", this.projectList)]
// 配件
@@ -539,6 +544,29 @@ export default {
// 其他
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("other", this.otherList)]
},
+ // 非空验证
+ handleValidate(){
+ let count = 0
+ this.formData.itemList.forEach(item => {
+ if (count !== 0) return count
+ if (!item.repairIds || !item.saleId){
+ let message = ""
+ switch (item.itemType){
+ case "01":
+ message += "项目:"
+ break
+ case "02":
+ message += "配件:"
+ break
+ case "03":
+ message += "其他:"
+ }
+ this.$modal.msgError(message + item.itemName + (!item.repairIds ? "施工人员" : "销售人员") + "不能为空")
+ count++
+ }
+ })
+ return count
+ },
// 子表信息预处理
formatItem(type, list) {
if (!(list && list.length > 0)) {