detailsPageEdit.vue 36 KB

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