detailsPageEdit.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449
  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" 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 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. hide: true,
  619. prop: "b"
  620. },
  621. {
  622. label: "结清月份",
  623. span: 8,
  624. hide: true,
  625. prop: "c"
  626. },
  627. {
  628. label: "结清天数",
  629. span: 8,
  630. hide: true,
  631. prop: "j"
  632. },
  633. {
  634. label: "日利息万分",
  635. span: 8,
  636. prop: "d"
  637. },
  638. {
  639. label: "最大欠款额",
  640. span: 8,
  641. prop: "e"
  642. },
  643. {
  644. label: "协议号",
  645. span: 8,
  646. prop: "f"
  647. },
  648. {
  649. label: "账期日期",
  650. span: 8,
  651. prop: "g"
  652. },
  653. {
  654. label: "账期备注",
  655. span: 24,
  656. prop: "h"
  657. }
  658. ]
  659. },
  660. basicData: {
  661. column: [
  662. {
  663. label: "编码",
  664. prop: "code",
  665. rules: [
  666. {
  667. required: true,
  668. message: " ",
  669. trigger: "blur"
  670. }
  671. ]
  672. },
  673. {
  674. label: "名称",
  675. prop: "cname",
  676. rules: [
  677. {
  678. required: true,
  679. message: " ",
  680. trigger: "blur"
  681. }
  682. ]
  683. },
  684. {
  685. label: "简称",
  686. prop: "shortName"
  687. },
  688. {
  689. label: "类别",
  690. prop: "corpsTypeId",
  691. rules: [
  692. {
  693. required: true,
  694. message: " ",
  695. trigger: "blur"
  696. }
  697. ]
  698. },
  699. {
  700. label: "企业类型",
  701. prop: "companytype",
  702. rules: [
  703. {
  704. required: false,
  705. message: " ",
  706. trigger: "blur"
  707. }
  708. ]
  709. },
  710. {
  711. label: "代理品牌",
  712. prop: "goodtypes",
  713. rules: [
  714. {
  715. required: false,
  716. message: " ",
  717. trigger: "blur"
  718. }
  719. ]
  720. },
  721. {
  722. label: "所属公司",
  723. prop: "belongtocompany",
  724. rules: [
  725. {
  726. required: false,
  727. message: " ",
  728. trigger: "blur"
  729. }
  730. ]
  731. },
  732. {
  733. label: "分管员",
  734. prop: "adminProfiles",
  735. span: 8
  736. },
  737. {
  738. label: "区域",
  739. prop: "belongtoarea",
  740. span: 8,
  741. mock: {
  742. type: "county"
  743. }
  744. },
  745. {
  746. label: "信用等级",
  747. prop: "creditRating",
  748. span: 8
  749. },
  750. {
  751. label: "代理商编码",
  752. prop: "agentCode",
  753. span: 8
  754. }, {
  755. label: "首字母",
  756. prop: "initials",
  757. span: 8
  758. },{
  759. label: "优势航线",
  760. prop: "line",
  761. span: 8
  762. },
  763. // {
  764. // label: "总返利",
  765. // prop: "profitReturn",
  766. // disabled: true,
  767. // span: 8
  768. // },
  769. // {
  770. // label: "已用返利",
  771. // prop: "usedProfit",
  772. // disabled: true,
  773. // span: 8
  774. // },
  775. // {
  776. // label: "可用返利",
  777. // prop: "surplusProfit",
  778. // disabled: false,
  779. // span: 8
  780. // },
  781. // {
  782. // label: "可用返利",
  783. // prop: "monthProfit",
  784. // disabled: true,
  785. // span: 8
  786. // },
  787. {
  788. label: "备注",
  789. prop: "remarks",
  790. span: 16,
  791. mock: {
  792. type: "county"
  793. }
  794. }
  795. ]
  796. },
  797. paymentOption: [],
  798. settingOption: [],
  799. monthOption: [],
  800. addressOption: {},
  801. addressForm: {},
  802. addressData: [],
  803. formRow: {},
  804. // 包装要求
  805. packageOptions: [],
  806. props: {
  807. value: "name",
  808. label: "name",
  809. multiple: true
  810. },
  811. addressLatLng: [],
  812. oldform: {
  813. creditstatus:'1'
  814. },
  815. oldcontactsData: [],
  816. oldbankOfDepositData: [],
  817. oldadvantageProjectData: [],
  818. oldaddressLatLng: [],
  819. oldaddressData: [],
  820. };
  821. },
  822. props: {
  823. detailData: {
  824. type: Object
  825. }
  826. },
  827. components: {
  828. flowDialog
  829. },
  830. async created() {
  831. this.customerContact = await this.getColumnData(
  832. this.getColumnName(143),
  833. customerContact
  834. );
  835. this.bankOfDeposit = await this.getColumnData(
  836. this.getColumnName(144),
  837. bankOfDeposit
  838. );
  839. this.addressOption = await this.getColumnData(
  840. this.getColumnName(145),
  841. addressOption
  842. );
  843. if (!website.tenantMode) {
  844. this.initData(website.tenantId);
  845. } else {
  846. this.initData();
  847. }
  848. if (this.$store.getters.userInfo.tenant_id === "096359") {
  849. let list = ["profitReturn", "usedProfit", "surplusProfit", "monthProfit"];
  850. for (let item in list) {
  851. for (let i in this.basicData.column) {
  852. if (list[item] == this.basicData.column[i].prop) {
  853. this.basicData.column.splice(i, 1);
  854. }
  855. }
  856. }
  857. }
  858. corpstypeTree({ corpType: customerParameter.code }).then(res => {
  859. this.dic = res.data.data;
  860. });
  861. areaTypeTree().then(res => {
  862. this.dicArea = res.data.data;
  863. });
  864. this.getWorkDicts("packageRemarks").then(res => {
  865. this.packageOptions = res.data.data;
  866. });
  867. this.getWorkDicts("payment_term").then(res => {
  868. this.paymentOption = res.data.data;
  869. });
  870. this.getWorkDicts("account_period").then(res => {
  871. this.settingOption = res.data.data;
  872. });
  873. this.getWorkDicts("month").then(res => {
  874. this.monthOption = res.data.data;
  875. });
  876. this.getWorkDicts("credit_rating").then(res => {
  877. this.creditRatingList = res.data.data;
  878. });
  879. this.getWorkDicts("dominant_route").then(res => {
  880. this.lineList = res.data.data;
  881. });
  882. if (this.$route.query.customerName) {
  883. this.returnButton = true
  884. } else {
  885. this.returnButton = true
  886. }
  887. if (this.detailData.id) {
  888. detail(this.detailData.id).then(res => {
  889. if (res.data.data.adminProfiles) {
  890. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  891. }
  892. if (res.data.data.line){
  893. res.data.data.line = res.data.data.line.split(",")
  894. }
  895. this.form = res.data.data;
  896. this.contactsData = this.form.corpsAttnList;
  897. this.bankOfDepositData = this.form.corpsBankList;
  898. this.advantageProjectData = this.form.corpsItems;
  899. this.addressLatLng = JSON.parse(this.form.addressLatLng);
  900. this.addressData = this.form.corpsAddrList;
  901. this.oldform = this.deepClone(res.data.data);
  902. this.oldcontactsData = this.deepClone(this.form.corpsAttnList);
  903. this.oldbankOfDepositData = this.deepClone(this.form.corpsBankList);
  904. this.oldadvantageProjectData = this.deepClone(this.form.corpsItems);
  905. this.oldaddressLatLng = this.deepClone(JSON.parse(this.form.addressLatLng));
  906. this.oldaddressData = this.deepClone(this.form.corpsAddrList);
  907. if (this.form.belongtoarea) {
  908. this.form.belongtoarea = this.form.belongtoarea
  909. .split(",")
  910. .map(item => item.split("/"));
  911. }
  912. delete this.form.corpsAttnList;
  913. delete this.form.corpsBankList;
  914. delete this.form.corpsItems;
  915. delete this.form.corpsAddrList;
  916. });
  917. } else if (this.detailData.treeDeptId) {
  918. this.$set(this.form, "corpsTypeId", this.detailData.treeDeptId);
  919. if (this.$route.query.customerName) {
  920. this.$set(this.form, "cname", this.$route.query.customerName);
  921. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  922. } else if (this.$route.query) {
  923. this.$set(this.form, "cname", this.$route.query.corpName);
  924. }
  925. } else {
  926. if (this.$route.query.customerName) {
  927. this.$set(this.form, "cname", this.$route.query.customerName);
  928. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  929. } else if (this.$route.query) {
  930. this.$set(this.form, "cname", this.$route.query.corpName);
  931. }
  932. }
  933. gainUser().then(res => {
  934. this.userList = res.data.data;
  935. });
  936. this.getWorkDicts("currency").then(res => {
  937. this.findObject(this.bankOfDeposit.column, "fcyno").dicData =
  938. res.data.data;
  939. });
  940. },
  941. methods: {
  942. initData(tenantId) {
  943. getRoleTree(tenantId).then(res => {
  944. const column = this.findObject(this.optionData.column, "roleId");
  945. column.dicData = res.data.data;
  946. });
  947. getDeptTree(tenantId).then(res => {
  948. const column = this.findObject(this.optionData.column, "deptId");
  949. column.dicData = res.data.data;
  950. });
  951. getPostList(tenantId).then(res => {
  952. const column = this.findObject(this.optionData.column, "postId");
  953. column.dicData = res.data.data;
  954. });
  955. },
  956. addressChange() {
  957. this.addressLatLng = [];
  958. this.form.belongtoarea.forEach(e => {
  959. if (e.length == 1) {
  960. this.dicArea.forEach(item1 => {
  961. if (item1.provinceName == e[0]) {
  962. this.addressLatLng.push({
  963. name: item1.provinceName,
  964. value: this.addressLatLng.length + 1,
  965. lng: item1.lng,
  966. lat: item1.lat,
  967. zoom: 1
  968. });
  969. }
  970. });
  971. } else if (e.length == 3) {
  972. this.dicArea.forEach(item1 => {
  973. if (item1.provinceName == e[0]) {
  974. if (item1.children.length > 0) {
  975. item1.children.forEach(item2 => {
  976. if (item2.cityName == e[1]) {
  977. if (e[0] == e[1]) {
  978. if (item2.children.length > 0) {
  979. item2.children.forEach(item3 => {
  980. if (item3.districtName == e[2]) {
  981. this.addressLatLng.push({
  982. name: item3.districtName,
  983. value: this.addressLatLng.length + 1,
  984. lng: item3.lng,
  985. lat: item3.lat,
  986. zoom: 1
  987. });
  988. }
  989. });
  990. }
  991. } else if (e[0] != e[1]) {
  992. this.addressLatLng.push({
  993. name: item2.cityName,
  994. value: this.addressLatLng.length + 1,
  995. lng: item2.lng,
  996. lat: item2.lat,
  997. zoom: 1
  998. });
  999. }
  1000. }
  1001. });
  1002. }
  1003. }
  1004. });
  1005. }
  1006. });
  1007. this.addressLatLng = this.addressLatLng.filter(
  1008. (currentValue, currentIndex, selfArr) => {
  1009. return (
  1010. selfArr.findIndex(x => x.name === currentValue.name) ===
  1011. currentIndex
  1012. );
  1013. }
  1014. );
  1015. },
  1016. //确认创建用户
  1017. confirmSynchronizationTwo() {
  1018. this.$refs["formDataTwo"].validate((valid, done) => {
  1019. done();
  1020. if (valid) {
  1021. let data = JSON.parse(JSON.stringify(this.formDataTwo));
  1022. data.deptId = data.deptId.join(",");
  1023. data.roleId = data.roleId.join(",");
  1024. data.postId = data.postId.join(",");
  1025. creatingUsers({
  1026. ...data,
  1027. id: this.formRow.id
  1028. }).then(res => {
  1029. this.dialogVisibleBt = false;
  1030. this.$message.success(
  1031. "创建用户成功,默认帐号:手机号。默认密码:123456"
  1032. );
  1033. });
  1034. } else {
  1035. return false;
  1036. }
  1037. });
  1038. },
  1039. aChange(row) {
  1040. console.log(row)
  1041. if (row == '月结') {
  1042. this.financialInformation.column.forEach(e => {
  1043. if (e.prop == 'b') {
  1044. e.hide = true
  1045. }
  1046. if (e.prop == 'c') {
  1047. e.hide = false
  1048. }
  1049. if (e.prop == 'j') {
  1050. e.hide = false
  1051. }
  1052. })
  1053. } else if (row == '业务后') {
  1054. this.financialInformation.column.forEach(e => {
  1055. if (e.prop == 'b') {
  1056. e.hide = false
  1057. }
  1058. if (e.prop == 'c') {
  1059. e.hide = true
  1060. }
  1061. if (e.prop == 'j') {
  1062. e.hide = true
  1063. }
  1064. })
  1065. } else {
  1066. this.financialInformation.column.forEach(e => {
  1067. if (e.prop == 'b') {
  1068. e.hide = true
  1069. }
  1070. if (e.prop == 'c') {
  1071. e.hide = true
  1072. }
  1073. if (e.prop == 'j') {
  1074. e.hide = true
  1075. }
  1076. })
  1077. }
  1078. },
  1079. creatingUsers(row) {
  1080. if (row.id) {
  1081. if (row.tel) {
  1082. this.dialogVisibleBt = true;
  1083. this.formDataTwo = {};
  1084. this.formRow = row;
  1085. } else {
  1086. this.$message.error("请输入手机号");
  1087. }
  1088. } else {
  1089. this.$message.error("请保存数据后再点击");
  1090. }
  1091. },
  1092. //新增客户联系人保存触发
  1093. rowSave(row, done, loading) {
  1094. console.log(row, done, loading);
  1095. this.contactsData.push(row);
  1096. done();
  1097. },
  1098. //修改客户联系人触发
  1099. rowUpdate(row, index, done, loading) {
  1100. done(row);
  1101. },
  1102. //删除客户联系人触发
  1103. rowDel(row, index, donerowDel) {
  1104. this.$confirm("确定将选择数据删除?", {
  1105. confirmButtonText: "确定",
  1106. cancelButtonText: "取消",
  1107. type: "warning"
  1108. }).then(() => {
  1109. // 数据回调进行刷新
  1110. if (row.id) {
  1111. corpsattn(row.id).then(res => {
  1112. this.$message({
  1113. type: "success",
  1114. message: "操作成功!"
  1115. });
  1116. this.contactsData.splice(index, 1);
  1117. });
  1118. } else {
  1119. this.$message({
  1120. type: "success",
  1121. message: "操作成功!"
  1122. });
  1123. this.contactsData.splice(index, 1);
  1124. }
  1125. });
  1126. },
  1127. //新增客户优势项目保存触发
  1128. rowSaveProject(row, done, loading) {
  1129. console.log(row, done, loading);
  1130. this.advantageProjectData.push(row);
  1131. done();
  1132. },
  1133. //修改客户优势项目触发
  1134. rowUpdateProject(row, index, done, loading) {
  1135. done(row);
  1136. },
  1137. //删除客户优势项目触发
  1138. rowDelProject(row, index, donerowDel) {
  1139. this.$confirm("确定将选择数据删除?", {
  1140. confirmButtonText: "确定",
  1141. cancelButtonText: "取消",
  1142. type: "warning"
  1143. }).then(() => {
  1144. if (row.id) {
  1145. corpsitem(row.id).then(res => {
  1146. this.$message({
  1147. type: "success",
  1148. message: "操作成功!"
  1149. });
  1150. this.advantageProjectData.splice(index, 1);
  1151. });
  1152. } else {
  1153. this.$message({
  1154. type: "success",
  1155. message: "操作成功!"
  1156. });
  1157. this.advantageProjectData.splice(index, 1);
  1158. }
  1159. });
  1160. },
  1161. //新增客户优势项目保存触发
  1162. rowSaveBankOfDeposit(row, done, loading) {
  1163. console.log(row, done, loading);
  1164. this.bankOfDepositData.push(row);
  1165. done();
  1166. },
  1167. //修改客户优势项目触发
  1168. rowUpdateBankOfDeposit(row, index, done, loading) {
  1169. done(row);
  1170. },
  1171. //删除客户优势项目触发
  1172. rowDelBankOfDeposit(row, index, donerowDel) {
  1173. this.$confirm("确定将选择数据删除?", {
  1174. confirmButtonText: "确定",
  1175. cancelButtonText: "取消",
  1176. type: "warning"
  1177. }).then(() => {
  1178. if (row.id) {
  1179. corpsbank(row.id).then(res => {
  1180. this.$message({
  1181. type: "success",
  1182. message: "操作成功!"
  1183. });
  1184. this.bankOfDepositData.splice(index, 1);
  1185. });
  1186. } else {
  1187. this.$message({
  1188. type: "success",
  1189. message: "操作成功!"
  1190. });
  1191. this.bankOfDepositData.splice(index, 1);
  1192. }
  1193. });
  1194. },
  1195. //新增收发货地址保存触发
  1196. rowSaveAddress(row, done, loading) {
  1197. this.addressData.push(row);
  1198. done();
  1199. },
  1200. //修改收发货地址优势项目触发
  1201. rowUpdateAddress(row, index, done, loading) {
  1202. done(row);
  1203. },
  1204. //删除收发货地址优势项目触发
  1205. rowDelAddress(row, index, donerowDel) {
  1206. this.$confirm("确定将选择数据删除?", {
  1207. confirmButtonText: "确定",
  1208. cancelButtonText: "取消",
  1209. type: "warning"
  1210. }).then(() => {
  1211. if (row.id) {
  1212. corpsAddrDelete(row.id).then(res => {
  1213. this.$message({
  1214. type: "success",
  1215. message: "操作成功!"
  1216. });
  1217. this.addressData.splice(index, 1);
  1218. });
  1219. } else {
  1220. this.$message({
  1221. type: "success",
  1222. message: "操作成功!"
  1223. });
  1224. this.addressData.splice(index, 1);
  1225. }
  1226. });
  1227. },
  1228. //修改提交触发
  1229. editCustomer(status) {
  1230. this.$refs["form"].validate(valid => {
  1231. if (valid) {
  1232. this.form.corpsAttnList = this.contactsData;
  1233. this.form.corpsBankList = this.bankOfDepositData;
  1234. this.form.corpsItems = this.advantageProjectData;
  1235. this.form.corpsAddrList = this.addressData;
  1236. this.form.addressLatLng = JSON.stringify(this.addressLatLng);
  1237. if (typeof this.form.corpsTypeId == "object") {
  1238. this.form.corpsTypeId = this.form.corpsTypeId.join(",");
  1239. }
  1240. if (typeof this.form.line == "object"){
  1241. this.form.line = this.form.line.join(",")
  1242. }
  1243. this.disabled = true;
  1244. if (this.form.belongtoarea) {
  1245. // this.form.belongtoarea = this.form.belongtoarea.toString();
  1246. this.form.belongtoarea = this.form.belongtoarea
  1247. .map(e => e.join("/"))
  1248. .join(",");
  1249. }
  1250. if (this.form.adminProfiles) {
  1251. this.form.adminProfiles = this.form.adminProfiles.join(",");
  1252. }
  1253. this.form.corpType = customerParameter.code;
  1254. typeSave(this.form).then(res => {
  1255. if (res.data.data === "error") {
  1256. this.disabled = false;
  1257. this.$message({
  1258. showClose: true,
  1259. message: res.data.msg,
  1260. type: "error"
  1261. });
  1262. } else {
  1263. this.$message({
  1264. type: "success",
  1265. message: this.form.id ? "修改成功!" : "新增成功!"
  1266. });
  1267. if (res.data.data.adminProfiles) {
  1268. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  1269. }
  1270. if (res.data.data.line){
  1271. res.data.data.line = res.data.data.line.split(",")
  1272. }
  1273. this.form = res.data.data;
  1274. this.contactsData = res.data.data.corpsAttnList;
  1275. if (this.form.belongtoarea) {
  1276. this.form.belongtoarea = this.form.belongtoarea
  1277. .split(",")
  1278. .map(item => item.split("/"));
  1279. }
  1280. this.disabled = false;
  1281. if (status) {
  1282. this.$emit("goBack", true);
  1283. }
  1284. }
  1285. });
  1286. } else {
  1287. return false;
  1288. }
  1289. });
  1290. },
  1291. synchronization() {
  1292. this.dialogVisible = true;
  1293. },
  1294. async saveColumn() {
  1295. const inSave = await this.saveColumnData(
  1296. this.getColumnName(143),
  1297. this.customerContact
  1298. );
  1299. if (inSave) {
  1300. this.$nextTick(() => {
  1301. this.$refs.crud.doLayout();
  1302. });
  1303. this.$message.success("保存成功");
  1304. //关闭窗口
  1305. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1306. }
  1307. },
  1308. async resetColumn() {
  1309. this.customerContact = customerContact;
  1310. const inSave = await this.delColumnData(
  1311. this.getColumnName(143),
  1312. customerContact
  1313. );
  1314. if (inSave) {
  1315. this.$nextTick(() => {
  1316. this.$refs.crud.doLayout();
  1317. });
  1318. this.$message.success("重置成功");
  1319. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1320. }
  1321. },
  1322. async saveColumn2() {
  1323. const inSave = await this.saveColumnData(
  1324. this.getColumnName(144),
  1325. this.bankOfDeposit
  1326. );
  1327. if (inSave) {
  1328. this.$nextTick(() => {
  1329. this.$refs.crud2.doLayout();
  1330. });
  1331. this.$message.success("保存成功");
  1332. //关闭窗口
  1333. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  1334. }
  1335. },
  1336. async resetColumn2() {
  1337. this.bankOfDeposit = bankOfDeposit;
  1338. const inSave = await this.delColumnData(
  1339. this.getColumnName(144),
  1340. bankOfDeposit
  1341. );
  1342. if (inSave) {
  1343. this.$nextTick(() => {
  1344. this.$refs.crud2.doLayout();
  1345. });
  1346. this.$message.success("重置成功");
  1347. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  1348. }
  1349. },
  1350. async saveColumn3() {
  1351. const inSave = await this.saveColumnData(
  1352. this.getColumnName(145),
  1353. this.addressOption
  1354. );
  1355. if (inSave) {
  1356. this.$nextTick(() => {
  1357. this.$refs.crud3.doLayout();
  1358. });
  1359. this.$message.success("保存成功");
  1360. //关闭窗口
  1361. this.$refs.crud3.$refs.dialogColumn.columnBox = false;
  1362. }
  1363. },
  1364. async resetColumn3() {
  1365. this.addressOption = addressOption;
  1366. const inSave = await this.delColumnData(
  1367. this.getColumnName(145),
  1368. addressOption
  1369. );
  1370. if (inSave) {
  1371. this.$nextTick(() => {
  1372. this.$refs.crud3.doLayout();
  1373. });
  1374. this.$message.success("重置成功");
  1375. this.$refs.crud3.$refs.dialogColumn.columnBox = false;
  1376. }
  1377. },
  1378. //确认同步
  1379. confirmSynchronization() {
  1380. this.$refs["formData"].validate((valid, done) => {
  1381. if (valid) {
  1382. synchronizationCopy({
  1383. ...this.formData,
  1384. id: this.form.id
  1385. }).then(res => {
  1386. done();
  1387. this.$message.success("同步成功");
  1388. this.dialogVisible = false;
  1389. });
  1390. } else {
  1391. return done();
  1392. }
  1393. });
  1394. },
  1395. backToList(value) {
  1396. console.log(value)
  1397. if (value == '0') {
  1398. this.$emit("goBack");
  1399. } else {
  1400. console.log(this.form, this.oldform)
  1401. if (
  1402. contrastObj(this.form, this.oldform) ||
  1403. contrastList(this.contactsData, this.oldcontactsData) ||
  1404. contrastList(this.bankOfDepositData, this.oldbankOfDepositData) ||
  1405. contrastList(this.advantageProjectData, this.oldadvantageProjectData) ||
  1406. contrastList(this.addressLatLng, this.oldaddressLatLng) ||
  1407. contrastList(this.addressData, this.oldaddressData)
  1408. ) {
  1409. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1410. confirmButtonText: "确定",
  1411. cancelButtonText: "取消",
  1412. type: "warning"
  1413. })
  1414. .then(() => {
  1415. this.editCustomer("goBack");
  1416. })
  1417. .catch(() => {
  1418. this.$emit("goBack", true);
  1419. });
  1420. }else{
  1421. this.$emit("goBack", true);
  1422. }
  1423. }
  1424. },
  1425. openFlow() {
  1426. this.switchDialog = !this.switchDialog;
  1427. },
  1428. onClose(val) {
  1429. this.switchDialog = val;
  1430. },
  1431. getCorpName(row) { }
  1432. }
  1433. };
  1434. </script>
  1435. <style lang="scss" scoped>
  1436. ::v-deep .el-form-item {
  1437. margin-bottom: 0;
  1438. }
  1439. ::v-deep .el-form-item__content {
  1440. line-height: 32px;
  1441. }
  1442. </style>