廖井涛
2024-04-07 86be28dd91854ff36dbc88d40a79efcb9b7229a6
north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/CreateOutBound.vue
@@ -72,10 +72,13 @@
  warehouseManager:userStore.user.userName
})
//筛选条件,有外键需要先定义明细里面的数据
let filterData = ref({
})
let optimizeUse = ref({
  id:0
})
let BasicData = ref([])
@@ -88,6 +91,7 @@
  {field: 'inventoryOrganization', width:'150', title: '库存组织', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged },
  {field: 'materialCode', width: '150',title: '物料编码', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'producer', width: '100',title: '产地', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'projectNo', width: '100',title: '工程号', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'inventoryQuantity',width: '100', title: '库存数量', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'availableQuantity', width: '100',title: '可用库存', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'outboundQuantity', width:'150', title: '出库数量', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } }},
@@ -102,7 +106,9 @@
request.get(`/BasicWarehouse/BasicWarehouseTypes/材料出库类型`).then((res) => {
  if(res.code==200){
    titleSelectJson.value=deepClone(res.data)
    console.log(titleSelectJson.value)
    const today = new Date
    today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000))
    titleUploadData.value.materialRequisitionDate = today.getFullYear() +
@@ -149,81 +155,121 @@
  addListener(xGrid.value,gridOptions,cellArea.value)
  //出库新增
  const id = route.query.id
  const type = route.query.type
  if (typeof id !== 'undefined' && id !== null && id !== '' && id !== '\n' && id !== '\r'){
    filterData.value.stockId=id
    number.value=id
    console.log(filterData.value)
    //第一次调用
    request.post("/MaterialInventory/getSelectMaterialInventory/1/100",filterData.value).then((res) => {
      if(res.code==200){
    if(type==='库存'){
      filterData.value.stockId=id
      number.value=id
      console.log(filterData.value)
      request.post("/MaterialInventory/getSelectMaterialInventory/1/100",filterData.value).then((res) => {
        console.log(res.data.data)
        titleUploadData.value.warehouseManager=userStore.user.userName
        titleUploadData.value.outboundType = titleSelectJson.value.outboundType[0].operateTypeName
        materialStore.value=[]
        for (let i=0;i<res.data.data.length;i++){
          materialStore.value[i]=(res.data.data[i])
          materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
        if(res.code==200){
          console.log(res.data.data)
          titleUploadData.value.warehouseManager=userStore.user.userName
          titleUploadData.value.outboundType = titleSelectJson.value.outboundType[0].operateTypeName
          materialStore.value=[]
          for (let i=0;i<res.data.data.length;i++){
            materialStore.value[i]=(res.data.data[i])
            materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
          }
          produceList = deepClone(materialStore.value)
          xGrid.value.loadData(produceList)
          //禁用按钮
          gridOptions.toolbarConfig.buttons[1].disabled  = true
          gridOptions.toolbarConfig.buttons[2].disabled = true
          //显示复选框
          xGrid.value.showColumn("select")
          gridOptions.loading=false
        }else{
          ElMessage.warning(res.msg)
        }
      })
    }else{
      optimizeUse.value.rawStockCode=id
      console.log(optimizeUse.value)
      number.value=id
      request.post("/MaterialInventory/getSelectMaterialInventoryEngineering/1/100",optimizeUse.value).then((res) => {
        produceList = deepClone(materialStore.value)
        xGrid.value.loadData(produceList)
        if(res.code==200){
          console.log(res.data.data)
          titleUploadData.value.warehouseManager=userStore.user.userName
          titleUploadData.value.outboundType = titleSelectJson.value.outboundType[0].operateTypeName
          materialStore.value=[]
          for (let i=0;i<res.data.data.length;i++){
            materialStore.value[i]=(res.data.data[i])
            materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
          }
          produceList = deepClone(materialStore.value)
          xGrid.value.loadData(produceList)
        //禁用按钮
        gridOptions.toolbarConfig.buttons[1].disabled  = true
        gridOptions.toolbarConfig.buttons[2].disabled = true
        //显示复选框
        xGrid.value.showColumn("select")
        gridOptions.loading=false
      }else{
        ElMessage.warning(res.msg)
      }
    })
          //禁用按钮
          gridOptions.toolbarConfig.buttons[1].disabled  = true
          gridOptions.toolbarConfig.buttons[2].disabled = true
          //显示复选框
          xGrid.value.showColumn("select")
          gridOptions.loading=false
        }else{
          ElMessage.warning(res.msg)
        }
      })
    }
  }
//出库编辑
  const str = route.query.materialOutboundId
  if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){
    filterData.value.materialOutboundId=str
    console.log(filterData.value)
    //第一次调用
    request.post("/MaterialInventory/getSelectMaterialOutbound/1/100",filterData.value).then((res) => {
      if(res.code==200){
        titleUploadData.value=deepClone(res.data.materialOutbound)
        //根据审核状态显示审核按钮或者是反审按钮
        console.log(res.data.data)
        if(titleUploadData.value.reviewedState!==0){
          gridOptions.toolbarConfig.buttons[1].disabled = true
          gridOptions.toolbarConfig.buttons[0].disabled = true
      filterData.value.materialOutboundId=str
      console.log(filterData.value)
      //第一次调用
      request.post("/MaterialInventory/getSelectMaterialOutbound/1/100",filterData.value).then((res) => {
        if(res.code==200){
          titleUploadData.value=deepClone(res.data.materialOutbound)
          //根据审核状态显示审核按钮或者是反审按钮
          console.log(res.data.data)
          if(titleUploadData.value.reviewedState!==0){
            gridOptions.toolbarConfig.buttons[1].disabled = true
            gridOptions.toolbarConfig.buttons[0].disabled = true
          }
          if(titleUploadData.value.reviewedState===0){
            gridOptions.toolbarConfig.buttons[2].disabled = true
          }
          materialStore.value=[]
          for (let i=0;i<res.data.data.length;i++){
            materialStore.value[i]=(res.data.data[i])
            materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
          }
          produceList = deepClone(materialStore.value)
          xGrid.value.loadData(produceList)
          //隐藏复选框
          /*xGrid.value.hideColumn("select")
          gridOptions.loading=false*/
          xGrid.value.showColumn("select")
          gridOptions.loading=false
        }else{
          ElMessage.warning(res.msg)
        }
        if(titleUploadData.value.reviewedState===0){
          gridOptions.toolbarConfig.buttons[2].disabled = true
        }
      })
        materialStore.value=[]
        for (let i=0;i<res.data.data.length;i++){
          materialStore.value[i]=(res.data.data[i])
          materialStore.value[i].json=(JSON.parse(res.data.data[i].json))
        }
        produceList = deepClone(materialStore.value)
        xGrid.value.loadData(produceList)
        //隐藏复选框
        /*xGrid.value.hideColumn("select")
        gridOptions.loading=false*/
        xGrid.value.showColumn("select")
        gridOptions.loading=false
      }else{
        ElMessage.warning(res.msg)
      }
    })
  }
@@ -375,7 +421,7 @@
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  id: 'CustomerList',
  showFooter: true,//显示脚
  printConfig: {},