严智鑫
2024-09-14 f74b51190a77c560949abd4628c5f33cd7e734ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!--  打标机  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
const requestData = reactive({
  account: '',
  password: '',
});
const findCraftTaskingData = 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;
    } else {
      ElMessage.warning(res.msg)
    }
  } catch (error) {
    // console.error('Error fetching rects :', error);  
  }
}
//修改工作状态 【失败/正在工作/完工】
const workStatus = async(row,state) => {
  let url;
  if(state=="失败"){
    url="/deviceInteraction/tasking/loseMachineTask";
  }else if(state=="正在工作"){
    url="/deviceInteraction/tasking/startMachineTask";
  }else if(state=="完工"){
    url="/deviceInteraction/tasking/finishMachineTask";
  }else{
    return;
  }
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //开始修改
          request.post(url,
            {
              "id": 11
            }).then((res) => { // 替换为你的API端点  
              if (res.code === 200) {
                ElMessage.success(res.message);
                load();
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
 
}
 
//开工/暂停
const machineStatus = async(row,state) => {
 
}
//破损
const damagedTask = async(row) => {
 
}
//下线(拿走)
const downLine = async(row,state) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/updateDownLine",
            {
              "glassId": row.glassId,
              "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 topLine = async() => {
 
}
 
</script>
<template>
  <div ref="content">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      自动打标机
    </div>
    <hr />
    <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="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
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" label="序号" min-width="30" />
        <el-table-column prop="batchNumber" label="批次号" />
        <el-table-column prop="taskType" label="任务类型" />
        <el-table-column prop="glassId" label="玻璃编号" />
        <el-table-column prop="length" label="长" />
        <el-table-column prop="width" label="宽" />
        <el-table-column prop="thickness" label="厚" />
        <el-table-column prop="workState" label="状态" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <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>
          </template>
        </el-table-column>
      </el-table>
    </div>
 
    <div id="main-body"
      style="width: 100%; height: 460px;background-image: url(../../src/assets/自动打标机.png) ;background-size: 100% 100%;">
      <!-- 画图内容 -->
      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
      </div>
    </div>
  </div>
</template>
 
<style scoped>
table {
  text-align: center;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
 
table td {
  text-align: center;
}
 
#main-body {
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  margin-top: 25px;
}
 
#searchButton {
  width: 100px;
  height: 40px;
  font-size: 16px;
  border-radius: 5px;
  background-color: #409EFF;
  color: #fff;
  border: none;
  cursor: pointer;
}
</style>