|
@@ -1,8 +1,9 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, onMounted, reactive } from "vue";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
+import { ElMessage,ElLoading } from "element-plus";
|
|
|
import { genFileId } from "element-plus";
|
|
|
import axios from "axios";
|
|
|
+import { Loading } from "@element-plus/icons-vue/dist/types";
|
|
|
|
|
|
const leftDirection = ref("东");
|
|
|
const rightDirection = ref("西");
|
|
@@ -16,6 +17,9 @@ const flag = ref<string>("");
|
|
|
const disableFlag = ref<boolean>(false);
|
|
|
const upload = ref<any>();
|
|
|
|
|
|
+//load标志
|
|
|
+const load =ref<any>();
|
|
|
+
|
|
|
const formData = ref<any>();
|
|
|
|
|
|
const fileType = ref<string>("");
|
|
@@ -50,6 +54,14 @@ const uploadFile = (file: any) => {
|
|
|
}
|
|
|
};
|
|
|
const startFun = () => {
|
|
|
+ //判断是否上传文件
|
|
|
+ if(currentFile.value==''||currentFile.value==null){
|
|
|
+ ElMessage({
|
|
|
+ message: `请选择文件`,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
const formData = new FormData();
|
|
|
formData.append("file", currentFile.value);
|
|
|
formData.append("userName", name.value);
|
|
@@ -61,6 +73,11 @@ const startFun = () => {
|
|
|
|
|
|
formData.append("taskType", taskType.value);
|
|
|
disableFlag.value = true;
|
|
|
+ load.value=ElLoading.service({
|
|
|
+ lock: true,
|
|
|
+ text: '努力检测中',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)',
|
|
|
+ })
|
|
|
axios
|
|
|
.post(`/v1/record/create`, formData)
|
|
|
.then((res) => {
|
|
@@ -76,6 +93,7 @@ const startFun = () => {
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
+ load.value.close()
|
|
|
disableFlag.value = false;
|
|
|
});
|
|
|
// formData.append("userName", params.name);
|
|
@@ -84,7 +102,9 @@ const startFun = () => {
|
|
|
|
|
|
const queryDetail = () => {
|
|
|
axios.get(`/v1/record/${flag.value}/find`, {}).then((res) => {
|
|
|
+ load.value.close()
|
|
|
if (res.data.code == 200) {
|
|
|
+
|
|
|
//当结果为空时
|
|
|
// ElMessage({
|
|
|
// message: `结果为${res.data.data.Result}`,
|
|
@@ -211,7 +231,7 @@ onMounted(() => {
|
|
|
</div>
|
|
|
<div>检测结果:</div>
|
|
|
<div class="run_dir">
|
|
|
- <div>车辆类别</div>
|
|
|
+ <div>车辆类别:</div>
|
|
|
<div class="run_input">{{ car_type }}</div>
|
|
|
</div>
|
|
|
<div class="run_dir">
|