detailsPageEdit.vue 32 KB

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