duy преди 2 седмици
родител
ревизия
a4ae0d0390
променени са 1 файла, в които са добавени 80 реда и са изтрити 39 реда
  1. 80 39
      src/views/data-fill/collapse-form/index.vue

+ 80 - 39
src/views/data-fill/collapse-form/index.vue

@@ -729,6 +729,33 @@
             </el-form-item>
         </el-form>
     </hc-dialog>
+    <!-- !-- 清除所有数据 - -->
+    <hc-new-dialog v-model="clearShow" title="清除数据" widths="400px" :footer="false">
+        <div class="text-center">
+            <div>
+                <el-button
+                    :loading="clearLoading1"
+                    hc-btn
+                    type="primary"
+                    @click="clearSaveClick(2)"
+                >
+                    清除所有表单的字段数据
+                </el-button>
+            </div>
+            <div class="mt-2">
+                <el-button
+                    :loading="clearLoading2"
+                    color="#419EFF"
+                    hc-btn
+                    style="color:white"
+             
+                    @click="clearSaveClick(1)"
+                >
+                    仅删除当前表单的字段数据
+                </el-button>
+            </div>
+        </div>
+    </hc-new-dialog>
 </template>
 
 <script setup>
@@ -1109,45 +1136,7 @@ const handleMenuSelect = async ({ key }) => {
         formulaModalLoading.value = false
         formulaModal.value = true
     } else if (key === 'clear') {
-        const { pkeyId, index } = tableFormItemNode.value
-        const refs = await getFormRef(pkeyId)
-        await HcDelMsg(async (resolve) => {
-            const { error, code, msg } = await wbsApi.rmTabdataInfo({
-                pkeyId: pkeyId,
-            })
-            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)
-            } else {
-                window.$message.error(msg)
-            }
-            resolve() //关闭弹窗的回调
-        })
+         clearShow.value = true
     } else if (key === 'water') {
         console.log('含水率')
         const { pkeyId } = tableFormItemNode.value
@@ -2406,7 +2395,59 @@ const fileTypeRules = {
     },
   
 }
+//清除所有数据
+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,