chenlu
2024-03-01 a1a27eba473c476cade23f003d3ac1f1cc1ac27d
north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
@@ -23,10 +23,7 @@
      router.push({path: '/main/processCard/PrintFlowCard', query: {id: row.id}})
      break
    }
    case 'delete': {
      alert('我接收到子组件传送的删除信息')
      break
    }
    case  'setType': {
      alert('我接收到子组件传送的排版状态')
      break
@@ -177,6 +174,7 @@
      }
    })
  } else if (inputVal != null && selectState == 1) {
    //根据订单号查询未排产数据
    request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => {
      if (res.code == 200) {
@@ -300,6 +298,7 @@
    {field: 'product_name', title: '产品名称', width: 140},
    {field: 'shape', title: '形状', width: 80},
    {field: 'notes', title: '备注', editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
    {field: 'scheduling_id', title: '排产编号',width: 120},
  ],//表头按钮
  toolbarConfig: {
@@ -316,26 +315,28 @@
  },
  data: [],//table body实际数据
  //脚部求和
  footerMethod({columns, data}) {//页脚函数
    let footList = ['数量', '面积', '排产数量', '已排产数量', '已排产面积', '未排产数量', '未排产面积']
    return [
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
        }
        if (footList.includes(column.field)) {
          return sumNum(data, column.field)
        }
        return ''
      })
    ]
  }
  // footerMethod({columns, data}) {//页脚函数
  //   let footList = ['数量', '面积', '排产数量', '已排产数量', '已排产面积', '未排产数量', '未排产面积']
  //   return [
  //     columns.map((column, columnIndex) => {
  //       if (columnIndex === 0) {
  //         return '合计:'
  //       }
  //       if (footList.includes(column.field)) {
  //         return sumNum(data, column.field)
  //       }
  //       return ''
  //     })
  //   ]
  // }
})
//删除
const gridEvents = {
  toolbarButtonClick({code}) {
  async toolbarButtonClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
@@ -368,7 +369,6 @@
              processes: selectProcesses,//工序
              userName: username//审核人
            })
            console.log(schedulingData.value)
            //保存排产数据
            request.post("/productionScheduling/addScheduling", schedulingData.value).then((res) => {
              if (res.code == 200) {
@@ -376,12 +376,37 @@
                location.reload();
              } else {
                ElMessage.warning(res.msg)
                router.push("/login")
              }
            })
          }
          return;
        }
        case 'delete': {
          const $table = xGrid.value
          const selectRecords = $table.getCheckboxRecords()
          if ($table) {
            if (selectRecords.length == 0) {
              ElMessage.warning("请勾选排产数据")
              return;
            }
            const type = await VXETable.modal.confirm('您确定要删除该数据?')
            if (type === 'confirm') {
              //保存排产数据
              request.post("/productionScheduling/addScheduling").then((res) => {
                if (res.code == 200) {
                  ElMessage.success("保存成功")
                  location.reload();
                } else {
                  ElMessage.warning(res.msg)
                }
              })
            }
          }
        }
@@ -395,7 +420,6 @@
  const $grid = xGrid.value
  const table = $grid.getTableData().fullData
  const selectRecords = $grid.getCheckboxRecords()
  console.log(selectRecords)
  table.forEach((selectRecords) => {
    if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity) {
      ElMessage.warning("排产数量不能大于待排产数量")
@@ -406,6 +430,8 @@
  })
}
</script>
@@ -425,9 +451,9 @@
        />
        &nbsp;&nbsp;
        <el-input v-model="form.orderId" placeholder="销售单号" style="width: 110px"></el-input>
        <el-input v-model="form.orderId" placeholder="销售单号" clearable style="width: 110px"></el-input>
        &nbsp;
        <el-select v-model="value" class="m-2" placeholder="工序" style="width: 90px;">
        <el-select v-model="value" class="m-2" placeholder="工序" clearable style="width: 90px;">
          <el-option
              v-for="item in options"
              :key="item.value"
@@ -457,6 +483,7 @@
        ref="xGrid"
        class="mytable-scrollbar"
        max-height="100%"
        height="100%"
        v-bind="gridOptions"
        v-on="gridEvents"
        @filter-change="filterChanged"
@@ -495,6 +522,7 @@
#selectForm {
  width: 70%;
  height: 6%;
  text-align: center;
}
</style>