|
@@ -0,0 +1,496 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="tenant">
|
|
|
|
+ <!-- <Banner /> -->
|
|
|
|
+ <div class="content">
|
|
|
|
+ <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
|
|
|
|
+ :selectConfig="selectConfig" :table-events="{
|
|
|
|
+ //element talbe事件都能传
|
|
|
|
+ 'selection-change': selectionChange,
|
|
|
|
+ }" :action-list="[
|
|
|
|
+ {
|
|
|
|
+ text: '申购',
|
|
|
|
+ disabled: selectData.length === 0,
|
|
|
|
+ action: () => openModal(),
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ ]" @get-list="getList">
|
|
|
|
+ <template #code="{ item }">
|
|
|
|
+ <div style="cursor: pointer; color: #409eff">
|
|
|
|
+ {{ item.businessCode }}
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #logistics="{ item }">
|
|
|
|
+ {{ item.logisticsCompanyName }} (
|
|
|
|
+ <span style="color: #409eff"> {{ item.logisticsCode }} </span>
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ </template>
|
|
|
|
+ </byTable>
|
|
|
|
+ </div>
|
|
|
|
+ <el-dialog title="退货" v-model="dialogVisible" width="50%" destroy-on-close>
|
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform" v-loading="submitLoading">
|
|
|
|
+ </byForm>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
|
|
|
|
+ 确 定
|
|
|
|
+ </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script setup>
|
|
|
|
+/* eslint-disable vue/no-unused-components */
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
+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 { getToken } from "@/utils/auth";
|
|
|
|
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
|
+const loading = ref(false);
|
|
|
|
+const submitLoading = ref(false);
|
|
|
|
+const sourceList = ref({
|
|
|
|
+ data: [],
|
|
|
|
+ pagination: {
|
|
|
|
+ total: 3,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ type: 1,
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+let dialogVisible = ref(false);
|
|
|
|
+let roomDialogVisible = ref(false);
|
|
|
|
+let modalType = ref("add");
|
|
|
|
+let rules = ref({
|
|
|
|
+ backLogisticsCode: [
|
|
|
|
+ { required: true, message: "请输入物流/快递单号", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+});
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
+const selectConfig = computed(() => [
|
|
|
|
+ {
|
|
|
|
+ label: "处理结果",
|
|
|
|
+ prop: "processingMethod",
|
|
|
|
+ data: statusData.value,
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const statusData = ref([
|
|
|
|
+ {
|
|
|
|
+ label: "未处理",
|
|
|
|
+ value: "0",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "退货",
|
|
|
|
+ value: "10",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "入库",
|
|
|
|
+ value: "20",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "申购",
|
|
|
|
+ value: "30",
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const config = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ type: "selection",
|
|
|
|
+ attrs: {
|
|
|
|
+ checkAtt: "isCheck",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // attrs: {
|
|
|
|
+ // label: "数据来源",
|
|
|
|
+ // prop: "businessType",
|
|
|
|
+ // width: 100,
|
|
|
|
+ // },
|
|
|
|
+ // render(type) {
|
|
|
|
+ // return businessType.find((x) => x.value == type).label;
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "入库单",
|
|
|
|
+ prop: "businessCode",
|
|
|
|
+ width: 150,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "物流/快递信息",
|
|
|
|
+ prop: "logisticsCompanyName",
|
|
|
|
+ slot: "logistics",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "物品编码",
|
|
|
|
+ prop: "productCustomCode",
|
|
|
|
+ // width: 150,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "物品名称",
|
|
|
|
+ prop: "productName",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "物品规格",
|
|
|
|
+ prop: "productSpec",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "数量",
|
|
|
|
+ prop: "quantity",
|
|
|
|
+ width: 100,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "处理结果",
|
|
|
|
+ prop: "processingMethod",
|
|
|
|
+ width: 100,
|
|
|
|
+ },
|
|
|
|
+ render(val) {
|
|
|
|
+ return proxy.dictValueLabel(val, statusData.value);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "操作",
|
|
|
|
+ width: "160",
|
|
|
|
+ align: "center",
|
|
|
|
+ },
|
|
|
|
+ // 渲染 el-button,一般用在最后一列。
|
|
|
|
+ renderHTML(row) {
|
|
|
|
+ return [
|
|
|
|
+ row.processingMethod == 0
|
|
|
|
+ ? {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "申购",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ getDtl(row);
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ : {},
|
|
|
|
+ row.processingMethod == 0
|
|
|
|
+ ? {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "退货",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ getDtl(row);
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ : {},
|
|
|
|
+ row.processingMethod == 0
|
|
|
|
+ ? {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "入库",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ ElMessageBox.confirm("您确定入库吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ }).then(() => {
|
|
|
|
+ // 删除
|
|
|
|
+ proxy
|
|
|
|
+ .post("/excessGoodsDetails/inStock", {
|
|
|
|
+ id: row.id,
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: "操作成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ getList();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ : {},
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+let formData = reactive({
|
|
|
|
+ data: {},
|
|
|
|
+ treeData: [],
|
|
|
|
+});
|
|
|
|
+const formOption = reactive({
|
|
|
|
+ inline: true,
|
|
|
|
+ labelWidth: 100,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ rules: [],
|
|
|
|
+});
|
|
|
|
+const byform = ref(null);
|
|
|
|
+const treeData = ref([]);
|
|
|
|
+const formConfig = computed(() => [
|
|
|
|
+ {
|
|
|
|
+ type: "title",
|
|
|
|
+ title: "基础信息",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "businessCode",
|
|
|
|
+ label: "单号",
|
|
|
|
+ disabled: true,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "productCustomCode",
|
|
|
|
+ label: "物品编码",
|
|
|
|
+ disabled: true,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "productName",
|
|
|
|
+ label: "物品名称",
|
|
|
|
+ disabled: true,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "productSpec",
|
|
|
|
+ label: "物品规格",
|
|
|
|
+ disabled: true,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "quantity",
|
|
|
|
+ label: "数量",
|
|
|
|
+ disabled: true,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "title",
|
|
|
|
+ title: "物流信息",
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // type: "select",
|
|
|
|
+ // prop: "logisticsCompanyCode",
|
|
|
|
+ // label: "物流/快递信息",
|
|
|
|
+ // placeholder: "物流/快递公司",
|
|
|
|
+ // itemWidth: 50,
|
|
|
|
+ // style: {
|
|
|
|
+ // width: "100%",
|
|
|
|
+ // },
|
|
|
|
+ // data: logisticsData.value,
|
|
|
|
+ // filterable: true,
|
|
|
|
+ // },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "backLogisticsCode",
|
|
|
|
+ label: "物流/快递单号",
|
|
|
|
+ // placeholder: "物流/快递单号",
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const getList = async (req) => {
|
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
|
+ loading.value = true;
|
|
|
|
+ proxy
|
|
|
|
+ .post("/excessGoodsDetails/page", sourceList.value.pagination)
|
|
|
|
+ .then((message) => {
|
|
|
|
+ sourceList.value.data = message.rows.map((x) => ({
|
|
|
|
+ ...x,
|
|
|
|
+ isCheck: x.processingMethod == 0 ? true : false,
|
|
|
|
+ }));
|
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ }, 200);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const submitForm = () => {
|
|
|
|
+ byform.value.handleSubmit((valid) => {
|
|
|
|
+ // const list = formData.data.stockWaitDetailsList;
|
|
|
|
+ // const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
|
|
|
|
+ // if (!(total > 0)) {
|
|
|
|
+ // return ElMessage({
|
|
|
|
+ // message: `本次入库不能为0!`,
|
|
|
|
+ // type: "info",
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // for (let i = 0; i < list.length; i++) {
|
|
|
|
+ // const e = list[i];
|
|
|
|
+ // if (Number(e.receiptQuantity) + e.quantity > Number(e.arrivalQuantity)) {
|
|
|
|
+ // return ElMessage({
|
|
|
|
+ // message: "本次入库加已入库数量不可大于发货数量!",
|
|
|
|
+ // type: "info",
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ submitLoading.value = true;
|
|
|
|
+ proxy.post("/excessGoodsDetails/backGoods", formData.data).then(
|
|
|
|
+ (res) => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: "操作成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ dialogVisible.value = false;
|
|
|
|
+ submitLoading.value = false;
|
|
|
|
+ getList();
|
|
|
|
+ },
|
|
|
|
+ (err) => (submitLoading.value = false)
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const getDtl = (row) => {
|
|
|
|
+ modalType.value = "edit";
|
|
|
|
+ formData.data = {
|
|
|
|
+ businessCode: row.businessCode,
|
|
|
|
+ productCustomCode: row.productCustomCode,
|
|
|
|
+ productName: row.productName,
|
|
|
|
+ productSpec: row.productSpec,
|
|
|
|
+ quantity: row.quantity,
|
|
|
|
+ id: row.id,
|
|
|
|
+ backLogisticsCode: "",
|
|
|
|
+ };
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+const warehouseType = ref([]);
|
|
|
|
+const logisticsData = ref([]);
|
|
|
|
+const getDict = () => {
|
|
|
|
+ // proxy
|
|
|
|
+ // .post("/dictTenantData/page", {
|
|
|
|
+ // pageNum: 1,
|
|
|
|
+ // pageSize: 999,
|
|
|
|
+ // tenantId: useUserStore().user.tenantId,
|
|
|
|
+ // dictCode: "warehouse_type",
|
|
|
|
+ // })
|
|
|
|
+ // .then((res) => {
|
|
|
|
+ // warehouseType.value = res.rows;
|
|
|
|
+ // });
|
|
|
|
+ proxy
|
|
|
|
+ .post("/companyInfo/list", { pageNum: 1, pageSize: 9999 })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ logisticsData.value = res.reverse();
|
|
|
|
+ logisticsData.value = logisticsData.value.map((x) => ({
|
|
|
|
+ label: x.name,
|
|
|
|
+ value: x.code,
|
|
|
|
+ }));
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const businessType = [
|
|
|
|
+ { label: "线边回仓", value: "1" },
|
|
|
|
+ { label: "完工入库", value: "2" },
|
|
|
|
+ { label: "采购到货", value: "3" },
|
|
|
|
+ { label: "退货出库", value: "4" },
|
|
|
|
+];
|
|
|
|
+
|
|
|
|
+getList();
|
|
|
|
+getDict();
|
|
|
|
+onMounted(() => {});
|
|
|
|
+const selectData = ref([]);
|
|
|
|
+const selectionChange = (data) => {
|
|
|
|
+ selectData.value = data;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const openModal = () => {
|
|
|
|
+ proxy.$router.push({
|
|
|
|
+ path: "/platform_manage/process/processApproval",
|
|
|
|
+ query: {
|
|
|
|
+ flowKey: "wdly_apply_purchase",
|
|
|
|
+ flowName: "申购发起",
|
|
|
|
+ random: proxy.random(),
|
|
|
|
+ arr: JSON.stringify(selectData.value),
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const deriveExcel = () => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: "请稍后",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ proxy
|
|
|
|
+ .postTwo(
|
|
|
|
+ "/stockWait/inStockWaitExportExcel",
|
|
|
|
+ selectData.value.map((x) => x.id)
|
|
|
|
+ )
|
|
|
|
+ .then((res) => {
|
|
|
|
+ const content = res;
|
|
|
|
+ const blob = new Blob([content], { type: "application/ms-excel" });
|
|
|
|
+ const fileName = "待入库.xlsx";
|
|
|
|
+ if ("download" in document.createElement("a")) {
|
|
|
|
+ // 非IE下载
|
|
|
|
+ const elink = document.createElement("a");
|
|
|
|
+ elink.download = fileName;
|
|
|
|
+ elink.style.display = "none";
|
|
|
|
+ elink.href = URL.createObjectURL(blob);
|
|
|
|
+ document.body.appendChild(elink);
|
|
|
|
+ elink.click();
|
|
|
|
+ URL.revokeObjectURL(elink.href); // 释放URL 对象
|
|
|
|
+ document.body.removeChild(elink);
|
|
|
|
+ } else {
|
|
|
|
+ navigator.msSaveBlob(blob, fileName);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const getSummaries = (param) => {
|
|
|
|
+ const { columns, data } = param; //columns是每列的信息,data是每行的信息
|
|
|
|
+ const sums = [];
|
|
|
|
+ columns.forEach((column, index) => {
|
|
|
|
+ if (index === 0) {
|
|
|
|
+ sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const values = data.map((item) => Number(item[column.property]));
|
|
|
|
+ if (
|
|
|
|
+ column.property === "purchaseQuantity" ||
|
|
|
|
+ column.property === "arrivalQuantity" ||
|
|
|
|
+ column.property === "receiptQuantity" ||
|
|
|
|
+ column.property === "quantity"
|
|
|
|
+ ) {
|
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
|
+ const value = Number(curr);
|
|
|
|
+ if (!isNaN(value)) {
|
|
|
|
+ return Number(parseFloat(prev + curr).toFixed(4));
|
|
|
|
+ } else {
|
|
|
|
+ return prev;
|
|
|
|
+ }
|
|
|
|
+ }, 0);
|
|
|
|
+ sums[index];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return sums;
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.tenant {
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+:deep(.el-table__header-wrapper .el-checkbox) {
|
|
|
|
+ display: none;
|
|
|
|
+}
|
|
|
|
+</style>
|