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