contactList.vue 21 KB

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