jesting0
2022-04-06 4a0fb138f5670809507c6483074622630e59eef3
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<template>
  <Modal
    :value="visible"
    title="订单管理"
    draggable
    sticky
    :mask="false"
    @on-visible-change="visibleChange"
    :footer-hide="true"
    :width="600"
  >
    <div class="order">
      <section>
        <div class="title">详情</div>
        <div class="line">
          <div class="width-50">订单名:{{ order.name }}</div>
          <div class="width-50">优先级:1</div>
        </div>
        <div class="line">
          <div class="width-50">发起方:OMI</div>
          <div class="width-50">订单状态:{{ order.state }}</div>
        </div>
        <div class="line">
          <div class="width-50">AGV:[{{ order.processingVehicle }}]</div>
          <div class="width-50">当前目的地:{{ order.destinations }}</div>
        </div>
        <div class="line">
          <div class="width-50">创建时间:2021-11-01 00:00:00</div>
          <div class="width-50">完成时间:2021-11-01 00:00:00</div>
        </div>
        <div class="line">
          <div class="width-50">订单ID:0000</div>
          <div class="width-50">截止时间:2021-11-01 00:00:00</div>
        </div>
        <div class="line">
          <div class="width-50">TS ID:atob</div>
          <div class="width-50">参数:{}</div>
        </div>
        <div class="line">
          <div class="width-50">命令:manually_finish_order</div>
          <div class="width-50">当前任务:</div>
        </div>
        <div class="line">
          <div class="width-50">当前Operation:</div>
          <div class="width-50">当前OMI:</div>
        </div>
        <div class="line">
          <div class="width-50">执行时间:</div>
          <div class="width-50">响应时间跨度:</div>
        </div>
      </section>
      <section>
        <div class="title">操作</div>
        <div class="btns" @click="cancel">
          <div class="btn">取消订单</div>
        </div>
      </section>
    </div>
  </Modal>
</template>
 
<script>
import { webConfig, checkAdmin } from "@/utils";
import HttpRequest from "@/api/request.js";
export default {
  name: "MonitorModalOrder",
  model: {
    prop: "visible",
    event: "visible-change",
  },
  props: {
    visible: Boolean,
    selectedOrderName: String,
  },
  data() {
    return {
      httpRequest: new HttpRequest(webConfig.apiUrl),
      order: {
        name: "",
        type: "",
        state: "",
        intendedVehicle: "",
        processingVehicle: "",
        destinations: "",
      },
      isAdmin: checkAdmin(),
    };
  },
  methods: {
    visibleChange(value) {
      this.$emit("visible-change", value);
    },
    cancel() {
      if (!this.isAdmin) return;
      this.httpRequest
        .post(`transportOrders/withdrawalOrder/${this.selectedOrderName}/true`)
        .then(() => {
          this.$Message.success("操作成功");
        })
        .catch((err) => {
          this.$Message.error({ content: err, duration: 10 });
        });
    },
    reset() {
      this.order.name = "";
      this.order.type = "";
      this.order.state = "";
      this.order.intendedVehicle = "";
      this.order.processingVehicle = "";
      this.order.destinations = [];
    },
  },
  watch: {
    selectedOrderName(name) {
      if (name) {
        this.reset();
        this.httpRequest
          .get(`transportOrders/${name}`)
          .then((res) => {
            this.order.name = res.name;
            this.order.type = res.type;
            this.order.state = res.state;
            this.order.intendedVehicle = res.intendedVehicle;
            this.order.processingVehicle = res.processingVehicle;
            this.order.destinations = res.destinations;
          })
          .catch((err) => {
            this.$Message.error({ content: err, duration: 10 });
          });
      }
    },
  },
};
</script>
 
<style lang="less" scoped>
.order {
  section {
    margin-bottom: 9px;
    .title {
      padding-left: 9px;
      border-left: 3px solid #57a3f3;
      height: 28px;
      line-height: 28px;
      font-size: 16px;
      margin-bottom: 9px;
    }
    .line {
      line-height: 30px;
      padding: 0 6px;
      &:after {
        content: "";
        display: table;
        clear: both;
      }
      &:nth-child(2n) {
        background-color: #dbecff;
      }
      .width-50 {
        width: 50%;
        float: left;
      }
    }
    .btns {
      &:after {
        content: "";
        display: table;
        clear: both;
      }
      .btn {
        width: 160px;
        background-color: #7691aa;
        color: #ffffff;
        margin-right: 20px;
        margin-bottom: 9px;
        line-height: 30px;
        text-align: center;
        border-radius: 3px;
        float: left;
        cursor: pointer;
        &:hover {
          background-color: #51687e;
        }
      }
    }
  }
}
</style>