Selaa lähdekoodia

文件上传提示

duy 3 päivää sitten
vanhempi
commit
938c758ebc
1 muutettua tiedostoa jossa 112 lisäystä ja 132 poistoa
  1. 112 132
      src/views/data-fill/collapse-form/index.vue

+ 112 - 132
src/views/data-fill/collapse-form/index.vue

@@ -98,7 +98,7 @@
                                     删除本表
                                 </el-link>
                             </HcTooltip>
-                        
+
                             <el-link
                                 v-if="
                                     treenodeDataInfo?.majorDataType === 8
@@ -112,7 +112,7 @@
                             </el-link>
                             <el-link
                                 v-if="isTemplateType"
-                                
+
                                 type="primary"
                                 @click="autoClick(item)"
                             >
@@ -415,8 +415,8 @@
                     v-model="formDesignModel.direction"
                     size="large"
                 >
-                    <el-radio :value="1">横向</el-radio>
-                    <el-radio :value="2" class="ml-4">纵向</el-radio>
+                    <el-radio :label="1">横向</el-radio>
+                    <el-radio :label="2" class="ml-4">纵向</el-radio>
                 </el-radio-group>
             </el-form-item>
             <el-form-item label="侧表数据">
@@ -510,9 +510,8 @@
             :tree-id="treeId"
             :wbs-id="wbsTemp_id"
             :wbs-type="wbs_type"
-            :table-file-type="fileTypeModal.tableFileType"
         />
-       
+
         <HcTestFileCy
             v-else
             ref="testFileRefsCy"
@@ -522,7 +521,6 @@
             :tree-id="treeId"
             :wbs-id="wbsTemp_id"
             :wbs-type="wbs_type"
-            :table-file-type="fileTypeModal.tableFileType"
         />
     </hc-new-dialog>
 
@@ -663,7 +661,7 @@
                         :key="item.dictKey"
                         :label="item.dictValue"
                         :value="item.dictKey"
-                    />   
+                    />
                 </el-select>
                 <template v-if="isShowNum">
                     <el-input v-model="autoModal.customValue" block placeholder="高程偏差/顶面高差" class="mt-1" />
@@ -679,7 +677,7 @@
         widths="55%"
         save-text="保存"
         title="插入编号"
-       
+
         @close="cancelPushCode"
         @save="submitPushCode"
     >
@@ -721,30 +719,28 @@
         </el-form>
     </hc-new-dialog>
 
-    
+
     <!-- 选择试验附件类型 -->
-    <hc-dialog v-model="fileTypeDialog" title="选择附件类型" :loading="fileTypeLoading" @save="fileTypeSaveClick">
+    <hc-dialog v-model="fileTypeDialog" title="关联试验文件" :loading="fileTypeLoading" @save="fileTypeSaveClick">
         <el-form
-            ref="fileTypeModalRef"
             :model="fileTypeModal"
             label-width="auto"
             size="large"
             label-position="left"
             :rules="fileTypeRules"
         >
-            <el-form-item label="选择附件类型" prop="tableFileType">
-                <el-select v-model="fileTypeModal.tableFileType" block>
+            <el-form-item label="选择附件类型" prop="type">
+                <el-select v-model="fileTypeModal.type" block>
                     <el-option
                         v-for="item in fileType"
                         :key="item.dictKey"
                         :label="item.label" :value="item.value"
-                    />   
+                    />
                 </el-select>
             </el-form-item>
         </el-form>
     </hc-dialog>
-
-    <!-- 清除所有数据 -->
+    <!-- !-- 清除所有数据 - -->
     <hc-new-dialog v-model="clearShow" title="清除数据" widths="400px" :footer="false">
         <div class="text-center">
             <div>
@@ -763,7 +759,7 @@
                     color="#419EFF"
                     hc-btn
                     style="color:white"
-             
+
                     @click="clearSaveClick(1)"
                 >
                     仅删除当前表单的字段数据
@@ -790,7 +786,7 @@
                                 style="width: 120px; display: inline-block" 
                                 placeholder="请输入页码"
                                 type="number"
-                               
+                                min="1"
                                 oninput="value = value > 0 ? parseInt(value) : ''"
                             />
                             <span class="ml-4">页表格</span>
@@ -1026,9 +1022,7 @@ watch(
 
 //渲染完成
 onMounted(() => {
-
-    
-    setFormDataNum(props.datas)
+     setFormDataNum(props.datas)
     setTableFormMenu(useAppState.projectInfo)
     const { offsetHeight } = document.body
     DragModalHeight.value = offsetHeight - 200
@@ -1070,10 +1064,9 @@ const setChangeFormDatas = async (pkeyId, type) => {
 //展开事件
 const ActiveKey = ref('')
 const CollapseChange = (name) => {
- 
-       if (isEnableBulk.value) {
+ if (isEnableBulk.value) {
         setMountOnEventKey()
-    
+
     }
     ActiveKey.value = name
     let index = getCollapseItemIndex(name)
@@ -1132,7 +1125,7 @@ const isOpen = infos['isOpenRandomNumber'] ?? 0
     if (isTemplateType.value) {
         newArr.push({ label: '设置自动获取数据', key: 'auto' })
     }
-    
+
     if (isOpen === 1 && isStatus.value !== 3) {
         newArr.push({ label: '插入设计值/频率', key: 'design' })
     }
@@ -1163,12 +1156,7 @@ const tableFormRightTap = (
     tableFormItemNode.value = { KeyName, index, startPos, endPos, pkeyId }
     contextMenuRef.value?.showMenu(event, false) //展开菜单
 }
-
-const clearShow = ref(false)
-const clearLoading = ref(false)
-//公式参数批量设置
 const checkKeys = ref([])
-
 //鼠标右键菜单被点击
 const handleMenuSelect = async ({ key }) => {
     if (key === 'design') {
@@ -1191,11 +1179,12 @@ const handleMenuSelect = async ({ key }) => {
         //    getIsUseTestTreeCy()
     } else if (key === 'formula') {
         formulaModalLoading.value = false
+        // formulaModal.value = true
         formulaModal.value = true
         const { pkeyId } = tableFormItemNode.value
         const refs = await getFormRef(pkeyId)
         const copyVal = await refs?.getCetCopyKeyList()
-   
+
         checkKeys.value = []
         if (copyVal.length > 0) {
             copyVal.forEach(item=>{
@@ -1203,13 +1192,9 @@ const handleMenuSelect = async ({ key }) => {
 
             })
         }
-   
-        
+
     } else if (key === 'clear') {
-   
-       
-        clearShow.value = true
-      
+         clearShow.value = true
     } else if (key === 'water') {
         console.log('含水率')
         const { pkeyId } = tableFormItemNode.value
@@ -1238,79 +1223,22 @@ const handleMenuSelect = async ({ key }) => {
         refs?.setFormData(curFormData)
     } else if (key === 'auto') {
         console.log('自动获取数据')
-        
-        
+
+
         autoModalDialog.value = true
         isShowNum.value = false
         autoModal.value = {
-            
+
         }
         getMajorDataTypeOptions()
-    } else if (key === 'pushCode') { 
+    } else if (key === 'pushCode') {
         pushCodeShow.value = true
-        
+
     } else if (key === 'deviation') {
          deviationShow.value = true
          getDeviationData()
     }
 }
-const clearLoading1 = ref(false)
-const clearLoading2 = ref(false)
-const clearSaveClick = async (type)=>{
- 
-    const { pkeyId, index } = tableFormItemNode.value
-     const refs = await getFormRef(pkeyId)
-        await HcDelMsg(async (resolve) => {
-            const { error, code, msg } = await wbsApi.rmTabdataInfo({
-                pkeyId: pkeyId,
-                type:type,
-            })
-            if (!error && code === 200) {
-            if (type === 2) {
-                      listDatas.value.forEach((item) => {
-                        item.isTableRender = false
-                    })
-            }
-
-                listDatas.value[index].isTableRender = false
-                if (DragModalTableForm.value.length > 0) {
-                    let draindex = arrIndex(
-                        DragModalTableForm.value,
-                        'pkeyId',
-                        pkeyId,
-                    )
-                    DragModalTableForm.value[draindex].isTableRender = false
-                }
-                await refs?.getTableFormInfo(pkeyId)
-                await nextTick()
-                listDatas.value[index].isTableRender = true
-                listDatas.value[index].isTableForm = true
-                if (DragModalTableForm.value.length > 0) {
-                    let draindex = arrIndex(
-                        DragModalTableForm.value,
-                        'pkeyId',
-                        pkeyId,
-                    )
-                    DragModalTableForm.value[draindex].isTableForm = true
-                    DragModalTableForm.value[draindex].isTableRender = true
-                    listDatas.value[index].isWindow = false
-                    DragModalTableForm.value.splice(draindex, 1)
-                    await refs?.getTableFormInfo(pkeyId)
-                    windowClick(listDatas.value[index], index)
-                }
-                window.$message.success(msg)
-              clearShow.value = false
-
-            } else {
-                window.$message.error(msg)
-                 clearShow.value = false
-            }
-           
-
-            resolve() //关闭弹窗的回调
-        })
-
-}
 
 //插入设计值
 const designModal = ref(false)
@@ -1496,8 +1424,8 @@ const testFileRefs = ref(null)
 const fileModalLoading = ref(false)
 const savefileModal = async () => {
     fileModalLoading.value = true
- 
-  
+
+
     if (!isUseTestTreeCy.value) {
           await testFileRefs.value?.savefileSubmit()
     } else {
@@ -1506,6 +1434,7 @@ const savefileModal = async () => {
     fileModalLoading.value = false
     fileModal.value = false
     fileTypeDialog.value = false
+
 }
 //判断与 是否使用成渝试验树
 const isUseTestTreeCy = ref(false)
@@ -1513,8 +1442,8 @@ const getIsUseTestTreeCy = async ()=>{
      const { error, code, data } = await thirdApi.isCyAndTestModule({
         projectId: projectId.value,
         contractId:   contract_id.value,
- 
-     
+
+
     })
     if (!error && code === 200) {
        isUseTestTreeCy.value = data
@@ -1531,6 +1460,7 @@ const fileModalClose = () => {
 }
 const testFileRefsCy = ref(null)
 
+
 //公式参数配置
 const formulaModal = ref(false)
 const formulaRefs = ref(null)
@@ -1543,7 +1473,7 @@ const formulaSaveClick = async () => {
     const { pkeyId } = tableFormItemNode.value
     const refs = await getFormRef(pkeyId)
 
-    
+
     refs?.clearCheckKeyList()
     formulaModalLoading.value = false
     formulaModal.value = false
@@ -2100,11 +2030,8 @@ const excelTableFormClick = (key) => {
 
 //缓存被激活时
 onActivated(() => {
-
-    
     if (isEnableBulk.value) {
         setMountOnEventKey()
-    
     }
 })
 
@@ -2230,11 +2157,13 @@ const setActiveKey = (key) => {
 }
 //导入模板
 const checkItem = ref({})
+
+
+
+
 const uploadFileDialog = ref(false)
 //打开文件选择框
 const uploadFileClick = (item) => {
-    uploadFileForm.value.pageSize = ''
-
     uploadFileDialog.value = true
     checkItem.value = item
 
@@ -2277,14 +2206,13 @@ const uploadFileClickSave = ()=>{
               renewData()
         },
         error: (file, res) => {
-         
-            const { msg, code } = res
-            if (code === 500) {
+            // window.$message.error('文件上传失败')
+             const { msg, code } = res
+           if (code === 400) {
+             window.$message.error(msg)
+           } else {
                 window.$message.error('文件上传失败')
-            } else if (code === 400) {
-                window.$message.error(msg)
-            }
-           
+           }
         },
     })
 
@@ -2373,7 +2301,7 @@ const dataType = ref([])
 const getMajorDataTypeOptions = async () => {
     const { data } = await getDictionary({ code:'auto_retrieve' })
     dataType.value = data
-   
+
 }
 const isShowNum = ref(false)
 const autoChangeType = (val)=>{
@@ -2411,7 +2339,7 @@ min = values[0]
 max = values[1]
          min = autoModal.value.customValue.split('/')[0]
         max = autoModal.value.customValue.split('/')[1]
-    } 
+    }
 
 
     const { error, code, msg, data } = await nodeBaseApi.getNodeBaseInfoByPkeyId(
@@ -2434,8 +2362,8 @@ max = values[1]
        window.$message?.success(msg || '操作成功')
        autoModalDialog.value = false
 
-    
-    } 
+
+    }
 }
 const autoClick = async (item)=>{
     console.log(item, 'item')
@@ -2457,7 +2385,7 @@ const autoClick = async (item)=>{
         console.log(data, 'data')
         refs?.setFormData(data)
 
-        } 
+        }
     }, 1000)
 }
 //插入编号
@@ -2476,8 +2404,8 @@ const submitPushCode = async ()=>{
             renewData()
             cancelPushCode()
         }
-     
-    
+
+
 }
 const pushCodeRef = ref(null)
 //测量偏差
@@ -2494,7 +2422,7 @@ const getDeviationData = async () => {
         // 从数组中找出k为"g8pcfw"和"g10pcfw"的对象,并提取v值
         const g8pcfwObj = data.find(item => item.k === 'g8pcfw')
         const g10pcfwObj = data.find(item => item.k === 'G10pcfw')
-        
+
         // 将找到的v值赋给deviationModal对应的属性
         deviationModal.value.g8pcfw = g8pcfwObj ? g8pcfwObj.v : ''
         deviationModal.value.g10pcfw = g10pcfwObj ? g10pcfwObj.v : ''
@@ -2503,7 +2431,7 @@ const getDeviationData = async () => {
         deviationModal.value.g8pcfw = ''
         deviationModal.value.g10pcfw = ''
     }
-}  
+}
 const validateDeviation = (rule, value, callback) => {
   if (!value) {
     callback(new Error('请输入偏差值')) // 空值提示
@@ -2537,7 +2465,7 @@ const deviationSaveClick = async ()=>{
             g8pcfw: deviationModal.value.g8pcfw,
             g10pcfw: deviationModal.value.g10pcfw,
             pKeyId: pkeyId,
-           
+
         },
     )
 
@@ -2545,7 +2473,7 @@ const deviationSaveClick = async ()=>{
     if (!error && code === 200) {
        window.$message?.success(msg || '操作成功')
       deviationShow.value = false
-    
+
 }
 }
 
@@ -2557,8 +2485,8 @@ const fileTypeSaveClick = ()=>{
 
 }
 const fileTypeModal = ref({
-    tableFileType: '',
-   
+    type: '',
+
 })
 const fileTypeLoading = ref(false)
 const fileType = ref([])
@@ -2566,14 +2494,66 @@ const getFileType = async ()=>{
       fileType.value = await getDictionaryData('table_file_type', true )
 }
 const fileTypeRules = {
-      tableFileType: {
+      type: {
         required: true,
         trigger: 'blur',
         message: '请选择附件类型',
     },
-  
+
 }
+//清除所有数据
+const clearShow = ref(false)
+const clearLoading1 = ref(false)
+const clearLoading2 = ref(false)
+const clearSaveClick = async (type)=>{
 
+    const { pkeyId, index } = tableFormItemNode.value
+     const refs = await getFormRef(pkeyId)
+        await HcDelMsg(async (resolve) => {
+            const { error, code, msg } = await wbsApi.rmTabdataInfo({
+                pkeyId: pkeyId,
+                type:type,
+            })
+            if (!error && code === 200) {
+                listDatas.value[index].isTableRender = false
+                if (DragModalTableForm.value.length > 0) {
+                    let draindex = arrIndex(
+                        DragModalTableForm.value,
+                        'pkeyId',
+                        pkeyId,
+                    )
+                    DragModalTableForm.value[draindex].isTableRender = false
+                }
+                await refs?.getTableFormInfo(pkeyId)
+                await nextTick()
+                listDatas.value[index].isTableRender = true
+                listDatas.value[index].isTableForm = true
+                if (DragModalTableForm.value.length > 0) {
+                    let draindex = arrIndex(
+                        DragModalTableForm.value,
+                        'pkeyId',
+                        pkeyId,
+                    )
+                    DragModalTableForm.value[draindex].isTableForm = true
+                    DragModalTableForm.value[draindex].isTableRender = true
+                    listDatas.value[index].isWindow = false
+                    DragModalTableForm.value.splice(draindex, 1)
+                    await refs?.getTableFormInfo(pkeyId)
+                    windowClick(listDatas.value[index], index)
+                }
+                window.$message.success(msg)
+              clearShow.value = false
+
+            } else {
+                window.$message.error(msg)
+                 clearShow.value = false
+            }
+
+
+            resolve() //关闭弹窗的回调
+        })
+
+}
 // 暴露出去
 defineExpose({
     getFormData,