647556386
3 天以前 696edbff3c8812e4b820f624d66a02ae6ddb1a06
ÏîÄ¿´úÂë/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,20 +22,20 @@
    });
    const editFormFields = ref({
      orderType: "",
      orderNo:"",
      orderNo: "",
      upperOrderNo: "",
      orderStatus: "",
      remark: "",
      warehouseId:""
      warehouseId: ""
    });
    const editFormOptions = ref([
      [
        {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        readonly:true
      },
          field: "orderNo",
          title: "单据编号",
          type: "string",
          readonly: true
        },
        {
          title: "上游单据编号",
          field: "upperOrderNo",
@@ -104,6 +81,9 @@
          title: "操作者",
          field: "operator",
          type: "string",
          hidden: true,
          readonly: true,
        },
      ],
    ]);
@@ -121,12 +101,11 @@
        { title: "单据编号", field: "orderNo", type: "like" },
        { title: "上游单据编号", field: "upperOrderNo", type: "like" },
        {
          title: "单据类型",
          field: "orderType",
          title: "业务类型",
          field: "businessType",
          type: "select",
          dataKey: "outOrderType",
          dataKey: "outboundbusinessType",
          data: [],
          hidden:true
        },
        {
          title: "单据状态",
@@ -138,13 +117,14 @@
      ],
      [
        {
          title: "创建方式",
          field: "createType",
          title: "回传MES状态",
          field: "returnToMESStatus",
          type: "select",
          dataKey: "createType",
          dataKey: "outboundReturnToMESStatus",
          data: [],
        },
        { title: "创建者", field: "creater", type: "like" },
        { title: "物料编号", field: "materielCode", type: "like" },
        { title: "拉线名称", field: "departmentName", type: "like" },
        { title: "创建时间", field: "createDate", type: "datetime" },
      ],
    ]);
@@ -165,7 +145,6 @@
        type: "string",
        width: 160,
        align: "left",
        link: true,
      },
      {
        field: "upperOrderNo",
@@ -181,7 +160,7 @@
        width: 150,
        align: "left",
        bind: { key: "outOrderType", data: [] },
        hidden:true
        hidden: true
      },
      {
        field: "businessType",
@@ -208,8 +187,28 @@
        bind: { key: "createType", data: [] },
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 180,
        align: "left"
      },
      {
        field: "returnToMESStatus",
        title: "回传MES状态",
        width: 120,
        bind: { key: "outboundReturnToMESStatus", data: [{ key: 0, value: "未回传" }, { key: 1, value: "已回传成功" }, { key: 2, value: "回传失败" },{ key: 3, value: "部分回传成功" },{ key: 4, value: "部分回传失败" },{ key: 5, value: "无需回传" }] },
      },
      {
        field: "factoryArea",
        title: "厂区",
        type: "string",
        width: 120,
        align: "left"
      },
      {
        field: "departmentName",
        title: "拉线名称",
        type: "string",
        width: 120,
        align: "left"
@@ -220,13 +219,13 @@
        type: "string",
        width: 120,
        align: "left",
        hidden:true
        hidden: true
      },
      {
        field: "departmentName",
        title: "部门名称",
        field: "operator",
        title: "操作人",
        type: "string",
        width: 160,
        width: 120,
        align: "left",
      },
      {
@@ -235,6 +234,7 @@
        type: "string",
        width: 90,
        align: "left",
        hidden: true,
      },
      {
        field: "createDate",
@@ -244,7 +244,7 @@
        align: "left",
      },
      {
        field: "modifier",
        field: "operator",
        title: "修改人",
        type: "string",
        width: 100,
@@ -255,13 +255,6 @@
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
      },
    ]);
@@ -311,7 +304,6 @@
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "supplyCode",
@@ -320,7 +312,6 @@
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "orderQuantity",
@@ -332,12 +323,40 @@
          required: true,
        },
        {
          field: "unit",
          title: "库存单位",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "barcodeUnit",
          title: "出库单位",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "warehouseCode",
          title: "仓库编号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "lineNo",
          title: "行号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          readonly: true
        },
        {
          field: "rowNo",
@@ -346,6 +365,7 @@
          width: 90,
          align: "left",
          edit: { type: "number" },
          readonly: true
        },
        {
          field: "lockQuantity",
@@ -369,7 +389,7 @@
          align: "left",
          edit: { type: "select" },
          bind: { key: "orderDetailStatusEnum", data: [] },
          required: true,
          readonly: true
        },
        {
          field: "creater",
@@ -410,41 +430,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,
@@ -454,11 +439,6 @@
      searchFormOptions,
      columns,
      detail,
       // å‡ºåº“相关
      outboundVisible,
      selectedOutboundDocument,
      handleOpenOutboundDialog,
      handleOutboundSuccess
    };
  },
});