1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button
- type="danger"
- style="border: none;background: none;color: red"
- icon="el-icon-arrow-left"
- @click="backToList"
- >返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button
- type="primary"
- @click="synchronization"
- size="small"
- :disabled="!form.id"
- >同 步
- </el-button>
- <el-button
- type="primary"
- @click="openFlow"
- size="small"
- :disabled="!form.id"
- >审 核
- </el-button>
- <el-button
- type="primary"
- :disabled="disabled"
- @click="editCustomer"
- size="small"
- >{{ form.id ? "确认修改" : "确认新增" }}
- </el-button>
- </div>
- </div>
- <div class="customer-main">
- <el-form
- :model="form"
- ref="form"
- label-width="100px"
- class="demo-ruleForm"
- >
- <containerTitle title="基础资料"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in basicData.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <avue-input-tree
- v-if="item.prop === 'corpsTypeId'"
- leaf-only
- multiple
- style="width: 100%;"
- size="small"
- :props="{ label: 'title' }"
- v-model="form[item.prop]"
- placeholder=" "
- type="tree"
- :dic="dic"
- ></avue-input-tree>
- <el-cascader
- v-else-if="item.prop === 'belongtoarea'"
- v-model="form[item.prop]"
- collapse-tags
- :options="dicArea"
- :props="props"
- size="small"
- style="width: 100%;"
- :show-all-levels="false"
- @change="addressChange"
- ></el-cascader>
- <!-- <avue-input-tree-->
- <!-- v-else-if="item.prop === 'belongtoarea'"-->
- <!-- leaf-only-->
- <!-- multiple-->
- <!-- tags-->
- <!-- style="width: 100%;"-->
- <!-- size="small"-->
- <!-- :props="{ label: 'name', value: 'name' }"-->
- <!-- v-model="form[item.prop]"-->
- <!-- placeholder=" "-->
- <!-- type="tree"-->
- <!-- :dic="dicArea"-->
- <!-- ></avue-input-tree>-->
- <el-select
- v-else-if="item.prop === 'adminProfiles'"
- size="small"
- style="width: 100%;"
- v-model="form[item.prop]"
- multiple
- placeholder=""
- >
- <el-option
- v-for="item in userList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- v-else-if="item.prop === 'creditRating'"
- size="small"
- style="width: 100%;"
- v-model="form[item.prop]"
- placeholder=""
- >
- <el-option
- v-for="item in creditRatingList"
- :key="item.id"
- :label="item.dictValue"
- :value="item.dictValue"
- >
- </el-option>
- </el-select>
- <crop-select
- v-else-if="item.prop === 'belongtocompany'"
- v-model="form[item.prop]"
- @getCorpData="getCorpName"
- corpType="GS"
- ></crop-select>
- <el-input
- type="age"
- v-else
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- :disabled="item.disabled"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="联系方式"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in contactInformation.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <el-input
- type="age"
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="财务资料"></containerTitle>
- <basic-container>
- <el-row>
- <el-col
- v-for="(item, index) in financialInformation.column"
- :key="index"
- :span="item.span ? item.span : 8"
- >
- <el-form-item
- :label="item.label"
- :prop="item.prop"
- :rules="item.rules"
- >
- <el-switch
- v-if="item.prop === 'creditstatus'"
- v-model="form[item.prop]"
- active-value="0"
- inactive-value="1"
- active-text="开启"
- inactive-text="关闭"
- >
- </el-switch>
- <el-select
- v-else-if="item.prop === 'paymentType'"
- v-model="form[item.prop]"
- clearable
- filterable
- size="small"
- style="width: 100%;"
- >
- <el-option
- v-for="(item, index) in paymentOption"
- :key="index"
- :label="item.dictValue"
- :value="item.dictValue"
- ></el-option>
- </el-select>
- <el-select
- v-else-if="item.prop === 'packageRemarks'"
- v-model="form[item.prop]"
- clearable
- filterable
- size="small"
- style="width: 100%;"
- >
- <el-option
- v-for="(item, index) in packageOptions"
- :key="index"
- :label="item.dictValue"
- :value="item.dictValue"
- ></el-option>
- </el-select>
- <el-input
- v-else
- type="age"
- v-model="form[item.prop]"
- size="small"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="客户联系人"></containerTitle>
- <basic-container>
- <avue-crud
- :option="customerContact"
- v-model="contactsForm"
- :data="contactsData"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @row-del="rowDel"
- >
- <template slot-scope="{ type, size, row }" slot="menu">
- <el-button
- icon="el-icon-check"
- :size="size"
- :type="type"
- @click="creatingUsers(row)"
- >创建用户</el-button
- >
- </template>
- </avue-crud>
- </basic-container>
- <!-- <containerTitle title="客户优势项目"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :option="advantageProject"
- v-model="advantageProjectForm"
- :data="advantageProjectData"
- @row-save="rowSaveProject"
- @row-update="rowUpdateProject"
- @row-del="rowDelProject"
- ></avue-crud>
- </basic-container> -->
- <containerTitle title="客户开户行"></containerTitle>
- <basic-container>
- <avue-crud
- :option="bankOfDeposit"
- v-model="bankOfDepositForm"
- :data="bankOfDepositData"
- @row-save="rowSaveBankOfDeposit"
- @row-update="rowUpdateBankOfDeposit"
- @row-del="rowDelBankOfDeposit"
- ></avue-crud>
- </basic-container>
- <containerTitle title="收发货地址"></containerTitle>
- <basic-container>
- <avue-crud
- :option="addressOption"
- v-model="addressForm"
- :data="addressData"
- @row-save="rowSaveAddress"
- @row-update="rowUpdateAddress"
- @row-del="rowDelAddress"
- ></avue-crud>
- </basic-container>
- </el-form>
- </div>
- <flow-dialog :switchDialog="switchDialog" @onClose="onClose()">
- <template slot="content"> </template>
- </flow-dialog>
- <el-dialog
- title="同 步"
- :visible.sync="dialogVisible"
- append-to-body
- width="60%"
- >
- <avue-form ref="formData" v-model="formData" :option="option">
- </avue-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="confirmSynchronization"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- <el-dialog
- title="创建用户"
- :visible.sync="dialogVisibleBt"
- append-to-body
- width="60%"
- >
- <avue-form ref="formDataTwo" v-model="formDataTwo" :option="optionData">
- </avue-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisibleBt = false">取 消</el-button>
- <el-button type="primary" @click="confirmSynchronizationTwo"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- customerList,
- typeSave,
- detail,
- deleteDetails,
- corpstypeTree,
- corpsattn,
- corpsbank,
- corpsfiles,
- corpsitem,
- areaTypeTree,
- corpsAddrDelete,
- synchronizationCopy,
- creatingUsers
- } from "@/api/basicData/customerInformation";
- import customerContact from "./configuration/customerContact.json";
- import advantageProject from "./configuration/advantageProject.json";
- import bankOfDeposit from "./configuration/bankOfDeposit.json";
- import flowDialog from "@/components/flow-dialog/main";
- import { customerParameter } from "@/enums/management-type";
- import { gainUser } from "@/api/basicData/customerInquiry";
- import addressOption from "./configuration/addressOption.json";
- import website from "@/config/website";
- import { getRoleTree } from "@/api/system/role";
- import { getDeptTree } from "@/api/system/dept";
- import { getPostList } from "@/api/system/post";
- export default {
- name: "detailsPage",
- data() {
- return {
- userList: [],
- formData: {},
- formDataTwo: {},
- creditRatingList:[],
- optionData: {
- span: 8,
- menuBtn: false,
- column: [
- {
- label: "所属角色",
- prop: "roleId",
- multiple: true,
- type: "tree",
- dicData: [],
- props: {
- label: "title"
- },
- checkStrictly: true,
- slot: true,
- rules: [
- {
- required: true,
- message: "请选择所属角色",
- trigger: "click"
- }
- ]
- },
- {
- label: "所属部门",
- prop: "deptId",
- type: "tree",
- multiple: true,
- dicData: [],
- props: {
- label: "title"
- },
- checkStrictly: true,
- slot: true,
- rules: [
- {
- required: true,
- message: "请选择所属部门",
- trigger: "click"
- }
- ]
- },
- {
- label: "所属岗位",
- prop: "postId",
- type: "tree",
- multiple: true,
- dicData: [],
- props: {
- label: "postName",
- value: "id"
- },
- rules: [
- {
- required: true,
- message: "请选择所属岗位",
- trigger: "click"
- }
- ]
- }
- ]
- },
- dialogVisibleBt: false,
- dialogVisible: false,
- option: {
- span: 12,
- menuBtn: false,
- column: [
- {
- label: "客户类型",
- prop: "corpType",
- type: "select",
- cascader: ["corpsTypeId"],
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=corp_type",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- rules: [
- {
- required: true,
- message: "请选择客户类型",
- trigger: "blur"
- }
- ]
- },
- {
- label: "类别",
- prop: "corpsTypeId",
- type: "tree",
- dicUrl: "/api/blade-client/corpstype/tree?&corpType={{key}}",
- props: {
- label: "title",
- value: "value"
- },
- rules: [
- {
- required: true,
- message: "请选择类型",
- trigger: "blur"
- }
- ]
- }
- ]
- },
- switchDialog: false,
- form: {},
- disabled: false,
- contactsForm: {},
- advantageProjectForm: {},
- bankOfDepositForm: {},
- contactsData: [],
- advantageProjectData: [],
- bankOfDepositData: [],
- dic: [],
- dicArea: [],
- customerContact: customerContact,
- advantageProject: advantageProject,
- bankOfDeposit: bankOfDeposit,
- contactInformation: {
- column: [
- {
- label: "联系人",
- prop: "attn",
- rules: [
- {
- required: false,
- message: "请输入联系人",
- trigger: "blur"
- }
- ]
- },
- {
- label: "联系电话",
- prop: "tel",
- rules: [
- {
- required: false,
- message: "请输入联系电话",
- trigger: "blur"
- }
- ]
- },
- {
- label: "职位",
- prop: "position",
- rules: [
- {
- required: false,
- message: "请输入联系电话",
- trigger: "blur"
- }
- ]
- },
- {
- label: "单位地址",
- prop: "addr",
- rules: [
- {
- required: false,
- message: "请输入单位地址",
- trigger: "blur"
- }
- ]
- },
- {
- label: "仓库地址",
- prop: "storageAddr",
- rules: [
- {
- required: false,
- message: "请输入仓库地址",
- trigger: "blur"
- }
- ]
- },
- {
- label: "分仓地址",
- prop: "subStorageAddr",
- rules: [
- {
- required: false,
- message: "请输入分仓地址",
- trigger: "blur"
- }
- ]
- }
- ]
- },
- financialInformation: {
- column: [
- {
- label: "账户名称",
- prop: "accountName",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "开户银行",
- prop: "accountBank",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "银行帐号",
- prop: "accountNo",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "CNAPS",
- prop: "cnaps",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "银行地址",
- prop: "localBankAddress",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币账户名称",
- prop: "accountNameFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币开户银行",
- prop: "accountBankFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币银行账号",
- prop: "accountNoFcy",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "Swift Code",
- prop: "swiftCode",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "外币银行地址",
- prop: "foreignBankAddress",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信状态",
- prop: "creditstatus",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信等级",
- prop: "creditLevel",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信额度",
- prop: "creditGrant",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信天数",
- prop: "creditDay",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "授信利率",
- prop: "creditRate",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "FOB系数",
- prop: "coefficient"
- },
- {
- label: "付款方式",
- prop: "paymentType"
- },
- {
- label: "包装要求",
- prop: "packageRemarks"
- }
- ]
- },
- basicData: {
- column: [
- {
- label: "编码",
- prop: "code",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "名称",
- prop: "cname",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "类别",
- prop: "corpsTypeId",
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "企业类型",
- prop: "companytype",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "代理品牌",
- prop: "goodtypes",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "所属公司",
- prop: "belongtocompany",
- rules: [
- {
- required: false,
- message: " ",
- trigger: "blur"
- }
- ]
- },
- {
- label: "分管员",
- prop: "adminProfiles",
- span: 8
- },
- {
- label: "代理区域",
- prop: "belongtoarea",
- span: 8,
- mock: {
- type: "county"
- }
- },
- {
- label: "信用等级",
- prop: "creditRating",
- span: 8,
- },
- // {
- // label: "总返利",
- // prop: "profitReturn",
- // disabled: true,
- // span: 8
- // },
- // {
- // label: "已用返利",
- // prop: "usedProfit",
- // disabled: true,
- // span: 8
- // },
- // {
- // label: "可用返利",
- // prop: "surplusProfit",
- // disabled: false,
- // span: 8
- // },
- // {
- // label: "可用返利",
- // prop: "monthProfit",
- // disabled: true,
- // span: 8
- // },
- {
- label: "备注",
- prop: "remarks",
- span: 24,
- mock: {
- type: "county"
- }
- }
- ]
- },
- paymentOption: [],
- addressOption: addressOption,
- addressForm: {},
- addressData: [],
- formRow: {},
- // 包装要求
- packageOptions: [],
- props: {
- value: "name",
- label: "name",
- multiple: true
- },
- addressLatLng: []
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- components: {
- flowDialog
- },
- created() {
- this.initData(website.tenantId);
- if (this.$store.getters.userInfo.tenant_id === "096359") {
- let list = ["profitReturn", "usedProfit", "surplusProfit", "monthProfit"];
- for (let item in list) {
- for (let i in this.basicData.column) {
- if (list[item] == this.basicData.column[i].prop) {
- this.basicData.column.splice(i, 1);
- }
- }
- }
- }
- corpstypeTree({ corpType: customerParameter.code }).then(res => {
- this.dic = res.data.data;
- });
- areaTypeTree().then(res => {
- this.dicArea = res.data.data;
- });
- this.getWorkDicts("packageRemarks").then(res => {
- this.packageOptions = res.data.data;
- });
- this.getWorkDicts("payment_term").then(res => {
- this.paymentOption = res.data.data;
- });
- this.getWorkDicts("credit_rating").then(res => {
- this.creditRatingList = res.data.data;
- });
- if (this.detailData.id) {
- detail(this.detailData.id).then(res => {
- if (res.data.data.adminProfiles) {
- res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
- }
- this.form = res.data.data;
- this.contactsData = this.form.corpsAttnList;
- this.bankOfDepositData = this.form.corpsBankList;
- this.advantageProjectData = this.form.corpsItems;
- this.addressLatLng = JSON.parse(this.form.addressLatLng);
- this.addressData = this.form.corpsAddrList;
- if (this.form.belongtoarea) {
- this.form.belongtoarea = this.form.belongtoarea
- .split(",")
- .map(item => item.split("/"));
- }
- delete this.form.corpsAttnList;
- delete this.form.corpsBankList;
- delete this.form.corpsItems;
- delete this.form.corpsAddrList;
- });
- } else if (this.detailData.treeDeptId) {
- this.$set(this.form, "corpsTypeId", this.detailData.treeDeptId);
- }
- gainUser().then(res => {
- this.userList = res.data.data;
- });
- },
- methods: {
- initData(tenantId) {
- getRoleTree(tenantId).then(res => {
- const column = this.findObject(this.optionData.column, "roleId");
- column.dicData = res.data.data;
- });
- getDeptTree(tenantId).then(res => {
- const column = this.findObject(this.optionData.column, "deptId");
- column.dicData = res.data.data;
- });
- getPostList(tenantId).then(res => {
- const column = this.findObject(this.optionData.column, "postId");
- column.dicData = res.data.data;
- });
- },
- addressChange() {
- this.addressLatLng = [];
- this.form.belongtoarea.forEach(e => {
- if (e.length == 1) {
- this.dicArea.forEach(item1 => {
- if (item1.provinceName == e[0]) {
- this.addressLatLng.push({
- name: item1.provinceName,
- value: this.addressLatLng.length + 1,
- lng: item1.lng,
- lat: item1.lat,
- zoom: 1
- });
- }
- });
- } else if (e.length == 3) {
- this.dicArea.forEach(item1 => {
- if (item1.provinceName == e[0]) {
- if (item1.children.length > 0) {
- item1.children.forEach(item2 => {
- if (item2.cityName == e[1]) {
- if (e[0] == e[1]) {
- if (item2.children.length > 0) {
- item2.children.forEach(item3 => {
- if (item3.districtName == e[2]) {
- this.addressLatLng.push({
- name: item3.districtName,
- value: this.addressLatLng.length + 1,
- lng: item3.lng,
- lat: item3.lat,
- zoom: 1
- });
- }
- });
- }
- } else if (e[0] != e[1]) {
- this.addressLatLng.push({
- name: item2.cityName,
- value: this.addressLatLng.length + 1,
- lng: item2.lng,
- lat: item2.lat,
- zoom: 1
- });
- }
- }
- });
- }
- }
- });
- }
- });
- this.addressLatLng= this.addressLatLng.filter((currentValue, currentIndex, selfArr) => {
- return selfArr.findIndex(x=>x.name === currentValue.name) === currentIndex
- });
- },
- //确认创建用户
- confirmSynchronizationTwo() {
- this.$refs["formDataTwo"].validate((valid, done) => {
- done();
- if (valid) {
- let data = JSON.parse(JSON.stringify(this.formDataTwo));
- data.deptId = data.deptId.join(",");
- data.roleId = data.roleId.join(",");
- data.postId = data.postId.join(",");
- creatingUsers({
- ...data,
- id: this.formRow.id
- }).then(res => {
- this.dialogVisibleBt = false;
- this.$message.success(
- "创建用户成功,默认帐号:联系人名称。默认密码:123456"
- );
- });
- } else {
- return false;
- }
- });
- },
- creatingUsers(row) {
- if (row.id) {
- if (row.tel) {
- this.dialogVisibleBt = true;
- this.formDataTwo = {};
- this.formRow = row;
- } else {
- this.$message.error("请输入手机号");
- }
- } else {
- this.$message.error("请保存数据后再点击");
- }
- },
- //新增客户联系人保存触发
- rowSave(row, done, loading) {
- console.log(row, done, loading);
- this.contactsData.push(row);
- done();
- },
- //修改客户联系人触发
- rowUpdate(row, index, done, loading) {
- done(row);
- },
- //删除客户联系人触发
- rowDel(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- // 数据回调进行刷新
- if (row.id) {
- corpsattn(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- }
- });
- },
- //新增客户优势项目保存触发
- rowSaveProject(row, done, loading) {
- console.log(row, done, loading);
- this.advantageProjectData.push(row);
- done();
- },
- //修改客户优势项目触发
- rowUpdateProject(row, index, done, loading) {
- done(row);
- },
- //删除客户优势项目触发
- rowDelProject(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpsitem(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- }
- });
- },
- //新增客户优势项目保存触发
- rowSaveBankOfDeposit(row, done, loading) {
- console.log(row, done, loading);
- this.bankOfDepositData.push(row);
- done();
- },
- //修改客户优势项目触发
- rowUpdateBankOfDeposit(row, index, done, loading) {
- done(row);
- },
- //删除客户优势项目触发
- rowDelBankOfDeposit(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpsbank(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- }
- });
- },
- //新增收发货地址保存触发
- rowSaveAddress(row, done, loading) {
- this.addressData.push(row);
- done();
- },
- //修改收发货地址优势项目触发
- rowUpdateAddress(row, index, done, loading) {
- done(row);
- },
- //删除收发货地址优势项目触发
- rowDelAddress(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- corpsAddrDelete(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.addressData.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.addressData.splice(index, 1);
- }
- });
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- this.form.corpsAttnList = this.contactsData;
- this.form.corpsBankList = this.bankOfDepositData;
- this.form.corpsItems = this.advantageProjectData;
- this.form.corpsAddrList = this.addressData;
- this.form.addressLatLng = JSON.stringify(this.addressLatLng);
- if (typeof this.form.corpsTypeId == "object") {
- this.form.corpsTypeId = this.form.corpsTypeId.join(",");
- }
- this.disabled = true;
- if (this.form.belongtoarea) {
- // this.form.belongtoarea = this.form.belongtoarea.toString();
- this.form.belongtoarea = this.form.belongtoarea
- .map(e => e.join("/"))
- .join(",");
- }
- if (this.form.adminProfiles) {
- this.form.adminProfiles = this.form.adminProfiles.join(",");
- }
- this.form.corpType = customerParameter.code;
- typeSave(this.form).then(res => {
- if (res.data.data === "error") {
- this.disabled = false;
- this.$message({
- showClose: true,
- message: res.data.msg,
- type: "error"
- });
- } else {
- this.$message({
- type: "success",
- message: this.form.id ? "修改成功!" : "新增成功!"
- });
- if (res.data.data.adminProfiles) {
- res.data.data.adminProfiles = res.data.data.adminProfiles.split(
- ","
- );
- }
- this.form = res.data.data;
- this.contactsData = res.data.data.corpsAttnList
- if (this.form.belongtoarea) {
- this.form.belongtoarea = this.form.belongtoarea.split(",").map(item => item.split("/"));
- }
- this.disabled = false;
- }
- });
- } else {
- return false;
- }
- });
- },
- synchronization() {
- this.dialogVisible = true;
- },
- //确认同步
- confirmSynchronization() {
- this.$refs["formData"].validate((valid, done) => {
- if (valid) {
- synchronizationCopy({
- ...this.formData,
- id: this.form.id
- }).then(res => {
- done();
- this.$message.success("同步成功");
- this.dialogVisible = false;
- });
- } else {
- return done();
- }
- });
- },
- backToList() {
- this.$emit("goBack");
- },
- openFlow() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- getCorpName(row) {}
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- ::v-deep .el-form-item__content {
- line-height: 32px;
- }
- </style>
|