提交 63f24240 authored 作者: matian's avatar matian

fix:禁止连点事件

上级 e4097bd7
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</el-row> </el-row>
<el-form-item> <el-form-item>
<el-row style="text-align: center; margin-top: 30px"> <el-row style="text-align: center; margin-top: 30px">
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit" :disabled="btnDisabled">提交</el-button>
<el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button> <el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button>
</el-row> </el-row>
</el-form-item> </el-form-item>
...@@ -64,6 +64,7 @@ import { createContact, UpdateContact } from '../api' ...@@ -64,6 +64,7 @@ import { createContact, UpdateContact } from '../api'
export default { export default {
data() { data() {
return { return {
btnDisabled: false,
form: { form: {
name: '', name: '',
positoon: '', positoon: '',
...@@ -113,19 +114,33 @@ export default { ...@@ -113,19 +114,33 @@ export default {
}, },
edit() { edit() {
const params = Object.assign({ id: this.row.id }, this.form) const params = Object.assign({ id: this.row.id }, this.form)
UpdateContact(params).then(res => { this.btnDisabled = true
this.$message.success('新建联系人成功') UpdateContact(params)
this.$emit('update:visible', false) .then(res => {
this.$emit('success', res.data) this.$message.success('新建联系人成功')
}) this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}, },
create() { create() {
const params = Object.assign({ customer_id: this.id }, this.form) const params = Object.assign({ customer_id: this.id }, this.form)
createContact(params).then(res => { this.btnDisabled = true
this.$message.success('新建联系人成功') createContact(params)
this.$emit('update:visible', false) .then(res => {
this.$emit('success', res.data) this.$message.success('新建联系人成功')
}) this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
} }
} }
} }
......
<template> <template>
<el-dialog :close-on-click-modal="false" v-bind="$attrs" v-on="$listeners" top="20vh" :title="title" width="60%"> <el-dialog :close-on-click-modal="false" v-bind="$attrs" v-on="$listeners" top="20vh" :title="title" width="60%">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-row style="text-align: center; margin-top: 20px"> <el-row style="text-align: center; margin-top: 20px">
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit" :disabled="btnDisabled">提交</el-button>
<el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button> <el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button>
</el-row> </el-row>
</el-form-item> </el-form-item>
...@@ -76,6 +76,7 @@ export default { ...@@ -76,6 +76,7 @@ export default {
components: { AppUserSearch }, components: { AppUserSearch },
data() { data() {
return { return {
btnDisabled: false,
form: { form: {
tag: '', tag: '',
status: '', status: '',
...@@ -138,19 +139,33 @@ export default { ...@@ -138,19 +139,33 @@ export default {
}, },
create() { create() {
const params = Object.assign({ customer_id: this.id }, this.form) const params = Object.assign({ customer_id: this.id }, this.form)
createCooProject(params).then(res => { this.btnDisabled = true
this.$message.success('新建合作项目成功') createCooProject(params)
this.$emit('update:visible', false) .then(res => {
this.$emit('success', res.data) this.$message.success('新建合作项目成功')
}) this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}, },
edit() { edit() {
const params = Object.assign({ id: this.row.id }, this.form) const params = Object.assign({ id: this.row.id }, this.form)
editCooProject(params).then(res => { this.btnDisabled = true
this.$message.success('更新合作项目成功') editCooProject(params)
this.$emit('update:visible', false) .then(res => {
this.$emit('success', res.data) this.$message.success('更新合作项目成功')
}) this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
} }
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</template> </template>
<template #footer> <template #footer>
<el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button> <el-button @click="$emit('update:visible', false)" style="margin-left: 20px">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit" :disabled="btnDisabled">提交</el-button>
</template> </template>
</app-list> </app-list>
</app-card> </app-card>
...@@ -24,7 +24,8 @@ export default { ...@@ -24,7 +24,8 @@ export default {
}, },
data() { data() {
return { return {
multipleSelection: [] multipleSelection: [],
btnDisabled: false
} }
}, },
props: { props: {
...@@ -79,14 +80,21 @@ export default { ...@@ -79,14 +80,21 @@ export default {
const param = this.multipleSelection const param = this.multipleSelection
const arr = param.map(item => item.id) const arr = param.map(item => item.id)
const params = { group_id: this.id, customer_ids: arr } const params = { group_id: this.id, customer_ids: arr }
createCustomer(params).then(res => { this.btnDisabled = true
if (res.code === 0) { createCustomer(params)
this.$message.success('添加客户成功') .then(res => {
this.$emit('update:visible', false) if (res.code === 0) {
this.$emit('success') this.$message.success('添加客户成功')
this.$refs.list.refetch() this.$emit('update:visible', false)
} this.$emit('success')
}) this.$refs.list.refetch()
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
} }
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-form-item> <el-form-item>
<el-row style="float: right"> <el-row style="float: right">
<el-button @click="$emit('update:visible', false)">取消</el-button> <el-button @click="$emit('update:visible', false)">取消</el-button>
<el-button type="primary" style="margin-left: 20px" @click="submit">提交</el-button> <el-button type="primary" style="margin-left: 20px" @click="submit" :disabled="btnDisabled">提交</el-button>
</el-row> </el-row>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -20,7 +20,8 @@ export default { ...@@ -20,7 +20,8 @@ export default {
data() { data() {
return { return {
form: { form: {
name: '' name: '',
btnDisabled: false
}, },
rules: { rules: {
name: [ name: [
...@@ -60,21 +61,35 @@ export default { ...@@ -60,21 +61,35 @@ export default {
// 编辑/更新客户组 // 编辑/更新客户组
edit() { edit() {
const params = Object.assign({ id: this.data.id }, this.form) const params = Object.assign({ id: this.data.id }, this.form)
editCustomerGroup(params).then(res => { this.btnDisabled = true
this.$message.success('客户组更新成功') editCustomerGroup(params)
this.$emit('update:visible', false) .then(res => {
this.$emit('success', res.data) this.$message.success('客户组更新成功')
}) this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}, },
// 新建客户组 // 新建客户组
create() { create() {
createCustomerGroup(this.form).then(res => { createCustomerGroup(this.form)
if (res.code === 0) { .then(res => {
this.$message.success('客户组创建成功') this.btnDisabled = true
this.$emit('update:visible', false) if (res.code === 0) {
this.$emit('success', res.data) this.$message.success('客户组创建成功')
} this.$emit('update:visible', false)
}) this.$emit('success', res.data)
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
} }
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<el-form-item> <el-form-item>
<el-row style="float: right"> <el-row style="float: right">
<el-button @click="$emit('update:visible', false)">取消</el-button> <el-button @click="$emit('update:visible', false)">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit" :disabled="btnDisabled">提交</el-button>
</el-row> </el-row>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
}, },
data() { data() {
return { return {
btnDisabled: false,
loading: false, loading: false,
form: { form: {
id: '' id: ''
...@@ -94,16 +95,24 @@ export default { ...@@ -94,16 +95,24 @@ export default {
}) })
}, },
submit() { submit() {
this.$refs.form.validate().then(() => { this.$refs.form
const params = Object.assign({ group_id: this.id, staff_ids: this.form.id }) .validate()
createEmployee(params).then(res => { .then(() => {
if (res.code === 0) { const params = Object.assign({ group_id: this.id, staff_ids: this.form.id })
this.$message.success('添加员工成功') this.btnDisabled = true
this.$emit('update:visible', false) createEmployee(params).then(res => {
this.$emit('success') if (res.code === 0) {
} this.$message.success('添加员工成功')
this.$emit('update:visible', false)
this.$emit('success')
}
})
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
}) })
})
} }
} }
} }
......
...@@ -69,11 +69,9 @@ export default { ...@@ -69,11 +69,9 @@ export default {
{ label: '客户数量', prop: 'customer_count', align: 'center' }, { label: '客户数量', prop: 'customer_count', align: 'center' },
{ label: '员工数量', prop: 'staff_count', align: 'center' }, { label: '员工数量', prop: 'staff_count', align: 'center' },
{ label: '创建时间', prop: 'created_at', align: 'center' }, { label: '创建时间', prop: 'created_at', align: 'center' },
// { label: '创建人', prop: 'created_by.username', align: 'center' },
{ {
prop: 'created_by', prop: 'created_by',
label: '创建人', label: '创建人',
// minWidth: '100px',
computed({ row }) { computed({ row }) {
return row.created_by.realname || row.created_by.nickname || row.created_by.username return row.created_by.realname || row.created_by.nickname || row.created_by.username
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论