contactList.vue 25 KB

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