Commit b0450428 by 张权

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

V3.5.1

See merge request !25
2 parents 1c3466da 7d7342b1
<template>
<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>
<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"
......@@ -13,7 +13,7 @@
</el-radio-group>
</div>
<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" v-if="requestTip">以下红色标记为合同号不存在,判断为无效合同</p>
<div class="contract_area">
......@@ -36,12 +36,17 @@
width="160"
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>
</el-popover>
</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 class="file_info">
<div class="file_num">
......@@ -69,12 +74,15 @@
</template>
<script>
import util from '@/util/util'
import exampleImg from '@/assets/example.png'
import { ConcatSource } from 'webpack-sources'
export default {
name: 'index',
data() {
return {
size: 'small',
exampleImg,
uploaded: false,
isVisible: false,
requestTip: false,
contractNoStr: '',
......@@ -82,6 +90,7 @@
contractNoList: [],
errorNoList: [],
errorFileInfo:{},
fileData: {},
getListApi: this.$apis.addCode.getcodeList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40],
......@@ -209,6 +218,30 @@
this.$refs.file.value = ''
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()
reader.readAsDataURL(file)
reader.onload = event => {
......@@ -217,15 +250,24 @@
const fileName = file.name.split('.')
//fileUrl: 文件名 + @ + base64拼接
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 => {
loading.close()
if(res?.batchNo) {
res.fileName = file?.name
this.errorFileInfo = res
this.uploaded = true
}
this.$refs.file.value = ''
}).catch(err =>{
loading.close()
})
}
},
},
// 下载错误的合同号
handleExport() {
const params = {
......@@ -246,14 +288,30 @@
})
},
createCode() {
this.uploaded = false
this.isVisible = true
},
onOk(){
if(this.addType==1){
this.formatContractNo()
if(this?.contractNoList?.length>20){
return this.$message({
message:'最多输入20个合同号',
type: 'error',
customClass: 'msgHierarchy'
})
}
const params = {
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 => {
loading.close()
if(res?.batchNo){
if(res?.invalidList?.length){
this.$message({
......@@ -274,16 +332,11 @@
this.$message.success('操作成功')
}
}
}).catch(err =>{
loading.close()
})
}else{
if(this.errorFileInfo.effectiveSize<=0){
return this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
}
this.clearData()
this.handleUploadFile()
}
},
clearData(){
......@@ -294,6 +347,7 @@
this.contractNoList = [],
this.errorNoList = []
this.errorFileInfo = {}
this.fileData = {}
this.handleRest()
},
handleClose() {
......@@ -335,8 +389,10 @@
}
.manual {
margin-top: 10px;
padding-left: 154px;
.contract_input {
margin-left: 154px;
width: 432px;
/deep/ .el-textarea__inner {
width: 432px;
height: 79px;
......@@ -346,6 +402,7 @@
}
}
.textarea_tip{
margin-left: 154px;
font-weight: 400;
font-size: 12px;
color: red;
......@@ -353,12 +410,14 @@
}
.contract_area{
margin-top: 10px;
width: 432px;
width: 600px;
max-height: 340px;
overflow-y: auto;
margin-left: 60px;
.contract_item{
height: 26px;
width: 200px;
width: 280px;
white-space: nowrap;
display: inline-flex;
justify-content: space-between;
align-items: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!