heshaofeng
2025-12-26 32898366256ac7a99c4ecdd094e05e54f8a7e621
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue
@@ -1,39 +1,16 @@
<template>
  <view-grid
    ref="grid"
        @openOutboundDialog="handleOpenOutboundDialog"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  <view-grid ref="grid" @openOutboundDialog="handleOpenOutboundDialog" :columns="columns" :detail="detail"
    :editFormFields="editFormFields" :editFormOptions="editFormOptions" :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions" :table="table" :extend="extend">
  </view-grid>
      <!-- å‡ºåº“操作弹窗 -->
    <OutboundDialog
      v-model:visible="outboundVisible"
      :selected-document="selectedOutboundDocument"
      @outbound-success="handleOutboundSuccess"
    ></OutboundDialog>
</template>
    <script>
<script>
import extend from "@/extension/outbound/outboundOrder.js";
import ViewGrid from '@/components/basic/ViewGrid/ViewGrid.vue';
import { ref, defineComponent } from "vue";
import { ElMessage } from "element-plus";
import OutboundDialog from "@/extension/outbound/extend/OutBound.vue";  // å¼•入出库弹窗组件
export default defineComponent({
   components: {
    // å…³é”®ä¿®å¤2:组件注册名与模板标签名适配(kebab-case对应view-grid)
    viewGrid: ViewGrid,  // æ³¨å†Œä¸ºkebab-case,模板用<view-grid>
    OutboundDialog  // æ³¨å†Œå‡ºåº“弹窗组件
  },
  setup() {
    const table = ref({
      key: "id",
@@ -45,28 +22,20 @@
    });
    const editFormFields = ref({
      orderType: "",
      orderNo:"",
      orderNo: "",
      upperOrderNo: "",
      orderStatus: "",
      remark: "",
      warehouseId:""
      warehouseId: ""
    });
    const editFormOptions = ref([
      [
        {
          title: "单据类型",
          required: true,
          field: "orderType",
          type: "select",
          dataKey: "outOrderType",
          data: [],
          field: "orderNo",
          title: "单据编号",
          type: "string",
          readonly: true
        },
        {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        readonly:true
      },
        {
          title: "上游单据编号",
          field: "upperOrderNo",
@@ -81,17 +50,40 @@
          readonly: true,
        },
        {
          title: "仓库",
          field: "warehouseId",
          type: "select",
          dataKey: "warehouses",
          data: [],
          required: true,
          title: "厂区",
          field: "factoryArea",
          type: "string",
        },
      ],
      [
        {
          title: "备注",
          field: "remark",
          type: "textarea",
        },
        {
          title: "业务类型",
          field: "businessType",
          type: "select",
          dataKey: "businessType",
          data: [],
          require: true,
        },
        {
          title: "是否分批",
          field: "isBatch",
          type: "select",
          dataKey: "enable",
          data: [],
          require: true,
        },
        {
          title: "操作者",
          field: "operator",
          type: "string",
          hidden: true,
          readonly: true,
        },
      ],
    ]);
@@ -109,10 +101,10 @@
        { title: "单据编号", field: "orderNo", type: "like" },
        { title: "上游单据编号", field: "upperOrderNo", type: "like" },
        {
          title: "单据类型",
          field: "orderType",
          title: "业务类型",
          field: "businessType",
          type: "select",
          dataKey: "outOrderType",
          dataKey: "documentTypeEmun",
          data: [],
        },
        {
@@ -147,20 +139,11 @@
        align: "left",
      },
      {
        field: "warehouseId",
        title: "仓库",
        type: "string",
        width: 90,
        align: "left",
        bind:{key: "warehouses", data: []}
      },
      {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        width: 160,
        align: "left",
        // link: true,
      },
      {
        field: "upperOrderNo",
@@ -176,6 +159,15 @@
        width: 150,
        align: "left",
        bind: { key: "outOrderType", data: [] },
        hidden: true
      },
      {
        field: "businessType",
        title: "业务类型",
        type: "string",
        width: 150,
        align: "left",
        bind: { key: "businessType", data: [] },
      },
      {
        field: "orderStatus",
@@ -194,18 +186,45 @@
        bind: { key: "createType", data: [] },
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 180,
        align: "left"
      },
      {
        field: "returnToMESStatus",
        title: "回传MES状态",
        width: 120,
        bind: { key: "createType", data: [{ key: 0, value: "未回传" }, { key: 1, value: "已回传成功" }, { key: 2, value: "回传失败" }] },
      },
      {
        field: "factoryArea",
        title: "厂区",
        type: "string",
        width: 120,
        align: "left"
      },
      {
        field: "departmentCode",
        title: "修改时间",
        type: "string",
        width: 120,
        align: "left",
        hidden:true
        hidden: true
      },
      {
        field: "departmentName",
        title: "部门名称",
        type: "string",
        width: 160,
        align: "left",
      },
      {
        field: "operator",
        title: "操作人",
        type: "string",
        width: 120,
        align: "left",
      },
      {
@@ -236,17 +255,10 @@
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
      },
    ]);
    const detail = ref({
      cnName: "出库明细单",
      table: "OnboundOrderDetail",
      table: "Details",
      columns: [
        {
          field: "id",
@@ -290,7 +302,14 @@
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "supplyCode",
          title: "供应商编号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "string" },
        },
        {
          field: "orderQuantity",
@@ -302,13 +321,22 @@
          required: true,
        },
        {
          field: "rowNo",
          field: "lineNo",
          title: "行号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
          readonly: true
        },
        {
          field: "rowNo",
          title: "行号2",
          type: "int",
          width: 90,
          align: "left",
          edit: { type: "number" },
          readonly: true
        },
        {
          field: "lockQuantity",
@@ -330,7 +358,9 @@
          type: "string",
          width: 180,
          align: "left",
          edit: { type: "select" },
          bind: { key: "orderDetailStatusEnum", data: [] },
          readonly: true
        },
        {
          field: "creater",
@@ -371,41 +401,6 @@
      sortName: "id",
      key: "id",
    });
      // å‡ºåº“弹窗相关
    const outboundVisible = ref(false);
    const selectedOutboundDocument = ref({});  // å­˜å‚¨é€‰ä¸­çš„出库单数据
    // æ‰“开出库弹窗(从扩展配置的按钮事件触发)
    const handleOpenOutboundDialog = (docData) => {
      selectedOutboundDocument.value = docData;  // ä¿å­˜é€‰ä¸­çš„单据数据
      outboundVisible.value = true;  // æ˜¾ç¤ºå¼¹çª—
    };
    // å‡ºåº“成功后的回调
    const handleOutboundSuccess = (docNo) => {
      ElMessage.success(`单据 ${docNo} å‡ºåº“成功`);
      gridRef.value?.refresh();  // åˆ·æ–°è¡¨æ ¼æ•°æ®
    };
    // åˆå§‹åŒ–扩展配置:为出库按钮添加事件触发逻辑
    const initExtension = () => {
      // æ‰¾åˆ°"出库"按钮并绑定打开弹窗的逻辑
      const outboundBtn = extend.buttons.view.find(btn => btn.name === '出库');
      if (outboundBtn) {
        const originalOnClick = outboundBtn.onClick;
        outboundBtn.onClick = function() {
          // å…ˆæ‰§è¡ŒåŽŸæœ‰æ ¡éªŒé€»è¾‘
          const selectedRows = this.$refs.table.getSelected();
          if (selectedRows.length === 1) {
            // æ ¡éªŒé€šè¿‡åŽï¼Œè§¦å‘主组件的出库弹窗事件
            this.$emit('openOutboundDialog', selectedRows[0]);
          } else {
            // åŽŸæœ‰é€»è¾‘å·²å¤„ç†æç¤ºï¼Œæ— éœ€é‡å¤
            originalOnClick.call(this);
          }
        };
      }
    };
    return {
      table,
      extend,
@@ -415,11 +410,6 @@
      searchFormOptions,
      columns,
      detail,
       // å‡ºåº“相关
      outboundVisible,
      selectedOutboundDocument,
      handleOpenOutboundDialog,
      handleOutboundSuccess
    };
  },
});