Vue+Element UI 弹出文本框

发布时间 2023-03-22 21:08:59作者: 高长缨

效果:

 

代码:

/* 打开审批弹窗*/
    openAudit(row) {
      this.$confirm('请确认审核结果', '审核', {
        distinguishCancelAndClose: true,
        confirmButtonText: '审核通过',
        cancelButtonText: '未通过'
      })
        .then(() => {
          row.auditStatus = '1'
          crudFinanceBudgetManage.audit(row).then(resp => {
            /* 提交后端保存同意结果*/
            this.$message({
              type: 'success',
              message: '已审核通过'
            })
            this.crud.refresh()
          }).catch((action) => {
            console.log(action)
          })
        })
        .catch(action => {
          if (action === 'cancel') {
            this.$prompt('请输入未通过审核意见', '审核未通过', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              inputPattern: /^.{1,100}$/,
              inputErrorMessage: '请输入未通过审核意见'
            }).then(({ value }) => {
              row.auditStatus = '0'
              row.suggestion = value
              crudFinanceBudgetManage.audit(row).then(resp => {
                /* 提交后端保存同意结果*/
                this.$message({
                  type: 'warning',
                  message: '未通过'
                })
                this.crud.refresh()
              }).catch((action) => {
                console.log(action)
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '取消审核'
              })
            })
          } else {
            console.log(action)
          }
        })
    },
View Code