detailsPage.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  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" size="small" @click="editCustomer">
  12. 保存数据
  13. </el-button>
  14. <el-button class="el-button--small-yh" :type="form.enableOrNot == 0?'primary':''" size="small" v-if="form.id" @click="editEnable">
  15. {{ form.enableOrNot == 0 ? '启用' : '禁用' }}
  16. </el-button>
  17. </div>
  18. </div>
  19. <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
  20. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  21. <template slot="corpsTypeId">
  22. <div style="display:flex;">
  23. <avue-input-tree v-model="form.corpsTypeId" :disabled="option.disabled" placeholder="请选择客户分类" :dic="corpTypeList" :props="props">
  24. </avue-input-tree>
  25. <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
  26. @click="corpTypeVisible = true"></i>
  27. </div>
  28. </template>
  29. <template slot="deliveryWarehouseId">
  30. <div style="display:flex;">
  31. <avue-input-tree v-model="form.deliveryWarehouseId" :disabled="option.disabled" placeholder="请选择发货仓库" :dic="corpTypeListCk"
  32. :props="propsCk">
  33. </avue-input-tree>
  34. <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
  35. @click="dialogVisibleCK = true"></i>
  36. </div>
  37. </template>
  38. </avue-form>
  39. </trade-card>
  40. <trade-card title="客户联系人" v-loading="loadingBtn">
  41. <avue-crud ref="crudTwo" :option="customerContact" v-model="contactsForm" :data="contactsData"
  42. @saveColumn="saveColumnTwo" @resetColumn="resetColumnTwo" @row-save="rowSave" @row-update="rowUpdate"
  43. @row-del="rowDelTwo">
  44. <template slot-scope="{ type, size, row, disabled,index}" slot="menu">
  45. <el-button :size="size" :disabled="disabled" :type="type"
  46. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.crudTwo.rowEdit(row, index)">{{
  47. row.$cellEdit ? '确认' : '修改' }}
  48. </el-button>
  49. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  50. @click="rowDelTwo(row, index)">删除
  51. </el-button>
  52. <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
  53. </template>
  54. </avue-crud>
  55. </trade-card>
  56. <trade-card title="地址信息" v-loading="loadingBtn">
  57. <avue-crud :option="option2" ref="crud" :data="data" @row-save="rowSave" @row-update="rowUpdate"
  58. @saveColumn="saveColumn" @resetColumn="resetColumn">
  59. <template slot="headerSerial">
  60. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  61. :disabled="detailData.status == 1" circle></el-button>
  62. </template>
  63. <!-- <template slot="menuLeft">
  64. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRows">录入明细
  65. </el-button>
  66. </template> -->
  67. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  68. <el-button :size="size" :disabled="disabled" :type="type"
  69. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.crud.rowEdit(row, index)">{{
  70. row.$cellEdit ? '确认' : '修改' }}
  71. </el-button>
  72. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type" @click="rowDel(row, index)">删除
  73. </el-button>
  74. </template>
  75. <template slot="defaultAddres" slot-scope="{row,index,disabled}">
  76. <el-switch active-value="1" inactive-value="0" :disabled="disabled" v-model="row.defaultAddres"
  77. @change="addressUnique(row, index)">
  78. </el-switch>
  79. </template>
  80. </avue-crud>
  81. </trade-card>
  82. <containerTitle title="上传附件"></containerTitle>
  83. <c-upload v-loading="loadingBtn" typeUpload="CD" deleteUrl="/api/blade-sales-part/corpsfiles/remove"
  84. :data="corpsFiles" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
  85. <el-dialog title="设置客户分类" v-dialogDrag :visible.sync="corpTypeVisible" class="avue-dialog" width="80%"
  86. append-to-body @closed="corpTypeClosed">
  87. <span>
  88. <corp-type></corp-type>
  89. <!-- <avue-form :key="reload" ref="corpType" v-model="form4" :option="option4" style="margin-top:20px">
  90. </avue-form> -->
  91. </span>
  92. <div class="avue-dialog__footer">
  93. <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
  94. <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
  95. </div>
  96. </el-dialog>
  97. </div>
  98. <el-dialog title="创建用户" :visible.sync="dialogVisibleBt" append-to-body width="60%">
  99. <avue-form v-if="dialogVisibleBt" ref="formDataTwo" v-model="formDataTwo" :option="optionData">
  100. </avue-form>
  101. <span slot="footer" class="dialog-footer">
  102. <el-button @click="dialogVisibleBt = false">取 消</el-button>
  103. <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
  104. </span>
  105. </el-dialog>
  106. <el-dialog title="新增仓库" :visible.sync="dialogVisibleCK" append-to-body width="60%">
  107. <avue-form v-if="dialogVisibleCK" ref="formDataThree" v-model="formDataThree" :option="optionDataCK">
  108. </avue-form>
  109. <span slot="footer" class="dialog-footer">
  110. <el-button @click="dialogVisibleCK = false">取 消</el-button>
  111. <el-button type="primary" @click="confirmSynchronizationThree">确 定</el-button>
  112. </span>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import { option2, option3 } from "./js/optionList";
  118. // import {getDetails, addCorpType, getCorpType, submit, customerList, itemDel} from "@/api/basicData/client";
  119. import {
  120. getDetails,
  121. getCorpType,
  122. submit,
  123. customerList,
  124. itemDel,
  125. corpsattn,
  126. editenable
  127. } from "@/api/tirePartsMall/basicData/customerInformation"
  128. import corpType from './components/index'
  129. import { creatingUsersTwo } from "@/api/basicData/customerInformation";
  130. import { getRoleTree } from "@/api/system/role";
  131. import { getDeptTree } from "@/api/system/dept";
  132. import { getPostList } from "@/api/system/post";
  133. import website from "@/config/website";
  134. import {
  135. typeSave,
  136. customerListAll
  137. } from "@/api/tirePartsMall/basicData/warehouse";
  138. export default {
  139. name: "index",
  140. data() {
  141. return {
  142. propsCk: {
  143. label: 'cname',
  144. value: 'id'
  145. },
  146. props: {
  147. label: 'title',
  148. value: 'value'
  149. },
  150. optionData: {
  151. span: 8,
  152. menuBtn: false,
  153. column: [
  154. {
  155. label: "所属角色",
  156. prop: "roleId",
  157. multiple: true,
  158. type: "tree",
  159. dicData: [],
  160. props: {
  161. label: "title"
  162. },
  163. checkStrictly: true,
  164. slot: true,
  165. rules: [
  166. {
  167. required: true,
  168. message: "请选择所属角色",
  169. trigger: "click"
  170. }
  171. ]
  172. },
  173. {
  174. label: "所属部门",
  175. prop: "deptId",
  176. type: "tree",
  177. multiple: true,
  178. dicData: [],
  179. props: {
  180. label: "title"
  181. },
  182. checkStrictly: true,
  183. slot: true,
  184. rules: [
  185. {
  186. required: true,
  187. message: "请选择所属部门",
  188. trigger: "click"
  189. }
  190. ]
  191. },
  192. {
  193. label: "所属岗位",
  194. prop: "postId",
  195. type: "tree",
  196. multiple: true,
  197. dicData: [],
  198. props: {
  199. label: "postName",
  200. value: "id"
  201. },
  202. rules: [
  203. {
  204. required: true,
  205. message: "请选择所属岗位",
  206. trigger: "click"
  207. }
  208. ]
  209. }
  210. ]
  211. },
  212. optionDataCK: {
  213. span: 8,
  214. menuBtn: false,
  215. column: [{
  216. label: "仓库编码",
  217. prop: "code",
  218. search: true,
  219. overHidden: true,
  220. width: 120,
  221. rules: [
  222. {
  223. required: true,
  224. message: " ",
  225. trigger: "blur"
  226. }
  227. ]
  228. }, {
  229. label: "仓库名称",
  230. prop: "cname",
  231. search: true,
  232. overHidden: true,
  233. width: 120,
  234. rules: [
  235. {
  236. required: true,
  237. message: " ",
  238. trigger: "blur"
  239. }
  240. ]
  241. }, {
  242. label: "联系人",
  243. prop: "contacts",
  244. search: true,
  245. overHidden: true,
  246. width: 120,
  247. rules: [
  248. {
  249. required: true,
  250. message: " ",
  251. trigger: "blur"
  252. }
  253. ]
  254. }, {
  255. label: "联系电话",
  256. prop: "tel",
  257. search: true,
  258. overHidden: true,
  259. width: 120,
  260. // rules: [
  261. // {
  262. // required: true,
  263. // message: " ",
  264. // trigger: "blur"
  265. // }
  266. // ]
  267. }, {
  268. label: "是否计费",
  269. prop: "chargeOrNot",
  270. search: true,
  271. overHidden: true,
  272. width: 120,
  273. type: "select",
  274. dicData: [{
  275. label: "是",
  276. value: "0"
  277. }, {
  278. label: "否",
  279. value: "1"
  280. }],
  281. // rules: [
  282. // {
  283. // required: true,
  284. // message: " ",
  285. // trigger: "blur"
  286. // }
  287. // ]
  288. }, {
  289. label: "库容",
  290. prop: "storageCapacity",
  291. search: true,
  292. overHidden: true,
  293. width: 120,
  294. // rules: [
  295. // {
  296. // required: true,
  297. // message: " ",
  298. // trigger: "blur"
  299. // }
  300. // ]
  301. }, {
  302. label: "所属公司",
  303. prop: "salesCompanyId",
  304. search: true,
  305. overHidden: true,
  306. width: 120,
  307. type: 'select',
  308. props: {
  309. label: 'fullName',
  310. value: 'id'
  311. },
  312. dicUrl: '/api/blade-system/dept/top-list',
  313. rules: [
  314. {
  315. required: true,
  316. message: " ",
  317. trigger: "blur"
  318. }
  319. ]
  320. },
  321. // {
  322. // label: "共享公司",
  323. // prop: "sharedCompany",
  324. // search: true,
  325. // overHidden: true,
  326. // width: 120,
  327. // rules: [
  328. // {
  329. // required: true,
  330. // message: " ",
  331. // trigger: "blur"
  332. // }
  333. // ]
  334. // },
  335. {
  336. label: "备注",
  337. prop: "remarks",
  338. type: "textarea",
  339. minRows: 3,
  340. span: 24,
  341. overHidden: true,
  342. width: 200
  343. }]
  344. },
  345. dialogVisibleBt: false,
  346. formDataTwo: false,
  347. dialogVisibleCK: false,
  348. formDataThree: false,
  349. customerContact: {},
  350. contactsForm: {},
  351. contactsData: [],
  352. corpTypeList: [],
  353. corpTypeListCk: [],
  354. corpTypeVisible: false,
  355. activeName: 'first',
  356. loadingBtn: false,
  357. addressTitle: null,
  358. addressVisible: false,
  359. form: {},
  360. form2: {},
  361. form3: {},
  362. form4: {},
  363. data: [],
  364. data1: [],
  365. data2: [],
  366. option: {
  367. menuBtn: false,
  368. labelWidth: 130,
  369. column: [
  370. {
  371. label: "客户名称",
  372. prop: "cname",
  373. rules: [
  374. {
  375. required: true,
  376. message: "",
  377. trigger: "blur"
  378. }
  379. ],
  380. span: 8,
  381. },
  382. {
  383. label: "客户分类",
  384. prop: "corpsTypeId",
  385. span: 8,
  386. rules: [{
  387. required: true,
  388. message: " ",
  389. trigger: "blur"
  390. }]
  391. },
  392. {
  393. label: "电话",
  394. prop: "tel",
  395. span: 8,
  396. },
  397. {
  398. label: "业务员",
  399. span: 8,
  400. prop: "salesmanId",
  401. type: "select",
  402. props: {
  403. label: "name",
  404. value: "id"
  405. },
  406. dicUrl: "/api/blade-user/client/getUserByRole",
  407. filterable: true,
  408. rules: [{
  409. required: true,
  410. message: " ",
  411. trigger: "blur"
  412. }]
  413. },
  414. {
  415. label: "账期",
  416. prop: "accountPeriod",
  417. span: 8,
  418. },
  419. {
  420. label: "发货仓库",
  421. prop: "deliveryWarehouseId",
  422. span: 8,
  423. type: 'select',
  424. props: {
  425. label: 'cname',
  426. value: 'id'
  427. },
  428. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  429. rules: [{
  430. required: true,
  431. message: " ",
  432. trigger: "blur"
  433. }]
  434. },
  435. {
  436. label: "商城价格",
  437. prop: "priceSystem",
  438. span: 8, filterable: true, type: "select", dicUrl: "/api/blade-system/dict-biz/dictionary?code=mall_price",
  439. props: {
  440. label: "dictValue",
  441. value: "dictKey"
  442. },
  443. rules: [{
  444. required: true,
  445. message: " ",
  446. trigger: "blur"
  447. }]
  448. }, {
  449. label: "信用额度",
  450. prop:
  451. "creditLimit", span: 8,
  452. type: "number", controls: false,
  453. precision: 2
  454. }
  455. ,
  456. {
  457. label: "使用信用额度",
  458. prop: "useCreditLimit", span: 8,
  459. type: "number",
  460. disabled: true,
  461. controls: false,
  462. precision: 2
  463. }, {
  464. label: "备注",
  465. prop: "remarks", type: "textarea",
  466. minRows: 2, span: 24,
  467. }
  468. ]
  469. },
  470. option2: {},
  471. option3: {},
  472. option4: {
  473. menuBtn: false,
  474. labelWidth: 80,
  475. column: [{
  476. label: "分类名称",
  477. prop: "cname",
  478. rules: [
  479. {
  480. required: true,
  481. message: "",
  482. trigger: "blur"
  483. }
  484. ],
  485. span: 24,
  486. },
  487. {
  488. label: "上级类型",
  489. prop: "parentId",
  490. dicData: [],
  491. type: "tree",
  492. props: {
  493. label: "cname",
  494. value: "id"
  495. },
  496. span: 24,
  497. }
  498. ]
  499. },
  500. corpsFiles: [],
  501. customerContactBack: {
  502. align: 'center',
  503. index: true,
  504. addBtnText: "录入明细",
  505. refreshBtn: false,
  506. dialogDrag: true,
  507. addBtn: true,
  508. span: 8,
  509. height: 600,
  510. addRowBtn: false,
  511. editBtn: false,
  512. delBtn: false,
  513. menuWidth: 200,
  514. dialogTop: 25,
  515. dialogWidth: "80%",
  516. column: [{
  517. label: '联系人',
  518. prop: 'cname',
  519. cell: true,
  520. rules: [
  521. {
  522. required: true,
  523. message: " ",
  524. trigger: "blur"
  525. }
  526. ]
  527. }, {
  528. label: '电话',
  529. prop: 'tel',
  530. cell: true,
  531. rules: [
  532. {
  533. required: true,
  534. message: " ",
  535. trigger: "blur"
  536. }
  537. ]
  538. }, {
  539. label: '备注',
  540. prop: 'remarks',
  541. cell: true
  542. }]
  543. }
  544. }
  545. },
  546. components: {
  547. corpType
  548. },
  549. props: {
  550. detailData: {
  551. type: Object
  552. }
  553. },
  554. async created() {
  555. this.customerContact = await this.getColumnData(
  556. this.getColumnName(263.1),
  557. this.customerContactBack
  558. );
  559. this.option2 = await this.getColumnData(this.getColumnName(263.2), option2);
  560. // this.option3 = await this.getColumnData(this.getColumnName(208.4), option3);
  561. if (this.detailData.id) {
  562. this.getDetail(this.detailData.id);
  563. }
  564. if (this.detailData.status == 1) {
  565. this.option.disabled = true;
  566. }
  567. if (!website.tenantMode) {
  568. this.initData(website.tenantId);
  569. } else {
  570. this.initData();
  571. }
  572. this.getCorpType()
  573. this.getAllWorkDicts()
  574. this.getCorpTypeCk()
  575. },
  576. activated() {
  577. setTimeout(() => {
  578. this.$nextTick(() => {
  579. this.$refs.crud.doLayout()
  580. })
  581. }, 100)
  582. },
  583. methods: {
  584. // 启用或禁用
  585. editEnable() {
  586. let data = this.form
  587. editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
  588. this.$message({
  589. type: "success",
  590. message: data.enableOrNot ? "禁用成功!" : "启用成功!"
  591. });
  592. this.getDetail(this.detailData.id)
  593. // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
  594. })
  595. },
  596. addressUnique(row, index) {
  597. for (let item in this.data) {
  598. if (index != item) {
  599. if (this.data[item].defaultAddres == 1) {
  600. this.$message.warning("默认地址只能唯一")
  601. return row.defaultAddres = 0
  602. }
  603. }
  604. }
  605. },
  606. initData(tenantId) {
  607. getRoleTree(tenantId).then(res => {
  608. const column = this.findObject(this.optionData.column, "roleId");
  609. column.dicData = res.data.data;
  610. });
  611. getDeptTree(tenantId).then(res => {
  612. const column = this.findObject(this.optionData.column, "deptId");
  613. column.dicData = res.data.data;
  614. });
  615. getPostList(tenantId).then(res => {
  616. const column = this.findObject(this.optionData.column, "postId");
  617. column.dicData = res.data.data;
  618. });
  619. },
  620. //确认创建用户
  621. confirmSynchronizationTwo() {
  622. this.$refs["formDataTwo"].validate((valid, done) => {
  623. done();
  624. if (valid) {
  625. let data = JSON.parse(JSON.stringify(this.formDataTwo));
  626. data.deptId = data.deptId.join(",");
  627. data.roleId = data.roleId.join(",");
  628. data.postId = data.postId.join(",");
  629. creatingUsersTwo({
  630. ...data,
  631. id: this.formRow.id
  632. }).then(res => {
  633. this.dialogVisibleBt = false;
  634. this.formDataTwo = {}
  635. this.$message.success(
  636. "创建用户成功,默认帐号:手机号。默认密码:123456"
  637. );
  638. });
  639. } else {
  640. return false;
  641. }
  642. });
  643. }
  644. ,
  645. //确认创建仓库
  646. confirmSynchronizationThree() {
  647. this.formDataThree.salesCompanyName = this.formDataThree.$salesCompanyId
  648. this.$refs["formDataThree"].validate((valid, done) => {
  649. done();
  650. if (valid) {
  651. typeSave({
  652. ...this.formDataThree,
  653. }).then(res => {
  654. this.dialogVisibleCK = false;
  655. this.$message.success('新增成功')
  656. this.formDataThree = {}
  657. this.getCorpTypeCk()
  658. });
  659. } else {
  660. return false;
  661. }
  662. });
  663. }
  664. ,
  665. getAllWorkDicts() {
  666. customerList({ corpType: "KH" }).then(res => {
  667. this.findObject(this.option4.column, "parentId").dicData = res.data.data.records
  668. });
  669. this.getWorkDicts("abbreviation").then(res => {
  670. this.findObject(this.option2.column, "abbreviation").dicData = res.data.data;
  671. });
  672. this.findObject(this.option2.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
  673. this.$refs.crud.init();
  674. }
  675. ,
  676. cellStyle() {
  677. return "padding:0;height:40px;";
  678. }
  679. ,
  680. selectValue(value, row) {
  681. if (row.feesId) {
  682. row.feesName = value.cname
  683. } else {
  684. row.feesName = ""
  685. }
  686. }
  687. ,
  688. getDetail(id) {
  689. this.loadingBtn = true
  690. getDetails({ id: id })
  691. .then(res => {
  692. this.form = res.data.data;
  693. if (this.form.enableOrNot == 1) {
  694. this.$set(this.option,'disabled',true)
  695. }else {
  696. this.$set(this.option,'disabled',false)
  697. }
  698. this.data = res.data.data.corpsAddrList
  699. this.corpsFiles = res.data.data.corpsFilesList
  700. this.contactsData = res.data.data.corpsAttnList
  701. })
  702. .finally(() => {
  703. this.loadingBtn = false;
  704. });
  705. }
  706. ,
  707. getCorpData(row) {
  708. this.form.corpName = row.cname
  709. }
  710. ,
  711. addRow() {
  712. console.log('1234');
  713. this.data.push({ $cellEdit: true })
  714. }
  715. ,
  716. rowCell(row, index) {
  717. if (row.$cellEdit == true) {
  718. this.$set(row, "$cellEdit", false);
  719. } else {
  720. this.$set(row, "$cellEdit", true);
  721. }
  722. }
  723. ,
  724. rowDel(row, index) {
  725. this.$confirm("确定删除数据?", {
  726. confirmButtonText: "确定",
  727. cancelButtonText: "取消",
  728. type: "warning"
  729. }).then(() => {
  730. if (row.id) {
  731. itemDel(row.id).then(res => {
  732. this.$message({
  733. type: "success",
  734. message: "删除成功!"
  735. });
  736. this.data.splice(index, 1);
  737. });
  738. } else {
  739. this.$message({
  740. type: "success",
  741. message: "删除成功!"
  742. });
  743. this.data.splice(index, 1);
  744. }
  745. });
  746. }
  747. ,
  748. addRow2() {
  749. this.data2.push({ $cellEdit: true, type: 1 })
  750. }
  751. ,
  752. rowCell2(row, index) {
  753. if (row.$cellEdit == true) {
  754. this.$set(row, "$cellEdit", false);
  755. } else {
  756. this.$set(row, "$cellEdit", true);
  757. }
  758. }
  759. ,
  760. rowDe2(row, index) {
  761. this.$confirm("确定删除数据?", {
  762. confirmButtonText: "确定",
  763. cancelButtonText: "取消",
  764. type: "warning"
  765. }).then(() => {
  766. if (row.id) {
  767. // itemDel(row.id).then(res => {
  768. // this.$message({
  769. // type: "success",
  770. // message: "删除成功!"
  771. // });
  772. // this.data2.splice(index, 1);
  773. // });
  774. } else {
  775. this.$message({
  776. type: "success",
  777. message: "删除成功!"
  778. });
  779. this.data2.splice(index, 1);
  780. }
  781. });
  782. }
  783. ,
  784. corpTypeClosed() {
  785. // this.reload = Math.random();
  786. // this.form4 = this.$options.data().form4
  787. }
  788. ,
  789. getCorpType() {
  790. getCorpType({ corpType: 'KH' }).then(res => {
  791. this.corpTypeList = res.data.data
  792. })
  793. }
  794. ,
  795. getCorpTypeCk() {
  796. customerListAll().then(res => {
  797. this.corpTypeListCk = res.data.data
  798. })
  799. }
  800. ,
  801. addCorpType() {
  802. // this.$refs["corpType"].validate((valid, done) => {
  803. // done();
  804. // if (valid) {
  805. // addCorpType({ ...this.form4, corpType: 'KH', status: 0 })
  806. // .then(res => {
  807. // this.$message.success("保存成功");
  808. // this.getCorpType()
  809. // this.corpTypeVisible = false
  810. // })
  811. // } else {
  812. // return false;
  813. // }
  814. // });
  815. this.getCorpType()
  816. this.corpTypeVisible = false
  817. }
  818. ,
  819. //修改提交触发
  820. editCustomer() {
  821. this.$refs["form"].validate((valid, done) => {
  822. done();
  823. if (valid) {
  824. this.loadingBtn = true;
  825. submit({
  826. ...this.form,
  827. code: this.form.cname,
  828. corpType: "KH",
  829. corpsAddrList: this.data,
  830. corpsFilesList: this.corpsFiles,
  831. corpsAttnList: this.contactsData,
  832. billType: 1
  833. }).then(res => {
  834. this.$message.success("保存成功");
  835. this.form = res.data.data;
  836. this.data = res.data.data.corpsAddrList
  837. this.corpsFiles = res.data.data.corpsFilesList
  838. this.getDetail(res.data.data.id);
  839. if (!this.form.id) {
  840. //添加成功后默认启用
  841. let data = this.form
  842. editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
  843. this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
  844. })
  845. }
  846. }).finally(() => {
  847. this.loadingBtn = false;
  848. });
  849. } else {
  850. return false;
  851. }
  852. });
  853. }
  854. ,
  855. async saveColumn() {
  856. const inSave = await this.saveColumnData(
  857. this.getColumnName(263.2),
  858. this.option2
  859. );
  860. if (inSave) {
  861. this.$nextTick(() => {
  862. this.$refs.crud.doLayout();
  863. });
  864. this.$message.success("保存成功");
  865. //关闭窗口
  866. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  867. }
  868. }
  869. ,
  870. async resetColumn() {
  871. this.option2 = option2;
  872. const inSave = await this.delColumnData(
  873. this.getColumnName(263.2),
  874. option2
  875. );
  876. if (inSave) {
  877. this.$nextTick(() => {
  878. this.$refs.crud.doLayout();
  879. });
  880. this.getAllWorkDicts()
  881. this.$message.success("重置成功");
  882. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  883. }
  884. }
  885. ,
  886. creatingUsers(row) {
  887. console.log("row", row)
  888. if (row.id) {
  889. if (row.tel) {
  890. this.dialogVisibleBt = true;
  891. this.formDataTwo = {};
  892. this.formRow = row;
  893. } else {
  894. this.$message.error("请输入手机号");
  895. }
  896. } else {
  897. this.$message.error("请保存数据后再点击");
  898. }
  899. }
  900. ,
  901. //新增客户联系人保存触发
  902. rowSave(row, done, loading) {
  903. done(row);
  904. }
  905. ,
  906. //修改客户联系人触发
  907. rowUpdate(row, index, done, loading) {
  908. done(row);
  909. }
  910. ,
  911. //删除客户联系人触发
  912. rowDelTwo(row, index, donerowDel) {
  913. this.$confirm("确定将选择数据删除?", {
  914. confirmButtonText: "确定",
  915. cancelButtonText: "取消",
  916. type: "warning"
  917. }).then(() => {
  918. // 数据回调进行刷新
  919. if (row.id) {
  920. corpsattn(row.id).then(res => {
  921. this.$message({
  922. type: "success",
  923. message: "操作成功!"
  924. });
  925. this.contactsData.splice(index, 1);
  926. });
  927. } else {
  928. this.$message({
  929. type: "success",
  930. message: "操作成功!"
  931. });
  932. this.contactsData.splice(index, 1);
  933. }
  934. });
  935. }
  936. ,
  937. async saveColumnTwo() {
  938. const inSave = await this.saveColumnData(
  939. this.getColumnName(263.1),
  940. this.customerContact
  941. );
  942. if (inSave) {
  943. this.$nextTick(() => {
  944. this.$refs.crudTwo.doLayout();
  945. });
  946. this.$message.success("保存成功");
  947. //关闭窗口
  948. this.$refs.crudTwo.$refs.dialogColumn.columnBox = false;
  949. }
  950. }
  951. ,
  952. async resetColumnTwo() {
  953. this.customerContact = this.customerContactBack;
  954. const inSave = await this.delColumnData(
  955. this.getColumnName(263.1),
  956. this.customerContactBack
  957. );
  958. if (inSave) {
  959. this.$nextTick(() => {
  960. this.$refs.crudTwo.doLayout();
  961. });
  962. this.$message.success("重置成功");
  963. this.$refs.crudTwo.$refs.dialogColumn.columnBox = false;
  964. }
  965. }
  966. ,
  967. async saveColumn2() {
  968. const inSave = await this.saveColumnData(
  969. this.getColumnName(208.4),
  970. this.option3
  971. );
  972. if (inSave) {
  973. this.$nextTick(() => {
  974. this.$refs.crud.doLayout();
  975. });
  976. this.$message.success("保存成功");
  977. //关闭窗口
  978. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  979. }
  980. }
  981. ,
  982. async resetColumn2() {
  983. this.option3 = option3;
  984. const inSave = await this.delColumnData(
  985. this.getColumnName(208.4),
  986. option3
  987. );
  988. if (inSave) {
  989. this.$nextTick(() => {
  990. this.$refs.crud.doLayout();
  991. });
  992. this.getAllWorkDicts()
  993. this.$message.success("重置成功");
  994. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  995. }
  996. }
  997. ,
  998. //返回列表
  999. backToList() {
  1000. this.$emit("goBack");
  1001. }
  1002. }
  1003. }
  1004. ;
  1005. </script>
  1006. <style lang="scss" scoped>
  1007. .trading-form ::v-deep .el-form-item {
  1008. margin-bottom: 8px !important;
  1009. }
  1010. ::v-deep .el-dialog__body {
  1011. padding: 0px 20px 15px 20px;
  1012. }
  1013. ::v-deep .el-form-item__error {
  1014. display: none !important;
  1015. }
  1016. .el-dialog ::v-deep .el-form-item__error {
  1017. display: none !important;
  1018. }
  1019. .img-form ::v-deep .el-form-item {
  1020. height: 150px;
  1021. line-height: 150px;
  1022. margin-bottom: 8px !important;
  1023. }
  1024. .img-form ::v-deep .avue-upload__icon {
  1025. font-size: 20px;
  1026. width: 150px;
  1027. height: 150px;
  1028. line-height: 150px;
  1029. }
  1030. ::v-deep .el-table .cell {
  1031. padding: 0 2px !important;
  1032. }
  1033. ::v-deep .avue-crud .el-table .el-form-item__label {
  1034. left: -1px;
  1035. }
  1036. .addressTabs {
  1037. display: flex;
  1038. justify-content: center;
  1039. span {
  1040. width: 100px;
  1041. font-size: 18px;
  1042. font-weight: 600;
  1043. text-align: center;
  1044. }
  1045. }
  1046. </style>