소스 검색

巡检路线调整

Zimo 3 주 전
부모
커밋
3dce9583aa
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/views/pms/inspect/route/IotInspectRoute.vue

+ 4 - 2
src/views/pms/inspect/route/IotInspectRoute.vue

@@ -229,8 +229,9 @@ const formRules = reactive({
 
 const formRef = ref() // 表单 Ref
 const inspectItemChoose = (rows) => {
+  debugger
   rows.forEach((it) => {
-    const ifExist = items.value.find((item) => item.id === it.id)
+    const ifExist = items.value.find((item) => item.itemId === it.id)
     if (!ifExist) {
       items.value.push(it)
       console.log(JSON.stringify(it))
@@ -274,7 +275,7 @@ const itemsWithIndex = computed(() => {
 })
 const itemsWithIndexUpdate = computed(() => {
   return items.value.map((item, index) => ({
-    itemId: item.itemId,
+    itemId: item.itemId||item.id,
     item: item.item,
     standard: item.standard,
     index: index + 1 // 序号从1开始
@@ -300,6 +301,7 @@ const submitForm = async () => {
       close()
     } else {
       const newitems = itemsWithIndexUpdate
+      debugger
       formData.value.itemJson = JSON.stringify(newitems.value)
       await IotInspectRouteApi.updateIotInspectRoute(data)
       message.success(t('common.updateSuccess'))