guoyuji
2024-12-10 7b0d59dbd16a0f90eec1ad35eff64cf40d3b97e7
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/GlassInventory.vue
@@ -1,6 +1,9 @@
<script setup>
import {reactive, ref} from "vue";
import {onMounted, reactive, ref} from "vue";
import {useI18n} from "vue-i18n";
import request from "@/utils/request";
import {ElMessage} from "element-plus";
import {useRoute} from "vue-router";
const { t } = useI18n()
const xGrid = ref()
@@ -31,42 +34,23 @@
    mode: 'row',
    showStatus: true
  },
  /*formConfig: {
    data: {
      width: '',
      height: '',
      quantity: ''
    },
    items: [
      { field: 'width', title: t('order.width')+':', itemRender: { name: 'VxeInput' } },
      { field: 'height', title: t('order.height')+':', itemRender: { name: 'VxeInput' } },
      { field: 'quantity', title: t('order.quantity')+':', itemRender: { name: 'VxeInput' } },
      {
        itemRender: {
          name: 'VxeButtonGroup',
          options: [
            { type: 'submit', content: t('craft.sure'), status: 'primary' },
            { type: 'reset', content: t('product.msg.reset') }
          ]
        }
      }
    ]
  },*/
  columns:[
    {title: '选择', type:'radio', width: 70},
    {type:'seq',fixed:"left", title:' ', width: 50},
    {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
    {field: 'id', title: '物料编码',},
    {field:'state',title: t('order.width'),},
    {type: 'seq',title: t('order.height')},
    {field: 'id', title: t('order.totalThickness'),},
    {field: 'id', title: t('warehouseBasicData.type'),},
    {field: 'id', title: '左修边',},
    {field: 'id', title: '下修边',},
    {field: 'id', title: '右修边',},
    {field: 'id', title: '上修边',},
    {field: 'id', title: '库存数量',},
    {field: 'id', title: '加工数量',},
    {field: 'id', title: '名称',},
    {field: 'id', title: '供应商',}
    {field:'width',title: t('order.width'),},
    {field: 'height',title: t('order.height')},
    {field: 'thickness', title: t('order.totalThickness'),},
    {field: 'model', title: t('warehouseBasicData.type'),},
    {field: 'leftTrim', title: '左修边',},
    {field: 'downTrim', title: '下修边',},
    {field: 'rigthTrim', title: '右修边',},
    {field: 'upTrim', title: '上修边',},
    {field: 'available_quantity', title: '库存数量',},
    {field: '', title: '加工数量',},
    {field: 'name', title: '名称',},
    {field: 'producer', title: '供应商',}
  ],//表头参数
  data:null,//表格数据
  toolbarConfig: {
@@ -75,8 +59,52 @@
      buttons: "toolbar_buttons"
    },
  },
})
const route = useRoute();
const thickness = ref(route.params.thickNess);
const model = ref(route.params.model);
const selectMaterialStore = () =>{
  request.post(`/glassOptimize/materialStore/${thickness.value}/${model.value}`).then((res) => {
    if (Number(res.code) === 200) {
      const rawData = res.data.data;
      if (Array.isArray(rawData) && rawData.length > 0) {
        const formattedData = rawData.map(item => {
          const formattedItem = {};
          for (const key in item) {
            if (typeof item[key] === 'string') {
              //去除字符串属性值开头和结尾的双引号
              formattedItem[key] = item[key].replace(/^\"|\"$/g, '');
            } else {
              formattedItem[key] = item[key];
            }
          }
          return formattedItem;
        });
        const data = formattedData;
        data.forEach(item => {
          item.leftTrim = 0;
          item.downTrim = 0;
          item.rigthTrim = 0;
          item.upTrim = 0;
        });
        xGrid.value.loadData(formattedData);
      } else {
      }
    } else {
      ElMessage.warning(res.msg);
      console.error('请求获取库存失败,状态码:', res.code, ',错误信息:', res.msg);
    }
  });
};
onMounted(() => {
  selectMaterialStore();
});
</script>
<template>