schangxiang@126.com
2025-05-20 3a61cb05bd4339b89127b15c489ae76370905404
PipeLineLems/pipelinelems_web/src/widgets/WorkTask/Controllers/WorkTaskQueryDrawer.tsx
@@ -748,26 +748,7 @@
    const check = isEqual(initiateData.value, data) 
    return check 
  } 
//   /**
//  * 获取表单数据 - 优化版
//  */
// const commonGetFormData = () => {
//   const data = {};
   
//   // 遍历表单配置收集数据
//   formItems.forEach(item => {
//     // 收集基础字段
//     data[item.prop] = formData.value[item.prop] || '';
//     // 收集过滤模式字段
//     if (item.highSelectAttrs && item.highSelectAttrs.prop) {
//       const filterModeProp = item.highSelectAttrs.prop;
//       data[filterModeProp] = formData.value[filterModeProp] || '';
//     }
//   });
//   return data;
// }
  const onClose = (done: () => void) => { 
    if (visible.value) { 
      visible.value = false 
@@ -782,45 +763,17 @@
    const data =collectFormDataForHighQuery(formItems,formData); 
    ctx.emit('confirmQuery', data) 
  } 
  // /**
  //  * 重置公共select查询
  //  */
  // const onResetForHighSelect = () => {
  //     // 遍历所有表单字段
  //     formItems.forEach(item => {
  //       // 检查字段是否有高级查询的过滤模式配置
  //       if (item.highSelectAttrs && item.highSelectAttrs.prop) {
  //         const filterModeProp = item.highSelectAttrs.prop;
  //         const options = item.highSelectAttrs.options || [];
  //         // 如果存在选项,则设置为第一个选项的值
  //         if (options.length > 0) {
  //           // 假设选项格式为 { value, label } 或类似结构
  //           const firstValue = options[0].value !== undefined ? options[0].value : options[0];
  //           formData.value[filterModeProp] = firstValue;
  //         }
  //       }
  //     });
  // }
    /** 
    * 重置查询 - 优化版 
    */ 
    const onReset = async () => { 
        // // 1. 清空所有基础字段(不包含过滤模式字段)
        // const baseFields = formItems.reduce((acc, item) => {
        // acc[item.prop] = '';
        // return acc;
        // }, {});
        // // 2. 应用基础字段初始值
        // formData.value = { ...baseFields };
        // 1. 清空所有基础字段(不包含过滤模式字段),应用基础字段初始值
        onResetForHighQuery(formItems,formData);
   
        // 3. 使用原有方法重置过滤模式字段
        onResetForHighSelect(formItems,formData); // 保留原有方法调用
        // 2. 使用原有方法重置过滤模式字段
        onResetForHighSelect(formItems,formData);
   
        // 4. 向父组件发送自定义事件
        // 3. 向父组件发送自定义事件
        ctx.emit('restQuery'); 
    }