|
@@ -4,17 +4,73 @@
|
|
|
<byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
|
|
|
highlight-current-row @get-list="getList">
|
|
|
|
|
|
- <template #pic="{item}">
|
|
|
- <div style="width: 100%">
|
|
|
- <img v-if="item.fileUrl" :src="item.fileUrl" class="pic" @click="openImg(item.fileUrl)" />
|
|
|
+ <template #expand="{item}">
|
|
|
+ <div style="width:100%;padding:0 50px">
|
|
|
+ <el-table :data="item.stockWaitDetailsList" class="bom-table" border>
|
|
|
+ <el-table-column label="物品图片" width="100" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.fileUrl">
|
|
|
+ <img :src="row.fileUrl" class="pic" @click="openImg(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productCode" label="物品编码" width="200" />
|
|
|
+ <el-table-column prop="productName" label="物品名称" min-width="130" />
|
|
|
+ <el-table-column label="尺寸 (cm)" width="140">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="需入库数量" prop="quantity" width="100" />
|
|
|
+ <el-table-column label="待入库数量" prop="waitQuantity" width="100" />
|
|
|
+ <el-table-column label="已入库数量" prop="receiptQuantity" width="100" />
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
</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">
|
|
|
+ <el-dialog title="出库" v-if="dialogVisible" v-model="dialogVisible" width="1200">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
|
|
|
+ <template #detail>
|
|
|
+ <div style="width:100%">
|
|
|
+ <div style="width:100%;padding:0 15px">
|
|
|
+ <el-table :data="formData.data.stockWaitDetailsList">
|
|
|
+ <el-table-column label="物品图片" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.fileUrl">
|
|
|
+ <img :src="row.fileUrl" class="pic" @click="openImg(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productCode" label="物品编码" width="160" />
|
|
|
+ <el-table-column prop="productName" label="物品名称" min-width="130" />
|
|
|
+ <el-table-column label="尺寸 (cm)" width="140">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="需入库数量" prop="needQuantity" width="100" />
|
|
|
+ <el-table-column label="待入库数量" prop="waitQuantity" width="100" />
|
|
|
+ <el-table-column label="已入库数量" prop="receiptQuantity" width="100" />
|
|
|
+ <el-table-column prop="quantity" label="入库数量" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item :prop="'stockWaitDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
|
|
|
+ class="margin-b-0">
|
|
|
+ <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
|
|
|
+ :controls="false" :min="0" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</byForm>
|
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false" size="default">取 消</el-button>
|
|
@@ -128,7 +184,7 @@ const sourceList = ref({
|
|
|
pageSize: 10,
|
|
|
keyword: "",
|
|
|
status: "",
|
|
|
- type: "2",
|
|
|
+ type: 2,
|
|
|
},
|
|
|
});
|
|
|
const loading = ref(false);
|
|
@@ -149,10 +205,18 @@ const selectConfig = computed(() => {
|
|
|
const config = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
+ type: "expand",
|
|
|
+ attrs: {
|
|
|
+ slot: "expand",
|
|
|
+ width: 50,
|
|
|
+ align: "center",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
attrs: {
|
|
|
label: "数据来源",
|
|
|
prop: "businessType",
|
|
|
- width: 120,
|
|
|
+ // width: 120,
|
|
|
},
|
|
|
render(type) {
|
|
|
return proxy.dictValueLabel(type, businessType.value);
|
|
@@ -162,7 +226,7 @@ const config = computed(() => {
|
|
|
attrs: {
|
|
|
label: "单号",
|
|
|
prop: "businessCode",
|
|
|
- width: 160,
|
|
|
+ // width: 160,
|
|
|
},
|
|
|
},
|
|
|
// {
|
|
@@ -175,28 +239,28 @@ const config = computed(() => {
|
|
|
// return proxy.dictValueLabel(type, productType.value);
|
|
|
// },
|
|
|
// },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "图片",
|
|
|
- slot: "pic",
|
|
|
- align: "center",
|
|
|
- width: 80,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "物品编码",
|
|
|
- prop: "productCustomCode",
|
|
|
- width: 140,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "物品名称",
|
|
|
- prop: "productName",
|
|
|
- "min-width": 200,
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "图片",
|
|
|
+ // slot: "pic",
|
|
|
+ // align: "center",
|
|
|
+ // width: 80,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "物品编码",
|
|
|
+ // prop: "productCustomCode",
|
|
|
+ // width: 140,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "物品名称",
|
|
|
+ // prop: "productName",
|
|
|
+ // "min-width": 200,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
// {
|
|
|
// attrs: {
|
|
|
// label: "规格型号",
|
|
@@ -214,18 +278,18 @@ const config = computed(() => {
|
|
|
// return proxy.dictKeyValue(unit, materialUnitData.value);
|
|
|
// },
|
|
|
// },
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "待出库数量",
|
|
|
- prop: "quantity",
|
|
|
- width: 120,
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "待出库数量",
|
|
|
+ // prop: "quantity",
|
|
|
+ // width: 120,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "出库状态",
|
|
|
prop: "status",
|
|
|
- width: 140,
|
|
|
+ // width: 140,
|
|
|
},
|
|
|
render(type) {
|
|
|
return proxy.dictValueLabel(type, status.value);
|
|
@@ -272,31 +336,46 @@ const getDict = () => {
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
|
- proxy
|
|
|
- .post("/stockWaitDetails/page", sourceList.value.pagination)
|
|
|
- .then((res) => {
|
|
|
- sourceList.value.data = res.rows.map((x) => ({
|
|
|
- ...x,
|
|
|
- quantity: (x.quantity - x.receiptQuantity).toFixed(4),
|
|
|
- }));
|
|
|
- sourceList.value.pagination.total = res.total;
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false;
|
|
|
- }, 200);
|
|
|
-
|
|
|
- const productIdList = res.rows.map((x) => x.productId);
|
|
|
- // 请求文件数据并回显
|
|
|
- if (productIdList.length > 0) {
|
|
|
- proxy.getFileData({
|
|
|
- businessIdList: productIdList,
|
|
|
- data: sourceList.value.data,
|
|
|
- att: "productId",
|
|
|
- businessType: "0",
|
|
|
- fileAtt: "fileList",
|
|
|
- filePathAtt: "fileUrl",
|
|
|
- });
|
|
|
+ proxy.post("/stockWait/page", sourceList.value.pagination).then((res) => {
|
|
|
+ sourceList.value.data = res.rows;
|
|
|
+ let productIds = [];
|
|
|
+ for (let i = 0; i < res.rows.length; i++) {
|
|
|
+ for (let j = 0; j < res.rows[i].stockWaitDetailsList.length; j++) {
|
|
|
+ let ele = res.rows[i].stockWaitDetailsList[j];
|
|
|
+ ele.waitQuantity = Number(ele.quantity) - Number(ele.receiptQuantity);
|
|
|
+ productIds.push(ele.productId);
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ if (productIds && productIds.length > 0) {
|
|
|
+ proxy
|
|
|
+ .getFileData({
|
|
|
+ businessIdList: Array.from(new Set(productIds)),
|
|
|
+ getAll: true,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ for (let i = 0; i < sourceList.value.data.length; i++) {
|
|
|
+ for (
|
|
|
+ let j = 0;
|
|
|
+ j < sourceList.value.data[i].stockWaitDetailsList.length;
|
|
|
+ j++
|
|
|
+ ) {
|
|
|
+ let ele = sourceList.value.data[i].stockWaitDetailsList[j];
|
|
|
+ for (const key in res) {
|
|
|
+ if (ele.productId == key && res[key]) {
|
|
|
+ let list = res[key].filter((x) => x.businessType == "0");
|
|
|
+ ele.fileUrl = list && list.length > 0 ? list[0].fileUrl : "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
};
|
|
|
getDict();
|
|
|
getList();
|
|
@@ -315,7 +394,8 @@ const formData = reactive({
|
|
|
const formConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
- label: "待出库信息",
|
|
|
+ type: "title1",
|
|
|
+ title: "待出库信息",
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
@@ -323,6 +403,7 @@ const formConfig = computed(() => {
|
|
|
label: "数据来源",
|
|
|
disabled: true,
|
|
|
data: businessType.value,
|
|
|
+ itemWidth: 50,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
@@ -330,23 +411,7 @@ const formConfig = computed(() => {
|
|
|
label: "单号",
|
|
|
itemType: "text",
|
|
|
disabled: true,
|
|
|
- },
|
|
|
- {
|
|
|
- type: "input",
|
|
|
- prop: "productName",
|
|
|
- label: "物品名称",
|
|
|
- itemType: "text",
|
|
|
- disabled: true,
|
|
|
- },
|
|
|
- {
|
|
|
- type: "input",
|
|
|
- prop: "quantity",
|
|
|
- label: "待出库数量",
|
|
|
- itemType: "text",
|
|
|
- disabled: true,
|
|
|
- },
|
|
|
- {
|
|
|
- label: "本次出库",
|
|
|
+ itemWidth: 50,
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
@@ -354,56 +419,68 @@ const formConfig = computed(() => {
|
|
|
label: "仓库名称",
|
|
|
required: true,
|
|
|
data: warehouseList.value,
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "upload",
|
|
|
+ listType: "text",
|
|
|
+ accept: "",
|
|
|
+ prop: "fileList",
|
|
|
+ label: "上传附件",
|
|
|
+ itemWidth: 100,
|
|
|
},
|
|
|
{
|
|
|
- type: "number",
|
|
|
- prop: "warehousingQuantity",
|
|
|
- label: "出库数量",
|
|
|
- precision: 0,
|
|
|
- min: 1,
|
|
|
- controls: false,
|
|
|
+ type: "title1",
|
|
|
+ title: "出库明细",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "detail",
|
|
|
+ label: "",
|
|
|
},
|
|
|
];
|
|
|
});
|
|
|
const rules = ref({
|
|
|
warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
|
|
|
- warehousingQuantity: [
|
|
|
- { required: true, message: "请输入出库数量", trigger: "blur" },
|
|
|
- ],
|
|
|
+ quantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
|
|
|
});
|
|
|
const submitForm = () => {
|
|
|
submit.value.handleSubmit(() => {
|
|
|
- loadingDialog.value = true;
|
|
|
- if (formData.data.warehousingQuantity > Number(formData.data.quantity)) {
|
|
|
- return ElMessage({
|
|
|
- message: "出库数量不可大于待出库数量",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
+ if (!(formData.data.fileList && formData.data.fileList.length > 0)) {
|
|
|
+ return proxy.msgTip("请上传附件", 2);
|
|
|
}
|
|
|
- proxy
|
|
|
- .post("/stockWait/add", {
|
|
|
- id: formData.data.id,
|
|
|
- warehouseId: formData.data.warehouseId,
|
|
|
- quantity: formData.data.warehousingQuantity,
|
|
|
- })
|
|
|
- .then(
|
|
|
- () => {
|
|
|
- ElMessage({
|
|
|
- message: "提交成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- dialogVisible.value = false;
|
|
|
- getList();
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log(err);
|
|
|
- loadingDialog.value = false;
|
|
|
- }
|
|
|
- );
|
|
|
+ for (let i = 0; i < formData.data.stockWaitDetailsList.length; i++) {
|
|
|
+ const ele = formData.data.stockWaitDetailsList[i];
|
|
|
+ if (Number(ele.quantity) > Number(ele.waitQuantity)) {
|
|
|
+ return proxy.msgTip("入库数量不可大于待入库数量", 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loadingDialog.value = true;
|
|
|
+ proxy.post("/stockWait/add", formData.data).then(
|
|
|
+ () => {
|
|
|
+ proxy.msgTip("提交成功", 1);
|
|
|
+ dialogVisible.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ loadingDialog.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
});
|
|
|
};
|
|
|
const clickOperation = (row) => {
|
|
|
- formData.data = row;
|
|
|
+ formData.data = {
|
|
|
+ id: row.id,
|
|
|
+ businessType: row.businessType + "",
|
|
|
+ businessCode: row.businessCode,
|
|
|
+ warehouseId: "",
|
|
|
+ stockWaitDetailsList: row.stockWaitDetailsList.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ needQuantity: x.quantity,
|
|
|
+ quantity: null,
|
|
|
+ })),
|
|
|
+ fileList: [],
|
|
|
+ };
|
|
|
loadingDialog.value = false;
|
|
|
dialogVisible.value = true;
|
|
|
};
|