notMutexOrder.vue 3.73 KB
Newer Older
dcy's avatar
dcy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
<template>
  <div class="add-associated-order">
    <h1 class="title">订单号:{{ orderDetails.orderNo }} 选择订单</h1>
    <el-divider></el-divider>
    <el-form inline label-width="85px" label-position="left">
      <el-form-item label="订单号">
        <div class="content">
          <el-input v-model="mutualOrderId"></el-input>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button @click="getUnassociatedOrder">查询</el-button>
      </el-form-item>
    </el-form>
    <h1 class="title">
      未加入关联订单列表
    </h1>
    <el-divider></el-divider>
    <el-table :data="list" @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55"
      ></el-table-column>
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column label="订单号" prop="orderNo"></el-table-column>
      <el-table-column label="唛头" prop="marks"></el-table-column>
      <el-table-column label="货物数据"></el-table-column>
      <el-table-column label="入仓时间" prop="rucangtime"></el-table-column>
      <el-table-column label="状态">
        <template v-slot:default="scope">
          <dict-tag :value="scope.row.status" :type="DICT_TYPE.ORDER_STATUS"></dict-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作人"></el-table-column>
      <el-table-column label="操作时间"></el-table-column>
      <el-table-column label="操作">
        <template v-slot:default="scope">
          <el-button type="text" size="mini" @click="joinAssociation(scope.row.orderId)">加入互斥</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-row style="margin-top: 40px">
      <el-col>
        <el-button type="primary" @click="batchJoin(multipleSelection.map(e => e.orderId))"
                   :disabled="multipleSelection.length === 0">
          批量加入互斥
        </el-button>
        <el-button @click="$router.push('/order/mutex-order/'+ orderId);">
          取消
        </el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
//添加关联订单
import {getOrder} from "@/api/ecw/order";
import Template from "@/views/cms/template";
import {getUnGuanlianOrderByOrderId, guanlianCreate, ordeRcreateBatch} from "@/api/ecw/mutexOrder";

export default {
  name: "notMutexOrder",
  components: {Template},
  props: {
    orderId: [String, Number]
  },
  data() {
    return {
      orderDetails: {},
      mutualOrderId: '',
      list: [],
      multipleSelection: [],
    }
  },
  created() {
    getOrder(this.orderId).then(r => {
      if (r.code === 0) {
        this.orderDetails = r.data;
      }
    })
    this.getUnassociatedOrder();
  },
  mounted() {
  },
  methods: {
    getUnassociatedOrder() {
      getUnGuanlianOrderByOrderId({
        orderId: this.orderId,
        mutualOrderId: this.mutualOrderId ? this.mutualOrderId : 0
      }).then(r => {
        if (r.code === 0) {
          this.list = r.data
        }
      })
    },
    joinAssociation(val) {
      guanlianCreate({orderId: this.orderId, mutualOrderId: val}).then(this.operation)
    },
    batchJoin(val) {
      let p = val.map(e => ({orderId:this.orderId,mutualOrderId:e}))
      ordeRcreateBatch(p).then(this.operation)
    },
    operation(r) {
      if (r.code === 0) {
        this.$message.success('操作成功')
        this.getUnassociatedOrder();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  }
}
</script>

<style scoped lang="scss">
.add-associated-order {
  padding: 20px;
  box-sizing: border-box;

  .title {
    font-size: 30px;
    font-weight: 600;
    text-align: left;
  }

  .el-form {
    .content {
      width: 300px;
    }
  }
}
</style>