detailsPageEdit.vue 33 KB

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