wu
2024-09-14 65ce957a82e047fe8327bcc1a290234da1d3ca29
UI-Project/src/views/Marking/marking.vue
@@ -10,20 +10,36 @@
  account: '',
  password: '',
});
const findCraftTaskingData = ref([]);
const loadData = ref([]);
const findMachine = ref([]);
onMounted(async () => {
  load();
});
//获取数据
const load = async() => {
  //获取设备任务数据
  try {
    const response = await request.post('/deviceInteraction/tasking/findMachineTask',
    {
      "id": 11
    }); // 替换为你的API端点  
    if (response.code === 200) {
      findCraftTaskingData.value= response.data;
      loadData.value.findTaskingData= response.data;
    } else {
      ElMessage.warning(res.msg)
    }
  } catch (error) {
    // console.error('Error fetching rects :', error);
  }
  //获取设备状态
  try {
    const response = await request.post('/deviceInteraction/machine/findMachine',
    {
      "id": 11
    }); // 替换为你的API端点
    if (response.code === 200) {
      findMachine.value= response.data;
    } else {
      ElMessage.warning(res.msg)
    }
@@ -76,15 +92,7 @@
}
//开工/暂停
const machineStatus = async(row,state) => {
}
//破损
const damagedTask = async(row) => {
}
//下线(拿走)
const downLine = async(row,state) => {
const machineStatus = async(state) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),  
@@ -96,10 +104,74 @@
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/updateDownLine",
          request.post("/deviceInteraction/machine/updateMachineState",
            {
              "id": 11,
              "state": state
            }).then((res) => { // 替换为你的API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
                this.load();
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
}
//破损
const damagedTask = async(row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/damagedTask",
            {
              "glassId": row.glassId
            }).then((res) => { // 替换为你的API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
                this.load();
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
}
//下线(拿走)
const glassDownLine = async(row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/glassDownLine",
            {
              "glassId": row.glassId,
              "state": state
            }).then((res) => { // 替换为你的API端点  
              if (res.code === 200) {
                ElMessage.success(res.message);
@@ -131,15 +203,15 @@
    <br>
    <div id="search" style="padding-left: 20px;">
      <!-- 功能 -->
      <el-button type="primary" id="searchButton" @click="machineStatus">开工</el-button>
      <el-button type="primary" id="searchButton" @click="topLine">上线</el-button>
      <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?'开工':'暂停'}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">上线</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- 表格内容 -->
      <el-table :data="findCraftTaskingData" stripe
      <el-table :data="loadData.findTaskingData" stripe
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
@@ -155,8 +227,8 @@
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '失败')">重发</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">完工</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '破损')">破损</el-button>
            <el-button size="mini" link type="primary" plain @click="downLine(scope.row, '下线')">下线</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">破损</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">下线</el-button>
          </template>
        </el-table-column>
      </el-table>