Bladeren bron

删除提醒修改

duy 2 jaren geleden
bovenliggende
commit
5b025ee893

+ 15 - 17
src/views/system/components/tab-approve.vue

@@ -64,6 +64,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getApproveList, getParentList, removeDictionary, submitApproveList, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 
 const props = defineProps({
     cur: {
@@ -203,24 +204,21 @@ const contextMenuClick = ({ key, item }) => {
         menuKey.value = item?.id
         priceform.value.dictName = item.dictName
     } else if (key === 'del') {
-        window?.$messageBox?.alert('您确定要删除该预算分类信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
+        delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
                             ids: item?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
+                 })
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getParentListData()
+                } 
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
         })
     }
 }

+ 35 - 36
src/views/system/components/tab-cost.vue

@@ -80,6 +80,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getChildList, getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 
 const props = defineProps({
     cur: {
@@ -148,25 +149,24 @@ const contextMenuClick = ({ key, item }) => {
         priceform.value.sort = item.sort
         priceform.value.dictValue = item.dictValue
     } else if (key === 'del') {
-        window?.$messageBox?.alert('您确定要删除该预算分类信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: item?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
+        delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                    ids: item?.id,
+                })
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getParentListData()
+                } else {
+                    window?.$message?.warning(msg)
                 }
-            },
-        })
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
     }
 }
 
@@ -244,25 +244,24 @@ const testModalClose = () => {
 }
 
 const delTask = (item) => {
-    window?.$messageBox?.alert('您确定要删除该预算科目信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: item?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                    ids: item?.id,
+                })
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getParentListData()
+                } else {
+                    window?.$message?.warning(msg)
                 }
-            },
-        })
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
 }
 
 const tableColumn = [

+ 19 - 19
src/views/system/components/tab-invoice.vue

@@ -31,6 +31,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 const props = defineProps({
     cur: {
         type: [String, Number],
@@ -139,25 +140,24 @@ const savepositionClick = async ()=>{
 
 }
 const delTaskposition = (row) => {
-    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: row?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
-    })
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                        ids: row?.id,
+                    })
+                    if (!error && code === 200) {
+                        window?.$message?.success('删除成功')
+                        getParentListData()
+                    } else {
+                        window?.$message?.warning(msg)
+                    }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+        })
 }
 </script>
 

+ 32 - 37
src/views/system/components/tab-other.vue

@@ -206,6 +206,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getChildList, getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { arrToId, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 
 const props = defineProps({
     cur: {
@@ -349,25 +350,22 @@ const delModal = (item)=>{
     
     const ids = arrToId(rows)
     delbtnloading.value = true
-    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
                             ids: ids || item.id,
-                        })
-                        delbtnloading.value = false
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getTableData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
+                })
+                delbtnloading.value = false
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getTableData()
+                } 
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
         })
 }
 
@@ -496,25 +494,22 @@ const configdelClick = (item)=>{
     const rows = configtableCheckedKeys.value
     const ids = arrToId(rows)
     configdelbtnloading.value = true
-    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: ids || item.id,
-                        })
-                        configdelbtnloading.value = false
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getChildListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                    ids: ids || item.id,
+                })
+                configdelbtnloading.value = false
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getChildListData()
+                } 
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
         })
 }
 </script>

+ 31 - 36
src/views/system/components/tab-price-type.vue

@@ -80,6 +80,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getChildList, getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 
 const props = defineProps({
     cur: {
@@ -148,24 +149,21 @@ const contextMenuClick = ({ key, item }) => {
         priceform.value.dictValue = item.dictValue
         priceform.value.sort = item.sort
     } else if (key === 'del') {
-        window?.$messageBox?.alert('您确定要删除该预算分类信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: item?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
+        delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                    ids: item?.id,
+                })
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getParentListData()
+                } 
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
         })
     }
 }
@@ -244,24 +242,21 @@ const testModalClose = () => {
 }
 
 const delTask = (item) => {
-    window?.$messageBox?.alert('您确定要删除该预算科目信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
-                            ids: item?.id,
-                        })
-                        if (!error && code === 200) {
-                            window?.$message?.success('删除成功')
-                            getParentListData()
-                        } else {
-                            window?.$message?.warning(msg)
-                        }
-                }
-            },
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
+                    ids: item?.id,
+                })
+                if (!error && code === 200) {
+                    window?.$message?.success('删除成功')
+                    getParentListData()
+                } 
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
         })
 }
 

+ 12 - 11
src/views/system/components/tab-price.vue

@@ -35,6 +35,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 const props = defineProps({
     cur: {
         type: [String, Number],
@@ -142,14 +143,11 @@ const savepositionClick = async ()=>{
  
 }
 const delTaskposition = (row) => {
-    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
+
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
                             ids: row?.id,
                         })
                         if (!error && code === 200) {
@@ -158,9 +156,12 @@ const delTaskposition = (row) => {
                         } else {
                             window?.$message?.warning(msg)
                         }
-                }
-            },
-    })
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
 }
 </script>
 

+ 11 - 11
src/views/system/components/tab-reimbursement.vue

@@ -31,6 +31,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 const props = defineProps({
     cur: {
         type: [String, Number],
@@ -141,14 +142,10 @@ const savepositionClick = async ()=>{
 
 }
 const delTaskposition = (row) => {
-    window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
                             ids: row?.id,
                         })
                         if (!error && code === 200) {
@@ -157,9 +154,12 @@ const delTaskposition = (row) => {
                         } else {
                             window?.$message?.warning(msg)
                         }
-                }
-            },
-    })
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
 }
 </script>
 

+ 11 - 11
src/views/system/components/tab-task-type.vue

@@ -41,6 +41,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getParentList, removeDictionary, submitDictionary } from '~api/system/parameter.js'
 import { formValidate, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
 const props = defineProps({
     cur: {
         type: [String, Number],
@@ -154,14 +155,10 @@ const taskTypeModalClose = () => {
 }
 
 const delTasktype = (item) => {
-    window?.$messageBox?.alert('您确定要删除该任务信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
-            showCancelButton: true,
-            confirmButtonText: '确认注销',
-            cancelButtonText: '取消',
-            type: 'warning',
-            callback: async (action) => {
-                if (action === 'confirm') {
-                        const { error, code, msg } = await removeDictionary({
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await removeDictionary({
                             ids: item?.id,
                         })
                         if (!error && code === 200) {
@@ -170,9 +167,12 @@ const delTasktype = (item) => {
                         } else {
                             window?.$message?.warning(msg)
                         }
-                }
-            },
-        })
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
 }
 </script>