From 482efd9ee971fe7d799a015dc288340c85b8805c Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 29 九月 2022 11:24:17 +0800
Subject: [PATCH] 1.新增 提交类按钮只能提交一次的控制2.关联类的按钮 接口返回成功后显示对话框
---
src/views/zzmx/gxdy.vue | 210 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 137 insertions(+), 73 deletions(-)
diff --git a/src/views/zzmx/gxdy.vue b/src/views/zzmx/gxdy.vue
index 38772d7..edc9fc6 100644
--- a/src/views/zzmx/gxdy.vue
+++ b/src/views/zzmx/gxdy.vue
@@ -148,8 +148,14 @@
width="110"
>
<template slot-scope="{row}">
- <div v-if="row.enable==='Y'"><svg-icon icon-class="circleYes" style="margin-right: 2px" />鏄�</div>
- <div v-if="row.enable==='N'"> <svg-icon icon-class="circleNo" style="margin-right: 2px" />鍚�</div>
+ <div v-if="row.enable==='Y'">
+ <svg-icon icon-class="circleYes" style="margin-right: 2px" />
+ 鏄�
+ </div>
+ <div v-if="row.enable==='N'">
+ <svg-icon icon-class="circleNo" style="margin-right: 2px" />
+ 鍚�
+ </div>
</template>
</el-table-column>
<el-table-column
@@ -296,7 +302,12 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
<el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>
- <el-button type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+ <el-button
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="dialogVisibleConfirm"
+ >纭� 瀹�</el-button>
</div>
</span>
</el-dialog>
@@ -364,7 +375,12 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
<el-button @click="workDialogVisibleCancel">鍙� 娑�</el-button>
- <el-button type="primary" @click="workDialogVisibleConfirm">纭� 瀹�</el-button>
+ <el-button
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="workDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
</div>
</span>
</el-dialog>
@@ -406,7 +422,12 @@
<span slot="footer" class="dialog-footer">
<div class="footerButton">
<el-button @click="defectDialogVisibleCancel">鍙� 娑�</el-button>
- <el-button type="primary" @click="defectDialogVisibleConfirm">纭� 瀹�</el-button>
+ <el-button
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="defectDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
</div>
</span>
</el-dialog>
@@ -610,6 +631,7 @@
dialogVisibleConfirm() {
this.$refs.dialogForm.validate(valid => {
if (valid) {
+ this.$store.state.app.buttonIsDisabled = true
const data = {
id: this.dialogForm.id,
stepcode: this.dialogForm.stepcode,
@@ -621,9 +643,10 @@
}
AddUpdateStep(data).then(res => {
if (res.code === '200') {
- this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
this.dialogVisible = false
+ this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
this.getStepSearch()
+ this.$store.state.app.buttonIsDisabled = false
} else {
this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
}
@@ -646,56 +669,71 @@
},
/* 鍏宠仈宸ヤ綔绔欐ā鍧�*/
// 鍏宠仈宸ヤ綔绔欑偣鍑�
- async workClick(row) {
- this.workDialogVisible = true
+ workClick(row) {
+ const loading = this.$loading({
+ lock: true,
+ text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...',
+ spinner: 'el-icon-loading',
+ customClass: 'osloading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ })
+
this.workDialogForm.stepcode = row.stepcode
this.workDialogForm.stepname = row.stepname
- const { data: res } = await StepAssociationEqp({ stepcode: this.workDialogForm.stepcode })
- this.workDialogForm.workArr = res.filter(item => item.children.length !== 0)
+ StepAssociationEqp({ stepcode: this.workDialogForm.stepcode }).then(res => {
+ if (res.code === '200') {
+ setTimeout(() => {
+ loading.close()
+ this.workDialogVisible = true
- let workGatherArr = []
- if (row.flwtype === 'W') { // 澶栧崗鎯呭喌涓�
- workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'W')
- } else if (row.flwtype === 'Z') { // 鑷埗鎯呭喌涓�
- workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'E')
- } else { // 鑷埗锛嬪鍗�
- workGatherArr = this.workDialogForm.workArr
- }
- // this.workDialogForm.workArr[1].children = []
- const nodeKey = []// 闇�瑕佹爲褰㈡暟鏄剧殑鍊�
- workGatherArr.forEach((item, index) => {
- this.workDialogForm.workGatherArr.push({
- isSelected1: index === 0,
- isSelected2: item.flag === 'Y',
- code: item.code,
- name: item.name,
- type: item.type,
- flag: item.flag
- })
- if (item.flag === 'Y' && item.children && item.children.length > 0) {
- this.$nextTick(() => {
- $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
- })
- item.children.forEach(it => {
- if (it.flag === 'Y') {
- nodeKey.push(it.code)
+ this.workDialogForm.workArr = res.data.filter(item => item.children.length !== 0)
+
+ let workGatherArr = []
+ if (row.flwtype === 'W') { // 澶栧崗鎯呭喌涓�
+ workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'W')
+ } else if (row.flwtype === 'Z') { // 鑷埗鎯呭喌涓�
+ workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'E')
+ } else { // 鑷埗锛嬪鍗�
+ workGatherArr = this.workDialogForm.workArr
}
- })
- }
- if (index === 0) {
- if (item.children && item.children.length > 0) {
- this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(it => it.code === item.code)
- this.workDialogForm.workTreeArr[0].name = '鍏ㄩ儴'
- }
- }
- // item.flag === 'Y'&&item
- })
- console.log(nodeKey, 1)
- this.$refs.workTree.setCheckedKeys(nodeKey)
- this.workDialogForm.workTreeSelectedArr = nodeKey
+ const nodeKey = []// 闇�瑕佹爲褰㈡暟鏄剧殑鍊�
+ workGatherArr.forEach((item, index) => {
+ this.workDialogForm.workGatherArr.push({
+ isSelected1: index === 0,
+ isSelected2: item.flag === 'Y',
+ code: item.code,
+ name: item.name,
+ type: item.type,
+ flag: item.flag
+ })
+ if (item.flag === 'Y' && item.children && item.children.length > 0) {
+ this.$nextTick(() => {
+ $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ item.children.forEach(it => {
+ if (it.flag === 'Y') {
+ nodeKey.push(it.code)
+ }
+ })
+ }
+ if (index === 0) {
+ if (item.children && item.children.length > 0) {
+ this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(it => it.code === item.code)
+ this.workDialogForm.workTreeArr[0].name = '鍏ㄩ儴'
+ }
+ }
+ // item.flag === 'Y'&&item
+ })
- console.log(this.workDialogForm.workGatherArr, 6)
- console.log(this.workDialogForm.workTreeArr, 7)
+ this.$nextTick(() => {
+ this.$refs.workTree.setCheckedKeys(nodeKey)
+ })
+ this.workDialogForm.workTreeSelectedArr = nodeKey
+ }, 1000)
+ } else {
+ loading.close()
+ }
+ })
},
// 澶х洅瀛愮偣鍑讳簨浠�
myCheckboxClick(val) {
@@ -914,8 +952,7 @@
// 纭
async workDialogVisibleConfirm() {
this.workDialogForm.workTreeSelectedArr = [...new Set(this.workDialogForm.workTreeSelectedArr)]
- console.log(this.workDialogForm.workTreeSelectedArr, 18)
- console.log(this.workDialogForm.workArr, 20)
+
const data = []
this.workDialogForm.workArr.forEach(item => {
if (item.flag === 'Y' && item.children && item.children.length > 0) {
@@ -926,34 +963,51 @@
})
}
})
- console.log(data)
+ this.$store.state.app.buttonIsDisabled = true
const res = await SaveStepAssociationEqp(this.workDialogForm.stepcode, data)
if (res.code === '200') {
+ this.workDialogVisible = false
this.$message.success('淇濆瓨鎴愬姛锛�')
await this.getStepSearch()
- this.workDialogVisible = false
+ this.$store.state.app.buttonIsDisabled = false
}
},
/* 鍏宠仈缂洪櫡*/
// 鍏宠仈缂洪櫡鐐瑰嚮
- async defectClick(row) {
+ defectClick(row) {
+ const loading = this.$loading({
+ lock: true,
+ text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...',
+ spinner: 'el-icon-loading',
+ customClass: 'osloading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ })
+
this.defectTreeCode = row.stepcode
this.defectTreeName = row.stepname
- this.defectDialogVisible = true
- const { data: res } = await StepAssociationDefect({ stepcode: row.stepcode })
- // this.defectTree = res
- this.defectTree.push({ code: 'QB', name: '鍏ㄩ儴', children: res, flag: 'N' })
- console.log(this.defectTree, 6)
- const nokeKey = []
- this.defectTree[0].children.forEach(item => {
- if (item.flag === 'Y') {
- nokeKey.push(item.code)
+ StepAssociationDefect({ stepcode: row.stepcode }).then(res => {
+ if (res.code === '200') {
+ setTimeout(() => {
+ loading.close()
+ this.defectDialogVisible = true
+
+ this.defectTree.push({ code: 'QB', name: '鍏ㄩ儴', children: res.data, flag: 'N' })
+
+ const nokeKey = []
+ this.defectTree[0].children.forEach(item => {
+ if (item.flag === 'Y') {
+ nokeKey.push(item.code)
+ }
+ })
+
+ this.$nextTick(() => {
+ this.$refs.defectTree.setCheckedKeys(nokeKey)
+ })
+ }, 1000)
+ } else {
+ loading.close()
}
- })
- console.log(nokeKey, 2)
- this.$nextTick(() => {
- this.$refs.defectTree.setCheckedKeys(nokeKey)
})
},
// 鍏抽棴
@@ -974,11 +1028,13 @@
data.push({ code: item.code, name: item.name })
}
})
+ this.$store.state.app.buttonIsDisabled = true
const res = await SaveStepAssociationDefect(this.defectTreeCode, data)
if (res.code === '200') {
+ this.defectDialogVisible = false
this.$message.success('淇濆瓨鎴愬姛锛�')
await this.getStepSearch()
- this.defectDialogVisible = false
+ this.$store.state.app.buttonIsDisabled = false
}
}
}
@@ -1136,17 +1192,25 @@
.userDialogVisible ::v-deep .el-form-item {
margin-bottom: 0;
}
-.tableFixed{
- ::v-deep .el-table__fixed-right{
+
+.tableFixed {
+ ::v-deep .el-table__fixed-right {
height: 100% !important;
}
- ::v-deep .el-table__fixed{
+
+ ::v-deep .el-table__fixed {
height: 100% !important;
}
}
</style>
<style>
+.osloading{
+ font-size: 26px !important;
+}
+.el-loading-text{
+ font-size: 26px !important;
+}
.el-table .custom-row {
background: #f8f8fa;
}
--
Gitblit v1.9.3