const editConfig = page.editConfig; const editFields = _.flatMap(editConfig.sections, x => x.fields || []); const OptFlagsEnum = { NONE: 0, A: 1, U: 2, D: 3 }; //转换配置数据 (function () { page.fnameSet = new Set(); page.selectmNames = []; page.selectSMNames = []; page.oldClientName = page.client.Name; page.isNewClient = page.client.id === 0; //下拉选项数据转换大小写 for (let [k, v] of Object.entries(editConfig.selects)) { editConfig.selects[k] = editConfig.selects[k].map(x => { return { text: x.Text, value: x.Value, visible: x.Visible, disabled: x.Disabled }; }); } //输入配置处理 //1.defaults中的默认值必须在selects中存在 for (let f of editFields) { if (!f.name) continue; page.fnameSet.add(f.name); let isSelectM = f.type === 'select-m'; isSelectM && (page.selectmNames.push(f.name)); if ((isSelectM || f.type === 'select') && f.name in editConfig.selects && f.name in editConfig.defaults) { let values = editConfig.selects[f.name].map(x => x.value); if (isSelectM) { let dvalues = _.split(editConfig.defaults[f.name], ",").map(x => x.trim()).filter(x => x); editConfig.defaults[f.name] = _.intersection(dvalues, values); } else if (!values.includes(editConfig.defaults[f.name])) { editConfig.defaults[f.name] = f.appendBlank ? "" : null; } } let isSelectSM = f.type === 'select-sm'; isSelectSM && (page.selectSMNames.push(f.name)); } //其他项默认值 let items = editConfig.selects['文件类型']; items && items.length && (page.file.FileTypeName = items[0].value); items = editConfig.selects['权益类签署版本']; items && items.length && (page.file.SignType = items[0].value); page.file.ReportorRole = "甲方"; page.file.SideProtocolNumber = ''; //所属机构排除当前客户 page.client.id > 0 && _.remove(editConfig.selects.ParentId, x => page.client.id === parseInt(x.value)); }()); //客户数据帮助类 const clientHelper = (new function () { //page.selectmNames已经有值的情况下调用 //转换为编辑用的数据 this.convertToEditData = function (client) { let TradingInstType = parseInt(client.TradingInstType) || 0, types = []; for (let a of [1, 2, 4, 8, 16]) { (TradingInstType & a) > 0 && types.push(a.toString()); } client.TradingInstType = types.join(","); let meta = client.MetaDic || {}; Object.keys(meta).forEach(x => { client['meta_' + x] = meta[x]; }); for (let f of editFields) { if (!f.name || !(f.name in client)) continue; if (f.type === 'select-m') { (client[f.name] = _.split(client[f.name], ",")); } else if (f.type === 'date') { client[f.name] && (client[f.name] = client[f.name].substring(0, 10)); } else if (f.type === 'select') { f.appendBlank && !client[f.name] && (client[f.name] = ''); } else if (f.type === 'select-sm') { (client[f.name] = _.split(client[f.name], ",")); } } return client; }; //转换为保存用的数据(会对client深度改造所以最好传入克隆对象) this.convertToSaveData = function (client) { client.TradingInstType = (client.TradingInstType || []).reduce((acc, cur) => acc | parseInt(cur), 0); for (var name of page.selectmNames) { name in client && Array.isArray(client[name]) && (client[name] = client[name].join(",")); } for (var name of page.selectSMNames) { name in client && Array.isArray(client[name]) && (client[name] = client[name].join(",")); } client.MetaDic = editFields.reduce((acc, cur) => { if (cur.name && cur.name.startsWith('meta_')) { acc[cur.name.substring(5)] = client[cur.name]; } return acc; }, {}); return client; }; //转换为查看用的数据 this.convertToViewData = function (client) { let arr = editConfig.selects["ParentId"]; Array.isArray(arr) && arr.unshift({ value: '0', text: ' ' }); let TradingInstType = parseInt(client.TradingInstType) || 0, types = []; for (let a of [1, 2, 4, 8, 16]) { (TradingInstType & a) > 0 && types.push(a.toString()); } client.TradingInstType = types.join(","); let meta = client.MetaDic || {}; Object.keys(meta).forEach(x => { client['meta_' + x] = meta[x]; }); for (let f of editFields) { if (!f.name || !(f.name in client)) continue; if (f.type === 'select-m') { client[f.name] = _.split(client[f.name], ",").map(x => { return (_.find(editConfig.selects[f.name], y => y.value === x) || "").text || x; }).join(","); } else if (f.type === 'date') { client[f.name] && (client[f.name] = client[f.name].substring(0, 10)); } else if (f.type === 'select') { let value = _.toString(client[f.name]); if (value) { client[f.name] = (_.find(editConfig.selects[f.name], y => y.value === value) || "").text || client[f.name]; } } else if (f.type === 'select-sm') { client[f.name] = _.split(client[f.name], ",").map(x => { return (_.find(editConfig.selects[f.name], y => y.value === x) || "").text || x; }).join(","); } } return client; }; //注册资本|产品规模 this.labelOfRegisteredCapital = function (client) { return client && client.ClientType !== "产品" ? "注册资本(万元)" : page.company === "海通" ? "产品规模(元)" : "产品规模(万元)"; }; }()); //转换客户数据 (function () { if (page.isNewClient) { Object.assign(page.client, editConfig.defaults); } else if (page.isView) { clientHelper.convertToViewData(page.client); } else { clientHelper.convertToEditData(page.client); } }()); //上一步下一步管理器 const flowMgr = (new function () { var _curTabIndex = 0; this.getTab = function (tabIndex) { if (_curTabIndex === tabIndex) return; page.isNewClient && main.message("请先保存客户基本信息"); _curTabIndex = tabIndex || 0; let $cur = $('#flowList').children(':eq(' + _curTabIndex + ')'); //if (page.client.ProcessStatus && page.client.ProcessStatus !== "未提交") { // $('#flowList').children().addClass("checked"); //} //else { // $cur.nextAll().removeClass("current checked"); // $cur.prevAll().removeClass("current").addClass("checked"); //} $cur.nextAll().removeClass("current checked"); $cur.prevAll().removeClass("current").addClass("checked"); $cur.removeClass("checked").addClass("current"); $("#myTab").children(':eq(' + _curTabIndex + ')').find("a").tab('show'); }; this.flowNext = function () { let nextIndex = _curTabIndex + 1; if (nextIndex === $('#flowList').children("div:visible").length) { return main.message("已到达最后一步,无法下一步"); } this.getTab(nextIndex); }; this.flowBack = function () { let preIndex = _curTabIndex - 1; if (preIndex < 0) { return main.message("已到达第一步,无法上一步"); } this.getTab(preIndex); }; this.init = function () { $("#myTab").children(':eq(0)').find("a").tab('show'); }; }()); //vue-flatPicker控件 VueFlatpickr.install(Vue); //银行卡管理(需要和client vue集成) const bankcardVue = (function () { return { data: { bankcard: _.cloneDeep(page.bankcard), bankcardList: editConfig.lists.bankcardList }, methods: { addBankCard() { if (!this.client.id) { return main.alert("请先保存用户基本信息"); } if (this.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } Object.assign(this.bankcard, page.bankcard, { ClientId: this.client.id, ClientName: this.client.Name, ValidState: 'Valid' }); $('#clientBankCardEditModal').modal('show'); }, editBankCard(enid) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } main.post('/bankcard/AjaxGetBankcardDetail?enid=' + enid).done(function (resp) { Object.assign(self.bankcard, resp.obj); $('#clientBankCardEditModal').modal('show'); }).fail(function () { main.alert('获取银行卡信息出错,请重新尝试!'); }); }, saveBankCard() { let arr = []; !_.trim(this.bankcard.Bank) && arr.push('开户行'); !_.trim(this.bankcard.Card) && arr.push('账号'); !_.trim(this.bankcard.ClientName) && arr.push('户名'); if (arr.length) { return main.alert(arr.join(",") + " 必须填写"); } let self = this; let fn = function (inProcess) { main.post("/bankcard/AjaxSaveBankCard", { req: self.bankcard, isDirectSubApp: pageData.isDirectSubApp }).done(function (resp) { resp = resp.obj; if (self.bankcard.id) { let index = self.bankcardList.findIndex(x => x.id === self.bankcard.id); Object.assign(self.bankcardList[index], resp.bankcard); } else { self.bankcardList.push(resp.bankcard); } Object.assign(self.client, resp.client); $('#clientBankCardEditModal').modal('hide'); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } }); }; if (new Array("已开户", "已休眠").includes(this.client.ProcessStatus) && page.clientApprovalProcessCount > 0 && page.isView) { main.confirm("银行卡变更,客户需要重新审批,确认提交?", fn.bind(this, true)); } else { fn(); } }, removeBankCard(enid) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } let inProcess = new Array("已开户", "已休眠").includes(this.client.ProcessStatus) && page.clientApprovalProcessCount > 0 && page.isView; let msg = (inProcess ? "删除客户银行卡,客户需要重新审批," : "") + "确定作废吗?"; main.confirmPost(msg, "/bankcard/AjaxInvalidBankcard?enid=" + enid + "&isDirectSubApp=" + pageData.isDirectSubApp).done(function (resp) { resp = resp.obj; let index = self.bankcardList.findIndex(x => x.id === resp.bankcard.id); Object.assign(self.bankcardList[index], resp.bankcard); Object.assign(self.client, resp.client); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } }); }, refreshBankCards() { let self = this; var isApproval = pageData.isApproval; if (!page.isView) { isApproval = true; } main.post('/bankcard/AjaxGetBankcardList?clientId=' + this.client.id + "&isApproval=" + isApproval).done(function (resp) { self.bankcardList = resp.obj; }).fail(function () { main.message("获取银行卡信息列表失败"); }); }, formatCardNum(cardnum) { return _.toString(cardnum).replace(/(\d{4}(?!$))/g, "$1 "); } } }; }()); //人员信息管理(需要和vue集成) const dutyVue = (function () { const IdCardTypeMap = (function () { let map = {}; let items = editConfig.selects['IdCardType']; items && items.reduce((acc, cur) => { map[cur.value] = cur.text; return map; }, map); return map; }()); //是否接受相关邮件 if (true) { } page.duty.IsReceiveEmail = "1"; page.duty.IdCardType = 1; return { data: { duty: _.cloneDeep(page.duty), dutyList: editConfig.lists.dutyList }, mounted() { $('#duty_ContactTypeId').selectpicker(); }, methods: { addDuty() { if (!this.client.id) { return main.alert("请先保存用户基本信息"); } if (this.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } $('#duty_ContactTypeId').selectpicker('val', []); Object.assign(this.duty, page.duty, { ClientId: this.client.id }); $('#clientDutyEditModal').modal('show'); }, editDuty(enid) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } main.post('/clientduty/AjaxGetDutyDetail?enid=' + enid).done(function (resp) { Object.assign(self.duty, resp.obj); !self.duty.IsReceiveEmail && (self.duty.IsReceiveEmail = "0"); self.duty.ContactTypeId = _.split(self.duty.ContactTypeId, ","); _.trim(self.duty.IdCardDate) && (self.duty.IdCardDate = self.duty.IdCardDate.substring(0, 10)); _.trim(self.duty.DeadLine) && (self.duty.DeadLine = self.duty.DeadLine.substring(0, 10)); _.trim(self.duty.AuthorizeEndDate) && (self.duty.AuthorizeEndDate = self.duty.AuthorizeEndDate.substring(0, 10)); _.trim(self.duty.IdCardStartDate) && (self.duty.IdCardStartDate = self.duty.IdCardStartDate.substring(0, 10)); _.trim(self.duty.IdCardEffectiveDate) && (self.duty.IdCardEffectiveDate = self.duty.IdCardEffectiveDate.substring(0, 10)); $('#duty_ContactTypeId').selectpicker('val', self.duty.ContactTypeId); $('#clientDutyEditModal').modal('show'); if (self.duty.IdCardEffectiveDateStr == "30001231") { $("#IdCardEffectiveDateStr").show(); $("#IdCardEffectiveDate").hide(); $("#clickLongOrShort").text("短期"); } else { $("#IdCardEffectiveDateStr").hide(); $("#IdCardEffectiveDate").show(); $("#clickLongOrShort").text("长期"); } }).fail(function () { main.alert('获取人员信息出错,请重新尝试!'); }); }, saveDuty() { let arr = []; !_.trim(this.duty.ContactName) && arr.push('姓名'); !_.trim(this.duty.ContactTypeId) && arr.push('职责类型'); if (arr.length) { return main.alert(arr.join(",") + " 必须填写"); } if (_.trim(this.duty.IdCardStartDate)) { this.duty.IdCardStartDateStr = new Date(this.duty.IdCardStartDate.substr(0, 10)).Format("yyyyMMMdd"); } if (_.trim($("#IdCardEffectiveDate").val()) == "" && $("#clickLongOrShort").text() == "长期") { this.duty.IdCardEffectiveDateStr = ""; this.duty.IdCardEffectiveDate = ""; } else { if (_.trim(this.duty.IdCardEffectiveDate) || $("#clickLongOrShort").text() == "短期") { if ($("#clickLongOrShort").text() != "长期") { this.duty.IdCardEffectiveDateStr = "30001231" } else { this.duty.IdCardEffectiveDateStr = new Date(this.duty.IdCardEffectiveDate.substr(0, 10)).Format("yyyyMMMdd"); } } } if (_.trim($("#AuthorizeEffectiveEndDate").val()) == "" && $("#clickLongOrShort_Authorize").text() == "长期") { this.duty.AuthorizeEffectiveEndDateStr = ""; this.duty.AuthorizeEffectiveEndDate = ""; } else { if (_.trim(this.duty.AuthorizeEffectiveEndDate) || $("#clickLongOrShort_Authorize").text() == "短期") { if ($("#clickLongOrShort_Authorize").text() != "长期") { this.duty.AuthorizeEffectiveEndDateStr = "30001231" } else { this.duty.AuthorizeEffectiveEndDateStr = new Date(this.duty.AuthorizeEffectiveEndDate.substr(0, 10)).Format("yyyyMMMdd"); } } } let self = this, clone = _.cloneDeep(this.duty); clone.ContactTypeId = clone.ContactTypeId ? clone.ContactTypeId.join(",") : ""; main.post("/clientduty/clientdutyEditJson", { req: clone, isDirectSubApp: pageData.isDirectSubApp }).done(function (resp) { if (self.duty.id) { let index = self.dutyList.findIndex(x => x.id === self.duty.id); Object.assign(self.dutyList[index], resp.obj); } else { self.dutyList.push(resp.obj); } if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } $('#clientDutyEditModal').modal('hide'); }); }, removeDuty(enid) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } main.confirmPost("确定删除吗?", "/clientduty/AjaxRemoveClientDuty", { enid: enid, isDirectSubApp: pageData.isDirectSubApp }).done(function (resp) { let index = self.dutyList.findIndex(x => x.id === resp.obj.id); self.dutyList.splice(index, 1); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } }); }, refreshDutys() { let self = this; var isApproval = pageData.isApproval; if (!page.isView) { isApproval = true; } main.post('/clientduty/AjaxGetDutyList?clientId=' + this.client.id + "&isApproval=" + isApproval).done(function (resp) { self.dutyList = resp.obj; }).fail(function () { main.message("获取人员信息列表失败"); }); }, changeContactTypeId() { if ($("#duty_ContactTypeId option:contains(约定收件人)").length > 0) { this.duty.IsReceiveEmail = $("#duty_ContactTypeId :selected:contains(约定收件人)").length + ''; } }, clickLongOrShort(id) { if (id == "IdCard") { if ($("#clickLongOrShort_IdCard").text() == "长期") { $("#IdCardEffectiveDateStr").show(); $("#IdCardEffectiveDate").hide(); $("#clickLongOrShort_IdCard").text("短期"); } else { $("#IdCardEffectiveDateStr").hide(); $("#IdCardEffectiveDate").show(); $("#clickLongOrShort_IdCard").text("长期"); } } else if (id == "Authorize") { if ($("#clickLongOrShort_Authorize").text() == "长期") { $("#AuthorizeEffectiveEndDateStr").show(); $("#AuthorizeEffectiveEndDate").hide(); $("#clickLongOrShort_Authorize").text("短期"); } else { $("#AuthorizeEffectiveEndDateStr").hide(); $("#AuthorizeEffectiveEndDate").show(); $("#clickLongOrShort_Authorize").text("长期"); } } }, dateFormat(v, f) { if (v == null || v == '') { return ''; } if (!f) { f = 'YYYY-MM-DD'; } var m = new moment(v); if (m.year() < 1910) { return ''; } return new moment(v).format(f); } }, computed: { dutyList2() { return this.dutyList.map(x => { let a = _.cloneDeep(x); a.IdCardType = IdCardTypeMap[a.IdCardType]; a.PhoneNumber = _.split(a.PhoneNumber, ","); _.trim(a.IdCardDate) && (a.IdCardDate = a.IdCardDate.substring(0, 10)); _.trim(a.DeadLine) && (a.DeadLine = a.DeadLine.substring(0, 10)); _.trim(a.AuthorizeEndDate) && (a.AuthorizeEndDate = a.AuthorizeEndDate.substring(0, 10)); a.EmailStr = (a.Email || "").replace(/[;|;|,|,]/g, ";\r\n"); a.ContactTypeStr = (a.ContactType || "").replace(/,/g, ",\r\n"); _.trim(a.IdCardStartDate) && (a.IdCardStartDate = a.IdCardStartDate.substring(0, 10)); _.trim(a.IdCardEffectiveDate) && (a.IdCardEffectiveDate = a.IdCardEffectiveDate.substring(0, 10)); return a; }); }, isIdCardDate() { if (page.company == "浙期") { return true; } return false; } } }; }()); //股东董事会成员信息 const dutydirectorVue = (function () { const IdCardTypeMap = (function () { let map = {}; let items = editConfig.selects['IdCardType']; items && items.reduce((acc, cur) => { map[cur.value] = cur.text; return map; }, map); return map; }()); const ShareholdingByShareholdersTypeMap = (function () { let map = {}; let items = editConfig.selects['ShareholdingByShareholdersType']; items && items.reduce((acc, cur) => { map[cur.value] = cur.text; return map; }, map); return map; }()); const ManagementIdentityMap = (function () { let map = {}; let items = editConfig.selects['ManagementIdentity']; items && items.reduce((acc, cur) => { map[cur.value] = cur.text; return map; }, map); return map; }()); const IdentityOfTheBoardOfDirectorsMap = (function () { let map = {}; let items = editConfig.selects['IdentityOfTheBoardOfDirectors']; items && items.reduce((acc, cur) => { map[cur.value] = cur.text; return map; }, map); return map; }()); return { data: { dutydirector: _.cloneDeep(page.dutydirector), dutydirectorList: editConfig.lists.dutydirectorList }, mounted() { $('#duty_ContactTypeId').selectpicker(); }, methods: { editDutyDirector(enid) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } main.post('/clientduty/AjaxGetDutyDetail?enid=' + enid).done(function (resp) { Object.assign(self.dutydirector, resp.obj); !self.dutydirector.IsReceiveEmail && (self.dutydirector.IsReceiveEmail = "0"); self.dutydirector.ContactTypeId = _.split(self.dutydirector.ContactTypeId, ","); _.trim(self.dutydirector.IdCardDate) && (self.dutydirector.IdCardDate = self.dutydirector.IdCardDate.substring(0, 10)); _.trim(self.dutydirector.DeadLine) && (self.dutydirector.DeadLine = self.dutydirector.DeadLine.substring(0, 10)); _.trim(self.dutydirector.AuthorizeEndDate) && (self.dutydirector.AuthorizeEndDate = self.dutydirector.AuthorizeEndDate.substring(0, 10)); _.trim(self.dutydirector.IdCardStartDate) && (self.dutydirector.IdCardStartDate = self.dutydirector.IdCardStartDate.substring(0, 10)); _.trim(self.dutydirector.IdCardEffectiveDate) && (self.dutydirector.IdCardEffectiveDate = self.dutydirector.IdCardEffectiveDate.substring(0, 10)); if (self.dutydirector.IsShareholder) { $("#ShareholdingByShareholdersRatiodiv").show(); $("#ShareholdingByShareholdersTypediv").show(); } else { $("#ShareholdingByShareholdersRatiodiv").hide(); $("#ShareholdingByShareholdersTypediv").hide(); } $('#duty_ContactTypeId').selectpicker('val', self.dutydirector.ContactTypeId); $('#clientDirectorDutyEditModal').modal('show'); }).fail(function () { main.alert('获取人员信息出错,请重新尝试!'); }); }, saveDutyDirector() { let arr = []; !_.trim(this.dutydirector.ContactName) && arr.push('姓名'); !_.trim(this.dutydirector.ContactTypeId) && arr.push('职责类型'); !_.trim(this.dutydirector.ManagementIdentity) && arr.push('管理层身份'); !_.trim(this.dutydirector.IdentityOfTheBoardOfDirectors) && arr.push('董事会身份'); !_.trim(this.dutydirector.IsShareholder) && arr.push('是否股东'); if (_.trim(this.dutydirector.IsShareholder) && this.dutydirector.IsShareholder.toString() == "true") { !_.trim(this.dutydirector.ShareholdingByShareholdersType) && arr.push('股东持股类型'); !_.trim(this.dutydirector.ShareholdingByShareholdersRatio) && arr.push('股东持股比例'); } if (arr.length) { return main.alert(arr.join(",") + " 必须填写"); } this.dutydirector.ShareholdingByShareholdersRatio = parseFloat(this.dutydirector.ShareholdingByShareholdersRatio); if (_.trim(this.dutydirector.ShareholdingByShareholdersRatio) && (this.dutydirector.ShareholdingByShareholdersRatio < 0 && this.dutydirector.ShareholdingByShareholdersRatio > 100)) { return main.alert('股东持股比例必须大于等于0并小于等于100!'); } let self = this, clone = _.cloneDeep(this.dutydirector); main.post("/clientduty/clientdutyEditJson", clone).done(function (resp) { if (self.dutydirector.id) { let index = self.dutydirectorList.findIndex(x => x.id === self.dutydirector.id); Object.assign(self.dutydirectorList[index], resp.obj); } else { self.dutydirectorList.push(resp.obj); } $('#clientDirectorDutyEditModal').modal('hide'); }); }, refreshDutysDirector() { let self = this; main.post('/clientduty/AjaxGetDirectorDutyList?clientId=' + this.client.id).done(function (resp) { self.dutydirectorList = resp.obj; }).fail(function () { main.message("获取人员信息列表失败"); }); }, changeIsShareholder() { //IsShareholder if ($("#IsShareholder").val() == "true") { $("#ShareholdingByShareholdersRatiodiv").show(); $("#ShareholdingByShareholdersTypediv").show(); } else { $("#ShareholdingByShareholdersRatiodiv").hide(); $("#ShareholdingByShareholdersTypediv").hide(); } } }, computed: { dutyList3() { return this.dutydirectorList.map(x => { let a = _.cloneDeep(x); a.IdCardType = IdCardTypeMap[a.IdCardType]; a.ShareholdingByShareholdersType = ShareholdingByShareholdersTypeMap[a.ShareholdingByShareholdersType]; a.ManagementIdentity = ManagementIdentityMap[a.ManagementIdentity]; a.IdentityOfTheBoardOfDirectors = IdentityOfTheBoardOfDirectorsMap[a.IdentityOfTheBoardOfDirectors]; a.IsShareholder = a.IsShareholder == true ? "是" : "否"; a.PhoneNumber = _.split(a.PhoneNumber, ","); _.trim(a.IdCardDate) && (a.IdCardDate = a.IdCardDate.substring(0, 10)); _.trim(a.IdCardStartDate) && (a.IdCardStartDate = a.IdCardStartDate.substring(0, 10)); _.trim(a.DeadLine) && (a.DeadLine = a.DeadLine.substring(0, 10)); _.trim(a.AuthorizeEndDate) && (a.AuthorizeEndDate = a.AuthorizeEndDate.substring(0, 10)); _.trim(a.IdCardStartDate) && (a.IdCardStartDate = a.IdCardStartDate.substring(0, 10)); _.trim(a.IdCardEffectiveDate) && (a.IdCardEffectiveDate = a.IdCardEffectiveDate.substring(0, 10)); a.EmailStr = (a.Email || "").replace(/[;|;|,|,]/g, ";\r\n"); a.ContactTypeStr = (a.ContactType || "").replace(/,/g, ",\r\n"); if ($("#IsShareholder").val() == "true") { $("#ShareholdingByShareholdersRatiodiv").show(); $("#ShareholdingByShareholdersTypediv").show(); } else { $("#ShareholdingByShareholdersRatiodiv").hide(); $("#ShareholdingByShareholdersTypediv").hide(); } return a; }); }, isIdCardDate() { if (page.company == "浙期") { return true; } return false; } } }; }()); //客户文件管理 const fileVue = (function () { const maxAllowedContentLength = page.maxRequestLength * 1024; const protocolTypes = new Array("主协议附件(PDF)", "补充协议附件(PDF)", "履约协议附件(PDF)", "代签产品附件(PDF)"); const fileSearchObj = Object.freeze({ fileTypes: [], fileName: "", fileDate: "" }); function getGroupKey(file, files) { if (file.MainProtocolNumber) { if (file.FileTypeName !== "履约协议附件(PDF)") return file.MainProtocolNumber; let mfile = files.find(o => o.ProtocolNumber === file.MainProtocolNumber); return mfile ? mfile.MainProtocolNumber : file.MainProtocolNumber; } return file.FileTypeName === "主协议附件(PDF)" ? file.ProtocolNumber : file.FileName; } return { data: { groupingFiles: [], orderByStr: "", orderByFieldStr: "", file: _.clone(page.file), fileList: editConfig.lists.fileList, parentFileList: editConfig.lists.parentFileList, fileSearch: { ...fileSearchObj }, fileSearchCur: { ...fileSearchObj }, //记录筛选按钮点击时的条件数据 dateTimePicker: { enableTime: true, dateFormat: 'Y-m-d H:i', allowInput: true, time_24hr: true, static: true }, viewState: { fileUpdateKey: 0 } }, mounted() { $('#search_fileTypes').selectpicker({ actionsBox: true }); let doneFn = function (e, data) { if (!data.result.success) { return main.message(data.result.msg); } let obj = data.result.obj; this.fileList = obj.fileList; obj.ret && main.alert(obj.ret); $('#uploadfile').val(''); $('#clientFileEditModal').modal('hide'); this.orderTableByField("", this.orderByStr); }; let formDataFn = function () { let file = this.file; return Object.keys(file).map(key => { return { name: key, value: file[key] || '' }; }); }; $('#uploadfile').fileupload({ dataType: 'json', url: "/client/UploadFilesV2?clientEnId=" + page.client.EncryptId + "&isDirectSubApp=" + pageData.isDirectSubApp, replaceFileInput: false, singleFileUploads: false, autoUpload: false, formData: formDataFn.bind(this), progressall: function (e, data) { let progress = parseInt(data.loaded / data.total * 100, 10) + '%'; setUploadProgress(progress); }, send() { showUploadProgress(); }, done: doneFn.bind(this), fail(e, data) { main.alert('提交失败'); }, always() { hideUploadProgress(); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } } }); this.orderTableByField("", this.orderByStr); }, methods: { addFile() { if (!this.client.id) { return main.alert("请先保存用户基本信息"); } if (this.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } let nowTime = this.fileNowTime(); Object.assign(this.file, page.file, { ClientId: this.client.id, OptDate: nowTime }); $('#uploadfile').val(''); fileVue.data.parentFileList = []; $('#clientFileEditModal').modal('show'); if (pageData.is华西) { this.parentFileList = []; let self = this; let clientId = $('#ef_ParentId').val(); if (!pageData.IsEdit) { clientId = page.client.id; } $.ajax({ type: "Post", url: "/client/AjaxGetClientFilesV3", data: { clientId: clientId, IsEdit: pageData.IsEdit == true ? true : false }, success: function (data) { if (data.success == true) { self.parentFileList = data.obj; } }, error: function (msg) { alert("error:" + msg); } }); } }, getFileLength(length) { var units = ["M", "G", "T"]; var unit = "K"; for (var i = 0; length > 1024 && i < units.length; i++) { length = length / 1024; unit = units[i]; } return parseInt(length) + unit; }, checkSubmit(files) { if (!files.length) { return "没有选择上传文件"; } if (page.isSecuritiesEnvironment && protocolTypes.includes(this.file.FileTypeName)) { for (let f of files) { if (f.size > page.maxAnnexLength) { return "主协议附件,补充协议附件,履约预付金附件,代签产品附件 单个附件大小不可以超过30M"; } if (f.type !== "application/pdf") { return "主协议附件,补充协议附件,履约预付金附件,代签产品附件 只能上传pdf文档"; } } } let totalSize = Array.from(files).reduce((sum, cur) => { return sum + cur.size }, 0); if (totalSize > maxAllowedContentLength) { var maxSize = this.getFileLength(page.maxRequestLength); return "文件过大,请勿传输超过" + maxSize + "文件"; } let req = this.file, check2 = true; switch (req.FileTypeName) { case "主协议附件(PDF)": if (!_.trim(req.SignType)) { return "主协议附件签署版本未填写"; } if (!_.trim(req.ReportorRole)) { return "主协议附件填报方角色未填写"; } req.MainProtocolNumber = ''; req.SideProtocolNumber = ''; break; case "履约协议附件(PDF)": if (!_.trim(req.SideProtocolNumber)) { return "履约协议附件补充协议编号未填写"; } break; case "补充协议附件(PDF)": if (!_.trim(req.MainProtocolNumber)) { return "主协议编号未填写"; } break; case "代签产品附件(PDF)": if (!_.trim(req.MainProtocolNumber)) { return "主协议编号未填写"; } if (!_.trim(req.ProtocolNumber)) { return "协议编号未填写"; } break; default: check2 = false; break; } if (check2) { if (!_.trim(req.ProtocolNumber) && !pageData.is华西) { return "协议编号未填写"; } if (!_.trim(req.SignDate)) { return "签署日期未填写"; } } }, saveFile() { let files = $('#uploadfile').prop('files'); let message = this.checkSubmit(files); if (message) { return main.alert(message); } $('#uploadfile').fileupload('send', { files: files }); }, //重置筛选 resetFiles() { this.fileSearch = { ...fileSearchObj }; this.fileSearchCur = { ...fileSearchObj }; $('#search_fileTypes').selectpicker('deselectAll'); }, //刷新列表 refreshFiles() { let self = this; var isApproval = pageData.isApproval; if (!page.isView) { isApproval = true; } main.post("/client/AjaxGetClientFilesV2", { clientEnId: page.client.EncryptId, isApproval: isApproval }).done(function (res) { self.fileList = res.obj; self.resetFiles(); }); }, //文件筛选 filterFiles() { Object.assign(this.fileSearchCur, this.fileSearch); this.orderTableByField("", this.orderByStr); }, //当前时间 fileNowTime() { return moment().format("YYYY-MM-DD HH:mm"); }, //当前日期 fileNowDay() { return moment().format("YYYY-MM-DD"); }, //下载文件 downloadFile(item) { //var url = "/client/DownloadClientFile?clientId=" + page.client.EncryptId + "&fileName=" + item.FileNameBak; //window.open(url); main.formOpenNewPage("/client/DownloadClientFile", { clientId: page.client.EncryptId, fileName: item.FileNameBak, fileid: item.EncryptId }); }, //预览文件 showFile(item) { main.post("/client/ShowClientFile", { clientId: page.client.EncryptId, fileName: item.FileNameBak }).done(function (res) { window.open(res.obj); }); }, //废弃文件 abandonFile(item) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } let alert = "警告:一但废止文件被报送后将无法解除废止,是否仍要废止?" + (item.ProtocolNumber ? "(协议文件废止将重新审批)" : ""); main.confirm(alert, function () { main.post("/client/AbandonFile", { clientId: page.client.EncryptId, protocolNumber: item.ProtocolNumber }).done(function (res) { self.refreshFiles(); }); }); }, //移除文件 removeFile(item) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } let alert = (item.FileTypeName === '主协议附件(PDF)' ? "删除该主协议,将同时删除和其关联的废弃已报送协议文件," : "") + "确定删除‘" + item.FileName + "’吗?" + (item.ProtocolNumber ? "(协议文件删除将重新审批)" : ""); main.confirm(alert, function () { main.post("/client/DeleteFile", { clientId: page.client.EncryptId, fileName: item.FileNameBak, protocolNumber: item.ProtocolNumber, isDirectSubApp: pageData.isDirectSubApp }).done(function (res) { let index = self.fileList.findIndex(x => x.id === item.id); self.fileList.splice(index, 1); self.orderTableByField("", this.orderByStr); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } }); }); }, //还原文件 recoverFile(item) { let self = this; if (self.client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } let alert = "还原文件将无法回到现在的状态,确认还原‘" + item.FileName + "’?" + (item.ProtocolNumber ? "(协议文件还原将重新审批)" : ""); main.confirm(alert, function () { main.post("/client/RecoverFile", { clientId: page.client.EncryptId, fileName: item.FileNameBak, protocolNumber: item.ProtocolNumber, isDirectSubApp: pageData.isDirectSubApp }).done(function (res) { self.refreshFiles(); if (pageData.isDirectSubApp) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } }); }); }, //文件管理表格按照标题头排序 orderTableByField(fieldName, orderBy) { this.orderByFieldStr = fieldName; this.orderByStr = orderBy; let self = this, search = this.fileSearchCur; let searchFileName = _.trim(search.fileName), searchFileDate = _.trim(search.fileDate); let files = this.fileList.filter(file => { let bl = !search.fileTypes.length || file.FileTypeName && (search.fileTypes.includes(file.FileTypeName)); if (bl && searchFileName) { bl = file.FileName.substring(0, file.FileName.lastIndexOf('.')).toLowerCase().includes(searchFileName.toLowerCase()); } return bl && (!searchFileDate || _.trim(file.OptDate).startsWith(searchFileDate)); }); files = _.sortBy(files, file => { let index = protocolTypes.findIndex(y => file.FileTypeName === y) + 1; return index + "^" + file.FileTypeName + "^" + file.OptDate; }); let keys = [], values = []; files = _.groupBy(files, file => { let key = getGroupKey(file, files); !keys.includes(key) && keys.push(key); return key; }); //不要用for..in,因为底层库的array扩展方法一直没清除掉 for (let i = 0; i < keys.length; i++) { let bgClass = 'bg' + (i % 2); files[keys[i]].forEach(file => { values.push(file); file.bgClass = bgClass; }); } this.viewState.fileUpdateKey++; //为了更新tips let tableData = values.map(file => { let fileName = _.trim(file.FileName); let show = Object.assign({ ...file }, { HasSentDrop: file.HasSent && file.OptState === OptFlagsEnum.D, FileTypeName: file.FileTypeName, FileName: fileName.substring(0, fileName.lastIndexOf('.')), SignDate: file.SignDate ? file.SignDate.substring(0, 10) : '', FileDesc: file.FileDesc, BookTime: file.BookTime ? file.BookTime : '', MainProtocolNumber: _.trim(file.MainProtocolNumber), CanDelete: !_.trim(file.ProtocolNumber) || (!file.HasSent && file.OptState === OptFlagsEnum.A), CanDrop: _.trim(file.ProtocolNumber) && file.HasSent && file.OptState !== OptFlagsEnum.D, CanBack: _.trim(file.FlagStr).includes('#CB#'), FileNameBak: encodeURI(file.FileName)//防止文件名中包含&等url中非法字符; }); return show; }); if (fieldName === '') { this.groupingFiles = tableData; } else { if (fieldName === 'FileTypeName') { this.groupingFiles = _.orderBy(tableData, ['FileTypeName'], [this.orderByStr]); } else if (fieldName === 'FileName') { this.groupingFiles = _.orderBy(tableData, ['FileName'], [this.orderByStr]); } else if (fieldName === 'FileDesc') { this.groupingFiles = _.orderBy(tableData, ['FileDesc'], [this.orderByStr]); } else if (fieldName === 'ProtocolNumber') { this.groupingFiles = _.orderBy(tableData, ['ProtocolNumber'], [this.orderByStr]); } else if (fieldName === 'SignDate') { this.groupingFiles = _.orderBy(tableData, ['SignDate'], [this.orderByStr]); } else if (fieldName === 'BookTime') { this.groupingFiles = _.orderBy(tableData, ['BookTime'], [this.orderByStr]); } } } }, computed: { showFileBookTime() { if (this.file.FileTypeName === "双录视频文件") { this.file.BookTime = this.fileNowDay(); return true; } this.file.BookTime = ''; return false; }, showFileSignDate() { switch (this.file.FileTypeName) { default: this.file.SignDate = ''; return false; case "主协议附件(PDF)": case "补充协议附件(PDF)": case "履约协议附件(PDF)": case "代签产品附件(PDF)": return true; } }, showFileProtocolNumber() { switch (this.file.FileTypeName) { default: this.file.ProtocolNumber = ''; return false; case "主协议附件(PDF)": case "补充协议附件(PDF)": case "履约协议附件(PDF)": case "代签产品附件(PDF)": return true; } }, showFileMainProtocolNumber() { switch (this.file.FileTypeName) { default: this.file.MainProtocolNumber = ''; return false; case "补充协议附件(PDF)": case "履约协议附件(PDF)": case "代签产品附件(PDF)": this.file.MainProtocolNumber = this.mainProtocolNumberItems[0]; return true; } }, showParentMainProtocalNumber() { return _.trim(this.client.ParentId) && pageData.is华西 && this.file.FileTypeName == '主协议附件(PDF)'; }, showFileSideProtocolNumber() { if (this.file.FileTypeName === "履约协议附件(PDF)") { return true; } this.file.SideProtocolNumber = ''; return false; }, showFileSignType() { if (this.file.FileTypeName === "主协议附件(PDF)") { this.file.SignType = page.file.SignType; return true; } this.file.SignType = ''; return false; }, showFileReportorRole() { if (this.file.FileTypeName === "主协议附件(PDF)") { this.file.ReportorRole = page.file.ReportorRole; return true; } this.file.ReportorRole = ''; return false; }, mainProtocolNumberItems() { let items = this.fileList.filter(x => !!_.trim(x.ProtocolNumber) && x.FileTypeName === '主协议附件(PDF)' && x.OptState !== OptFlagsEnum.D).map(x => x.ProtocolNumber); if (pageData.isDongGuan) { let itemsParents = this.parentFileList.filter(x => !!_.trim(x.ProtocolNumber) && x.FileTypeName === '主协议附件(PDF)' && x.OptState !== OptFlagsEnum.D).map(x => x.ProtocolNumber); page.file.MainProtocolNumber = items[0]; return items.concat(itemsParents); } else { page.file.MainProtocolNumber = items[0]; return items; } }, mainParentProtocolNumberItems() { let items = this.parentFileList.filter(x => !!_.trim(x.ProtocolNumber) && x.FileTypeName === '主协议附件(PDF)' && x.OptState !== OptFlagsEnum.D); this.file.ParentClientFileId = items.length > 0 ? items[0].id : 0; return items; }, sideProtocolNumberItems() { if (this.file.FileTypeName !== "履约协议附件(PDF)") { this.file.SideProtocolNumber = ''; return []; } let m = this.file.MainProtocolNumber; let items = this.fileList.filter(x => !!_.trim(x.ProtocolNumber) && x.FileTypeName === '补充协议附件(PDF)' && x.OptState !== OptFlagsEnum.D && x.MainProtocolNumber === m).map(x => x.ProtocolNumber); this.$nextTick(function () { this.file.SideProtocolNumber = items[0]; }); return items; }, securitiesEnvironment() { if (page.isSecuritiesEnvironment) { return true; } else { return false; } } } }; }()); //产品投资人 const investorsVue = (function () { return { data: { investor: _.cloneDeep(page.investor), investorList: editConfig.lists.investorList }, methods: { addInvestor() { if (!this.client.id) { return main.alert("请先保存用户基本信息"); } Object.assign(this.investor, page.investor, { ClientId: this.client.id, ClientName: this.client.Name, ValidState: 'Valid' }); $('#clientInvestorEditModal').modal('show'); }, editInvestor(enid) { let self = this; main.post('/clientInvestor/AjaxGetInvestorDetail?enid=' + enid).done(function (resp) { Object.assign(self.investor, resp.obj); $('#clientInvestorEditModal').modal('show'); }).fail(function () { main.alert('获取产品投资人信息出错,请重新尝试!'); }); }, saveInvestor() { let arr = []; console.log(this.investor.Investor, this.investor) !_.trim(this.investor.Investor) && arr.push('产品投资人'); if (arr.length) { return main.alert(arr.join(",") + " 必须填写"); } ////适当性类型部位专业投资者是 权益比例不得超过20% //if (this.investor.EligibilityType != '专业投资者' && this.investor.ShareRate>20) { // return main.alert("非专业投资者,产品权益比例不得超过20%"); //} let self = this; main.post("/clientInvestor/AjaxSaveInvestor", self.investor).done(function (resp) { resp = resp.obj; if (self.investor.id) { let index = self.investorList.findIndex(x => x.id === self.investor.id); Object.assign(self.investorList[index], resp.investor); } else { self.investorList.push(resp.investor); } Object.assign(self.client, resp.client); $('#clientInvestorEditModal').modal('hide'); }); }, removeInvestor(enid) { let self = this; main.confirmPost("确定删除吗?", "/clientInvestor/AjaxRemoveInvestor", { enid: enid }).done(function (resp) { let index = self.investorList.findIndex(x => x.id === resp.obj.id); self.investorList.splice(index, 1); }); }, refreshInvestors() { let self = this; main.post('/clientInvestor/AjaxGetInvestorList?clientId=' + this.client.id).done(function (resp) { self.investorList = resp.obj; }).fail(function () { main.message("获取产品投资人信息列表失败"); }); }, formatCardNum(cardnum) { return _.toString(cardnum).replace(/(\d{4}(?!$))/g, "$1 "); } } }; }()); //创建编辑视图 function createEditVue() { $("#ef_Number").attr("v-bind:disabled", "client.id>0"); $('#ef_ClientType').attr("v-on:change", "changeClientType"); $('#ef_CustomerNature1,#ef_CustomerNature2').prop('readonly', true); if (page.company !== "浙期") { //适当性评级影响可接受风险服务 $('#ef_AppropriatenessDegree').attr("v-on:change", "changeAppropriatenessDegree"); $("#ef_QuestionnaireScore").attr("v-on:change", "changeQuestionnaireScore"); } $('#ef_BusinessType').attr("v-on:change", "changeBusinessType"); //$('#ef_ProperClientClass').attr("v-on:change", "changeProperClientClass"); $('#ef_AdminRegisteredNum').attr("v-bind:disabled", "disableAdminRegisteredNum"); $('#ef_AdminFullName').attr("v-bind:disabled", "disableAdminFullName"); $('#ef_ProductNumber').attr("v-bind:disabled", "client.ClientType!=='产品'"); $('#ef_Manager').attr("v-bind:disabled", "client.ClientType!=='产品'"); $('#ef_RegisteredCapital').attr("v-bind:disabled", "client.ClientType==='自然人'"); $('#ef_RegisteredCapital').prev('label').text("{{labelOfRegisteredCapital}}"); $('#ef_RegisteredAddress').attr("v-bind:disabled", "client.ClientType==='自然人'"); !page.isSecuritiesEnvironment && $('#AccessRule').parent().hide(); //$('#ef_SupProtocolDate').attr("v-bind:maxdate", "nowday"); $('#ef_SupProtocolDate').attr("v-on:input", "changeSupProtocolDate"); $('#ef_ConfirmBookMode').attr("v-on:change", "changeConfirmBookMode"); if (pageData.isWuChanZhongDa) { $('#ef_IsDocShowParentName').attr("disabled", true); } window.vue = new Vue({ el: "#editPanes", data: { client: page.client, viewState: { InstitutionalAttributes: page.client.InstitutionalAttributes || editConfig.defaults.InstitutionalAttributes }, viewData: { ...editConfig.selects }, hasChange: 0 }, computed: { disableAdminRegisteredNum() { if (this.client.ClientType === '产品' || this.client.ClientType === '机构' && this.client.BusinessType === '私募管理人') { return false; } this.AdminRegisteredNum = ''; return true; }, disableInvestors() { if (this.client.ClientType === '产品') { return true; } return false; }, disableAdminFullName() { if (this.client.ClientType === '产品') { return false; } this.AdminFullName = ''; return true; }, labelOfRegisteredCapital() { return clientHelper.labelOfRegisteredCapital(this.client); }, clientJson() { return JSON.parse(JSON.stringify(this.client)); } }, created() { this.viewData._InstitutionalAttributes = this.viewData.InstitutionalAttributes; !_.includes(page.client.ClientType, "机构") && (this.viewData.InstitutionalAttributes = []); this.changeClientType() this.displayBankCreditRating() }, mounted() { $(page.selectmNames.map(n => '#ef_' + n).join(",")).selectpicker(); $('#ef_ParentId').removeClass('text-box').selectpicker({ liveSearch: true, dropdownAlignRight: true }); $('#ef_SalesDepartmentId').removeClass('text-box').selectpicker({ liveSearch: true, dropdownAlignRight: true }); $('#ef_Seller').attr("multiple", "multiple"); $('#ef_Seller').selectpicker({ liveSearch: true }); $('#ef_BusinessType').removeClass('text-box').selectpicker({ liveSearch: true, dropdownAlignRight: true }); $(".hasDatepicker").each(function (i, obj) { if ($(obj).attr("required") == "required") { $(obj).after(" *"); } }); $(".formlabel").each(function (i, obj) { if ($(obj).text() == '营业部销售') { $(obj).parent().children("div.bootstrap-select").css("border-width", "0px"); } }); //this.changeProperClientClass(); }, methods: { changeClientType() { if (_.includes(this.client.ClientType, "机构") && this.viewState.InstitutionalAttributes) { this.client.InstitutionalAttributes = this.viewState.InstitutionalAttributes; this.viewData.InstitutionalAttributes = this.viewData._InstitutionalAttributes; } else { if (this.client.InstitutionalAttributes) { this.viewState.InstitutionalAttributes = this.client.InstitutionalAttributes; this.client.InstitutionalAttributes = ''; } this.viewData.InstitutionalAttributes = []; } //客户为产品时显示产品投资人步骤 if (this.client.ClientType === '产品') { $('#flowPoint_investors').css("display", "block"); } else { $('#flowPoint_investors').css("display", "none"); } }, changeQuestionnaireScore() { debugger; if (!pageData.isZhaoZheng) { let score = parseInt(this.client.QuestionnaireScore) || 0, selVal = "5"; if (score <= 20) { selVal = "1"; } else if (score <= 30) { selVal = "2"; } else if (score <= 40) { selVal = "3"; } else if (score <= 70) { selVal = "4"; } this.client.RiskServiceDegree = this.client.AppropriatenessDegree = selVal; } }, clickLongOrShortLicense() { if ($('#clickLongOrShortLicense').text() == "长期") { $("#LicenseValidTimeStr").show(); $("#LicenseValidTime").hide(); $("#clickLongOrShortLicense").text("短期"); } else { $("#LicenseValidTimeStr").hide(); $("#LicenseValidTime").show(); $("#clickLongOrShortLicense").text("长期"); } }, changeBusinessType() { this.displayBankCreditRating() let self = this; if (!this.client.BusinessType) { return self.client.CustomerNature1 = self.client.CustomerNature2 = ''; } main.post("/client/GetCustomerNaturesByBusinessType", { name: this.client.BusinessType }).done(function (data) { let ss = (data || '').split(','); self.client.CustomerNature1 = ss[0]; self.client.CustomerNature2 = ss[1] || ''; }); }, changeAppropriatenessDegree() { this.client.RiskServiceDegree = this.client.AppropriatenessDegree; }, changeSupProtocolDate() { var myDate = this.client.SupProtocolDate; if (!_.trim(myDate)) { this.client.ConfirmBookMode = "双章版"; } else if (myDate <= nowday) { this.client.ConfirmBookMode = "单章版"; } else { this.client.ConfirmBookMode = "双章版"; } }, changeConfirmBookMode() { let self = this; if (self.client.ConfirmBookMode === "单章版") { if (_.trim(self.client.ProtocolSignDate)) { self.client.SupProtocolDate = self.client.ProtocolSignDate; } else { self.client.SupProtocolDate = "";//商品签署日期为空,补充协议二置空 } } else { self.client.SupProtocolDate = ""; } }, //changeProperClientClass() { // if (this.client.ProperClientClass == "专业投资者") { // $('#ef_QuestionnaireScore,#ef_DisbeliefRecord').prop('readonly', true); // $("#ef_IsEvaluate,#ef_AppropriatenessDegree,#ef_RiskServiceDegree,#ef_AppropriatenessAssessor,#ef_EvaluateOfValidity,#ef_EvaluateDate").attr("disabled", true); // this.client.AppropriatenessDegree = ""; // this.client.EvaluateDate = ""; // this.client.IsEvaluate = ""; // this.client.RiskServiceDegree = ""; // this.client.EvaluateOfValidity = ""; // this.client.QuestionnaireScore = ""; // this.client.AppropriatenessAssessor = ""; // this.client.DisbeliefRecord = ""; // } // else { // $('#ef_EvaluateDate,#ef_QuestionnaireScore,#ef_DisbeliefRecord').prop('readonly', false); // $("#ef_IsEvaluate,#ef_AppropriatenessDegree,#ef_RiskServiceDegree,#ef_AppropriatenessAssessor,#ef_EvaluateOfValidity,#ef_EvaluateDate").attr("disabled", false); // } //}, changeProperClientClass() { if (this.client.ProperClientClass == "专业投资者") { $('#ef_QuestionnaireScore,#ef_DisbeliefRecord').prop('readonly', true); $("#ef_IsEvaluate,#ef_AppropriatenessDegree,#ef_RiskServiceDegree,#ef_AppropriatenessAssessor,#ef_EvaluateOfValidity,#ef_EvaluateDate").attr("disabled", true); this.client.AppropriatenessDegree = ""; this.client.EvaluateDate = ""; this.client.IsEvaluate = ""; this.client.RiskServiceDegree = ""; this.client.EvaluateOfValidity = ""; this.client.QuestionnaireScore = ""; this.client.AppropriatenessAssessor = ""; this.client.DisbeliefRecord = ""; } else { $('#ef_EvaluateDate,#ef_QuestionnaireScore,#ef_DisbeliefRecord').prop('readonly', false); $("#ef_IsEvaluate,#ef_AppropriatenessDegree,#ef_RiskServiceDegree,#ef_AppropriatenessAssessor,#ef_EvaluateOfValidity,#ef_EvaluateDate").attr("disabled", false); } }, displayBankCreditRating() { //行业包含银行时显示银行信用评级 否则不显示 if (this.client.BusinessType && this.client.BusinessType.indexOf("银行") != -1) { $('#div_ef_BankCreditRating').css("display", "block"); } else { $('#div_ef_BankCreditRating').css("display", "none"); } }, changeClientName(val) { this.client.Name = val; }, changeUsccCode(val) { this.client.UnifiedSocialCreditCode = val; } }, components: { 'vue-datepicker': FastVue.vueDatePicker(), 'vue-niceselect': FastVue.vueNiceSelect(), 'vue-number-input': FastVue.vueNumberInput() }, watch: { clientJson(newValue, oldValue) { this.hasChange++; } }, mixins: [bankcardVue, dutyVue, dutydirectorVue, fileVue, investorsVue] }); } //创建显示视图 function createViewVue() { window.vue = new Vue({ el: "#viewPanes", data: { client: page.client, isApproval: pageData.isApproval, viewData: { ...editConfig.selects }, }, mounted() { $('#myTab').children(":first").children(":first").tab('show'); }, components: { 'vue-datepicker': FastVue.vueDatePicker(), 'vue-niceselect': FastVue.vueNiceSelect(), 'vue-number-input': FastVue.vueNumberInput() }, mixins: [bankcardVue, dutyVue, dutydirectorVue, fileVue, investorsVue], methods: { labelText(fname, label) { if (fname === 'RegisteredCapital') { return clientHelper.labelOfRegisteredCapital(this.client); } return label; }, showAssessmentHistoryLog() { main.open("评估历史记录", "/client/ClientAssessmentHistoryLog?id=" + vue.client.id); }, showPassword() { layer.tips(vue.client.ProxyEmailPwd, "#ProxyEmailPwd", { tips: [1, '#e33333'], tipsMore: false }); } } }); } //顶部工具栏管理 function createTopVue() { window.topVue = new Vue({ el: '#toolbarDiv', data: { clientId: page.client.id }, methods: { saveClient() { let client = vue.client; if (!_.trim(client.Name)) { return main.alert("客户名称 必须填写"); } if (!_.trim(client.meta_MainProtocolType)) { return main.alert("主协议类型 必须填写"); } if (!_.trim(client.meta_OrganizationType)) { return main.alert("交易对手方类型 必须填写"); } if (!_.trim(client.meta_ClientTag)) { return main.alert("交易对手方标识 必须填写"); } if (client.meta_OrganizationType === "14" || client.meta_OrganizationType === "15") { if (!_.trim(client.LEICode)) { return main.alert("LEI编码 必须填写"); } } else { if (!_.trim(client.CounterpartyCode)) { return main.alert("统一社会信用代码 必须填写"); } } if (page.fnameSet.has("EvaluateDate") && client.EvaluateDate && ! /^[0-9]{4}-[0-1]?[0-9]{1}-[0-3]?[0-9]{1}$/.test(client.EvaluateDate)) { return main.message("请输入正确的评估日期格式"); } if (page.fnameSet.has("ProtocolSignDate") && client.ProtocolSignDate && ! /^[0-9]{4}-[0-1]?[0-9]{1}-[0-3]?[0-9]{1}$/.test(client.ProtocolSignDate)) { return main.message("请输入正确的协议签署日期格式"); } if (client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } if (new Array("已开户", "已休眠", "已销户").includes(client.ProcessStatus) && page.clientApprovalProcessCount > 0) { main.confirm("修改客户信息后该用户需要重新审批,确认修改?", this.ajaxSaveClient.bind(this)); } else { this.ajaxSaveClient(); } }, ajaxSaveClient() { let self = this; let client = vue.client; if (_.trim($("#LicenseValidTime").val()) || $("#clickLongOrShortLicense").text() == "短期") { if ($("#clickLongOrShortLicense").text() != "长期") { client.LicenseValidTimeStr = "30001231" } else { client.LicenseValidTimeStr = new Date($("#LicenseValidTime").val().substr(0, 10)).Format("yyyyMMMdd"); } } let clone = clientHelper.convertToSaveData(_.cloneDeep(client)); var clientSaveReq = { ClientReq: clone, Tags: new Array() }; $(".tag-context .tag-item").each(function (i, v) { clientSaveReq.Tags.push({ Id: $(v).data("id"), Name: $(v).data("name") }); }); main.post("/client/clientEditJson?enid=" + page.client.EncryptId, clientSaveReq).done(function (resp) { self.clientId = resp.obj.id; resp.obj.ProxyEmailPwd = client.ProxyEmailPwd; window.parent.reloadclient2 && window.parent.reloadclient2(); history.replaceState(null, null, "/client/clienteditV2?enid=" + resp.obj.EncryptId); Object.assign(client, clientHelper.convertToEditData(resp.obj)); if (page.isNewClient) { page.isNewClient = false; setTimeout(() => $('#search_fileTypes').selectpicker({ actionsBox: true }), 500); } page.canEditList = true; vue.hasChange = -1; }).fail(function () { main.message("提交失败"); }); }, submitProcess() { let client = vue.client; if (!client.id) { return main.message("请先保存用户基本信息"); } if (client.ApprovalStatus == "审批中") { return main.alert("当前客户正在审批中,不可进行修改,请等待审批完成后再进行操作!"); } if (vue.hasChange > 0) { return main.message("请先保存修改后再执行此操作"); } main.post("/AccountOpeningProcess/SubmitProcess", { clientId: client.id }).done(function (resp) { if (page.isView) { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + pageData.isApproval; window.parent.reloadclient2 && window.parent.reloadclient2(); } else { Object.assign(client, clientHelper.convertToEditData(resp.obj)); window.parent.saveClient && window.parent.reloadclient2(); } }).fail(function () { main.message('提交失败'); }); }, showOperationHistory() { main.open("操作历史", "/client/ClientOperationHistory?id=" + vue.client.id); }, resetPassword() { main.post("/client/ResetPassword", { clientId: vue.client.id }).fail(function () { main.message('操作失败'); }); }, openClientFileAudit() { var url = "/client/ClientFilesAudit/?clientId=" + vue.client.id + "&isApproval=false"; window.open(url, '_blank'); }, showClientLevels() { window.location.href = '/Client/Clientlevel?clientid=' + page.client.id; }, reloadClientView() { window.location.href = '/Client/ClientViewV2?enid=' + page.client.EncryptId + "&isApproval=" + (pageData.isApproval ? false : true); }, closeMe() { let self = this; if (!page.isView) { if (page.client.ApprovalStatus != "审批中" && page.client.EncryptId && page.client.EncryptId.length > 0) { main.post("/client/GetIsApprove", { enid: page.client.EncryptId }).done(function (resp) { debugger; if (resp.obj) { main.confirm("信息发生变更,是否保存变更信息?", function () { self.saveClient() }, function () { self.cancelMe() }); } else { window.layer.closeMe(); return true; } }).fail(function () { main.message('提交失败'); }); return false; } else { window.layer.closeMe(); return true; } } else { window.layer.closeMe(); return true; } }, cancelMe() { main.post("/client/CancelApprove", { enid: page.client.EncryptId }).done(function (resp) { window.layer.closeMe(); return true; }).fail(function () { main.message('提交失败'); }); } }, computed: { isOpening() { return !(new Array("已开户", "已休眠", "审批中").includes(vue.client.ProcessStatus)); } } }); } $(function () { $('body').tooltip({ selector: '.yl-tooltip' }); if (page.isView) { createViewVue(); } else { flowMgr.init(); createEditVue(); } _.trim(page.client.LicenseValidTime) && $("#LicenseValidTime").val(page.client.LicenseValidTime.substring(0, 10)); if (page.client.LicenseValidTimeStr == "30001231") { $("#LicenseValidTimeStr").show(); $("#LicenseValidTime").hide(); $("#clickLongOrShortLicense").text("短期"); } else { $("#LicenseValidTimeStr").hide(); $("#LicenseValidTime").show(); $("#clickLongOrShortLicense").text("长期"); } $("[name=meta_ClientTagDesc]").prop("disabled", "disabled"); $("[name=meta_ClientTag]").change(() => { $("[name=meta_ClientTagDesc]").get(0).selectedIndex = $('[name=meta_ClientTag] option:selected').index() page.client.meta_ClientTagDesc = $("[name=meta_ClientTagDesc]").val(); }); if (!page.isNewClient) { $("[name=meta_ClientTag]").val(page.client.MetaDic.ClientTag); $("[name=meta_ClientTag]").change(); } createTopVue(); if (!pageData.isGuoJun) { $(".showmore").mouseenter(//进入元素 function () { if ($(this).text()) { $(this).removeClass("showshort");//移除默认的样式 var classes = $(this).parent().attr('class'); if (classes.indexOf("striped") != -1) {//由于背景色不一样,先检测,再添加不同背景色的样式 $(this).addClass("showallstriped"); } else { $(this).addClass("showallno"); } } }).mouseleave(function () {//离开元素 if ($(this).text()) { var classes = $(this).parent().attr('class'); if (classes.indexOf("striped") != -1) { $(this).removeClass("showallstriped"); } else { $(this).removeClass("showallno"); } $(this).addClass("showshort"); } }); } $('.toggle-password').click(function () { var input = $(this).closest('.input-password').find('input'); if (input.attr('type') == 'password') { input.attr('type', 'text'); $(this).addClass("glyphicon-eye-open"); $(this).removeClass("glyphicon-eye-close"); } else { input.attr('type', 'password'); $(this).removeClass("glyphicon-eye-open"); $(this).addClass("glyphicon-eye-close"); } }); });