contactList.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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 label="序号" type="index" width="50" align="center" fixed/>
  18. <el-table-column width="300" 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 width="200" show-overflow-tooltip 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 width="200" show-overflow-tooltip label="兴趣爱好" align="center" prop="hobby" />
  39. <el-table-column width="200" show-overflow-tooltip 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 width="200" 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 size="mini" 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. <dr-popover-select v-model="form.superiorContactName" title="上级联系人" type="LINKMAN_PARAM" :dataMapping="{
  175. superiorContact: 'id',
  176. superiorContactName: 'name',
  177. }" :source.sync="form"
  178. :queryParams="additionalCondition"
  179. >
  180. </dr-popover-select>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="8">
  184. <el-form-item label="任职科室" prop="section">
  185. <el-select v-model="form.section" placeholder="请输入任职科室">
  186. <el-option
  187. v-for="dict in dict.type.mk_bo_section"
  188. :key="dict.value"
  189. :label="dict.label"
  190. :value="dict.value"
  191. ></el-option>
  192. </el-select>
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="8">
  196. <el-form-item label="职务" prop="position">
  197. <el-select v-model="form.position" placeholder="请输入职务">
  198. <el-option
  199. v-for="dict in dict.type.mk_bo_position"
  200. :key="dict.value"
  201. :label="dict.label"
  202. :value="dict.value"
  203. ></el-option>
  204. </el-select>
  205. </el-form-item>
  206. </el-col>
  207. </el-row>
  208. <el-row>
  209. <el-col :span="8">
  210. <el-form-item label="职称" prop="jobTitle">
  211. <el-select v-model="form.jobTitle" placeholder="请输入职称">
  212. <el-option
  213. v-for="dict in dict.type.mk_bo_job_title"
  214. :key="dict.value"
  215. :label="dict.label"
  216. :value="dict.value"
  217. ></el-option>
  218. </el-select>
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="8">
  222. <el-form-item label="决策力" prop="power">
  223. <el-select v-model="form.power" placeholder="请输入决策力">
  224. <el-option
  225. v-for="dict in dict.type.mk_bo_power"
  226. :key="dict.value"
  227. :label="dict.label"
  228. :value="dict.value"
  229. ></el-option>
  230. </el-select>
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="8">
  234. <el-form-item label="支持度" prop="support">
  235. <el-select v-model="form.support" placeholder="请输入支持度">
  236. <el-option
  237. v-for="dict in dict.type.mk_bo_support"
  238. :key="dict.value"
  239. :label="dict.label"
  240. :value="dict.value"
  241. ></el-option>
  242. </el-select>
  243. </el-form-item>
  244. </el-col>
  245. </el-row>
  246. <el-row>
  247. <el-col :span="8">
  248. <el-form-item label="擅长领域" prop="fieldExpertise">
  249. <el-select v-model="form.fieldExpertise" placeholder="请输入擅长领域">
  250. <el-option
  251. v-for="dict in dict.type.mk_bo_field_expertise"
  252. :key="dict.value"
  253. :label="dict.label"
  254. :value="dict.value"
  255. ></el-option>
  256. </el-select>
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="8">
  260. <el-form-item label="关键决策人" prop="decisionMaker">
  261. <el-select v-model="form.decisionMaker" placeholder="请输入关键决策人">
  262. <el-option
  263. v-for="dict in dict.type.sys_yes_no"
  264. :key="dict.value"
  265. :label="dict.label"
  266. :value="dict.value"
  267. ></el-option>
  268. </el-select>
  269. </el-form-item>
  270. </el-col>
  271. <el-col :span="8">
  272. </el-col>
  273. </el-row>
  274. <el-divider content-position="left">
  275. <dev style="width: 50px; height: 40px; font-size: 18px">联系信息</dev>
  276. </el-divider>
  277. <el-row>
  278. <el-col :span="8">
  279. <el-form-item label="联系电话" prop="telephone">
  280. <el-input v-model="form.telephone" placeholder="请输入联系电话" />
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="8">
  284. <el-form-item label="微信" prop="mail">
  285. <el-input v-model="form.mail" placeholder="请输入微信" />
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="8">
  289. <el-form-item label="家庭地址" prop="address">
  290. <el-input v-model="form.address" placeholder="请输入家庭地址" />
  291. </el-form-item>
  292. </el-col>
  293. </el-row>
  294. <el-row>
  295. <el-col :span="8">
  296. <el-form-item label="最佳拜访时间" prop="visitTime">
  297. <el-input v-model="form.visitTime" placeholder="请选择最佳拜访时间" />
  298. </el-form-item>
  299. </el-col>
  300. <el-col :span="8">
  301. <el-form-item label="最佳拜访地点" prop="visitPlace">
  302. <el-input v-model="form.visitPlace" placeholder="请输入最佳拜访地点" />
  303. </el-form-item>
  304. </el-col>
  305. <el-col :span="8">
  306. </el-col>
  307. </el-row>
  308. <el-tabs v-model="activeName" @tab-click="handleClick" v-if="this.operatingState != 'Insert'">
  309. <el-tab-pane label="学历信息" name="first">
  310. <EducationList :key="timer" :source="'ContactList'" :supForm="this.form" />
  311. </el-tab-pane>
  312. <el-tab-pane label="社会关系" name="second">
  313. <RelationshipList :key="timer" :source="'ContactList'" :supForm="this.form" />
  314. </el-tab-pane>
  315. </el-tabs>
  316. <div class="md-auditInfo">
  317. <el-divider content-position="left">
  318. <dev style="width: 50px; height: 40px; font-size: 18px">其它信息</dev>
  319. </el-divider>
  320. <el-row>
  321. <el-col :span="6">
  322. <el-form-item label="创建人">
  323. <el-input v-model="form.createByName" 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.createTime" readonly></el-input>
  329. </el-form-item>
  330. </el-col>
  331. <el-col :span="6">
  332. <el-form-item label="修改人">
  333. <el-input v-model="form.updateByName" readonly></el-input>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="6">
  337. <el-form-item label="修改时间">
  338. <el-input v-model="form.updateTime" readonly></el-input>
  339. </el-form-item>
  340. </el-col>
  341. </el-row>
  342. </div>
  343. </el-form>
  344. <div slot="footer">
  345. <el-button size="mini" type="primary" @click="submitForm" v-if="this.operatingState != 'Browse'" :disabled="submitButtonEditStatus">确 定</el-button>
  346. <el-button size="mini" @click="cancel">取 消</el-button>
  347. </div>
  348. </el-dialog>
  349. </div>
  350. </template>
  351. <script>
  352. import { listContact, getContact, delContact, addContact, updateContact } from "@/api/business/spd/bo/contact";
  353. import EducationList from '../education/educationList.vue';
  354. import RelationshipList from '../relationship/relationshipList.vue';
  355. export default {
  356. name: "contactList",
  357. props:["source","bo","boAuthority"],
  358. 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'],
  359. components: {EducationList,RelationshipList},
  360. data() {
  361. return {
  362. // 遮罩层
  363. loading: true,
  364. // 选中数组
  365. ids: [],
  366. // 非单个禁用
  367. single: true,
  368. // 非多个禁用
  369. multiple: true,
  370. // 显示搜索条件
  371. showSearch: true,
  372. // 总条数
  373. total: 0,
  374. // 联系人管理表格数据
  375. contactList: [],
  376. // 弹出层标题
  377. title: "",
  378. // 是否显示弹出层
  379. open: false,
  380. // 查询参数
  381. queryParams: {
  382. pageNum: 1,
  383. pageSize: 10,
  384. boId: null,
  385. name: null,
  386. code: null,
  387. customer: null,
  388. },
  389. // 表单参数
  390. form: {},
  391. // 表单校验
  392. rules: {
  393. name: [
  394. { required: true, message: "姓名不能为空", trigger: "blur" }
  395. ],
  396. gander: [
  397. { required: true, message: "性别不能为空", trigger: "blur" }
  398. ],
  399. customerName: [
  400. { required: true, message: "所属客户名称不能为空", trigger: "blur" }
  401. ],
  402. state: [
  403. { required: true, message: "状态不能为空", trigger: "blur" }
  404. ],
  405. section: [
  406. { required: true, message: "任职科室不能为空", trigger: "blur" }
  407. ],
  408. position: [
  409. { required: true, message: "职务不能为空", trigger: "blur" }
  410. ],
  411. jobTitle: [
  412. { required: true, message: "职称不能为空", trigger: "blur" }
  413. ],
  414. power: [
  415. { required: true, message: "决策力不能为空", trigger: "blur" }
  416. ],
  417. decisionMaker: [
  418. { required: true, message: "关键决策人不能为空", trigger: "blur" }
  419. ],
  420. telephone: [
  421. { required: true, message: "联系电话不能为空", trigger: "blur" },
  422. {
  423. validator: function(rule, value, callback) {
  424. if (/^1[34578]\d{9}$/.test(value) == false) {
  425. callback(new Error("手机号格式错误"));
  426. } else {
  427. callback();
  428. }
  429. },
  430. trigger: "blur"
  431. }
  432. ],
  433. },
  434. //重新加载子组件参数
  435. timer: '',
  436. //当前操作状态
  437. operatingState: '',
  438. //
  439. activeName: 'first',
  440. //确定按钮是否可点
  441. submitButtonEditStatus:false,
  442. };
  443. },
  444. created() {
  445. this.queryParams.customer = this.bo.customer;
  446. let params = {"post":this.boAuthority.post};
  447. this.queryParams.params = params;
  448. this.getList();
  449. },
  450. methods: {
  451. /** 查询联系人管理列表 */
  452. getList() {
  453. this.loading = true;
  454. listContact(this.queryParams).then(response => {
  455. this.contactList = response.rows;
  456. console.log('this.contactList',this.contactList);
  457. for (var i = 0; i < this.contactList.length; i++) {
  458. 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);
  459. 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);
  460. const start = new Array(this.contactList[i].name.length).join('*');
  461. this.contactList[i].name = start + this.contactList[i].name.slice(-1);
  462. }
  463. this.total = response.total;
  464. this.loading = false;
  465. });
  466. },
  467. // 取消按钮
  468. cancel() {
  469. this.open = false;
  470. this.reset();
  471. },
  472. // 表单重置
  473. reset() {
  474. this.form = {
  475. boId: null,
  476. delFlag: null,
  477. updateTime: null,
  478. updateBy: null,
  479. createDate: null,
  480. createBy: null,
  481. departmentName: null,
  482. departmentCode: null,
  483. area: null,
  484. organization: null,
  485. visitPlace: null,
  486. visitTime: null,
  487. address: null,
  488. mail: null,
  489. telephone: null,
  490. decisionMaker: null,
  491. fieldExpertise: null,
  492. support: null,
  493. power: null,
  494. jobTitle: null,
  495. position: null,
  496. section: null,
  497. superiorContact: null,
  498. superiorContactName: null,
  499. state: null,
  500. hobby: null,
  501. birthplace: null,
  502. birthday: null,
  503. contactClassification: null,
  504. customerName: null,
  505. customerCode: null,
  506. gander: null,
  507. name: null,
  508. code: null,
  509. id: null
  510. };
  511. this.resetForm("form");
  512. },
  513. /** 新增按钮操作 */
  514. handleAdd() {
  515. this.operatingState = "Insert";
  516. this.reset();
  517. this.form.boId = this.bo.id;
  518. this.form.customer = this.bo.customer;
  519. this.form.customerName = this.bo.customerName;
  520. this.form.state = '1';
  521. this.open = true;
  522. this.title = "添加联系人";
  523. },
  524. /** 修改按钮操作 */
  525. handleUpdate(row) {
  526. this.operatingState = "Update";
  527. this.reset();
  528. const id = row.id || this.ids
  529. getContact(id).then(response => {
  530. this.form = response.data;
  531. this.open = true;
  532. this.title = "修改联系人";
  533. this.timer = new Date().getTime();
  534. });
  535. },
  536. /** 查看按钮操作 */
  537. handleBrowse(row) {
  538. this.reset();
  539. const id = row.id || this.ids
  540. getContact(id).then(response => {
  541. this.form = response.data;
  542. this.open = true;
  543. this.operatingState = "Browse";
  544. this.title = "基础信息";
  545. });
  546. },
  547. /** 提交按钮 */
  548. submitForm() {
  549. this.submitButtonEditStatus = true;
  550. this.$refs["form"].validate(valid => {
  551. if (valid) {
  552. if (this.form.id != null) {
  553. updateContact(this.form).then(response => {
  554. this.$modal.msgSuccess("修改成功");
  555. this.open = false;
  556. this.getList();
  557. this.submitButtonEditStatus = false;
  558. });
  559. } else {
  560. addContact(this.form).then(response => {
  561. this.$modal.msgSuccess("新增成功");
  562. this.open = false;
  563. this.getList();
  564. this.submitButtonEditStatus = false;
  565. });
  566. }
  567. }else{
  568. this.submitButtonEditStatus = false;
  569. }
  570. });
  571. },
  572. /** 删除按钮操作 */
  573. handleDelete(row) {
  574. const ids = row.id || this.ids;
  575. this.$modal.confirm('是否确认删除联系人管理编号为"' + ids + '"的数据项?').then(function() {
  576. return delContact(ids);
  577. }).then(() => {
  578. this.getList();
  579. this.$modal.msgSuccess("删除成功");
  580. }).catch(() => {});
  581. },
  582. additionalCondition(){
  583. return {
  584. parame:{
  585. customer: this.form.customer ? this.form.customer : 'xxx'
  586. }
  587. }
  588. },
  589. }
  590. };
  591. </script>