1
hutongqing
2025-01-08 413f243b73ef073f4ac83889fda2f5bf6d1e727c
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<template>
  <div>
    <vol-box
      v-model="showDetialBox"
      :lazy="true"
      width="1200px"
      :padding="15"
      title="任务详情"
    >
      <el-row height="50">
        <el-col :span="24">
          <div class="grid-content right-text">
            <el-link type="primary" @click="switchView" v-if="false">切换视图</el-link>
          </div>
        </el-col>
      </el-row>
      <div :style="{ height: height }">
        <div v-if="viewType == 1">
          <el-row height="50">
            <el-col :span="8">
              <div
                class="grid-content content-text"
                style="font-weight: bold; font-size: 18px"
              >
                <span>任务编号:{{ row.taskNum }}</span>
              </div>
            </el-col>
            <el-col :span="8">
              <div
                class="grid-content content-text"
                style="font-weight: bold; font-size: 18px"
              >
                <span>托盘编号:{{ row.palletCode }}</span>
              </div>
            </el-col>
            <el-col :span="8">
              <div
                class="grid-content content-text"
                style="font-weight: bold; font-size: 18px"
              >
                <span>任务状态:{{ row.taskState }}</span>
              </div>
            </el-col>
          </el-row>
          <div style="height: 100px; margin-top: 3%">
            <el-steps :active="active" align-center finish-status="success">
              <el-step
                v-for="item in steps"
                :key="item.title"
                :title="item.title"
                :description="item.description"
              ></el-step>
            </el-steps>
          </div>
          <el-row height="50" v-show="previousShow || nextShow">
            <el-col :span="8">
              <div v-show="previousShow" class="grid-content content-text">
                <el-button type="danger" @click="previous"
                  >回滚到上一步</el-button
                >
              </div>
            </el-col>
            <el-col :span="8">
              <div v-show="recoveryShow" class="grid-content content-text">
                <el-button type="primary" @click="recovery">任务挂起恢复</el-button>
              </div>
            </el-col>
            <el-col :span="8">
              <div v-show="nextShow" class="grid-content content-text">
                <el-button type="warning" @click="next">跳转到下一步</el-button>
              </div>
            </el-col>
          </el-row>
        </div>
        <div v-else>
          <el-table
            :data="tableData"
            style="width: 100%"
            :row-class-name="tableRowClassName"
          >
            <el-table-column type="index" width="50"> </el-table-column>
            <el-table-column prop="taskNum" label="任务号" width="90">
            </el-table-column>
            <el-table-column prop="taskState" label="任务状态" width="90">
            </el-table-column>
            <el-table-column prop="currentAddress" label="当前位置" width="90">
            </el-table-column>
            <el-table-column prop="nextAddress" label="下一位置" width="90">
            </el-table-column>
            <el-table-column prop="isManual" label="是否人工操作" width="120">
            </el-table-column>
            <el-table-column prop="isNormal" label="是否正常" width="90">
            </el-table-column>
            <el-table-column prop="description" label="描述"> </el-table-column>
            <el-table-column prop="createDate" label="创建时间" width="180">
            </el-table-column>
            <el-table-column prop="remark" label="备注" width="180">
            </el-table-column>
          </el-table>
        </div>
      </div>
    </vol-box>
  </div>
</template>
 
<script>
import VolBox from "@/components/basic/VolBox.vue";
export default {
  components: { VolBox },
  data() {
    return {
      active: 0,
      showDetialBox: false,
      row: {},
      steps: [],
      viewType: 2,
      height: "200px",
      tableData: [],
      previousShow: false,
      nextShow: false,
      recoveryShow: true,
    };
  },
  methods: {
    open(row) {
      this.row = row;
      this.showDetialBox = true;
      if (this.viewType == 1) {
        this.getSteps();
      } else {
        this.getDetailDatas();
      }
 
      this.$emit("parentCall", ($vue) => {
        var previousButton = $vue.buttons.find((x) => x.value == "Previous");
        this.previousShow = previousButton != null;
 
        var nextButton = $vue.buttons.find((x) => x.value == "Next");
        this.nextShow = nextButton != null;
      });
    },
    getSteps() {
      this.http
        .post(
          "/api/TaskExecuteDetail/GetDetailInfo?taskNum=" + this.row.taskNum,
          {},
          true
        )
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.steps = x.data.list;
          this.active = x.data.active;
        });
    },
    getDetailDatas() {
      this.http
        .post(
          "/api/TaskExecuteDetail/GetDetailDatas?taskNum=" + this.row.taskNum,
          {},
          true
        )
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.tableData = x.data;
        });
    },
    previous() {
      this.http
        .post(
          "/api/Task/RollbackTaskStatusToLast?taskNum=" + this.row.taskNum,
          {},
          true
        )
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
          this.getSteps();
        });
    },
    recovery(){
      this.http
        .post(
          "/api/Task/TaskStatusRecovery?taskNum=" + this.row.taskNum,
          {},
          true
        )
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
          this.getSteps();
        });
    },
    next() {
      this.http
        .post(
          "/api/Task/UpdateTaskStatusToNext?taskNum=" + this.row.taskNum,
          {},
          true
        )
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
          this.getSteps();
        });
    },
    switchView() {
      this.viewType = this.viewType == 1 ? 2 : 1;
      if (this.viewType == 2) {
        this.height = "600px";
        this.getDetailDatas();
      } else {
        this.height = "200px";
      }
    },
    tableRowClassName({ row, rowIndex }) {
      if (!row.isNormal) {
        return "error-row";
      } else if (row.isManual) {
        return "warning-row";
      }
      return "success-row";
    },
  },
  created() {},
};
</script>
 
<style scoped>
.el-col {
  border-radius: 4px;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.content-text {
  display: flex;
  align-items: center;
  justify-content: center;
}
.right-text {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
</style>
<style>
.el-table .warning-row {
  background: #fcf1e2;
}
 
.el-table .success-row {
  background: #f0f9eb;
}
 
.el-table .error-row {
  background: #fde2e2;
}
</style>