addContactDialog.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. v-if="visible"
  6. :visible.sync="visible"
  7. :title="title"
  8. :close-on-click-modal="false"
  9. :append-to-body="true"
  10. width="70%"
  11. :maxable="true"
  12. :resizable="true"
  13. @close="cancel"
  14. >
  15. <el-tabs v-model="activeName" type="card" @tab-click="handleActive">
  16. <el-tab-pane label="基本信息" name="1">
  17. <headerTitle title="基本信息" style="margin-top: 30px"></headerTitle>
  18. <el-form
  19. label-width="120px"
  20. ref="form"
  21. class="el-form-box"
  22. :model="form"
  23. :rules="rules"
  24. >
  25. <el-row>
  26. <el-col :span="8">
  27. <el-form-item label="分类" prop="categoryId">
  28. <ele-tree-select
  29. :data="categoryTreeList"
  30. v-model="categoryIdList"
  31. multiple
  32. filterable
  33. :checkStrictly="true"
  34. valueKey="id"
  35. labelKey="name"
  36. placeholder="请选择"
  37. default-expand-all
  38. ref="treeSelect"
  39. />
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="8">
  43. <el-form-item
  44. label="对像类型 "
  45. prop="objectType"
  46. >
  47. <el-select
  48. v-model="form.objectType"
  49. clearable
  50. style="width: 100%"
  51. >
  52. <el-option
  53. :key="1"
  54. label="企业"
  55. :value="1"
  56. >
  57. </el-option>
  58. <el-option
  59. :key="2"
  60. label="个人"
  61. :value="2"
  62. >
  63. </el-option>
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="8">
  68. <el-form-item label="名称" prop="name">
  69. <el-input
  70. placeholder="请输入"
  71. v-model="form.name"
  72. maxlength="50"
  73. @change="nameChange"
  74. ></el-input>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="8">
  78. <el-form-item
  79. :label="form.objectType == 1 ? '统一信用代码' : '身份证号'"
  80. prop="unifiedSocialCreditCode"
  81. >
  82. <el-input
  83. placeholder="请输入"
  84. v-model="form.unifiedSocialCreditCode"
  85. maxlength="18"
  86. @change="unifiedSocialCreditCodeChange"
  87. ></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="8">
  91. <el-form-item label="简称">
  92. <el-input
  93. placeholder="请输入"
  94. v-model="form.simpleName"
  95. maxlength="50"
  96. ></el-input>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="8">
  100. <el-form-item
  101. label="代号"
  102. prop="serialNo"
  103. :rules="{
  104. required: false,
  105. message: '请输入',
  106. trigger: 'change'
  107. }"
  108. >
  109. <el-input
  110. placeholder="请输入"
  111. v-model="form.serialNo"
  112. maxlength="50"
  113. ></el-input>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="8">
  117. <el-form-item label="法定代表人" prop="legalPerson">
  118. <el-input
  119. placeholder="请输入"
  120. v-model="form.legalPerson"
  121. maxlength="50"
  122. ></el-input>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="8">
  126. <el-form-item label="所属行业" prop="industry">
  127. <DictSelection
  128. dictName="所属行业"
  129. clearable
  130. v-model="form.industryCode"
  131. >
  132. </DictSelection>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="8">
  136. <el-form-item label="企业类型" prop="companyCategoryId">
  137. <DictSelection
  138. dictName="营业类型"
  139. clearable
  140. v-model="form.companyCategoryId"
  141. >
  142. </DictSelection>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="8" style="height: 40px;">
  146. <el-form-item label="企业性质" prop="enterpriseTypeId">
  147. <DictSelection
  148. dictName="企业类型"
  149. clearable
  150. v-model="form.enterpriseTypeId"
  151. >
  152. </DictSelection>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="8">
  156. <el-form-item label="上级单位" prop="parentId">
  157. <el-input
  158. placeholder="请选择上级单位"
  159. v-model="form.parentName"
  160. readonly
  161. @click.native="handParent"
  162. ></el-input>
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="8">
  166. <el-form-item label="注册资本" prop="registeredCapital">
  167. <el-input
  168. placeholder="请输入"
  169. v-model="form.registeredCapital"
  170. maxlength="50"
  171. ></el-input>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="8">
  175. <el-form-item label="授信额度" prop="authorizationLimit">
  176. <el-input
  177. placeholder="请输入"
  178. v-model="form.authorizationLimit"
  179. maxlength="17"
  180. oninput="value=value.replace(/[^0-9.]/g,'')"
  181. ></el-input>
  182. </el-form-item>
  183. </el-col>
  184. <el-col :span="8">
  185. <el-form-item label="单位电话" prop="phone">
  186. <el-input
  187. placeholder="请输入"
  188. v-model="form.phone"
  189. maxlength="20"
  190. ></el-input>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="8">
  194. <el-form-item label="成立日期" prop="registerDate">
  195. <el-date-picker
  196. style="width: 100%"
  197. clearable
  198. v-model="form.registerDate"
  199. type="date"
  200. value-format="yyyy-MM-dd"
  201. placeholder="请选择日期"
  202. >
  203. </el-date-picker>
  204. </el-form-item>
  205. </el-col>
  206. <el-col :span="8" style="height: 40px;">
  207. <el-form-item label="级别:">
  208. <DictSelection
  209. dictName="供应商级别"
  210. clearable
  211. v-model="form.level"
  212. >
  213. </DictSelection>
  214. </el-form-item>
  215. </el-col>
  216. <el-col :span="8">
  217. <el-form-item
  218. label="企业规模"
  219. prop="enterpriseScale"
  220. style="height: 36px"
  221. >
  222. <DictSelection
  223. dictName="企业规模"
  224. clearable
  225. v-model="form.enterpriseScale"
  226. >
  227. </DictSelection>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="8">
  231. <el-form-item label="员工人数" prop="staffCount">
  232. <el-input
  233. placeholder="请输入"
  234. v-model="form.staffCount"
  235. maxlength="20"
  236. ></el-input>
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="8">
  240. <el-form-item label="英文名称" prop="englishName">
  241. <el-input
  242. placeholder="请输入"
  243. v-model="form.englishName"
  244. maxlength="20"
  245. ></el-input>
  246. </el-form-item>
  247. </el-col>
  248. <el-col :span="8">
  249. <el-form-item label="纳税人资质" prop="taxpayerQualification">
  250. <DictSelection
  251. dictName="纳税人资质"
  252. clearable
  253. v-model="form.taxpayerQualification"
  254. >
  255. </DictSelection>
  256. </el-form-item>
  257. </el-col>
  258. <el-col :span="8">
  259. <el-form-item label="企业荣誉" prop="enterpriseHonor">
  260. <DictSelection
  261. dictName="企业荣誉"
  262. clearable
  263. v-model="form.enterpriseHonor"
  264. >
  265. </DictSelection>
  266. </el-form-item>
  267. </el-col>
  268. <!-- <el-col :span="8" v-if="form.type != 2">
  269. <el-form-item label="客户审查" prop="qualificationCensorship">
  270. <el-radio v-model="form.qualificationCensorship" label="1"
  271. >启用</el-radio
  272. >
  273. <el-radio v-model="form.qualificationCensorship" label="2"
  274. >不启用</el-radio
  275. >
  276. </el-form-item>
  277. </el-col> -->
  278. <el-col :span="24">
  279. <el-form-item label="注册地址" prop="addressId">
  280. <el-cascader
  281. filterable
  282. clearable
  283. v-model="form.addressId"
  284. :options="options.cityData"
  285. ref="address"
  286. style="width: 35%"
  287. placeholder="请选择省市区/县"
  288. @change="changeAddress1"
  289. ></el-cascader>
  290. <el-input
  291. placeholder="请输入详细地址"
  292. v-model="form.address"
  293. style="width: 65%"
  294. ></el-input>
  295. </el-form-item>
  296. </el-col>
  297. </el-row>
  298. </el-form>
  299. <el-form
  300. label-width="120px"
  301. ref="otherForm"
  302. class="el-form-box"
  303. :model="otherForm"
  304. :rules="otherRules"
  305. >
  306. <el-row>
  307. <el-col :span="24">
  308. <el-form-item label="联系地址" prop="address">
  309. <el-cascader
  310. @change="changeAddress2"
  311. clearable
  312. v-model="otherForm.addressId"
  313. :options="options.cityData"
  314. ref="sendAddress"
  315. style="width: 35%"
  316. placeholder="请选择省市区/县"
  317. ></el-cascader>
  318. <el-input
  319. placeholder="请输入详细地址"
  320. v-model="otherForm.address"
  321. maxlength="50"
  322. style="width: 65%"
  323. ></el-input>
  324. </el-form-item>
  325. </el-col>
  326. <el-col :span="24">
  327. <el-form-item label="主营产品" prop="mainProduct">
  328. <el-input
  329. placeholder="请输入"
  330. v-model="form.mainProduct"
  331. type="textarea"
  332. maxlength="500"
  333. ></el-input>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="24">
  337. <el-form-item label="经营范围" prop="businessScope">
  338. <el-input
  339. type="textarea"
  340. maxlength="500"
  341. placeholder="请输入"
  342. v-model="form.businessScope"
  343. ></el-input>
  344. </el-form-item>
  345. </el-col>
  346. <el-col :span="24">
  347. <el-form-item label="企业简介" prop="enterpriseProfile">
  348. <el-input
  349. placeholder="请输入"
  350. v-model="form.enterpriseProfile"
  351. type="textarea"
  352. maxlength="500"
  353. ></el-input>
  354. </el-form-item>
  355. </el-col>
  356. <el-col :span="24">
  357. <el-form-item label="备注" prop="remark">
  358. <el-input
  359. type="textarea"
  360. resize="none"
  361. v-model="form.remark"
  362. :rows="2"
  363. placeholder="请输入"
  364. size="small"
  365. maxlength="200"
  366. ></el-input>
  367. </el-form-item>
  368. </el-col>
  369. </el-row>
  370. </el-form>
  371. </el-tab-pane>
  372. <el-tab-pane label="银行信息" name="2">
  373. <headerTitle title="银行信息" style="margin-top: 30px"></headerTitle>
  374. <ele-pro-table
  375. ref="table"
  376. :columns="bankColumns"
  377. :datasource="tableBankData"
  378. height="350px"
  379. :toolkit="[]"
  380. class="el-form-box"
  381. :need-page="false"
  382. >
  383. <!-- 表头工具栏 -->
  384. <template v-slot:toolbar>
  385. <el-button type="primary" @click="addBank">添加</el-button>
  386. </template>
  387. <template v-slot:action="{ row, $index }">
  388. <el-link
  389. type="danger"
  390. :underline="false"
  391. icon="el-icon-delete"
  392. @click="handleBankDel(row, $index)"
  393. >删除
  394. </el-link>
  395. </template>
  396. <template v-slot:accountNameHeader="{ column }">
  397. <span>{{ column.label }}</span
  398. ><span style="color: red">*</span>
  399. </template>
  400. <template v-slot:accountName="{ row }">
  401. <el-input
  402. v-model="row.accountName"
  403. placeholder="请输入"
  404. maxlength="50"
  405. ></el-input>
  406. </template>
  407. <template v-slot:accountNo="{ row }">
  408. <el-input
  409. v-model="row.accountNo"
  410. placeholder="请输入"
  411. maxlength="50"
  412. ></el-input>
  413. </template>
  414. <template v-slot:bankName="{ row }">
  415. <el-input
  416. v-model="row.bankName"
  417. placeholder="请输入"
  418. maxlength="50"
  419. ></el-input>
  420. </template>
  421. <template v-slot:interbankNo="{ row }">
  422. <el-input
  423. v-model="row.interbankNo"
  424. placeholder="请输入"
  425. maxlength="50"
  426. ></el-input>
  427. </template>
  428. </ele-pro-table>
  429. </el-tab-pane>
  430. <el-tab-pane label="联系人信息" name="3">
  431. <headerTitle title="联系人信息" style="margin-top: 30px"></headerTitle>
  432. <ele-pro-table
  433. ref="linkTable"
  434. :columns="linkColumns"
  435. :datasource="tableLinkData"
  436. :toolkit="[]"
  437. height="350px"
  438. class="el-form-box"
  439. :need-page="false"
  440. >
  441. <!-- 表头工具栏 -->
  442. <template v-slot:toolbar>
  443. <el-button type="primary" @click="addLink">添加</el-button>
  444. </template>
  445. <template v-slot:action="{ row, $index }">
  446. <el-link
  447. type="danger"
  448. :underline="false"
  449. icon="el-icon-delete"
  450. @click="handleLinkDel(row, $index)"
  451. >删除
  452. </el-link>
  453. </template>
  454. <template v-slot:linkNameHeader="{ column }">
  455. <span>{{ column.label }}</span
  456. ><span style="color: red">*</span>
  457. </template>
  458. <template v-slot:mobilePhoneHeader="{ column }">
  459. <span>{{ column.label }}</span
  460. ><span style="color: red">*</span>
  461. </template>
  462. <template v-slot:statusHeader="{ column }">
  463. <span>{{ column.label }}</span
  464. ><span style="color: red">*</span>
  465. </template>
  466. <template v-slot:linkName="{ row }">
  467. <el-input
  468. v-model="row.linkName"
  469. placeholder="请输入"
  470. maxlength="50"
  471. ></el-input>
  472. </template>
  473. <template v-slot:mobilePhone="{ row }">
  474. <el-input
  475. v-model="row.mobilePhone"
  476. placeholder="请输入"
  477. maxlength="20"
  478. ></el-input>
  479. </template>
  480. <template v-slot:phone="{ row }">
  481. <el-input
  482. v-model="row.phone"
  483. placeholder="请输入"
  484. maxlength="20"
  485. ></el-input>
  486. </template>
  487. <template v-slot:wechat="{ row }">
  488. <el-input
  489. v-model="row.wechat"
  490. placeholder="请输入"
  491. maxlength="50"
  492. ></el-input>
  493. </template>
  494. <template v-slot:email="{ row }">
  495. <el-input
  496. v-model="row.email"
  497. placeholder="请输入"
  498. maxlength="50"
  499. ></el-input>
  500. </template>
  501. <template v-slot:deptName="{ row }">
  502. <el-input
  503. v-model="row.deptName"
  504. placeholder="请输入"
  505. maxlength="50"
  506. ></el-input>
  507. </template>
  508. <template v-slot:post="{ row }">
  509. <el-input
  510. v-model="row.post"
  511. placeholder="请输入"
  512. maxlength="20"
  513. ></el-input>
  514. </template>
  515. <template v-slot:ifChief="{ row, $index }">
  516. <el-select
  517. v-model="row.ifChief"
  518. placeholder="请选择"
  519. class="w100"
  520. @change="
  521. (value) => {
  522. ifChiefChange(value, $index);
  523. }
  524. "
  525. >
  526. <el-option
  527. v-for="item in ifChiefList"
  528. :key="item.value"
  529. :label="item.label"
  530. :value="item.value"
  531. ></el-option>
  532. </el-select>
  533. </template>
  534. <template v-slot:isDefault="{ row, $index }">
  535. <el-select
  536. v-model="row.isDefault"
  537. placeholder="请选择"
  538. class="w100"
  539. >
  540. <el-option
  541. v-for="item in ifChiefList"
  542. :key="item.value"
  543. :label="item.label"
  544. :value="item.value"
  545. ></el-option>
  546. </el-select>
  547. </template>
  548. <template v-slot:status="{ row }">
  549. <DictSelection
  550. dictName="联系人状态"
  551. v-model="row.status"
  552. ></DictSelection>
  553. </template>
  554. <template v-slot:remark="{ row }">
  555. <el-input
  556. v-model="row.remark"
  557. placeholder="请输入"
  558. maxlength="50"
  559. ></el-input>
  560. </template>
  561. </ele-pro-table>
  562. </el-tab-pane>
  563. <!-- <el-tab-pane label="其他信息" :name="4">
  564. <headerTitle title="其他信息" style="margin-top: 30px"></headerTitle>
  565. <el-form
  566. label-width="100px"
  567. ref="otherForm"
  568. :model="otherForm"
  569. :rules="otherRules"
  570. style="margin-top: 30px"
  571. >
  572. <el-row>
  573. <el-col :span="8">
  574. <el-form-item label="结算方式" prop="settlementMode">
  575. <DictSelection
  576. dictName="结算方式"
  577. clearable
  578. @itemChange="settlementModeChange"
  579. v-model="otherForm.settlementMode"
  580. >
  581. </DictSelection>
  582. </el-form-item>
  583. </el-col>
  584. <el-col :span="8">
  585. <el-form-item label="税率">
  586. <el-input
  587. v-model="otherForm.taxRate"
  588. maxlength="5"
  589. oninput="value=value.replace(/[^0-9.]/g,'')"
  590. >
  591. <template slot="append">%</template>
  592. </el-input>
  593. </el-form-item>
  594. </el-col>
  595. <el-col :span="8">
  596. <el-form-item label="折扣率" prop="discount">
  597. <el-input
  598. v-model="otherForm.discount"
  599. maxlength="5"
  600. oninput="value=value.replace(/[^0-9.]/g,'')"
  601. >
  602. <template slot="append">%</template>
  603. </el-input>
  604. </el-form-item>
  605. </el-col>
  606. <el-col :span="8">
  607. <el-form-item label="收件人" prop="sender">
  608. <el-input
  609. placeholder="请输入"
  610. v-model="otherForm.sender"
  611. maxlength="50"
  612. ></el-input>
  613. </el-form-item>
  614. </el-col>
  615. <el-col :span="8">
  616. <el-form-item label="收件人电话" prop="senderPhone">
  617. <el-input
  618. placeholder="请输入"
  619. v-model="otherForm.senderPhone"
  620. maxlength="20"
  621. ></el-input>
  622. </el-form-item>
  623. </el-col>
  624. </el-row>
  625. </el-form>
  626. </el-tab-pane> -->
  627. <el-tab-pane label="证书资质" name="4">
  628. <headerTitle title="证书资质" style="margin-top: 30px"></headerTitle>
  629. <certificateManagement
  630. ref="certificateManagementRef"
  631. ></certificateManagement>
  632. <!-- <ele-pro-table
  633. ref="certificateTable"
  634. :columns="certificateColumns"
  635. :need-page="false"
  636. :datasource="tableCertificateDataList"
  637. :toolkit="[]"
  638. height="350px"
  639. > -->
  640. <!-- 表头工具栏 -->
  641. <!-- <template v-slot:toolbar>
  642. <el-button type="primary" @click="addCertificate('add', '')"
  643. >新增</el-button
  644. >
  645. </template> -->
  646. <!-- 操作栏 -->
  647. <!-- <template v-slot:action="scope">
  648. <el-link
  649. v-if="[1, 2].includes(scope.row.processStatus)"
  650. type="primary"
  651. :underline="false"
  652. icon="el-icon-edit"
  653. @click="addCertificate('view', scope.row, scope.$index)"
  654. >
  655. 详情
  656. </el-link>
  657. <el-link
  658. v-if="[0, 3].includes(scope.row.processStatus)"
  659. type="primary"
  660. :underline="false"
  661. icon="el-icon-edit"
  662. @click="addCertificate('update', scope.row, scope.$index)"
  663. >
  664. 修改
  665. </el-link>
  666. <el-link
  667. v-if="
  668. [0, 3].includes(scope.row.processStatus) &&
  669. form.type == 1 &&
  670. form.qualificationCensorship == '2'
  671. "
  672. type="primary"
  673. :underline="false"
  674. icon="el-icon-plus"
  675. @click="submit(scope.row)"
  676. >
  677. 提交
  678. </el-link>
  679. <el-link
  680. v-if="[0, 3].includes(scope.row.processStatus) && (form.type == 2||form.type == 3)"
  681. type="primary"
  682. :underline="false"
  683. icon="el-icon-plus"
  684. @click="submit(scope.row)"
  685. >
  686. 提交
  687. </el-link>
  688. <el-popconfirm
  689. class="ele-action"
  690. title="确定要删除此资质吗?"
  691. @confirm="handleRemove(scope.row)"
  692. >
  693. <template v-slot:reference>
  694. <el-link
  695. v-if="[0, 3].includes(scope.row.processStatus)"
  696. type="danger"
  697. :underline="false"
  698. icon="el-icon-delete"
  699. >
  700. 删除
  701. </el-link>
  702. </template>
  703. </el-popconfirm>
  704. </template>
  705. </ele-pro-table> -->
  706. </el-tab-pane>
  707. <el-tab-pane :label="getLabel" name="5">
  708. <headerTitle :title="getLabel" style="margin-top: 30px"></headerTitle>
  709. <ele-pro-table
  710. ref="supplyRef"
  711. :columns="supplyColumns"
  712. :need-page="false"
  713. :datasource="supplyList"
  714. :toolkit="[]"
  715. height="350px"
  716. >
  717. <!-- 表头工具栏 -->
  718. <template v-slot:toolbar>
  719. <el-button type="primary" @click="handSelectSupply">新增</el-button>
  720. </template>
  721. <template v-slot:purchasingCycle="scope">
  722. <el-input v-model="scope.row.purchasingCycle" placeholder="请输入">
  723. <template slot="append">天</template>
  724. </el-input>
  725. </template>
  726. <template v-slot:purchaseMultiplier="scope">
  727. <el-input
  728. v-model="scope.row.purchaseMultiplier"
  729. placeholder="请输入"
  730. >
  731. </el-input>
  732. </template>
  733. <template v-slot:minimumOrderQuantity="scope">
  734. <el-input
  735. v-model="scope.row.minimumOrderQuantity"
  736. placeholder="请输入"
  737. >
  738. </el-input>
  739. </template>
  740. <template v-slot:provenance="scope">
  741. <DictSelection
  742. dictName="产地"
  743. clearable
  744. v-model="scope.row.provenance"
  745. multiple
  746. >
  747. </DictSelection>
  748. </template>
  749. <!-- 操作栏 -->
  750. <template v-slot:action="scope">
  751. <el-popconfirm
  752. class="ele-action"
  753. title="确定要删除此产品吗?"
  754. @confirm="handleRemoveSupply(scope.$index)"
  755. >
  756. <template v-slot:reference>
  757. <el-link type="danger" :underline="false" icon="el-icon-delete">
  758. 删除
  759. </el-link>
  760. </template>
  761. </el-popconfirm>
  762. </template>
  763. </ele-pro-table>
  764. </el-tab-pane>
  765. </el-tabs>
  766. <div slot="footer" class="footer">
  767. <el-button
  768. type="primary"
  769. @click="pageChange('up')"
  770. :disabled="activeName == '1'"
  771. >上一步</el-button
  772. >
  773. <el-button
  774. type="primary"
  775. @click="pageChange('next')"
  776. :disabled="activeName == '5'"
  777. >下一步</el-button
  778. >
  779. <el-button type="primary" v-if="form?.id||activeName == '5'" @click="save" v-click-once
  780. >保存</el-button
  781. >
  782. <el-button
  783. type="primary"
  784. v-if="
  785. form.type == 1 &&
  786. activeName == '5' &&
  787. contactApprovalEnabled
  788. "
  789. @click="save('sub')"
  790. v-click-once
  791. >提交</el-button
  792. >
  793. <el-button @click="cancel">返回</el-button>
  794. </div>
  795. <parentList
  796. ref="parentRef"
  797. classType="1"
  798. @changeParent="changeParent"
  799. ></parentList>
  800. <!-- 资质证书弹窗
  801. <certificate-qualifications-dialog
  802. :certificate-qualifications-dialog-flag.sync="
  803. certificateQualificationsDialogFlag
  804. "
  805. v-if="certificateQualificationsDialogFlag"
  806. ref="certificateQualificationsDialogRef"
  807. :contactInfo="form"
  808. :typeInfo="form.type"
  809. @success="tableCertificateDataAdd"
  810. @reload="reloadTableCertificateDataList"
  811. >
  812. </certificate-qualifications-dialog> -->
  813. <process-submit-dialog
  814. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  815. v-if="processSubmitDialogFlag"
  816. ref="processSubmitDialogRef"
  817. @reload="reload"
  818. ></process-submit-dialog>
  819. <product-list
  820. ref="productListRef"
  821. :data="supplyList"
  822. @changeParent="getSupplyList"
  823. ></product-list>
  824. </ele-modal>
  825. </template>
  826. <script>
  827. import {
  828. contactDetail,
  829. contactSave,
  830. contactUpdate,
  831. // contactQcPackDeleteAPI,
  832. // identityphotoList,
  833. // contactQcPackPageAPI,
  834. contactQcPackSaveAPI
  835. } from '@/api/saleManage/contact';
  836. import { categoryData } from 'element-china-category-data';
  837. import fileUpload from '@/components/upload/fileUpload';
  838. import { cityData } from 'ele-admin/packages/utils/regions';
  839. import dictMixins from '@/mixins/dictMixins';
  840. import deptSelect from '@/components/CommomSelect/dept-select.vue';
  841. import personSelect from '@/components/CommomSelect/person-select.vue';
  842. import { listOrganizations } from '@/api/system/organization';
  843. import { copyObj } from '@/utils/util';
  844. import productList from '@/BIZComponents/product-list.vue';
  845. import parentList from './parentList.vue';
  846. // import certificateQualificationsDialog from '@/views/purchasingManage/supplierManage/components/certificateQualificationsDialog.vue';
  847. import certificateQualificationsDialog from './certificateQualificationsDialog.vue';
  848. import { reviewStatus, lbjtList } from '@/enum/dict';
  849. import { deepClone } from '@/utils';
  850. import searchTable from '@/views/saleManage/saleOrder/components/searchTable.vue';
  851. // import fileMain from '@/components/addDoc/index.vue';
  852. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  853. import certificateManagement from '@/views/saleManage/contact/components/certificateManagement/index.vue';
  854. import { parameterGetByCode } from '@/api/main/index.js';
  855. import { saveOrEdit } from '@/api/saleManage/contact';
  856. export default {
  857. props: {
  858. categoryTreeList: Array
  859. },
  860. mixins: [dictMixins],
  861. components: {
  862. processSubmitDialog,
  863. // fileMain,
  864. searchTable,
  865. certificateQualificationsDialog,
  866. fileUpload,
  867. deptSelect,
  868. personSelect,
  869. parentList,
  870. productList,
  871. certificateManagement
  872. },
  873. data() {
  874. let formDef = {
  875. objectType: 1,
  876. address: '',
  877. addressId: '',
  878. addressName: '',
  879. authorizationLimit: 0,
  880. businessLicenseFiles: [],
  881. businessLicenseFile: [],
  882. businessScope: '',
  883. categoryId: '',
  884. companyCategoryId: '',
  885. companyCategoryName: '',
  886. enterpriseTypeId: '',
  887. enterpriseTypeName: '',
  888. legalPerson: '',
  889. registeredCapital: '',
  890. parentId: '',
  891. industry: '',
  892. industryCode: '',
  893. industryFullName: '',
  894. mainProduct: '',
  895. name: '',
  896. officialIndustry: '',
  897. phone: '',
  898. registerDate: '',
  899. remark: '',
  900. serialNo: '',
  901. simpleName: '',
  902. type: 1,
  903. unifiedSocialCreditCode: '',
  904. enterpriseHonor: '',
  905. enterpriseScale: '',
  906. staffCount: '',
  907. enterpriseProfile: '',
  908. englishName: '',
  909. taxpayerQualification: '',
  910. qualificationCensorship: '2'
  911. };
  912. let otherFormDef = {
  913. settlementMode: '',
  914. settlementModeName: '',
  915. taxRate: 0,
  916. address: '',
  917. addressId: '',
  918. deptId: '',
  919. deptName: '',
  920. discount: 0,
  921. salesmanId: '',
  922. salesmanName: '',
  923. sender: '',
  924. senderPhone: ''
  925. };
  926. return {
  927. enableStatus: '2',
  928. contactApprovalEnabled: false,
  929. fullscreen: false,
  930. visible: false,
  931. certificateQualificationsDialogFlag: false,
  932. processSubmitDialogFlag: false,
  933. title: '',
  934. row: {},
  935. activeName: '1',
  936. formDef,
  937. editVersion: null,
  938. supplyList: [],
  939. otherFormDef,
  940. form: copyObj(formDef),
  941. otherForm: copyObj(otherFormDef),
  942. // removeBankList: [],
  943. // removeLinkList: [],
  944. tableBankData: [],
  945. tableLinkData: [],
  946. categoryIdList: [],
  947. dictList: {},
  948. ifChiefList: [
  949. {
  950. value: 0,
  951. label: '否'
  952. },
  953. {
  954. value: 1,
  955. label: '是'
  956. }
  957. ],
  958. bankColumns: [
  959. {
  960. type: 'index',
  961. width: 55,
  962. align: 'center'
  963. },
  964. {
  965. label: '单位名称',
  966. prop: 'accountName',
  967. slot: 'accountName',
  968. action: 'accountName',
  969. headerSlot: 'accountNameHeader',
  970. align: 'center'
  971. },
  972. {
  973. label: '银行账号',
  974. prop: 'accountNo',
  975. slot: 'accountNo',
  976. action: 'accountNo',
  977. align: 'center'
  978. },
  979. {
  980. label: '开户行',
  981. prop: 'bankName',
  982. slot: 'bankName',
  983. action: 'bankName',
  984. align: 'center'
  985. },
  986. {
  987. label: '银行银联号',
  988. prop: 'interbankNo',
  989. slot: 'interbankNo',
  990. action: 'interbankNo',
  991. align: 'center'
  992. },
  993. {
  994. action: 'action',
  995. slot: 'action',
  996. label: '操作',
  997. align: 'center'
  998. }
  999. ],
  1000. certificateColumns: [
  1001. {
  1002. type: 'index',
  1003. width: 55,
  1004. align: 'center'
  1005. },
  1006. {
  1007. label: '编码',
  1008. prop: 'code',
  1009. slot: 'code',
  1010. align: 'center',
  1011. minWidth: 120
  1012. },
  1013. {
  1014. label: '名称',
  1015. prop: 'name',
  1016. slot: 'name',
  1017. align: 'center',
  1018. minWidth: 120
  1019. },
  1020. {
  1021. label: '创建时间',
  1022. prop: 'createTime',
  1023. slot: 'createTime',
  1024. align: 'center',
  1025. minWidth: 120
  1026. },
  1027. {
  1028. label: '状态',
  1029. prop: 'processStatus',
  1030. slot: 'processStatus',
  1031. align: 'center',
  1032. width: 120,
  1033. formatter: (_row, _column, cellValue) => {
  1034. return reviewStatus[_row.processStatus];
  1035. }
  1036. },
  1037. {
  1038. label: '备注',
  1039. prop: 'remark',
  1040. slot: 'remark',
  1041. align: 'center',
  1042. minWidth: 120
  1043. },
  1044. {
  1045. action: 'action',
  1046. slot: 'action',
  1047. label: '操作',
  1048. align: 'center',
  1049. width: 200
  1050. }
  1051. ],
  1052. otherRules: {
  1053. // settlementMode: [
  1054. // { required: true, message: '请输入结算方式', trigger: 'blur' }
  1055. // ],
  1056. address: [
  1057. { required: false, message: '请选择地址', trigger: 'change' }
  1058. ]
  1059. },
  1060. options: {
  1061. cityData,
  1062. categoryData
  1063. },
  1064. // 提交状态
  1065. loading: false,
  1066. // 是否是修改
  1067. isUpdate: false,
  1068. // 组织机构树形结构数据
  1069. groupTreeData: [],
  1070. // 组织机构平铺数据
  1071. groupData: [],
  1072. parentShow: false,
  1073. tableCertificateDataList: []
  1074. };
  1075. },
  1076. computed: {
  1077. rules() {
  1078. return {
  1079. categoryId: [
  1080. { required: true, message: '请选择分类', trigger: 'change' }
  1081. ],
  1082. name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
  1083. unifiedSocialCreditCode: [
  1084. {
  1085. required: this.form.objectType == 1 ? true : false,
  1086. message: '请输入统一社会信用代码',
  1087. trigger: 'blur'
  1088. }
  1089. ],
  1090. authorizationLimit: [
  1091. { required: true, message: '请输入授信额度', trigger: 'blur' }
  1092. ],
  1093. // addressId: [
  1094. // { required: true, message: '请选择地址', trigger: 'change' }
  1095. // ],
  1096. // qualificationCensorship: [
  1097. // { required: true, message: '请选择', trigger: 'change' }
  1098. // ]
  1099. }
  1100. },
  1101. clientEnvironmentId() {
  1102. return this.$store.state.user.info.clientEnvironmentId;
  1103. },
  1104. linkColumns() {
  1105. return [
  1106. {
  1107. type: 'index',
  1108. width: 55,
  1109. align: 'center'
  1110. },
  1111. {
  1112. label: '姓名',
  1113. prop: 'linkName',
  1114. slot: 'linkName',
  1115. action: 'linkName',
  1116. headerSlot: 'linkNameHeader',
  1117. align: 'center'
  1118. },
  1119. {
  1120. label: '手机',
  1121. prop: 'mobilePhone',
  1122. slot: 'mobilePhone',
  1123. action: 'mobilePhone',
  1124. // headerSlot: 'mobilePhoneHeader',
  1125. align: 'center'
  1126. },
  1127. {
  1128. label: '电话',
  1129. prop: 'phone',
  1130. slot: 'phone',
  1131. action: 'phone',
  1132. align: 'center'
  1133. },
  1134. {
  1135. label: '微信号',
  1136. prop: 'wechat',
  1137. slot: 'wechat',
  1138. action: 'wechat',
  1139. align: 'center'
  1140. },
  1141. {
  1142. label: '邮箱',
  1143. prop: 'email',
  1144. slot: 'email',
  1145. action: 'email',
  1146. align: 'center'
  1147. },
  1148. {
  1149. label: '部门',
  1150. prop: 'deptName',
  1151. slot: 'deptName',
  1152. action: 'deptName',
  1153. align: 'center'
  1154. },
  1155. {
  1156. label: '职务',
  1157. prop: 'post',
  1158. slot: 'post',
  1159. action: 'post',
  1160. align: 'center'
  1161. },
  1162. {
  1163. label: '状态',
  1164. prop: 'status',
  1165. slot: 'status',
  1166. action: 'status',
  1167. headerSlot: 'statusHeader',
  1168. align: 'center'
  1169. },
  1170. {
  1171. label: '是否首要',
  1172. prop: 'ifChief',
  1173. slot: 'ifChief',
  1174. action: 'ifChief',
  1175. align: 'center'
  1176. },
  1177. {
  1178. label: `是否默认${this.form.type == 1 ? '收件' : '寄件'}人`,
  1179. prop: 'isDefault',
  1180. slot: 'isDefault',
  1181. align: 'center'
  1182. },
  1183. {
  1184. label: '备注',
  1185. prop: 'remark',
  1186. slot: 'remark',
  1187. action: 'remark',
  1188. align: 'center'
  1189. },
  1190. {
  1191. action: 'action',
  1192. slot: 'action',
  1193. label: '操作',
  1194. align: 'center'
  1195. }
  1196. ];
  1197. },
  1198. getLabel() {
  1199. return this.categoryIdList
  1200. .map((item) => {
  1201. let data = this.$refs?.treeSelect?.getNodeByValue(item);
  1202. return data?.rootCategoryLevelId;
  1203. })
  1204. .includes('20250317001')
  1205. ? '生产列表'
  1206. : '供货列表';
  1207. },
  1208. supplyColumns() {
  1209. return [
  1210. {
  1211. columnKey: 'index',
  1212. type: 'index',
  1213. width: 50,
  1214. align: 'center',
  1215. showOverflowTooltip: true,
  1216. label: '序号'
  1217. },
  1218. {
  1219. prop: 'productCode',
  1220. label: '编码',
  1221. align: 'center',
  1222. showOverflowTooltip: true,
  1223. minWidth: 110
  1224. },
  1225. {
  1226. prop: 'productName',
  1227. label: '名称',
  1228. align: 'center',
  1229. showOverflowTooltip: true,
  1230. minWidth: 110
  1231. },
  1232. {
  1233. prop: 'purchasingCycle',
  1234. label: '采购周期',
  1235. align: 'center',
  1236. slot: 'purchasingCycle',
  1237. showOverflowTooltip: true,
  1238. minWidth: 150
  1239. },
  1240. {
  1241. prop: 'purchaseMultiplier',
  1242. label: '倍数',
  1243. slot: 'purchaseMultiplier',
  1244. align: 'center',
  1245. showOverflowTooltip: true,
  1246. minWidth: 100
  1247. },
  1248. {
  1249. prop: 'minimumOrderQuantity',
  1250. label: '最低订购数量',
  1251. slot: 'minimumOrderQuantity',
  1252. align: 'center',
  1253. showOverflowTooltip: true,
  1254. minWidth: 150
  1255. },
  1256. {
  1257. prop: 'provenance',
  1258. label: '产地',
  1259. slot: 'provenance',
  1260. align: 'center',
  1261. showOverflowTooltip: true,
  1262. minWidth: 200
  1263. },
  1264. {
  1265. prop: 'manufacturer',
  1266. label: '生产厂家',
  1267. slot: 'manufacturer',
  1268. align: 'center',
  1269. showOverflowTooltip: true,
  1270. minWidth: 200,
  1271. show: this.getLabel == '供货列表'
  1272. },
  1273. {
  1274. prop: 'imgCode',
  1275. align: 'center',
  1276. label: '图号/件号',
  1277. showOverflowTooltip: true,
  1278. minWidth: 110
  1279. },
  1280. {
  1281. prop: 'produceType',
  1282. align: 'center',
  1283. label: '属性类型',
  1284. showOverflowTooltip: true,
  1285. minWidth: 110,
  1286. formatter: (row, column) => {
  1287. if (row.produceType) {
  1288. return row.produceType
  1289. .map((item) => {
  1290. return lbjtList[item];
  1291. })
  1292. .toString();
  1293. }
  1294. }
  1295. },
  1296. {
  1297. prop: 'packingSpecification',
  1298. align: 'center',
  1299. label: '包装规格',
  1300. showOverflowTooltip: true,
  1301. minWidth: 110
  1302. },
  1303. {
  1304. prop: 'brandNum',
  1305. align: 'center',
  1306. label: '牌号',
  1307. showOverflowTooltip: true
  1308. },
  1309. {
  1310. prop: 'modelType',
  1311. label: '型号',
  1312. align: 'center',
  1313. showOverflowTooltip: true
  1314. },
  1315. {
  1316. prop: 'specification',
  1317. label: '规格',
  1318. align: 'center',
  1319. showOverflowTooltip: true
  1320. },
  1321. {
  1322. prop: 'measuringUnit',
  1323. label: '计量单位',
  1324. showOverflowTooltip: true,
  1325. align: 'center',
  1326. minWidth: 90
  1327. },
  1328. {
  1329. prop: 'createTime',
  1330. label: '创建时间',
  1331. showOverflowTooltip: true,
  1332. align: 'center',
  1333. minWidth: 160
  1334. },
  1335. {
  1336. slot: 'action',
  1337. align: 'center',
  1338. minWidth: 90,
  1339. fixed: 'right',
  1340. label: '操作'
  1341. }
  1342. ];
  1343. }
  1344. },
  1345. watch: {
  1346. categoryIdList(val) {
  1347. if (val.length > 0) {
  1348. this.$refs.form?.clearValidate('categoryId');
  1349. this.form.categoryId = this.categoryIdList.join(',');
  1350. } else {
  1351. this.form.categoryId = '';
  1352. this.$refs.form?.validateField('categoryId');
  1353. }
  1354. }
  1355. },
  1356. created() {
  1357. this.getGroupAll();
  1358. this.requestDict('生产类型');
  1359. parameterGetByCode({ code: 'contact_is_approval' }).then((res) => {
  1360. this.contactApprovalEnabled = String(res.value) === '1';
  1361. });
  1362. },
  1363. methods: {
  1364. async open(type, row, contactCategoryId, pageType) {
  1365. this.resetForm()
  1366. this.editVersion = null;
  1367. // return
  1368. this.form.type = pageType || 1;
  1369. this.title = type;
  1370. this.row = row;
  1371. this.visible = true;
  1372. if (!row.id) {
  1373. console.log('新增', this.form);
  1374. this.isUpdate = false;
  1375. // 默认带出列表页面选中的分类
  1376. this.$nextTick(() => {
  1377. this.categoryIdList = contactCategoryId ? [contactCategoryId] : [];
  1378. // 客户审查 //2不启用 1启用
  1379. parameterGetByCode({
  1380. code: 'eom_saleManage_contact_qualificationCensorship'
  1381. }).then((res) => {
  1382. console.log('客户审查', res)
  1383. this.form.qualificationCensorship = res.value;
  1384. this.enableStatus = res.value
  1385. });
  1386. this.$refs.certificateManagementRef &&
  1387. this.$refs.certificateManagementRef.init(
  1388. this.form.type != 1
  1389. ? this.getLabel == '供货列表'
  1390. ? '3'
  1391. : '6'
  1392. : '4',
  1393. this.form.id,
  1394. this.form.name,
  1395. true
  1396. );
  1397. });
  1398. } else {
  1399. this.isUpdate = true;
  1400. await this._getById(row.id);
  1401. }
  1402. },
  1403. handleActive(val) {
  1404. console.log(val);
  1405. },
  1406. nameChange() {
  1407. this.tableBankData.forEach((item) => {
  1408. item.accountName = this.form.name;
  1409. });
  1410. },
  1411. // 获取公司数据
  1412. getGroupAll() {
  1413. listOrganizations().then((list) => {
  1414. this.groupData = list;
  1415. this.groupTreeData = this.$util.toTreeData({
  1416. data: list,
  1417. idField: 'id',
  1418. parentIdField: 'parentId'
  1419. });
  1420. });
  1421. },
  1422. // //新增/查看/修改资质
  1423. // addCertificate(type, row, index) {
  1424. // this.certificateQualificationsDialogFlag = true;
  1425. // this.$nextTick(() => {
  1426. // console.log(index);
  1427. // this.$refs.certificateQualificationsDialogRef.init(type, row, index);
  1428. // });
  1429. // },
  1430. // /* 证书资质表格数据源 */
  1431. // tableCertificateData() {
  1432. // contactQcPackPageAPI({
  1433. // certificationType: this.form.type,
  1434. // relationId: this.form.id
  1435. // }).then((res) => {
  1436. // this.tableCertificateDataList = res;
  1437. // });
  1438. // },
  1439. // tableCertificateDataAdd({ form = {}, index = '' }) {
  1440. // if (this.form.id) {
  1441. // this.tableCertificateData();
  1442. // } else {
  1443. // if (index + '') {
  1444. // this.$set(this.tableCertificateDataList, index, form);
  1445. // } else {
  1446. // this.tableCertificateDataList.push(form);
  1447. // }
  1448. // }
  1449. // },
  1450. // //删除资质包
  1451. // handleRemove(row) {
  1452. // contactQcPackDeleteAPI([row.id]).then((res) => {
  1453. // this.$message.success('删除成功!');
  1454. // this.tableCertificateDataAdd({});
  1455. // });
  1456. // },
  1457. //开启提交流程
  1458. async contactSubmit(row) {
  1459. const { base } = await contactDetail(this.form.id || row);
  1460. this.processSubmitDialogFlag = true;
  1461. this.$nextTick(() => {
  1462. let params = {
  1463. businessId: base.id,
  1464. businessKey: 'contact_approve',
  1465. formCreateUserId: base.createUserId,
  1466. variables: {
  1467. certificationType: 1,
  1468. businessCode: base.code,
  1469. businessName: base.name,
  1470. businessType: '客户审核'
  1471. }
  1472. };
  1473. this.$refs.processSubmitDialogRef.init(params);
  1474. });
  1475. },
  1476. //开启资质提交流程
  1477. async submit(row) {
  1478. this.processSubmitDialogFlag = true;
  1479. this.$nextTick(() => {
  1480. let params = {
  1481. businessId: row.id,
  1482. businessKey: 'contact_qc_approve',
  1483. formCreateUserId: row.createUserId,
  1484. variables: {
  1485. certificationType: this.form.type,
  1486. businessName: row.name
  1487. }
  1488. };
  1489. this.$refs.processSubmitDialogRef.init(params);
  1490. });
  1491. },
  1492. //获取代号
  1493. unifiedSocialCreditCodeChange(val) {
  1494. this.form.serialNo = this.form.serialNo || val.slice(-4);
  1495. },
  1496. // 选择负责人部门
  1497. change_principalDep(id) {
  1498. const info = this.groupData.find((e) => e.id == id);
  1499. this.otherForm.deptName = info.name;
  1500. this.otherForm.salesmanId = '';
  1501. this.otherForm.salesmanName = '';
  1502. // 根据部门获取人员
  1503. const params = { groupId: id };
  1504. this.$nextTick(() => {
  1505. this.$refs.directorRef.getList(params);
  1506. });
  1507. },
  1508. salesmanChange(val, info) {
  1509. this.otherForm.salesmanName = info.name;
  1510. },
  1511. settlementModeChange(info) {
  1512. this.otherForm.settlementModeName = info.dictValue;
  1513. },
  1514. ifChiefChange(value, idx) {
  1515. if (value === 1) {
  1516. this.tableLinkData.forEach((e) => (e.ifChief = 0));
  1517. this.tableLinkData[idx].ifChief = 1;
  1518. }
  1519. },
  1520. addBank() {
  1521. this.tableBankData.push({
  1522. accountName: this.form.name,
  1523. accountNo: '',
  1524. bankName: '',
  1525. interbankNo: ''
  1526. });
  1527. },
  1528. addLink() {
  1529. this.tableLinkData.push({
  1530. linkName: '',
  1531. mobilePhone: '',
  1532. phone: '',
  1533. email: '',
  1534. post: '',
  1535. status: '1',
  1536. ifChief: 0,
  1537. remark: ''
  1538. });
  1539. },
  1540. handleBankDel(row, index) {
  1541. this.tableBankData.splice(index, 1);
  1542. if (row?.id) {
  1543. // this.removeBankList.push(row.id);
  1544. }
  1545. },
  1546. handleLinkDel(row, index) {
  1547. this.tableLinkData.splice(index, 1);
  1548. if (row?.id) {
  1549. // this.removeLinkList.push(row.id);
  1550. }
  1551. },
  1552. formValid() {
  1553. return new Promise((resolve, reject) => {
  1554. this.$refs.form.validate((valid) => {
  1555. if (!valid) {
  1556. this.activeName = '1';
  1557. reject(false);
  1558. } else {
  1559. resolve(true);
  1560. }
  1561. });
  1562. });
  1563. },
  1564. otherFormValid() {
  1565. return new Promise((resolve, reject) => {
  1566. this.$refs.otherForm.validate((valid) => {
  1567. console.log(valid, 'valid');
  1568. if (!valid) {
  1569. this.activeName = '1';
  1570. reject(false);
  1571. } else {
  1572. resolve(true);
  1573. }
  1574. });
  1575. });
  1576. },
  1577. tableLinkDataValid() {
  1578. return new Promise((resolve, reject) => {
  1579. if (this.tableLinkData.length == 0) {
  1580. this.activeName = '3';
  1581. this.$message.error('联系人信息至少有1条');
  1582. reject(false);
  1583. } else {
  1584. resolve(true);
  1585. }
  1586. });
  1587. },
  1588. getValidate() {
  1589. return Promise.all([
  1590. this.formValid(),
  1591. this.otherFormValid(),
  1592. this.tableLinkDataValid()
  1593. ]);
  1594. },
  1595. async pageChange(type) {
  1596. if (type == 'up') {
  1597. this.activeName = (parseInt(this.activeName) - 1).toString();
  1598. }
  1599. if (type == 'next') {
  1600. if (this.activeName == '1' && !(await this.formValid())) {
  1601. return;
  1602. }
  1603. if (this.activeName == '3' && !(await this.tableLinkDataValid())) {
  1604. this.$message.error('联系人信息至少有1条');
  1605. return;
  1606. }
  1607. // if (this.activeName == 4 && !(await this.otherFormValid())) {
  1608. // return;
  1609. // }
  1610. this.activeName = (parseInt(this.activeName) + 1).toString();
  1611. }
  1612. },
  1613. async save(type = '') {
  1614. try {
  1615. await this.getValidate();
  1616. // 表单验证通过,执行保存操作
  1617. this.loading = true;
  1618. // 基本信息处理
  1619. if (this.$refs.address.getCheckedNodes()) {
  1620. let node = this.$refs.address.getCheckedNodes()[0];
  1621. if (node) {
  1622. this.form.addressId = node.path.join();
  1623. this.form.addressName = node.pathLabels.join();
  1624. } else {
  1625. this.form.addressId = '';
  1626. this.form.addressName = '';
  1627. }
  1628. }
  1629. this.form.categoryId = this.categoryIdList.join(',');
  1630. if (this.form.companyCategoryId) {
  1631. this.form.companyCategoryName = this.getDictValue(
  1632. '营业类型',
  1633. this.form.companyCategoryId
  1634. );
  1635. }
  1636. if (this.form.industryCode) {
  1637. this.form.industryFullName = this.getDictValue(
  1638. '所属行业',
  1639. this.form.industryCode
  1640. );
  1641. }
  1642. if (this.form.enterpriseTypeId) {
  1643. this.form.enterpriseTypeName = this.getDictValue(
  1644. '企业类型',
  1645. this.form.enterpriseTypeId
  1646. );
  1647. }
  1648. // if (
  1649. // this.form.businessLicenseFiles &&
  1650. // this.form.businessLicenseFiles.length > 0
  1651. // ) {
  1652. // this.form.businessLicenseFile = this.form.businessLicenseFiles[0];
  1653. // } else {
  1654. // this.form.businessLicenseFile = null;
  1655. // }
  1656. // 其他信息处理
  1657. if (this.form.settlementMode) {
  1658. this.form.settlementModeName = this.getDictValue(
  1659. '结算方式',
  1660. this.form.settlementMode
  1661. );
  1662. }
  1663. if (this.$refs.sendAddress.getCheckedNodes()) {
  1664. let node = this.$refs.sendAddress.getCheckedNodes()[0];
  1665. if (node) {
  1666. this.otherForm.addressId = node.path.join();
  1667. this.otherForm.addressName = node.pathLabels.join();
  1668. } else {
  1669. this.otherForm.addressId = '';
  1670. this.otherForm.addressName = '';
  1671. }
  1672. }
  1673. if (!this.isUpdate) {
  1674. delete this.form.id;
  1675. } else {
  1676. // this.form.removeBankList = this.removeBankList;
  1677. // this.form.removeLinkList = this.removeLinkList;
  1678. }
  1679. this.form.type =
  1680. this.form.type != 1 ? (this.getLabel == '供货列表' ? '2' : '3') : 1;
  1681. console.log(this.form, 'this.form~~~~~~~~');
  1682. const data = {
  1683. base: this.isUpdate ? { ...this.form, version: this.editVersion } : this.form,
  1684. other: this.otherForm,
  1685. bankList: this.tableBankData,
  1686. linkList: this.tableLinkData,
  1687. productList: this.supplyList
  1688. };
  1689. this.tableCertificateDataList = this.$refs.certificateManagementRef.getTableValue();
  1690. if (this.isUpdate) {
  1691. if (this.editVersion == null) {
  1692. this.loading = false;
  1693. this.$message.error('客户版本缺失,请刷新后重试');
  1694. return;
  1695. }
  1696. contactUpdate(data)
  1697. .then((res) => {
  1698. this.loading = false;
  1699. this.$message.success('修改成功');
  1700. if (type == 'sub') {
  1701. this.contactSubmit(res);
  1702. return;
  1703. }
  1704. this.cancel();
  1705. this.$emit('done');
  1706. })
  1707. .catch((e) => {
  1708. //this.loading = false;
  1709. });
  1710. } else {
  1711. contactSave(data)
  1712. .then((id) => {
  1713. this.loading = false;
  1714. this.$message.success('新增成功');
  1715. this.tableCertificateDataList.forEach((item) => {
  1716. item['holderId'] = id;
  1717. item['holder'] = this.form.name;
  1718. saveOrEdit(item);
  1719. });
  1720. if (type == 'sub') {
  1721. this.contactSubmit(id);
  1722. return;
  1723. }
  1724. this.cancel();
  1725. this._getById(id);
  1726. this.title = '编辑';
  1727. this.$emit('done');
  1728. this.isUpdate = true;
  1729. })
  1730. .catch((e) => {
  1731. //this.loading = false;
  1732. });
  1733. }
  1734. } catch (error) {
  1735. console.log(error);
  1736. // 表单验证未通过,不执行保存操作
  1737. }
  1738. },
  1739. reload() {
  1740. this.cancel();
  1741. this.$emit('done');
  1742. },
  1743. cancel() {
  1744. this.$nextTick(() => {
  1745. this.activeName = '1';
  1746. // 关闭后,销毁所有的表单数据
  1747. this.resetForm()
  1748. this.visible = false;
  1749. });
  1750. },
  1751. resetForm() {
  1752. this.$set(this, 'form', copyObj(this.formDef));
  1753. this.$set(this, 'otherForm', copyObj(this.otherFormDef));
  1754. this.$set(this, 'tableBankData', []);
  1755. this.$set(this, 'tableLinkData', []);
  1756. this.$set(this, 'categoryIdList', []);
  1757. this.$set(this, 'tableCertificateDataList', []);
  1758. this.$set(this, 'supplyList', []);
  1759. // this.form = copyObj(this.formDef);
  1760. // this.otherForm = copyObj(this.otherFormDef);
  1761. // this.tableBankData = [];
  1762. // this.tableLinkData = [];
  1763. // this.categoryIdList = [];
  1764. // this.tableCertificateDataList = [];
  1765. this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
  1766. this.$refs['form'] && this.$refs['form'].resetFields();
  1767. },
  1768. async _getById(id) {
  1769. const data = await contactDetail(id);
  1770. this.form = data.base;
  1771. this.editVersion = data.base.version;
  1772. this.otherForm = data.other;
  1773. this.tableBankData = data.bankList;
  1774. this.tableLinkData = data.linkList;
  1775. this.supplyList = data.productList || [];
  1776. // this.tableCertificateDataAdd({});
  1777. this.form.qualificationCensorship =
  1778. this.form.qualificationCensorship || this.enableStatus || '2';
  1779. // if (data.base.businessLicenseFile && data.base.businessLicenseFile.uid) {
  1780. // this.$set(this.form, 'businessLicenseFiles', [
  1781. // data.base.businessLicenseFile
  1782. // ]);
  1783. // }
  1784. this.categoryIdList = this.form.categoryId
  1785. ? deepClone(this.form.categoryId.split(','))
  1786. : [];
  1787. this.$nextTick(() => {
  1788. this.$refs.certificateManagementRef &&
  1789. this.$refs.certificateManagementRef.init(
  1790. this.form.type != 1
  1791. ? this.getLabel == '供货列表'
  1792. ? '3'
  1793. : '6'
  1794. : '4',
  1795. this.form.id,
  1796. this.form.name
  1797. );
  1798. });
  1799. if (this.tableLinkData && this.tableLinkData.length > 0) {
  1800. this.tableLinkData.forEach((e) => (e.status = e.status + ''));
  1801. }
  1802. if (this.otherForm.settlementMode) {
  1803. this.otherForm.settlementMode = this.otherForm.settlementMode + '';
  1804. }
  1805. if (this.form.level) {
  1806. this.form.level = this.form.level + '';
  1807. }
  1808. // 回显地址选择器
  1809. if (this.form.addressId && this.form.addressId.length > 0) {
  1810. this.form.addressId = this.form.addressId.split(',');
  1811. }
  1812. if (this.otherForm.addressId && this.otherForm.addressId.length > 0) {
  1813. this.otherForm.addressId = this.otherForm.addressId.split(',');
  1814. }
  1815. if (this.otherForm.deptId) {
  1816. // 编辑时,默认查询组织相关的用户列表,用于回显
  1817. this.$nextTick(async () => {
  1818. await this.$refs.directorRef.getList({
  1819. groupId: this.otherForm.deptId
  1820. });
  1821. });
  1822. }
  1823. },
  1824. //选择产品
  1825. handSelectSupply() {
  1826. this.$refs.productListRef.open(this.supplyList, -1);
  1827. },
  1828. getSupplyList(obj) {
  1829. obj.forEach((item, index) => {
  1830. let params = {};
  1831. this.$set(params, 'contactId', this.row.id);
  1832. this.$set(params, 'productId', item.id);
  1833. this.$set(params, 'categoryName', item.name);
  1834. this.$set(params, 'productCategoryId', item.categoryLevelId);
  1835. this.$set(params, 'productBrand', item.brandNum);
  1836. this.$set(params, 'productCategoryName', item.categoryLevelPath);
  1837. this.$set(params, 'productCode', item.code);
  1838. this.$set(params, 'productName', item.name);
  1839. this.$set(params, 'modelType', item.modelType);
  1840. this.$set(params, 'availableCountBase', item.availableCountBase);
  1841. this.$set(params, 'measuringUnit', item.measuringUnit);
  1842. this.$set(params, 'specification', item.specification);
  1843. this.$set(params, 'weightUnit', item.weightUnit);
  1844. this.$set(params, 'imgCode', item.imgCode);
  1845. this.$set(params, 'produceType', item.componentAttribute);
  1846. this.$set(params, 'approvalNumber', item.approvalNumber);
  1847. this.$set(params, 'packingSpecification', item.packingSpecification);
  1848. if (item.purchaseOrigins?.length) {
  1849. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  1850. }
  1851. this.$set(params, 'provenance', item.purchaseOrigins || []);
  1852. this.supplyList.push(params);
  1853. });
  1854. },
  1855. //删除供货产品
  1856. handleRemoveSupply(index) {
  1857. this.supplyList.splice(index, 1);
  1858. },
  1859. handParent() {
  1860. let item = {
  1861. id: this.form.parentId
  1862. };
  1863. this.$refs.parentRef.open(item);
  1864. },
  1865. changeParent(obj) {
  1866. this.$set(this.form, 'parentId', obj.id);
  1867. this.$set(this.form, 'parentName', obj.name);
  1868. },
  1869. changeAddress1(e) {
  1870. if (e.length) {
  1871. this.form.address = '/';
  1872. return;
  1873. }
  1874. this.form.address = '';
  1875. },
  1876. changeAddress2(e) {
  1877. if (e.length) {
  1878. this.otherForm.address = '/';
  1879. return;
  1880. }
  1881. this.otherForm.address = '';
  1882. console.log(e);
  1883. }
  1884. }
  1885. };
  1886. </script>