1
huangxiaoqiang
2025-12-24 61567f0d7ee950c518c8342dd03a233917589f79
1
已修改4个文件
865 ■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js 286 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue 354 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js
@@ -1,9 +1,5 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import http from '@/api/http.js'
import { h,createVNode, render,reactive ,ref } from 'vue';
import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect, ElOption} from 'element-plus';
import gridBody from './extend/newAllocateOrderDetail.vue'
let extension = {
    components: {
@@ -17,287 +13,7 @@
      modelFooter: ''
    },
    tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
    buttons: { view: [
       /* {
        name: '出库',
        type: 'primary',
        value: '出库',
        onClick: function () { // ä¿®å¤ï¼šç”¨ElMessage替代this.$message
          const selectedRows = this.$refs.table.getSelected();
          if (selectedRows.length === 0) {
            ElMessage.warning('请先选择要生成任务的行');
            return;
          }
          if (selectedRows.length > 1) {
            ElMessage.warning('只能选择一行');
            return;
          }
          // æ‰€æœ‰æ ¡éªŒé€šè¿‡ï¼Œè§¦å‘主组件打开出库弹窗
          console.log('所有校验通过,触发openOutboundDialog事件,单据数据:', selectedRows[0]);
          this.$emit('openOutboundDialog', {
            transNo: selectedRows[0].transNo,       // å‡ºåº“单编号
            createDate: selectedRows[0].createDate || new Date().toLocaleDateString()  // å‡ºåº“日期
          });
        }
      }, */
      {
  name: '空托盘出库',
  type: 'primary',
  value: '空托盘出库',
  onClick: function () {
    const platformOptions = Array.from({ length: 1 }, (_, i) => {
      const num = 1;
      return { label: `站台${num}`, value: `1-2` };
    });
    const quantityOptions = Array.from({ length: 6 }, (_, i) => ({
      label: (i + 1).toString(),
      value: i + 1
    }));
    const warehouseOptions = ref([]);
    const isLoadingWarehouses = ref(false);
    const getWarehouseList = async () => {
      isLoadingWarehouses.value = true;
      try {
        const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes');
        if (status && Array.isArray(data)) {
          // æ ¼å¼åŒ–仓库选项:适配ElSelect的label-value格式
          warehouseOptions.value = data.map(item => ({
            label: item.locationTypeDesc,
            value: item.locationType
          }));
        } else {
          ElMessage.error('获取区域列表失败');
          warehouseOptions.value = [];
        }
      } catch (err) {
        ElMessage.error('区域数据请求异常,请稍后重试');
        warehouseOptions.value = [];
      } finally {
        isLoadingWarehouses.value = false;
      }
    };
    const mountNode = document.createElement('div');
    document.body.appendChild(mountNode);
    const formData = reactive({
      warehouseCode:'',
      palletCode: '',
      selectedPlatform: platformOptions[0].value,
      quantity:1
    });
    const vnode = createVNode(ElDialog, {
      title: '空托盘出库',
      width: '500px',
      modelValue: true,
      appendToBody: true,
      onOpened: async () => {
        await getWarehouseList();
        const inputRef = vnode.component.refs.boxCodeInput;
        inputRef?.focus();
      },
      'onUpdate:modelValue': (isVisible) => {
        if (!isVisible) {
          render(null, mountNode);
          document.body.removeChild(mountNode);
        }
      },
      style: {
        padding: '20px 0',
        borderRadius: '8px'
      }
    }, {
      default: () => h(ElForm, {
        model: formData,
        rules: {
          warehouseCode:[
            { required: true, message: '请选择区域', trigger: ['change', 'blur'] }
          ],
          palletCode: [
            { type: 'string', message: '料箱号必须为字符串', trigger: 'blur' }
          ],
          selectedPlatform: [
            { required: true, message: '请选择出库站台', trigger: 'change' }
          ],
          quantity:[
            { required: true, message: '请选择空箱数量', trigger: 'change'}
          ]
        },
        ref: 'batchOutForm',
        labelWidth: '100px',
        style: {
          padding: '0 30px',
        }
       },
       [
      //   h(ElFormItem, {
      //     label: '仓库区域',
      //     prop: 'warehouseCode',
      //     style: {
      //       marginBottom: '24px'
      //     }
      //   }, [
      //     h(ElSelect, {
      //       placeholder: '请选择仓库区域',
      //       modelValue: formData.warehouseCode,
      //       'onUpdate:modelValue': (val) => {
      //         formData.warehouseCode = val;
      //       },
      //       style: {
      //         width: '100%',
      //         height: '40px',
      //         borderRadius: '4px',
      //         borderColor: '#dcdfe6'
      //       }
      //     }, warehouseOptions.value.map(platform =>
      //       h(ElOption, { label: platform.label, value: platform.value })
      //     ))
      //   ]),
        h(ElFormItem, {
          label: '出库站台',
          prop: 'selectedPlatform',
          style: {
            marginBottom: '24px'
          }
        }, [
          h(ElSelect, {
            placeholder: '请选择出库站台',
            modelValue: formData.selectedPlatform,
            'onUpdate:modelValue': (val) => {
              formData.selectedPlatform = val;
            },
            style: {
              width: '100%',
              height: '40px',
              borderRadius: '4px',
              borderColor: '#dcdfe6'
            }
          }, platformOptions.map(platform =>
            h(ElOption, { label: platform.label, value: platform.value })
          ))
        ]),
      //   h(ElFormItem,{
      //     label:'出库数量',
      //     prop:'quantity',
      //     style:{
      //       marginBottom:'24px'
      //     }
      //   },[h(ElSelect,{
      //     placeholder:'请选择空箱数量',
      //     modelValue:formData.quantity,
      //     'onUpdate:modelValue':(val)=>{
      //       formData.quantity=val;
      //     },
      //     style:{
      //       width:'100%',
      //       height:'40px',
      //       borderRadius:'4px',
      //       borderColor:'#dcdfe6'
      //     },
      //     filterable:false
      //   },
      //   quantityOptions.map(option=>
      //     h(ElOption,{
      //       label:option.label,
      //       value:option.value
      //     })
      //   )
      // )]),
        h(ElFormItem, {
          label: '料箱号',
          prop: 'palletCode',
          style: {
            marginBottom: '16px'
          }
        }, [
          h(ElInput, {
            type: 'text',
            placeholder: '可选输入料箱号,不填则自动分配空料箱',
            modelValue: formData.palletCode,
            'onUpdate:modelValue': (val) => {
              formData.palletCode = val;
            },
            style: {
              width: '100%',
              height: '40px',
              borderRadius: '4px',
              borderColor: '#dcdfe6'
            },
            attrs: {
              placeholderStyle: 'color: #909399;'
            }
          })
        ]),
        h('div', {
          style: {
            textAlign: 'right',
            marginTop: '8px',
            paddingRight: '4px'
          }
        }, [
          h(ElButton, {
            type: 'text',
            onClick: () => {
              render(null, mountNode);
              document.body.removeChild(mountNode);
              ElMessage.info('取消出库操作');
            },
            style: {
              marginRight: '8px',
              color: '#606266'
            }
          }, '取消'),
          h(ElButton, {
            type: 'primary',
            onClick: async () => {
              const formRef = vnode.component.refs.batchOutForm;
              try {
                await formRef.validate();
              } catch (err) {
                return;
              }
              http.post('/api/Task/PalletOutboundTask?palletCode='+formData.palletCode+'&endStation='+formData.selectedPlatform, {
              }).then(({ data, status, message }) => {
                if (status) {
                  ElMessage.success(`出库成功`);
                  this.refresh();
                  render(null, mountNode);
                  document.body.removeChild(mountNode);
                } else {
                  ElMessage.error(message || data?.message || '出库失败');
                }
              }).catch(() => {
                ElMessage.error('请求失败,请稍后重试');
              });
            },
            style: {
              borderRadius: '4px',
              padding: '8px 20px'
            }
          }, '确定')
        ])
      ])
    });
    vnode.appContext = this.$.appContext;
    render(vnode, mountNode);
  }
}
    ], box: [], detail: [] }, //扩展的按钮
    buttons: { view: [], box: [], detail: [] }, //扩展的按钮
    methods: {
       //下面这些方法可以保留也可以删除
      onInit() {  
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue
@@ -55,6 +55,7 @@
    <stock-select ref="child" @parentCall="parentCall"></stock-select>
    <selected-stock ref="selectedStock" @parentCall="parentCall"></selected-stock>
    <NoStockOut ref="NoStockOut" @parentCall="parentCall"></NoStockOut>
    <DirectOutbound ref="DirectOutbound" @parentCall="parentCall"></DirectOutbound>
  </div>
</template>
@@ -64,20 +65,10 @@
import StockSelect from "./StockSelect.vue";
import SelectedStock from "./SelectedStock.vue";
import NoStockOut from "./NoStockOut.vue";
import { h, createVNode, render, reactive } from "vue";
import {
  ElDialog,
  ElForm,
  ElFormItem,
  ElSelect,
  ElOption,
  ElButton,
  ElInput,
  ElMessage,
} from "element-plus";
import DirectOutbound from "./DirectOutbound.vue";
export default {
  components: { VolBox, VolForm, StockSelect, SelectedStock, NoStockOut },
  components: { VolBox, VolForm, StockSelect, SelectedStock, NoStockOut, DirectOutbound },
  data() {
    return {
      row: null,
@@ -327,334 +318,33 @@
      if (this.selection.length === 0) {
        return this.$message.error("请选择单据明细");
      }
      const platformOptions = [
        { label: "站台2", value: "2-1" },
        { label: "站台3", value: "3-1" },
      ];
      const mountNode = document.createElement("div");
      document.body.appendChild(mountNode);
      const formData = reactive({
        selectedPlatform: platformOptions[0].value,
      });
      const vnode = createVNode(
        ElDialog,
        {
          title: "出库操作 - é€‰æ‹©å‡ºåº“站台",
          width: "500px",
          modelValue: true,
          appendToBody: true,
          "onUpdate:modelValue": (isVisible) => {
            if (!isVisible) {
              render(null, mountNode);
              document.body.removeChild(mountNode);
            }
          },
          style: {
            padding: "20px 0",
            borderRadius: "8px",
          },
        },
        {
          default: () =>
            h(
              ElForm,
              {
                model: formData,
                rules: {
                  selectedPlatform: [
                    { required: true, message: "请选择出库站台", trigger: "change" },
                  ],
                },
                ref: "outboundForm",
                labelWidth: "100px",
                style: {
                  padding: "0 30px",
                },
              },
              [
                h(ElFormItem, {
                  label: "出库站台",
                  prop: "selectedPlatform",
                  style: {
                    marginBottom: "24px",
                  },
                }, [
                  h(ElSelect, {
                    placeholder: "请选择出库站台(3-12)",
                    modelValue: formData.selectedPlatform,
                    "onUpdate:modelValue": (val) => {
                      formData.selectedPlatform = val;
                    },
                    style: {
                      width: "100%",
                      height: "40px",
                      borderRadius: "4px",
                      borderColor: "#dcdfe6",
                    },
                  }, platformOptions.map((platform) =>
                    h(ElOption, { label: platform.label, value: platform.value })
                  )),
                ]),
                h("div", {
                  style: {
                    textAlign: "right",
                    marginTop: "8px",
                    paddingRight: "4px",
                  },
                }, [
                  h(ElButton, {
                    type: "text",
                    onClick: () => {
                      render(null, mountNode);
                      document.body.removeChild(mountNode);
                      ElMessage.info("取消出库操作");
                    },
                    style: {
                      marginRight: "8px",
                      color: "#606266",
                    },
                  }, "取消"),
                  h(ElButton, {
                    type: "primary",
                    onClick: async () => {
                      const formRef = vnode.component.refs.outboundForm;
                      try {
                        await formRef.validate();
                      } catch (err) {
                        return;
                      }
                      const keys = this.selection.map((item) => item.id);
                      const requestParams = {
                        detailIds: keys,
                        outboundTargetLocation: formData.selectedPlatform,
                        outboundQuantity: 1,
                        operator: "",
                        orderNo: this.row.orderNo,
                      };
                      this.http
                        .post(
                          "api/Outbound/ProcessPickingOutbound",
                          requestParams,
                          "数据处理中"
                        )
                        .then((x) => {
                          if (!x.status) return ElMessage.error(x.message);
                          ElMessage.success("操作成功");
                          this.showDetialBox = false;
                          this.$emit("parentCall", ($vue) => {
                            $vue.getData();
                          });
                          render(null, mountNode);
                          document.body.removeChild(mountNode);
                        })
                      // .catch(() => {
                      //   ElMessage.error("请求失败,请稍后重试");
                      // });
                    },
                    style: {
                      borderRadius: "4px",
                      padding: "8px 20px",
                    },
                  }, "确定出库"),
                ]),
              ]),
        }
      );
      vnode.appContext = this.$.appContext;
      render(vnode, mountNode);
      const keys = this.selection.map((item) => item.id);
      const requestParams = {
        detailIds: keys,
        outboundQuantity: 1,
        operator: "",
        orderNo: this.row.orderNo,
        isBatch: this.isBatch
      };
      this.$refs.DirectOutbound.open(requestParams);
    },
    outboundbatch() {
      if (this.selection.length === 0) {
        return this.$message.error("请选择单据明细");
      }
      if (this.selection.length > 1) {
        return this.$message.error("只能选择一条单据明细进行分批出库");
      }
      const platformOptions = [
        { label: "站台2", value: "2-1" },
        { label: "站台3", value: "3-1" },
      ];
      const mountNode = document.createElement("div");
      document.body.appendChild(mountNode);
      const formData = reactive({
        selectedPlatform: platformOptions[0].value,
        outboundDecimal: "",
      });
      const keys = this.selection.map((item) => item.id);
      const requestParams = {
        detailIds: keys,
        outboundQuantity: this.selection[0].orderQuantity - this.selection[0].lockQuantity,
        operator: "",
        orderNo: this.row.orderNo,
        isBatch: this.isBatch
      };
      console.log(requestParams);
      this.$refs.DirectOutbound.open(requestParams);
      const vnode = createVNode(
        ElDialog,
        {
          title: "出库操作 - é€‰æ‹©å‡ºåº“站台",
          width: "500px",
          modelValue: true,
          appendToBody: true,
          "onUpdate:modelValue": (isVisible) => {
            if (!isVisible) {
              render(null, mountNode);
              document.body.removeChild(mountNode);
            }
          },
          style: {
            padding: "20px 0",
            borderRadius: "8px",
          },
        },
        {
          default: () =>
            h(
              ElForm,
              {
                model: formData,
                rules: {
                  selectedPlatform: [
                    { required: true, message: "请选择出库站台", trigger: "change" },
                  ],
                  outboundDecimal: [
                    { required: true, message: "请输入小数数值", trigger: "blur" },
                    {
                      validator: (rule, value, callback) => {
                        const decimalReg = /^(([1-9]\d*)|0)(\.\d{1,2})?$/;
                        if (value && !decimalReg.test(value)) {
                          callback(new Error("请输入有效的小数(正数,最多2位小数)"));
                        } else {
                          callback();
                        }
                      },
                      trigger: "blur",
                    },
                  ],
                },
                ref: "outboundForm",
                labelWidth: "100px",
                style: {
                  padding: "0 30px",
                },
              },
              [
                h(ElFormItem, {
                  label: "出库站台",
                  prop: "selectedPlatform",
                  style: {
                    marginBottom: "24px",
                  },
                }, [
                  h(ElSelect, {
                    placeholder: "请选择出库站台(3-12)",
                    modelValue: formData.selectedPlatform,
                    "onUpdate:modelValue": (val) => {
                      formData.selectedPlatform = val;
                    },
                    style: {
                      width: "100%",
                      height: "40px",
                      borderRadius: "4px",
                      borderColor: "#dcdfe6",
                    },
                  }, platformOptions.map((platform) =>
                    h(ElOption, { label: platform.label, value: platform.value })
                  )),
                ]),
                h(ElFormItem, {
                  label: "出库数",
                  prop: "outboundDecimal",
                  style: {
                    marginBottom: "24px",
                  },
                }, [
                  h(ElInput, {
                    type: "number",
                    placeholder: "请输入小数数值(最多2位小数)",
                    modelValue: formData.outboundDecimal,
                    "onUpdate:modelValue": (val) => {
                      formData.outboundDecimal = val;
                    },
                    style: {
                      width: "100%",
                      height: "40px",
                      borderRadius: "4px",
                      borderColor: "#dcdfe6",
                    },
                    step: "0.01",
                    precision: 2,
                    min: 0.01,
                  }),
                ]),
                h("div", {
                  style: {
                    textAlign: "right",
                    marginTop: "8px",
                    paddingRight: "4px",
                  },
                }, [
                  h(ElButton, {
                    type: "text",
                    onClick: () => {
                      render(null, mountNode);
                      document.body.removeChild(mountNode);
                      ElMessage.info("取消分批出库操作");
                    },
                    style: {
                      marginRight: "8px",
                      color: "#606266",
                    },
                  }, "取消"),
                  h(ElButton, {
                    type: "primary",
                    onClick: async () => {
                      const formRef = vnode.component.refs.outboundForm;
                      try {
                        await formRef.validate();
                      } catch (err) {
                        return;
                      }
                      const keys = this.selection.map((item) => item.id);
                      const requestParams = {
                        detailIds: keys,
                        outboundTargetLocation: formData.selectedPlatform,
                        outboundQuantity: formData.outboundDecimal,
                        operator: "",
                        orderNo: this.row.orderNo,
                      };
                      this.http
                        .post(
                          "api/Outbound/ProcessPickingOutbound",
                          requestParams,
                          "数据处理中"
                        )
                        .then((x) => {
                          if (!x.status) return ElMessage.error(x.message);
                          ElMessage.success("操作成功");
                          this.showDetialBox = false;
                          this.$emit("parentCall", ($vue) => {
                            $vue.getData();
                          });
                          render(null, mountNode);
                          document.body.removeChild(mountNode);
                        })
                        .catch(() => {
                          ElMessage.error("请求失败,请稍后重试");
                        });
                    },
                    style: {
                      borderRadius: "4px",
                      padding: "8px 20px",
                    },
                  }, "确定分批出库"),
                ]),
              ]),
        }
      );
      vnode.appContext = this.$.appContext;
      render(vnode, mountNode);
    },
    setCurrent(row) {
      this.$refs.singleTable.setCurrentRow(row);
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue
@@ -1,39 +1,15 @@
<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/allocateoutboundOrder.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,11 +21,11 @@
    });
    const editFormFields = ref({
      orderType: "",
      orderNo:"",
      orderNo: "",
      upperOrderNo: "",
      orderStatus: "",
      remark: "",
      warehouseId:""
      warehouseId: ""
    });
    const editFormOptions = ref([
      [
@@ -62,11 +38,11 @@
          data: [],
        },
        {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        readonly:true
      },
          field: "orderNo",
          title: "单据编号",
          type: "string",
          readonly: true
        },
        {
          title: "上游单据编号",
          field: "upperOrderNo",
@@ -220,7 +196,7 @@
        type: "string",
        width: 120,
        align: "left",
        hidden:true
        hidden: true
      },
      {
        field: "departmentName",
@@ -401,41 +377,41 @@
      sortName: "id",
      key: "id",
    });
      // è°ƒæ‹¨å¼¹çª—相关
    const outboundVisible = ref(false);
    const selectedOutboundDocument = ref({});  // å­˜å‚¨é€‰ä¸­çš„调拨单数据
    // è°ƒæ‹¨å¼¹çª—相关
    // const outboundVisible = ref(false);
    // const selectedOutboundDocument = ref({});  // å­˜å‚¨é€‰ä¸­çš„调拨单数据
    // æ‰“开调拨弹窗(从扩展配置的按钮事件触发)
    const handleOpenOutboundDialog = (docData) => {
      selectedOutboundDocument.value = docData;  // ä¿å­˜é€‰ä¸­çš„单据数据
      outboundVisible.value = true;  // æ˜¾ç¤ºå¼¹çª—
    };
    // // æ‰“开调拨弹窗(从扩展配置的按钮事件触发)
    // const handleOpenOutboundDialog = (docData) => {
    //   selectedOutboundDocument.value = docData;  // ä¿å­˜é€‰ä¸­çš„单据数据
    //   outboundVisible.value = true;  // æ˜¾ç¤ºå¼¹çª—
    // };
    // è°ƒæ‹¨æˆåŠŸåŽçš„å›žè°ƒ
    const handleOutboundSuccess = (docNo) => {
      ElMessage.success(`单据 ${docNo} è°ƒæ‹¨æˆåŠŸ`);
      gridRef.value?.refresh();  // åˆ·æ–°è¡¨æ ¼æ•°æ®
    };
    // // è°ƒæ‹¨æˆåŠŸåŽçš„å›žè°ƒ
    // 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);
          }
        };
      }
    };
    // // åˆå§‹åŒ–扩展配置:为调拨按钮添加事件触发逻辑
    // 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,
@@ -445,11 +421,11 @@
      searchFormOptions,
      columns,
      detail,
       // å‡ºåº“相关
      outboundVisible,
      selectedOutboundDocument,
      handleOpenOutboundDialog,
      handleOutboundSuccess
      // å‡ºåº“相关
      // outboundVisible,
      // selectedOutboundDocument,
      // handleOpenOutboundDialog,
      // handleOutboundSuccess
    };
  },
});
ÏîÄ¿´úÂë/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,9 +81,9 @@
          title: "操作者",
          field: "operator",
          type: "string",
          hidden:true,
          hidden: true,
          readonly: true,
        },
      ],
    ]);
@@ -182,7 +159,7 @@
        width: 150,
        align: "left",
        bind: { key: "outOrderType", data: [] },
        hidden:true
        hidden: true
      },
      {
        field: "businessType",
@@ -219,7 +196,7 @@
        field: "returnToMESStatus",
        title: "回传MES状态",
        width: 120,
        bind: { key: "createType", data:[{key:0, value:"未回传"},{key:1, value:"已回传成功"},{key:2, value:"回传失败"}]},
        bind: { key: "createType", data: [{ key: 0, value: "未回传" }, { key: 1, value: "已回传成功" }, { key: 2, value: "回传失败" }] },
      },
      {
        field: "factoryArea",
@@ -234,7 +211,7 @@
        type: "string",
        width: 120,
        align: "left",
        hidden:true
        hidden: true
      },
      {
        field: "departmentName",
@@ -350,7 +327,7 @@
          width: 90,
          align: "left",
          edit: { type: "number" },
          readonly:true
          readonly: true
        },
        {
          field: "rowNo",
@@ -359,7 +336,7 @@
          width: 90,
          align: "left",
          edit: { type: "number" },
          readonly:true
          readonly: true
        },
        {
          field: "lockQuantity",
@@ -383,7 +360,7 @@
          align: "left",
          edit: { type: "select" },
          bind: { key: "orderDetailStatusEnum", data: [] },
          readonly:true
          readonly: true
        },
        {
          field: "creater",
@@ -424,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,
@@ -468,11 +410,6 @@
      searchFormOptions,
      columns,
      detail,
       // å‡ºåº“相关
      outboundVisible,
      selectedOutboundDocument,
      handleOpenOutboundDialog,
      handleOutboundSuccess
    };
  },
});