detailsPageEdit.vue 44 KB

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