|
@@ -28,13 +28,20 @@
|
|
|
添加物品
|
|
|
</el-button>
|
|
|
<el-table :data="formData.data.list" :row-class-name="changeClass">
|
|
|
- <el-table-column prop="productCode" label="物品编码" />
|
|
|
- <el-table-column prop="productName" label="物品名称" />
|
|
|
- <el-table-column prop="productUnit" label="单位" :formatter="
|
|
|
+ <el-table-column label="图片" width="70" align="center">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <img v-if="row.fileUrl" :src="row.fileUrl" class="pic" @click="handleClickFile(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productCode" label="物品编码" width="160" />
|
|
|
+ <el-table-column prop="productName" label="物品名称" min-width="160" />
|
|
|
+ <!-- <el-table-column prop="productUnit" label="单位" :formatter="
|
|
|
(row) => dictValueLabel(row.productUnit, productUnit)
|
|
|
- " />
|
|
|
- <el-table-column prop="quantity" label="库存数量" />
|
|
|
- <el-table-column prop="checkQuantity" label="盘点数量" min-width="150">
|
|
|
+ " /> -->
|
|
|
+ <el-table-column prop="quantity" label="库存数量" width="100" />
|
|
|
+ <el-table-column prop="checkQuantity" label="盘点数量" width="140">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item :prop="'list.' + $index + '.checkQuantity'" :rules="rules.checkQuantity" :inline-message="true"
|
|
|
class="margin-b-0 wid100">
|
|
@@ -43,8 +50,8 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="result" label="盘点结果" />
|
|
|
- <el-table-column prop="zip" label="操作" width="100" v-if="modalType == 'add'">
|
|
|
+ <el-table-column prop="result" label="盘点结果" width="80" />
|
|
|
+ <el-table-column prop="zip" label="操作" width="80" v-if="modalType == 'add'">
|
|
|
<template #default="{ $index }">
|
|
|
<el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
</template>
|
|
@@ -60,10 +67,10 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog v-if="openProduct" v-model="openProduct" title="选择物品" width="90%" append-to-body>
|
|
|
- <!-- <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods> -->
|
|
|
+ <el-dialog v-if="openProduct" v-model="openProduct" title="物品选择" width="90%" append-to-body>
|
|
|
+ <SelectAllGood @selectGood="selectMaterial"></SelectAllGood>
|
|
|
|
|
|
- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
+ <!-- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
<el-tab-pane label="产品" name="first">
|
|
|
<SelectProduct @selectProduct="selectMaterial"></SelectProduct>
|
|
|
</el-tab-pane>
|
|
@@ -71,7 +78,7 @@
|
|
|
<SelectMaterial @selectMaterial="selectMaterial"></SelectMaterial>
|
|
|
</el-tab-pane>
|
|
|
|
|
|
- </el-tabs>
|
|
|
+ </el-tabs> -->
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -83,9 +90,9 @@ import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import { computed, defineComponent, ref } from "vue";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
-import SelectGoods from "@/components/product/SelectGoods";
|
|
|
-import SelectMaterial from "@/components/product/SelectMaterial.vue";
|
|
|
-import SelectProduct from "@/components/product/SelectProduct.vue";
|
|
|
+import SelectAllGood from "@/components/product/SelectAllGood";
|
|
|
+// import SelectMaterial from "@/components/product/SelectMaterial.vue";
|
|
|
+// import SelectProduct from "@/components/product/SelectProduct.vue";
|
|
|
const activeName = ref("first");
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
@@ -379,7 +386,7 @@ const pushGoods = (goods) => {
|
|
|
const ids = arr.map((x) => x.productId);
|
|
|
if (formData.data.warehouseId) {
|
|
|
proxy
|
|
|
- .post("/stock/pageByWarehouse", {
|
|
|
+ .post("/stock/page", {
|
|
|
id: formData.data.warehouseId,
|
|
|
productIds: ids,
|
|
|
})
|
|
@@ -414,7 +421,12 @@ const pushGoods = (goods) => {
|
|
|
const selectMaterial = (row) => {
|
|
|
let flag = formData.data.list.some((x) => x.productId == row.id);
|
|
|
if (!flag) {
|
|
|
+ let fileUrl = "";
|
|
|
+ if (row.fileList && row.fileList.length > 0) {
|
|
|
+ fileUrl = row.fileList[0].fileUrl;
|
|
|
+ }
|
|
|
formData.data.list.push({
|
|
|
+ fileUrl: fileUrl,
|
|
|
productCode: row.customCode,
|
|
|
productId: row.id,
|
|
|
productName: row.name,
|
|
@@ -425,35 +437,33 @@ const selectMaterial = (row) => {
|
|
|
const ids = formData.data.list.map((x) => x.productId);
|
|
|
if (formData.data.warehouseId) {
|
|
|
proxy
|
|
|
- .post("/stock/pageByWarehouse", {
|
|
|
+ .post("/stock/page", {
|
|
|
id: formData.data.warehouseId,
|
|
|
productIds: ids,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- const productList = res.rows;
|
|
|
- if (productList.length > 0) {
|
|
|
- for (let i = 0; i < arr.length; i++) {
|
|
|
- const e = arr[i];
|
|
|
- const current = productList.find(
|
|
|
- (x) => x.productId === e.productId
|
|
|
- );
|
|
|
- if (current) {
|
|
|
- formData.data.list.push({ ...e, quantity: current.quantity });
|
|
|
- } else {
|
|
|
- formData.data.list.push({ ...e, quantity: 0 });
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.list.length; i++) {
|
|
|
+ const iele = formData.data.list[i];
|
|
|
+ let quantity = 0;
|
|
|
+ for (let j = 0; j < res.rows.length; j++) {
|
|
|
+ const jele = res.rows[j];
|
|
|
+ if (iele.productId == jele.productId) {
|
|
|
+ quantity = jele.quantity;
|
|
|
+ }
|
|
|
}
|
|
|
+ iele.quantity = quantity;
|
|
|
}
|
|
|
} else {
|
|
|
- for (let i = 0; i < arr.length; i++) {
|
|
|
- const e = arr[i];
|
|
|
- formData.data.list.push({ ...e, quantity: 0 });
|
|
|
+ for (let i = 0; i < formData.data.list.length; i++) {
|
|
|
+ formData.data.list[i].quantity = 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
proxy.msgTip("选择成功");
|
|
|
} else {
|
|
|
- proxy.msgTip("该物料已选择", 2);
|
|
|
+ proxy.msgTip("该物品已选择", 2);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -473,7 +483,7 @@ const handleRemove = (index) => {
|
|
|
// modalType.value == "add"
|
|
|
// ) {
|
|
|
// proxy
|
|
|
-// .post("/stock/pageByWarehouse", {
|
|
|
+// .post("/stock/page", {
|
|
|
// id: formData.data.warehouseId,
|
|
|
// productIds: list.map((x) => x.productId),
|
|
|
// })
|
|
@@ -555,6 +565,10 @@ const acquireSelectList = () => {
|
|
|
}
|
|
|
return data;
|
|
|
};
|
|
|
+
|
|
|
+const handleClickFile = (fileUrl) => {
|
|
|
+ window.open(fileUrl, "_blank");
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|