Commit b0450428 by 张权

Merge branch 'v3.5.1' into 'v3.6.0'

V3.5.1

See merge request !25
2 parents 1c3466da 7d7342b1
<template> <template>
<div class="container"> <div class="container">
<GLCombiForm ref="searchRef" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm> <GLCombiForm ref="searchRef" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm>
<el-button type="primary" :size="size" style="float:right;margin-bottom:10px;" @click="createCode">生成核销码</el-button> <el-button type="primary" :size="size" style="float:right;margin-bottom:10px;" @click="createCode">生成核销码</el-button>
<GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi"></GLTable> <GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi"></GLTable>
<GLDialog class="dialog_wrap" title="生成核销码" mode="mid" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" @onOk="onOk" <GLDialog class="dialog_wrap" title="生成核销码" mode="mid" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" @onOk="onOk"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</el-radio-group> </el-radio-group>
</div> </div>
<div class="manual" v-if="addType == 1"> <div class="manual" v-if="addType == 1">
<el-input type="textarea" @blur="formatContractNo" class="contract_input" v-model="contractNoStr" placeholder="请输入合同号"></el-input> <el-input type="textarea" class="contract_input" v-model="contractNoStr" placeholder="请输入合同号"></el-input>
<p class="textarea_tip" :style="{color: contractNoList.length > 20 ? 'red': '#999999'}">{{contractNoList.length > 20 ? '最多输入20个合同号':'多个合同号换行输入,最多20个合同号'}}</p> <p class="textarea_tip" :style="{color: contractNoList.length > 20 ? 'red': '#999999'}">{{contractNoList.length > 20 ? '最多输入20个合同号':'多个合同号换行输入,最多20个合同号'}}</p>
<p class="textarea_tip" v-if="requestTip">以下红色标记为合同号不存在,判断为无效合同</p> <p class="textarea_tip" v-if="requestTip">以下红色标记为合同号不存在,判断为无效合同</p>
<div class="contract_area"> <div class="contract_area">
...@@ -36,12 +36,17 @@ ...@@ -36,12 +36,17 @@
width="160" width="160"
trigger="hover" trigger="hover"
> >
<img style="width: 100%;" :src="require('@/assets/example.png')"> <!-- <img style="width: 100%;" :src="require('@/assets/example.png')"> -->
<el-image
style="width: 100px;"
:src="exampleImg"
:preview-src-list="[exampleImg]">
</el-image>
<span slot="reference">模版预览</span> <span slot="reference">模版预览</span>
</el-popover> </el-popover>
</div> </div>
</div> </div>
<div class="file_name" v-if="errorFileInfo.fileName">{{errorFileInfo.fileName}}</div> <div class="file_name" v-if="fileData && fileData.name">{{fileData.name}}</div>
</div> </div>
<div class="file_info"> <div class="file_info">
<div class="file_num"> <div class="file_num">
...@@ -69,12 +74,15 @@ ...@@ -69,12 +74,15 @@
</template> </template>
<script> <script>
import util from '@/util/util' import util from '@/util/util'
import exampleImg from '@/assets/example.png'
import { ConcatSource } from 'webpack-sources' import { ConcatSource } from 'webpack-sources'
export default { export default {
name: 'index', name: 'index',
data() { data() {
return { return {
size: 'small', size: 'small',
exampleImg,
uploaded: false,
isVisible: false, isVisible: false,
requestTip: false, requestTip: false,
contractNoStr: '', contractNoStr: '',
...@@ -82,6 +90,7 @@ ...@@ -82,6 +90,7 @@
contractNoList: [], contractNoList: [],
errorNoList: [], errorNoList: [],
errorFileInfo:{}, errorFileInfo:{},
fileData: {},
getListApi: this.$apis.addCode.getcodeList, getListApi: this.$apis.addCode.getcodeList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40], pageSizes: [5, 10, 20, 30, 40],
...@@ -209,6 +218,30 @@ ...@@ -209,6 +218,30 @@
this.$refs.file.value = '' this.$refs.file.value = ''
return false return false
} }
this.uploaded = false
this.fileData = file
},
handleUploadFile(){
if(!this.fileData.size) return this.$message({
message:'请上传文件',
type: 'error',
customClass: 'msgHierarchy'
});
if(this.uploaded){
if(this.errorFileInfo.effectiveSize<=0){
this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
this.fileData = {}
}else{
this.clearData()
}
this.uploaded = false
return false
}
const file = this.fileData
const reader = new FileReader() const reader = new FileReader()
reader.readAsDataURL(file) reader.readAsDataURL(file)
reader.onload = event => { reader.onload = event => {
...@@ -217,15 +250,24 @@ ...@@ -217,15 +250,24 @@
const fileName = file.name.split('.') const fileName = file.name.split('.')
//fileUrl: 文件名 + @ + base64拼接 //fileUrl: 文件名 + @ + base64拼接
const fileUrl = fileName.pop() + '@' + arrBase64[1] const fileUrl = fileName.pop() + '@' + arrBase64[1]
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.addCode.uploadCodeFile({ file: fileUrl }).then(res => { this.$apis.addCode.uploadCodeFile({ file: fileUrl }).then(res => {
loading.close()
if(res?.batchNo) { if(res?.batchNo) {
res.fileName = file?.name
this.errorFileInfo = res this.errorFileInfo = res
this.uploaded = true
} }
this.$refs.file.value = '' this.$refs.file.value = ''
}).catch(err =>{
loading.close()
}) })
} }
}, },
// 下载错误的合同号 // 下载错误的合同号
handleExport() { handleExport() {
const params = { const params = {
...@@ -246,14 +288,30 @@ ...@@ -246,14 +288,30 @@
}) })
}, },
createCode() { createCode() {
this.uploaded = false
this.isVisible = true this.isVisible = true
}, },
onOk(){ onOk(){
if(this.addType==1){ if(this.addType==1){
this.formatContractNo()
if(this?.contractNoList?.length>20){
return this.$message({
message:'最多输入20个合同号',
type: 'error',
customClass: 'msgHierarchy'
})
}
const params = { const params = {
contractNoList: this.contractNoList.map(item => item.val) contractNoList: this.contractNoList.map(item => item.val)
} }
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.addCode.createCode(params).then(res => { this.$apis.addCode.createCode(params).then(res => {
loading.close()
if(res?.batchNo){ if(res?.batchNo){
if(res?.invalidList?.length){ if(res?.invalidList?.length){
this.$message({ this.$message({
...@@ -274,16 +332,11 @@ ...@@ -274,16 +332,11 @@
this.$message.success('操作成功') this.$message.success('操作成功')
} }
} }
}).catch(err =>{
loading.close()
}) })
}else{ }else{
if(this.errorFileInfo.effectiveSize<=0){ this.handleUploadFile()
return this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
}
this.clearData()
} }
}, },
clearData(){ clearData(){
...@@ -294,6 +347,7 @@ ...@@ -294,6 +347,7 @@
this.contractNoList = [], this.contractNoList = [],
this.errorNoList = [] this.errorNoList = []
this.errorFileInfo = {} this.errorFileInfo = {}
this.fileData = {}
this.handleRest() this.handleRest()
}, },
handleClose() { handleClose() {
...@@ -335,8 +389,10 @@ ...@@ -335,8 +389,10 @@
} }
.manual { .manual {
margin-top: 10px; margin-top: 10px;
padding-left: 154px;
.contract_input { .contract_input {
margin-left: 154px;
width: 432px;
/deep/ .el-textarea__inner { /deep/ .el-textarea__inner {
width: 432px; width: 432px;
height: 79px; height: 79px;
...@@ -346,6 +402,7 @@ ...@@ -346,6 +402,7 @@
} }
} }
.textarea_tip{ .textarea_tip{
margin-left: 154px;
font-weight: 400; font-weight: 400;
font-size: 12px; font-size: 12px;
color: red; color: red;
...@@ -353,12 +410,14 @@ ...@@ -353,12 +410,14 @@
} }
.contract_area{ .contract_area{
margin-top: 10px; margin-top: 10px;
width: 432px; width: 600px;
max-height: 340px; max-height: 340px;
overflow-y: auto; overflow-y: auto;
margin-left: 60px;
.contract_item{ .contract_item{
height: 26px; height: 26px;
width: 200px; width: 280px;
white-space: nowrap;
display: inline-flex; display: inline-flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!