detailsPageEdit.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button
  7. type="danger"
  8. style="border: none;background: none;color: red"
  9. icon="el-icon-arrow-left"
  10. @click="backToList"
  11. >返回列表
  12. </el-button>
  13. </div>
  14. <div class="add-customer-btn">
  15. <el-button type="primary" @click="synchronization" size="small"
  16. >同 步
  17. </el-button>
  18. <el-button type="primary" @click="openFlow" size="small"
  19. >审 核
  20. </el-button>
  21. <el-button
  22. type="primary"
  23. :disabled="disabled"
  24. @click="editCustomer"
  25. size="small"
  26. >{{ form.id ? "确认修改" : "确认新增" }}
  27. </el-button>
  28. </div>
  29. </div>
  30. <div class="customer-main">
  31. <el-form
  32. :model="form"
  33. ref="form"
  34. label-width="100px"
  35. class="demo-ruleForm"
  36. >
  37. <containerTitle title="基础资料"></containerTitle>
  38. <basic-container>
  39. <el-row>
  40. <el-col
  41. v-for="(item, index) in basicData.column"
  42. :key="index"
  43. :span="item.span ? item.span : 8"
  44. >
  45. <el-form-item
  46. :label="item.label"
  47. :prop="item.prop"
  48. :rules="item.rules"
  49. >
  50. <avue-input-tree
  51. v-if="item.prop === 'corpsTypeId'"
  52. leaf-only
  53. multiple
  54. style="width: 100%;"
  55. size="small"
  56. :props="{ label: 'title' }"
  57. v-model="form[item.prop]"
  58. placeholder=" "
  59. type="tree"
  60. :dic="dic"
  61. ></avue-input-tree>
  62. <avue-input-tree
  63. v-else-if="item.prop === 'belongtoarea'"
  64. leaf-only
  65. multiple
  66. tags
  67. style="width: 100%;"
  68. size="small"
  69. :props="{ label: 'name', value: 'name' }"
  70. v-model="form[item.prop]"
  71. placeholder=" "
  72. type="tree"
  73. :dic="dicArea"
  74. ></avue-input-tree>
  75. <el-select
  76. v-else-if="item.prop === 'adminProfiles'"
  77. size="small"
  78. style="width: 100%;"
  79. v-model="form[item.prop]"
  80. multiple
  81. placeholder=""
  82. >
  83. <el-option
  84. v-for="item in userList"
  85. :key="item.id"
  86. :label="item.name"
  87. :value="item.id"
  88. >
  89. </el-option>
  90. </el-select>
  91. <crop-select
  92. v-else-if="item.prop === 'belongtocompany'"
  93. v-model="form[item.prop]"
  94. @getCorpData="getCorpName"
  95. corpType="GS"
  96. ></crop-select>
  97. <el-input
  98. type="age"
  99. v-else
  100. v-model="form[item.prop]"
  101. size="small"
  102. autocomplete="off"
  103. :disabled="item.disabled"
  104. ></el-input>
  105. </el-form-item>
  106. </el-col>
  107. </el-row>
  108. </basic-container>
  109. <containerTitle title="联系方式"></containerTitle>
  110. <basic-container>
  111. <el-row>
  112. <el-col
  113. v-for="(item, index) in contactInformation.column"
  114. :key="index"
  115. :span="item.span ? item.span : 8"
  116. >
  117. <el-form-item
  118. :label="item.label"
  119. :prop="item.prop"
  120. :rules="item.rules"
  121. >
  122. <el-input
  123. type="age"
  124. v-model="form[item.prop]"
  125. size="small"
  126. autocomplete="off"
  127. ></el-input>
  128. </el-form-item>
  129. </el-col>
  130. </el-row>
  131. </basic-container>
  132. <containerTitle title="财务资料"></containerTitle>
  133. <basic-container>
  134. <el-row>
  135. <el-col
  136. v-for="(item, index) in financialInformation.column"
  137. :key="index"
  138. :span="item.span ? item.span : 8"
  139. >
  140. <el-form-item
  141. :label="item.label"
  142. :prop="item.prop"
  143. :rules="item.rules"
  144. >
  145. <el-switch
  146. v-if="item.prop === 'creditstatus'"
  147. v-model="form[item.prop]"
  148. active-value="0"
  149. inactive-value="1"
  150. active-text="开启"
  151. inactive-text="关闭"
  152. >
  153. </el-switch>
  154. <el-select
  155. v-else-if="item.prop === 'paymentType'"
  156. v-model="form[item.prop]"
  157. clearable
  158. filterable
  159. size="small"
  160. style="width: 100%;"
  161. >
  162. <el-option
  163. v-for="(item, index) in paymentOption"
  164. :key="index"
  165. :label="item.dictValue"
  166. :value="item.dictValue"
  167. ></el-option>
  168. </el-select>
  169. <el-select
  170. v-else-if="item.prop === 'packageRemarks'"
  171. v-model="form[item.prop]"
  172. clearable
  173. filterable
  174. size="small"
  175. style="width: 100%;"
  176. >
  177. <el-option
  178. v-for="(item, index) in packageOptions"
  179. :key="index"
  180. :label="item.dictValue"
  181. :value="item.dictValue"
  182. ></el-option>
  183. </el-select>
  184. <el-input
  185. v-else
  186. type="age"
  187. v-model="form[item.prop]"
  188. size="small"
  189. autocomplete="off"
  190. ></el-input>
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. </basic-container>
  195. <containerTitle title="客户联系人"></containerTitle>
  196. <basic-container>
  197. <avue-crud
  198. :option="customerContact"
  199. v-model="contactsForm"
  200. :data="contactsData"
  201. @row-save="rowSave"
  202. @row-update="rowUpdate"
  203. @row-del="rowDel"
  204. >
  205. <template slot-scope="{type,size,row}" slot="menu">
  206. <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
  207. </template>
  208. </avue-crud>
  209. </basic-container>
  210. <!-- <containerTitle title="客户优势项目"></containerTitle>
  211. <basic-container style="margin-bottom: 10px">
  212. <avue-crud
  213. :option="advantageProject"
  214. v-model="advantageProjectForm"
  215. :data="advantageProjectData"
  216. @row-save="rowSaveProject"
  217. @row-update="rowUpdateProject"
  218. @row-del="rowDelProject"
  219. ></avue-crud>
  220. </basic-container> -->
  221. <containerTitle title="客户开户行"></containerTitle>
  222. <basic-container>
  223. <avue-crud
  224. :option="bankOfDeposit"
  225. v-model="bankOfDepositForm"
  226. :data="bankOfDepositData"
  227. @row-save="rowSaveBankOfDeposit"
  228. @row-update="rowUpdateBankOfDeposit"
  229. @row-del="rowDelBankOfDeposit"
  230. ></avue-crud>
  231. </basic-container>
  232. <containerTitle title="收发货地址"></containerTitle>
  233. <basic-container>
  234. <avue-crud
  235. :option="addressOption"
  236. v-model="addressForm"
  237. :data="addressData"
  238. @row-save="rowSaveAddress"
  239. @row-update="rowUpdateAddress"
  240. @row-del="rowDelAddress"
  241. ></avue-crud>
  242. </basic-container>
  243. </el-form>
  244. </div>
  245. <flow-dialog :switchDialog="switchDialog" @onClose="onClose()">
  246. <template slot="content"> </template>
  247. </flow-dialog>
  248. <el-dialog
  249. title="同 步"
  250. :visible.sync="dialogVisible"
  251. append-to-body
  252. width="60%">
  253. <avue-form ref="formData" v-model="formData" :option="option">
  254. </avue-form>
  255. <span slot="footer" class="dialog-footer">
  256. <el-button @click="dialogVisible = false">取 消</el-button>
  257. <el-button type="primary" @click="confirmSynchronization">确 定</el-button>
  258. </span>
  259. </el-dialog>
  260. <el-dialog
  261. title="创建用户"
  262. :visible.sync="dialogVisibleBt"
  263. append-to-body
  264. width="60%">
  265. <avue-form ref="formDataTwo" v-model="formDataTwo" :option="optionData">
  266. </avue-form>
  267. <span slot="footer" class="dialog-footer">
  268. <el-button @click="dialogVisibleBt = false">取 消</el-button>
  269. <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
  270. </span>
  271. </el-dialog>
  272. </div>
  273. </template>
  274. <script>
  275. import {
  276. customerList,
  277. typeSave,
  278. detail,
  279. deleteDetails,
  280. corpstypeTree,
  281. corpsattn,
  282. corpsbank,
  283. corpsfiles,
  284. corpsitem,
  285. areaTypeTree,
  286. corpsAddrDelete, synchronizationCopy,creatingUsers
  287. } from "@/api/basicData/customerInformation";
  288. import customerContact from "./configuration/customerContact.json";
  289. import advantageProject from "./configuration/advantageProject.json";
  290. import bankOfDeposit from "./configuration/bankOfDeposit.json";
  291. import flowDialog from "@/components/flow-dialog/main";
  292. import { customerParameter } from "@/enums/management-type";
  293. import { gainUser } from "@/api/basicData/customerInquiry";
  294. import addressOption from "./configuration/addressOption.json";
  295. import website from "@/config/website";
  296. import {getRoleTree} from "@/api/system/role";
  297. import {getDeptTree} from "@/api/system/dept";
  298. import {getPostList} from "@/api/system/post";
  299. export default {
  300. name: "detailsPage",
  301. data() {
  302. return {
  303. userList: [],
  304. formData:{},
  305. formDataTwo:{},
  306. optionData:{
  307. span:8,
  308. menuBtn:false,
  309. column:[{
  310. label: "所属角色",
  311. prop: "roleId",
  312. multiple: true,
  313. type: "tree",
  314. dicData: [],
  315. props: {
  316. label: "title"
  317. },
  318. checkStrictly: true,
  319. slot: true,
  320. rules: [{
  321. required: true,
  322. message: "请选择所属角色",
  323. trigger: "click"
  324. }]
  325. },{
  326. label: "所属部门",
  327. prop: "deptId",
  328. type: "tree",
  329. multiple: true,
  330. dicData: [],
  331. props: {
  332. label: "title"
  333. },
  334. checkStrictly: true,
  335. slot: true,
  336. rules: [{
  337. required: true,
  338. message: "请选择所属部门",
  339. trigger: "click"
  340. }]
  341. },
  342. {
  343. label: "所属岗位",
  344. prop: "postId",
  345. type: "tree",
  346. multiple: true,
  347. dicData: [],
  348. props: {
  349. label: "postName",
  350. value: "id"
  351. },
  352. rules: [{
  353. required: true,
  354. message: "请选择所属岗位",
  355. trigger: "click"
  356. }],
  357. }]
  358. },
  359. dialogVisibleBt:false,
  360. dialogVisible:false,
  361. option:{
  362. span:12,
  363. menuBtn:false,
  364. column: [{
  365. label: '客户类型',
  366. prop: 'corpType',
  367. type: 'select',
  368. cascader: ['corpsTypeId'],
  369. dicUrl: "/api/blade-system/dict-biz/dictionary?code=corp_type",
  370. props: {
  371. label: "dictValue",
  372. value: "dictKey"
  373. },
  374. rules: [
  375. {
  376. required: true,
  377. message: "请选择客户类型",
  378. trigger: "blur"
  379. }
  380. ]
  381. },{
  382. label: '类别',
  383. prop: 'corpsTypeId',
  384. type: 'tree',
  385. dicUrl: "/api/blade-client/corpstype/tree?&corpType={{key}}",
  386. props: {
  387. label: "title",
  388. value: "value",
  389. },
  390. rules: [
  391. {
  392. required: true,
  393. message: "请选择类型",
  394. trigger: "blur"
  395. }
  396. ]
  397. }]
  398. },
  399. switchDialog: false,
  400. form: {},
  401. disabled: false,
  402. contactsForm: {},
  403. advantageProjectForm: {},
  404. bankOfDepositForm: {},
  405. contactsData: [],
  406. advantageProjectData: [],
  407. bankOfDepositData: [],
  408. dic: [],
  409. dicArea: [],
  410. customerContact: customerContact,
  411. advantageProject: advantageProject,
  412. bankOfDeposit: bankOfDeposit,
  413. contactInformation: {
  414. column: [
  415. {
  416. label: "联系人",
  417. prop: "attn",
  418. rules: [
  419. {
  420. required: false,
  421. message: "请输入联系人",
  422. trigger: "blur"
  423. }
  424. ]
  425. },
  426. {
  427. label: "联系电话",
  428. prop: "tel",
  429. rules: [
  430. {
  431. required: false,
  432. message: "请输入联系电话",
  433. trigger: "blur"
  434. }
  435. ]
  436. },
  437. {
  438. label: "职位",
  439. prop: "position",
  440. rules: [
  441. {
  442. required: false,
  443. message: "请输入联系电话",
  444. trigger: "blur"
  445. }
  446. ]
  447. },
  448. {
  449. label: "单位地址",
  450. prop: "addr",
  451. rules: [
  452. {
  453. required: false,
  454. message: "请输入单位地址",
  455. trigger: "blur"
  456. }
  457. ]
  458. },
  459. {
  460. label: "仓库地址",
  461. prop: "storageAddr",
  462. rules: [
  463. {
  464. required: false,
  465. message: "请输入仓库地址",
  466. trigger: "blur"
  467. }
  468. ]
  469. },
  470. {
  471. label: "分仓地址",
  472. prop: "subStorageAddr",
  473. rules: [
  474. {
  475. required: false,
  476. message: "请输入分仓地址",
  477. trigger: "blur"
  478. }
  479. ]
  480. }
  481. ]
  482. },
  483. financialInformation: {
  484. column: [
  485. {
  486. label: "账户名称",
  487. prop: "accountName",
  488. rules: [
  489. {
  490. required: false,
  491. message: " ",
  492. trigger: "blur"
  493. }
  494. ]
  495. },
  496. {
  497. label: "开户银行",
  498. prop: "accountBank",
  499. rules: [
  500. {
  501. required: false,
  502. message: " ",
  503. trigger: "blur"
  504. }
  505. ]
  506. },
  507. {
  508. label: "银行帐号",
  509. prop: "accountNo",
  510. rules: [
  511. {
  512. required: false,
  513. message: " ",
  514. trigger: "blur"
  515. }
  516. ]
  517. },
  518. {
  519. label: "CNAPS",
  520. prop: "cnaps",
  521. rules: [
  522. {
  523. required: false,
  524. message: " ",
  525. trigger: "blur"
  526. }
  527. ]
  528. },
  529. {
  530. label: "银行地址",
  531. prop: "localBankAddress",
  532. rules: [
  533. {
  534. required: false,
  535. message: " ",
  536. trigger: "blur"
  537. }
  538. ]
  539. },
  540. {
  541. label: "外币账户名称",
  542. prop: "accountNameFcy",
  543. rules: [
  544. {
  545. required: false,
  546. message: " ",
  547. trigger: "blur"
  548. }
  549. ]
  550. },
  551. {
  552. label: "外币开户银行",
  553. prop: "accountBankFcy",
  554. rules: [
  555. {
  556. required: false,
  557. message: " ",
  558. trigger: "blur"
  559. }
  560. ]
  561. },
  562. {
  563. label: "外币银行账号",
  564. prop: "accountNoFcy",
  565. rules: [
  566. {
  567. required: false,
  568. message: " ",
  569. trigger: "blur"
  570. }
  571. ]
  572. },
  573. {
  574. label: "Swift Code",
  575. prop: "swiftCode",
  576. rules: [
  577. {
  578. required: false,
  579. message: " ",
  580. trigger: "blur"
  581. }
  582. ]
  583. },
  584. {
  585. label: "外币银行地址",
  586. prop: "foreignBankAddress",
  587. rules: [
  588. {
  589. required: false,
  590. message: " ",
  591. trigger: "blur"
  592. }
  593. ]
  594. },
  595. {
  596. label: "授信状态",
  597. prop: "creditstatus",
  598. rules: [
  599. {
  600. required: false,
  601. message: " ",
  602. trigger: "blur"
  603. }
  604. ]
  605. },
  606. {
  607. label: "授信等级",
  608. prop: "creditLevel",
  609. rules: [
  610. {
  611. required: false,
  612. message: " ",
  613. trigger: "blur"
  614. }
  615. ]
  616. },
  617. {
  618. label: "授信额度",
  619. prop: "creditGrant",
  620. rules: [
  621. {
  622. required: false,
  623. message: " ",
  624. trigger: "blur"
  625. }
  626. ]
  627. },
  628. {
  629. label: "授信天数",
  630. prop: "creditDay",
  631. rules: [
  632. {
  633. required: false,
  634. message: " ",
  635. trigger: "blur"
  636. }
  637. ]
  638. },
  639. {
  640. label: "授信利率",
  641. prop: "creditRate",
  642. rules: [
  643. {
  644. required: false,
  645. message: " ",
  646. trigger: "blur"
  647. }
  648. ]
  649. },
  650. {
  651. label: "FOB系数",
  652. prop: "coefficient"
  653. },
  654. {
  655. label: "付款方式",
  656. prop: "paymentType"
  657. },
  658. {
  659. label: "包装要求",
  660. prop: "packageRemarks"
  661. }
  662. ]
  663. },
  664. basicData: {
  665. column: [
  666. {
  667. label: "编码",
  668. prop: "code",
  669. rules: [
  670. {
  671. required: true,
  672. message: " ",
  673. trigger: "blur"
  674. }
  675. ]
  676. },
  677. {
  678. label: "名称",
  679. prop: "cname",
  680. rules: [
  681. {
  682. required: true,
  683. message: " ",
  684. trigger: "blur"
  685. }
  686. ]
  687. },
  688. {
  689. label: "类别",
  690. prop: "corpsTypeId",
  691. rules: [
  692. {
  693. required: true,
  694. message: " ",
  695. trigger: "blur"
  696. }
  697. ]
  698. },
  699. {
  700. label: "企业类型",
  701. prop: "companytype",
  702. rules: [
  703. {
  704. required: false,
  705. message: " ",
  706. trigger: "blur"
  707. }
  708. ]
  709. },
  710. {
  711. label: "代理品牌",
  712. prop: "goodtypes",
  713. rules: [
  714. {
  715. required: false,
  716. message: " ",
  717. trigger: "blur"
  718. }
  719. ]
  720. },
  721. {
  722. label: "所属公司",
  723. prop: "belongtocompany",
  724. rules: [
  725. {
  726. required: false,
  727. message: " ",
  728. trigger: "blur"
  729. }
  730. ]
  731. },
  732. {
  733. label: "分管员",
  734. prop: "adminProfiles",
  735. span: 8
  736. },
  737. {
  738. label: "代理区域",
  739. prop: "belongtoarea",
  740. span: 16,
  741. mock: {
  742. type: "county"
  743. }
  744. },
  745. // {
  746. // label: "总返利",
  747. // prop: "profitReturn",
  748. // disabled: true,
  749. // span: 8
  750. // },
  751. // {
  752. // label: "已用返利",
  753. // prop: "usedProfit",
  754. // disabled: true,
  755. // span: 8
  756. // },
  757. // {
  758. // label: "可用返利",
  759. // prop: "surplusProfit",
  760. // disabled: false,
  761. // span: 8
  762. // },
  763. // {
  764. // label: "可用返利",
  765. // prop: "monthProfit",
  766. // disabled: true,
  767. // span: 8
  768. // },
  769. {
  770. label: "备注",
  771. prop: "remarks",
  772. span: 24,
  773. mock: {
  774. type: "county"
  775. }
  776. }
  777. ]
  778. },
  779. paymentOption: [],
  780. addressOption: addressOption,
  781. addressForm: {},
  782. addressData: [],
  783. formRow:{},
  784. // 包装要求
  785. packageOptions: []
  786. };
  787. },
  788. props: {
  789. detailData: {
  790. type: Object
  791. }
  792. },
  793. components: {
  794. flowDialog
  795. },
  796. created() {
  797. this.initData(website.tenantId)
  798. if (this.$store.getters.userInfo.tenant_id === "096359") {
  799. let list = ["profitReturn", "usedProfit", "surplusProfit", "monthProfit"];
  800. for (let item in list) {
  801. for (let i in this.basicData.column) {
  802. if (list[item] == this.basicData.column[i].prop) {
  803. this.basicData.column.splice(i, 1);
  804. }
  805. }
  806. }
  807. }
  808. corpstypeTree({ corpType: customerParameter.code }).then(res => {
  809. this.dic = res.data.data;
  810. });
  811. areaTypeTree().then(res => {
  812. this.dicArea = res.data.data;
  813. });
  814. this.getWorkDicts("packageRemarks").then(res => {
  815. this.packageOptions = res.data.data;
  816. });
  817. this.getWorkDicts("payment_term").then(res => {
  818. this.paymentOption = res.data.data;
  819. });
  820. if (this.detailData.id) {
  821. detail(this.detailData.id).then(res => {
  822. if (res.data.data.adminProfiles) {
  823. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  824. }
  825. this.form = res.data.data;
  826. this.contactsData = this.form.corpsAttnList;
  827. this.bankOfDepositData = this.form.corpsBankList;
  828. this.advantageProjectData = this.form.corpsItems;
  829. this.addressData = this.form.corpsAddrList;
  830. delete this.form.corpsAttnList;
  831. delete this.form.corpsBankList;
  832. delete this.form.corpsItems;
  833. delete this.form.corpsAddrList;
  834. });
  835. } else if (this.detailData.treeDeptId) {
  836. this.$set(this.form, 'corpsTypeId', this.detailData.treeDeptId)
  837. }
  838. gainUser().then(res => {
  839. this.userList = res.data.data;
  840. });
  841. },
  842. methods: {
  843. initData(tenantId) {
  844. getRoleTree(tenantId).then(res => {
  845. const column = this.findObject(this.optionData.column, "roleId");
  846. column.dicData = res.data.data;
  847. });
  848. getDeptTree(tenantId).then(res => {
  849. const column = this.findObject(this.optionData.column, "deptId");
  850. column.dicData = res.data.data;
  851. });
  852. getPostList(tenantId).then(res => {
  853. const column = this.findObject(this.optionData.column, "postId");
  854. column.dicData = res.data.data;
  855. });
  856. },
  857. //确认创建用户
  858. confirmSynchronizationTwo(){
  859. this.$refs['formDataTwo'].validate((valid, done) => {
  860. done()
  861. if (valid) {
  862. let data = JSON.parse(JSON.stringify(this.formDataTwo))
  863. data.deptId = data.deptId.join(",");
  864. data.roleId = data.roleId.join(",");
  865. data.postId = data.postId.join(",");
  866. creatingUsers({
  867. ...data,
  868. id:this.formRow.id
  869. }).then(res=>{
  870. this.dialogVisibleBt = false
  871. this.$message.success('创建用户成功,默认帐号:联系人名称。默认密码:123456');
  872. })
  873. } else {
  874. return false;
  875. }
  876. });
  877. },
  878. creatingUsers(row){
  879. if (row.id){
  880. if (row.tel){
  881. this.dialogVisibleBt = true
  882. this.formDataTwo = {}
  883. this.formRow = row
  884. }else {
  885. this.$message.error('请输入手机号');
  886. }
  887. }else {
  888. this.$message.error('请保存数据后再点击');
  889. }
  890. },
  891. //新增客户联系人保存触发
  892. rowSave(row, done, loading) {
  893. console.log(row, done, loading);
  894. this.contactsData.push(row);
  895. done();
  896. },
  897. //修改客户联系人触发
  898. rowUpdate(row, index, done, loading) {
  899. done(row);
  900. },
  901. //删除客户联系人触发
  902. rowDel(row, index, donerowDel) {
  903. this.$confirm("确定将选择数据删除?", {
  904. confirmButtonText: "确定",
  905. cancelButtonText: "取消",
  906. type: "warning"
  907. }).then(() => {
  908. // 数据回调进行刷新
  909. if (row.id) {
  910. corpsattn(row.id).then(res => {
  911. this.$message({
  912. type: "success",
  913. message: "操作成功!"
  914. });
  915. this.contactsData.splice(index, 1);
  916. });
  917. } else {
  918. this.$message({
  919. type: "success",
  920. message: "操作成功!"
  921. });
  922. this.contactsData.splice(index, 1);
  923. }
  924. });
  925. },
  926. //新增客户优势项目保存触发
  927. rowSaveProject(row, done, loading) {
  928. console.log(row, done, loading);
  929. this.advantageProjectData.push(row);
  930. done();
  931. },
  932. //修改客户优势项目触发
  933. rowUpdateProject(row, index, done, loading) {
  934. done(row);
  935. },
  936. //删除客户优势项目触发
  937. rowDelProject(row, index, donerowDel) {
  938. this.$confirm("确定将选择数据删除?", {
  939. confirmButtonText: "确定",
  940. cancelButtonText: "取消",
  941. type: "warning"
  942. }).then(() => {
  943. if (row.id) {
  944. corpsitem(row.id).then(res => {
  945. this.$message({
  946. type: "success",
  947. message: "操作成功!"
  948. });
  949. this.advantageProjectData.splice(index, 1);
  950. });
  951. } else {
  952. this.$message({
  953. type: "success",
  954. message: "操作成功!"
  955. });
  956. this.advantageProjectData.splice(index, 1);
  957. }
  958. });
  959. },
  960. //新增客户优势项目保存触发
  961. rowSaveBankOfDeposit(row, done, loading) {
  962. console.log(row, done, loading);
  963. this.bankOfDepositData.push(row);
  964. done();
  965. },
  966. //修改客户优势项目触发
  967. rowUpdateBankOfDeposit(row, index, done, loading) {
  968. done(row);
  969. },
  970. //删除客户优势项目触发
  971. rowDelBankOfDeposit(row, index, donerowDel) {
  972. this.$confirm("确定将选择数据删除?", {
  973. confirmButtonText: "确定",
  974. cancelButtonText: "取消",
  975. type: "warning"
  976. }).then(() => {
  977. if (row.id) {
  978. corpsbank(row.id).then(res => {
  979. this.$message({
  980. type: "success",
  981. message: "操作成功!"
  982. });
  983. this.bankOfDepositData.splice(index, 1);
  984. });
  985. } else {
  986. this.$message({
  987. type: "success",
  988. message: "操作成功!"
  989. });
  990. this.bankOfDepositData.splice(index, 1);
  991. }
  992. });
  993. },
  994. //新增收发货地址保存触发
  995. rowSaveAddress(row, done, loading) {
  996. this.addressData.push(row);
  997. done();
  998. },
  999. //修改收发货地址优势项目触发
  1000. rowUpdateAddress(row, index, done, loading) {
  1001. done(row);
  1002. },
  1003. //删除收发货地址优势项目触发
  1004. rowDelAddress(row, index, donerowDel) {
  1005. this.$confirm("确定将选择数据删除?", {
  1006. confirmButtonText: "确定",
  1007. cancelButtonText: "取消",
  1008. type: "warning"
  1009. }).then(() => {
  1010. if (row.id) {
  1011. corpsAddrDelete(row.id).then(res => {
  1012. this.$message({
  1013. type: "success",
  1014. message: "操作成功!"
  1015. });
  1016. this.addressData.splice(index, 1);
  1017. });
  1018. } else {
  1019. this.$message({
  1020. type: "success",
  1021. message: "操作成功!"
  1022. });
  1023. this.addressData.splice(index, 1);
  1024. }
  1025. });
  1026. },
  1027. //修改提交触发
  1028. editCustomer() {
  1029. this.$refs["form"].validate(valid => {
  1030. if (valid) {
  1031. this.form.corpsAttnList = this.contactsData;
  1032. this.form.corpsBankList = this.bankOfDepositData;
  1033. this.form.corpsItems = this.advantageProjectData;
  1034. this.form.corpsAddrList = this.addressData;
  1035. if (typeof this.form.corpsTypeId == "object") {
  1036. this.form.corpsTypeId = this.form.corpsTypeId.join(",");
  1037. }
  1038. this.disabled = true;
  1039. if (this.form.belongtoarea) {
  1040. this.form.belongtoarea = this.form.belongtoarea.toString();
  1041. }
  1042. if (this.form.adminProfiles) {
  1043. this.form.adminProfiles = this.form.adminProfiles.join(",");
  1044. }
  1045. this.form.corpType = customerParameter.code;
  1046. typeSave(this.form).then(res => {
  1047. if (res.data.data === "error") {
  1048. this.disabled = false;
  1049. this.$message({
  1050. showClose: true,
  1051. message: res.data.msg,
  1052. type: "error"
  1053. });
  1054. } else {
  1055. this.$message({
  1056. type: "success",
  1057. message: this.form.id ? "修改成功!" : "新增成功!"
  1058. });
  1059. this.form = res.data.data
  1060. this.disabled = false;
  1061. }
  1062. });
  1063. } else {
  1064. return false;
  1065. }
  1066. });
  1067. },
  1068. synchronization(){
  1069. this.dialogVisible = true
  1070. },
  1071. //确认同步
  1072. confirmSynchronization(){
  1073. this.$refs['formData'].validate((valid, done) => {
  1074. if (valid){
  1075. synchronizationCopy({
  1076. ...this.formData,
  1077. id:this.form.id
  1078. }).then(res=>{
  1079. done()
  1080. this.$message.success('同步成功');
  1081. this.dialogVisible = false
  1082. })
  1083. }else {
  1084. return done();
  1085. }
  1086. })
  1087. },
  1088. backToList() {
  1089. this.$emit("goBack");
  1090. },
  1091. openFlow() {
  1092. this.switchDialog = !this.switchDialog;
  1093. },
  1094. onClose(val) {
  1095. this.switchDialog = val;
  1096. },
  1097. getCorpName(row) {}
  1098. }
  1099. };
  1100. </script>
  1101. <style lang="scss" scoped>
  1102. ::v-deep .el-form-item {
  1103. margin-bottom: 0;
  1104. }
  1105. ::v-deep .el-form-item__content {
  1106. line-height: 32px;
  1107. }
  1108. </style>