index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <!-- <el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body> -->
  3. <div id="CustomersContact" class="app-container">
  4. <el-form ref="form" :model="form" :rules="rules" label-width="auto"
  5. :disabled="this.operatingState == 'Browse'">
  6. <el-divider content-position="left">
  7. <dev style="width: 50px; height: 40px; font-size: 18px">基本信息</dev>
  8. </el-divider>
  9. <el-row>
  10. <el-col :span="8">
  11. <el-form-item label="编码" prop="code">
  12. <el-input v-model="form.code" placeholder="系统自动生成编码" readonly />
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="8">
  16. <el-form-item label="姓名" prop="name">
  17. <el-input v-model="form.name" />
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="8">
  21. <el-form-item label="性别" prop="gander">
  22. <el-select v-model="form.gander" placeholder="">
  23. <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
  24. :value="dict.value"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="8">
  31. <el-form-item label="所属客户" prop="customerName">
  32. <dr-popover-select v-model="form.customerName" title="客户" type="CUSTOMER_PARAM_ZT" :dataMapping="{
  33. customer: 'id',
  34. customerName: 'name',
  35. }" :source.sync="form" :disabled="true">
  36. </dr-popover-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="8">
  40. <el-form-item label="联系人分类" prop="contactClassification">
  41. <el-select v-model="form.contactClassification" placeholder="">
  42. <el-option v-for="dict in dict.type.mk_bo_contact_type" :key="dict.value" :label="dict.label"
  43. :value="dict.value"></el-option>
  44. </el-select>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="8">
  48. <el-form-item label="生日" prop="birthday">
  49. <el-date-picker clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd">
  50. </el-date-picker>
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. <el-row>
  55. <el-col :span="8">
  56. <el-form-item label="籍贯" prop="birthplace">
  57. <el-input v-model="form.birthplace" />
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="8">
  61. <el-form-item label="兴趣爱好" prop="hobby">
  62. <el-input v-model="form.hobby" placeholder="" />
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="8">
  66. <el-form-item label="状态" prop="state">
  67. <el-select v-model="form.state" placeholder="">
  68. <el-option v-for="dict in dict.type.mk_bo_contact_state" :key="dict.value" :label="dict.label"
  69. :value="dict.value"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. <el-divider content-position="left">
  75. <dev style="width: 50px; height: 40px; font-size: 18px">工作信息</dev>
  76. </el-divider>
  77. <el-row>
  78. <el-col :span="8">
  79. <el-form-item label="上级联系人" prop="superiorContactName">
  80. <dr-popover-select v-model="form.superiorContactName" title="上级联系人" type="LINKMAN_PARAM" :dataMapping="{
  81. superiorContact: 'id',
  82. superiorContactName: 'name',
  83. }" :source.sync="form" :queryParams="additionalCondition">
  84. </dr-popover-select>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="8">
  88. <el-form-item label="任职科室" prop="section">
  89. <el-select v-model.trim="form.section" placeholder="" filterable>
  90. <el-option v-for="dict in dict.type.mk_bo_section" :key="dict.value" :label="dict.label"
  91. :value="dict.value"></el-option>
  92. </el-select>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="8">
  96. <el-form-item label="职务" prop="position">
  97. <el-select v-model="form.position" placeholder="">
  98. <el-option v-for="dict in dict.type.mk_bo_position" :key="dict.value" :label="dict.label"
  99. :value="dict.value"></el-option>
  100. </el-select>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. <el-row>
  105. <el-col :span="8">
  106. <el-form-item label="职称" prop="jobTitle">
  107. <el-select v-model="form.jobTitle" placeholder="">
  108. <el-option v-for="dict in dict.type.mk_bo_job_title" :key="dict.value" :label="dict.label"
  109. :value="dict.value"></el-option>
  110. </el-select>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="8">
  114. <el-form-item label="决策力" prop="power">
  115. <el-select v-model="form.power" placeholder="">
  116. <el-option v-for="dict in dict.type.mk_bo_power" :key="dict.value" :label="dict.label"
  117. :value="dict.value"></el-option>
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="8">
  122. <el-form-item label="支持度" prop="support">
  123. <el-select v-model="form.support" placeholder="">
  124. <el-option v-for="dict in dict.type.mk_bo_support" :key="dict.value" :label="dict.label"
  125. :value="dict.value"></el-option>
  126. </el-select>
  127. </el-form-item>
  128. </el-col>
  129. </el-row>
  130. <el-row>
  131. <el-col :span="8">
  132. <el-form-item label="擅长领域" prop="fieldExpertise">
  133. <el-select v-model="form.fieldExpertise" placeholder="">
  134. <el-option v-for="dict in dict.type.mk_bo_field_expertise" :key="dict.value" :label="dict.label"
  135. :value="dict.value"></el-option>
  136. </el-select>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="关键决策人" prop="decisionMaker">
  141. <el-select v-model="form.decisionMaker" placeholder="">
  142. <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value">
  143. </el-option>
  144. </el-select>
  145. </el-form-item>
  146. </el-col>
  147. <el-col :span="8">
  148. </el-col>
  149. </el-row>
  150. <el-divider content-position="left">
  151. <dev style="width: 50px; height: 40px; font-size: 18px">联系信息</dev>
  152. </el-divider>
  153. <el-row>
  154. <el-col :span="8">
  155. <el-form-item label="联系电话" prop="telephone">
  156. <el-input v-model="form.telephone" />
  157. </el-form-item>
  158. </el-col>
  159. <el-col :span="8">
  160. <el-form-item label="微信" prop="mail">
  161. <el-input v-model="form.mail" />
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="8">
  165. <el-form-item label="家庭地址" prop="address">
  166. <el-input v-model="form.address" />
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col :span="8">
  172. <el-form-item label="最佳拜访时间" prop="visitTime">
  173. <el-input v-model="form.visitTime" />
  174. </el-form-item>
  175. </el-col>
  176. <el-col :span="8">
  177. <el-form-item label="最佳拜访地点" prop="visitPlace">
  178. <el-input v-model="form.visitPlace" />
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="8">
  182. </el-col>
  183. </el-row>
  184. <el-tabs v-model="activeName" v-if="this.operatingState != 'Insert'">
  185. <el-tab-pane label="学历信息" name="first">
  186. <EducationList :key="timer" :supForm="this.row" />
  187. </el-tab-pane>
  188. <el-tab-pane label="社会关系" name="second">
  189. <RelationshipList :key="timer" :supForm="this.row" />
  190. </el-tab-pane>
  191. </el-tabs>
  192. <div class="md-auditInfo">
  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="6">
  198. <el-form-item label="创建人">
  199. <el-input v-model="form.createByName" readonly></el-input>
  200. </el-form-item>
  201. </el-col>
  202. <el-col :span="6">
  203. <el-form-item label="创建时间">
  204. <el-input v-model="form.createTime" readonly></el-input>
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="6">
  208. <el-form-item label="修改人">
  209. <el-input v-model="form.updateByName" readonly></el-input>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="6">
  213. <el-form-item label="修改时间">
  214. <el-input v-model="form.updateTime" readonly></el-input>
  215. </el-form-item>
  216. </el-col>
  217. </el-row>
  218. </div>
  219. </el-form>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button size="mini" type="primary" @click="submitForm" v-if="this.operatingState != 'Browse'"
  222. :disabled="submitButtonEditStatus">确 定</el-button>
  223. <el-button size="mini" @click="cancel">取 消</el-button>
  224. </div>
  225. </div>
  226. <!-- </el-dialog> -->
  227. </template>
  228. <script>
  229. import {
  230. listContact,
  231. getContact,
  232. delContact,
  233. addContact,
  234. updateContact
  235. } from "@/api/business/spd/bo/contact";
  236. // import EducationList from '../education/educationList.vue';
  237. // import RelationshipList from '../relationship/relationshipList.vue';
  238. export default {
  239. name: "CustomersContact",
  240. props: ['operatingState', 'row', 'disable', 'state', 'customersId', 'customersName', 'customersCode'],
  241. model: {
  242. prop: 'isAdd0',
  243. event: 'jugislist'
  244. },
  245. dicts: ['sys_user_sex', 'mk_bo_contact_state', 'mk_bo_section', 'mk_bo_position', 'mk_bo_job_title', 'mk_bo_power',
  246. 'mk_bo_support', 'mk_bo_field_expertise', 'sys_yes_no', 'mk_bo_contact_type'
  247. ],
  248. components: {
  249. EducationList: () => import('../education/educationList.vue'),
  250. RelationshipList: () => import('../relationship/relationshipList.vue')
  251. },
  252. data() {
  253. return {
  254. // 遮罩层
  255. loading: true,
  256. // 选中数组
  257. ids: [],
  258. // 非单个禁用
  259. single: true,
  260. // 非多个禁用
  261. multiple: true,
  262. // 显示搜索条件
  263. showSearch: true,
  264. // 总条数
  265. total: 0,
  266. // 联系人管理表格数据
  267. contactList: [],
  268. // 查询参数
  269. queryParams: {
  270. pageNum: 1,
  271. pageSize: 10,
  272. name: null,
  273. telephone: null,
  274. customerName: null,
  275. },
  276. // 表单参数
  277. form: {
  278. id: null,
  279. code: null,
  280. name: null,
  281. gander: null,
  282. customer: null,
  283. customer_name: null,
  284. customer_code: null,
  285. contact_classification: null,
  286. birthday: null,
  287. birthplace: null,
  288. hobby: null,
  289. state: null,
  290. superior_contact_name: null,
  291. superior_contact: null,
  292. section: null,
  293. position: null,
  294. job_title: null,
  295. power: null,
  296. support: null,
  297. field_expertise: null,
  298. decision_maker: null,
  299. telephone: null,
  300. mail: null,
  301. address: null,
  302. visit_time: null,
  303. visit_place: null,
  304. organization: null,
  305. organization_name: null,
  306. area: null,
  307. department: null,
  308. department_name: null,
  309. department_code: null,
  310. create_by: null,
  311. create_time: null,
  312. update_by: null,
  313. update_time: null,
  314. del_flag: null,
  315. bo_id: null,
  316. zt_id: null
  317. },
  318. // 表单校验
  319. rules: {
  320. name: [{
  321. required: true,
  322. message: "姓名不能为空",
  323. trigger: "blur"
  324. }],
  325. gander: [{
  326. required: true,
  327. message: "性别不能为空",
  328. trigger: "blur"
  329. }],
  330. customerName: [{
  331. required: true,
  332. message: "所属客户名称不能为空",
  333. trigger: "blur"
  334. }],
  335. state: [{
  336. required: true,
  337. message: "状态不能为空",
  338. trigger: "blur"
  339. }],
  340. section: [{
  341. required: true,
  342. message: "任职科室不能为空",
  343. trigger: "blur"
  344. }],
  345. position: [{
  346. required: true,
  347. message: "职务不能为空",
  348. trigger: "blur"
  349. }],
  350. jobTitle: [{
  351. required: true,
  352. message: "职称不能为空",
  353. trigger: "blur"
  354. }],
  355. power: [{
  356. required: true,
  357. message: "决策力不能为空",
  358. trigger: "blur"
  359. }],
  360. decisionMaker: [{
  361. required: true,
  362. message: "关键决策人不能为空",
  363. trigger: "blur"
  364. }],
  365. telephone: [{
  366. required: true,
  367. message: "联系电话不能为空",
  368. trigger: "blur"
  369. },
  370. {
  371. validator: function (rule, value, callback) {
  372. if (/^1[34578]\d{9}$/.test(value) == false) {
  373. callback(new Error("手机号格式错误"));
  374. } else {
  375. callback();
  376. }
  377. },
  378. trigger: "blur"
  379. }
  380. ],
  381. },
  382. //重新加载子组件参数
  383. timer: '',
  384. activeName: 'first',
  385. //确定按钮是否可点
  386. submitButtonEditStatus: false,
  387. };
  388. },
  389. created() {
  390. this.initialization();
  391. },
  392. methods: {
  393. // 初始化
  394. initialization() {
  395. // 客户数据赋值
  396. this.form.customer = this.customersId;
  397. this.form.customerCode = this.customersCode;
  398. this.form.customerName = this.customersName;
  399. if (this.operatingState == 'Browse') {
  400. this.handleBrowse(this.row);
  401. } else if (this.operatingState == 'Update') {
  402. this.handleUpdate(this.row);
  403. }
  404. },
  405. // 取消按钮
  406. cancel() {
  407. this.$emit('jugislist', false);
  408. },
  409. /** 修改按钮操作 */
  410. handleUpdate(row) {
  411. this.operatingState = "Update";
  412. const id = row.id || this.ids
  413. getContact(id).then(response => {
  414. this.form = response.data;
  415. this.timer = new Date().getTime();
  416. });
  417. },
  418. /** 查看按钮操作 */
  419. handleBrowse(row) {
  420. const id = row.id || this.ids
  421. getContact(id).then(response => {
  422. this.form = response.data;
  423. this.operatingState = "Browse";
  424. });
  425. },
  426. /** 提交按钮 */
  427. submitForm() {
  428. this.submitButtonEditStatus = true;
  429. this.$refs["form"].validate(valid => {
  430. if (valid) {
  431. if (this.form.id != null) {
  432. updateContact(this.form).then(response => {
  433. this.$modal.msgSuccess("修改成功");
  434. this.submitButtonEditStatus = false;
  435. this.cancel();
  436. this.$parent.handleCheck(this.customersId);
  437. });
  438. } else {
  439. addContact(this.form).then(response => {
  440. this.$modal.msgSuccess("新增成功");
  441. this.submitButtonEditStatus = false;
  442. this.cancel();
  443. this.$parent.handleCheck(this.customersId);
  444. });
  445. }
  446. } else {
  447. this.submitButtonEditStatus = false;
  448. }
  449. });
  450. },
  451. additionalCondition() {
  452. return {
  453. parame: {
  454. customer: this.form.customer ? this.form.customer : 'xxx'
  455. }
  456. }
  457. },
  458. }
  459. };
  460. </script>