index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch">
  4. <el-form-item label="姓名" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入姓名"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="联系电话" prop="telephone">
  13. <el-input
  14. v-model="queryParams.telephone"
  15. placeholder="请输入联系电话"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="所属客户" prop="customerName">
  21. <el-input
  22. v-model="queryParams.customerName"
  23. placeholder="请输入所属客户"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <div class="btn_grooup">
  34. <el-button
  35. type="primary"
  36. plain
  37. size="mini"
  38. @click="handleAdd"
  39. >新增</el-button>
  40. <BatchImport
  41. ref="batchImport"
  42. @import="importDataBtn"
  43. @temDownload="importTemplateBtn"
  44. :fileSize="2"
  45. ></BatchImport>
  46. </div>
  47. <el-table size="mini" v-loading="loading" :data="contactList">
  48. <el-table-column width="200" label="编号" align="center" prop="code" />
  49. <el-table-column show-overflow-tooltip label="姓名" align="center" prop="name" />
  50. <el-table-column label="性别" align="center" prop="gander" >
  51. <template slot-scope="scope">
  52. <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gander"/>
  53. </template>
  54. </el-table-column>
  55. <el-table-column width="100" label="联系电话" align="center" prop="telephone" />
  56. <el-table-column width="100" label="微信" align="center" prop="mail" />
  57. <el-table-column width="200" show-overflow-tooltip label="所属客户" align="center" prop="customerName" />
  58. <el-table-column show-overflow-tooltip label="所属科室" align="center" prop="sectionName" />
  59. <el-table-column label="职务" align="center" prop="position" >
  60. <template slot-scope="scope">
  61. <dict-tag :options="dict.type.mk_bo_position" :value="scope.row.position"/>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="决策力" align="center" prop="power" >
  65. <template slot-scope="scope">
  66. <dict-tag :options="dict.type.mk_bo_power" :value="scope.row.power"/>
  67. </template>
  68. </el-table-column>
  69. <el-table-column show-overflow-tooltip label="兴趣爱好" align="center" prop="hobby" />
  70. <el-table-column show-overflow-tooltip label="家庭地址" align="center" prop="address" />
  71. <el-table-column label="状态" align="center" prop="state" >
  72. <template slot-scope="scope">
  73. <dict-tag :options="dict.type.mk_bo_contact_state" :value="scope.row.state"/>
  74. </template>
  75. </el-table-column>
  76. <el-table-column width="200" label="操作" fixed="right" align="center" >
  77. <template slot-scope="scope">
  78. <el-button
  79. size="mini"
  80. type="text"
  81. icon="el-icon-edit"
  82. @click="handleUpdate(scope.row)"
  83. >修改</el-button>
  84. <el-button
  85. size="mini"
  86. type="text"
  87. icon="el-icon-view"
  88. @click="handleBrowse(scope.row)"
  89. >查看</el-button>
  90. <el-button
  91. size="mini"
  92. type="text"
  93. icon="el-icon-delete"
  94. @click="handleDelete(scope.row)"
  95. >删除</el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination
  100. v-show="total>0"
  101. :total="total"
  102. :page.sync="queryParams.pageNum"
  103. :limit.sync="queryParams.pageSize"
  104. @pagination="getList"
  105. class="paginationClass"
  106. />
  107. <!-- 添加或修改联系人管理对话框 -->
  108. <el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body>
  109. <el-form size="mini" ref="form" :model="form" :rules="rules" label-width="80px" :disabled="this.operatingState == 'Browse'">
  110. <el-divider content-position="left">
  111. <dev style="width: 50px; height: 40px; font-size: 18px">基本信息</dev>
  112. </el-divider>
  113. <el-row>
  114. <el-col :span="8">
  115. <el-form-item label="编码" prop="code">
  116. <el-input v-model="form.code" placeholder="系统自动生成编码" readonly/>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="8">
  120. <el-form-item label="姓名" prop="name">
  121. <el-input v-model="form.name" />
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="8">
  125. <el-form-item label="性别" prop="gander">
  126. <el-select v-model="form.gander" placeholder="">
  127. <el-option
  128. v-for="dict in dict.type.sys_user_sex"
  129. :key="dict.value"
  130. :label="dict.label"
  131. :value="dict.value"
  132. ></el-option>
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="8">
  139. <el-form-item label="所属客户" prop="customerName">
  140. <dr-popover-select v-model="form.customerName" title="客户" type="CUSTOMER_PARAM_DRP" :dataMapping="{
  141. customer: 'id',
  142. customerName: 'name',
  143. }" :source.sync="form">
  144. </dr-popover-select>
  145. </el-form-item>
  146. </el-col>
  147. <el-col :span="8">
  148. <el-form-item label="分类" prop="contactClassification">
  149. <el-select v-model="form.contactClassification" placeholder="">
  150. <el-option
  151. v-for="dict in dict.type.mk_bo_contact_type"
  152. :key="dict.value"
  153. :label="dict.label"
  154. :value="dict.value"
  155. ></el-option>
  156. </el-select>
  157. </el-form-item>
  158. </el-col>
  159. <el-col :span="8">
  160. <el-form-item label="生日" prop="birthday">
  161. <el-date-picker clearable
  162. v-model="form.birthday"
  163. type="date"
  164. value-format="yyyy-MM-dd">
  165. </el-date-picker>
  166. </el-form-item>
  167. </el-col>
  168. </el-row>
  169. <el-row>
  170. <el-col :span="8">
  171. <el-form-item label="籍贯" prop="birthplace">
  172. <el-input v-model="form.birthplace" />
  173. </el-form-item>
  174. </el-col>
  175. <el-col :span="8">
  176. <el-form-item label="兴趣爱好" prop="hobby">
  177. <el-input v-model="form.hobby" placeholder="" />
  178. </el-form-item>
  179. </el-col>
  180. <el-col :span="8">
  181. <el-form-item label="状态" prop="state">
  182. <el-select v-model="form.state" placeholder="">
  183. <el-option
  184. v-for="dict in dict.type.mk_bo_contact_state"
  185. :key="dict.value"
  186. :label="dict.label"
  187. :value="dict.value"
  188. ></el-option>
  189. </el-select>
  190. </el-form-item>
  191. </el-col>
  192. </el-row>
  193. <el-divider content-position="left">
  194. <dev style="width: 50px; height: 40px; font-size: 18px">工作信息</dev>
  195. </el-divider>
  196. <el-row>
  197. <el-col :span="8">
  198. <el-form-item label="联系人" prop="superiorContactName">
  199. <dr-popover-select v-model="form.superiorContactName" title="上级联系人" type="LINKMAN_PARAM" :dataMapping="{
  200. superiorContact: 'id',
  201. superiorContactName: 'name',
  202. }" :source.sync="form"
  203. :queryParams="addCmCondition"
  204. >
  205. </dr-popover-select>
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="8">
  209. <el-form-item label="任职科室" prop="section">
  210. <el-popover-select-v2 v-model="form.sectionName" title="科室" valueKey="name" referName="MkCustomersDepartmentRule"
  211. :dataMapping="{ section: 'id', sectionName: 'name'}" :source.sync="form" :queryParams="addCmCondition" />
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="8">
  215. <el-form-item label="职务" prop="position">
  216. <el-select v-model="form.position" placeholder="">
  217. <el-option
  218. v-for="dict in dict.type.mk_bo_position"
  219. :key="dict.value"
  220. :label="dict.label"
  221. :value="dict.value"
  222. ></el-option>
  223. </el-select>
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. <el-row>
  228. <el-col :span="8">
  229. <el-form-item label="职称" prop="jobTitle">
  230. <el-select v-model="form.jobTitle" placeholder="">
  231. <el-option
  232. v-for="dict in dict.type.mk_bo_job_title"
  233. :key="dict.value"
  234. :label="dict.label"
  235. :value="dict.value"
  236. ></el-option>
  237. </el-select>
  238. </el-form-item>
  239. </el-col>
  240. <el-col :span="8">
  241. <el-form-item label="决策力" prop="power">
  242. <el-select v-model="form.power" placeholder="">
  243. <el-option
  244. v-for="dict in dict.type.mk_bo_power"
  245. :key="dict.value"
  246. :label="dict.label"
  247. :value="dict.value"
  248. ></el-option>
  249. </el-select>
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="8">
  253. <el-form-item label="支持度" prop="support">
  254. <el-select v-model="form.support" placeholder="">
  255. <el-option
  256. v-for="dict in dict.type.mk_bo_support"
  257. :key="dict.value"
  258. :label="dict.label"
  259. :value="dict.value"
  260. ></el-option>
  261. </el-select>
  262. </el-form-item>
  263. </el-col>
  264. </el-row>
  265. <el-row>
  266. <el-col :span="8">
  267. <el-form-item label="擅长领域" prop="fieldExpertise">
  268. <el-select v-model="form.fieldExpertise" placeholder="">
  269. <el-option
  270. v-for="dict in dict.type.mk_bo_field_expertise"
  271. :key="dict.value"
  272. :label="dict.label"
  273. :value="dict.value"
  274. ></el-option>
  275. </el-select>
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="8">
  279. <el-form-item label="关键决策人" prop="decisionMaker">
  280. <el-select v-model="form.decisionMaker" placeholder="">
  281. <el-option
  282. v-for="dict in dict.type.sys_yes_no"
  283. :key="dict.value"
  284. :label="dict.label"
  285. :value="dict.value"
  286. ></el-option>
  287. </el-select>
  288. </el-form-item>
  289. </el-col>
  290. <el-col :span="8">
  291. </el-col>
  292. </el-row>
  293. <el-divider content-position="left">
  294. <dev style="width: 50px; height: 40px; font-size: 18px">联系信息</dev>
  295. </el-divider>
  296. <el-row>
  297. <el-col :span="8">
  298. <el-form-item label="联系电话" prop="telephone">
  299. <el-input v-model="form.telephone" />
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="8">
  303. <el-form-item label="微信" prop="mail">
  304. <el-input v-model="form.mail" />
  305. </el-form-item>
  306. </el-col>
  307. <el-col :span="8">
  308. <el-form-item label="家庭地址" prop="address">
  309. <el-input v-model="form.address" />
  310. </el-form-item>
  311. </el-col>
  312. </el-row>
  313. <el-row>
  314. <el-col :span="8">
  315. <el-form-item label="最佳拜访时间" prop="visitTime">
  316. <el-input v-model="form.visitTime" />
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="8">
  320. <el-form-item label="最佳拜访地点" prop="visitPlace">
  321. <el-input v-model="form.visitPlace" />
  322. </el-form-item>
  323. </el-col>
  324. <el-col :span="8">
  325. </el-col>
  326. </el-row>
  327. <el-tabs v-model="activeName" v-if="this.operatingState != 'Insert'">
  328. <el-tab-pane label="学历信息" name="first">
  329. <EducationList :key="timer" :supForm="this.form" />
  330. </el-tab-pane>
  331. <el-tab-pane label="社会关系" name="second">
  332. <RelationshipList :key="timer" :supForm="this.form" />
  333. </el-tab-pane>
  334. </el-tabs>
  335. <div class="md-auditInfo">
  336. <el-divider content-position="left">
  337. <dev style="width: 50px; height: 40px; font-size: 18px">其它信息</dev>
  338. </el-divider>
  339. <el-row>
  340. <el-col :span="6">
  341. <el-form-item label="创建人">
  342. <el-input v-model="form.createByName" readonly></el-input>
  343. </el-form-item>
  344. </el-col>
  345. <el-col :span="6">
  346. <el-form-item label="创建时间">
  347. <el-input v-model="form.createTime" readonly></el-input>
  348. </el-form-item>
  349. </el-col>
  350. <el-col :span="6">
  351. <el-form-item label="修改人">
  352. <el-input v-model="form.updateByName" readonly></el-input>
  353. </el-form-item>
  354. </el-col>
  355. <el-col :span="6">
  356. <el-form-item label="修改时间">
  357. <el-input v-model="form.updateTime" readonly></el-input>
  358. </el-form-item>
  359. </el-col>
  360. </el-row>
  361. </div>
  362. </el-form>
  363. <div slot="footer" class="dialog-footer">
  364. <el-button size="mini" type="primary" @click="submitForm" v-if="this.operatingState != 'Browse'" :disabled="submitButtonEditStatus">确 定</el-button>
  365. <el-button size="mini" @click="cancel">取 消</el-button>
  366. </div>
  367. </el-dialog>
  368. </div>
  369. </template>
  370. <script>
  371. import { listContact, getContact, delContact, addContact, updateContact,importData} from "@/api/business/spd/bo/contact";
  372. import EducationList from '../education/educationList.vue';
  373. import RelationshipList from '../relationship/relationshipList.vue';
  374. export default {
  375. name: "Contact",
  376. dicts: ['sys_user_sex','mk_bo_contact_state','mk_bo_section','mk_bo_position','mk_bo_job_title','mk_bo_power','mk_bo_support','mk_bo_field_expertise','sys_yes_no','mk_bo_contact_type'],
  377. components: {
  378. EducationList,
  379. RelationshipList,
  380. ElPopoverSelectV2: () =>import("@/components/popover-select-v2"),
  381. BatchImport: () => import("@/components/BatchImport/index.vue"),
  382. },
  383. data() {
  384. return {
  385. // 遮罩层
  386. loading: true,
  387. // 选中数组
  388. ids: [],
  389. // 非单个禁用
  390. single: true,
  391. // 非多个禁用
  392. multiple: true,
  393. // 显示搜索条件
  394. showSearch: true,
  395. // 总条数
  396. total: 0,
  397. // 联系人管理表格数据
  398. contactList: [],
  399. // 弹出层标题
  400. title: "",
  401. // 是否显示弹出层
  402. open: false,
  403. // 查询参数
  404. queryParams: {
  405. pageNum: 1,
  406. pageSize: 10,
  407. name: null,
  408. telephone: null,
  409. customerName: null,
  410. },
  411. // 表单参数
  412. form: {},
  413. // 表单校验
  414. rules: {
  415. name: [
  416. { required: true, message: "姓名不能为空", trigger: "blur" }
  417. ],
  418. gander: [
  419. { required: true, message: "性别不能为空", trigger: "blur" }
  420. ],
  421. customerName: [
  422. { required: true, message: "所属客户名称不能为空", trigger: "blur" }
  423. ],
  424. state: [
  425. { required: true, message: "状态不能为空", trigger: "blur" }
  426. ],
  427. section: [
  428. { required: true, message: "任职科室不能为空", trigger: "blur" }
  429. ],
  430. position: [
  431. { required: true, message: "职务不能为空", trigger: "blur" }
  432. ],
  433. jobTitle: [
  434. { required: true, message: "职称不能为空", trigger: "blur" }
  435. ],
  436. power: [
  437. { required: true, message: "决策力不能为空", trigger: "blur" }
  438. ],
  439. decisionMaker: [
  440. { required: true, message: "关键决策人不能为空", trigger: "blur" }
  441. ],
  442. telephone: [
  443. { required: true, message: "联系电话不能为空", trigger: "blur" },
  444. {
  445. validator: function(rule, value, callback) {
  446. if (/^1[34578]\d{9}$/.test(value) == false) {
  447. callback(new Error("手机号格式错误"));
  448. } else {
  449. callback();
  450. }
  451. },
  452. trigger: "blur"
  453. }
  454. ],
  455. },
  456. //重新加载子组件参数
  457. timer: '',
  458. //当前操作状态
  459. operatingState: '',
  460. activeName: 'first',
  461. //确定按钮是否可点
  462. submitButtonEditStatus:false,
  463. };
  464. },
  465. created() {
  466. this.getList();
  467. },
  468. methods: {
  469. /** 查询联系人管理列表 */
  470. getList() {
  471. this.loading = true;
  472. listContact(this.queryParams).then(response => {
  473. this.contactList = response.rows;
  474. this.total = response.total;
  475. this.loading = false;
  476. });
  477. },
  478. // 取消按钮
  479. cancel() {
  480. this.open = false;
  481. this.reset();
  482. },
  483. // 表单重置
  484. reset() {
  485. this.form = {
  486. boId: null,
  487. delFlag: null,
  488. updateTime: null,
  489. updateBy: null,
  490. createDate: null,
  491. createBy: null,
  492. departmentName: null,
  493. departmentCode: null,
  494. area: null,
  495. organization: null,
  496. visitPlace: null,
  497. visitTime: null,
  498. address: null,
  499. mail: null,
  500. telephone: null,
  501. decisionMaker: null,
  502. fieldExpertise: null,
  503. support: null,
  504. power: null,
  505. jobTitle: null,
  506. position: null,
  507. section: null,
  508. superiorContact: null,
  509. state: null,
  510. hobby: null,
  511. birthplace: null,
  512. birthday: null,
  513. contactClassification: null,
  514. customerName: null,
  515. customerCode: null,
  516. gander: null,
  517. name: null,
  518. code: null,
  519. id: null
  520. };
  521. this.resetForm("form");
  522. },
  523. /** 搜索按钮操作 */
  524. handleQuery() {
  525. this.queryParams.pageNum = 1;
  526. this.getList();
  527. },
  528. /** 重置按钮操作 */
  529. resetQuery() {
  530. this.resetForm("queryForm");
  531. this.handleQuery();
  532. },
  533. /** 新增按钮操作 */
  534. handleAdd() {
  535. this.operatingState = "Insert";
  536. this.reset();
  537. this.form.state = '1';
  538. this.open = true;
  539. this.title = "添加联系人";
  540. },
  541. /** 修改按钮操作 */
  542. handleUpdate(row) {
  543. this.operatingState = "Update";
  544. this.reset();
  545. const id = row.id || this.ids
  546. getContact(id).then(response => {
  547. this.form = response.data;
  548. this.open = true;
  549. this.title = "修改联系人";
  550. this.timer = new Date().getTime();
  551. });
  552. },
  553. /** 查看按钮操作 */
  554. handleBrowse(row) {
  555. this.reset();
  556. const id = row.id || this.ids
  557. getContact(id).then(response => {
  558. this.form = response.data;
  559. this.open = true;
  560. this.operatingState = "Browse";
  561. this.title = "基础信息";
  562. });
  563. },
  564. /** 提交按钮 */
  565. submitForm() {
  566. this.submitButtonEditStatus = true;
  567. this.$refs["form"].validate(valid => {
  568. if (valid) {
  569. if (this.form.id != null) {
  570. updateContact(this.form).then(response => {
  571. this.$modal.msgSuccess("修改成功");
  572. this.open = false;
  573. this.getList();
  574. this.submitButtonEditStatus = false;
  575. });
  576. } else {
  577. addContact(this.form).then(response => {
  578. this.$modal.msgSuccess("新增成功");
  579. this.open = false;
  580. this.getList();
  581. this.submitButtonEditStatus = false;
  582. });
  583. }
  584. }else{
  585. this.submitButtonEditStatus = false;
  586. }
  587. });
  588. },
  589. /** 删除按钮操作 */
  590. handleDelete(row) {
  591. const ids = row.id || this.ids;
  592. this.$modal.confirm('是否确认删除联系人管理编号为"' + ids + '"的数据项?').then(function() {
  593. return delContact(ids);
  594. }).then(() => {
  595. this.getList();
  596. this.$modal.msgSuccess("删除成功");
  597. }).catch(() => {});
  598. },
  599. addCmCondition(){
  600. return {
  601. parame:{
  602. customer: this.form.customer ? this.form.customer : 'xxx'
  603. }
  604. }
  605. },
  606. //导入模板
  607. importTemplateBtn(){
  608. this.download('/mk/bo/contact/importTemplate', {
  609. }, `客户联系人导入模板_${new Date().getTime()}.xlsx`)
  610. },
  611. // 上传文件
  612. async importDataBtn(file) {
  613. try {
  614. this.$modal.loading("加载中......");
  615. let formData = new FormData();
  616. formData.append("file", file[0].raw);
  617. let { code, msg } = await importData(formData);
  618. if (code == 200) {
  619. this.$notify.success({ message: msg });
  620. let { setVisible } = this.$refs.batchImport;
  621. setVisible(false);
  622. this.resetList();
  623. }
  624. } catch (error) {
  625. console.log(error);
  626. } finally {
  627. this.$modal.closeLoading();
  628. }
  629. },
  630. }
  631. };
  632. </script>
  633. <style lang="scss" scoped>
  634. .btn_grooup {
  635. margin-bottom: 10px;
  636. display: flex;
  637. justify-content: flex-end;
  638. }
  639. .paginationClass {
  640. z-index: 500;
  641. position: fixed;
  642. bottom: 10px;
  643. right: 10px;
  644. width: 100%;
  645. line-height: var(--footer-height);
  646. color: #fff;
  647. }
  648. </style>