<template>
|
<div style="min-width: 1200px;overflow: scroll;">
|
<div class="left">
|
<LeftMenus
|
:menuItems="menuItems"
|
@jump="jump"
|
@backList="backProDetail"
|
title="返回产品详情"
|
/>
|
</div>
|
<div class="right" @scroll="onScroll">
|
<div class="scroll_item" v-for="(item, index) in menuItems" :key="index">
|
<ModuleTitle :title="item.label" />
|
<div
|
v-if="!!item.children && item.children.length > 0"
|
style="background: #fff;"
|
>
|
<div v-for="(child, index) in item.children" :key="index">
|
<div class="item_set_class" v-show="child.isShow">
|
<MenusTitle :title="child.label" />
|
<CreateForms
|
v-if="child.type === 'FORMS'"
|
:screenWidth="screenWidth"
|
:ref="child.name"
|
:isShowOld="showOld"
|
:oldVal="child.oldVal"
|
:isView="true"
|
:isShowBorder="isShowBorder"
|
@handleSelFocus="handleSelFocus"
|
@handleGetValue="handleGetValue"
|
:formItems="child.formItems"
|
:defValues="child.defValues"
|
:formRules="child.formRules"
|
/>
|
<ProcessControlSetting
|
v-if="child.name === 'PROCESSCONTROLSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<PrepaymentSetting
|
v-if="child.name === 'PREPAYMENTSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<RollPlanSetting
|
v-if="child.name === 'ROLLPLANSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<DiscountPlanSetting
|
v-if="child.name === 'DISCOUNTPLANSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<CreditQuerySetting
|
v-if="child.name === 'CREDITQUERYSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<ScreenageDocSetting
|
v-if="child.name === 'SCREENAGEDOCSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
</div>
|
</div>
|
</div>
|
<DimensionPricingSetting
|
v-if="item.name === 'DIMENSIONPRICINGSETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
<DimensionIncentiveSetting
|
v-if="item.name === 'DIMENSIONINCENTIVESETTING'"
|
:options="optionsMap"
|
:edit="OPRETYPE === 'edit'"
|
:isView="true"
|
:noHistory="noHistory"
|
:isShowBorder="isShowBorder"
|
/>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script>
|
import { PRODIMENSIONMENUS } from "../../../utils/menusConfig.js";
|
import {
|
qryDropDownOptionBatch,
|
qryDimensionsCustomerNoList,
|
saveProductDimensionsInfo,
|
qryCityCodeList,
|
selectSubBranch,
|
qryCondition,
|
qryAreaCodeList,
|
selectPartnersConfiguration,
|
qryProductDimensionsInfo,
|
qryDimensionInfoShowConfig,
|
qryVirtualAccount
|
} from "../../../api/productManage.api";
|
import {
|
DIMENSIONOPTIONS,
|
DIMENSIONENUM
|
} from "../../../utils/optionsQueryConfig.js";
|
import {
|
DIMENSIONBASEINFODEF,
|
MATCHEDELEMENTDEFVALUE,
|
AMOUNTSETTINGDEFVALUE,
|
DIMENSIONPOSTLOANDEFVALUE,
|
OPERATINGSETTINGDEFVALUE,
|
PARTNERSINFOSETTINGDEFVALUE
|
} from "../../../utils/defValueConfig";
|
import LeftMenus from "../../../components/LeftMenus.vue";
|
import ModuleTitle from "../../../components/ModuleTitle.vue";
|
import MenusTitle from "../../../components/MenusTitle.vue";
|
import CreateForms from "../../../components/CreateForms.vue";
|
import ProcessControlSetting from "./components/ProcessControlSetting.vue";
|
import PrepaymentSetting from "./components/PrepaymentSetting.vue";
|
import RollPlanSetting from "./components/RollPlanSetting.vue";
|
import DiscountPlanSetting from "./components/DiscountPlanSetting.vue";
|
import CreditQuerySetting from "./components/CreditQuerySetting.vue";
|
import DimensionIncentiveSetting from "./components/DimensionIncentiveSetting.vue";
|
import DimensionPricingSetting from "./components/DimensionPricingSetting.vue";
|
import ScreenageDocSetting from "./components/ScreenageDocSetting.vue";
|
|
export default {
|
data() {
|
return {
|
screenWidth: document.documentElement.clientWidth || 1280, // 屏幕宽度
|
menuItems: [...PRODIMENSIONMENUS(false)],
|
dimensionno: "", // 维度编号
|
serialno: "", // 维度流水号
|
isBaseForm: false,
|
commitDialogVisible: false,
|
productid: this.$route.query.typeno,
|
objectno: this.$route.query.objectno,
|
objecttype: this.$route.query.objecttype,
|
noHistory: this.$route.query.noHistory.toString() === "true" || false,
|
isShowBorder: this.$route.query.isShowBorder.toString() === "true",
|
type: "",
|
showOld:
|
this.$route.query.objecttype === "jbo.app.BUSINESS_TYPE_CHANGE" &&
|
!this.noHistory,
|
selProNo: "",
|
optionsMap: {},
|
cities: [],
|
areaCodes: [],
|
detailData: {},
|
oldVal: {},
|
showData: {},
|
showForms: {}
|
};
|
},
|
computed: {
|
DIMENSIONNO() {
|
return this.$route.query.dimensionno;
|
},
|
OBJECTNO() {
|
return this.$route.query.objectno;
|
},
|
PRODUCTID() {
|
return this.$route.query.productid;
|
},
|
OPRETYPE() {
|
return this.$route.query.type === "detail" ? "edit" : "detail";
|
}
|
},
|
components: {
|
LeftMenus,
|
ModuleTitle,
|
MenusTitle,
|
CreateForms,
|
ProcessControlSetting,
|
DimensionPricingSetting,
|
PrepaymentSetting,
|
RollPlanSetting,
|
DiscountPlanSetting,
|
DimensionIncentiveSetting,
|
CreditQuerySetting,
|
ScreenageDocSetting
|
},
|
async created() {
|
this.dimensionno = this.DIMENSIONNO;
|
this.productid = this.PRODUCTID;
|
this.objectno = this.OBJECTNO;
|
this.type = this.OPRETYPE;
|
await this.getProductDimensionsInfo();
|
await this.initDimensions();
|
},
|
async mounted() {
|
window.addEventListener("scroll", this.onScroll);
|
window.addEventListener("resize", this.getScreenWidth);
|
this.$router.afterEach((to, from, next) => {
|
window.scrollTo(0, 0);
|
});
|
await this.getDimensionInfoShowConfig();
|
await this.getCondition("cities");
|
await this.getAreaCodeList("");
|
await this.getOptions();
|
await this.getDimensionsCustomerNoList();
|
},
|
destroyed() {
|
window.removeEventListener("scroll", this.onScroll);
|
window.removeEventListener("resize", this.getScreenWidth);
|
},
|
methods: {
|
// 返回列表
|
backProDetail() {
|
this.detailData = {};
|
this.showData = {};
|
this.showForms = {};
|
this.$router.go(-1);
|
},
|
// 查询维度可见配置项
|
async getDimensionInfoShowConfig() {
|
const { dimensionno, objectno, productid } = this;
|
const params = {
|
dimensionno,
|
objectno,
|
productid
|
};
|
const res = await qryDimensionInfoShowConfig(params);
|
if (res && res.code === "00") {
|
this.showData = res.result;
|
}
|
},
|
// 查询产品维度信息
|
async getProductDimensionsInfo() {
|
const { dimensionno, objectno, productid, objecttype } = this;
|
const params = {
|
dimensionno,
|
objectno,
|
productid,
|
showoldvalue: objecttype === "jbo.app.BUSINESS_TYPE_CHANGE"
|
};
|
const loading = this.$loading({
|
lock: true,
|
text: "加载中",
|
background: "hsla(0,0%,100%,.9)"
|
});
|
const detailsRes = await qryProductDimensionsInfo(params);
|
setTimeout(() => {
|
loading.close();
|
}, 2000);
|
let detailData = {};
|
let showForms = {};
|
let oldValue = {};
|
Object.getOwnPropertyNames(detailsRes.result).forEach(key => {
|
detailData[key] = detailsRes.result[key].value || "";
|
if (key === "partnersbranch") {
|
detailData["partnersbranchName"] =
|
detailsRes.result[key].valueDesc || "";
|
}
|
if (key === "paymentbranch") {
|
detailData["paymentbranchName"] =
|
detailsRes.result[key].valueDesc || "";
|
}
|
showForms[key] = detailsRes.result[key].visible;
|
oldValue[key] = detailsRes.result[key].oldValue;
|
});
|
this.oldVal = oldValue;
|
this.detailData = detailData;
|
this.showForms = showForms;
|
},
|
// 初始化产品维度信息
|
async initDimensions() {
|
const itemMenus = PRODIMENSIONMENUS(false)
|
.concat()
|
.map(item => {
|
const newItem = { ...item };
|
if (
|
newItem.name === "DIMENSIONBASEINFO" ||
|
newItem.name === "PROBUSINESSINFO" ||
|
newItem.name === "PROCUSTOMERSLIST" ||
|
newItem.name === "DIMENSIONOPERATING"
|
) {
|
const newChildren = newItem.children.map(child => {
|
const newChild = { ...child };
|
if (newChild.type === "FORMS") {
|
const newFormItems = newChild.formItems.map(forms => {
|
const newForms = { ...forms };
|
newForms.placeholder = "";
|
newForms.readonly = true;
|
return newForms;
|
});
|
newChild.formItems = newFormItems;
|
newChild.oldVal = this.oldVal;
|
}
|
return newChild;
|
});
|
newItem.children = newChildren;
|
}
|
return newItem;
|
});
|
this.$set(this, "menuItems", itemMenus);
|
const {
|
isprepayment,
|
isrollover,
|
havecooperation,
|
discounttype
|
} = this.detailData;
|
const showMenus = [
|
{
|
parentName: "PROBUSINESSINFO",
|
name: "PREPAYMENTSETTING",
|
value: isprepayment === "1"
|
},
|
{
|
parentName: "PROBUSINESSINFO",
|
name: "ROLLPLANSETTING",
|
value: isrollover === "1"
|
},
|
|
// ID1006726之前控制列表显示 之后列表一直显示。只控制新增按钮是否显示 所以屏蔽该控制代码
|
// {
|
// parentName: "PROCUSTOMERSLIST",
|
// name: "DISCOUNTPLANSETTING",
|
// value:
|
// havecooperation === "1" &&
|
// (discounttype === "2" || discounttype === "3")
|
// }
|
];
|
showMenus.forEach(menu => {
|
this.handleShowTable(menu.parentName, menu.name, menu.value);
|
});
|
},
|
// 合作协议贴息方案
|
async getPartnersConfiguration(doctype, projectno) {
|
const { objectno } = this;
|
const params = {
|
doctype,
|
objectno,
|
projectno
|
};
|
const res = await selectPartnersConfiguration(params);
|
if (res.code !== "00") {
|
return false;
|
}
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
const partnerFormItems = [...partnerForm.formItems];
|
const fieldName =
|
doctype === "170" ? "cooperationagreement" : "discountagreement";
|
partnerFormItems.forEach(item => {
|
if (item.name === fieldName) {
|
item.options = res.result;
|
}
|
});
|
this.updateForms(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
partnerFormItems
|
);
|
},
|
async getDimensionsCustomerNoList() {
|
const { objectno } = this;
|
const res = await qryDimensionsCustomerNoList({ objectno });
|
if (!res && res.code !== "00") {
|
return false;
|
}
|
const matchForm = this.$refs.MATCHEDELEMENT[0];
|
const matchFormItems =
|
matchForm && matchForm.formItems.filter(Boolean).concat();
|
matchFormItems &&
|
matchFormItems.forEach(forms => {
|
if (forms.name === "customersNo") {
|
forms.options = res.result;
|
}
|
});
|
this.updateForms("DIMENSIONBASEINFO", "MATCHEDELEMENT", matchFormItems);
|
},
|
async getOptions() {
|
const params = [...DIMENSIONOPTIONS];
|
const res = await qryDropDownOptionBatch(params);
|
if (res.code !== "00") {
|
return false;
|
}
|
this.optionsMap = res.result;
|
const baseForm = this.$refs.BASEINFO[0];
|
const matchForm =
|
this.$refs.MATCHEDELEMENT && this.$refs.MATCHEDELEMENT[0];
|
const amountForm = this.$refs.AMOUNTSETTING[0];
|
const busniessForm = this.$refs.PROBUSINESSBSASE[0];
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
const operatingForm = this.$refs.OPERATINGSETTING[0];
|
const baseFormItems = baseForm && [...baseForm.formItems];
|
const matchFormItems = matchForm && [...matchForm.formItems];
|
const amountFormItems = amountForm && [...amountForm.formItems];
|
const busniessFormItems = busniessForm && [...busniessForm.formItems];
|
const partnerFormItems = partnerForm && [...partnerForm.formItems];
|
const operatingFormItems = operatingForm && [...operatingForm.formItems];
|
const upArray = [
|
{
|
parentName: "DIMENSIONBASEINFO",
|
name: "BASEINFO",
|
defValue: this.detailData,
|
value: this.getOptionItems(baseFormItems)
|
},
|
{
|
parentName: "DIMENSIONBASEINFO",
|
name: "MATCHEDELEMENT",
|
defValue: this.detailData,
|
value: this.getOptionItems(matchFormItems.filter(Boolean))
|
},
|
{
|
parentName: "DIMENSIONBASEINFO",
|
name: "AMOUNTSETTING",
|
defValue: this.detailData,
|
value: this.getOptionItems(amountFormItems)
|
},
|
{
|
parentName: "PROBUSINESSINFO",
|
name: "PROBUSINESSBSASE",
|
defValue: this.detailData,
|
value: this.getOptionItems(busniessFormItems)
|
},
|
{
|
parentName: "PROCUSTOMERSLIST",
|
name: "PARTNERSINFOSETTING",
|
defValue: this.detailData,
|
value: this.getOptionItems(partnerFormItems, "PARTNERSINFOSETTING")
|
},
|
{
|
parentName: "DIMENSIONOPERATING",
|
name: "OPERATINGSETTING",
|
defValue: this.detailData,
|
value: this.getOptionItems(operatingFormItems)
|
}
|
];
|
console.log("this.detailData======", this.detailData);
|
this.OPRETYPE !== "edit" &&
|
upArray.forEach(menus => {
|
this.updateForms(menus.parentName, menus.name, menus.value);
|
});
|
if (this.OPRETYPE === "edit") {
|
console.log("this.OPRETYPE", this.OPRETYPE);
|
upArray.forEach(menus => {
|
const newForms = [...menus.value].map(form => {
|
const newForm = { ...form };
|
newForm.show = this.showForms[newForm.name] || newForm.show;
|
return newForm;
|
});
|
this.handleShowContrl(
|
menus.parentName,
|
menus.name,
|
"formItems",
|
newForms
|
);
|
this.handleShowContrl(
|
menus.parentName,
|
menus.name,
|
"defValues",
|
menus.defValue
|
);
|
});
|
setTimeout(() => {
|
if (this.detailData.havecooperation === "1") {
|
const filedsArray = [
|
{
|
key: "projectNo",
|
value: this.detailData.projectNo
|
},
|
{
|
key: "partnersprovince",
|
value: this.detailData.partnersprovince
|
},
|
{
|
key: "paymentprovince",
|
value: this.detailData.paymentprovince
|
},
|
{
|
key: "contactpersonprovince",
|
value: this.detailData.contactpersonprovince
|
},
|
{ key: "partnersbank", value: this.detailData.partnersbank },
|
{ key: "paymentbank", value: this.detailData.paymentbank }
|
];
|
filedsArray.forEach(item => {
|
if (item.value) {
|
this.handleChildSelect(item.key, item.value);
|
}
|
});
|
}
|
}, 10);
|
}
|
},
|
// 处理联动的显示或隐藏
|
handleShowContrl(parentName, updateName, childName, value) {
|
const updateFormItems = [...this.menuItems].map(menus => {
|
const newMenu = { ...menus };
|
if (newMenu.name === parentName) {
|
const newChildren = [...newMenu.children].map(childs => {
|
const newChilds = { ...childs };
|
if (newChilds.name === updateName) {
|
newChilds[childName] = value;
|
}
|
return newChilds;
|
});
|
newMenu.children = newChildren;
|
}
|
return newMenu;
|
});
|
this.$set(this, "menuItems", updateFormItems);
|
},
|
// 更新Form
|
updateForms(parentName, name, value, isUpdateTab) {
|
const { menuItems, showData } = this;
|
const { attribute2, elementname } = showData;
|
const newMenus = menuItems.map(item => {
|
const newItem = { ...item };
|
if (newItem.name === parentName) {
|
const newChildren = newItem.children.map(child => {
|
let newChild = { ...child };
|
if (newChild.name === name) {
|
let newValue = [...value];
|
if (name === "PARTNERSINFOSETTING") {
|
newValue = newValue.map(form => {
|
const newForm = { ...form };
|
const hasPro =
|
elementname &&
|
elementname.length > 0 &&
|
elementname.includes("projectNo");
|
if (
|
newForm.name === "cooperationagreement" ||
|
newForm.name === "discountagreement"
|
) {
|
newForm.show = hasPro && newForm.show;
|
}
|
return newForm;
|
});
|
}
|
newChild.formItems = newValue;
|
}
|
if (newChild.name === "MATCHEDELEMENT") {
|
const newElementname =
|
elementname && elementname.filter(el => el !== null);
|
const newElementLength = newElementname && newElementname.length;
|
newChild.isShow = newElementLength > 0;
|
if (newElementLength > 0) {
|
const filterArray = newChild.formItems.filter(Boolean);
|
newChild.formItems = elementname.map(el => {
|
const elObj =
|
filterArray && filterArray.filter(form => form.name === el);
|
return elObj[0];
|
});
|
}
|
}
|
if (newChild.name === "PROCESSCONTROLSETTING") {
|
newChild.isShow = attribute2;
|
}
|
return newChild;
|
});
|
newItem.children = newChildren;
|
}
|
return newItem;
|
});
|
this.$set(this, "menuItems", newMenus);
|
},
|
getOptionItems(items, name) {
|
const { optionsMap, detailData } = this;
|
const newItems = [...items];
|
const { havecooperation, isissuepartners, discounttype } = detailData;
|
newItems.forEach(forms => {
|
if (forms.options) {
|
forms.options = optionsMap[DIMENSIONENUM[forms.name]];
|
}
|
if (forms.name === 'provinceCode') {
|
forms.options = optionsMap[DIMENSIONENUM[forms.name]]
|
}
|
if (forms.name === "cityCode") {
|
forms.options = this.cities;
|
}
|
if (forms.name === "areaCode") {
|
forms.options = this.areaCodes;
|
}
|
if (name === "PARTNERSINFOSETTING") {
|
forms.show = havecooperation === "1";
|
if (forms.name === "havecooperation") {
|
forms.show = true;
|
}
|
if (havecooperation !== "1") {
|
return false;
|
}
|
const hideFields = [
|
"partnersaccountname",
|
"partnersaccount",
|
"partnersprovince",
|
"partnerscity",
|
"partnersbank",
|
"partnersbranch",
|
"partnersbranchName"
|
];
|
if (hideFields.includes(forms.name)) {
|
forms.show = forms.show && isissuepartners === "1";
|
}
|
if (discounttype !== "2" && discounttype !== "3") {
|
const showFields = [
|
"havecooperation",
|
"enterprisename",
|
"socialcreditcode",
|
"isissuepartners",
|
"partnersaccountname",
|
"partnersaccount",
|
"partnersprovince",
|
"partnerscity",
|
"partnersbank",
|
"partnersbranch",
|
"partnersbranchName",
|
"cooperationagreement",
|
"discounttype"
|
];
|
if (!showFields.includes(forms.name)) {
|
forms.show = false;
|
}
|
}
|
}
|
});
|
return newItems;
|
},
|
// 校验维度基本信息
|
validateBase() {
|
const baseForm = this.$refs.BASEINFO[0];
|
baseForm.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
this.isBaseForm = true;
|
} else {
|
this.isBaseForm = false;
|
this.$message.error("请完维度基本信息!");
|
return false;
|
}
|
});
|
},
|
// 校验维度匹配元素
|
validateMatch() {
|
const { elementname } = this.showData;
|
if (elementname.length < 1) {
|
return true;
|
}
|
const matchForm = this.$refs.MATCHEDELEMENT[0];
|
matchForm.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
this.isMatchForm = true;
|
} else {
|
this.isMatchForm = false;
|
this.$message.error("请完善匹配元素!");
|
return false;
|
}
|
});
|
},
|
// 校验额度信息
|
validateAmount() {
|
const amountForm = this.$refs.AMOUNTSETTING[0];
|
amountForm.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
this.isAmountForm = true;
|
} else {
|
this.isAmountForm = false;
|
this.$message.error("请完善额度配置!");
|
return false;
|
}
|
});
|
},
|
// 校验维度贷后配置
|
validateBusniess() {
|
const busniessForm = this.$refs.PROBUSINESSBSASE[0];
|
busniessForm.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
this.isBusniessForm = true;
|
} else {
|
this.isBusniessForm = false;
|
this.$message.error("请完维度贷后配置!");
|
return false;
|
}
|
});
|
},
|
// 校验表单信息
|
validateForms() {
|
const formsInfo = [
|
{
|
formName: "BASEINFO", // 维度基本信息
|
tipContent: "请完维度基本信息!", // 提示信息
|
key: "isBaseForm"
|
},
|
{
|
formName: "MATCHEDELEMENT", // 匹配元素
|
tipContent: "请完善匹配元素!", // 提示信息
|
key: "isMatchForm"
|
},
|
{
|
formName: "AMOUNTSETTING", // 额度配置
|
tipContent: "请完善额度配置!", // 提示信息
|
key: "isAmountForm"
|
},
|
{
|
formName: "PROBUSINESSBSASE", // 维度贷后配置
|
tipContent: "请完善维度贷后配置", // 提示信息
|
key: "isBusniessForm"
|
},
|
{
|
formName: "PARTNERSINFOSETTING", // 合作商信息配置
|
tipContent: "请完善合作商信息配置", // 提示信息
|
key: "isPartnerForm"
|
},
|
{
|
formName: "OPERATINGSETTING", // 维度运营配置
|
tipContent: "请完善维度运营配置基本信息", // 提示信息
|
key: "isOperatingForm"
|
}
|
];
|
formsInfo.forEach(item => {
|
const ITEMFORMS = this.$refs[item.formName][0];
|
ITEMFORMS.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
this[item.key] = true;
|
} else {
|
this[item.key] = false;
|
setTimeout(() => {
|
this.$message.error(item.tipContent);
|
}, 0);
|
}
|
});
|
});
|
},
|
enterMessages() {
|
const { productid, objectno, objecttype } = this;
|
this.commitDialogVisible = false;
|
this.$router.push({
|
name: "productDetail",
|
query: {
|
serialno: objectno,
|
productid,
|
objecttype: objecttype
|
}
|
});
|
},
|
handleSave() {
|
const { dimensionno } = this;
|
if (!dimensionno) {
|
this.$message({
|
message: "产品维度编号不存在!",
|
type: "error"
|
});
|
return false;
|
}
|
this.saveDimensionsInfo(false);
|
},
|
async saveDimensionsInfo(checkflag) {
|
const params = this.getFormsValue(checkflag);
|
const res = await saveProductDimensionsInfo(params);
|
if (!res || res.code !== "00") {
|
return false;
|
}
|
if (!checkflag) {
|
this.$message({
|
message: "草稿已保存",
|
type: "success"
|
});
|
} else {
|
this.commitDialogVisible = true;
|
}
|
},
|
// 获取焦点时判断是否有可选项
|
handleSelFocus(formName, options) {
|
if (!options || options.length < 1) {
|
if (formName === "partnerscity") {
|
this.validateSels("partnerscity", "请先选择商家收款银行所在省份!");
|
}
|
if (formName === "partnersbranch") {
|
this.validateSels("partnersbank", "请先选择商家收款银行");
|
}
|
if (formName === "paymentcity") {
|
this.validateSels(
|
"paymentprovince",
|
"请先选择商家贴息付款账户所在省份"
|
);
|
}
|
if (formName === "paymentbranchName") {
|
this.validateSels("partnersbank", "请先选择商家贴息付款银行");
|
}
|
if (formName === "contactpersoncity") {
|
this.validateSels(
|
"contactpersonprovince",
|
"请先选择发票接收人地址(省)"
|
);
|
}
|
if (
|
formName === "cooperationagreement" ||
|
formName === "discountagreement"
|
) {
|
const matchForm = this.$refs.MATCHEDELEMENT[0];
|
matchForm.$refs["createForm"].validateField(
|
"projectNo",
|
errorMessage => {
|
if (errorMessage) {
|
this.$message.error("请先选择项目");
|
return false;
|
}
|
}
|
);
|
}
|
if (formName === "areaCode") {
|
const matchForm = this.$refs.MATCHEDELEMENT[0];
|
if (this.areaCodes.length === 0) {
|
matchForm.$refs["createForm"].validateField(
|
"cityCode",
|
errorMessage => {
|
if (errorMessage) {
|
this.$message.error("请先选择维度城市");
|
return false;
|
}
|
}
|
);
|
}
|
}
|
}
|
},
|
// 校验form
|
validateSels(field, tipMessage) {
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
partnerForm.$refs["createForm"].validateField(field, errorMessage => {
|
if (errorMessage) {
|
this.$message.error(tipMessage);
|
return false;
|
}
|
});
|
},
|
// 处理联动表格的显示或隐藏
|
handleShowTable(parentName, updateName, isShow) {
|
const updateFormItems = [...this.menuItems].map(menus => {
|
const newMenu = { ...menus };
|
if (newMenu.name === parentName) {
|
const newChildren = [...newMenu.children].map(childs => {
|
const newChilds = { ...childs };
|
if (newChilds.name === updateName) {
|
newChilds.isShow = isShow;
|
}
|
return newChilds;
|
});
|
newMenu.children = newChildren;
|
}
|
return newMenu;
|
});
|
this.$set(this, "menuItems", updateFormItems);
|
},
|
// 处理子级联动
|
async handleChildSelect(formName, value, isChange = false) {
|
console.log("formName", formName, value);
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
let partnerFormItems = [...partnerForm.formItems];
|
if (!value || value === " ") {
|
return false;
|
}
|
if (formName === "projectNo") {
|
!isChange && (await this.getPartnersConfiguration("160", value));
|
!isChange && (await this.getPartnersConfiguration("170", value));
|
return false;
|
}
|
if (formName === "partnersprovince") {
|
const partnerscityOp = await this.getCityCodeList(value);
|
partnerFormItems.forEach(item => {
|
if (item.name === "partnerscity") {
|
item.options = partnerscityOp;
|
}
|
});
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{
|
...partnerForm.formValues,
|
partnersprovince: value,
|
partnerscity: " "
|
}
|
);
|
}
|
}
|
if (formName === "settlementaccount") {
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{ ...partnerForm.formValues, settlementbankname: value }
|
);
|
}
|
}
|
if (formName === "paymentprovince") {
|
const paymentcityOp = await this.getCityCodeList(value);
|
partnerFormItems.forEach(item => {
|
if (item.name === "paymentcity") {
|
item.options = paymentcityOp;
|
}
|
});
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{
|
...partnerForm.formValues,
|
paymentprovince: value,
|
paymentcity: " "
|
}
|
);
|
}
|
}
|
if (formName === "contactpersonprovince") {
|
const contactpersoncityOp = await this.getCityCodeList(value);
|
partnerFormItems.forEach(item => {
|
if (item.name === "contactpersoncity") {
|
item.options = contactpersoncityOp;
|
}
|
});
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{
|
...partnerForm.formValues,
|
contactpersonprovince: value,
|
contactpersoncity: " "
|
}
|
);
|
}
|
}
|
if (formName === "partnersbank") {
|
const partnersbranchOp = await this.getSelectSubBranch(value);
|
partnerFormItems.forEach(item => {
|
if (item.name === "partnersbranchName") {
|
item.options = partnersbranchOp;
|
}
|
});
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{
|
...partnerForm.formValues,
|
partnersbank: value,
|
partnersbranchName: ""
|
}
|
);
|
}
|
}
|
if (formName === "paymentbank") {
|
const paymentbranchOp = await this.getSelectSubBranch(value);
|
partnerFormItems.forEach(item => {
|
if (item.name === "paymentbranchName") {
|
item.options = paymentbranchOp;
|
}
|
});
|
if (isChange) {
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"defValues",
|
{
|
...partnerForm.formValues,
|
paymentbank: value,
|
paymentbranchName: ""
|
}
|
);
|
}
|
}
|
this.handleShowContrl(
|
"PROCUSTOMERSLIST",
|
"PARTNERSINFOSETTING",
|
"formItems",
|
partnerFormItems
|
);
|
},
|
// 获取城市options
|
async getCityCodeList(itemno) {
|
if (!itemno || itemno === " ") {
|
return;
|
}
|
const cityRes = await qryCityCodeList({ itemno });
|
if (!cityRes || cityRes.code !== "00") {
|
return "";
|
}
|
if (itemno === "cities") {
|
this.cities = cityRes.result;
|
}
|
return cityRes.result;
|
},
|
// 下拉
|
async getCondition(conditionName) {
|
const selRes = await qryCondition({ conditionName });
|
if (!selRes || selRes.code !== "00") {
|
return "";
|
}
|
this.cities = selRes.result;
|
},
|
// 下拉区
|
async getAreaCodeList(itemno) {
|
const selRes = await qryAreaCodeList({ itemno });
|
if (!selRes || selRes.code !== "00") {
|
return "";
|
}
|
this.areaCodes = selRes.result;
|
},
|
// 获取支行options
|
async getSelectSubBranch(bankcode) {
|
if (!bankcode || bankcode === " ") {
|
return;
|
}
|
const subBranchRes = await selectSubBranch({
|
bankcode,
|
currentPage: 1,
|
pageSize: 10
|
});
|
if (!subBranchRes || subBranchRes.code !== "00") {
|
return "";
|
}
|
return subBranchRes.result.records;
|
},
|
// 获取虚拟账号
|
handleGetValue() {
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
partnerForm.$refs["createForm"].validateField(
|
"enterprisename",
|
errorMessage => {
|
if (errorMessage) {
|
this.$message.error("请输入企业工商登记名称");
|
return false;
|
}
|
partnerForm.$refs["createForm"].validateField(
|
"socialcreditcode",
|
async errorMessage => {
|
if (errorMessage) {
|
this.$message.error("请输入统一社会信用代码");
|
return false;
|
}
|
const {
|
enterprisename,
|
socialcreditcode
|
} = partnerForm.formValues;
|
const virtualAccountRes = await qryVirtualAccount({
|
enterprisename,
|
socialcreditcode
|
});
|
if (!virtualAccountRes && virtualAccountRes.code !== "00") {
|
return false;
|
}
|
partnerForm.formValues.clearingvirtual =
|
virtualAccountRes.result.virtualno;
|
partnerForm.update();
|
}
|
);
|
}
|
);
|
},
|
// 获取维度定义表单值
|
getFormsValue(checkflag) {
|
const baseForm = this.$refs.BASEINFO[0];
|
const matchForm = this.$refs.MATCHEDELEMENT[0];
|
const amountForm = this.$refs.AMOUNTSETTING[0];
|
const busniessForm = this.$refs.PROBUSINESSBSASE[0];
|
const partnerForm = this.$refs.PARTNERSINFOSETTING[0];
|
const operatingForm = this.$refs.OPERATINGSETTING[0];
|
const { objectno, productid } = this;
|
const otherParams = {
|
checkflag,
|
objectno,
|
productid
|
};
|
let baseFormValue = {};
|
const showForms = baseForm.formItems.filter(
|
form => form && form.show !== false
|
);
|
showForms.forEach(form => {
|
baseFormValue[form.name] = baseForm.formValues[form.name];
|
});
|
return {
|
...this.getFormItemsValue(
|
baseForm.formItems,
|
baseForm.formValues,
|
DIMENSIONBASEINFODEF
|
),
|
...this.getFormItemsValue(
|
matchForm.formItems,
|
matchForm.formValues,
|
MATCHEDELEMENTDEFVALUE
|
),
|
...this.getFormItemsValue(
|
amountForm.formItems,
|
amountForm.formValues,
|
AMOUNTSETTINGDEFVALUE
|
),
|
...this.getFormItemsValue(
|
busniessForm.formItems,
|
busniessForm.formValues,
|
DIMENSIONPOSTLOANDEFVALUE
|
),
|
...this.getFormItemsValue(
|
partnerForm.formItems,
|
partnerForm.formValues,
|
PARTNERSINFOSETTINGDEFVALUE
|
),
|
...this.getFormItemsValue(
|
operatingForm.formItems,
|
operatingForm.formValues,
|
OPERATINGSETTINGDEFVALUE
|
),
|
...otherParams
|
};
|
},
|
// 获取显示表单对应的value值
|
getFormItemsValue(forms, values, defvalue) {
|
let newDfvalue = {};
|
Object.getOwnPropertyNames(defvalue).forEach(key => {
|
newDfvalue[key] = "";
|
});
|
const showForms = forms.filter(form => form && form.show !== false);
|
let formsValue = {};
|
showForms.forEach(form => {
|
formsValue[form.name] = values[form.name];
|
});
|
return { ...newDfvalue, ...formsValue };
|
},
|
async submitForm() {
|
await this.validateForms();
|
const {
|
isBaseForm,
|
isMatchForm,
|
isAmountForm,
|
isBusniessForm,
|
isPartnerForm,
|
isOperatingForm
|
} = this;
|
if (
|
!isBaseForm ||
|
!isMatchForm ||
|
!isAmountForm ||
|
!isBusniessForm ||
|
!isPartnerForm ||
|
!isOperatingForm
|
) {
|
return false;
|
}
|
this.saveDimensionsInfo(true);
|
},
|
getScreenWidth() {
|
this.$set(this, "screenWidth", document.body.offsetWidth);
|
},
|
jump(index) {
|
const { menuItems } = this;
|
const items = document.querySelectorAll(".scroll_item");
|
items.forEach((item, i) => {
|
this.$set(this.menuItems, i, {
|
...menuItems[i],
|
isActive: index === i
|
});
|
if (index === i) {
|
items[i].scrollIntoView({
|
block: "start", // 默认跳转到顶部
|
behavior: "smooth" // 滚动的速度
|
});
|
}
|
});
|
},
|
onScroll(e) {
|
const scrollItems = document.querySelectorAll(".scroll_item");
|
const { menuItems } = this;
|
for (let i = scrollItems.length - 1; i >= 0; i--) {
|
// 判断滚动条滚动距离是否大于当前滚动项可滚动距离
|
const judge =
|
e.target.scrollingElement.scrollTop >=
|
scrollItems[i].offsetTop - scrollItems[0].offsetTop - 50;
|
if (judge) {
|
scrollItems.forEach((item, index) => {
|
this.$set(this.menuItems, index, {
|
...menuItems[index],
|
isActive: index === i
|
});
|
});
|
break;
|
}
|
}
|
const scrollTop =
|
document.documentElement.scrollTop || document.body.scrollTop;
|
// 变量windowHeight是可视区的高度
|
const windowHeight =
|
document.documentElement.clientHeight || document.body.clientHeight;
|
// 变量scrollHeight是滚动条的总高度
|
const scrollHeight =
|
document.documentElement.scrollHeight || document.body.scrollHeight;
|
// 滚动条到底部的条件
|
if (scrollTop + windowHeight === scrollHeight) {
|
const newMenuItems = [...this.menuItems].map((item, i) => {
|
const newItem = { ...item };
|
newItem.isActive = i === this.menuItems.length - 1;
|
return newItem;
|
});
|
this.menuItems = newMenuItems;
|
}
|
}
|
}
|
};
|
</script>
|
<style lang="stylus" scoped>
|
.left {
|
width: 160px;
|
height: 100%;
|
position: fixed;
|
outline: 1px solid #eee;
|
border-right: 1px solid #eee;
|
background: #fff;
|
z-index: 999;
|
top: 0;
|
left: 0;
|
min-width: 160px;
|
}
|
|
.right {
|
position: absolute;
|
width: calc(100% - 220px);
|
padding: 20px 20px;
|
background: #f9f9f9;
|
left: 160px;
|
right: 10px;
|
min-width: 1060px;
|
top: 0;
|
}
|
|
.scroll_item {
|
min-height: 200px;
|
background: rgba(249, 249, 249, 1);
|
padding-bottom: 10px;
|
}
|
|
.item_set_class {
|
padding-left: 14px;
|
}
|
.right_opreat {
|
position: fixed;
|
width: calc(100% - 220px);
|
text-align: center;
|
line-height: 80px;
|
background: #fff;
|
z-index: 6;
|
bottom: 0;
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
margin-left: -80px;
|
line-height: 7px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
& .el-button--primary {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
background: #0081f0;
|
border-color: #0081f0;
|
border-radius: 4px;
|
margin-left: 40px;
|
}
|
}
|
.messageCheck {
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
align-items: center;
|
}
|
.checkSuccess {
|
font-size: 80px;
|
color: rgb(82, 196, 26);
|
}
|
.tip {
|
margin-top: 10px;
|
font-size: 20px;
|
}
|
.product_submit_dialog {
|
& >>> .el-button--default {
|
width: 120px;
|
height: 30px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
}
|
</style>
|