From ca5a51b272cbf4626a09179dbe6d7bc2f9e93ea6 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期六, 02 九月 2023 12:13:00 +0800
Subject: [PATCH] 下发成功之后 关闭弹框+刷新get 接口获取status
---
src/main.js | 5
src/api/global-directives.js | 17 ++
src/components/AddIssue.vue | 399 ++++++++++++++++++++++++++-----------------------
3 files changed, 230 insertions(+), 191 deletions(-)
diff --git a/src/api/global-directives.js b/src/api/global-directives.js
new file mode 100644
index 0000000..e816875
--- /dev/null
+++ b/src/api/global-directives.js
@@ -0,0 +1,17 @@
+import Vue from 'vue'
+// import { Message } from 'element-ui'
+// 闃叉閲嶅鎻愪氦鎸囦护
+const preventReClick = Vue.directive('preventReClick', {
+ inserted (el, binding) {
+ el.addEventListener('click', () => {
+ if (!el.disabled) {
+ el.disabled = true
+ // Message.warning('鎿嶄綔棰戠箒锛�')
+ setTimeout(() => {
+ el.disabled = false
+ }, binding.value || 2000)
+ }
+ })
+ }
+})
+export { preventReClick }
diff --git a/src/components/AddIssue.vue b/src/components/AddIssue.vue
index 8b76557..6790233 100644
--- a/src/components/AddIssue.vue
+++ b/src/components/AddIssue.vue
@@ -7,7 +7,7 @@
class="add-event-dialog"
:show-close="false"
>
- <div class="tank-box">
+ <div class="tank-box" v-loading.fullscreen.lock="isLoading" element-loading-text="涓嬪彂涓紝璇风◢鍚�...">
<div slot="title" class="tac drawerHeader">鏂颁换鍔�</div>
<div class="dialog-content-box">
<div
@@ -35,95 +35,101 @@
<div class="error-m">
{{ messageError }}
</div>
- <div class="font_size_20 color_fff" style="text-align:center;width:100%;margin:10px 0;">璇烽噸璇�</div>
+ <div
+ class="font_size_20 color_fff"
+ style="text-align: center; width: 100%; margin: 10px 0"
+ >
+ 璇烽噸璇�
+ </div>
</template>
<template v-else>
<div class="title-auto-box">
- <div class="title-box margin_bottom_20">
- <div class="title-item">
- 璁㈠崟缂栧彿锛歿{ taskData.Order.orderId || "" }}
- </div>
- <div class="title-item">
- 宸ュ崟缂栧彿锛歿{ taskData.Order.workOrderId || "" }}
- </div>
- <div class="title-item">
- 浜у搧鍚嶇О锛歿{ taskData.Order.productName || "" }}
- </div>
- <div class="title-item">
- 鏁伴噺锛歿{ taskData.Order.amount || 0 }}{{ taskData.Order.unit }}
- </div>
- <div class="title-item">
- 浜よ揣鏃ユ湡锛歿{ taskData.Order.deliverDate || "" }}
- </div>
- <div class="title-item">
- 宸ユ椂锛� {{ taskData.Procedure.procedure.workHours || "" }}
- </div>
- <div class="title-item">
- 璧锋鏃堕棿锛� {{ formatDate(taskData.Order.startTime) || "" }}
- -
- {{ formatDate(taskData.Order.endTime) }}
- </div>
- <div class="title-item">
- 瀹㈡埛鍚嶇О锛歿{ taskData.Order.customer || "" }}
- </div>
- <div class="title-item title-item-two">
- 璐х墿鎻忚堪锛� {{ taskData.Order.orderAttr || "" }}
- </div>
+ <div class="title-box margin_bottom_20">
+ <div class="title-item">
+ 璁㈠崟缂栧彿锛歿{ taskData.Order.orderId || "" }}
+ </div>
+ <div class="title-item">
+ 宸ュ崟缂栧彿锛歿{ taskData.Order.workOrderId || "" }}
+ </div>
+ <div class="title-item">
+ 浜у搧鍚嶇О锛歿{ taskData.Order.productName || "" }}
+ </div>
+ <div class="title-item">
+ 鏁伴噺锛歿{ taskData.Order.amount || 0
+ }}{{ taskData.Order.unit }}
+ </div>
+ <div class="title-item">
+ 浜よ揣鏃ユ湡锛歿{ taskData.Order.deliverDate || "" }}
+ </div>
+ <div class="title-item">
+ 宸ユ椂锛� {{ taskData.Procedure.procedure.workHours || "" }}
+ </div>
+ <div class="title-item">
+ 璧锋鏃堕棿锛� {{ formatDate(taskData.Order.startTime) || "" }}
+ -
+ {{ formatDate(taskData.Order.endTime) }}
+ </div>
+ <div class="title-item">
+ 瀹㈡埛鍚嶇О锛歿{ taskData.Order.customer || "" }}
+ </div>
+ <div class="title-item title-item-two">
+ 璐х墿鎻忚堪锛� {{ taskData.Order.orderAttr || "" }}
+ </div>
- <div class="title-item title-item-two">
- 鍙傛暟瑕佹眰锛歿{ taskData.Order.parameter || "" }}
+ <div class="title-item title-item-two">
+ 鍙傛暟瑕佹眰锛歿{ taskData.Order.parameter || "" }}
+ </div>
+ </div>
+ <div class="title-box margin_bottom_20">
+ <div
+ style="
+ color: #fff;
+ font-size: 18px;
+ font-weight: 700;
+ margin-bottom: 10px;
+ margin-top: 20px;
+ "
+ >
+ 宸ヨ壓鍙傛暟
+ </div>
+ <div
+ class="title-item title-item-two"
+ v-for="(item, index) in Arr"
+ :key="index"
+ >
+ {{ item.Key }}锛歿{ item.Value || "" }}
+ </div>
</div>
</div>
- <div class="title-box margin_bottom_20">
+ <div class="process-box" v-if="showBtn == 2 || showBtn == 3">
<div
style="
- color: #fff;
- font-size: 18px;
+ color: red;
+ font-size: 16px;
+ width: 100%;
+ text-align: center;
font-weight: 700;
- margin-bottom: 10px;
- margin-top: 20px;
+ margin-bottom: 20px;
+ margin-top: 10px;
"
>
- 宸ヨ壓鍙傛暟
+ {{ message }}
</div>
- <div
- class="title-item title-item-two"
- v-for="(item, index) in Arr"
- :key="index"
- >
- {{ item.Key }}锛歿{ item.Value || "" }}
- </div>
- </div>
- </div>
- <div class="process-box" v-if="showBtn==2||showBtn==3">
- <div
- style="
- color: red;
- font-size: 16px;
- width: 100%;
- text-align: center;
- font-weight: 700;
- margin-bottom: 20px;
- margin-top: 10px;
- "
- >
- {{ message }}
- </div>
- <div class="progress-item">
- <span>{{ parseInt(num/60*100) }}%</span>
- <el-progress
- style="width:calc(100% - 50px);float:right"
+ <div class="progress-item">
+ <span>{{ parseInt((num / 60) * 100) }}%</span>
+ <el-progress
+ style="width: calc(100% - 50px); float: right"
define-back-color="#CDC6C6"
color="#00cc66"
text-color="#fff"
:text-inside="true"
:stroke-width="20"
- :percentage="parseInt(num/60*100)"
+ :percentage="parseInt((num / 60) * 100)"
></el-progress>
- </div>
- </div>
+ </div>
+ </div>
</template>
-
+
<!-- <div class="circel-text">
<div class="circel-text-b">
鐢熶骇鏁伴噺锛�<span>{{ Order.amount||0 }}</span>{{ Order.unit||'' }}
@@ -133,34 +139,41 @@
</div>
<div slot="footer" class="dialog-footer tac" style="overflow: hidden">
<template v-if="messageError">
- <div class="btn" style="margin-left:220px;" @click="confirmClick2">
+ <div class="btn" style="margin-left: 220px" @click="confirmClick2">
<img src="../../public/confirm3.png" />
</div>
</template>
<template v-else>
- <div class="btn" @click="closeClick">
- <img src="../../public/btn1.png" />
- </div>
- <div class="btn" v-if="showBtn==1" @click="confirmClick1">
- <img src="../../public/confirm3.png" />
- </div>
- <div class="btn" v-if="showBtn==2">
- <img src="../../public/confirm2.png" />
- </div>
- <div class="btn" v-if="showBtn==3" @click="onSubmit()">
- <img src="../../public/confirm1.png" />
- </div>
+ <div class="btn" @click="closeClick">
+ <img src="../../public/btn1.png" />
+ </div>
+ <div class="btn" v-if="showBtn == 1" @click="confirmClick1">
+ <img src="../../public/confirm3.png" />
+ </div>
+ <div class="btn" v-if="showBtn == 2">
+ <img src="../../public/confirm2.png" />
+ </div>
+ <div
+ class="btn"
+ v-if="showBtn == 3"
+ v-prevent-re-click="3000"
+ @click="onSubmit()"
+ >
+ <img src="../../public/confirm1.png" />
+ </div>
</template>
-
</div>
<!-- <ErrorIssue ref="error" :messageError="messageError" @shutdown="shutdown"/> -->
</div>
</el-dialog>
-
</template>
<script>
-import { startTask, setProductNumber,sendProcessParams } from "@/api/home/index"; // 浜х嚎
+import {
+ startTask,
+ setProductNumber,
+ sendProcessParams,
+} from "@/api/home/index"; // 浜х嚎
// import ErrorIssue from "@/components/ErrorIssue";
export default {
components: {},
@@ -187,12 +200,13 @@
data() {
return {
islook: false,
- showBtn:1,
- num:0,
- timer:null,
- message:'璇风‘璁ょ敓浜у畨鍏紒',
- messageError:'',
- resParams:{},
+ showBtn: 1,
+ num: 0,
+ timer: null,
+ message: "璇风‘璁ょ敓浜у畨鍏紒",
+ messageError: "",
+ resParams: {},
+ isLoading:false,
};
},
mounted() {
@@ -202,41 +216,43 @@
taskData(val) {
this.getInfo();
},
- num(){
- if(this.num==60){
- clearInterval(this.timer)
- this.showBtn=3;
+ num() {
+ if (this.num == 60) {
+ clearInterval(this.timer);
+ this.showBtn = 3;
}
- }
+ },
},
methods: {
- confirmClick2(){
- this.messageError=''
+ confirmClick2() {
+ this.messageError = "";
},
- confirmClick1(){
-
- this.num=0;
- this.showBtn=2;
- this.message='璇风‘璁ょ敓浜у畨鍏紒',
- this.timer=setInterval(()=>{
- this.num=this.num+1;
- },1000)
-
+ confirmClick1() {
+ this.num = 0;
+ this.showBtn = 2;
+ (this.message = "璇风‘璁ょ敓浜у畨鍏紒"),
+ (this.timer = setInterval(() => {
+ this.num = this.num + 1;
+ }, 1000));
},
- closeClick(){
- if(this.timer){
- clearInterval(this.timer)
+ closeClick() {
+ if (this.timer) {
+ clearInterval(this.timer);
}
- this.num=0;
+ this.num = 0;
this.shutdown();
},
getInfo() {
- if (Object.keys(this.taskData).length > 0 && this.taskData.Procedure.ID && this.taskData.Procedure.Status == 1) {
- this.num=0;
- this.showBtn= 1;
- this.islook=true;
- }else{
- this.islook=false;
+ if (
+ Object.keys(this.taskData).length > 0 &&
+ this.taskData.Procedure.ID &&
+ this.taskData.Procedure.Status == 1
+ ) {
+ this.num = 0;
+ this.showBtn = 1;
+ this.islook = true;
+ } else {
+ this.islook = false;
}
},
getDateObj(date, fmt) {
@@ -277,51 +293,54 @@
return "";
}
},
-
- onSubmit() {
- if(this.taskData.Procedure.ID){
- this.message='鍙傛暟涓嬪彂涓�...',
- this.num=0
- this.timer=setInterval(()=>{
- this.num=this.num+1;
- if(this.num==60||this.resParams){
- this.num=60
- this.getCode(this.resParams)
- }
- },1000)
-
- sendProcessParams({id:this.taskData.Procedure.ID}).then(res=>{
- if(res.code==200){
- setProductNumber().then((res) => {
- this.resParams=res;
-
- });
- }else{
- this.resParams=res;
- }
- })
-
- }
+ onSubmit() {
+ if (this.taskData.Procedure.ID) {
+ (this.message = "鍙傛暟涓嬪彂涓�..."), (this.num = 0);
+ this.timer = setInterval(() => {
+ this.num = this.num + 1;
+ if (this.num == 60 || this.resParams) {
+ this.num = 60;
+ this.getCode(this.resParams);
+ }
+ }, 1000);
+ this.isLoading=true;
+ sendProcessParams({ id: this.taskData.Procedure.ID }).then((res) => {
+ if (res.code == 200) {
+ setProductNumber().then((res) => {
+ this.resParams = res;
+ this.isLoading=false;
+ });
+ } else {
+ this.isLoading=false;
+ this.resParams = res;
+ }
+ });
+ }
},
- getCode(res){
+ getCode(res) {
if (res.code == 200) {
- if(this.num==60){
- this.messageError='涓嬪彂鎴愬姛锛�'
- clearInterval(this.timer)
- this.num=60;
- this.showBtn=2;
- this.message='璇风‘璁ょ敓浜у畨鍏紒'
- // this.$message.success("涓嬪彂鐢熶骇鏁伴噺鎴愬姛锛�");
- }
- }else{
- this.messageError=res.msg?res.msg:'鎶辨瓑锛屽伐搴忎笅鍙戝け璐ワ紒'
- clearInterval(this.timer)
- this.num=60;
- this.showBtn=2;
- this.message='璇风‘璁ょ敓浜у畨鍏紒'
- }
+ if (this.num == 60) {
+ this.messageError = "涓嬪彂鎴愬姛锛�";
+ clearInterval(this.timer);
+ // this.num = 60;
+ // this.showBtn = 2;
+ this.message = "璇风‘璁ょ敓浜у畨鍏紒";
+
+ this.num = 0;
+ this.showBtn= 1
+ this.shutdown();
+ this.$emit('getSetProductNumber')
+ // this.$message.success("涓嬪彂鐢熶骇鏁伴噺鎴愬姛锛�");
+ }
+ } else {
+ this.messageError = res.msg ? res.msg : "鎶辨瓑锛屽伐搴忎笅鍙戝け璐ワ紒";
+ clearInterval(this.timer);
+ this.num = 60;
+ this.showBtn = 2;
+ this.message = "璇风‘璁ょ敓浜у畨鍏紒";
+ }
},
shutdown() {
this.islook = false;
@@ -345,8 +364,8 @@
.color_4efefa {
color: #4efefa !important;
}
-.color_fff{
- color:#fff;
+.color_fff {
+ color: #fff;
}
.font_size_20 {
font-size: 20px !important;
@@ -369,7 +388,7 @@
width: 55%;
}
}
-
+
.title-bng {
height: 42px;
line-height: 42px;
@@ -385,21 +404,21 @@
width: 100% !important;
}
}
-.error-t{
- width:120px;
- margin:50px auto 40px;
- img{
- width:100%;
- display:inline-block;
- }
+.error-t {
+ width: 120px;
+ margin: 50px auto 40px;
+ img {
+ width: 100%;
+ display: inline-block;
}
- .error-m{
- line-height:35px;
- font-size:26px;
- color:#fff;
- margin-bottom:20px;
- text-align:center;
- }
+}
+.error-m {
+ line-height: 35px;
+ font-size: 26px;
+ color: #fff;
+ margin-bottom: 20px;
+ text-align: center;
+}
::v-deep .el-dialog {
background: transparent;
}
@@ -507,20 +526,20 @@
height: calc(100% - 150px);
overflow: auto;
}
- .progress-item{
- width:55%;
- padding:2px 8px;
- height:20px;
- background:#fff;
- border-radius:30px;
- margin:0 auto;
- border:2px solid rgba(255,255,255,0.5);
- box-shadow: 1px 5px 5px rgba(255,255,255,0.5);
- span{
- float:left;
+ .progress-item {
+ width: 55%;
+ padding: 2px 8px;
+ height: 20px;
+ background: #fff;
+ border-radius: 30px;
+ margin: 0 auto;
+ border: 2px solid rgba(255, 255, 255, 0.5);
+ box-shadow: 1px 5px 5px rgba(255, 255, 255, 0.5);
+ span {
+ float: left;
font-weight: 700;
- color:#333;
- font-size:15px;
+ color: #333;
+ font-size: 15px;
}
}
}
diff --git a/src/main.js b/src/main.js
index 6144894..ec9e245 100644
--- a/src/main.js
+++ b/src/main.js
@@ -9,7 +9,10 @@
// import Element from "element-ui"
// Vue.use(Element, { size: "small", zIndex: 3000 })
-
+// 闃叉杩炵画鐐瑰嚮
+// 鍏ㄥ眬鎸囦护
+import { preventReClick } from "@/api/global-directives";
+Vue.use(preventReClick);
Vue.use(ElementUI)
new Vue({
--
Gitblit v1.8.0