调整用户管理、权限管理、角色管理页面关闭方式,调整角色管理级联选择则器回显,大理片笼小车位置,获取接口
4个文件已修改
269 ■■■■■ 已修改文件
UI-Project/src/views/Slicecage/slicecage.vue 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/User/permissions.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/User/rolelist.vue 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/User/userlist.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Slicecage/slicecage.vue
@@ -20,6 +20,7 @@
const tableDatad = ref([])
const tableDataf = ref([])
const tableDatae = ref([])
const carPosition = ref([])
const adjustedRects = ref([]);
const project = ref([]);
const adjustedRectsa = ref([]);
@@ -42,17 +43,11 @@
const temperingLayoutId = ref('');
const thickness = ref('');
const width = ref('');
const carposition1 = ref(60);
const carposition2 = ref(220);
const carposition3 = ref(60);
const carposition4 = ref(260);
const timers1 =ref(true);
const timers2 =ref(true);
const timers3 =ref(true);
const timers4 =ref(true);
const cellshow5=ref(false);
const c1=ref(false);
const c2=ref(false);
const cellshow1=ref(true);
const cellshow2=ref(true);
const cellshow3=ref(true);
@@ -471,7 +466,8 @@
  tableData.value = data.bigStorageCageInfo[0]
  tableDatab.value = data.temperingGlassInfoList[0]
  tableDatae.value = data.bigStorageCageUsage[0]
  // adjustedRects.value = data.bigStorageCageInfo1[0]
  carPosition.value = data.carPostion[0]
  console.log(carPosition.value);
  window.localStorage.setItem('length', data.data.bigStorageCageInfos[0][1].length)
  let length = window.localStorage.getItem('length')
  adjustedRects.value = data.data.bigStorageCageInfos[0][1].map(rect => ({  
@@ -621,7 +617,7 @@
        <el-table height="100%" ref="table" 
        @selection-change="handleSelectionChange"
        :data="tableDatad" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="bigStorageCageFeedTask.glassId" align="center" :label="$t('searchOrder.intoglassid')" min-width="100" />
          <el-table-column prop="bigStorageCageFeedTask.glassId" align="center" :label="$t('searchOrder.intoglassid')" min-width="120" />
          <el-table-column prop="bigStorageCageFeedTask.targetSlot" align="center" :label="$t('searchOrder.targetlocation')" min-width="120" />
          <!-- <el-table-column prop="task_type" align="center" label="任务类型" min-width="120" />没有返回字段 -->
          <el-table-column prop="bigStorageCageFeedTask.taskState" align="center" :label="$t('searchOrder.taskstatus')" min-width="120">
@@ -633,9 +629,9 @@
          <el-table-column prop="id" align="center" :label="$t('searchOrder.tabid')" min-width="150"/>
          <el-table-column prop="deviceId" align="center" :label="$t('searchOrder.tid')" min-width="100"/>
          <el-table-column prop="slot" align="center" :label="$t('searchOrder.gridnumber')" min-width="100"/>
          <el-table-column prop="glassId" align="center" :label="$t('searchOrder.glassID')" min-width="100"/>
          <el-table-column prop="glassId" align="center" :label="$t('searchOrder.glassID')" min-width="120"/>
          <el-table-column prop="sequence" align="center" :label="$t('searchOrder.pieceingrid')" min-width="150"/>
          <el-table-column prop="flowCardId" align="center" :label="$t('searchOrder.cardnumber')" min-width="100"/>
          <el-table-column prop="flowCardId" align="center" :label="$t('searchOrder.cardnumber')" min-width="140"/>
          <el-table-column prop="glassType" align="center" :label="$t('searchOrder.typeglass')" min-width="100"/>
          <el-table-column prop="width" align="center" :label="$t('searchOrder.width')" min-width="100"/>
          <el-table-column prop="height" align="center" :label="$t('searchOrder.height')" min-width="100"/>
@@ -665,17 +661,10 @@
    </div>
<!-- // 父级框 -->
<div class="img-dlpl" >
    <div class="img-car1" :style="'z-index:999;left:247px;top:' + carposition1 + 'px;position:absolute;'">
    <div class="img-car1" :style="'z-index:999;left:247px;top:' + 350*carPosition[0] + 'px;position:absolute;'">
      <div v-show="cellshow1" style="margin-top:10px;width:200px;height:5px;background-color:#409EFF;"></div>
    </div>
    <div v-show="c1" class="img-car2" :style="'z-index:999;left:704px;top:' + carposition2 + 'px;position:absolute;'">
      <div v-show="cellshow2" style="margin-top:10px;width:200px;height:5px;background-color:#409EFF;"></div>
    </div>
    <div v-show="c2" class="img-car3" :style="'z-index:999;left:247px;top:' + carposition3 + 'px;position:absolute;'">
      <div v-show="cellshow3" style="margin-top:10px;width:220px;height:5px;background-color:#409EFF;"></div>
    </div>
    <div class="img-car4" :style="'z-index:999;left:704px;top:' + carposition4 + 'px;position:absolute;'">
    <div class="img-car4" :style="'z-index:999;left:704px;top:' + 350*carPosition[1] + 'px;position:absolute;'">
      <div v-show="cellshow4" style="margin-top:10px;width:200px;height:5px;background-color:#409EFF;"></div>
    </div>
    <div style="position: relative;">
@@ -1261,30 +1250,6 @@
    position:relative
}
.img-car1{
  background-image:url('../../assets/lp.png');
  position: absolute;
  background-repeat: no-repeat;
    background-attachment: local;
    min-height: 200px;
    width: 200px;
    max-width: 100%;
    background-size: 200px 70px;
    overflow: hidden;
    position:relative
}
.img-car2{
  background-image:url('../../assets/lpa.png');
  position: absolute;
  background-repeat: no-repeat;
    background-attachment: local;
    min-height: 200px;
    width: 200px;
    max-width: 100%;
    background-size: 200px 70px;
    overflow: hidden;
    position:relative
}
.img-car3{
  background-image:url('../../assets/lp.png');
  position: absolute;
  background-repeat: no-repeat;
UI-Project/src/views/User/permissions.vue
@@ -75,6 +75,30 @@
  // window.localStorage.setItem('slot', row.slot)
  addb.value = true; // 打开绑定架子对话框
};
function closeDialog(row) {
     add.value = false;
       menuName.value = '';
       listSort.value = '';
       url.value = '';
}
function closeDialoga(row) {
     adda.value = false;
       menuName.value = '';
       listSort.value = '';
       url.value = '';
}
function closeDialogb(row) {
     addb.value = false;
       menuName.value = '';
       listSort.value = '';
       url.value = '';
}
function closeDialogc(row) {
     addc.value = false;
       menuName.value = '';
       listSort.value = '';
       url.value = '';
}
// 添加一级菜单
const getTableRow = async () => {
  try {
@@ -319,7 +343,7 @@
        <el-button type="primary" @click="getTableRow">
          {{ $t('customer.sure') }}
        </el-button>
        <el-button @click="add = false">{{ $t('customer.cancel') }}</el-button>
        <el-button @click="closeDialog">{{ $t('customer.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
@@ -376,7 +400,7 @@
        <el-button type="primary" @click="getTableRowb">
          {{ $t('customer.sure') }}
        </el-button>
        <el-button @click="addb = false">{{ $t('customer.cancel') }}</el-button>
        <el-button @click="closeDialogb">{{ $t('customer.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
@@ -419,7 +443,7 @@
        <el-button type="primary" @click="getTableRowa">
          {{ $t('customer.sure') }}
        </el-button>
        <el-button @click="adda = false">{{ $t('customer.cancel') }}</el-button>
        <el-button @click="closeDialoga">{{ $t('customer.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
@@ -462,7 +486,7 @@
        <el-button type="primary" @click="getTableRowac">
          {{ $t('customer.sure') }}
        </el-button>
        <el-button @click="addc = false">{{ $t('customer.cancel') }}</el-button>
        <el-button @click="closeDialogc">{{ $t('customer.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
UI-Project/src/views/User/rolelist.vue
@@ -99,113 +99,69 @@
    console.error(error);
  }
};
// function buildCascaderOptions(menuList) {
//   // 创建一个映射来快速查找父项
//   const parentIdMap = {};
//   // 初始化最终的级联选项数组
//   const options = [];
//   // 遍历所有菜单项,将它们添加到映射中,并构建顶级菜单项
//   menuList.forEach(item => {
//     // 如果parentId为0,则为顶级菜单项
//     if (item.parentId === 0) {
//       // 初始化children数组
//       item.children = [];
//       // 添加到最终的选项中
//       options.push({
//         value: item.id,
//         label: item.menuName,
//         children: item.children
//       });
//       // 将顶级菜单项添加到映射中(虽然在这个特定场景中可能不是必需的,但可以用于其他目的)
//       parentIdMap[item.id] = item;
//     } else {
//       // 如果parentId不是0,则查找父项并添加到其children数组中
//       // 注意:这里假设parentIdMap在之前已经填充了所有顶级菜单项
//       if (!parentIdMap[item.parentId]) {
//         // 如果父项不存在,则可能是数据不完整或错误,需要处理这种情况
//         console.error(`Parent item with ID ${item.parentId} not found for child item with ID ${item.id}`);
//       } else {
//         parentIdMap[item.parentId].children.push({
//           value: item.id,
//           label: item.menuName
//           // 这里不需要嵌套的children,除非你的菜单有多于两级的结构
//         });
//       }
//     }
//   });
//   return options;
// }
function handleEdit(row) {  
  name.value = row.name;  
  adda.value = true;
  window.localStorage.setItem('ids', row.id);
  const parentIdMap = {};  
  const menuItems = row.menuList.map(item => {
    let parentId = item.parentId || null; // 或者使用 0,如果你的系统是这样设计的
  const menuItemsById = {}; // 快速查找菜单项
  let topLevelItems = []; // 存储顶级菜单项
  row.menuList.forEach(item => {
    const parentId = item.parentId === 0 ? null : item.parentId;
    const menuItem = {
      id: item.id,
      parentId: parentId,
      menuName: item.menuName,
      children: []
    };
    menuItemsById[item.id] = menuItem;
    // 初始化或更新parentIdMap中的数组
    if (!parentIdMap[parentId]) {  
      parentIdMap[parentId] = [];  
    }  
    parentIdMap[parentId].push({
      id: item.id,
      menuName: item.menuName,
      children: [] // 初始为空,稍后会填充子项
    });
    return { id: item.id, menuName: item.menuName, parentId: parentId };
  });
  // 现在,我们遍历所有项,并将它们分配给它们的父项(如果有的话)
  menuItems.forEach(item => {
    if (item.parentId !== null && parentIdMap[item.parentId]) {
      // 将当前项添加到其父项的 children 数组中
      parentIdMap[item.parentId].push({
        ...item, // 复制除了 parentId 之外的所有属性
        children: [] // 这里我们不需要再次添加 children,因为它已经在 parentIdMap 中被初始化了
      });
      // 注意:这里实际上是一个错误,因为我们不应该向 parentIdMap[item.parentId] 数组中添加整个项,
      // 而应该只更新它的 children 数组。但上面的代码示例了如何访问父项。
      // 正确的做法是在构建 parentIdMap 时就设置好 children 数组,并在后面不再修改 parentIdMap[item.parentId] 数组。
    if (parentId === null) {
      // 顶级菜单项直接添加到topLevelItems
      topLevelItems.push(menuItem);
    } else {
      // 非顶级菜单项添加到parentIdMap中
      parentIdMap[parentId].push(menuItem);
    }  
    // 注意:上面的代码逻辑有误,因为我们在构建 parentIdMap 时已经为每个项设置了 children 数组。
    // 我们应该直接修改这些 children 数组,而不是向 parentIdMap[item.parentId] 数组添加新项。
  });  
  // 但是,由于我们在构建 parentIdMap 时已经为每个项(包括其父项)设置了 children 数组,
  // 我们实际上不需要上面的循环来重新分配子项。
  // 我们只需要找到顶级项(parentId 为 null 或 0 的项),并将它们设置为 selectedOptions.value
  // 假设顶级项的 parentId 为 null(或 0,根据你的系统)
  const topLevelItems = parentIdMap[null] || parentIdMap[0] || [];
  // selectedOptions.value 应该是顶级项的数组,但首先我们需要将它们从 parentIdMap 的值中提取出来
  // 由于我们在构建 parentIdMap 时已经为每个顶级项设置了 children,所以我们可以直接使用这些项
  selectedOptions.value = topLevelItems;
  // 注意:selectedOptions.value 的具体格式应该与你的级联选择器组件所期望的格式相匹配
  // 如果你的级联选择器组件期望的是一个包含 value 和 label 的数组数组,你可能还需要进一步转换 topLevelItems
  adda.value = true; // 显示对话框
}
// 注意:上面的代码可能仍然需要根据你的具体数据结构进行调整
// 特别是关于 parentId 的处理,以及如何将菜单项正确地分配给它们的父项
// 处理编辑按钮点击
// function handleEdit(row) {
//   name.value = row.name;
//   let cascaderOptions = buildCascaderOptions(row.menuList);
//   selectedOptions.value = cascaderOptions; // 假设selectedOptions是v-model绑定的级联选择器的值
//   console.log(cascaderOptions); // 查看构建后的级联选项
//   // let transformedMenuList = row.menuList.map(item => ({
//   //   id: item.id, // 假设每个项都有一个id作为唯一标识
//   //   menuName: item.menuName, // 显示给用户的文本
//   //   // children: item.children ? item.children.map(child => ({ value: child.id, label: child.name })) : []
//   // }));
//   // selectedOptions.value = transformedMenuList
//   console.log(transformedMenuList);
//   adda.value = true; // 显示对话框
//   window.localStorage.setItem('id', row.id)
// }
  for (const parentId in parentIdMap) {
    if (parentId !== 'null') { // 跳过顶级菜单项
      parentIdMap[parentId].forEach(child => {
        // 查找父项并添加子项
        if (menuItemsById[parentId]) {
          menuItemsById[parentId].children.push(child);
        }
      });
    }
  }
  if (selectedOptions.value !== topLevelItems) {
    selectedOptions.value = topLevelItems;
  }
  console.log(topLevelItems);
  // selectedOptions.value = topLevelItems;
const topLevelItemsWithChildren = topLevelItems; // 包含顶级菜单项及其子菜单项的数组  
 let selectedPath = [];
// 循环遍历 topLevelItemsWithChildren 数组
for (let i = 0; i < topLevelItemsWithChildren.length; i++) {
 // 添加顶级菜单项的 id
 selectedPath.push(topLevelItemsWithChildren[i].id);
 // 如果有子菜单项,添加第一个子菜单项的 id
 if (topLevelItemsWithChildren[i].children && topLevelItemsWithChildren[i].children.length > 0) {
  for (let j = 0; j < topLevelItemsWithChildren[i].children.length; j++) {
            // 将每个子菜单项的 id 添加到 selectedPath 中
            selectedPath.push(topLevelItemsWithChildren[i].children[j].id);
        }
    }
}
 console.log(selectedPath);
selectedOptions.value = selectedPath;
}
// 编辑
const getTableRowa = async () => {
  let id = window.localStorage.getItem('id')
  let ids = window.localStorage.getItem('ids')
  try {  
    let menuList = [];
     let parentIdMap = {}; // 用于存储已经添加的父项  
@@ -233,7 +189,7 @@
      }  
    });  
    const dataToSend = {  
      id:id,
      id:ids,
      name: name.value,
      menuList: menuList
    };  
@@ -251,6 +207,16 @@
    console.error(error);
  }
};
function closeDialog(row) {
     add.value = false;
      name.value = '';
      selectedOptions.value = '';
}
function closeDialoga(row) {
     adda.value = false;
      name.value = '';
      selectedOptions.value = '';
}
// 删除 
 const opena = async(row) => {  
  try {
@@ -346,7 +312,7 @@
        <el-button type="primary" @click="getTableRow">
          {{ $t('delivery.sure') }}
        </el-button>
        <el-button @click="add = false"> {{ $t('delivery.cancel') }}</el-button>
        <el-button @click="closeDialog"> {{ $t('delivery.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
@@ -386,7 +352,7 @@
        <el-button type="primary" @click="getTableRowa">
          {{ $t('delivery.sure') }}
        </el-button>
        <el-button @click="adda = false">{{ $t('delivery.cancel') }}</el-button>
        <el-button @click="closeDialoga">{{ $t('delivery.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
UI-Project/src/views/User/userlist.vue
@@ -107,6 +107,20 @@
  window.localStorage.setItem('id', row.id)
function closeDialog(row) {
     add.value = false;
     userName.value = '';
     nickName.value = '';
     password.value = '';
     selectedProjectNoa.value = '';
}
function closeDialoga(row) {
     adda.value = false;
     userName.value = '';
     nickName.value = '';
     password.value = '';
}
// 添加 
const getTableRow = async () => {
  try {
@@ -131,7 +145,7 @@
     tableData.value = response.data;
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
      ElMessage.error(response.message);
    }
  } catch (error) {
    // 处理错误
@@ -281,7 +295,7 @@
        <el-button type="primary" @click="getTableRow">
          {{ $t('productStock.sure') }}
        </el-button>
        <el-button @click="add = false">{{ $t('productStock.cancel') }}</el-button>
        <el-button @click="closeDialog">{{ $t('productStock.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog> 
@@ -328,7 +342,7 @@
        <el-button type="primary" @click="getTableRowa">
          {{ $t('productStock.sure') }}
        </el-button>
        <el-button @click="adda = false">{{ $t('productStock.cancel') }}</el-button>
        <el-button @click="closeDialoga">{{ $t('productStock.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>