chenlu
2024-09-10 ed3ce5c8f6e1f7ac1aad3218ab5e518fc95cdb0f
north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue
@@ -90,7 +90,7 @@
//获取七天前到当前时间
function getNowTime() {
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 3)
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15)
      .toISOString()
      .replace('T', ' ')
      .slice(0, 10) //默认开始时间3天前
@@ -127,9 +127,10 @@
    titleSelectJson.value.processType = res.data.process
    gridOptions.loading = false
    //禁用删除、保存按钮
    //禁用删除、审核按钮
    gridOptions.toolbarConfig.buttons[0].disabled = true
    gridOptions.toolbarConfig.buttons[1].disabled = true
    gridOptions.toolbarConfig.buttons[2].disabled = true
  } else {
    ElMessage.warning(res.msg)
  }
@@ -154,21 +155,23 @@
      total.dataTotal = res.data.total.total * 1
      total.pageTotal = res.data.total.pageTotal
      pageTotal.value = res.data.total
      xGrid.value.loadData(res.data.data)
      console.log(res.data.data)
      xGrid.value.loadData(res.data.data)
      gridOptions.loading = false
      if (selectState==1){
        //禁用删除、审核按钮
        gridOptions.toolbarConfig.buttons[0].disabled = true
        gridOptions.toolbarConfig.buttons[1].disabled = true
        gridOptions.toolbarConfig.buttons[2].disabled = true
        //启用保存
        gridOptions.toolbarConfig.buttons[2].disabled = false
        gridOptions.toolbarConfig.buttons[3].disabled = false
      }else{
        //禁用删除、审核按钮
        //启用删除、审核按钮
        gridOptions.toolbarConfig.buttons[0].disabled = false
        gridOptions.toolbarConfig.buttons[1].disabled = false
        //启用保存
        gridOptions.toolbarConfig.buttons[2].disabled = false
        //禁用保存
        gridOptions.toolbarConfig.buttons[3].disabled = true
      }
    } else {
@@ -240,8 +243,8 @@
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe: true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true, height: 50},//鼠标移动或选择高亮
  id: 'CustomerList',
  rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
  id: 'productionScheduling',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
@@ -259,7 +262,7 @@
    storage: true
  },
  editConfig: {
    trigger: 'click',
    trigger: 'dblclick',
    mode: 'row',
    showStatus: true
  },
@@ -309,9 +312,18 @@
      editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
      title: t('processCard.planEndTime')
    },
    {
      field: 'schedulingQuantity',
      width: 120,
      editRender: {name: 'input', attrs: {placeholder: ''}},
      title: t('processCard.productionSchedulingQuantity'),
      sortable: true
    },
    {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
    // {field: '排产编号', title: '排产编号',  width: 120 },
    {
      field: 'orderGlassDetail.orderId',
      field: 'order.orderId',
      title: t('order.orderId'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
@@ -357,13 +369,7 @@
    },
    {field: 'orderDetail.quantity', title: t('processCard.orderQuantity'), width: 90},
    {field: 'orderGlassDetail.area', title: t('processCard.orderArea'), width: 90},
    {
      field: 'schedulingQuantity',
      width: 120,
      editRender: {name: 'input', attrs: {placeholder: ''}},
      title: t('processCard.productionSchedulingQuantity'),
      sortable: true
    },
    {field: 'pendingProductionQuantity', title: t('processCard.quantityToScheduled'), width: 100},
    {field: 'pendingProductionArea', title: t('processCard.areaToScheduled'), width: 100},
    {field: 'productionScheduledQuantity', title: t('processCard.plannedProductionQuantity'), width: 100},
@@ -372,7 +378,6 @@
    {field: 'reviewer', title: t('processCard.reviewed'), width: 80},
    {field: 'orderDetail.productName', title: t('order.product'), width: 140},
    {field: 'orderDetail.shape', title: t('order.shape'), width: 80},
    {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
    {field: 'schedulingId', title: t('processCard.schedulingId'), width: 120},
  ],//表头按钮
@@ -380,6 +385,7 @@
    buttons: [
      {code: 'delete', name: t('basicData.delete'), status: 'primary'},
      {code: 'review', name: t('basicData.review'), status: 'primary'},
      {code: 'cancelReview', name: t('basicData.cancelReview'), status: 'primary'},
      {code: 'save', name: t('processCard.scheduling'), status: 'primary', icon: 'vxe-icon-save'},
    ],
    import: false,
@@ -477,6 +483,7 @@
              ElMessage.warning("请勾选排产数据")
              return;
            }
            const type = await VXETable.modal.confirm('您确定要删除该数据?')
            if (type === 'confirm') {
              let schedulingData = ref({
@@ -499,6 +506,10 @@
        case 'review': {
          const $table = xGrid.value
          const selectRecords = $table.getCheckboxRecords()
          let date = form.date1
          let selectProcesses = processVal.value
          let selectState = stateValue.value
          let inputVal = form.orderId
          if ($table) {
            if (selectRecords.length == 0) {
              ElMessage.warning("请勾选排产数据")
@@ -511,6 +522,34 @@
            request.post("/productionScheduling/examineScheduling", schedulingData.value).then((res) => {
              if (res.code == 200) {
                ElMessage.success("审核成功")
                router.push({
                  path: '/main/processCard/ProductionScheduling',
                  query: {random: Math.random()}
                })
              } else {
                ElMessage.warning(res.msg)
              }
            })
          }
          return;
        }
        case 'cancelReview': {
          const $table = xGrid.value
          const selectRecords = $table.getCheckboxRecords()
          if ($table) {
            if (selectRecords.length == 0) {
              ElMessage.warning("请勾选排产数据")
              return;
            }
            let schedulingData = ref({
              scheduling: selectRecords,
              userName: username//审核人
            })
            request.post("/productionScheduling/cancelReviewScheduling", schedulingData.value).then((res) => {
              if (res.code == 200) {
                ElMessage.success("反审成功")
                location.reload();
              } else {
                ElMessage.warning(res.msg)
@@ -583,17 +622,26 @@
  const table = $grid.getTableData().fullData
  const selectRecords = $grid.getCheckboxRecords()
  let selectState = stateValue.value
  table.forEach((selectRecords) => {
    if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity && selectState == 1) {
  selectRecords.forEach((selectRecords) => {
    if (selectRecords.schedulingQuantity > selectRecords.pendingProductionQuantity) {
      ElMessage.warning("排产数量不能大于待排产数量")
      //禁用保存按钮
      //gridOptions.toolbarConfig.buttons[2].disabled = true
    }
  })
}
const checkBoxConfig = {
  checkMethod: ({ row }) => {
    if (row['reviewStatus']==="已审核"){
      return row.disable
    }else{
      return !row.disable
    }
  },
  reserve:true
}
</script>
@@ -643,14 +691,14 @@
    <vxe-grid
        ref="xGrid"
        class="mytable-scrollbar"
        height="500px"
        max-height="100%"
        height="95%"
        v-bind="gridOptions"
        v-on="gridEvents"
        @filter-change="filterChanged"
        @checkbox-change="determineNum"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
      <!--      :checkbox-config="checkBoxConfig"  @checkbox-change="determineNum"-->
      <!--      下拉显示所有信息插槽-->
      <template #content="{ row }">
        <ul class="expand-wrapper">