lipenghui hace 2 meses
padre
commit
ebc48273a9
Se han modificado 1 ficheros con 12 adiciones y 4 borrados
  1. 12 4
      src/views/pms/inspect/route/IotInspectRoute.vue

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

@@ -226,7 +226,6 @@ const close = () => {
   })
 }
 const itemsWithIndex = computed(() => {
-  debugger
   return items.value.map((item, index) => ({
     itemId: item.id,
     item: item.item,
@@ -234,6 +233,14 @@ const itemsWithIndex = computed(() => {
     index: index + 1 // 序号从1开始
   }))
 })
+const itemsWithIndexUpdate = computed(() => {
+  return items.value.map((item, index) => ({
+    itemId: item.itemId,
+    item: item.item,
+    standard: item.standard,
+    index: index + 1 // 序号从1开始
+  }))
+})
 const { wsCache } = useCache()
 /** 提交表单 */
 const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
@@ -244,17 +251,18 @@ const submitForm = async () => {
   // 提交请求
   formLoading.value = true
   try {
-    const newitems = itemsWithIndex
-    debugger
-    formData.value.itemJson = JSON.stringify(newitems.value)
     // const user = wsCache.get(CACHE_KEY.USER)
     // formData.value.deptId = user.user.deptId
     const data = formData.value as unknown as IotInspectRouteVO
     if (formType.value === 'create') {
+      const newitems = itemsWithIndex
+      formData.value.itemJson = JSON.stringify(newitems.value)
       await IotInspectRouteApi.createIotInspectRoute(data)
       message.success(t('common.createSuccess'))
       close()
     } else {
+      const newitems = itemsWithIndexUpdate
+      formData.value.itemJson = JSON.stringify(newitems.value)
       await IotInspectRouteApi.updateIotInspectRoute(data)
       message.success(t('common.updateSuccess'))
       close()