Showing
2 changed files
with
37 additions
and
77 deletions
@@ -99,6 +99,14 @@ export function addSortingStation(query) { | @@ -99,6 +99,14 @@ export function addSortingStation(query) { | ||
99 | }); | 99 | }); |
100 | } | 100 | } |
101 | 101 | ||
102 | +export function addScanItem(query) { | ||
103 | + return request({ | ||
104 | + url: "/scanItem", | ||
105 | + method: "POST", | ||
106 | + data: query, | ||
107 | + }); | ||
108 | +} | ||
109 | + | ||
102 | export function editScanSpec(query) { | 110 | export function editScanSpec(query) { |
103 | return request({ | 111 | return request({ |
104 | url: "/scanSpec", | 112 | url: "/scanSpec", |
@@ -91,6 +91,11 @@ | @@ -91,6 +91,11 @@ | ||
91 | > | 91 | > |
92 | <el-row :gutter="10" class="mb8"> | 92 | <el-row :gutter="10" class="mb8"> |
93 | <el-col :span="1.5"> | 93 | <el-col :span="1.5"> |
94 | + <el-button type="primary" plain icon="Plus" @click="addTask" | ||
95 | + >新增</el-button | ||
96 | + > | ||
97 | + </el-col> | ||
98 | + <el-col :span="1.5"> | ||
94 | <el-button | 99 | <el-button |
95 | type="primary" | 100 | type="primary" |
96 | plain | 101 | plain |
@@ -175,52 +180,16 @@ | @@ -175,52 +180,16 @@ | ||
175 | <el-form :model="form" :rules="rules" ref="userRef" label-width="120px"> | 180 | <el-form :model="form" :rules="rules" ref="userRef" label-width="120px"> |
176 | <el-row> | 181 | <el-row> |
177 | <el-col :span="24"> | 182 | <el-col :span="24"> |
178 | - <el-form-item label="Type" prop="type"> | ||
179 | - <el-input v-model="form.type" placeholder="Please enter type" /> | ||
180 | - </el-form-item> | ||
181 | - </el-col> | ||
182 | - <el-col :span="24"> | ||
183 | - <el-form-item label="Trans" prop="trans"> | ||
184 | - <el-input v-model="form.trans" placeholder="Please enter trans" /> | ||
185 | - </el-form-item> | ||
186 | - </el-col> | ||
187 | - <el-col :span="24"> | ||
188 | - <el-form-item label="Contract No" prop="contractNo"> | ||
189 | - <el-input | ||
190 | - v-model="form.contractNo" | ||
191 | - placeholder="Please enter contractNo" | ||
192 | - /> | ||
193 | - </el-form-item> | ||
194 | - </el-col> | ||
195 | - <el-col :span="24"> | ||
196 | - <el-form-item label="Del" prop="del"> | ||
197 | - <el-input v-model="form.del" placeholder="Please enter del" /> | ||
198 | - </el-form-item> | ||
199 | - </el-col> | ||
200 | - | ||
201 | - <el-col :span="24"> | ||
202 | - <el-form-item label="EX-Fact" prop="exFact"> | ||
203 | - <el-input | ||
204 | - v-model="form.exFact" | ||
205 | - placeholder="Please enter exFact" | ||
206 | - /> | ||
207 | - </el-form-item> | ||
208 | - </el-col> | ||
209 | - | ||
210 | - <el-col :span="24"> | ||
211 | - <el-form-item label="Quantity" prop="quantity"> | ||
212 | - <el-input | ||
213 | - v-model="form.quantity" | ||
214 | - placeholder="Please enter quantity" | ||
215 | - /> | 183 | + <el-form-item label="串码" prop="barcode"> |
184 | + <el-input v-model="form.barcode" placeholder="请输入串码" /> | ||
216 | </el-form-item> | 185 | </el-form-item> |
217 | </el-col> | 186 | </el-col> |
218 | </el-row> | 187 | </el-row> |
219 | </el-form> | 188 | </el-form> |
220 | <template #footer> | 189 | <template #footer> |
221 | <div class="dialog-footer"> | 190 | <div class="dialog-footer"> |
222 | - <el-button type="primary" @click="submitForm">Confirm</el-button> | ||
223 | - <el-button @click="() => (open = false)">Cancel</el-button> | 191 | + <el-button type="primary" :loading="isLoading" @click="submitForm">确认</el-button> |
192 | + <el-button @click="() => (open = false)">取消</el-button> | ||
224 | </div> | 193 | </div> |
225 | </template> | 194 | </template> |
226 | </el-dialog> | 195 | </el-dialog> |
@@ -274,7 +243,7 @@ import { getToken } from "@/utils/auth"; | @@ -274,7 +243,7 @@ import { getToken } from "@/utils/auth"; | ||
274 | import { formatDate } from "@/utils/index"; | 243 | import { formatDate } from "@/utils/index"; |
275 | 244 | ||
276 | import { onMounted, ref } from "vue"; | 245 | import { onMounted, ref } from "vue"; |
277 | -import { addScanOrder, scanTaskdetal, scanTaskQueryList, } from "@/api/system/scan"; | 246 | +import { addScanItem, scanTaskdetal, scanTaskQueryList, } from "@/api/system/scan"; |
278 | 247 | ||
279 | const router = useRouter(); | 248 | const router = useRouter(); |
280 | const route = useRoute(); | 249 | const route = useRoute(); |
@@ -346,32 +315,7 @@ const data = reactive({ | @@ -346,32 +315,7 @@ const data = reactive({ | ||
346 | scanTaskId: route.query.scanTaskId | 315 | scanTaskId: route.query.scanTaskId |
347 | }, | 316 | }, |
348 | rules: { | 317 | rules: { |
349 | - type: [{ required: true, message: "Type is required", trigger: "blur" }], | ||
350 | - trans: [{ required: true, message: "Trans is required", trigger: "blur" }], | ||
351 | - contractNo: [ | ||
352 | - { required: true, message: "Contract No is required", trigger: "blur" }, | ||
353 | - ], | ||
354 | - del: [ | ||
355 | - { | ||
356 | - required: true, | ||
357 | - message: "Del is required", | ||
358 | - trigger: "blur", | ||
359 | - }, | ||
360 | - ], | ||
361 | - exFact: [ | ||
362 | - { | ||
363 | - required: true, | ||
364 | - message: "EX-Fact is required", | ||
365 | - trigger: "blur", | ||
366 | - }, | ||
367 | - ], | ||
368 | - quantity: [ | ||
369 | - { | ||
370 | - required: true, | ||
371 | - message: "Quantity is required", | ||
372 | - trigger: "blur", | ||
373 | - }, | ||
374 | - ], | 318 | + barcode: [{ required: true, message: "请输入串码", trigger: "blur" }], |
375 | }, | 319 | }, |
376 | }); | 320 | }); |
377 | 321 | ||
@@ -379,19 +323,32 @@ const { queryParams, form, rules } = toRefs(data); | @@ -379,19 +323,32 @@ const { queryParams, form, rules } = toRefs(data); | ||
379 | 323 | ||
380 | const open = ref(false); | 324 | const open = ref(false); |
381 | const title = ref(""); | 325 | const title = ref(""); |
382 | - | 326 | +const isLoading = ref(false) |
383 | function submitForm() { | 327 | function submitForm() { |
384 | proxy.$refs["userRef"].validate((valid) => { | 328 | proxy.$refs["userRef"].validate((valid) => { |
385 | if (valid) { | 329 | if (valid) { |
386 | - addScanOrder(form.value).then((response) => { | ||
387 | - proxy.$modal.msgSuccess("add successfully!"); | 330 | + isLoading.value = true |
331 | + addScanItem({ | ||
332 | + ...form.value, | ||
333 | + scanTaskId:route.query.scanTaskId | ||
334 | + }).then((response) => { | ||
335 | + proxy.$modal.msgSuccess("新增成功!"); | ||
388 | open.value = false; | 336 | open.value = false; |
337 | + | ||
389 | getList(); | 338 | getList(); |
390 | - }); | 339 | + }).finally(() => { |
340 | + isLoading.value = false | ||
341 | + }) | ||
391 | } | 342 | } |
392 | }); | 343 | }); |
393 | } | 344 | } |
394 | 345 | ||
346 | +const addTask = () => { | ||
347 | + reset(); | ||
348 | + title.value = '新增任务' | ||
349 | + open.value = true | ||
350 | +} | ||
351 | + | ||
395 | const handleExportDiff = () => { | 352 | const handleExportDiff = () => { |
396 | proxy.download( | 353 | proxy.download( |
397 | "/scanSpec/difference/export", | 354 | "/scanSpec/difference/export", |
@@ -425,12 +382,7 @@ const handleExportResult = () => { | @@ -425,12 +382,7 @@ const handleExportResult = () => { | ||
425 | function reset() { | 382 | function reset() { |
426 | form.value = { | 383 | form.value = { |
427 | scanTaskId: route.query.scanTaskId, | 384 | scanTaskId: route.query.scanTaskId, |
428 | - type: undefined, | ||
429 | - trans: undefined, | ||
430 | - contractNo: undefined, | ||
431 | - del: undefined, | ||
432 | - exFact: undefined, | ||
433 | - quantity: undefined, | 385 | + barcode: undefined |
434 | }; | 386 | }; |
435 | proxy.resetForm("userRef"); | 387 | proxy.resetForm("userRef"); |
436 | } | 388 | } |
Please
register
or
login
to post a comment