houjie
2023-08-18 22e3a5aeef29150ef81d4d8b4f902c5fc8e2cca8
src/mixins/JeecgListMixin.js
@@ -379,6 +379,157 @@
      let url = getFileAccessHttpUrl(text)
      window.open(url);
    },
    /**
     *  单据批量提交
     */
    handleSubmitBatch: function() {
      if (!this.url.submitBatch) {
        this.$message.error('请设置url.submitBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        let httpurl = this.url.submitBatch
        let method = 'post'
        var params = { ids: ids }
        const that = this
        httpAction(httpurl, params, method).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData()
          } else {
            that.$message.warning(res.message)
          }
        }).finally(() => {
          that.loading = false
        })
      }
    },
    /**
     *  批量撤回已提交的记录
     */
    handleRevocationBatch: function() {
      if (!this.url.revocationBatch) {
        this.$message.error('请设置url.revocationBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        let httpurl = this.url.revocationBatch
        let method = 'post'
        var params = { ids: ids }
        const that = this
        httpAction(httpurl, params, method).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData()
          } else {
            that.$message.warning(res.message)
          }
        }).finally(() => {
          that.loading = false
        })
      }
    },
    /**
     *  单据提交
     */
    handleSubmit: function() {
      if (!this.url.submit) {
        this.$message.error('请设置url.submit属性!')
        return
      }
      if (this.selectedRowKeys.length != 1) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var id = this.selectedRowKeys[0]
        let httpurl = this.url.submit
        let method = 'post'
        var params = { id: id }
        const that = this
        this.$confirm({
          title: '确认提交!',
          okText: '确认',
          cancelText: '取消',
          onOk() {
            httpAction(httpurl, params, method).then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.loadData()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.loading = false
            })
          }
        })
      }
    },
    /**
     *  撤回已提交的记录
     */
    handleRevocation: function() {
      if (!this.url.revocation) {
        this.$message.error('请设置url.revocation属性!')
        return
      }
      if (this.selectedRowKeys.length != 1) {
        this.$message.warning('请选择一条记录!')
        return
      } else {
        var id = this.selectedRowKeys[0]
        let httpurl = this.url.revocation
        let method = 'post'
        var params = { id: id }
        const that = this
        this.$confirm({
          title: '确认撤回!',
          okText: '确认',
          cancelText: '取消',
          onOk() {
            httpAction(httpurl, params, method).then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.loadData()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.loading = false
            })
          }
        })
      }
    }
  }
}