detailsPage.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  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" @click="backToList"
  7. >返回列表
  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" @click="corpTypeVisible = true"></i>
  26. </div>
  27. </template>
  28. </avue-form>
  29. </trade-card>
  30. <trade-card title="客户联系人" v-loading="loadingBtn">
  31. <avue-crud
  32. ref="crudTwo"
  33. :option="customerContactBack"
  34. v-model="contactsForm"
  35. :data="contactsData"
  36. @row-save="rowSave"
  37. @row-update="rowUpdate"
  38. @row-del="rowDelTwo"
  39. >
  40. <template slot-scope="{ type, size, row, disabled, index }" slot="menu">
  41. <el-button
  42. :size="size"
  43. :disabled="disabled"
  44. :type="type"
  45. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  46. @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" @click="rowDelTwo(row, index)">删除 </el-button>
  50. <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户 </el-button>
  51. </template>
  52. </avue-crud>
  53. </trade-card>
  54. <trade-card title="地址信息" v-loading="loadingBtn">
  55. <avue-crud
  56. :option="option2"
  57. ref="crud"
  58. :data="data"
  59. @row-save="rowSave"
  60. @row-update="rowUpdate"
  61. >
  62. <template slot="headerSerial">
  63. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow" :disabled="detailData.status == 1" circle></el-button>
  64. </template>
  65. <template slot="menuLeft">
  66. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRow">录入明细 </el-button>
  67. </template>
  68. <template v-if="!row.$cellEdit" slot-scope="{ type, size, row, index, disabled }" slot="menu">
  69. <el-button
  70. :size="size"
  71. :disabled="disabled"
  72. :type="type"
  73. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  74. @click="$refs.crud.rowCell(row, index)"
  75. >{{ row.$cellEdit ? "确认" : "修改" }}
  76. </el-button>
  77. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type" @click="rowDel(row, index)">删除 </el-button>
  78. </template>
  79. <template slot="defaultAddres" slot-scope="{ row, index, disabled }">
  80. <el-switch active-value="1" inactive-value="0" :disabled="disabled" v-model="row.defaultAddres" @change="addressUnique(row, index)">
  81. </el-switch>
  82. </template>
  83. </avue-crud>
  84. </trade-card>
  85. <containerTitle title="上传附件"></containerTitle>
  86. <c-upload
  87. v-loading="loadingBtn"
  88. typeUpload="CD"
  89. deleteUrl="/api/blade-sales-part/corpsfiles/remove"
  90. :data="corpsFiles"
  91. display
  92. :enumerationValue="35.1"
  93. :disabled="detailData.status == 1"
  94. ></c-upload>
  95. <el-dialog
  96. title="设置客户分类"
  97. v-dialogDrag
  98. :visible.sync="corpTypeVisible"
  99. class="avue-dialog"
  100. width="80%"
  101. append-to-body
  102. @closed="corpTypeClosed"
  103. >
  104. <span>
  105. <corp-type></corp-type>
  106. </span>
  107. <div class="avue-dialog__footer">
  108. <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
  109. <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
  110. </div>
  111. </el-dialog>
  112. </div>
  113. <el-dialog title="创建用户" :visible.sync="dialogVisibleBt" append-to-body width="60%">
  114. <avue-form v-if="dialogVisibleBt" ref="formDataTwo" v-model="formDataTwo" :option="optionData"> </avue-form>
  115. <span slot="footer" class="dialog-footer">
  116. <el-button @click="dialogVisibleBt = false">取 消</el-button>
  117. <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
  118. </span>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import {
  124. getDetails,
  125. getCorpType,
  126. submit,
  127. customerList,
  128. areaTypeTree,
  129. itemDel,
  130. corpsattn,
  131. editenable,
  132. getUserByRole,
  133. getBrandDesc,
  134. creatingUsersTwo
  135. } from "@/api/fc/customerInformation";
  136. import { getRoleTree } from "@/api/system/role";
  137. import { getDeptTree } from "@/api/system/dept";
  138. import { getPostList } from "@/api/system/post";
  139. import corpType from './components/index.vue'
  140. import website from "@/config/website";
  141. export default {
  142. name: "index",
  143. data() {
  144. return {
  145. propsCk: {
  146. label: "cname",
  147. value: "id"
  148. },
  149. props: {
  150. label: "title",
  151. value: "value"
  152. },
  153. optionData: {
  154. span: 8,
  155. menuBtn: false,
  156. column: [
  157. {
  158. label: "所属角色",
  159. prop: "roleId",
  160. multiple: true,
  161. type: "tree",
  162. dicData: [],
  163. props: {
  164. label: "title"
  165. },
  166. checkStrictly: true,
  167. slot: true,
  168. rules: [
  169. {
  170. required: true,
  171. message: "请选择所属角色",
  172. trigger: "click"
  173. }
  174. ]
  175. },
  176. {
  177. label: "所属部门",
  178. prop: "deptId",
  179. type: "tree",
  180. multiple: true,
  181. dicData: [],
  182. props: {
  183. label: "title"
  184. },
  185. checkStrictly: true,
  186. slot: true,
  187. rules: [
  188. {
  189. required: true,
  190. message: "请选择所属部门",
  191. trigger: "click"
  192. }
  193. ]
  194. },
  195. {
  196. label: "所属岗位",
  197. prop: "postId",
  198. type: "tree",
  199. multiple: true,
  200. dicData: [],
  201. props: {
  202. label: "postName",
  203. value: "id"
  204. },
  205. rules: [
  206. {
  207. required: true,
  208. message: "请选择所属岗位",
  209. trigger: "click"
  210. }
  211. ]
  212. }
  213. ]
  214. },
  215. dialogVisibleBt: false,
  216. formDataTwo: false,
  217. customerContact: {},
  218. contactsForm: {},
  219. contactsData: [],
  220. corpTypeList: [],
  221. corpTypeVisible: false,
  222. loadingBtn: false,
  223. form: {
  224. ifLimitAmount: "0"
  225. },
  226. form4: {},
  227. data: [],
  228. data2: [],
  229. option: {
  230. menuBtn: false,
  231. labelWidth: 130,
  232. column: [
  233. {
  234. label: "客户名称",
  235. prop: "cname",
  236. rules: [
  237. {
  238. required: true,
  239. message: "",
  240. trigger: "blur"
  241. }
  242. ],
  243. span: 8
  244. },
  245. {
  246. label: "客户分类",
  247. prop: "corpsTypeId",
  248. span: 8,
  249. rules: [
  250. {
  251. required: true,
  252. message: " ",
  253. trigger: "blur"
  254. }
  255. ]
  256. },
  257. {
  258. label: "电话",
  259. prop: "tel",
  260. span: 8
  261. },
  262. {
  263. label: "业务员",
  264. span: 12,
  265. prop: "salesmanId",
  266. type: "select",
  267. props: {
  268. label: "name",
  269. value: "id"
  270. },
  271. dicData: [],
  272. dicUrl: "/api/blade-user/factoryUserList",
  273. filterable: true,
  274. rules: [
  275. {
  276. required: true,
  277. message: " ",
  278. trigger: "blur"
  279. }
  280. ],
  281. // change: value => {
  282. // if (value.value) {
  283. // for (let item of value.column.dicData.data) {
  284. // if (item.id == value.value) {
  285. // this.$set(this.form, "salesmanName", item.name);
  286. // }
  287. // }
  288. // }
  289. // }
  290. },
  291. {
  292. label: "品牌",
  293. prop: "brandId",
  294. props: {
  295. label: "cname",
  296. value: "id"
  297. },
  298. span: 12,
  299. search: true,
  300. dicDate: [],
  301. multiple: true,
  302. dicUrl: "/api/gubersail-admin/brandDesc/listAllV1?type=PP",
  303. type: "select",
  304. dataType: "string",
  305. rules: [
  306. {
  307. message: "请选择品牌",
  308. trigger: "click"
  309. }
  310. ]
  311. },
  312. {
  313. label: "备注",
  314. prop: "remarks",
  315. type: "textarea",
  316. minRows: 2,
  317. span: 24
  318. }
  319. ]
  320. },
  321. option2: {
  322. align: "center",
  323. index: true,
  324. addBtnText: "录入明细",
  325. refreshBtn: false,
  326. dialogDrag: true,
  327. addBtn: false,
  328. span: 8,
  329. height: 300,
  330. editBtn: false,
  331. delBtn: false,
  332. menuWidth: 140,
  333. dialogTop: 25,
  334. dialogWidth: "80%",
  335. addRowBtn: false,
  336. cellBtn: true,
  337. rowKey: "index",
  338. cancelBtn: false,
  339. columnBtn:false,
  340. // saveBtn:false,
  341. column: [
  342. {
  343. label: "联系人",
  344. prop: "contacts",
  345. cell: true,
  346. rules: [
  347. {
  348. required: true,
  349. message: " ",
  350. trigger: "blur"
  351. }
  352. ]
  353. },
  354. {
  355. label: "电话",
  356. prop: "tel",
  357. cell: true,
  358. rules: [
  359. {
  360. required: true,
  361. message: " ",
  362. trigger: "blur"
  363. }
  364. ]
  365. },
  366. {
  367. label: "地址",
  368. prop: "belongtoarea",
  369. dicData: [],
  370. dataType: "string",
  371. type: "cascader",
  372. props: {
  373. label: "name",
  374. value: "name"
  375. },
  376. rules: [
  377. {
  378. required: true,
  379. message: " ",
  380. trigger: "blur"
  381. }
  382. ],
  383. filterable: true,
  384. cell: true
  385. },
  386. {
  387. label: "详细地址",
  388. prop: "detailedAddress",
  389. cell: true,
  390. rules: [
  391. {
  392. required: true,
  393. message: " ",
  394. trigger: "blur"
  395. }
  396. ]
  397. },
  398. {
  399. label: "备注",
  400. prop: "remarks",
  401. cell: true
  402. },
  403. {
  404. label: "默认地址",
  405. prop: "defaultAddres",
  406. display: false,
  407. width: 100
  408. }
  409. ]
  410. },
  411. option3: {},
  412. option4: {
  413. menuBtn: false,
  414. labelWidth: 80,
  415. column: [
  416. {
  417. label: "分类名称",
  418. prop: "cname",
  419. rules: [
  420. {
  421. required: true,
  422. message: "",
  423. trigger: "blur"
  424. }
  425. ],
  426. span: 24
  427. },
  428. {
  429. label: "上级类型",
  430. prop: "parentId",
  431. dicData: [],
  432. type: "tree",
  433. props: {
  434. label: "cname",
  435. value: "id"
  436. },
  437. span: 24
  438. }
  439. ]
  440. },
  441. corpsFiles: [],
  442. customerContactBack: {
  443. align: "center",
  444. index: true,
  445. addBtnText: "录入明细",
  446. refreshBtn: false,
  447. dialogDrag: true,
  448. addBtn: true,
  449. span: 8,
  450. height: 300,
  451. addRowBtn: false,
  452. editBtn: false,
  453. delBtn: false,
  454. menuWidth: 200,
  455. dialogTop: 25,
  456. dialogWidth: "80%",
  457. columnBtn:false,
  458. column: [
  459. {
  460. label: "联系人",
  461. prop: "cname",
  462. cell: true,
  463. rules: [
  464. {
  465. required: true,
  466. message: " ",
  467. trigger: "blur"
  468. }
  469. ]
  470. },
  471. {
  472. label: "电话",
  473. prop: "tel",
  474. cell: true,
  475. rules: [
  476. {
  477. required: true,
  478. message: " ",
  479. trigger: "blur"
  480. }
  481. ]
  482. },
  483. {
  484. label: "登录用户id",
  485. prop: "userId",
  486. cell: true
  487. },
  488. {
  489. label: "备注",
  490. prop: "remarks",
  491. cell: true
  492. }
  493. ]
  494. },
  495. userObj: {}
  496. };
  497. },
  498. components: { corpType },
  499. props: {
  500. detailData: {
  501. type: Object
  502. }
  503. },
  504. async created() {
  505. if (this.detailData.id) {
  506. this.getDetail(this.detailData.id);
  507. }
  508. if (this.detailData.status == 1) {
  509. this.option.disabled = true;
  510. }
  511. if (!website.tenantMode) {
  512. this.initData(website.tenantId);
  513. } else {
  514. this.initData();
  515. }
  516. this.getUserByRolefun();
  517. this.getCorpType();
  518. this.getAllWorkDicts();
  519. this.userObj = JSON.parse(localStorage.getItem("saber-userInfo")).content;
  520. },
  521. activated() {
  522. setTimeout(() => {
  523. this.$nextTick(() => {
  524. this.$refs.crud.doLayout();
  525. });
  526. }, 100);
  527. },
  528. methods: {
  529. // 获取业务员数据
  530. getUserByRolefun() {
  531. getUserByRole().then(res => {
  532. this.findObject(this.option.column, "salesmanId").dicData = res.data;
  533. });
  534. },
  535. // 启用或禁用
  536. editEnable() {
  537. let data = this.form;
  538. editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
  539. this.$message({
  540. type: "success",
  541. message: data.enableOrNot ? "禁用成功!" : "启用成功!"
  542. });
  543. this.getDetail(this.detailData.id);
  544. // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
  545. });
  546. },
  547. addressUnique(row, index) {
  548. for (let item in this.data) {
  549. if (index != item) {
  550. if (this.data[item].defaultAddres == 1) {
  551. this.$message.warning("默认地址只能唯一");
  552. return (row.defaultAddres = 0);
  553. }
  554. }
  555. }
  556. },
  557. initData(tenantId) {
  558. getBrandDesc().then(res => {
  559. const column = this.findObject(this.option.column, "brandId");
  560. column.dicData = res.data.data;
  561. this.form.brandId = "";
  562. });
  563. getRoleTree(tenantId).then(res => {
  564. const column = this.findObject(this.optionData.column, "roleId");
  565. column.dicData = res.data.data;
  566. });
  567. getDeptTree(tenantId).then(res => {
  568. const column = this.findObject(this.optionData.column, "deptId");
  569. column.dicData = res.data.data;
  570. });
  571. getPostList(tenantId).then(res => {
  572. const column = this.findObject(this.optionData.column, "postId");
  573. column.dicData = res.data.data;
  574. });
  575. },
  576. //确认创建用户
  577. confirmSynchronizationTwo() {
  578. this.$refs.formDataTwo.validate((valid, done) => {
  579. done();
  580. if (valid) {
  581. let data = JSON.parse(JSON.stringify(this.formDataTwo));
  582. data.deptId = data.deptId.join(",");
  583. data.roleId = data.roleId.join(",");
  584. data.postId = data.postId.join(",");
  585. creatingUsersTwo({
  586. ...data,
  587. id: this.formRow.id
  588. }).then(res => {
  589. this.dialogVisibleBt = false;
  590. this.formDataTwo = {};
  591. this.$message.success("创建用户成功,默认帐号:手机号。默认密码:123456");
  592. this.getDetail(this.form.id);
  593. });
  594. } else {
  595. return false;
  596. }
  597. });
  598. },
  599. getAllWorkDicts() {
  600. customerList({ corpType: "KH" }).then(res => {
  601. this.findObject(this.option4.column, "parentId").dicData = res.data.data.records;
  602. });
  603. this.getWorkDicts("abbreviation").then(res => {
  604. this.findObject(this.option2.column, "abbreviation").dicData = res.data.data;
  605. });
  606. this.getAreaData();
  607. this.findObject(this.option2.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
  608. this.$refs.crud.init();
  609. },
  610. getAreaData() {
  611. areaTypeTree().then(res => {});
  612. },
  613. getDetail(id) {
  614. this.loadingBtn = true;
  615. getDetails({ id: id })
  616. .then(res => {
  617. this.form = res.data.data;
  618. if (this.form.enableOrNot == 1) {
  619. this.$set(this.option, "disabled", true);
  620. } else {
  621. this.$set(this.option, "disabled", false);
  622. }
  623. if (this.form.brandId == null || this.form.brandId === "") {
  624. this.form.brandId = "";
  625. }
  626. this.data = res.data.data.corpsAddrList;
  627. this.corpsFiles = res.data.data.corpsFilesList;
  628. this.contactsData = res.data.data.corpsAttnList;
  629. })
  630. .finally(() => {
  631. this.loadingBtn = false;
  632. });
  633. },
  634. addRow() {
  635. this.data.push({ $cellEdit: true });
  636. },
  637. rowDel(row, index) {
  638. this.$confirm("确定删除数据?", {
  639. confirmButtonText: "确定",
  640. cancelButtonText: "取消",
  641. type: "warning"
  642. }).then(() => {
  643. if (row.id) {
  644. itemDel(row.id).then(res => {
  645. this.$message({
  646. type: "success",
  647. message: "删除成功!"
  648. });
  649. this.data.splice(index, 1);
  650. });
  651. } else {
  652. this.$message({
  653. type: "success",
  654. message: "删除成功!"
  655. });
  656. this.data.splice(index, 1);
  657. }
  658. });
  659. },
  660. addRow2() {
  661. this.data2.push({ $cellEdit: true, type: 1 });
  662. },
  663. rowCell2(row, index) {
  664. if (row.$cellEdit == true) {
  665. this.$set(row, "$cellEdit", false);
  666. } else {
  667. this.$set(row, "$cellEdit", true);
  668. }
  669. },
  670. rowDe2(row, index) {
  671. this.$confirm("确定删除数据?", {
  672. confirmButtonText: "确定",
  673. cancelButtonText: "取消",
  674. type: "warning"
  675. }).then(() => {
  676. if (row.id) {
  677. // itemDel(row.id).then(res => {
  678. // this.$message({
  679. // type: "success",
  680. // message: "删除成功!"
  681. // });
  682. // this.data2.splice(index, 1);
  683. // });
  684. } else {
  685. this.$message({
  686. type: "success",
  687. message: "删除成功!"
  688. });
  689. this.data2.splice(index, 1);
  690. }
  691. });
  692. },
  693. corpTypeClosed() {
  694. // this.reload = Math.random();
  695. // this.form4 = this.$options.data().form4
  696. },
  697. getCorpType() {
  698. getCorpType({ corpType: "KH" }).then(res => {
  699. this.corpTypeList = res.data.data;
  700. });
  701. },
  702. addCorpType() {
  703. this.getCorpType();
  704. this.corpTypeVisible = false;
  705. },
  706. //修改提交触发
  707. editCustomer() {
  708. this.$refs.form.validate((valid, done) => {
  709. done();
  710. if (valid) {
  711. if (this.contactsData.length == 0) return this.$message.error("请添加客户联系人");
  712. if (this.data.length == 0) return this.$message.error("请添加地址信息");
  713. this.loadingBtn = true;
  714. if (!this.form.id) {
  715. this.form.checkStatus = "通过";
  716. // typeof(this.form.brandId) == 'Array' ? this.form.prandId.join(',') : this.form.brandId = ''
  717. }
  718. console.log(this.form.$brandId);
  719. if (this.form.$brandId) {
  720. this.form.brandName = this.form.$brandId.split("|").join(",");
  721. } else {
  722. this.form.brandName = null;
  723. }
  724. submit({
  725. ...this.form,
  726. code: this.form.cname,
  727. corpType: "KH",
  728. corpsAddrList: this.data,
  729. corpsFilesList: this.corpsFiles,
  730. corpsAttnList: this.contactsData,
  731. billType: 1
  732. })
  733. .then(res => {
  734. this.$message.success("保存成功");
  735. this.form = res.data.data;
  736. this.data = res.data.data.corpsAddrList;
  737. this.corpsFiles = res.data.data.corpsFilesList;
  738. this.getDetail(res.data.data.id);
  739. if (!this.form.id) {
  740. //添加成功后默认启用
  741. let data = this.form;
  742. editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
  743. this.$set(this.form, "enableOrNot", data.enableOrNot == 1 ? 0 : 1);
  744. });
  745. }
  746. })
  747. .finally(() => {
  748. this.loadingBtn = false;
  749. });
  750. } else {
  751. return false;
  752. }
  753. });
  754. },
  755. creatingUsers(row) {
  756. console.log("row", row);
  757. if (row.id) {
  758. if (row.tel) {
  759. if (!row.userId) {
  760. this.dialogVisibleBt = true;
  761. this.formDataTwo = {
  762. roleId: ["1658417787548205058"],
  763. postId: ["1742709504333688834"],
  764. deptId: [this.userObj.dept_id]
  765. };
  766. this.formRow = row;
  767. } else {
  768. this.$message.error("已经存在用户,请勿重复创建");
  769. }
  770. } else {
  771. this.$message.error("请输入手机号");
  772. }
  773. } else {
  774. this.$message.error("请保存数据后再点击");
  775. }
  776. },
  777. //新增客户联系人保存触发
  778. rowSave(row, done, loading) {
  779. if (this.data.length == 1) {
  780. this.$set(row, "defaultAddres", "1");
  781. }
  782. done(row);
  783. },
  784. //修改客户联系人触发
  785. rowUpdate(row, index, done, loading) {
  786. done(row);
  787. },
  788. //删除客户联系人触发
  789. rowDelTwo(row, index, donerowDel) {
  790. this.$confirm("确定将选择数据删除?", {
  791. confirmButtonText: "确定",
  792. cancelButtonText: "取消",
  793. type: "warning"
  794. }).then(() => {
  795. // 数据回调进行刷新
  796. if (row.id) {
  797. corpsattn(row.id).then(res => {
  798. this.$message({
  799. type: "success",
  800. message: "操作成功!"
  801. });
  802. this.contactsData.splice(index, 1);
  803. });
  804. } else {
  805. this.$message({
  806. type: "success",
  807. message: "操作成功!"
  808. });
  809. this.contactsData.splice(index, 1);
  810. }
  811. });
  812. },
  813. //返回列表
  814. backToList() {
  815. this.$emit("goBack");
  816. }
  817. }
  818. };
  819. </script>
  820. <style lang="scss" scoped>
  821. .trading-form ::v-deep .el-form-item {
  822. margin-bottom: 8px !important;
  823. }
  824. ::v-deep .el-dialog__body {
  825. padding: 0px 20px 15px 20px;
  826. }
  827. ::v-deep .el-form-item__error {
  828. display: none !important;
  829. }
  830. .el-dialog ::v-deep .el-form-item__error {
  831. display: none !important;
  832. }
  833. .img-form ::v-deep .el-form-item {
  834. height: 150px;
  835. line-height: 150px;
  836. margin-bottom: 8px !important;
  837. }
  838. .img-form ::v-deep .avue-upload__icon {
  839. font-size: 20px;
  840. width: 150px;
  841. height: 150px;
  842. line-height: 150px;
  843. }
  844. ::v-deep .el-table .cell {
  845. padding: 0 2px !important;
  846. }
  847. ::v-deep .avue-crud .el-table .el-form-item__label {
  848. left: -1px;
  849. }
  850. .addressTabs {
  851. display: flex;
  852. justify-content: center;
  853. span {
  854. width: 100px;
  855. font-size: 18px;
  856. font-weight: 600;
  857. text-align: center;
  858. }
  859. }
  860. </style>