严智鑫
2024-05-16 4185a44f983c7aa3cf45ec03a65eece9e847e229
UI-Project/src/views/StockBasicData/stockBasicData.vue
@@ -3,38 +3,58 @@
import {reactive} from "vue";
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { ref } from 'vue'
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 tableData = [
  {
    id: '1',
    long: '1005',
    wide: '183.6',
    thick: '1991',
    type: '待识别',
    typea: '1',
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    typea: '1',
    type: '待识别'
  },
]
const open = () => {
  ElMessageBox.confirm(
const tableData = ref([])
const slot = ref('')
request.post("/cacheGlass/taskCache/selectEdgTask").then((res) => {
          if (res.code == 200) {
          console.log(res.data);
          tableData.value = res.data
          console.log(res.data[0].slot);
          } else {
          ElMessage.warning(res.msg)
          }
          });
//   const getTableRow = (row,type) =>{
//   switch (type) {
//     case 'delete':{
//       let flowData = ref({
//         id:0,
//         slot:row.slot
//       })
//       request.post("/cacheGlass/edgStorageCage/edgStorageCageGlass",flowData.value).then((res) => {
//         if(res.code==200){
//           ElMessage.success(t('searchOrder.msgDeleteSuccess'))
//           router.push({path:'/main/delivery/selectDelivery',query:{random:Math.random()}})
//         }else{
//           ElMessage.warning(res.msg)
//           router.push("/login")
//         }
//       })
//       return
//     }
//   }
// }
// let slots = ref({
//   id:0,
//    slot: slot.value
// })
const open = async(row) => {
  try {
    const confirmResult = await ElMessageBox.confirm(
    '是否删除该条信息?',
    '提示',
    {
@@ -42,60 +62,77 @@
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
    .then(() => {
      ElMessage({
        type: 'success',
        message: '删除成功!',
    );
    if (confirmResult === 'confirm') {
      // 用户点击了“是”,现在调用删除接口
      const deleteResponse = await request.post("/cacheGlass/edgStorageCage/edgStorageCageGlass", {
        id:0,
        slot: row.slot
      })
    })
    .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
      if (response.code == 200) {
        // 删除成功,您可以根据需要处理成功的情况
        alert('删除成功!');
      } else {
        // 删除失败,您可以处理错误或显示错误信息给用户
        alert('删除失败:' + deleteResponse.message);
    }
  }
  } catch (error) {
    // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等
    console.error('发生错误:', error);
}
const dialogForm = () => {
  ElMessageBox.confirm(
    '是否破损?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
  .then(() => {
    // this.boxa = true
    // this.box = false
};
// const open = () => {
//   ElMessageBox.confirm(
//     '是否删除该条信息?',
//     '提示',
//     {
//       confirmButtonText: '是',
//       cancelButtonText: '取消',
//       type: 'warning',
//     }
//   )
//     .then(() => {
//       ElMessage({
//         type: 'success',
//         message: '删除成功!',
//       })
//     })
//     .catch(() => {
//       ElMessage({
//         type: 'info',
//         message: '删除失败',
//       })
//     })
// }
// 删除
// const handleBindRacka = (row) => {
//   adda.value = true; // 打开绑定架子对话框
// };
// // 删除
// const handleConfirma = async () => {
//   try {
//       window.localStorage.setItem('slot', res.data.slot)
//     let slot = window.localStorage.getItem('slot')
//     const response = await request.post('/cacheGlass/edgStorageCage/edgStorageCageGlass', {
//       slot: slot.value,
//       id: 0
//     });
      
    })
}
const dialogForma = () => {
  ElMessageBox.confirm(
    '是否删除该条信息?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
}
//     if (response.code == 200) {
//       // 绑定成功,处理逻辑
//       ElMessage.success(response.message);
//       adda.value = false;
//     } else {
//       // 请求失败,显示错误消息
//       ElMessage.error(response.msg);
//     }
//   } catch (error) {
//     // 处理错误
//     console.error(error);
//   }
// };
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -131,36 +168,48 @@
      'wide': '1005',
      'thick': '183.6',
    }
  ],
  ]
})
</script>
<template>
  <div>
    <el-card style="flex: 1;margin-left: 10px;margin-top: 5px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
        <el-table height="100%" ref="table"
    <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="id" min-width="80" />
          <el-table-column prop="long" align="center" label="长" min-width="120" />
          <el-table-column prop="wide" align="center" label="宽" min-width="120" />
          <el-table-column prop="wide" align="center" label="厚度" min-width="120" />
          <el-table-column prop="wide" align="center" label="膜系" min-width="120" />
          <el-table-column prop="wide" align="center" label="出片顺序" min-width="120" />
          <el-table-column prop="wide" align="center" label="流程卡号" min-width="120" />
          <el-table-column prop="wide" align="center" label="其他" min-width="120" />
          <el-table-column prop="slot" align="center" label="id" min-width="80" />
          <el-table-column prop="glass_id" align="center" label="长" min-width="80" />
          <el-table-column prop="width" align="center" label="宽" min-width="120" />
          <el-table-column prop="height" align="center" label="厚度" min-width="120" />
          <el-table-column prop="height" align="center" label="膜系" min-width="120" />
          <el-table-column prop="height" align="center" label="出片顺序" min-width="120" />
          <el-table-column prop="height" align="center" label="流程卡号" min-width="120" />
          <el-table-column prop="height" align="center" label="其他" min-width="120" />
          <el-table-column
            align="center"
            label="启用状态"
            min-width="80"
            prop="enable_state"
          >
          <template #default="scope">
            <el-tag type="success" >{{ scope.row.enable_state==1?"启用":"未启用"  }}</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="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="open(scope.row)">删除</el-button>
            </template>
        </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>
@@ -182,14 +231,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>