|
@@ -13,7 +13,7 @@
|
|
|
|
|
|
<el-dialog title="手动出库" v-if="dialogVisible" v-model="dialogVisible" width="1300" v-loading="loadingDialog">
|
|
|
<div style="width:100%;display:flex">
|
|
|
- <div style="flex:1;overflow:auto;height:calc(100vh - 300px)">
|
|
|
+ <div style="flex:1;overflow:auto;height:calc(100vh - 270px)">
|
|
|
<byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
<template #workOrderId>
|
|
|
<div style="width: 100%">
|
|
@@ -27,9 +27,18 @@
|
|
|
<div style="width: 100%">
|
|
|
<el-button type="primary" @click="clickAdd()">添加明细</el-button>
|
|
|
<el-table :data="formData.data.list" style=" margin-top: 16px">
|
|
|
- <el-table-column label="是否扫码" width="80" :formatter="
|
|
|
- (row) => dictValueLabel(row.isScan, scanData)
|
|
|
- " />
|
|
|
+ <el-table-column type="index" width="50" />
|
|
|
+ <el-table-column label="是否扫码" width="80">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div>
|
|
|
+ <span style="padding: 4px" :class="[row.isScan == 1 ? 'active' : 'disActive']">
|
|
|
+ {{
|
|
|
+ proxy.dictValueLabel(row.isScan, scanData)
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="productCode" label="产品编码" width="140" />
|
|
|
<el-table-column prop="productName" label="产品名称" min-width="160" />
|
|
|
<el-table-column prop="productSpec" label="规格型号" width="120" />
|
|
@@ -313,23 +322,35 @@ const changeWarehouse = () => {
|
|
|
};
|
|
|
|
|
|
const pushGoods = (goods) => {
|
|
|
- const arr = goods.map((item) => ({
|
|
|
- isScan: "0",
|
|
|
- productCode: item.productCode,
|
|
|
- productId: item.productId,
|
|
|
- productName: item.productName,
|
|
|
- productSpec: item.productSpec,
|
|
|
- productUnit: item.productUnit,
|
|
|
- productQuantity: item.quantity,
|
|
|
- quantity: undefined,
|
|
|
- purchaseDetailId: "",
|
|
|
- }));
|
|
|
- formData.data.list = formData.data.list.concat(arr);
|
|
|
- // openProduct.value = false;
|
|
|
- return ElMessage({
|
|
|
- message: "添加成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
+ console.log(goods, "asdad");
|
|
|
+ if (goods && goods.productId) {
|
|
|
+ // const arr = goods.map((item) => ({
|
|
|
+ // isScan: "0",
|
|
|
+ // productCode: item.productCode,
|
|
|
+ // productId: item.productId,
|
|
|
+ // productName: item.productName,
|
|
|
+ // productSpec: item.productSpec,
|
|
|
+ // productUnit: item.productUnit,
|
|
|
+ // productQuantity: item.quantity,
|
|
|
+ // quantity: undefined,
|
|
|
+ // purchaseDetailId: "",
|
|
|
+ // }));
|
|
|
+ formData.data.list.push({
|
|
|
+ isScan: "0",
|
|
|
+ productCode: goods.productCode,
|
|
|
+ productId: goods.productId,
|
|
|
+ productName: goods.productName,
|
|
|
+ productSpec: goods.productSpec,
|
|
|
+ productUnit: goods.productUnit,
|
|
|
+ productQuantity: goods.quantity,
|
|
|
+ quantity: undefined,
|
|
|
+ purchaseDetailId: "",
|
|
|
+ });
|
|
|
+ return ElMessage({
|
|
|
+ message: "添加成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
const submitForm = () => {
|
|
|
submit.value.handleSubmit(() => {
|
|
@@ -396,33 +417,45 @@ const isScan = ref(false);
|
|
|
const btnTitle = ref("扫码出库");
|
|
|
const scanInput = ref(null);
|
|
|
const handleClickScan = () => {
|
|
|
- isScan.value = !isScan.value;
|
|
|
- btnTitle.value = isScan.value ? "扫码中···" : "扫码出库";
|
|
|
- if (isScan.value) {
|
|
|
- scanInput.value.focus();
|
|
|
+ if (!isScan.value) {
|
|
|
+ if (formData.data.warehouseId) {
|
|
|
+ isScan.value = !isScan.value;
|
|
|
+ btnTitle.value = isScan.value ? "扫码中···" : "扫码出库";
|
|
|
+ if (isScan.value) {
|
|
|
+ scanInput.value.focus();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage("请先选择仓库");
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
const handleScanBlur = () => {
|
|
|
setTimeout(() => {
|
|
|
+ scanValue.value = "";
|
|
|
isScan.value = false;
|
|
|
btnTitle.value = "扫码出库";
|
|
|
}, 100);
|
|
|
};
|
|
|
const handleScanValueChange = (val) => {
|
|
|
if (val) {
|
|
|
- proxy.post("/purchaseDetail/detail", { id: val }).then((res) => {
|
|
|
- formData.data.list.push({
|
|
|
- isScan: "1",
|
|
|
- productCode: res.productCode,
|
|
|
- productId: res.bussinessId,
|
|
|
- productName: res.productName,
|
|
|
- productSpec: res.productSpec,
|
|
|
- productUnit: res.productUnit,
|
|
|
- quantity: 1,
|
|
|
- purchaseDetailId: val,
|
|
|
- });
|
|
|
- scanValue.value = "";
|
|
|
- });
|
|
|
+ proxy.post("/purchaseDetail/detail", { id: val }).then(
|
|
|
+ (res) => {
|
|
|
+ formData.data.list.push({
|
|
|
+ isScan: "1",
|
|
|
+ productCode: res.productCode,
|
|
|
+ productId: res.bussinessId,
|
|
|
+ productName: res.productName,
|
|
|
+ productSpec: res.productSpec,
|
|
|
+ productUnit: res.productUnit,
|
|
|
+ quantity: 1,
|
|
|
+ purchaseDetailId: val,
|
|
|
+ });
|
|
|
+ scanValue.value = "";
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ scanValue.value = "";
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -463,4 +496,15 @@ const handleScanValueChange = (val) => {
|
|
|
left: 0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.active {
|
|
|
+ background: #a6dd82;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.disActive {
|
|
|
+ background: #fa9841;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
</style>
|