Commit 25ef22dd by 张权

修复上传接口进度不正确情况

1 parent 652709e3
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</template> --> </template> -->
<!-- 选择框 --> <!-- 选择框 -->
<div v-else-if="item.type === 'select'"> <div v-else-if="item.type === 'select'">
<el-select :style="{ width: item.width || defaultWidth }" v-model="formObj[item.name]" :clearable="item.isClear || false" :placeholder="'请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)"> <el-select :style="{ width: item.width || defaultWidth }" v-model="formObj[item.name]" :clearable="item.isClear || false" :placeholder="item.placeholder || '请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option> <el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select> </el-select>
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
</template> </template>
<!-- 省市区 --> <!-- 省市区 -->
<el-cascader v-else-if="item.type === 'cascader'" filterable :disabled="item.isDisabled" ref="cascader" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" :placeholder="item.placeholder ? item.placeholder : '请选择省/请选择市/请选择区'" size="small " :options="regionData" v-model="formObj[item.name]" @change="item.handleChange"></el-cascader> <el-cascader v-else-if="item.type === 'cascader'" filterable :disabled="item.isDisabled" ref="cascader" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" :placeholder="item.placeholder || '请选择省/请选择市/请选择区'" size="small " :options="regionData" v-model="formObj[item.name]" @change="item.handleChange"></el-cascader>
</el-form-item> </el-form-item>
</template> </template>
<slot name="footer"></slot> <slot name="footer"></slot>
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
<el-button v-if="item.name == 'otherInfo'" slot="default" :disabled="pageType == 2" size="small" class="el-icon-plus">上传文件</el-button> <el-button v-if="item.name == 'otherInfo'" slot="default" :disabled="pageType == 2" size="small" class="el-icon-plus">上传文件</el-button>
<div slot="tip" class="remark" v-if="item.name == 'idCard'">身份证人像面</div> <div slot="tip" class="remark" v-if="item.name == 'idCard'">身份证人像面</div>
<div slot="tip" class="remark" v-if="item.name == 'idCardBack'">身份证国徽面</div> <div slot="tip" class="remark" v-if="item.name == 'idCardBack'">身份证国徽面</div>
<div slot="tip" :style="[{ 'margin-top': materialForm[item.name].length == 0 ? '5px' : '12px' }]" class="file-box" v-if="item.name == 'otherInfo'"> <div slot="tip" class="file-box" v-if="item.name == 'otherInfo'">
<span v-if="materialForm[item.name].length == 0" class="file_tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg .png .jpeg。图片类型大小不能超过9M,其他类型文件大小不能超过30M。</span> <span class="file_tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg .png .jpeg。图片类型大小不能超过9M,其他类型文件大小不能超过30M。</span>
<template v-else> <template>
<div class="bar_outer" v-for="(imgItem, imgId) in materialForm[item.name]" :key="imgId"> <div class="bar_outer" v-for="(imgItem, imgId) in materialForm[item.name]" :key="imgId">
<el-progress <el-progress
color="#F5F7FA" color="#F5F7FA"
...@@ -172,22 +172,28 @@ export default { ...@@ -172,22 +172,28 @@ export default {
const paramObj = { file: fileInfo, fileType: fileType } const paramObj = { file: fileInfo, fileType: fileType }
let param = {} let param = {}
param.fileList = [paramObj] param.fileList = [paramObj]
this.$apis.common this.$apis.common
.uploadFileApi(param, res => { .uploadFileApi(param, res => {
if (loading != null) { if (loading != null) {
loading.close() loading.close()
loading = null loading = null
} }
this.$set(this.materialForm[fieldName][id], 'progress', ((res.loaded / res.total) * 100).toFixed(2)) let progress = ((res.loaded / res.total) * 100).toFixed(2)
if (progress > 90) {
progress = 90
}
this.$set(this.materialForm[fieldName][id], 'progress', progress)
}) })
.then(res => { .then(res => {
if (res.code == '0') { if (res.code == '0') {
this.$set(this.materialForm[fieldName][id], 'url', res.data[0]) this.$set(this.materialForm[fieldName][id], 'url', res.data[0])
this.$set(this.materialForm[fieldName][id], 'progress', 100)
} else { } else {
// this.materialForm[fieldName] = this.materialForm[fieldName].filter(item => item.url) // this.materialForm[fieldName] = this.materialForm[fieldName].filter(item => item.url)
// console.log(this.materialForm[fieldName]) // console.log(this.materialForm[fieldName])
this.$set(this.materialForm[fieldName][id], 'progress', 100)
this.materialForm[fieldName].splice(id, 1) this.materialForm[fieldName].splice(id, 1)
this.$message.error('该文件上传失败')
} }
}) })
} }
...@@ -337,8 +343,8 @@ export default { ...@@ -337,8 +343,8 @@ export default {
position: absolute; position: absolute;
} }
.file-box { .file-box {
margin-top: 12px;
.file_tip { .file_tip {
margin: 8px 0;
font-size: 14px; font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
......
...@@ -118,6 +118,7 @@ export default { ...@@ -118,6 +118,7 @@ export default {
label: '收款账号所在省市', label: '收款账号所在省市',
name: 'bankCity', name: 'bankCity',
type: 'select', type: 'select',
placeholder:'可输入所在市关键词查询',
optionList: [], optionList: [],
optionId: 'code', optionId: 'code',
optionLabel: 'name', optionLabel: 'name',
......
...@@ -181,6 +181,7 @@ export default { ...@@ -181,6 +181,7 @@ export default {
label: '出险地点', label: '出险地点',
name: 'reimbursementAddress', name: 'reimbursementAddress',
type: 'cascader', type: 'cascader',
placeholder: '可输入省、市或区关键字搜索',
isDisabled, isDisabled,
isClear: true, isClear: true,
handleChange: cellValue => { handleChange: cellValue => {
...@@ -268,7 +269,7 @@ export default { ...@@ -268,7 +269,7 @@ export default {
label: '出险地点', label: '出险地点',
name: 'reimbursementAddress', name: 'reimbursementAddress',
type: 'cascader', type: 'cascader',
placeholder: '请选择省/市/区', placeholder: '可输入省、市或区关键字搜索',
isDisabled, isDisabled,
isClear: true, isClear: true,
handleChange: cellValue => { handleChange: cellValue => {
......
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
{ {
label: '门店提交时间', label: '门店提交时间',
prop: 'commitTime', prop: 'commitTime',
width: '160', width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.commitTime ? dayjs(cellValue.commitTime).format('YYYY-MM-DD HH:mm:ss') : '-' return cellValue.commitTime ? dayjs(cellValue.commitTime).format('YYYY-MM-DD HH:mm:ss') : '-'
} }
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
{ {
label: '提交国任时间', label: '提交国任时间',
prop: 'commitGuoRenDate', prop: 'commitGuoRenDate',
width: '160', width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.commitGuoRenDate ? dayjs(cellValue.commitGuoRenDate).format('YYYY-MM-DD HH:mm:ss') : '-' return cellValue.commitGuoRenDate ? dayjs(cellValue.commitGuoRenDate).format('YYYY-MM-DD HH:mm:ss') : '-'
} }
......
...@@ -201,28 +201,18 @@ export default { ...@@ -201,28 +201,18 @@ export default {
} }
}) })
if (requirePrice) { if (requirePrice) {
this.$message({ this.$message.error('至少输入一项服务的定损批准金额')
message: '至少输入一项服务的定损批准金额',
type: 'error'
})
return false return false
} }
let tipObj = { let fileTip = false
isTip: false,
tipMsg: ''
}
for (let key in this.materialForm) { for (let key in this.materialForm) {
if (this.materialForm[key].length < 1 && !tipObj.isTip) { if (this.materialForm[key].length < 1 && !fileTip) {
tipObj.isTip = true fileTip = true
tipObj.tipMsg = `请补全资料`
} }
} }
if (tipObj.isTip) { if (fileTip) {
this.$message({ this.$message.error(`请补全资料`)
message: tipObj.tipMsg,
type: 'error'
})
return false return false
} }
return valid return valid
...@@ -232,11 +222,18 @@ export default { ...@@ -232,11 +222,18 @@ export default {
if (type == 1 && !this.validAccountInfo()) { if (type == 1 && !this.validAccountInfo()) {
return false return false
} }
if (!this.routeInfo.orderId && type == 2 && !this.permitDraft) { let isUpload = false
this.$message({ for (let key in this.materialForm) {
message: '请同步信息之后再保存草稿', this.materialForm[key].forEach(item => {
type: 'error' if (!item.url) isUpload = true
}) })
}
if (isUpload) {
this.$message.error(`文件正在上传,请稍后再${type == 1 ? '提交' : '保存草稿'}`)
return false
}
if (!this.routeInfo.orderId && type == 2 && !this.permitDraft) {
this.$message.error('请同步信息之后再保存草稿')
return return
} }
const params = { ...this.editForm, ...this.accountForm } const params = { ...this.editForm, ...this.accountForm }
......
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
{ {
label: '门店提交时间', label: '门店提交时间',
prop: 'commitTime', prop: 'commitTime',
width: '160', width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.commitTime ? dayjs(cellValue.commitTime).format('YYYY-MM-DD HH:mm:ss') : '-' return cellValue.commitTime ? dayjs(cellValue.commitTime).format('YYYY-MM-DD HH:mm:ss') : '-'
} }
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
{ {
label: '提交国任时间', label: '提交国任时间',
prop: 'commitGuoRenDate', prop: 'commitGuoRenDate',
width: '160', width: '180',
formatter: cellValue => { formatter: cellValue => {
return cellValue.commitGuoRenDate ? dayjs(cellValue.commitGuoRenDate).format('YYYY-MM-DD HH:mm:ss') : '-' return cellValue.commitGuoRenDate ? dayjs(cellValue.commitGuoRenDate).format('YYYY-MM-DD HH:mm:ss') : '-'
} }
......
...@@ -201,28 +201,18 @@ export default { ...@@ -201,28 +201,18 @@ export default {
} }
}) })
if (requirePrice) { if (requirePrice) {
this.$message({ this.$message.error('至少输入一项服务的定损批准金额')
message: '至少输入一项服务的定损批准金额',
type: 'error'
})
return false return false
} }
let tipObj = { let fileTip = false
isTip: false,
tipMsg: ''
}
for (let key in this.materialForm) { for (let key in this.materialForm) {
if (this.materialForm[key].length < 1 && !tipObj.isTip) { if (this.materialForm[key].length < 1 && !fileTip) {
tipObj.isTip = true fileTip = true
tipObj.tipMsg = `请补全资料`
} }
} }
if (tipObj.isTip) { if (fileTip) {
this.$message({ this.$message.error(`请补全资料`)
message: tipObj.tipMsg,
type: 'error'
})
return false return false
} }
return valid return valid
...@@ -232,11 +222,18 @@ export default { ...@@ -232,11 +222,18 @@ export default {
if (type == 1 && !this.validAccountInfo()) { if (type == 1 && !this.validAccountInfo()) {
return false return false
} }
if (!this.routeInfo.orderId && type == 2 && !this.permitDraft) { let isUpload = false
this.$message({ for (let key in this.materialForm) {
message: '请同步信息之后再保存草稿', this.materialForm[key].forEach(item => {
type: 'error' if (!item.url) isUpload = true
}) })
}
if (isUpload) {
this.$message.error(`文件正在上传,请稍后再${type == 1 ? '提交' : '保存草稿'}`)
return false
}
if (!this.routeInfo.orderId && type == 2 && !this.permitDraft) {
this.$message.error('请同步信息之后再保存草稿')
return return
} }
const params = { ...this.editForm, ...this.accountForm } const params = { ...this.editForm, ...this.accountForm }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!