|
@@ -0,0 +1,469 @@
|
|
|
+<template>
|
|
|
+ <div style="width: 100%; padding: 0px 15px">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
|
|
|
+ <template #details>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-button type="primary" @click="openProduct = true" v-if="!judgeStatus()"
|
|
|
+ :disabled="['100','103'].includes(formData.data.type)">添加明细</el-button>
|
|
|
+ <el-table :data="formData.data.list" style="width: 100%; margin-top: 16px">
|
|
|
+ <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="openImg(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="productCode" label="编码" width="190" />
|
|
|
+ <el-table-column prop="productName" label="名称" min-width="220" />
|
|
|
+ <el-table-column label="规格尺寸 (cm)" min-width="160">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="productUnit" label="单位" width="100" :formatter="
|
|
|
+ (row) => dictKeyValue(row.productUnit, materialUnitData)
|
|
|
+ " /> -->
|
|
|
+ <el-table-column label="入库数量" width="140">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" class="margin-b-0">
|
|
|
+ <el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="1"
|
|
|
+ onmousewheel="return false;" :disabled="['100','103'].includes(formData.data.type)" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作" width="80" fixed="right" v-if="!['100','103'].includes(formData.data.type) && !judgeStatus()">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <el-dialog v-if="openProduct" v-model="openProduct" title="物品选择" width="90%" append-to-body>
|
|
|
+ <SelectAllGood @selectGood="selectGood"></SelectAllGood>
|
|
|
+ <!-- <SelectMaterial @selectMaterial="selectMaterial"></SelectMaterial> -->
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import SelectAllGood from "@/components/product/SelectAllGood";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const route = useRoute();
|
|
|
+// 接收父组件的传值
|
|
|
+const props = defineProps({
|
|
|
+ queryData: Object,
|
|
|
+});
|
|
|
+const openProduct = ref(false);
|
|
|
+const warehouseList = ref([]);
|
|
|
+const warehouseListOne = ref([]);
|
|
|
+const userList = ref([]);
|
|
|
+const deptData = ref([]);
|
|
|
+const inBoundReason = ref([
|
|
|
+ {
|
|
|
+ label: "借用归还",
|
|
|
+ value: "100",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "退料入库",
|
|
|
+ value: "101",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "废料入库",
|
|
|
+ value: "102",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "丢件寻回",
|
|
|
+ value: "103",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "超领归还",
|
|
|
+ value: "108",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "错领归还",
|
|
|
+ value: "109",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "其他入库",
|
|
|
+ value: "110",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const produceOrder = ref([]);
|
|
|
+const lendData = ref([]);
|
|
|
+const lendDataOne = ref([]);
|
|
|
+const formData = reactive({
|
|
|
+ data: {
|
|
|
+ fileList: [],
|
|
|
+ list: [],
|
|
|
+ },
|
|
|
+});
|
|
|
+const formDom = ref(null);
|
|
|
+const judgeStatus = () => {
|
|
|
+ if (route.query.processType == 20 || route.query.processType == 10) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (props.queryData.recordList && props.queryData.recordList.length > 0) {
|
|
|
+ let data = props.queryData.recordList.filter(
|
|
|
+ (item) => item.status === 2 && item.nodeType !== 1
|
|
|
+ );
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+};
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 110,
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "title1",
|
|
|
+ title: "基本信息",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "companyId",
|
|
|
+ label: "业务公司",
|
|
|
+ data: proxy.useUserStore().allDict["tree_company_data"],
|
|
|
+ propsTreeLabel: "deptName",
|
|
|
+ propsTreeValue: "deptId",
|
|
|
+ itemWidth: 50,
|
|
|
+ fn: (val) => {
|
|
|
+ formData.data.warehouseId = "";
|
|
|
+ getWarehouseList(val);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "warehouseId",
|
|
|
+ label: "仓库名称",
|
|
|
+ required: true,
|
|
|
+ data: warehouseListOne.value,
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "exWarehousePerson",
|
|
|
+ label: "申请入库人",
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "type",
|
|
|
+ label: "入库原因",
|
|
|
+ required: true,
|
|
|
+ data: inBoundReason.value,
|
|
|
+ fn: (val) => {
|
|
|
+ formData.data.list = [];
|
|
|
+ if (["101", "102", "108", "109", "110"].includes(val)) {
|
|
|
+ formData.data.borrowId = "";
|
|
|
+ formData.data.loseId = "";
|
|
|
+ } else if (val == "103") {
|
|
|
+ formData.data.borrowId = "";
|
|
|
+ formData.data.prodOrderId = "";
|
|
|
+ } else {
|
|
|
+ formData.data.loseId = "";
|
|
|
+ formData.data.prodOrderId = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "prodOrderId",
|
|
|
+ label: "生产订单",
|
|
|
+ data: produceOrder.value,
|
|
|
+ filterable: true,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: ["101", "102", "108", "109", "110"].includes(formData.data.type),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "borrowId",
|
|
|
+ label: "借出单",
|
|
|
+ data: lendData.value,
|
|
|
+ filterable: true,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: formData.data.type == "100",
|
|
|
+ fn: (val) => {
|
|
|
+ if (val) {
|
|
|
+ proxy.post("/stockJournal/detail", { id: val }).then((res) => {
|
|
|
+ if (res.list && res.list.length < 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let ids = res.list.map((x) => x.productId);
|
|
|
+ formData.data.list = res.list.map((x) => ({
|
|
|
+ fileUrl: "",
|
|
|
+ productCode: x.productCode,
|
|
|
+ productId: x.productId,
|
|
|
+ productName: x.productName,
|
|
|
+ productLength: x.productLength,
|
|
|
+ productWidth: x.productWidth,
|
|
|
+ productHeight: x.productHeight,
|
|
|
+ quantity: x.quantity,
|
|
|
+ }));
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: ids,
|
|
|
+ data: formData.data.list,
|
|
|
+ att: "productId",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "loseId",
|
|
|
+ label: "丢件单",
|
|
|
+ data: lendDataOne.value,
|
|
|
+ filterable: true,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: formData.data.type == "103",
|
|
|
+ fn: (val) => {
|
|
|
+ const current = lendDataOne.value.find((x) => x.value == val);
|
|
|
+ if (current && current.materialId) {
|
|
|
+ let ids = [current.materialId];
|
|
|
+ formData.data.list = [
|
|
|
+ {
|
|
|
+ fileUrl: "",
|
|
|
+ productCode: current.materialCode,
|
|
|
+ productId: current.materialId,
|
|
|
+ productName: current.materialName,
|
|
|
+ productLength: current.materialLength,
|
|
|
+ productWidth: current.materialWidth,
|
|
|
+ productHeight: current.materialHeight,
|
|
|
+ quantity: current.quantity,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: ids,
|
|
|
+ data: formData.data.list,
|
|
|
+ att: "productId",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "textarea",
|
|
|
+ prop: "remarks",
|
|
|
+ label: "备注",
|
|
|
+ itemWidth: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "details",
|
|
|
+ label: "入库明细",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const rules = ref({
|
|
|
+ companyId: [{ required: true, message: "请选择业务公司", trigger: "change" }],
|
|
|
+ warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
|
|
|
+ exWarehousePerson: [
|
|
|
+ { required: true, message: "请输入领料人", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ type: [{ required: true, message: "请选择入库原因", trigger: "change" }],
|
|
|
+ prodOrderId: [
|
|
|
+ { required: true, message: "请选择生产订单", trigger: "change" },
|
|
|
+ ],
|
|
|
+ borrowId: [
|
|
|
+ { required: true, message: "请选择借用出库单", trigger: "change" },
|
|
|
+ ],
|
|
|
+ loseId: [{ required: true, message: "请选择丢件单", trigger: "change" }],
|
|
|
+ quantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
|
|
|
+ remarks: [{ required: true, message: "请输入备注", trigger: "blur" }],
|
|
|
+});
|
|
|
+
|
|
|
+const isFormDetail = ref(false);
|
|
|
+if (route.query && route.query.processType && route.query.processType == 20) {
|
|
|
+ isFormDetail.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+const getDict = () => {
|
|
|
+ // proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ // if (res.rows && res.rows.length > 0) {
|
|
|
+ // warehouseList.value = res.rows.map((item) => {
|
|
|
+ // return {
|
|
|
+ // label: item.name,
|
|
|
+ // value: item.id,
|
|
|
+ // };
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
+ proxy
|
|
|
+ .post("produceOrder/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ neProduceStatus: "10,99",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ produceOrder.value = res.rows.map((x) => ({
|
|
|
+ label: x.code,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ produceOrder.value.unshift({
|
|
|
+ label: "无",
|
|
|
+ value: -1,
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy
|
|
|
+ .post("/stockJournal/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ isRestitution: 0,
|
|
|
+ type: "3",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ lendData.value = res.rows.map((x) => ({
|
|
|
+ label:
|
|
|
+ x.code +
|
|
|
+ " " +
|
|
|
+ x.expectRestitutionTime.slice(0, 10) +
|
|
|
+ " " +
|
|
|
+ x.exWarehousePerson +
|
|
|
+ " " +
|
|
|
+ x.remarks,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy
|
|
|
+ .post("/reportLossesDetails/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ type: "2",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ lendDataOne.value = res.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label:
|
|
|
+ // x.code +
|
|
|
+ // " " +
|
|
|
+ x.repoTime.slice(0, 10) + " " + x.respUserName + " 数量" + x.quantity,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+
|
|
|
+const getWarehouseList = (val) => {
|
|
|
+ proxy
|
|
|
+ .post("/warehouse/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ companyId: val,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ warehouseListOne.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleDelete = (index) => {
|
|
|
+ formData.data.list.splice(index, 1);
|
|
|
+};
|
|
|
+
|
|
|
+const selectGood = (row) => {
|
|
|
+ console.log(row, "asdasd");
|
|
|
+ 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,
|
|
|
+ productLength: row["length"],
|
|
|
+ productWidth: row.width,
|
|
|
+ productHeight: row.height,
|
|
|
+ quantity: null,
|
|
|
+ });
|
|
|
+ proxy.msgTip("选择成功");
|
|
|
+};
|
|
|
+
|
|
|
+const handleSubmit = async (isStag = false) => {
|
|
|
+ if (isStag) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ let flag = await formDom.value.handleSubmit(() => {});
|
|
|
+ if (flag) {
|
|
|
+ if (!(formData.data.list && formData.data.list.length > 0)) {
|
|
|
+ proxy.msgTip("请添加入库明细", 2);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ const errorDiv = document.getElementsByClassName("is-error");
|
|
|
+ errorDiv[0].scrollIntoView();
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+};
|
|
|
+
|
|
|
+const getFormData = () => {
|
|
|
+ return proxy.deepClone(formData.data);
|
|
|
+};
|
|
|
+// 向父组件暴露
|
|
|
+defineExpose({
|
|
|
+ getFormData,
|
|
|
+ handleSubmit,
|
|
|
+});
|
|
|
+
|
|
|
+const getAllData = (businessId) => {
|
|
|
+ if (businessId) {
|
|
|
+ proxy.post("/manualStock/detail", { id: businessId }).then((res) => {
|
|
|
+ getWarehouseList(res.companyId);
|
|
|
+ res.type = res.type + "";
|
|
|
+ formData.data = res;
|
|
|
+ let ids = formData.data.list.map((x) => x.productId);
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: ids,
|
|
|
+ data: formData.data.list,
|
|
|
+ att: "productId",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ formOption.disabled = judgeStatus();
|
|
|
+ if (route.query.businessId) {
|
|
|
+ getAllData(route.query.businessId);
|
|
|
+ }
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|