Commit 918ffc40aec60f1481896c14a8e67f6df0a07d9e
1 parent
55f9e013
crm联系人前端init
Showing
3 changed files
with
425 additions
and
0 deletions
sql/mysql/crm_menu.sql
| ... | ... | @@ -117,6 +117,61 @@ VALUES ( |
| 117 | 117 | '线索导出', 'crm:clue:export', 3, 5, @parentId, |
| 118 | 118 | '', '', '', 0 |
| 119 | 119 | ); |
| 120 | +-- 菜单 SQL | |
| 121 | +INSERT INTO system_menu( | |
| 122 | + name, permission, type, sort, parent_id, | |
| 123 | + path, icon, component, status, component_name | |
| 124 | +) | |
| 125 | +VALUES ( | |
| 126 | + '联系人', '', 2, 0, ${table.parentMenuId}, | |
| 127 | + 'contact', '', 'crm/contact/index', 0, 'Contact' | |
| 128 | + ); | |
| 129 | + | |
| 130 | +-- 按钮父菜单ID | |
| 131 | +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 | |
| 132 | +SELECT @parentId := LAST_INSERT_ID(); | |
| 133 | + | |
| 134 | +-- 按钮 SQL | |
| 135 | +INSERT INTO system_menu( | |
| 136 | + name, permission, type, sort, parent_id, | |
| 137 | + path, icon, component, status | |
| 138 | +) | |
| 139 | +VALUES ( | |
| 140 | + '联系人查询', 'crm:contact:query', 3, 1, @parentId, | |
| 141 | + '', '', '', 0 | |
| 142 | + ); | |
| 143 | +INSERT INTO system_menu( | |
| 144 | + name, permission, type, sort, parent_id, | |
| 145 | + path, icon, component, status | |
| 146 | +) | |
| 147 | +VALUES ( | |
| 148 | + '联系人创建', 'crm:contact:create', 3, 2, @parentId, | |
| 149 | + '', '', '', 0 | |
| 150 | + ); | |
| 151 | +INSERT INTO system_menu( | |
| 152 | + name, permission, type, sort, parent_id, | |
| 153 | + path, icon, component, status | |
| 154 | +) | |
| 155 | +VALUES ( | |
| 156 | + '联系人更新', 'crm:contact:update', 3, 3, @parentId, | |
| 157 | + '', '', '', 0 | |
| 158 | + ); | |
| 159 | +INSERT INTO system_menu( | |
| 160 | + name, permission, type, sort, parent_id, | |
| 161 | + path, icon, component, status | |
| 162 | +) | |
| 163 | +VALUES ( | |
| 164 | + '联系人删除', 'crm:contact:delete', 3, 4, @parentId, | |
| 165 | + '', '', '', 0 | |
| 166 | + ); | |
| 167 | +INSERT INTO system_menu( | |
| 168 | + name, permission, type, sort, parent_id, | |
| 169 | + path, icon, component, status | |
| 170 | +) | |
| 171 | +VALUES ( | |
| 172 | + '联系人导出', 'crm:contact:export', 3, 5, @parentId, | |
| 173 | + '', '', '', 0 | |
| 174 | + ); | |
| 120 | 175 | |
| 121 | 176 | -- ---------------------------- |
| 122 | 177 | -- 合同菜单 | ... | ... |
yudao-ui-admin/src/api/crm/contact/contact.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建crm联系人 | |
| 4 | +export function createContact(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/crm/contact/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新crm联系人 | |
| 13 | +export function updateContact(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/crm/contact/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除crm联系人 | |
| 22 | +export function deleteContact(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/crm/contact/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得crm联系人 | |
| 30 | +export function getContact(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/crm/contact/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得crm联系人分页 | |
| 38 | +export function getContactPage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/crm/contact/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出crm联系人 Excel | |
| 47 | +export function exportContactExcel(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/crm/contact/export-excel', | |
| 50 | + method: 'get', | |
| 51 | + params: query, | |
| 52 | + responseType: 'blob' | |
| 53 | + }) | |
| 54 | +} | ... | ... |
yudao-ui-admin/src/views/crm/contact/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <!-- 搜索工作栏 --> | |
| 5 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px"> | |
| 6 | + <el-form-item label="姓名" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入联系人名称" clearable @keyup.enter.native="handleQuery"/> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item label="下次联系时间" prop="nextTime"> | |
| 10 | + <el-date-picker v-model="queryParams.nextTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | |
| 11 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item label="手机号" prop="mobile"> | |
| 14 | + <el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery"/> | |
| 15 | + </el-form-item> | |
| 16 | +<!-- <el-form-item label="电话" prop="telephone">--> | |
| 17 | +<!-- <el-input v-model="queryParams.telephone" placeholder="请输入电话" clearable @keyup.enter.native="handleQuery"/>--> | |
| 18 | +<!-- </el-form-item>--> | |
| 19 | +<!-- <el-form-item label="电子邮箱" prop="email">--> | |
| 20 | +<!-- <el-input v-model="queryParams.email" placeholder="请输入电子邮箱" clearable @keyup.enter.native="handleQuery"/>--> | |
| 21 | +<!-- </el-form-item>--> | |
| 22 | +<!-- <el-form-item label="职务" prop="post">--> | |
| 23 | +<!-- <el-input v-model="queryParams.post" placeholder="请输入职务" clearable @keyup.enter.native="handleQuery"/>--> | |
| 24 | +<!-- </el-form-item>--> | |
| 25 | + <el-form-item label="客户编号" prop="customerId"> | |
| 26 | + <el-input v-model="queryParams.customerId" placeholder="请输入客户编号" clearable @keyup.enter.native="handleQuery"/> | |
| 27 | + </el-form-item> | |
| 28 | +<!-- <el-form-item label="地址" prop="address">--> | |
| 29 | +<!-- <el-input v-model="queryParams.address" placeholder="请输入地址" clearable @keyup.enter.native="handleQuery"/>--> | |
| 30 | +<!-- </el-form-item>--> | |
| 31 | +<!-- <el-form-item label="备注" prop="remark">--> | |
| 32 | +<!-- <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery"/>--> | |
| 33 | +<!-- </el-form-item>--> | |
| 34 | + <el-form-item label="负责人用户编号" prop="ownerUserId"> | |
| 35 | + <el-input v-model="queryParams.ownerUserId" placeholder="请输入负责人用户编号" clearable @keyup.enter.native="handleQuery"/> | |
| 36 | + </el-form-item> | |
| 37 | +<!-- <el-form-item label="创建时间" prop="createTime">--> | |
| 38 | +<!-- <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"--> | |
| 39 | +<!-- range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />--> | |
| 40 | +<!-- </el-form-item>--> | |
| 41 | +<!-- <el-form-item label="最后跟进时间" prop="lastTime">--> | |
| 42 | +<!-- <el-date-picker v-model="queryParams.lastTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"--> | |
| 43 | +<!-- range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />--> | |
| 44 | +<!-- </el-form-item>--> | |
| 45 | +<!-- <el-form-item label="更新人" prop="updator">--> | |
| 46 | +<!-- <el-input v-model="queryParams.updator" placeholder="请输入更新人" clearable @keyup.enter.native="handleQuery"/>--> | |
| 47 | +<!-- </el-form-item>--> | |
| 48 | + <el-form-item> | |
| 49 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 50 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 51 | + </el-form-item> | |
| 52 | + </el-form> | |
| 53 | + | |
| 54 | + <!-- 操作工具栏 --> | |
| 55 | + <el-row :gutter="10" class="mb8"> | |
| 56 | + <el-col :span="1.5"> | |
| 57 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | |
| 58 | + v-hasPermi="['crm:contact:create']">新增</el-button> | |
| 59 | + </el-col> | |
| 60 | + <el-col :span="1.5"> | |
| 61 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | |
| 62 | + v-hasPermi="['crm:contact:export']">导出</el-button> | |
| 63 | + </el-col> | |
| 64 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 65 | + </el-row> | |
| 66 | + | |
| 67 | + <!-- 列表 --> | |
| 68 | + <el-table v-loading="loading" :data="list"> | |
| 69 | + <el-table-column label="姓名" align="center" prop="name" /> | |
| 70 | + <el-table-column label="下次联系时间" align="center" prop="nextTime" > | |
| 71 | + <template v-slot="scope"> | |
| 72 | + <span>{{ parseTime(scope.row.nextTime) }}</span> | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column label="手机号" align="center" prop="mobile" /> | |
| 76 | + <el-table-column label="电话" align="center" prop="telephone" /> | |
| 77 | + <el-table-column label="电子邮箱" align="center" prop="email" /> | |
| 78 | + <el-table-column label="职务" align="center" prop="post" /> | |
| 79 | + <el-table-column label="客户编号" align="center" prop="customerId" /> | |
| 80 | + <el-table-column label="地址" align="center" prop="address" /> | |
| 81 | + <el-table-column label="备注" align="center" prop="remark" /> | |
| 82 | + <el-table-column label="负责人用户编号" align="center" prop="ownerUserId" /> | |
| 83 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 84 | + <template v-slot="scope"> | |
| 85 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 86 | + </template> | |
| 87 | + </el-table-column> | |
| 88 | + <el-table-column label="最后跟进时间" align="center" prop="lastTime" width="180"> | |
| 89 | + <template v-slot="scope"> | |
| 90 | + <span>{{ parseTime(scope.row.lastTime) }}</span> | |
| 91 | + </template> | |
| 92 | + </el-table-column> | |
| 93 | + <el-table-column label="更新人" align="center" prop="updator" /> | |
| 94 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 95 | + <template v-slot="scope"> | |
| 96 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | |
| 97 | + v-hasPermi="['crm:contact:update']">修改</el-button> | |
| 98 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | |
| 99 | + v-hasPermi="['crm:contact:delete']">删除</el-button> | |
| 100 | + </template> | |
| 101 | + </el-table-column> | |
| 102 | + </el-table> | |
| 103 | + <!-- 分页组件 --> | |
| 104 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 105 | + @pagination="getList"/> | |
| 106 | + | |
| 107 | + <!-- 对话框(添加 / 修改) --> | |
| 108 | + <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> | |
| 109 | + <el-form ref="form" :model="form" :rules="rules" label-width="110px"> | |
| 110 | + <el-form-item label="姓名" prop="name"> | |
| 111 | + <el-input v-model="form.name" placeholder="请输入联系人名称" /> | |
| 112 | + </el-form-item> | |
| 113 | + <el-form-item label="下次联系时间" prop="nextTime"> | |
| 114 | + <el-date-picker clearable v-model="form.nextTime" type="date" value-format="timestamp" placeholder="选择下次联系时间" /> | |
| 115 | + </el-form-item> | |
| 116 | + <el-form-item label="手机号" prop="mobile"> | |
| 117 | + <el-input v-model="form.mobile" placeholder="请输入手机号" /> | |
| 118 | + </el-form-item> | |
| 119 | + <el-form-item label="电话" prop="telephone"> | |
| 120 | + <el-input v-model="form.telephone" placeholder="请输入电话" /> | |
| 121 | + </el-form-item> | |
| 122 | + <el-form-item label="电子邮箱" prop="email"> | |
| 123 | + <el-input v-model="form.email" placeholder="请输入电子邮箱" /> | |
| 124 | + </el-form-item> | |
| 125 | + <el-form-item label="职务" prop="post"> | |
| 126 | + <el-input v-model="form.post" placeholder="请输入职务" /> | |
| 127 | + </el-form-item> | |
| 128 | + <el-form-item label="客户编号" prop="customerId"> | |
| 129 | + <el-input v-model="form.customerId" placeholder="请输入客户编号" /> | |
| 130 | + </el-form-item> | |
| 131 | + <el-form-item label="地址" prop="address"> | |
| 132 | + <el-input v-model="form.address" placeholder="请输入地址" /> | |
| 133 | + </el-form-item> | |
| 134 | + <el-form-item label="备注" prop="remark"> | |
| 135 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | |
| 136 | + </el-form-item> | |
| 137 | + <el-form-item label="负责人用户编号" prop="ownerUserId"> | |
| 138 | + <el-input v-model="form.ownerUserId" placeholder="请输入负责人用户编号" /> | |
| 139 | + </el-form-item> | |
| 140 | + <el-form-item label="最后跟进时间" prop="lastTime"> | |
| 141 | + <el-date-picker clearable v-model="form.lastTime" type="date" value-format="timestamp" placeholder="选择最后跟进时间" /> | |
| 142 | + </el-form-item> | |
| 143 | + <el-form-item label="更新人" prop="updator"> | |
| 144 | + <el-input v-model="form.updator" placeholder="请输入更新人" /> | |
| 145 | + </el-form-item> | |
| 146 | + </el-form> | |
| 147 | + <div slot="footer" class="dialog-footer"> | |
| 148 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 149 | + <el-button @click="cancel">取 消</el-button> | |
| 150 | + </div> | |
| 151 | + </el-dialog> | |
| 152 | + </div> | |
| 153 | +</template> | |
| 154 | + | |
| 155 | +<script> | |
| 156 | +import { createContact, updateContact, deleteContact, getContact, getContactPage, exportContactExcel } from "@/api/crm/contact/contact"; | |
| 157 | + | |
| 158 | +export default { | |
| 159 | + name: "Contact", | |
| 160 | + components: { | |
| 161 | + }, | |
| 162 | + data() { | |
| 163 | + return { | |
| 164 | + // 遮罩层 | |
| 165 | + loading: true, | |
| 166 | + // 导出遮罩层 | |
| 167 | + exportLoading: false, | |
| 168 | + // 显示搜索条件 | |
| 169 | + showSearch: true, | |
| 170 | + // 总条数 | |
| 171 | + total: 0, | |
| 172 | + // crm联系人列表 | |
| 173 | + list: [], | |
| 174 | + // 弹出层标题 | |
| 175 | + title: "", | |
| 176 | + // 是否显示弹出层 | |
| 177 | + open: false, | |
| 178 | + // 查询参数 | |
| 179 | + queryParams: { | |
| 180 | + pageNo: 1, | |
| 181 | + pageSize: 10, | |
| 182 | + name: null, | |
| 183 | + nextTime: [], | |
| 184 | + mobile: null, | |
| 185 | + telephone: null, | |
| 186 | + email: null, | |
| 187 | + post: null, | |
| 188 | + customerId: null, | |
| 189 | + address: null, | |
| 190 | + remark: null, | |
| 191 | + ownerUserId: null, | |
| 192 | + createTime: [], | |
| 193 | + lastTime: [], | |
| 194 | + updator: null, | |
| 195 | + }, | |
| 196 | + // 表单参数 | |
| 197 | + form: {}, | |
| 198 | + // 表单校验 | |
| 199 | + rules: { | |
| 200 | + } | |
| 201 | + }; | |
| 202 | + }, | |
| 203 | + created() { | |
| 204 | + this.getList(); | |
| 205 | + }, | |
| 206 | + methods: { | |
| 207 | + /** 查询列表 */ | |
| 208 | + getList() { | |
| 209 | + this.loading = true; | |
| 210 | + // 执行查询 | |
| 211 | + getContactPage(this.queryParams).then(response => { | |
| 212 | + this.list = response.data.list; | |
| 213 | + this.total = response.data.total; | |
| 214 | + this.loading = false; | |
| 215 | + }); | |
| 216 | + }, | |
| 217 | + /** 取消按钮 */ | |
| 218 | + cancel() { | |
| 219 | + this.open = false; | |
| 220 | + this.reset(); | |
| 221 | + }, | |
| 222 | + /** 表单重置 */ | |
| 223 | + reset() { | |
| 224 | + this.form = { | |
| 225 | + id: undefined, | |
| 226 | + name: undefined, | |
| 227 | + nextTime: undefined, | |
| 228 | + mobile: undefined, | |
| 229 | + telephone: undefined, | |
| 230 | + email: undefined, | |
| 231 | + post: undefined, | |
| 232 | + customerId: undefined, | |
| 233 | + address: undefined, | |
| 234 | + remark: undefined, | |
| 235 | + ownerUserId: undefined, | |
| 236 | + lastTime: undefined, | |
| 237 | + updator: undefined, | |
| 238 | + }; | |
| 239 | + this.resetForm("form"); | |
| 240 | + }, | |
| 241 | + /** 搜索按钮操作 */ | |
| 242 | + handleQuery() { | |
| 243 | + this.queryParams.pageNo = 1; | |
| 244 | + this.getList(); | |
| 245 | + }, | |
| 246 | + /** 重置按钮操作 */ | |
| 247 | + resetQuery() { | |
| 248 | + this.resetForm("queryForm"); | |
| 249 | + this.handleQuery(); | |
| 250 | + }, | |
| 251 | + /** 新增按钮操作 */ | |
| 252 | + handleAdd() { | |
| 253 | + this.reset(); | |
| 254 | + this.open = true; | |
| 255 | + this.title = "添加联系人"; | |
| 256 | + }, | |
| 257 | + /** 修改按钮操作 */ | |
| 258 | + handleUpdate(row) { | |
| 259 | + this.reset(); | |
| 260 | + const id = row.id; | |
| 261 | + getContact(id).then(response => { | |
| 262 | + this.form = response.data; | |
| 263 | + this.open = true; | |
| 264 | + this.title = "修改联系人"; | |
| 265 | + }); | |
| 266 | + }, | |
| 267 | + /** 提交按钮 */ | |
| 268 | + submitForm() { | |
| 269 | + this.$refs["form"].validate(valid => { | |
| 270 | + if (!valid) { | |
| 271 | + return; | |
| 272 | + } | |
| 273 | + // 修改的提交 | |
| 274 | + if (this.form.id != null) { | |
| 275 | + updateContact(this.form).then(response => { | |
| 276 | + this.$modal.msgSuccess("修改成功"); | |
| 277 | + this.open = false; | |
| 278 | + this.getList(); | |
| 279 | + }); | |
| 280 | + return; | |
| 281 | + } | |
| 282 | + // 添加的提交 | |
| 283 | + createContact(this.form).then(response => { | |
| 284 | + this.$modal.msgSuccess("新增成功"); | |
| 285 | + this.open = false; | |
| 286 | + this.getList(); | |
| 287 | + }); | |
| 288 | + }); | |
| 289 | + }, | |
| 290 | + /** 删除按钮操作 */ | |
| 291 | + handleDelete(row) { | |
| 292 | + const id = row.id; | |
| 293 | + this.$modal.confirm('是否确认删除联系人编号为"' + id + '"的数据项?').then(function() { | |
| 294 | + return deleteContact(id); | |
| 295 | + }).then(() => { | |
| 296 | + this.getList(); | |
| 297 | + this.$modal.msgSuccess("删除成功"); | |
| 298 | + }).catch(() => {}); | |
| 299 | + }, | |
| 300 | + /** 导出按钮操作 */ | |
| 301 | + handleExport() { | |
| 302 | + // 处理查询参数 | |
| 303 | + let params = {...this.queryParams}; | |
| 304 | + params.pageNo = undefined; | |
| 305 | + params.pageSize = undefined; | |
| 306 | + this.$modal.confirm('是否确认导出所有联系人数据项?').then(() => { | |
| 307 | + this.exportLoading = true; | |
| 308 | + return exportContactExcel(params); | |
| 309 | + }).then(response => { | |
| 310 | + this.$download.excel(response, '联系人.xls'); | |
| 311 | + this.exportLoading = false; | |
| 312 | + }).catch(() => {}); | |
| 313 | + } | |
| 314 | + } | |
| 315 | +}; | |
| 316 | +</script> | ... | ... |