于杰
1 天以前 121ef0e477b9ab0e3a610de08a92f08eb955d556
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProcessCard.vue
@@ -1,5 +1,5 @@
<script setup>
import {onMounted, reactive, ref, watch} from "vue";
import {nextTick, onMounted, reactive, ref, watch} from "vue";
import {useI18n} from "vue-i18n";
import {Search} from "@element-plus/icons-vue";
import request from "@/utils/request";
@@ -10,7 +10,7 @@
const {t} = useI18n()
const userStore = useUserInfoStore()
const username = userStore.user.userName
const username = userStore.user.userId
let rowClickIndex = ref(null)
let props = defineProps({
@@ -70,6 +70,7 @@
onMounted(() => {
  console.log(userStore.user);
  getProjectId();
  selectGlassType();
@@ -85,7 +86,7 @@
      selectFlowCardList();
    }
  }
});
}, { flush: 'post' });
const gridOptions = reactive({
@@ -240,25 +241,64 @@
  })
}
const getUpdateFlowCardList = async (projectNumber,type,thickness) => {
  radio.value=1
const getUpdateFlowCardList = async (projectNumber, type, thickness) => {
  // 重置状态
  radio.value = 1;
  isButtonDisabledAdd.value = true;
  isButtonDisabledUpdate.value = false;
  // 清空现有数据
  if (xGrid.value) {
    xGrid.value.loadData([]);
  }
  // 强制更新表单字段
  oddNumbers.value = projectNumber;
  projectNmae.value = ''; // 先清空工程名称
  // 构造正确的膜系值
  const glassTypeValue = `${thickness}mm${type}`;
  optionVal.value = glassTypeValue;
  request.post(`/glassOptimize/getUpdateFlowCardList/${type}/${thickness}/${radio.value}/${projectNumber}`).then((res) => {
    if (res.code == 200) {
      oddNumbers.value=projectNumber
      optionVal.value=thickness+"mm"+type
      isButtonDisabledAdd.value=true
      isButtonDisabledUpdate.value=false
      xGrid.value.loadData(deepClone(res.data.data))
      xGrid.value.getTableData().fullData.forEach(item => {
        if(item.occupyState===0){
          xGrid.value.setCheckboxRow(item, true);
      // 更新工程编号
      oddNumbers.value = projectNumber;
      // 更新工程名称(如果后端返回)
      if (res.data.projectName) {
        projectNmae.value = res.data.projectName;
      }
      // 确保膜系选择正确
      optionVal.value = glassTypeValue;
      isButtonDisabledAdd.value = true;
      isButtonDisabledUpdate.value = false;
      // 使用 $nextTick 确保DOM更新后再加载数据
      nextTick(() => {
        if (xGrid.value) {
          xGrid.value.loadData(deepClone(res.data.data));
          // 设置选中状态
          nextTick(() => {
            const tableData = xGrid.value.getTableData().fullData;
            tableData.forEach(item => {
              if(item.occupyState === 0){
                xGrid.value.setCheckboxRow(item, true);
              }
            });
          });
        }
      })
      });
    } else {
      ElMessage.warning(res.msg)
      ElMessage.warning(res.msg);
    }
  })
}
  }).catch(error => {
    ElMessage.error('获取流程卡数据失败');
    console.error(error);
  });
};
//创建工程
const addProject = (type) => {
@@ -269,10 +309,10 @@
      ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst'))
      return
    }
    if (selectRecords.length == 0) {
      ElMessage.warning(t('reportingWorks.selectProcessCardData'))
      return;
    }
    // if (selectRecords.length == 0) {
    //   ElMessage.warning(t('reportingWorks.selectProcessCardData'))
    //   return;
    // }
    let projectData = ref({
      projectdetail: selectRecords,
@@ -298,6 +338,17 @@
  }
}
watch(optionVal, (newVal, oldVal) => {
  if (newVal) {
    // 当膜系改变时,更新工程名称为当前膜系值
    projectNmae.value = newVal;
    // 当膜系改变时,自动刷新数据
    selectFlowCardList();
  }
}, { flush: 'post' });
const handleRowClassName = ({ row, rowIndex }) => {
  if (row.patch_state === 1) {
    return 'high-score';
@@ -354,7 +405,7 @@
      </template>
      <template #toolbar_buttons>
        <h1>膜系筛选:</h1>
        <h2>膜系筛选:</h2>
        <el-select v-model="optionVal" clearable default-value="default_city" placeholder="选择膜系"
                   style="width: 120px">
          <el-option