zhoushihao
2024-05-23 a8959c68af98c26e14888f946f40501b94fbc6e5
Merge remote-tracking branch 'origin/master'
4个文件已修改
480 ■■■■ 已修改文件
UI-Project/src/router/index.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Identify/identify.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Returns/returns.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/User/userlist.vue 420 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/router/index.js
@@ -210,7 +210,29 @@
            }
          ]
         },
/*----------- 系统管理 ----------------*/
{
  path: 'User',
  name: 'user',
  component: () => import('../views/User/user.vue'),
  children:[
    {
      path: '/User/userlist',
      name: 'userlist',
      component: () => import('../views/User/userlist.vue')
    },
    {
      path: '/User/rolelist',
      name: 'rolelist',
      component: () => import('../views/User/rolelist.vue')
    },
    {
      path: '/User/permissions',
      name: 'permissions',
      component: () => import('../views/User/permissions.vue')
    }
  ]
 },
        /*----------- 管理系统 ----------------*/
        {
          path: 'sys',
UI-Project/src/views/Identify/identify.vue
@@ -21,7 +21,7 @@
     <!-- <div  class="centered-text" >NG24030401B01</div> -->
     <div  class="centered-text">
    <div>{{ rect.process_id }}</div>
    <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div>
    <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div>
  </div>
  </div> 
  <!-- 点击弹出 -->
@@ -78,6 +78,8 @@
        x_axis: (rect.x_axis*100) * 0.005, // 将x值除以3  
        y_axis: (rect.y_axis*100) * 0.005,
        width: (rect.width*100) * 0.004 ,
        widtha: rect.width ,
        heighta: rect.height ,
        height:( rect.height*100) * 0.004 ,
        glass_state: rect.glass_state
      }));  
UI-Project/src/views/Returns/returns.vue
@@ -14,8 +14,16 @@
const adda = ref(false)
const flake = ref(false)
const flakea = ref(false)
const state = reactive({updateKey: 0})
// const value = ref('')
// const patternHeight = ref('');
// const patternWidth = ref('');
// const filmsId = ref('');
// const patternThickness = ref('');
// const number = ref('');
//  patternHeight.value = '';
    //  patternWidth.value = '';
    //  filmsId.value = '';
    //  patternThickness.value = '';
    //  number.value = '';
import request from "@/utils/request"
const ida = ref(null); 
import { ref, onMounted } from "vue";
@@ -58,7 +66,7 @@
    }
  } catch (error) {
    // 处理请求失败的情况
    ElMessage.error('获取表格数据失败,请重试');
    // ElMessage.error('获取表格数据失败,请重试');
  }
};
   request.get("/loadGlass/LoadGlass/list").then((res) => {
@@ -248,6 +256,11 @@
      // window.location.reload() 
      add.value = false;
     tableDataa.value = response.data;
    //  patternHeight = '';
    //  patternWidth.value = '';
    //  filmsId.value = '';
    //  patternThickness.value = '';
    //  number.value = '';
      window.localStorage.setItem('workstationId', response.data.workstationId)
      let workstationId = window.localStorage.getItem('workstationId')
      if (workstationId == '1') {
@@ -351,6 +364,7 @@
      ElMessage.success(response.message);
      // window.location.reload() 
      dialogFormVisible.value = false;
      selectedProjectNo.value = ''
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -374,7 +388,7 @@
      // window.location.reload() 
      blind.value = false;
      tableData.splice(0, tableData.length, ...response.data);
      selectedProjectNoa.value = ''
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -402,7 +416,7 @@
      blinda.value = false;
      // tableData.value = response.data
      // tableData.value = [];
      state.updateKey ++
      tableData.splice([]);
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -435,7 +449,7 @@
      ElMessage.success(response.message);
      // window.location.reload() 
      blindb.value = false;
      state.updateKey ++
      tableData.splice([]);
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -577,7 +591,7 @@
    <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">停止任务</el-button>
    
    <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;" :key="state.updateKey">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
    <el-table
    height="150"
     ref="table" 
@@ -678,7 +692,7 @@
     :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
        >
          <el-table-column prop="patternWidth" align="center" label="宽" min-width="80" />
          <el-table-column prop="patternHeight" align="center" label="长" min-width="80" />
          <el-table-column prop="patternHeight" align="center" label="高" min-width="80" />
          <el-table-column prop="filmsId" align="center" label="膜系" min-width="80" />
          <el-table-column prop="number" align="center" label="数量" min-width="80" />
          <el-table-column fixed="right" label="操作" align="center" width="150">
@@ -698,7 +712,7 @@
          <el-col :span="6">
              <div id="dt" style="font-size: 15px;">
        <div>
              <el-form-item label="长:" :required="true" style="width: 14vw">
              <el-form-item label="高:" :required="true" style="width: 14vw">
                <el-input  v-model="patternHeight" autocomplete="off" />
              </el-form-item></div></div>
          </el-col>
UI-Project/src/views/User/userlist.vue
@@ -1,178 +1,154 @@
<script lang="ts" setup>
<script setup>
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {useRouter} from "vue-router"
import { ref } from 'vue'
const router = useRouter()
const value1 = ref(true)
const add = ref(false)
const adda = ref(false)
const changer = ref(false)
import request from "@/utils/request"
import { ref, onMounted } from "vue";
// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
//  import LanguageMixin from './lang/LanguageMixin'
const selectedProjectNoa = ref(''); // 当前选中的角色
// const options = ref<any[]>([]); // 下拉选项列表
  const userName = ref('');
  const password = ref('');
const tableData = [
  {
    id: '1',
    long: '1005',
    wide: '183.6',
    thick: '1991',
    time: '2024/4/1',
    type: '待识别',
    typea: '1',
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    time: '2024/4/1',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    time: '2024/4/1',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
]
const open = () => {
  ElMessageBox.confirm(
    '是否删除该条信息?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
    .then(() => {
      ElMessage({
        type: 'success',
        message: '删除成功!',
      })
const tableData = ref([])
const slot = ref('')
request.post("/loadGlass/sys/user/listByUserName",{
  key: ''
}).then((res) => {
          if (res.code == 200) {
          console.log(res.data);
          tableData.value = res.data
          } else {
          ElMessage.warning(res.msg)
          }
          });
// 重置密码
 const open = async(row) => {
  try {
    const confirmResult = await ElMessageBox.confirm(
      '是否重置用户密码?',
      '提示',
      {
        confirmButtonText: '是',
        cancelButtonText: '取消',
        type: 'warning',
      }
    );
    if (confirmResult === 'confirm') {
      // 用户点击了“是”,现在调用删除接口
      var url="/loadGlass/sys/user/resetPassword?userId="+row.id;
      console.log(url);
      const response = await request.post(url, {
        esdId: row.esdId
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: '删除失败',
      })
    })
}
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
}
const dialogForm = () => {
  ElMessageBox.confirm(
    '是否重置密码?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
  .then(() => {
    // this.boxa = true
    // this.box = false
    })
}
const dialogForma = () => {
  ElMessageBox.confirm(
    '是否删除该条信息?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
}
const options = [
  {
    value: 'Option1',
    label: 'admin',
  },
  {
    value: 'Option2',
    label: 'ueser2',
  },
  {
    value: 'Option3',
    label: 'ueser3',
  },
]
const optionsa = [
  {
    valuea: 'Option1',
    labela: '正常',
  },
  {
    valuea: 'Option2',
    labela: '禁用',
  },
]
const data= reactive({
   tableList:[]//table数据
})
const beforeChange = () => {
  return new Promise((resolve) => {
    setTimeout(() => {
      ElMessage.success("修改成功!");
      return resolve(true);
    }, 1000);
  });
};
// //js层,实战版本,与后台接口交互
// const gettableList = (id) = >{
//   xxx接口.({
//    id:id
// }).then((res)=>{
//    //将数据传给el-table绑定的:data=>data.tableList
//    data.tableList = res.data
// })
// }
    if (response.code === 200) {
      ElMessage.success(response.message);
      } else {
        // 删除失败,您可以处理错误或显示错误信息给用户
      ElMessage.error(response.msg);
        // alert('删除失败:' + deleteResponse.message);
      }
    }
  } catch (error) {
    // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等
    console.error('发生错误:', error);
  }
};
const titleSelectJsona = ref({
  processType: [],
 
// //最后将请求函数挂载到vue视图上
// onMounted(() => {
//   gettableList ()
})
// const handleInputChangea = async (value: string) => {
//   if (value) {
//     await fetchOptionsa(value);
//   } else {
//     options.value = []; // 清空选项列表
//   }
// };
onMounted(() => {
  // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要)
  fetchOptionsa('');
});
  // 角色下拉选
  const fetchOptionsa = async () => {
  try {
    // 发送请求到后端接口
    const response = await request.post('/loadGlass/sys/role/queryRole',{
  key: ''
});
    if (response.code == 200) {
    titleSelectJsona.value.processTypea = response.data;
    console.log(response.data);
    } else {
      ElMessage.warning(response.data);
    }
  } catch (error) {
    console.error('Error fetching options:', error);
  }
};
// 添加
const getTableRow = async () => {
  try {
    const response = await request.post('/loadGlass/sys/user/saveUser', {
      userName: userName.value,
      password: password.value,
      name: selectedProjectNoa.value,
    });
    if (response.code == 200) {
      // 绑定成功,处理逻辑
      ElMessage.success(response.message);
      add.value = false;
     tableData.value = response.data;
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
    }
  } catch (error) {
    // 处理错误
    console.error(error);
  }
};
// 删除
 const opena = async(row) => {
  try {
    const confirmResult = await ElMessageBox.confirm(
      '是否删除该用户?',
      '提示',
      {
        confirmButtonText: '是',
        cancelButtonText: '取消',
        type: 'warning',
      }
    );
    if (confirmResult === 'confirm') {
      // 用户点击了“是”,现在调用删除接口
      const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", {
        glassId: row.GlassId,
        controlsId: 301
    })
    if (response.code === 200) {
      ElMessage.success(response.message);
      } else {
        // 删除失败,您可以处理错误或显示错误信息给用户
      ElMessage.error(response.msg);
        // alert('删除失败:' + deleteResponse.message);
      }
    }
  } catch (error) {
    // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等
    console.error('发生错误:', error);
  }
};
// })
// const delete = () => {
//   ElMessageBox.confirm(
//     '是否删除该条信息?',
//     '提示',
//     {
//       confirmButtonText: '是',
//       cancelButtonText: '取消',
//       type: 'warning',
//     }
//   )
//   .then(() => {
//     })
// }
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -207,57 +183,39 @@
      'long': '5',
      'wide': '1005',
      'thick': '183.6',
      'time': '2024/4/1',
    }
  ]
})
</script>
<template>
  <div>
        <el-button type="primary" style="margin-top: 10px;margin-left: 10px;"  size="mini" id="searchButton" @click="add = true">添加用户</el-button>
        <el-input
          clearable
          placeholder="请输入用户名"
          size="mini"
          style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
        />
        <el-input
          clearable
          placeholder="请输入邮箱"
          size="mini"
          style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;"
        />
        <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">查询</el-button >
        <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">清空</el-button>
    <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
        <el-table height="100%" ref="table"
     <el-button type="primary" style="margin-top: 10px;margin-left: 10px;"  size="mini" id="searchButton" @click="add = true">添加用户</el-button>
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
        <el-table height="240" ref="table"
        @selection-change="handleSelectionChange"
        :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="id" align="center" label="用户名" min-width="80" />
          <el-table-column prop="long" align="center" label="邮箱" min-width="120" />
          <el-table-column prop="time" align="center" label="创建时间" min-width="120" />
          <el-table-column  align="center" prop="changer"  label="是否禁用"   min-width="140"  >
           <template #default="scope">
           <el-switch  v-model="scope.row.changer"  :before-change="beforeChange" />
         </template>
         </el-table-column>
          <el-table-column prop="userName" align="center" label="用户名" min-width="180" />
          <el-table-column align="center" label="角色" min-width="80">
            <template #default="scope">
             <el-tag v-for="role in scope.row.roleList">
            {{role.name}}
           </el-tag>
         </template>
            </el-table-column>
          <el-table-column fixed="right" label="操作" align="center" width="200">
            <template #default>
              <el-button size="mini" type="text" plain  @click="dialogForm">重置密码</el-button>
              <el-button size="mini" type="text" plain  @click="adda = true">编辑</el-button>
              <el-button size="mini" type="text" plain  @click="dialogForma">删除</el-button>
            <template #default="scope">
              <el-button size="mini" type="text" plain @click="open(scope.row)">重置密码</el-button>
              <el-button size="mini" type="text" plain @click="adda = true">编辑</el-button>
              <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button>
            </template>
        </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
  <el-dialog v-model="add" top="23vh" width="37%" title="添加用户" >
    <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
            <el-form  size="mini" label-width="150px">
@@ -266,8 +224,8 @@
          <el-col :span="6">
              <div id="dt" style="font-size: 15px;">
        <div>
              <el-form-item label="用户名:" :required="true" style="width: 25vw">
                <el-input  autocomplete="off" />
          <el-form-item label="用户名:" :required="true" style="width: 25vw">
                <el-input v-model="userName" autocomplete="off" />
              </el-form-item></div></div>
          </el-col>
        </el-row>
@@ -277,46 +235,17 @@
        <div>
              <el-form-item label="角色:" :required="true" style="width: 25vw;">
                <el-select
               v-model="value"
               v-model="selectedProjectNoa"
               filterable
               clearable
               placeholder="请选择角色"
               style="width: 330px"
             >
               <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
              </el-form-item></div></div>
          </el-col>
        </el-row>
        <el-row style="margin-top: 10px;">
          <el-col :span="6">
              <div id="dt" style="font-size: 15px;">
        <div>
              <el-form-item label="邮箱:" :required="true" style="width: 25vw;">
                <el-input autocomplete="off" />
              </el-form-item></div></div>
          </el-col>
        </el-row>
        <el-row style="margin-top: 10px;">
          <el-col :span="6">
              <div id="dt" style="font-size: 15px;">
        <div>
              <el-form-item label="是否禁用" :required="true" style="width: 25vw;">
                <el-select
               v-model="value"
               clearable
               placeholder="请选择是否禁用"
               style="width: 330px"
             >
               <el-option
            v-for="item in optionsa"
            :key="item.valuea"
            :label="item.labela"
            :value="item.valuea"
         v-for="item in titleSelectJsona['processTypea']"
            :key="item.id"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
              </el-form-item></div></div>
@@ -327,7 +256,11 @@
              <div id="dt" style="font-size: 15px;">
        <div>
              <el-form-item label="密码:" :required="true" style="width: 25vw;">
                <el-input autocomplete="off" />
                <el-input style="width: 340px;"
                        v-model="password"
                        autocomplete="off"
                        :prefix-icon="Lock"
                        show-password/>
              </el-form-item></div></div>
          </el-col>
        </el-row>
@@ -336,13 +269,13 @@
          </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="getTableRow('edit')">
        <el-button type="primary" @click="getTableRow">
          确认
        </el-button>
        <el-button @click="add = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
  </el-dialog>
  <el-dialog v-model="adda" top="23vh" width="37%" title="修改用户" >
    <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
            <el-form  size="mini" label-width="150px">
@@ -448,14 +381,7 @@
   margin-left: 28%;
}
#awatch{
  height: 450px;
}
#main-body{
  margin-top: -20px;
  margin-left: 300px;
}
#main-bodya{
  margin-top: -10px;
  margin-left: 100px;
  height: 460px;
  /* margin-top: -60px; */
}
</style>