detailsPageEdit.vue 44 KB

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