lixiangyu
2 天以前 e461400624e975821edf4684727eeaa7bf8c29c1
src/views/cms/CuttingScrapList.vue
@@ -110,6 +110,11 @@
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item v-if="record.orderStatus != '2'">
                  <a @click="handleSubmit(record.id)" :disabled="record.orderStatus == '3'">提交</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
@@ -137,6 +142,7 @@
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingScrapModal from './modules/CuttingScrapModal'
import CuttingScrapDetailList from './CuttingScrapDetailList'
import { httpAction } from '@api/manage'
export default {
  name: 'CuttingScrapList',
@@ -199,7 +205,7 @@
        {
          title: '报废单状态',
          align: 'center',
          dataIndex: 'orderStatus'
          dataIndex: 'orderStatus_dictText'
        },
        {
          title: '操作',
@@ -251,6 +257,60 @@
      this.$refs.modalForm.title = '详情'
      this.$refs.modalForm.disableSubmit = true
    },
    //  单据提交
    handleSubmit: function(id) {
      if (!this.url.submit) {
        this.$message.error('请设置url.submit属性!')
        return
      }
      let targetId = id // 从参数获取ID
      // 如果没有通过参数传递ID,则检查选中的记录
      if (!targetId) {
        if (this.selectedRowKeys.length != 1) {
          this.$message.warning('请选择一条记录!')
          return
        } else {
          targetId = this.selectedRowKeys[0]
        }
      }
      // 将参数作为查询参数附加到URL上
      let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId)
      let method = 'get'
      var params = {}  // 清空params,因为参数已经在URL中传递
      const that = this
      this.$confirm({
        title: '确认提交!',
        // content: '正在提交数据,请耐心等待...',
        okText: '确认',
        cancelText: '取消',
        onOk() {
          // 显示加载提示
          const hide = that.$message.loading('正在提交数据,请耐心等待...', 0)
          // 发送请求
          return httpAction(httpurl, params, method).then((res) => {
            hide() // 隐藏加载提示
            if (res.success) {
              that.$message.success(res.message)
              that.loadData()
            } else {
              that.$message.warning(res.message)
            }
          }).catch(error => {
            hide() // 隐藏加载提示
            that.$message.error('提交失败: ' + error.message)
          }).finally(() => {
            that.loading = false
          })
        }
      })
    },
    customRow(record) {
      return {
        on: {