提交 a0a05aa0 authored 作者: pengxiaohui's avatar pengxiaohui
......@@ -51,7 +51,7 @@
</el-row>
<el-form-item>
<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-row>
</el-form-item>
......@@ -64,6 +64,7 @@ import { createContact, UpdateContact } from '../api'
export default {
data() {
return {
btnDisabled: false,
form: {
name: '',
positoon: '',
......@@ -113,19 +114,33 @@ export default {
},
edit() {
const params = Object.assign({ id: this.row.id }, this.form)
UpdateContact(params).then(res => {
this.$message.success('新建联系人成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
this.btnDisabled = true
UpdateContact(params)
.then(res => {
this.$message.success('更新联系人成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
},
create() {
const params = Object.assign({ customer_id: this.id }, this.form)
createContact(params).then(res => {
this.$message.success('新建联系人成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
this.btnDisabled = true
createContact(params)
.then(res => {
this.$message.success('新建联系人成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}
}
}
......
<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-row>
<el-col :span="12">
......@@ -60,7 +60,7 @@
</el-form-item>
<el-form-item>
<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-row>
</el-form-item>
......@@ -76,6 +76,7 @@ export default {
components: { AppUserSearch },
data() {
return {
btnDisabled: false,
form: {
tag: '',
status: '',
......@@ -138,19 +139,33 @@ export default {
},
create() {
const params = Object.assign({ customer_id: this.id }, this.form)
createCooProject(params).then(res => {
this.$message.success('新建合作项目成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
this.btnDisabled = true
createCooProject(params)
.then(res => {
this.$message.success('新建合作项目成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
},
edit() {
const params = Object.assign({ id: this.row.id }, this.form)
editCooProject(params).then(res => {
this.$message.success('更新合作项目成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
this.btnDisabled = true
editCooProject(params)
.then(res => {
this.$message.success('更新合作项目成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}
}
}
......
......@@ -66,7 +66,14 @@
</el-select>
</el-form-item>
<el-form-item label="跟进记录" prop="desc">
<el-input v-model="form.desc" type="textarea" size="small" rows="4" placeholder="请输入跟进记录" />
<el-input
v-model="form.desc"
type="textarea"
size="small"
rows="4"
placeholder="请输入跟进记录"
maxlength="200"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" style="margin-left: 20px" @click="submit" :disabled="btnDisabled">提交</el-button>
......@@ -132,7 +139,7 @@ export default {
methods: {
// 提交
submit() {
this.$refs.form.validate().then((valid) => {
this.$refs.form.validate().then(valid => {
if (valid) {
this.fetchCreateRecord()
}
......@@ -154,15 +161,17 @@ export default {
// }
// }
this.btnDisabled = true
createFollowRecord(this.customerId, params).then(res => {
this.$message.success('新建跟进记录成功')
this.$emit('input', false)
this.$emit('success')
}).finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
createFollowRecord(this.customerId, params)
.then(res => {
this.$message.success('新建跟进记录成功')
this.$emit('input', false)
this.$emit('success')
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
},
fetchProjectList() {
getCoopList({ page: 1, limit: 1000, customer_id: this.customerId }).then(res => {
......
......@@ -10,10 +10,10 @@
>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="90px">
<el-form-item label="客户名称" prop="name">
<el-input v-model="form.name" size="small" placeholder="请输入客户名称" />
<el-input v-model="form.name" size="small" placeholder="请输入客户名称" maxlength="50" />
</el-form-item>
<el-form-item label="客户简称">
<el-input v-model="form.short_name" size="small" placeholder="请输入客户简称" />
<el-input v-model="form.short_name" size="small" placeholder="请输入客户简称" maxlength="50" />
</el-form-item>
<el-form-item label="客户来源" prop="source" class="form-item-select" style="margin-right: 20px">
<el-select v-model="form.source" placeholder="请选择客户来源" size="small" style="width: 100%">
......@@ -35,7 +35,14 @@
<el-input v-model="form.address" size="small" placeholder="请输入详细地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" size="small" rows="4" placeholder="请输入备注" />
<el-input
v-model="form.remark"
type="textarea"
size="small"
rows="4"
placeholder="请输入备注"
maxlength="200"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSubmit" size="mini" :disabled="btnDisabled">提交</el-button>
......@@ -112,33 +119,37 @@ export default {
const params = Object.assign({}, this.form)
params.region = this.form.region.join('-')
this.btnDisabled = true
createCustomer(params).then(res => {
if (res.code === 0 && res.data && res.data.id) {
this.$message.success('创建客户成功')
this.$emit('input', false)
this.$emit('change')
}
}).finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
createCustomer(params)
.then(res => {
if (res.code === 0 && res.data && res.data.id) {
this.$message.success('创建客户成功')
this.$emit('input', false)
this.$emit('change')
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
},
fetchUpdateCustomer() {
const params = Object.assign({}, this.form)
params.region = this.form.region.join('-')
this.btnDisabled = true
updateCustomer(this.info.id, params).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更新客户成功')
this.$emit('input', false)
this.$emit('change')
}
}).finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
updateCustomer(this.info.id, params)
.then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更新客户成功')
this.$emit('input', false)
this.$emit('change')
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}
}
}
......
......@@ -7,7 +7,9 @@
</template>
<template #footer>
<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 || multipleSelection.length === 0"
>提交</el-button
>
</template>
</app-list>
</app-card>
......@@ -24,7 +26,8 @@ export default {
},
data() {
return {
multipleSelection: []
multipleSelection: [],
btnDisabled: false
}
},
props: {
......@@ -79,14 +82,21 @@ export default {
const param = this.multipleSelection
const arr = param.map(item => item.id)
const params = { group_id: this.id, customer_ids: arr }
createCustomer(params).then(res => {
if (res.code === 0) {
this.$message.success('添加客户成功')
this.$emit('update:visible', false)
this.$emit('success')
this.$refs.list.refetch()
}
})
this.btnDisabled = true
createCustomer(params)
.then(res => {
if (res.code === 0) {
this.$message.success('添加客户成功')
this.$emit('update:visible', false)
this.$emit('success')
this.$refs.list.refetch()
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}
}
}
......
......@@ -7,7 +7,7 @@
<el-form-item>
<el-row style="float: right">
<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-form-item>
</el-form>
......@@ -20,7 +20,8 @@ export default {
data() {
return {
form: {
name: ''
name: '',
btnDisabled: false
},
rules: {
name: [
......@@ -60,21 +61,35 @@ export default {
// 编辑/更新客户组
edit() {
const params = Object.assign({ id: this.data.id }, this.form)
editCustomerGroup(params).then(res => {
this.$message.success('客户组更新成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
this.btnDisabled = true
editCustomerGroup(params)
.then(res => {
this.$message.success('客户组更新成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
},
// 新建客户组
create() {
createCustomerGroup(this.form).then(res => {
if (res.code === 0) {
this.$message.success('客户组创建成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
}
})
this.btnDisabled = true
createCustomerGroup(this.form)
.then(res => {
if (res.code === 0) {
this.$message.success('客户组创建成功')
this.$emit('update:visible', false)
this.$emit('success', res.data)
}
})
.finally(() => {
window.setTimeout(() => {
this.btnDisabled = false
}, 500)
})
}
}
}
......
......@@ -29,7 +29,7 @@
<el-form-item>
<el-row style="float: right">
<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-form-item>
</el-form>
......@@ -48,6 +48,7 @@ export default {
},
data() {
return {
btnDisabled: false,
loading: false,
form: {
id: ''
......@@ -94,16 +95,24 @@ export default {
})
},
submit() {
this.$refs.form.validate().then(() => {
const params = Object.assign({ group_id: this.id, staff_ids: this.form.id })
createEmployee(params).then(res => {
if (res.code === 0) {
this.$message.success('添加员工成功')
this.$emit('update:visible', false)
this.$emit('success')
}
this.$refs.form
.validate()
.then(() => {
const params = Object.assign({ group_id: this.id, staff_ids: this.form.id })
this.btnDisabled = true
createEmployee(params).then(res => {
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 {
{ label: '客户数量', prop: 'customer_count', align: 'center' },
{ label: '员工数量', prop: 'staff_count', align: 'center' },
{ label: '创建时间', prop: 'created_at', align: 'center' },
// { label: '创建人', prop: 'created_by.username', align: 'center' },
{
prop: 'created_by',
label: '创建人',
// minWidth: '100px',
computed({ row }) {
return row.created_by.realname || row.created_by.nickname || row.created_by.username
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论