Browse Source

【调拨订单】调拨订单重构

002390 1 year ago
parent
commit
9e427cbb0c

+ 772 - 0
src/views/purchase/transferOrder/add/columns.js

@@ -0,0 +1,772 @@
+export default function useColumns(type) {
+
+  const FormColumns = [
+    {
+      item: { key: "code", title: "单据号", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        disabled: true,
+      }
+    },
+    {
+      item: { key: "billDate", title: "单据日期", required: true, },
+      attr: {
+        is: "el-date-picker",
+        clearable: true,
+        type: "date",
+        valueFormat: "yyyy-MM-dd",
+      }
+    },
+    {
+      item: { key: "billType", title: "订单类型", required: true, },
+      attr: {
+        is: "el-select",
+        dictName: "sys_allot_billtype",
+        clearable: true,
+      }
+    },
+    // {
+    //   item: { key: "allotType", title: "调拨方式", },
+    //   attr: {
+    //     is: "el-select",
+    //     dictName: "sys_to_type",
+    //     clearable: true,
+    //     disabled: true,
+    //   }
+    // },
+    {
+      item: { key: "status", title: "单据状态", },
+      attr: {
+        is: "el-select",
+        dictName: "sys_status",
+        disabled: true,
+      }
+    },
+    // {
+    //   item: { key: "currencyName", title: "币种", },
+    //   attr: {
+    //     is: "el-popover-select-v2",
+    //     valueKey: "name",
+    //     referName: "CURRENCY_PARAM",
+    //     dataMapping: {
+    //       currency: "id",
+    //     },
+    //     clearable: true,
+    //   }
+    // },
+    {
+      item: { key: "qty", title: "总数量", },
+      attr: {
+        is: "el-input-number",
+        min: 0,
+        disabled: true,
+      }
+    },
+    // {
+    //   item: { key: "accountPath", title: "结算路径", },
+    //   attr: {
+    //     is: "el-input",
+    //     clearable: true,
+    //   }
+    // },
+    // {
+    //   item: { key: "rate", title: "折本汇率", },
+    //   attr: {
+    //     is: "el-input-number",
+    //     max: 10,
+    //     step: 0.1,
+    //     precision: 2,
+    //     disabled: true,
+    //   }
+    // },
+    {
+      item: { key: "customerName", title: "客户", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CUSTOMER_PARAM",
+        dataMapping: {
+          customer: 'id',
+          customerName: 'name',
+        },
+      }
+    },
+    // {
+    //   item: { key: "materialProject", title: "物流项目组", },
+    //   attr: {
+    //     is: "el-select",
+    //     dictName: "sys_project_group",
+    //     clearable: true,
+    //   }
+    // },
+    // {
+    //   item: { key: "liacenterName", title: "利润中心", },
+    //   attr: {
+    //     is: "el-popover-select-v2",
+    //     valueKey: "name",
+    //     referName: "LIACENTER_PARAM",
+    //     dataMapping: {
+    //       liacenter: "id",
+    //     },
+    //     clearable: true,
+    //   }
+    // },
+    // {
+    //   item: { key: "onRouteAffilliation", title: "在途归属", },
+    //   attr: {
+    //     is: "el-input",
+    //     clearable: true,
+    //     disabled: true,
+    //   }
+    // },
+    {
+      item: { key: "remark", title: "备注", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "deliveryInventoryOrgName", title: "调出库存组织", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "ORG_PARAM",
+        dataMapping: {
+          deliveryInventoryOrg: "id",
+        },
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "deliveryWarehouseName", title: "调出仓库", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "WAREHOUSE_PARAM",
+        dataMapping: {
+          deliveryWarehouse: "id",
+        },
+        queryParams: (params) => ({
+          pkOrg: params.deliveryInventoryOrg,
+        }),
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "deliveryDeptName", title: "调出部门", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "DEPT_PARAM",
+        dataMapping: {
+          deliveryDept: "id",
+        },
+        queryParams: (params) => ({
+          // parame
+          drpOrg: params.deliveryInventoryOrg,
+        }),
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "businessPersonalName", title: "调出业务员", },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CONTACTS_PARAM",
+        dataMapping: {
+          businessPersonal: "code",
+        },
+        clearable: true,
+      }
+    },
+
+    {
+      item: { key: "storageInventoryOrgName", title: "调入库存组织", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "ORG_PARAM",
+        dataMapping: {
+          storageInventoryOrg: "id",
+        },
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "storageWarehouseName", title: "调入仓库", required: true, },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "WAREHOUSE_PARAM",
+        dataMapping: {
+          storageWarehouse: "id",
+        },
+        queryParams: (params) => ({
+          pkOrg: params.storageInventoryOrg,
+        }),
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "deliveryCode", title: "调拨出库单号", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+      }
+    },
+    {
+      item: { key: "storageCode", title: "调拨入库单号", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+      }
+    },
+    {
+      item: { key: "ncCode", title: "NC单据号", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+      }
+    },
+    {
+      item: { key: "createByName", title: "制单人", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "createTime", title: "制单日期", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "createByName", title: "创建人", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "createTime", title: "创建时间", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "updateByName", title: "最后修改人", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "updateTime", title: "最后修改时间", },
+      attr: {
+        is: "el-input",
+        disabled: true,
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "isSendWms", title: "同步NC结果", span: 12 },
+      attr: {
+        is: "el-input",
+        type: "textarea",
+        rows: 3,
+        disabled: true,
+        clearable: true,
+      }
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, span: item.span || 6 },
+  }));
+
+  const TabColumns = [
+    // 物料信息
+    {
+      item: { key: "stAllotMaterialList", title: "物料信息" },
+      attr: { value: [] },
+      TableColumns: [
+        {
+          item: { key: "rowno", title: "行号", width: 80, },
+          attr: {}
+        },
+        {
+          item: { key: "materialCode", title: "物料编码", require: true, },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "code",
+            referName: "MATERIAL_PARAM",
+            dataMapping: {
+              material: "id",
+              materialName: "name",
+              specification: "specification",
+              model: "model",
+              unitName: "unitIdName",
+              manufacturer: "manufacturerIdName",
+              originPlace: "originPlace",
+              originPlaceName: "originPlaceName",
+              // unit: "unitId",
+              // mainUnit: "unitId",
+              // mainUnitName: "unitIdName",
+              // marketingApprovalPersonal: "registrant",
+              // production: "productionPermit",
+            },
+            clearable: true,
+          }
+        },
+        {
+          item: { key: "materialName", title: "物料名称", },
+          attr: {}
+        },
+        {
+          item: { key: "qty", title: "数量", require: true, },
+          attr: {
+            is: "el-input-number",
+            min: 0,
+            clearable: true,
+          }
+        },
+        {
+          item: { key: "unitName", title: "单位", },
+          attr: {}
+        },
+        {
+          item: { key: "specification", title: "规格", },
+          attr: {}
+        },
+        {
+          item: { key: "model", title: "型号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufacturer", title: "生产厂家/代理人", },
+          attr: {}
+        },
+        {
+          item: { key: "originPlaceName", title: "产地", },
+          attr: {}
+        },
+        // {
+        //   item: { key: "mainUnitName", title: "主单位", },
+        //   attr: {}
+        // },
+        {
+          item: { key: "storageDeptName", title: "调入部门", require: true, },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "DEPT_PARAM",
+            dataMapping: {
+              storageDept: "id",
+            },
+            clearable: true,
+          }
+        },
+        {
+          item: { key: "producBatch", title: "产品批号", },
+          attr: {
+            // is: "el-popover-select-v2",
+            // valueKey: "name",
+            // referName: "ALLOCATION_PARAM",
+            // dataMapping: {
+            //   storageAllocation: "id",
+            // },
+            // clearable: true,
+          }
+        },
+        // {
+        //   item: { key: "deliveryCode", title: "调拨出库单号", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "storageCode", title: "调拨入库单号", },
+        //   attr: {}
+        // },
+
+        // {
+        //   item: { key: "equation", title: "换算率", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "mainQty", title: "主数量", },
+        //   attr: {
+        //     is: "el-input-number",
+        //     min: 0,
+        //     clearable: true,
+        //   }
+        // },
+        // {
+        //   item: { key: "rate", title: "税率", },
+        //   attr: {}
+        // },
+        {
+          item: { key: "deliveryAllocationName", title: "调出货位", },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "ALLOCATION_PARAM",
+            dataMapping: {
+              deliveryAllocation: "id",
+            },
+            clearable: true,
+          }
+        },
+        {
+          item: { key: "storageAllocationName", title: "调入货位", },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "ALLOCATION_PARAM",
+            dataMapping: {
+              storageAllocation: "id",
+            },
+            clearable: true,
+          }
+        },
+        // {
+        //   item: { key: "manufactureDate", title: "生产日期", },
+        //   attr: {
+        //     is: "el-date-picker",
+        //     type: "date",
+        //     valueFormat: "yyyy-MM-dd",
+        //   }
+        // },
+        // {
+        //   item: { key: "periodEndDate", title: "有效期至/失效日期", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "ratifyCode", title: "批准文号", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "registration", title: "注册证号", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "productCode", title: "商品名", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "commonCode", title: "通用名", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "drug", title: "剂型", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "ruleDetail", title: "调入调出结算规则明细", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "marketingApprovalPersonal", title: "上市许可持有人", },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "production", title: "生产许可证号/经营许可证号/备案凭证号", width: 270 },
+        //   attr: {}
+        // },
+        // {
+        //   item: { key: "pi", title: "pi码", },
+        //   attr: {
+
+        //   }
+        // },
+        // {
+        //   item: { key: "classify", title: "类别", },
+        //   attr: {
+
+        //   }
+        // },
+        // {
+        //   item: { key: "customerLogistic", title: "客户物料码", },
+        //   attr: {
+
+        //   }
+        // },
+        // {
+        //   item: { key: "customerLogisticName", title: "客户物料名称", },
+        //   attr: {}
+        // },
+      ]
+    },
+    // 收发货信息
+    {
+      item: { key: "stAllotReceiveDeliverList", title: "收发货信息" },
+      attr: { value: [] },
+      TableColumns: [
+        {
+          item: { key: "rowno", title: "行号", width: 80, },
+          attr: {}
+        },
+        {
+          item: { key: "deliveryCode", title: "调拨出库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "storageCode", title: "调拨入库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufacturer", title: "生产厂家/代理人", },
+          attr: {}
+        },
+        {
+          item: { key: "originPlace", title: "产地", },
+          attr: {}
+        },
+        {
+          item: { key: "classify", title: "类别", },
+          attr: {}
+        },
+        {
+          item: { key: "deliveryWarehouseName", title: "调出仓库", },
+          attr: {}
+        },
+        {
+          item: { key: "storageWarehouseName", title: "调入仓库", },
+          attr: {}
+        },
+        {
+          item: { key: "businessPersonalName", title: "调入业务员", },
+          attr: {}
+        },
+        {
+          item: { key: "productBatch", title: "产品批号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufactureDate", title: "生产日期", },
+          attr: {}
+        },
+        {
+          item: { key: "periodEndDate", title: "有效期至/失效日期", },
+          attr: {}
+        },
+        {
+          item: { key: "ratifyCode", title: "批准文号", },
+          attr: {}
+        },
+        {
+          item: { key: "registration", title: "注册证号", },
+          attr: {}
+        },
+        {
+          item: { key: "productCode", title: "商品名", },
+          attr: {}
+        },
+        {
+          item: { key: "commonCode", title: "通用名", },
+          attr: {}
+        },
+        {
+          item: { key: "drug", title: "剂型", },
+          attr: {}
+        },
+        {
+          item: { key: "customerName", title: "收货客户", },
+          attr: {}
+        },
+        {
+          item: { key: "addressaddress", title: "收货地址", },
+          attr: {}
+        },
+        {
+          item: { key: "area", title: "收货地区", },
+          attr: {}
+        },
+        {
+          item: { key: "place", title: "收货地点", },
+          attr: {}
+        },
+        {
+          item: { key: "deliveryDate", title: "计划发货日期", },
+          attr: {}
+        },
+        {
+          item: { key: "strageDate", title: "计划到货日期", },
+          attr: {}
+        },
+        {
+          item: { key: "transportation", title: "运输方式", },
+          attr: {}
+        },
+        {
+          item: { key: "remark", title: "备注", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogistic", title: "客户物料编码", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogisticName", title: "客户物料名称", },
+          attr: {}
+        },
+
+      ]
+    },
+    // 价格费用
+    {
+      item: { key: "stAllotReceiveExecuteList", title: "价格费用" },
+      attr: { value: [] },
+      TableColumns: [
+        {
+          item: { key: "rowno", title: "行号", width: 80, },
+          attr: {}
+        },
+        {
+          item: { key: "deliveryCode", title: "调拨出库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "storageCode", title: "调拨入库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufacturer", title: "生产厂家/代理人", },
+          attr: {}
+        },
+        {
+          item: { key: "originPlace", title: "产地", },
+          attr: {}
+        },
+        {
+          item: { key: "classify", title: "类别", },
+          attr: {}
+        },
+        {
+          item: { key: "productBatch", title: "产品批号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufactureDate", title: "生产日期", },
+          attr: {}
+        },
+        {
+          item: { key: "periodEndDate", title: "有效期至/失效日期", },
+          attr: {}
+        },
+        {
+          item: { key: "ratifyCode", title: "批准文号", },
+          attr: {}
+        },
+        {
+          item: { key: "registration", title: "注册证号", },
+          attr: {}
+        },
+        {
+          item: { key: "productCode", title: "商品名", },
+          attr: {}
+        },
+        {
+          item: { key: "commonCode", title: "通用名", },
+          attr: {}
+        },
+        {
+          item: { key: "drug", title: "剂型", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogistic", title: "客户物料码", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogisticName", title: "客户物料名称", },
+          attr: {}
+        },
+
+      ]
+    },
+    // 执行结果
+    {
+      item: { key: "stAllotReceiveExpenseList", title: "执行结果" },
+      attr: { value: [] },
+      TableColumns: [
+        {
+          item: { key: "rowno", title: "行号", width: 80, },
+          attr: {}
+        },
+        {
+          item: { key: "deliveryCode", title: "调拨出库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "storageCode", title: "调拨入库单号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufacturer", title: "生产厂家/代理人", },
+          attr: {}
+        },
+        {
+          item: { key: "originPlace", title: "产地", },
+          attr: {}
+        },
+        {
+          item: { key: "classify", title: "类别", },
+          attr: {}
+        },
+        {
+          item: { key: "productBatch", title: "产品批号", },
+          attr: {}
+        },
+        {
+          item: { key: "manufactureDate", title: "生产日期", },
+          attr: {}
+        },
+        {
+          item: { key: "periodEndDate", title: "有效期至/失效日期", },
+          attr: {}
+        },
+        {
+          item: { key: "ratifyCode", title: "批准文号", },
+          attr: {}
+        },
+        {
+          item: { key: "registration", title: "注册证号", },
+          attr: {}
+        },
+        {
+          item: { key: "productCode", title: "商品名", },
+          attr: {}
+        },
+        {
+          item: { key: "commonCode", title: "通用名", },
+          attr: {}
+        },
+        {
+          item: { key: "drug", title: "剂型", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogistic", title: "客户物料码", },
+          attr: {}
+        },
+        {
+          item: { key: "customerLogisticName", title: "客户物料名称", },
+          attr: {}
+        },
+
+      ]
+    },
+
+  ];
+
+  return { FormColumns, TabColumns }
+}

+ 437 - 0
src/views/purchase/transferOrder/add/index.vue

@@ -0,0 +1,437 @@
+<script>
+import useColumns from "./columns";
+import { toOA } from "@/api/purchase/purchaseDemand.js";
+import {
+  addOrder,
+  getOrderDetail,
+  editOrder,
+  submitOrder,
+  againToNC,
+} from "@/api/purchase/transferOrder.js";
+export default {
+  name: "AddTransfer",
+  props: {
+    addType: {
+      type: String,
+      default: "add",
+    },
+    dict: {
+      type: Object,
+    },
+    data: {
+      tyep: Object,
+    },
+  },
+  components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ReservedButton: () => import("../reserved/index.vue"),
+  },
+  data() {
+    const {
+      FormColumns,
+      TabColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = useColumns();
+    const params = this.$init.params([...TabColumns, ...FormColumns]);
+    const rules = this.$init.rules([...TabColumns, ...FormColumns]);
+    return {
+      rules,
+      params,
+      tabName,
+      TabColumns,
+      FormColumns,
+      size: "mini",
+      width: "100%",
+      count: 0,
+      loading: false,
+      visible: false,
+    };
+  },
+  computed: {
+    title: {
+      get() {
+        const { addType } = this.$props;
+        if (addType === "edit") {
+          return "编 辑";
+        } else if (addType === "see") {
+          return "查 看";
+        } else {
+          return "新 增";
+        }
+      },
+      set() {},
+    },
+    tabInfo: {
+      get() {
+        const {
+          stAllotMaterialList,
+          stAllotReceiveDeliverList,
+          stAllotReceiveExecuteList,
+          stAllotReceiveExpenseList,
+        } = this.params;
+        return {
+          stAllotMaterialList: stAllotMaterialList.filter(
+            ({ delFlag }) => delFlag !== "2"
+          ),
+          stAllotReceiveDeliverList,
+          stAllotReceiveExecuteList,
+          stAllotReceiveExpenseList,
+        };
+      },
+      set() {},
+    },
+    tableHeight: {
+      get() {
+        return window.innerHeight - 430;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    setVisible(prop) {
+      this.visible = prop;
+    },
+    //
+    hide() {
+      const {
+        FormColumns,
+        TabColumns,
+        TabColumns: [
+          {
+            item: { key: tabName },
+          },
+        ],
+      } = useColumns();
+      this.params = this.$init.params([...TabColumns, ...FormColumns]);
+      this.tabName = tabName;
+      this.TabColumn = TabColumns;
+      this.$refs["superForm"].clearValidate();
+      this.visible = false;
+      this.$emit("refresh");
+    },
+    //
+    async beforeOpen() {
+      const { data, addType } = this.$props;
+      if (!data.id) {
+        // 新增
+        const { name, nickName } = this.$store.state.user;
+        this.params = {
+          ...this.params,
+          status: "0",
+          createBy: name,
+          createByName: nickName,
+          billDate: new Date().Format("yyyy-MM-dd"),
+          createTime: new Date().Format("yyyy-MM-dd HH:mm:ss"),
+        };
+      } else {
+        await this.fetchItem(data);
+      }
+      // if (addType === "see") {
+      //   const { TabColumns } = useColumns();
+      //   let Columns = _.cloneDeep(TabColumns);
+      //   this.TabColumns = Columns.map((tab, index) => ({
+      //     ...tab,
+      //     TableColumns: tab.TableColumns.map(({ item, attr }) => ({
+      //       item,
+      //       attr: {
+      //         ...attr,
+      //         disabled: true,
+      //       },
+      //     })),
+      //   }));
+      // }
+    },
+    //
+    async fetchItem(prop) {
+      try {
+        this.loading = true;
+        const { addType } = this.$props;
+        const { name, nickName } = this.$store.state.user;
+        let { code, data, msg } = await getOrderDetail(prop.id);
+        if (code == 200) {
+          this.params = {
+            ...data,
+            stAllotReceiveDeliverList: [],
+            stAllotReceiveExecuteList: [],
+            stAllotReceiveExpenseList: [],
+          };
+          // 复制
+          if (addType === "add") {
+            this.params = {
+              ...data,
+              id: "",
+              status: "0",
+              createBy: name,
+              createByName: nickName,
+              billDate: new Date().Format("yyyy-MM-dd"),
+              createTime: new Date().Format("yyyy-MM-dd HH:mm:ss"),
+            };
+          }
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 增行
+    useRowAdd(prop) {
+      const { TableColumns } = this.TabColumns.find(
+        ({ item: { key } }) => key === prop
+      );
+
+      let tabList = this.params[prop];
+      let length = tabList.length;
+
+      this.params[prop].push({
+        ...this.$init.params(TableColumns),
+        delFlag: "0",
+        rowno: length ? Number(tabList[length - 1]["rowno"]) + 10 : length + 10,
+      });
+    },
+    // 删行
+    useRowRemove(prop, { row }) {
+      console.log(row, "row");
+      this.params[prop].forEach((item, index) => {
+        if (item["rowno"] && item["rowno"] == row["rowno"]) {
+          item.id
+            ? (item["delFlag"] = "2")
+            : this.params[prop].splice(index, 1);
+        }
+      });
+    },
+    // 保存
+    useSave(prop) {
+      console.log(this.params);
+      this.$refs[prop].validate(async (valid, obj) => {
+        if (valid) {
+          try {
+            this.$modal.loading("处理中,请稍后...");
+            const { params, addType } = this;
+            let { code, msg } =
+              addType === "add"
+                ? await addOrder(params)
+                : await editOrder(params);
+            if (code == 200) {
+              this.$notify.success(msg);
+            }
+          } catch (error) {
+          } finally {
+            this.$modal.closeLoading();
+          }
+        } else {
+          let fail = [];
+          for (let key in obj) {
+            fail.push(obj[key][0].message);
+          }
+          this.$notify({
+            message: fail[0],
+            type: "warning",
+          });
+          return false;
+        }
+      });
+    },
+    // 提交
+    useCommit(prop) {},
+  },
+  created() {},
+};
+</script>
+
+<template>
+  <el-drawer
+    v-bind="$attrs"
+    v-on="$listeners"
+    :size="width"
+    :visible.sync="visible"
+    destroy-on-close
+    :show-close="false"
+    @close="hide"
+    @open="beforeOpen"
+    v-loading="loading"
+  >
+    <div
+      slot="title"
+      style="display: flex; justify-content: space-between; align-items: center"
+    >
+      <h3>{{ title }}</h3>
+      <div>
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSave('superForm')"
+          >保 存</el-button
+        >
+        <el-button
+          v-show="addType === 'see'"
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useCommit('superForm')"
+          >提 交</el-button
+        >
+
+        <el-button :size="$attrs.size" :loading="loading" @click="hide"
+          >取 消</el-button
+        >
+      </div>
+    </div>
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="$attrs.size"
+      :columns="FormColumns"
+      ref="superForm"
+      label-width="auto"
+      label-position="right"
+      style="padding: 20px"
+      :disabled="addType === 'see'"
+    >
+      <!-- <template slot="puOrgName" slot-scope="scope">
+        <component
+          v-bind="scope.attr"
+          v-model="scope.row[scope.item.key]"
+          :size="$attrs.size"
+          :source.sync="scope.row"
+        >
+        </component
+      ></template> -->
+    </el-super-form>
+
+    <div style="position: relative">
+      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+        <el-tab-pane
+          v-for="({ item, TableColumns: columns }, index) in TabColumns"
+          :key="index"
+          :label="item.title"
+          :name="item.key"
+          lazy
+        >
+          <el-super-ux-table
+            v-model="tabInfo[item.key]"
+            index
+            :dict="dict"
+            :ref="tabName"
+            :columns="columns"
+            :size="$attrs.size"
+            :height="tableHeight"
+          >
+            <!-- 物料编码 -->
+            <template slot="materialCode" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see'"
+              >
+              </component>
+            </template>
+            <!-- 数量 -->
+            <template slot="qty" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see'"
+              >
+              </component>
+            </template>
+            <!-- 调入部门 -->
+            <template slot="storageDeptName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see'"
+                :queryParams="
+                  () => ({
+                    drpOrg: params.storageInventoryOrg,
+                  })
+                "
+              >
+              </component>
+            </template>
+            <!-- 调出货位 -->
+            <template slot="deliveryAllocationName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see'"
+              >
+              </component>
+            </template>
+            <!-- 调入货位 -->
+            <template slot="storageAllocationName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see'"
+              >
+              </component>
+            </template>
+            <ux-table-column
+              v-if="tabName === 'stAllotMaterialList'"
+              fixed="right"
+              title="操作"
+              width="80"
+              align="center"
+            >
+              <template slot="header" slot-scope="scope">
+                <el-button
+                  type="text"
+                  :size="$attrs.size"
+                  :disabled="addType === 'see'"
+                  @click="useRowAdd(tabName)"
+                >
+                  增行
+                </el-button>
+              </template>
+              <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  :size="$attrs.size"
+                  :disabled="addType === 'see'"
+                  @click.native.prevent="useRowRemove(tabName, scope)"
+                >
+                  删除
+                </el-button>
+              </template>
+            </ux-table-column>
+          </el-super-ux-table>
+        </el-tab-pane>
+      </el-tabs>
+
+      <div style="position: absolute; top: 5px; right: 20px">
+        <reserved-button
+          v-show="addType === 'see'"
+          type="primary"
+          :info="data"
+          :size="$attrs.size"
+        />
+      </div>
+    </div>
+  </el-drawer>
+</template>
+
+<style scoped>
+>>> .el-drawer__header {
+  margin-bottom: 0;
+  padding: 5px 20px;
+}
+</style>

+ 138 - 168
src/views/purchase/transferOrder/index.vue

@@ -1,125 +1,122 @@
 <template>
-  <div id="transferOrder">
-    <div v-if="isList">
-      <el-card style="position: relative" v-loading="loading">
-        <el-super-search
-          v-model="params"
-          :size="size"
-          :dict="dict"
-          :columns="SearchColumns"
-          @reset="resetList"
-          @submit="getList(params, Pages)"
-        ></el-super-search>
+  <el-card
+    v-loading="loading"
+    style="width: calc(100% - 24px); height: 100%; margin: 10px; padding: 10px"
+    :body-style="{ padding: 0 }"
+  >
+    <el-super-search
+      v-model="params"
+      :size="size"
+      :dict="dict"
+      :columns="SearchColumns"
+      @reset="resetList"
+      @submit="getList(params, page)"
+    ></el-super-search>
 
-        <el-row class="my-4" style="text-align: right">
-          <el-button-group style="margin-right: 5px">
-            <el-button type="primary" :size="size" @click="addOrder"
-              >新增</el-button
-            >
-          </el-button-group>
-          <BatchImport
-            ref="batchImport"
-            @import="onUpload"
-            @temDownload="useImportTemplate"
-            :fileSize="2"
-          ></BatchImport>
-        </el-row>
+    <el-row :gutter="24" type="flex" justify="end" style="margin: 20px 0 12px">
+      <el-col :span="24" style="text-align: right">
+        <el-button-group style="margin-right: 5px">
+          <el-button type="primary" :size="size" @click="addOrder"
+            >新增</el-button
+          >
+        </el-button-group>
+        <BatchImport
+          ref="batchImport"
+          @import="onUpload"
+          @temDownload="useImportTemplate"
+          :fileSize="2"
+        ></BatchImport>
+      </el-col>
+    </el-row>
+
+    <el-super-ux-table
+      v-model="tableList"
+      :size="size"
+      :dict="dict"
+      :page="page"
+      :columns="TableColumns"
+      index
+      pagination
+      :height="400"
+      showSummary
+      convenitentOperation
+      storage-key="TransferOrderSuperTable"
+      @row-click="select"
+      @row-dblclick="useSee"
+      @pagination="getList(params, page)"
+    >
+      <ux-table-column fixed="right" title="操作" align="center" width="160">
+        <template slot-scope="scope">
+          <el-button type="text" :size="size" @click="useSee(scope.row)"
+            >查看</el-button
+          >
+          <el-button
+            type="text"
+            :size="size"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            @click="useEdit(scope.row)"
+            >编辑</el-button
+          >
+          <el-button
+            type="text"
+            :size="size"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            @click="commit(scope.row)"
+            >提交</el-button
+          >
+          <el-button
+            type="text"
+            :size="size"
+            v-if="scope.row.status == '1'"
+            @click="handleBack(scope.row)"
+            >流程收回</el-button
+          >
+          <el-button
+            type="text"
+            :size="size"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            @click="deleteids(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </ux-table-column>
+    </el-super-ux-table>
 
+    <el-tabs v-model="tabName" style="width: 100%; padding: 0px 10px">
+      <el-tab-pane
+        v-for="({ item, TableColumns: columns }, index) in TabColumns"
+        :key="index"
+        :label="item.title"
+        :name="item.key"
+      >
         <el-super-ux-table
-          v-model="tableList"
+          v-model="tabParams[item.key]"
+          v-loading="itemLoading"
+          index
+          :ref="tabName"
+          :height="tabHeight"
+          :columns="columns"
           :size="size"
           :dict="dict"
-          :page="Pages"
-          :columns="TableColumns"
-          index
-          pagination
-          height="400"
-          showSummary
-          convenitentOperation
-          storage-key="TransferOrderSuperTable"
-          @row-click="select"
-          @row-dblclick="doubleClick"
-          @pagination="getList(params, Pages)"
-        >
-          <ux-table-column
-            fixed="right"
-            title="操作"
-            align="center"
-            width="160"
-          >
-            <template slot-scope="scope">
-              <el-button type="text" :size="size" @click="check(scope.row)"
-                >查看</el-button
-              >
-              <el-button
-                type="text"
-                :size="size"
-                v-if="scope.row.status == '0' || scope.row.status == '3'"
-                @click="edit(scope.row)"
-                >编辑</el-button
-              >
-              <el-button
-                type="text"
-                :size="size"
-                v-if="scope.row.status == '0' || scope.row.status == '3'"
-                @click="commit(scope.row)"
-                >提交</el-button
-              >
-              <el-button
-                type="text"
-                :size="size"
-                v-if="scope.row.status == '1'"
-                @click="handleBack(scope.row)"
-                >流程收回</el-button
-              >
-              <el-button
-                type="text"
-                :size="size"
-                v-if="scope.row.status == '0' || scope.row.status == '3'"
-                @click="deleteids(scope.row)"
-                >删除</el-button
-              >
-            </template>
-          </ux-table-column>
-        </el-super-ux-table>
-
-        <el-tabs v-model="tabName" style="margin-top: 10px">
-          <el-tab-pane
-            v-for="({ item, TableColumns: columns }, index) in TabColumns"
-            :key="index"
-            :label="item.title"
-            :name="item.key"
-            lazy
-          >
-            <el-super-ux-table
-              v-loading="itemLoading"
-              index
-              v-model="tabParams[item.key]"
-              :ref="tabName"
-              :height="tabHeight"
-              :columns="columns"
-              :size="size"
-            ></el-super-ux-table>
-          </el-tab-pane>
-        </el-tabs>
-      </el-card>
-    </div>
+        ></el-super-ux-table>
+      </el-tab-pane>
+    </el-tabs>
 
-    <Add
-      v-model="isList"
-      v-if="!isList"
-      :pageStu="page"
-      :disable="disable"
-      :row="rowDetail"
-      @refresh="getList(params, Pages)"
-    />
-  </div>
+    <add-transfer
+      ref="AddTransfer"
+      :data="rowDetail"
+      :size="size"
+      :dict="dict"
+      :addType="pageStu"
+      @refresh="getList(params, page)"
+    >
+    </add-transfer>
+  </el-card>
 </template>
 
 <script>
 import useColumns from "./columns";
 import { dicts } from "./dicts";
-import Add from "./add.vue";
 import {
   getOrderList,
   delOrder,
@@ -132,47 +129,30 @@ export default {
   name: "transferOrder",
   dicts: [...dicts, "oa_templete_id"],
   components: {
-    Add,
+    AddTransfer: () => import("./add/index.vue"),
     ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
     BatchImport: () => import("@/components/BatchImport/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
   data() {
     const { TableColumns, TabColumns, SearchColumns } = useColumns();
-    const Pages = this.$init.page();
+    const page = this.$init.page();
     const params = this.$init.params(SearchColumns);
     return {
       params: {
         ...params,
         code: this.$route.query.billCode,
       },
-      TableColumns: TableColumns,
-      TabColumns: TabColumns,
-      SearchColumns: SearchColumns,
+      page,
+      TableColumns,
+      TabColumns,
+      SearchColumns,
       tabName: "materialInfo",
       size: "mini",
-      Pages: Pages,
       loading: false,
       itemLoading: false,
-      // 页面配置
-      isList: true,
       // 页面状态
-      page: "",
-      referCondition: {
-        type: "",
-        isPage: true,
-        title: "",
-      },
-      options: [
-        {
-          value: "1",
-          label: "是",
-        },
-        {
-          value: "0",
-          label: "否",
-        },
-      ],
+      pageStu: "",
       tableList: [],
       // total: 0,
       tabParams: {
@@ -202,28 +182,28 @@ export default {
     },
   },
   created() {
-    this.getList(this.params, this.Pages);
+    this.getList(this.params, this.page);
   },
   methods: {
     resetList() {
-      this.Pages = this.$init.page();
+      this.page = this.$init.page();
       const { SearchColumns } = useColumns();
       this.params = {
         ...this.$init.params(SearchColumns),
         code: this.$route.query.billCode,
       };
-      this.getList(this.params, this.Pages);
+      this.getList(this.params, this.page);
     },
-    getList(params, Pages) {
+    getList(params, page) {
       this.loading = true;
       getOrderList({
         ...this.addDateRange(params, params.billDates),
-        ...Pages,
+        ...page,
       })
         .then((res) => {
           if (res.code === 200) {
             this.tableList = res.rows;
-            this.Pages.total = res.total;
+            this.page.total = res.total;
           }
           this.loading = false;
         })
@@ -240,28 +220,26 @@ export default {
         this.itemLoading = false;
       });
     },
+    // 新 增
     addOrder() {
-      this.isList = false;
-      this.page = "add";
-      this.disable = false;
-    },
-    check(row) {
-      this.isList = false;
-      this.page = "check";
-      this.rowDetail = row;
-      this.disable = true;
+      const { setVisible } = this.$refs.AddTransfer;
+      setVisible(true);
+      this.pageStu = "add";
+      this.rowDetail = {};
     },
-    doubleClick(row) {
-      this.isList = false;
-      this.page = "check";
+    // 查 看
+    useSee(row) {
+      const { setVisible } = this.$refs.AddTransfer;
+      setVisible(true);
+      this.pageStu = "see";
       this.rowDetail = row;
-      this.disable = true;
     },
-    edit(row) {
-      this.isList = false;
-      this.page = "edit";
+    // 编 辑
+    useEdit(row) {
+      const { setVisible } = this.$refs.AddTransfer;
+      setVisible(true);
+      this.pageStu = "edit";
       this.rowDetail = row;
-      this.disable = false;
     },
     commit(row) {
       this.$modal.loading("提交中...");
@@ -270,7 +248,7 @@ export default {
           if (res.code === 200) {
             this.$modal.closeLoading();
             this.$modal.notifySuccess("提交成功");
-            this.getList(this.params, this.Pages);
+            this.getList(this.params, this.page);
           }
         })
         .catch((err) => {
@@ -290,7 +268,7 @@ export default {
           delOrder(row.id).then((res) => {
             if (res.code === 200) {
               this.$modal.notifySuccess("删除成功");
-              this.getList(this.params, this.Pages);
+              this.getList(this.params, this.page);
             }
           });
         })
@@ -341,17 +319,9 @@ export default {
       } catch (err) {
         console.error(err);
       } finally {
-        this.getList(this.params, this.Pages);
+        this.getList(this.params, this.page);
       }
     },
   },
 };
 </script>
-
-<style lang="scss" scoped>
-#transferOrder {
-  padding: 12px;
-  box-sizing: border-box;
-  overflow-y: scroll;
-}
-</style>

+ 26 - 11
src/views/purchase/transferOrder/reserved/index.vue

@@ -1,6 +1,18 @@
 <template>
-  <div class="reserved">
-    <el-dialog :visible.sync="visible" :before-close="handleClose" width="70%">
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :size="$attrs.size"
+    @click="useClick"
+  >
+    {{ title }}
+    <el-dialog
+      :visible.sync="visible"
+      :before-close="handleClose"
+      width="70%"
+      append-to-body
+      @open="useOpen"
+    >
       <el-descriptions
         class="margin-top"
         title="货权预留单"
@@ -39,7 +51,7 @@
         </template>
       </el-super-ux-table>
     </el-dialog>
-  </div>
+  </el-button>
 </template>
 
 <script>
@@ -52,26 +64,23 @@ export default {
     ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
   },
   props: {
-    isVisible: {
-      type: Boolean,
-      default: false,
-    },
     info: {
       type: Object,
       default: null,
     },
   },
   mounted() {
-    this.getDetails(this.info);
+    // this.getDetails(this.info);
   },
   data() {
     const { desColumns, itemsColumns, historyColumns } = useColumns();
     return {
+      title: "货权预留单",
       size: "mini",
       desColumns: desColumns,
       itemsColumns: itemsColumns,
       historyColumns: historyColumns,
-      visible: this.isVisible,
+      visible: false,
       resData: {},
       items: [],
       historyItems: [],
@@ -79,6 +88,12 @@ export default {
     };
   },
   methods: {
+    useClick() {
+      this.visible = true;
+    },
+    useOpen() {
+      this.getDetails(this.info);
+    },
     getDetails(row) {
       getDetailBySource(row.code).then((res) => {
         if (res.code === 200) {
@@ -93,8 +108,8 @@ export default {
         }
       });
     },
-    handleClose() {
-      this.$emit("updateReserved", false);
+    handleClose(done) {
+      done();
     },
     rowClick(row) {
       this.showHistoryItems = this.historyItems.filter(