瀏覽代碼

设置confirm默认样式

zhengnaiwen_citu 6 月之前
父節點
當前提交
d6ea23aae8

+ 9 - 0
src/main.js

@@ -17,9 +17,18 @@ import './autoComponents'
 // 引入自定义指令
 import Directives from './directives/index.js'
 import 'scrolling-element'
+
 // import '@babel/polyfill'
 require('@babel/polyfill')
 
+// 修改 MessageBox 的默认配置
+ElementUI.MessageBox.setDefaults({
+  confirmButtonText: '确定',
+  cancelButtonText: '取消',
+  type: 'warning',
+  confirmButtonClass: 'el-button--orange'
+})
+
 promise.polyfill()
 
 Vue.use(ElementUI)

+ 2 - 10
src/views/bonus/allocation/index.vue

@@ -193,11 +193,7 @@ export default {
             h('p', undefined, '当前非完全配额,是否强制提交?'),
             ..._el
           ])
-          this.$confirm(el, '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
+          this.$confirm(el, '提示').then(() => {
             this.onSaveAll(true)
           }).catch(_ => {})
           return
@@ -206,11 +202,7 @@ export default {
           h('p', undefined, '确定提交所有数据?'),
           ..._el
         ])
-        this.$confirm(el, '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
+        this.$confirm(el, '提示').then(() => {
           this.onSaveAll(false)
         }).catch(_ => {})
       } catch (error) {

+ 2 - 10
src/views/bonus/approve/approveDetails.vue

@@ -69,11 +69,7 @@ export default {
       })
     },
     onResolve () {
-      this.$confirm('是否确定通过?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm('是否确定通过?', '提示').then(async () => {
         try {
           await saveBonusApproveConfirmation({
             employeePerformanceConfirmationId: this.item.employeePerformanceConfirmationId,
@@ -92,11 +88,7 @@ export default {
         this.$message.error('请输入拒绝原因')
         return
       }
-      this.$confirm('是否确定拒绝?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm('是否确定拒绝?', '提示').then(async () => {
         try {
           await saveBonusApproveConfirmation({
             employeePerformanceConfirmationId: this.item.employeePerformanceConfirmationId,

+ 1 - 6
src/views/humanResources/organizationStructure/index.vue

@@ -278,12 +278,7 @@ export default {
       })
     },
     async onDelete (nodes) {
-      this.$confirm('是否删除该项', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-        confirmButtonClass: 'el-button--orange'
-      }).then(async () => {
+      this.$confirm('是否删除该项', '提示').then(async () => {
         try {
           await deleteOrganization({
             organizationNo: nodes.id

+ 1 - 5
src/views/humanResources/roster/index.vue

@@ -190,11 +190,7 @@ export default {
       this.$refs.rosterEditRef.open(item)
     },
     onDelete (item) {
-      this.$confirm('确定删除该员工吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm('确定删除该员工吗?', '提示').then(async () => {
         try {
           await deleteRoster({ personnelCode: item.personnelCode })
           this.init()

+ 1 - 5
src/views/humanResources/welfare/welfareList/index.vue

@@ -51,11 +51,7 @@ export default {
       this.$refs.welfareRulesRefs.open(item)
     },
     onDelete (item) {
-      this.$confirm(`确定删除${item.subsidyName}吗?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm(`确定删除${item.subsidyName}吗?`, '提示').then(async () => {
         try {
           await deleteWelfare({ subsidyId: item.subsidyId })
           this.$message.success('删除成功')

+ 1 - 5
src/views/salary/calculate/salaryCalculateUpload/index.vue

@@ -195,11 +195,7 @@ export default {
         h('p', undefined, `更新月份:${this.queryValues.month}`),
         h('p', undefined, `更新物业线:${this.queryValues.category}`),
         h('p', { style: 'color: red' }, '上传文件后,将覆盖之前的文件,请谨慎操作!')
-      ]), '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      ]), '提示').then(async () => {
         this.submitLoading = true
         try {
           const formData = new FormData()

+ 1 - 5
src/views/salary/comparison/salaryEmployeeComparison/index.vue

@@ -206,11 +206,7 @@ export default {
       this.$confirm(h('div', null, [
         h('p', undefined, '确认后将无法修改,是否确认?'),
         h('p', { style: 'color: #ff5555' }, '注:版本确认之后所有人将同步使用当前选择的版本')
-      ]), '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      ]), '提示').then(async () => {
         try {
           await confirmComparisonVersion({
             employeePerformanceConfirmation: {

+ 1 - 5
src/views/salary/solution/salarySolution/index.vue

@@ -54,11 +54,7 @@ export default {
       this.$refs.salarySolutionRulesRefs.open(item)
     },
     onDelete (item) {
-      this.$confirm(`确定删除${item.title}吗?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm(`确定删除${item.title}吗?`, '提示').then(async () => {
         try {
           await deleteSolution({ performanceSolutionId: item.performanceSolutionId })
           this.$message.success('删除成功')

+ 1 - 5
src/views/salary/solution/salarySolutionParameter/index.vue

@@ -116,11 +116,7 @@ export default {
       }
     },
     onDelete (item) {
-      this.$confirm('确定删除该配置吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm('确定删除该配置吗?', '提示').then(async () => {
         try {
           await deleteConfig(item.calculateConfigurationId)
           this.$message.success('删除成功')

+ 1 - 5
src/views/system/menu/index.vue

@@ -152,11 +152,7 @@ export default {
       }
     },
     onDelete (item) {
-      this.$confirm(`是否确定删除该选项 ${item.label} 包括所以子项`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
+      this.$confirm(`是否确定删除该选项 ${item.label} 包括所以子项`, '提示')
         .then(async () => {
           try {
             await this.$store.dispatch('menu/deleteMenu', { id: item.id })

+ 1 - 5
src/views/system/role/index.vue

@@ -135,11 +135,7 @@ export default {
       this.$refs.dataRefs.open(data)
     },
     onDelete (item) {
-      this.$confirm('是否确定删除该选项', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
+      this.$confirm('是否确定删除该选项', '提示').then(async () => {
         try {
           await deleteRole({ id: item.id })
           this.$message.success('删除成功')

+ 1 - 5
src/views/system/safety/index.vue

@@ -91,11 +91,7 @@ export default {
         if (!valid) {
           return
         }
-        this.$confirm('确定修改密码吗?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(async () => {
+        this.$confirm('确定修改密码吗?', '提示').then(async () => {
           const { renewPwd, ...obj } = this.formValue
           try {
             await resetPassword({ ...obj, type: 2 })

+ 1 - 5
src/views/system/user/index.vue

@@ -164,11 +164,7 @@ export default {
       this.$refs.userReset.open(item)
     },
     onDelete (item) {
-      this.$confirm('是否确定删除该选项', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
+      this.$confirm('是否确定删除该选项', '提示')
         .then(async () => {
           try {
             await deleteUser({ userId: item.id })