AgvTaskCreateModal.vue
7.05 KB
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
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:maskClosable="false"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model">
<!-- 主表单区域 -->
<a-row class="form-row" :gutter="42">
<a-col :lg="14">
<a-form-model-item label="容器编码" :rules="[{ required: true, message: '请输入容器编码!' }]">
<a-input v-model="agvMainModel.containerCode" placeholder="请输入容器编码"></a-input>
</a-form-model-item>
</a-col>
<a-col :lg="14">
<a-form-model-item label="起始工位" :rules="[{ required: true, message: '请输入起始工位!' }]">
<a-input v-model="agvMainModel.fromAgvPortCode" placeholder="请输入起始工位"></a-input>
</a-form-model-item>
</a-col>
<a-col :lg="14">
<a-form-model-item label="目标工位" :rules="[{ required: true, message: '请输入目标工位!' }]">
<a-input v-model="agvMainModel.toAgvPortCode" placeholder="请输入目标工位"></a-input>
</a-form-model-item>
</a-col>
</a-row>
<!-- 子表单区域 -->
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="物料信息" key="1">
<div style="height:350px;overflow-x: hidden;overflow-y:auto">
<a-row type="flex" style="margin-bottom:10px;" :gutter="24">
<a-col :span="5">物料编码</a-col>
<a-col :span="4">物料类别</a-col>
<a-col :span="4">余料类型</a-col>
<a-col :span="6">登记时间</a-col>
<a-col :span="3">数量</a-col>
<a-col :span="2">操作</a-col>
</a-row>
<a-row type="flex" style="margin-bottom:-20px" :gutter="24" v-for="(item, index) in agvMainModel.agvTaskDetailEnityList" :key="index">
<a-col style="display: none">
<a-form-model-item>
<a-input placeholder="id" v-model="item.id"/>
</a-form-model-item>
</a-col>
<a-col :span="5">
<a-form-model-item>
<!-- <j-search-select-tag-->
<!-- placeholder="请选择"-->
<!-- v-model="item.materialCode"-->
<!-- :dict="'material,name,code'"-->
<!-- :pageSize="5"-->
<!-- :async="true">-->
<!-- </j-search-select-tag>-->
<j-popup v-model="item.materialCode" code="getMaterialList" placeholder="请选择" field="code" orgFields="code,type,checkTime" destFields="code,type,checkTime" :multi="false"/>
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item>
<j-dict-select-tag placeholder="请选择物料类别" v-model="item.materialType" dictCode="material_type"/>
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item>
<j-dict-select-tag placeholder="请选择余料类型" v-model="item.surplusType" dictCode="surplus_type"/>
</a-form-model-item>
</a-col>
<a-col :span="6">
<a-form-model-item>
<j-date
:show-time="true"
date-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择登记时间"
class="query-group-cust"
v-model="item.checkTime"
/>
</a-form-model-item>
</a-col>
<a-col :span="3">
<a-form-model-item>
<a-input placeholder="数量" v-model="item.qty"/>
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item>
<a-icon type="minus-circle" @click="delRowCustom(index)" style="fontSize :20px"/>
</a-form-model-item>
</a-col>
</a-row>
<a-button type="dashed" style="width: 100%;margin-top: 10px" @click="addRowCustom"><a-icon type="plus"/>添加物料信息</a-button>
</div>
</a-tab-pane>
</a-tabs>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import {createAgvTask} from '@/api/api'
import JDate from "@comp/jeecg/JDate";
import JEditableTable from "@comp/jeecg/JEditableTable";
import JSelectMultiCanUseContainer from "@comp/jeecgbiz/JSelectMultiCanUseContainer";
export default {
name: "AgvTaskCreateModal",
components: {
JDate, JEditableTable,JSelectMultiCanUseContainer
},
data() {
return {
title: "发送AGV任务",
visible: false,
confirmLoading: false,
model: {},
labelCol: {
xs: {span: 24},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16},
},
activeKey: '1',
agvMainModel: {
agvTaskDetailEnityList: [{}],
},
url: {
add: "/task/agvTask/createAgvTask",
}
}
},
created() {
},
methods: {
handleOk() {
this.validateFields()
},
handleCancel() {
this.visible = false
},
addRowCustom() {
this.agvMainModel.agvTaskDetailEnityList.push({});
this.$forceUpdate();
},
delRowCustom(index) {
console.log(index)
this.agvMainModel.agvTaskDetailEnityList.splice(index, 1);
this.$forceUpdate();
},
addRowTicket() {
this.agvMainModel.jeecgOrderTicketList.push({});
console.log(this.agvMainModel.jeecgOrderTicketList)
this.$forceUpdate();
},
delRowTicket(index) {
console.log(index)
this.agvMainModel.jeecgOrderTicketList.splice(index, 1);
this.$forceUpdate();
},
edit(record) {
this.visible = true
this.activeKey = '1'
this.agvMainModel = Object.assign({
agvTaskDetailEnityList: [{}]
}, record);
},
/** 触发表单验证 */
validateFields() {
// 触发表单验证
this.$refs.form.validate(valid => {
//alert(JSON.stringify(this.quickMainModel));
this.createAgvTask(this.agvMainModel);
})
},
createAgvTask(record) {
this.confirmLoading = true
this.model = Object.assign({}, record);
createAgvTask(this.model).then((res) => {
this.loading = false;
if (res.success) {
this.$message.success(res.message);
this.$emit('ok');
this.visible = false
} else {
this.$message.error(res.message);
}
this.confirmLoading = false
});
},
}
}
</script>