Bladeren bron

自动获取数据修改

duy 6 maanden geleden
bovenliggende
commit
b5e2003e86
1 gewijzigde bestanden met toevoegingen van 36 en 41 verwijderingen
  1. 36 41
      src/views/data-fill/collapse-form/index.vue

+ 36 - 41
src/views/data-fill/collapse-form/index.vue

@@ -88,14 +88,14 @@
                             >
                                 评定汇总
                             </el-link>
-                            <el-link
+                            <!-- <el-link
                                 
                                 
                                 type="primary"
-                                @click="autoClick(item)"
+                                @click.stop="autoClick(item, index)"
                             >
                                 自动获取数据
-                            </el-link>
+                            </el-link> -->
                             <HcTooltip keys="wbs_copy_table">
                                 <el-link
                                     v-if="
@@ -935,7 +935,7 @@ const setTableFormMenu = (info) => {
     let newArr = [],
     infos = getObjValue(info)
     const isOpen = infos['isOpenRandomNumber'] ?? 0
-    newArr.push({ label: '设置自动获取数据', key: 'auto' })
+    // newArr.push({ label: '设置自动获取数据', key: 'auto' })
     if (isOpen === 1 && isStatus.value !== 3) {
         newArr.push({ label: '插入设计值/频率', key: 'design' })
     }
@@ -1053,6 +1053,7 @@ const handleMenuSelect = async ({ key }) => {
         
         
         autoModalDialog.value = true
+        isShowNum.value = false
         autoModal.value = {
             
         }
@@ -1983,24 +1984,6 @@ const getdownloadExcel = async (pKeyId) => {
 //下载模板
 const downModal = (item) => {
     const { pkeyId } = item
-    // if (isStatus.value === 3) {
-    //     window?.$messageBox?.alert('是否选择把数据一起导出?', '下载模板', {
-    //         showCancelButton: true,
-    //         confirmButtonText: '是',
-    //         cancelButtonText: '否',
-    //         callback: (action) => {
-    //             if (action === 'confirm') {
-    //                 console.log('数据')
-    //             } else if ( action === 'cancel') {
-    //                 console.log('清表')
-    //                 getdownloadExcel(pkeyId)
-    //             }
-    //         },
-    //     })
-    // } else {
-    //     console.log('清表')
-    //     getdownloadExcel(pkeyId)
-    // }
     getdownloadExcel(pkeyId)
 }
 
@@ -2099,6 +2082,23 @@ const autoSaveClick = async ()=>{
         return
     }
     if (autoModal.value.type === '8' && autoModal.value?.customValue.length > 0) {
+const values = autoModal.value.customValue.split('/')
+// 检查格式是否为 数字/数字
+if (values.length !== 2) {
+    window.$message?.error('请输入正确格式的高程偏差/顶面高差')
+    return
+}
+
+// 检查两个值是否都是合法数字
+const isValidNumber = (num) => !isNaN(num) && num.toString().trim().length > 0
+
+if (!isValidNumber(values[0]) || !isValidNumber(values[1])) {
+    window.$message?.error('请输入正确的数字格式')
+    return
+}
+
+min = values[0]
+max = values[1]
          min = autoModal.value.customValue.split('/')[0]
         max = autoModal.value.customValue.split('/')[1]
     } 
@@ -2126,26 +2126,21 @@ const autoSaveClick = async ()=>{
     
     } 
 }
-const autoClick = async (item)=>{
+const autoClick = async (item, index)=>{
     const { pkeyId } = item
-    const refs = await getFormRef(pkeyId)
-    const { error, code, msg, data } = await nodeBaseApi.getAllNodeBaseInfoByPkeyId(
-        {
-        nodeId: treeId.value,
-        pkeyId: pkeyId,
-        },
-)
-
-
-if (!error && code === 200) {
-console.log(data, 'data')
-// itemFormData[KeyName] = data
-refs?.setFormData(data)
-// window.$message?.success(msg || '操作成功')
-// autoModalDialog.value = false
-
-
-} 
+    CollapseChange(`item-${index}-${pkeyId}`)
+    setTimeout(async () => {
+        const refs = await getFormRef(pkeyId)
+        const { error, code, msg, data } = await nodeBaseApi.getAllNodeBaseInfoByPkeyId(
+                {
+                nodeId: treeId.value,
+                pkeyId: pkeyId,
+                },
+        )
+        if (!error && code === 200) {
+        refs?.setFormData(data)
+        } 
+    }, 1000)
 }
 
 // 暴露出去