contactList.vue 22 KB

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