zhangherong
2025-05-15 b633761a98d8d675578f517b6d3715c847874f30
src/views/eam/equipment/EamEquipmentList.vue
@@ -38,7 +38,7 @@
              <a-form-item label="使用车间">
                <a-tree-select v-model="queryParam.orgId"
                               style="width: 100%"
                               :tree-data="treeData"
                               :tree-data="treeDataAlias"
                               :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                               placeholder="请选择使用车间"
                               allow-clear
@@ -250,7 +250,13 @@
            dataIndex: 'equipmentImportance_dictText',
          },
          {
            title: '资产状态',
            title: '技术状态',
            align: 'center',
            width: 100,
            dataIndex: 'technologyStatus_dictText'
          },
          {
            title: '资产使用状态',
            align: 'center',
            width: 100,
            dataIndex: 'assetStatus_dictText'
@@ -300,12 +306,6 @@
            align: 'center',
            width: 100,
            dataIndex: 'equipmentSpecification'
          },
          {
            title: '区号',
            align: 'center',
            width: 100,
            dataIndex: 'areaCode'
          },
          {
            title: '电机台数',
@@ -463,6 +463,7 @@
        currentTableRowRecord: {},
        isOpenProcess: false,
        isOpenPrecision: false,
        treeDataAlias: [],
      }
    },
    computed: {
@@ -480,6 +481,8 @@
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
            this.treeData = [...res.result]
            this.treeDataAlias = this.deepCopyAndModify(res.result)
            console.info('treeDataAlias====', this.treeDataAlias)
          } else {
            that.$message.warning(res.message)
          }
@@ -590,7 +593,37 @@
          }
        })
      },
      deepCopyAndModify(arr) {
        // 如果当前元素不是数组或对象,直接返回
        if (!Array.isArray(arr) && typeof arr !== 'object' || arr === null || arr.length === 0) {
          return arr;
        }
        // 如果是数组,创建一个新数组并递归处理每个元素
        if (Array.isArray(arr)) {
          const newArray = [];
          for (let i = 0; i < arr.length; i++) {
            newArray.push(this.deepCopyAndModify(arr[i]));
          }
          return newArray;
        }
        // 如果是对象,创建一个新对象并递归处理每个属性
        const newObj = {};
        for (const key in arr) {
          if (arr.hasOwnProperty(key)) {
            if(key === 'selectable') {
              newObj[key] = true;
            } else if(key === 'children') {
              newObj[key] = this.deepCopyAndModify(arr[key]);
            }else {
              newObj[key] = arr[key];
            }
          }
        }
        return newObj;
      },
    }
  }
</script>