修改技术监督按钮重复点击问题

This commit is contained in:
GGJ
2024-10-17 13:29:51 +08:00
parent e470554b7c
commit 96ea25d0a6
6 changed files with 57 additions and 58 deletions

View File

@@ -1061,7 +1061,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#FFCC00",
},
@@ -1072,7 +1072,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#009900",
},
@@ -1083,7 +1083,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#CC0000",
},
@@ -1479,7 +1479,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#FFCC00",
},
@@ -1490,7 +1490,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#009900",
},
@@ -1501,7 +1501,7 @@ export default {
type: "line",
smooth: true,
symbol: "none",
sampling: "lttb",
sampling: "average",
itemStyle: {
color: "#CC0000",
},

View File

@@ -729,7 +729,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#FFCC00'
},
@@ -740,7 +740,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#009900'
},
@@ -751,7 +751,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#CC0000'
},
@@ -1083,7 +1083,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#FFCC00'
},
@@ -1094,7 +1094,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#009900'
},
@@ -1105,7 +1105,7 @@ export default {
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'lttb',
sampling: 'average',
itemStyle: {
color: '#CC0000'
},

View File

@@ -36,7 +36,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" v-loading="loading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -51,6 +51,7 @@ const emit = defineEmits(['getTree'])
const dialogVisible = ref(false)
const title = ref('')
const formRef = ref()
const loading = ref(false)
const dataTree = ref([])
const TreeList: any = ref({})
const List = ref({})
@@ -110,7 +111,8 @@ const open = (row: any) => {
// row.row
}
}
const submit = () => {
const submit = async () => {
loading.value = true
formRef.value.validate(async (valid: boolean) => {
if (valid) {
if (title.value == '新增算法') {
@@ -121,7 +123,7 @@ const submit = () => {
forms.name = form.name
forms.pid = form.pid
}
addAlgorithm(forms).then(res => {
await addAlgorithm(forms).then(res => {
ElMessage.success('新增成功')
dialogVisible.value = false
emit('getTree')
@@ -135,7 +137,7 @@ const submit = () => {
forms.id = form.id
}
forms.pid = null
updateAlgorithmLibrary(forms).then(res => {
await updateAlgorithmLibrary(forms).then(res => {
ElMessage.success('修改成功')
dialogVisible.value = false
emit('getTree')
@@ -143,6 +145,9 @@ const submit = () => {
}
}
})
await setTimeout(() => {
loading.value=false
},0)
}
const getTheTree = () => {
queryAllAlgorithmLibrary().then(res => {

View File

@@ -1,12 +1,6 @@
<template>
<el-dialog
draggable
class="cn-operate-dialog"
v-model="dialogVisible"
:title="title"
:before-close="handleClose"
width="1200px"
>
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" :before-close="handleClose"
width="1200px">
<el-scrollbar>
<el-form :inline="false" :model="form" class="form-two" label-width="auto" :rules="rules" ref="formRef">
<el-form-item label="事件名称" prop="name">
@@ -21,37 +15,21 @@
/>
</el-form-item> -->
<el-form-item label="发生地点" prop="location">
<el-input
v-model="form.location"
placeholder="请输入发生地点"
:autosize="{ minRows: 2, maxRows: 4 }"
type="textarea"
/>
<el-input v-model="form.location" placeholder="请输入发生地点" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" />
</el-form-item>
<el-form-item label="事件经过" prop="process">
<el-input
v-model="form.process"
placeholder="请输入事件经过"
:autosize="{ minRows: 2, maxRows: 4 }"
type="textarea"
/>
<el-input v-model="form.process" placeholder="请输入事件经过" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" />
</el-form-item>
<el-form-item label="处理措施" prop="measures">
<el-input
v-model="form.measures"
placeholder="请输入处理措施"
:autosize="{ minRows: 2, maxRows: 4 }"
type="textarea"
/>
<el-input v-model="form.measures" placeholder="请输入处理措施" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" />
</el-form-item>
<el-form-item label="治理效果" prop="effect">
<el-input
v-model="form.effect"
placeholder="请输入治理效果"
:autosize="{ minRows: 2, maxRows: 4 }"
type="textarea"
/>
<el-input v-model="form.effect" placeholder="请输入治理效果" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" />
</el-form-item>
<el-form-item label="附件">
<el-upload v-model:file-list="fileList" action="" :auto-upload="false" multiple>
@@ -68,7 +46,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -85,6 +63,7 @@ const emit = defineEmits(['onSubmit'])
const dialogVisible = ref(false)
const title = ref('')
const formRef = ref()
const loading = ref(false)
const fileList: any = ref([])
// 注意不要和表单ref的命名冲突
const form = reactive<anyObj>({
@@ -135,8 +114,9 @@ const open = (text: string, data?: anyObj) => {
}
}
}
const submit = () => {
formRef.value.validate(async (valid: boolean) => {
const submit = async () => {
loading.value = true
await formRef.value.validate(async (valid: boolean) => {
if (valid) {
if (fileList.value.length > 0) {
const promises = fileList.value.map(async item => {
@@ -164,21 +144,25 @@ const submit = () => {
form.url = ''
}
setTimeout(() => {
await setTimeout(async () => {
if (title.value === '新增案例') {
libcaseAdd(form).then(res => {
await libcaseAdd(form).then(res => {
ElMessage.success(title.value + '成功!')
handleClose()
})
} else {
await updateCaseLibrary(form).then(res => {
ElMessage.success(title.value + '成功!')
updateCaseLibrary(form).then(res => {
handleClose()
})
}
}, 100)
}
})
await setTimeout(() => {
loading.value = false
}, 1000)
}
const handleClose = () => {

View File

@@ -31,7 +31,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -57,6 +57,7 @@ const form = reactive<anyObj>({
url: ''
})
const urlList: any = ref([])
const loading=ref(false)
const defaultProps = {
children: 'children',
label: 'name',
@@ -107,7 +108,8 @@ const getTheTree = () => {
dataTree.value = res.data
})
}
const submit = () => {
const submit = async() => {
loading.value=true
formRef.value.validate(async (valid: boolean) => {
if (valid) {
if (urlList.value.length > 0 && form.pid != '') {
@@ -162,6 +164,9 @@ const submit = () => {
}, 100)
}
})
setTimeout(() => {
loading.value=false
}, 1000);
}
const handleClose = () => {
urlList.value = []

View File

@@ -17,7 +17,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
<el-button type="primary" @click="submit" :loading="loading">确认</el-button>
</span>
</template>
</el-dialog>
@@ -42,6 +42,7 @@ const form = reactive<anyObj>({
url: ''
})
const urlList: any = ref([])
const loading=ref(false)
const defaultProps = {
children: 'children',
label: 'name',
@@ -86,6 +87,7 @@ const handleExceed: UploadProps['onExceed'] = (files) => {
const submit = () => {
loading.value = true
formRef.value.validate(async (valid: boolean) => {
if (valid) {
if (urlList.value.length > 0) {
@@ -138,6 +140,9 @@ const submit = () => {
}, 100)
}
})
setTimeout(() => {
loading.value = false
}, 1000)
}
const handleClose = () => {
urlList.value = []