20261008
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<view class="flex justify-end items-center">
|
||||
<el-button type="primary" @click="isAdd = !isAdd" v-if="!isAdd">新增业务联系人</el-button>
|
||||
</view>
|
||||
<view class="mt-20" v-if="isAdd">
|
||||
<el-form ref="form" :model="form" label-width="120px">
|
||||
<el-form-item label="姓名" required>
|
||||
<el-input v-model="form.name" placeholder="请输入姓名"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" required>
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" required>
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="职位" required>
|
||||
<el-input v-model="form.position" placeholder="请输入职位"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" required>
|
||||
<el-input v-model="form.idCard" placeholder="请输入身份证号"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<view class="mt-30 flex justify-center items-center">
|
||||
<el-button plain @click="isAdd = !isAdd">取消</el-button>
|
||||
<el-button type="primary" @click="addContact">确定</el-button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="py-20 border-bottom flex justify-between items-center" v-for="(item, index) in list"
|
||||
:key="index">
|
||||
<view class="flex flex-col justify-start items-start">
|
||||
<view>
|
||||
<text class="font-bold text-40">{{ item.name }}</text>
|
||||
<text class="ml-20 text-gray">({{ item.position }})</text>
|
||||
</view>
|
||||
<view class="my-20">手机号:{{ item.phone }}</view>
|
||||
<view class="my-20">邮箱:{{ item.email }}</view>
|
||||
<view class="my-20">身份证号:{{ item.idCard }}</view>
|
||||
</view>
|
||||
<view class="flex flex-col justify-end">
|
||||
<el-button type="primary" size="small" @click="edit(item)">编辑</el-button>
|
||||
<view class="mt-20">
|
||||
<el-button type="primary" size="small" @click="del(item._id)" plain>删除</el-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "business-contact",
|
||||
data() {
|
||||
return {
|
||||
isAdd: false,
|
||||
form: {
|
||||
_id: null,
|
||||
phone: '',
|
||||
name: '',
|
||||
email: '',
|
||||
position: '',
|
||||
idCard: '',
|
||||
},
|
||||
list: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async addContact() {
|
||||
if (!this.form.name) {
|
||||
this.$message.error('请输入姓名')
|
||||
return
|
||||
}
|
||||
if (!this.form.phone) {
|
||||
this.$message.error('请输入手机号')
|
||||
return
|
||||
}
|
||||
if (!this.form.email) {
|
||||
this.$message.error('请输入邮箱')
|
||||
return
|
||||
}
|
||||
if (!this.form.position) {
|
||||
this.$message.error('请输入职位')
|
||||
return
|
||||
}
|
||||
if (!this.form.idCard) {
|
||||
this.$message.error('请输入身份证号')
|
||||
return
|
||||
}
|
||||
await vk.callFunction({
|
||||
url: 'client/businessContact/kh/action',
|
||||
data: this.form
|
||||
})
|
||||
this.$message.success(this.form._id ? '修改成功' : '新增成功')
|
||||
await this.getList()
|
||||
this.isAdd = false
|
||||
this.form = {
|
||||
_id: null,
|
||||
phone: '',
|
||||
name: '',
|
||||
email: '',
|
||||
position: '',
|
||||
}
|
||||
},
|
||||
async getList() {
|
||||
const {rows} = await vk.callFunction({
|
||||
url: 'client/businessContact/kh/getList',
|
||||
})
|
||||
this.list = rows
|
||||
},
|
||||
del(_id) {
|
||||
this.$confirm('确认删除该业务联系人吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
showCancelButton: false,
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
await vk.callFunction({
|
||||
url: 'client/businessContact/kh/delete',
|
||||
data: {_id}
|
||||
})
|
||||
await this.getList()
|
||||
})
|
||||
},
|
||||
edit(item) {
|
||||
for (let key in this.form) this.form[key] = item[key]
|
||||
this.isAdd = true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user