<template>
|
<div v-if="isNew">
|
<div class="left">
|
<LeftMenus :menuItems="menuItems"
|
@jump="jump"
|
@backList="backFirstReadingList" />
|
</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 class="item_set_class"
|
v-for="(child, index) in item.children"
|
:key="index">
|
<MenusTitle :title="child.label"
|
v-if="!isDetail" />
|
<CreateForms :isView="true"
|
v-if="child.type === 'FORMS' && child.name !== 'APPROVEOPTION'"
|
:screenWidth="screenWidth"
|
:ref="child.name"
|
:isShowOld="showOld"
|
:isShowBorder="isShowBorder"
|
:oldVal="child.oldVal"
|
:formItems="child.formItems"
|
:defValues="child.defValues"
|
:formRules="child.formRules"
|
@handleSelOnChange="handleSelOnChange"
|
@handleElmentChange="handleElmentChange" />
|
<CreateForms v-if="
|
child.type === 'FORMS' &&
|
child.name === 'APPROVEOPTION' &&
|
!isDetail
|
"
|
:screenWidth="screenWidth"
|
:ref="child.name"
|
:isShowOld="showOld"
|
:oldVal="child.oldVal"
|
:formItems="child.formItems"
|
:defValues="child.defValues"
|
:formRules="child.formRules"
|
@handleSelOnChange="handleSelOnChange"
|
@handleElmentChange="handleElmentChange" />
|
<ApprovalList v-if="child.name === 'APPROVEANDINFO'" />
|
</div>
|
</div>
|
<ProCustomersList v-if="item.name === 'PROCUSTOMERSLIST'"
|
ref="customersList"
|
:isView="true"
|
:isShowBorder="isShowBorder" />
|
<ProDimensionList v-if="item.name === 'PRODIMENSIONLIST'"
|
ref="dimensionList"
|
:screenWidth="screenWidth"
|
:isView="true"
|
:isShowBorder="isShowBorder" />
|
<el-row v-if="item.name === 'IMAGESDOC'"
|
style="margin-left:2px;">
|
<el-col :span="12">
|
<FileUpload :fileInfo="proDocFileInfo"
|
:isUpload="false"
|
@beforeAvatarUpload="beforeAvatarUpload"
|
@handleImageClick="handleImageClick"
|
@handleUpload="handleUpload"
|
@handleDelete="handleDelete" />
|
</el-col>
|
<el-col :span="12">
|
<FileUpload :fileInfo="otherFileInfo"
|
:isUpload="false"
|
@beforeAvatarUpload="beforeAvatarUpload"
|
@handleImageClick="handleImageClick"
|
@handleUpload="handleUpload"
|
@handleDelete="handleDelete" />
|
</el-col>
|
</el-row>
|
<el-row class="right_opreat"
|
v-if="!isDetail">
|
<el-button type="primary"
|
:loading="subLoading"
|
class="submit_button"
|
@click="submitOption">提交</el-button>
|
<el-button class="save_button"
|
@click="backFirstReadingList"
|
:disabled="subLoading">关闭</el-button>
|
</el-row>
|
<!-- <el-row class="right_opreat">
|
<el-button class="save_button" @click="handleSave"
|
>保存草稿</el-button
|
>
|
<el-button type="primary" class="submit_button" @click="submitForm"
|
>提交</el-button
|
>
|
</el-row> -->
|
</div>
|
<el-dialog custom-class="product_submit_dialog"
|
:visible.sync="commitDialogVisible"
|
width="400px"
|
center>
|
<div class="messageCheck">
|
<i class="el-icon-success checkSuccess"></i>
|
<div class="tip">提交成功</div>
|
</div>
|
<span slot="footer"
|
class="dialog-footer">
|
<el-button @click="enterMessages">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</div>
|
</template>
|
<script>
|
import { PRODUCTAPPROVEMENUS } from '../utils/menusConfig.js'
|
import { rmoney } from '../utils/currency'
|
import {
|
PRODUCTOPTIONS,
|
PRODUCTOPTIONSENUM
|
} from '../utils/optionsQueryConfig.js'
|
import LeftMenus from '../components/LeftMenus.vue'
|
import ModuleTitle from '../components/ModuleTitle.vue'
|
import MenusTitle from '../components/MenusTitle.vue'
|
import FileUpload from '../components/FileUpload.vue'
|
import CreateForms from '../components/CreateForms.vue'
|
import ProCustomersList from '../management/components/ProCustomersList.vue'
|
import ProDimensionList from '../management/components/productDimension/ProDimensionList.vue'
|
import ApprovalList from './ApprovalList.vue'
|
import {
|
qryDropDownOptionBatch,
|
initProductInfo,
|
saveProductInfo,
|
qryProductImageInfo,
|
addFileForProductInfo,
|
delFileForProductInfo,
|
productFlowSubmit,
|
qryProductDetailInfo,
|
qryInputUserInfo,
|
qryCommitActionRange
|
} from '../api/productManage.api.js'
|
export default {
|
data () {
|
return {
|
screenWidth: document.documentElement.clientWidth || 1280, // 屏幕宽度
|
menuItems: [...PRODUCTAPPROVEMENUS()],
|
optionsMap: {},
|
serialno: this.$route.query.serialno,
|
productid: this.$route.query.productid,
|
newWindow: null,
|
type: '',
|
oldVal: {},
|
showOld: this.$route.query.objecttype === 'jbo.app.BUSINESS_TYPE_CHANGE',
|
objecttype: this.$route.query.objecttype,
|
detailData: {},
|
typeno: this.$route.query.productid,
|
oldTypeNo: '',
|
proDocFileInfo: {
|
required: false,
|
description: '产品资料',
|
count: 0,
|
key: 'productInfo'
|
},
|
otherFileInfo: {
|
required: false,
|
description: '其他资料',
|
count: 0,
|
key: 'productOtherInfo'
|
},
|
isNew: true,
|
subLoading: false,
|
isDetail: this.$route.query.from === 'detail',
|
isShowBorder: !(this.$route.query.from === 'detail'),
|
isBaseForm: false,
|
isAmountForm: false,
|
isBusinessForm: false,
|
commitDialogVisible: false // 提交弹框
|
}
|
},
|
components: {
|
LeftMenus,
|
ModuleTitle,
|
MenusTitle,
|
CreateForms,
|
FileUpload,
|
ProCustomersList,
|
ProDimensionList,
|
ApprovalList
|
},
|
computed: {
|
SERIALNO () {
|
return this.$route.query.serialno
|
},
|
PRODUCTID () {
|
return this.$route.query.productid
|
},
|
OBJECTTYPE () {
|
return this.$route.query.objecttype
|
}
|
},
|
async mounted () {
|
window.addEventListener('scroll', this.onScroll)
|
window.addEventListener('resize', this.getScreenWidth)
|
this.$router.afterEach((to, from, next) => {
|
window.scrollTo(0, 0)
|
})
|
this.serialno = this.SERIALNO
|
this.productid = this.PRODUCTID
|
this.objecttype = this.OBJECTTYPE
|
this.typeno = this.PRODUCTID
|
this.type = 'edit'
|
!this.isDetail && (await this.getCommitActionRange())
|
await this.getOptions()
|
await this.getProductDetailInfo()
|
await this.getProductImageInfo()
|
// const approveForm = this.$refs.APPROVEOPTION[0]
|
// approveForm.$refs['createForm'].resetFields()
|
// this.$refs.dimensionList[0] &&
|
// this.$refs.dimensionList[0].getProductDimensionsList()
|
},
|
async activated () {
|
this.isNew = true
|
},
|
destroyed () {
|
window.removeEventListener('scroll', this.onScroll)
|
window.removeEventListener('resize', this.getScreenWidth)
|
},
|
deactivated () {
|
this.new = false
|
},
|
methods: {
|
// 返回列表
|
backFirstReadingList () {
|
this.$router.go(-1)
|
},
|
// 维度元素change事件
|
handleElmentChange (elments) {
|
this.$refs.dimensionList[0].restTable(elments)
|
this.handleSave()
|
},
|
handleSelOnChange (name, value) {
|
const baseForm = this.$refs.BASEINFO[0]
|
const amountForm = this.$refs.PROAMOUNTINFO[0]
|
const approveForm = this.$refs.APPROVEOPTION[0]
|
if (name === 'phasechoice') {
|
approveForm.formValues.phaseopinion = ''
|
approveForm.formRules.phaseopinion = [
|
{
|
required: value !== '01',
|
message: '请输入审批意见',
|
trigger: 'blur'
|
}
|
]
|
return false
|
}
|
if (name === 'suitableflow') {
|
const suitablefObj = this.getOptionItems('suitableflow').find(item => {
|
// 这里的userList就是上面遍历的数据源
|
return item.value === value
|
})
|
baseForm.formValues.suitableflow = suitablefObj.value
|
baseForm.formValues.suitableflowname = suitablefObj.label
|
}
|
if (name === 'attribute3') {
|
const newFormItems = [...baseForm.formItems].map(form => {
|
const newForm = { ...form }
|
const checkForms = [
|
'attribute22',
|
'attribute23',
|
'attribute17',
|
'attribute18'
|
]
|
if (
|
checkForms.includes(newForm.name) &&
|
(newForm.name === 'attribute22' || newForm.name === 'attribute23')
|
) {
|
newForm.show = value === 'M'
|
baseForm.formValues.attribute17 = ''
|
baseForm.formValues.attribute18 = ''
|
baseForm.$refs['createForm'].clearValidate([
|
'attribute17',
|
'attribute18'
|
])
|
} else if (
|
checkForms.includes(newForm.name) &&
|
(newForm.name === 'attribute17' || newForm.name === 'attribute18')
|
) {
|
newForm.show = value === 'D'
|
baseForm.formValues.attribute22 = ''
|
baseForm.formValues.attribute23 = ''
|
baseForm.$refs['createForm'].clearValidate([
|
'attribute22',
|
'attribute23'
|
])
|
}
|
return newForm
|
})
|
this.handleShowContrl(
|
'BASEINFO',
|
'BASEINFO',
|
'formItems',
|
newFormItems
|
)
|
return
|
}
|
if (name === 'attribute12') {
|
const newFormItems = [...amountForm.formItems].map(form => {
|
const newForm = { ...form }
|
if (newForm.name === 'attribute15') {
|
amountForm.$refs['createForm'].clearValidate([
|
'attribute15',
|
'attribute13'
|
])
|
amountForm.formValues.attribute15 = ''
|
newForm.show = value === '1'
|
}
|
return newForm
|
})
|
this.handleShowContrl(
|
'BASEINFO',
|
'PROAMOUNTINFO',
|
'formItems',
|
newFormItems
|
)
|
}
|
},
|
// 处理联动的显示或隐藏
|
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)
|
},
|
// 获取子元素
|
getChildItem (name, childName, itemName) {
|
const { menuItems } = this
|
const parents = menuItems.filter(parent => parent.name === name)[0]
|
const children = parents.children.filter(
|
child => child.name === childName
|
)[0]
|
return children[itemName]
|
},
|
// 提交审批意见
|
submitOption () {
|
const approveForm = this.$refs.APPROVEOPTION[0]
|
const { phasechoice, phaseopinion } = approveForm.formValues
|
approveForm.$refs['createForm'].validate(valid => {
|
if (valid) {
|
this.handleSubmitproductFlow(phasechoice, phaseopinion)
|
} else {
|
!phasechoice && this.$message.warning('请选择审批结果')
|
phasechoice &&
|
!phaseopinion &&
|
this.$message.warning('请输入审批意见')
|
return false
|
}
|
})
|
},
|
// 查询产品详情信息
|
async getProductDetailInfo () {
|
const { objecttype } = this
|
const params = {
|
serialno: this.serialno,
|
showoldvalue: objecttype === 'jbo.app.BUSINESS_TYPE_CHANGE'
|
}
|
const loading = this.$loading({
|
lock: true,
|
text: '加载中',
|
background: 'hsla(0,0%,100%,.9)'
|
})
|
setTimeout(() => {
|
loading.close()
|
}, 1500)
|
const detailsRes = await qryProductDetailInfo(params)
|
if (!detailsRes || detailsRes.code !== '00') {
|
return false
|
}
|
let detailData = {}
|
let oldVal = {}
|
Object.getOwnPropertyNames(detailsRes.result).forEach(key => {
|
detailData[key] = detailsRes.result[key].value
|
oldVal[key] = detailsRes.result[key].oldValue
|
if (key === 'attribute13') {
|
detailData[key] =
|
detailsRes.result[key].value &&
|
detailsRes.result[key].value.split(',')
|
}
|
})
|
this.$set(this, 'oldVal', oldVal)
|
const baseFormItems = this.getChildItem(
|
'BASEINFO',
|
'BASEINFO',
|
'formItems'
|
)
|
const amountFormItems = this.getChildItem(
|
'BASEINFO',
|
'PROAMOUNTINFO',
|
'formItems'
|
)
|
const baseDefValues = this.getChildItem(
|
'BASEINFO',
|
'BASEINFO',
|
'defValues'
|
)
|
const amountValues = this.getChildItem(
|
'BASEINFO',
|
'PROAMOUNTINFO',
|
'defValues'
|
)
|
const businessValues = this.getChildItem(
|
'BASEINFO',
|
'PROBUSINESSINFO',
|
'defValues'
|
)
|
const newFormsItems = [...baseFormItems].map(form => {
|
const newForm = { ...form }
|
if (newForm.name === 'attribute22' || newForm.name === 'attribute23') {
|
newForm.show = detailData.attribute3 === 'M'
|
} else if (
|
newForm.name === 'attribute17' ||
|
newForm.name === 'attribute18'
|
) {
|
newForm.show = detailData.attribute3 === 'D'
|
}
|
if (newForm.name === 'attribute15') {
|
newForm.show = detailData.attribute12 === '1'
|
}
|
return newForm
|
})
|
const newAmountFormItems = [...amountFormItems].map(form => {
|
const newForm = { ...form }
|
if (newForm.name === 'attribute15') {
|
newForm.show = detailData.attribute12 === '1'
|
}
|
return newForm
|
})
|
const checkeds = detailData.elementname
|
? detailData.elementname.split(';').filter(Boolean)
|
: ''
|
const transferVal = checkeds
|
? checkeds.map(sel => {
|
const selObj = this.getOptionItems('elementname').filter(el =>
|
el.label.includes(sel.trim())
|
)
|
return selObj[0] && selObj[0].value
|
})
|
: []
|
this.$refs.dimensionList[0].restTable(transferVal)
|
const baseForm = this.$refs.BASEINFO[0]
|
baseForm.transferVal = transferVal
|
this.handleShowContrl('BASEINFO', 'BASEINFO', 'formItems', newFormsItems)
|
this.handleShowContrl(
|
'BASEINFO',
|
'PROAMOUNTINFO',
|
'formItems',
|
newAmountFormItems
|
)
|
this.handleShowContrl('BASEINFO', 'BASEINFO', 'defValues', {
|
...baseDefValues,
|
...detailData,
|
attribute16: parseInt(detailData.attribute16)
|
})
|
this.handleShowContrl('BASEINFO', 'PROAMOUNTINFO', 'defValues', {
|
...amountValues,
|
...detailData
|
})
|
this.handleShowContrl('BASEINFO', 'PROBUSINESSINFO', 'defValues', {
|
...businessValues,
|
...detailData
|
})
|
const itemMenus = [...this.menuItems].map(item => {
|
const newItem = { ...item }
|
if (newItem.name === 'BASEINFO') {
|
const newChildren = newItem.children.map(child => {
|
const newChild = { ...child }
|
newChild.oldVal = oldVal
|
return newChild
|
})
|
newItem.children = newChildren
|
}
|
return newItem
|
})
|
this.$set(this, 'menuItems', itemMenus)
|
},
|
getScreenWidth () {
|
this.$set(this, 'screenWidth', document.body.offsetWidth)
|
},
|
// 获取用户基本信息
|
async getInputUserInfo () {
|
const userInfoRes = await qryInputUserInfo()
|
if (userInfoRes && userInfoRes.code === '00') {
|
const newDefValues = {
|
...this.getChildItem('BASEINFO', 'BASEINFO', 'defValues'),
|
...userInfoRes.result
|
}
|
this.handleShowContrl(
|
'BASEINFO',
|
'BASEINFO',
|
'defValues',
|
newDefValues
|
)
|
}
|
},
|
async getCommitActionRange () {
|
const params = {
|
objectno: this.serialno,
|
objecttype: this.objecttype
|
}
|
const res = await qryCommitActionRange(params)
|
if (!res || res.code !== '00') {
|
return false
|
}
|
const itemMenus = [...this.menuItems].concat().map(item => {
|
const newItem = { ...item }
|
if (newItem.name === 'APPROVEINFO') {
|
const newChildren = newItem.children.map(child => {
|
const newChild = { ...child }
|
let newFormItems = []
|
if (newChild.name === 'APPROVEOPTION') {
|
newFormItems = newChild.formItems.map(forms => {
|
const newForms = { ...forms }
|
if (newForms.options) {
|
newForms.options = res.result
|
}
|
return newForms
|
})
|
newChild.formItems = newFormItems
|
}
|
return newChild
|
})
|
newItem.children = newChildren
|
}
|
return newItem
|
})
|
this.$set(this, 'menuItems', itemMenus)
|
},
|
async getOptions () {
|
const params = [...PRODUCTOPTIONS]
|
const res = await qryDropDownOptionBatch(params)
|
if (res.code !== '00') {
|
return false
|
}
|
this.optionsMap = res.result
|
const itemMenus = [...this.menuItems].map(item => {
|
const newItem = { ...item }
|
if (newItem.name === 'BASEINFO') {
|
const newChildren = newItem.children.map(child => {
|
const newChild = { ...child }
|
const newFormItems = newChild.formItems.map(forms => {
|
const newForms = { ...forms }
|
newForms.placeholder = ''
|
newForms.readonly = true
|
if (newForms.options) {
|
newForms.options = [...this.getOptionItems(forms.name)]
|
}
|
return newForms
|
})
|
newChild.formItems = newFormItems
|
newChild.oldVal = this.oldVal
|
return newChild
|
})
|
newItem.children = newChildren
|
}
|
return newItem
|
})
|
this.$set(this, 'menuItems', itemMenus)
|
},
|
// 初始化产品信息
|
async initProduct (params, from, filedata, key) {
|
const proRes = await initProductInfo(params)
|
if (proRes.code !== '00') {
|
return false
|
}
|
this.serialno = proRes.result.serialno
|
this.objecttype = proRes.result.objecttype
|
if (from === 'dimension') {
|
this.$router.push({
|
name: 'dimensionAdd',
|
query: {
|
typeno: params.typeno,
|
objectno: proRes.result.serialno
|
}
|
})
|
}
|
if (from === 'customer') {
|
this.$refs.customersList[0].handleAddCus()
|
}
|
this.getProductImageInfo('init', filedata, key)
|
return proRes.result
|
},
|
// 获取产品影像信息
|
async getProductImageInfo (isInit, filedata, key) {
|
const proImageRes = await qryProductImageInfo({
|
objectno: this.typeno
|
})
|
if (proImageRes.code !== '00') {
|
return ''
|
}
|
this.$set(
|
this,
|
'proDocFileInfo',
|
proImageRes.result.filter(item => item.key === 'productInfo')[0]
|
)
|
this.$set(
|
this,
|
'otherFileInfo',
|
proImageRes.result.filter(item => item.key === 'productOtherInfo')[0]
|
)
|
if (isInit === 'init') {
|
this.handleUpload(filedata, key)
|
}
|
},
|
getOptionItems (name) {
|
const { optionsMap } = this
|
return optionsMap[PRODUCTOPTIONSENUM[name]]
|
},
|
// 保存草稿
|
async handleSave (type, from, filedata, key) {
|
await this.validateBase()
|
const { isBaseForm } = this
|
if (!isBaseForm) {
|
return false
|
}
|
const _this = this.$refs.BASEINFO[0]
|
const { typeno } = _this.formValues
|
this.typeno = this.productid = typeno
|
_this.$refs['createForm'].validateField('typeno', async errorMessage => {
|
if (errorMessage) {
|
this.$message.error(errorMessage)
|
return false
|
}
|
const { serialno } = this
|
!serialno &&
|
(await this.initProduct(
|
{
|
typeno
|
},
|
from,
|
filedata,
|
key
|
))
|
!!serialno && (await this.saveProduct(false, type))
|
})
|
},
|
// 保存产品信息
|
async saveProduct (checkflag, type) {
|
const {
|
inputuser,
|
inputtime,
|
updateuser,
|
updatetime,
|
...params
|
} = this.getProParams(checkflag)
|
const res = await saveProductInfo(params)
|
if (res.code !== '00') {
|
this.$message.error(res.msg)
|
return false
|
}
|
if (!checkflag && type !== 'init') {
|
this.$message({
|
message: '草稿已保存',
|
type: 'success'
|
})
|
}
|
},
|
// 获取显示表单对应的value值
|
getFormItemsValue (forms, values) {
|
const showForms = forms.filter(form => form.show !== false)
|
let formsValue = {}
|
showForms.forEach(form => {
|
formsValue[form.name] = values[form.name]
|
})
|
return formsValue
|
},
|
// 获取保存产品信息params
|
getProParams (checkflag) {
|
const { serialno } = this
|
// 获取基本信息表单
|
const baseForm = this.$refs.BASEINFO[0]
|
// 获取额度信息表单
|
const amountForm = this.$refs.PROAMOUNTINFO[0]
|
// 获取业务信息表单
|
const businessForm = this.$refs.PROBUSINESSINFO[0]
|
const {
|
typeno,
|
typename,
|
attribute2,
|
attribute3,
|
attribute22,
|
attribute23,
|
attribute17,
|
attribute18,
|
elementname,
|
attribute16,
|
suitableflow,
|
suitableflowname,
|
attribute5,
|
attribute6,
|
attribute19
|
} = baseForm.formValues
|
const {
|
attribute7,
|
attribute11,
|
attribute8,
|
attribute10,
|
attribute12,
|
attribute15,
|
attribute13,
|
minsingleloansum,
|
maxsingleloansum,
|
mincreditsum,
|
maxcreditsum
|
} = amountForm.formValues
|
const {
|
customerBaseConfirmWay,
|
attribute21,
|
attribute14,
|
attribute4,
|
attribute24,
|
mergeCreditLoan,
|
thereviewsum,
|
thefinalsum,
|
preapproved
|
} = businessForm.formValues
|
const otherParams = {
|
typeno,
|
typename,
|
attribute2,
|
attribute3,
|
attribute22,
|
attribute23,
|
attribute17,
|
attribute18,
|
elementname,
|
attribute16,
|
suitableflow,
|
suitableflowname,
|
attribute5,
|
attribute6,
|
attribute19,
|
attribute7,
|
attribute11,
|
attribute8,
|
attribute10,
|
attribute12,
|
attribute15,
|
minsingleloansum: rmoney(minsingleloansum),
|
maxsingleloansum: rmoney(maxsingleloansum),
|
mincreditsum: rmoney(mincreditsum),
|
maxcreditsum: rmoney(maxcreditsum),
|
attribute13: attribute13.toString(),
|
customerBaseConfirmWay,
|
attribute21,
|
attribute14,
|
attribute4,
|
attribute24,
|
mergeCreditLoan,
|
thereviewsum,
|
thefinalsum,
|
preapproved,
|
serialno,
|
checkflag
|
}
|
return otherParams
|
},
|
async submitForm () {
|
await this.validateBase()
|
await this.validateAmount()
|
await this.validateBusiness()
|
const { isBaseForm, isAmountForm, isBusinessForm } = this
|
if (!isBaseForm || !isAmountForm || !isBusinessForm) {
|
return false
|
}
|
const { serialno } = this
|
serialno && (await this.handleSubmitproductFlow())
|
},
|
// 产品流程提交
|
async handleSubmitproductFlow (phasechoice, phaseopinion) {
|
this.subLoading = true
|
const { serialno, objecttype } = this
|
const params = {
|
objectNo: serialno,
|
objectType: objecttype,
|
phasechoice,
|
phaseopinion
|
}
|
// await this.saveProduct(true)
|
const subRes = await productFlowSubmit(params)
|
this.subLoading = false
|
if (!subRes || subRes.code !== '00') {
|
return false
|
}
|
this.commitDialogVisible = true
|
},
|
enterMessages () {
|
const approveForm = this.$refs.APPROVEOPTION[0]
|
approveForm.formValues.phaseopinion = ''
|
approveForm.formRules.phaseopinion = ''
|
approveForm.$refs['createForm'].resetFields()
|
this.commitDialogVisible = false
|
this.backFirstReadingList()
|
},
|
// 校验基本信息
|
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
|
}
|
})
|
},
|
// 校验额度信息
|
validateAmount () {
|
// 获取额度信息表单
|
const amountForm = this.$refs.PROAMOUNTINFO[0]
|
amountForm.$refs['createForm'].validate(async valid => {
|
if (valid) {
|
this.isAmountForm = true
|
} else {
|
this.isAmountForm = false
|
this.$message.error('请完善额度信息必填项!')
|
return false
|
}
|
})
|
},
|
// 校验业务信息
|
validateBusiness () {
|
// 获取业务信息表单
|
const businessForm = this.$refs.PROBUSINESSINFO[0]
|
businessForm.$refs['createForm'].validate(async valid => {
|
if (valid) {
|
this.isBusinessForm = true
|
} else {
|
this.isBusinessForm = false
|
this.$message.error('请完善业务信息必填项!')
|
return false
|
}
|
})
|
},
|
// 上传前事件
|
async beforeAvatarUpload (file, key) {
|
// const fileType = file.name.substring(file.name.lastIndexOf('.') + 1)
|
const { typeno } = this
|
if (!typeno) {
|
await this.handleSave('init', 'upload', file, key)
|
return false
|
}
|
return !!typeno
|
},
|
// 上传文件
|
handleUpload (fileData, key) {
|
if (!fileData || !this.typeno) {
|
return false
|
}
|
const { proDocFileInfo, otherFileInfo } = this
|
const { docNo = '', docType = '' } =
|
key === 'productInfo' ? proDocFileInfo : otherFileInfo
|
const { objecttype } = this
|
const formData = new FormData()
|
formData.append('file', fileData)
|
formData.append('docNo', docNo)
|
formData.append('docType', docType)
|
formData.append('objectNo', this.typeno)
|
formData.append('objectType', objecttype)
|
addFileForProductInfo(formData).then(res => {
|
if (res.code === '00') {
|
this.$message.success('上传成功!')
|
this.getProductImageInfo()
|
}
|
})
|
},
|
// 删除文件
|
handleDelete (attachmentno) {
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
let params = {
|
attachmentno
|
}
|
delFileForProductInfo(params).then(res => {
|
if (res.code === '00') {
|
this.$message.success('删除成功!')
|
this.getProductImageInfo()
|
}
|
})
|
})
|
.catch(() => { })
|
},
|
// 点击图片预览
|
async handleImageClick (file, fileInfo, objectno, typeno) {
|
const { attachmentno, docno } = file
|
const { objectNo, docType } = fileInfo
|
const objecttype = 'jbo.app.BUSINESS_TYPE'
|
const routeStr = location.href.includes('#') ? '#/' : ''
|
const query = `attachmentno=${attachmentno}&serialno=${docno}&objectno=${objectNo}&objecttype=${objecttype}&typeno=${docType}&from=PRO`
|
let baseUrl = process.env.VUE_APP_HOST_PATH
|
if (location.hostname === 'scp.jycash.cn') {
|
baseUrl = process.env.VUE_APP_PROD_API_HOST
|
}
|
this.newWindow = window.open(
|
`${location.origin}${baseUrl}${routeStr}file-view?${query}`,
|
'newwindow',
|
'height=700px, width=800px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'
|
)
|
},
|
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 + 50 >=
|
scrollItems[i].offsetTop - scrollItems[0].offsetTop
|
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="postcss" scoped>
|
.left {
|
width: 160px;
|
height: 100%;
|
position: fixed;
|
outline: 1px solid #eeeeee;
|
background: #fff;
|
z-index: 999;
|
}
|
.right {
|
position: absolute;
|
width: calc(100% - 220px);
|
padding: 20px 30px;
|
background: rgba(249, 249, 249, 1);
|
right: 0;
|
& >>> .el-dialog__wrapper {
|
z-index: 2006;
|
& .product_submit_dialog {
|
& .el-dialog__footer {
|
& .dialog-footer {
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
border-radius: 4px;
|
line-height: 2px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
}
|
}
|
}
|
}
|
}
|
.scroll_item {
|
min-height: 200px;
|
background: rgba(249, 249, 249, 1);
|
padding-bottom: 10px;
|
}
|
.item_set_class {
|
padding-left: 14px;
|
& >>> .form_main {
|
min-height: 200px;
|
}
|
}
|
.right_opreat {
|
position: fixed;
|
width: 100%;
|
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;
|
margin-right: 120px;
|
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-right: 120px;
|
}
|
}
|
.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;
|
}
|
</style>
|