廖井涛
2024-03-13 b13c552870d145f287dfd93a502e91cf9efc8ec3
north-glass-erp/northglass-erp/src/views/mm/mainProductStock/OrderAllocation.vue
@@ -11,6 +11,10 @@
import useUserInfoStore from "@/stores/userInfo";
import {ElMessage} from "element-plus";
import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
import { useI18n } from 'vue-i18n'
//语言获取
const { t } = useI18n()
const userStore = useUserInfoStore()
const username = userStore.user.userName
@@ -175,7 +179,7 @@
    body: {
      options: [
        [
          { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
          { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
        ]
      ]
    }
@@ -197,30 +201,30 @@
  },//表头参数
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
    { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
    // { type: 'seq',fixed:"left", title: '自序', width: '80' },
    { type: 'checkbox',fixed:"left", title: t('basicData.check'), width: '80' },
     { type: 'seq',fixed:"left", title: t('basicData.Number'), width: '80' },
    // {title: '操作', width: '80', slots: { default: 'button_slot' },fixed:"left"},
    {field: 'finishedGoodsInventory.orderId', width: '150',title: '销售单号',showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'order.project', width: '120',title: '项目名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'finishedGoodsInventory.orderNumber', width: '120',title: '当前序号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'finishedGoodsInventory.quantityAvailable',width: '140', title: '订单数量'},
    {field: 'orderId', width: '150',title: '调拨单号',editRender: { name: 'input', attrs: { placeholder: '' } }, showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'orderNumber', width:'150', title: '新订序', editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'quantity',width: '120', title: '调拨数量',editRender: { name: 'input', attrs: { placeholder: '' } }},
    {field: 'productId', width: '120',title: '产品编号'},
    {field: 'productName',width: '140', title: '产品名称'},
    {field: 'order.customerId', width: '100',title: '客户编号'},
    {field: 'order.customerName',width: '140', title: '客户名称'},
    {field: 'width', width: '100',title: '宽度'},
    {field: 'height',width: '100', title: '高度'},
    {field: 'finishedGoodsInventory.actualSignalArea',width: '140', title: '单片面积'},
    {field: 'finishedGoodsInventory.area',width: '100', title: '总面积'},
    {field: 'finishedGoodsInventory.storageRegion',width: '100', title: '库存区域'},
    {field: 'finishedGoodsInventory.orderId', width: '150',title: t('order.orderId'),showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'order.project', width: '120',title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'finishedGoodsInventory.orderNumber', width: '120',title: t('order.OrderNum'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'finishedGoodsInventory.quantityAvailable',width: '140', title: t('productStock.totalNumberOfOrders')},
    {field: 'orderId', width: '150',title: t('productStock.newOrderId'),editRender: { name: 'input', attrs: { placeholder: '' } }, showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'orderNumber', width:'150', title: t('productStock.newOrderNumber'), editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'quantity',width: '120', title: t('productStock.transferQuantity'),editRender: { name: 'input', attrs: { placeholder: '' } }},
    {field: 'productId', width: '120',title: t('order.productId')},
    {field: 'productName',width: '140', title: t('order.product')},
    {field: 'order.customerId', width: '100',title: t('customer.customerNumber')},
    {field: 'order.customerName',width: '140', title: t('customer.customerName')},
    {field: 'width', width: '100',title: t('order.width')},
    {field: 'height',width: '100', title: t('order.height')},
    {field: 'finishedGoodsInventory.actualSignalArea',width: '140', title: t('productStock.singlePieceArea')},
    {field: 'finishedGoodsInventory.area',width: '100', title: t('productStock.totalArea')},
    {field: 'finishedGoodsInventory.storageRegion',width: '100', title: t('productStock.inventoryArea')},
  ],//表头按钮
  toolbarConfig: {
    buttons: [
        {'name': '确认调拨',status: 'primary','code':'edit'},
        {'name': '调拨记录','code':'record'}
        {'name': t('productStock.confirmTransfer'),status: 'primary','code':'edit'},
        {'name': t('productStock.transferRecords'),'code':'record'}
    ],
    /*import: false,
   export: true,
@@ -233,7 +237,7 @@
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return `合计`
          return t('basicData.total')
        }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
@@ -258,11 +262,11 @@
            if (selectRecords.length > 0) {
              const errMap = await $grid.validate(selectRecords)
              if (errMap) {
                ElMessage.warning("数据校验失败")
                ElMessage.warning(t('productStock.dataVerificationFailed'))
                return
              }
            } else {
              ElMessage.warning("未选中数据")
              ElMessage.warning(t('productStock.unselectedData'))
              return
            }
@@ -275,7 +279,7 @@
            request.post("/FinishedGoodsInventory/updateFinishedGoodsInventoryAllocate", flowData.value).then((res) => {
              if (res.code == 200) {
                ElMessage.success("调拨成功")
                ElMessage.success(t('productStock.transferSuccessful'))
                router.push({path:'/main/productStock/OrderAllocation',query:{random:Math.random()}})
              } else {
                ElMessage.warning(res.msg)
@@ -337,21 +341,21 @@
/*数据校验*/
const validRules = ref({
  orderId: [
    { required: true, message: '请输入调拨的订单号' }
    { required: true, message: t('productStock.pleaseEnterTheOrderIdForTheTransfer') }
  ],
  orderNumber: [
    { required: true, message: '请输入调拨的订单序号' }
    { required: true, message: t('productStock.pleaseEnterTheOrderNumberForTheTransfer') }
  ],
  quantity: [{
    validator (e) {
      if (e.row.quantity > e.row.finishedGoodsInventory.quantityAvailable) {
        return new Error('调拨数量不能大于订单数')
        return new Error(t('productStock.theTransferQuantityCannotBeGreaterThanTheOrderQuantity'))
      }else if (e.row.quantity ==="") {
        return new Error('调拨数量不能为空或者是0')
        return new Error(t('productStock.transferQuantityCannotBeEmptyOr0'))
      }
      const regex = /^[1-9]\d*$/g
      if ( !regex.test(e.row.quantity) ) {
        return new Error('请输入正整数')
        return new Error(t('productStock.pleaseEnterAPositiveInteger'))
      }
    }
@@ -393,7 +397,7 @@
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{ $t('basicData.edit') }}</el-button>
<!--        <el-button @click="getTableRow(row,'out')" link type="primary" size="small">成品领出</el-button>-->
<!--        <el-button @click="getTableRow(row,'back')" link type="primary" size="small">成品返工</el-button>-->
      </template>