zenglf
2023-09-18 92ff846fb659c62037a32b1d8c15eae9df9d9b54
src/mixins/JeecgListMixin.js
@@ -4,7 +4,7 @@
 * data中url定义 list为查询列表  delete为删除单条记录  deleteBatch为批量删除
 */
import { filterObj } from '@/utils/util';
import { deleteAction, getAction,downFile,getFileAccessHttpUrl } from '@/api/manage'
import { deleteAction, getAction, downFile, getFileAccessHttpUrl, httpAction } from '@/api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
import store from '@/store'
@@ -403,6 +403,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
            })
          }
        })
      }
    }
  }
}