|
@@ -34,9 +34,79 @@
|
|
|
</byTable>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog title="出库" v-if="dialogVisible" v-model="dialogVisible" width="400" v-loading="loadingDialog">
|
|
|
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
- </byForm>
|
|
|
+ <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)">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
+ <template #details>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-button type="primary" @click="clickAdd()">添加明细</el-button>
|
|
|
+ <el-table :data="formData.data.stockWaitDetailsList" style=" margin-top: 16px">
|
|
|
+ <el-table-column label="是否扫码" width="80" :formatter="
|
|
|
+ (row) => dictValueLabel(row.isScan, scanData)
|
|
|
+ " />
|
|
|
+ <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" />
|
|
|
+ <el-table-column prop="productUnit" label="单位" width="80" :formatter="
|
|
|
+ (row) => dictValueLabel(row.productUnit, productUnit)
|
|
|
+ " />
|
|
|
+ <el-table-column label="出库数量" width="160">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item :prop="'stockWaitDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
|
|
|
+ <el-input-number v-model="row.quantity" placeholder="请输入出库数量" style="width: 100%" :precision="0" :controls="false" :min="1"
|
|
|
+ :disabled="row.isScan =='1'" onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作" width="80" fixed="right">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ </div>
|
|
|
+ <div style="width:300px;margin-left:20px">
|
|
|
+ <el-card class="box-card" style="height:100%;position: relative;">
|
|
|
+ <div class="box">
|
|
|
+ <img src="@/assets/images/scanz.png" class="img" v-if="!isScan" />
|
|
|
+ <img src="@/assets/images/scaning.gif" class="img" v-if="isScan" />
|
|
|
+ <div class="titlea" @click.stop="handleClickScan">
|
|
|
+ {{btnTitle}}
|
|
|
+ </div>
|
|
|
+ <el-input v-model="scanValue" :rows="1" type="textarea" :disabled="!isScan" ref="scanInput" @input="handleScanValueChange"
|
|
|
+ @blur="handleScanBlur" class="input" />
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- <div style="display:flex">
|
|
|
+ <div style="width:50%">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
+ </byForm>
|
|
|
+ </div>
|
|
|
+ <div style="width:50%;padding-left:20px;padding-top:10px">
|
|
|
+ <div>
|
|
|
+ <el-button type="primary" @click="handleClickScan">{{btnTitle}}</el-button>
|
|
|
+ </div>
|
|
|
+ <div style="margin:15px 0px">
|
|
|
+ <el-input v-model="textarea" :rows="5" type="textarea" :disabled="!isScan" ref="scanInput" />
|
|
|
+ </div>
|
|
|
+ <TitleInfo content="已扫码产品"></TitleInfo>
|
|
|
+ <el-table :data="scanCodeData" style="margin-top: 10px">
|
|
|
+ <el-table-column prop="productName" label="产品名称" />
|
|
|
+ <el-table-column prop="productSpec" label="规格型号" width="100" />
|
|
|
+ <el-table-column prop="productSpec" label="单价" width="100" />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
<el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
|
|
@@ -51,6 +121,7 @@ import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
+import TitleInfo from "@/components/TitleInfo/index.vue";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const warehouseList = ref([]);
|
|
@@ -359,13 +430,18 @@ const formConfig = computed(() => {
|
|
|
required: true,
|
|
|
data: warehouseList.value,
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "number",
|
|
|
+ // prop: "warehousingQuantity",
|
|
|
+ // label: "出库数量",
|
|
|
+ // precision: 0,
|
|
|
+ // min: 1,
|
|
|
+ // controls: false,
|
|
|
+ // },
|
|
|
{
|
|
|
- type: "number",
|
|
|
- prop: "warehousingQuantity",
|
|
|
- label: "出库数量",
|
|
|
- precision: 0,
|
|
|
- min: 1,
|
|
|
- controls: false,
|
|
|
+ type: "slot",
|
|
|
+ slotName: "details",
|
|
|
+ label: "出库明细",
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
@@ -386,6 +462,7 @@ const rules = ref({
|
|
|
warehousingQuantity: [
|
|
|
{ required: true, message: "请输入出库数量", trigger: "blur" },
|
|
|
],
|
|
|
+ quantity: [{ required: true, message: "请输入出库数量", trigger: "blur" }],
|
|
|
exWarehousePerson: [
|
|
|
{ required: true, message: "请输入出库人", trigger: "blur" },
|
|
|
],
|
|
@@ -396,9 +473,17 @@ const rules = ref({
|
|
|
const submitForm = () => {
|
|
|
submit.value.handleSubmit(() => {
|
|
|
loadingDialog.value = true;
|
|
|
- if (
|
|
|
- formData.data.warehousingQuantity > Number(formData.data.waitQuantity)
|
|
|
- ) {
|
|
|
+ if (!(formData.data.stockWaitDetailsList.length > 0)) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "请添加出库明细",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const total = formData.data.stockWaitDetailsList.reduce(
|
|
|
+ (val, x) => (val += x.quantity),
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ if (Number(total) > Number(formData.data.waitQuantity)) {
|
|
|
return ElMessage({
|
|
|
message: "出库数量不可大于待出库数量",
|
|
|
type: "info",
|
|
@@ -406,11 +491,12 @@ const submitForm = () => {
|
|
|
}
|
|
|
proxy
|
|
|
.post("/stockWait/add", {
|
|
|
- id: formData.data.id,
|
|
|
+ id: formData.data.stockWaitId,
|
|
|
warehouseId: formData.data.warehouseId,
|
|
|
quantity: formData.data.warehousingQuantity,
|
|
|
exWarehousePerson: formData.data.exWarehousePerson,
|
|
|
receivingPerson: formData.data.receivingPerson,
|
|
|
+ stockWaitDetailsList: formData.data.stockWaitDetailsList,
|
|
|
})
|
|
|
.then(
|
|
|
() => {
|
|
@@ -428,12 +514,86 @@ const submitForm = () => {
|
|
|
);
|
|
|
});
|
|
|
};
|
|
|
+const rowData = ref({});
|
|
|
const clickOperation = (row) => {
|
|
|
+ rowData.value = row;
|
|
|
formData.data = row;
|
|
|
+ formData.data.stockWaitDetailsList = [];
|
|
|
formData.data.exWarehousePerson = useUserStore().user.nickName;
|
|
|
loadingDialog.value = false;
|
|
|
dialogVisible.value = true;
|
|
|
};
|
|
|
+
|
|
|
+const scanData = ref([
|
|
|
+ {
|
|
|
+ label: "是",
|
|
|
+ value: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "否",
|
|
|
+ value: "0",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const scanValue = ref("");
|
|
|
+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();
|
|
|
+ }
|
|
|
+};
|
|
|
+const handleScanBlur = () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ isScan.value = false;
|
|
|
+ btnTitle.value = "扫码出库";
|
|
|
+ }, 100);
|
|
|
+};
|
|
|
+const handleScanValueChange = (val) => {
|
|
|
+ if (val) {
|
|
|
+ proxy.post("/purchaseDetail/detail", { id: val }).then((res) => {
|
|
|
+ if (res.bussinessId != rowData.value.productId) {
|
|
|
+ ElMessage({
|
|
|
+ message: "请扫正确的产品",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.stockWaitDetailsList.push({
|
|
|
+ id: rowData.value.id,
|
|
|
+ isScan: "1",
|
|
|
+ productCode: res.productCode,
|
|
|
+ productId: res.bussinessId,
|
|
|
+ productName: res.productName,
|
|
|
+ productSpec: res.productSpec,
|
|
|
+ productUnit: res.productUnit,
|
|
|
+ quantity: 1,
|
|
|
+ purchaseDetailId: val,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ scanValue.value = "";
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const clickAdd = () => {
|
|
|
+ formData.data.stockWaitDetailsList.push({
|
|
|
+ id: formData.data.id,
|
|
|
+ isScan: "0",
|
|
|
+ productCode: formData.data.productCode,
|
|
|
+ productId: formData.data.productId,
|
|
|
+ productName: formData.data.productName,
|
|
|
+ productSpec: formData.data.productSpec,
|
|
|
+ productUnit: formData.data.productUnit,
|
|
|
+ quantity: undefined,
|
|
|
+ purchaseDetailId: "",
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleDelete = (index) => {
|
|
|
+ formData.data.stockWaitDetailsList.splice(index, 1);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -449,4 +609,33 @@ const clickOperation = (row) => {
|
|
|
color: #fff;
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
+.box {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ transform: translate(0, -50%);
|
|
|
+ .img {
|
|
|
+ width: 260px;
|
|
|
+ height: 260px;
|
|
|
+ object-fit: contain;
|
|
|
+ vertical-align: middle;
|
|
|
+ // cursor: pointer;
|
|
|
+ z-index: 10;
|
|
|
+ }
|
|
|
+ .titlea {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #5df5e9;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .input {
|
|
|
+ opacity: 1;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|