Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH

This commit is contained in:
高嵩
2023-03-26 11:03:47 +08:00
9 changed files with 365 additions and 65 deletions
@@ -0,0 +1,239 @@
<template>
<div>
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-upload-dragger
:accept='accept'
:disabled="disabled"
class="ant-upload-list"
:class="{'uploadFile':isUploadFile}"
name="file"
:file-list="myfileList"
:multiple="multiple"
:action="uploadAction+'?state='+state+'&cut='+cut"
:headers="headers"
@preview="preview"
:before-upload="beforeUpload"
:remove='remove'
@change="handleChange">
<p v-if="!isUploadFile">
<a-icon class="action-upload" type="cloud-upload"/>
</p>
<p v-if="!isUploadFile" class="ant-upload-text" style="font-size: 14px;line-height: 30px">
{{this.$t('clickUpload')}}</p>
</a-upload-dragger>
</a-modal>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction, downFile, downloadFile } from '@/api/manage'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
export default {
name: 'file',
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
data() {
return {
visible: false,
title: this.$t('clickUpload'),
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
state: undefined,
myuploadAction: window._CONFIG['domianURL'] + this.thisFileUploadUrl,
upDataList: [],
downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download',
fileList: [],
myfileList: [],
isLoding: false,
cut: '',
multiple: true,
accept: ''
}
},
created() {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
this.containerId = 'container-ty-' + new Date().getTime()
},
mounted() {
let long = localStorage.getItem('language')
this.cut = ''
if (long && long == 'zh-cn') {
this.cut = 'cn'
} else if (long && long == 'en-us') {
this.cut = 'en'
}
if (this.isMultiple) {
this.multiple = false
}
this.accept = this.restrictUploads ? this.Uploadable : '*.*'
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
},
methods: {
...mapGetters(['userInfo']),
perentHandleFunc(data) {
this.myfileList = data
if (data && data.length > 0) {
this.myfileList.forEach((res) => {
res.name = res.fileName
res.uid = res.id
})
} else {
this.myfileList = []
}
},
beforeUpload(file, fileList) {
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
console.log(file)
this.fileTypeSatus = true
if (this.isMultiple) {
if ((this.myfileList && this.myfileList.length == 1) || this.myfileList && this.myfileList.length > 1) {
this.$message.warning(this.$t('onlyOnefileUploaded'))
return false
}
}
if (this.restrictUploads) {
let fileName = file.name
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
if (this.Uploadable.includes(fileSuffix)) {
} else {
this.$message.warning(this.$t('uploadOnly') + this.Uploadable + this.$t('file'))
return false
}
}
//TODO 客户要求不拦截文件
// if(file.type){
// if (thisFileType.indexOf(file.type) != -1) {
// this.fileTypeSatus = true;
// }else{
// this.fileTypeSatus = false;
// }
// }else{
// if(file.name.slice(file.name.length - 3 , file.name.length) == 'rar'){
// this.fileTypeSatus = true
// }else if(file.type == 'application/x-zip-compressed'){
// this.fileTypeSatus = true
// }else{
// this.fileTypeSatus = false;
// }
// }
this.$message.destroy()
},
remove() {
this.fileTypeSatus = true
},
mypreview(item) {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + item.ext1)
window.open(url, '_blank')
},
handleChange(info) {
let { file } = info
const status = info.file.status
info.fileList.forEach((val, index) => {
if (val.response && !val.response.result) {
this.$message.error(val.response.message)
info.fileList.splice(index, 1)
}
})
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(`${info.file.name}` + this.$t('FileUploadFailed'))
} else if (status === 'removed') {
this.myfileList = info.fileList
this.fileList = []
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
if (this.myfileList.length > 0) {
this.$message.destroy()
this.$message.success(`${info.file.name}` + this.$t('DeletedSuccessfully'))
}
} else if (status === 'done') {
this.fileList = []
this.myfileList = info.fileList
if (info.fileList.length > 20) {
info.fileList.splice(20)
this.myfileList = info.fileList
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(this.$t('UploadMost'))
return
}
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
if (this.myfileList.length > 0) {
this.$message.destroy()
if (file.response.success) {
this.$message.success(`${info.file.name}` + this.$t('FileUploadedSuccessfully'))
}
}
} else if (status === 'uploading') {
this.myfileList = info.fileList
// this.$message.success(`${info.file.name} 文件上传成功。`);
}
},
resetFileList() {
this.myfileList = []
this.fileList = []
},
preview(file) {
let fileQuery = file.response ? file.response.result : file
let fileName = fileQuery.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.id })
// if (fileSuffix === '.pdf') {
// window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id+'&userName='+this.userInfo().username))
// } else if (fileSuffix === '.docx') {
// let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
// window.open(url, '_blank')
// } else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
// let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix)
// window.open(url, '_blank')
// } else {
// downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.id })
// }
}
}
}
</script>
<style>
.ant-upload-list-item-name {
color: rgba(0, 0, 0, 0.65) !important;
}
.action-upload {
font-size: 67px;
color: #c0c4cc;
}
.uploadFile {
}
</style>
@@ -270,6 +270,9 @@ import { message } from 'ant-design-vue'
localStorage.setItem('otaIdT',value)
this.$forceUpdate()
if(this.$route.query.type == 1){
return
}
this.getData()
},
// 模板下载
@@ -296,8 +299,10 @@ import { message } from 'ant-design-vue'
})
},
getData(){
if(this.$route.query.type == 1){
return
}
let otaIdT=localStorage.getItem('otaIdT')
console.log('!!!',otaIdT);
if(otaIdT==null){
otaIdT=''
}
@@ -315,19 +320,19 @@ import { message } from 'ant-design-vue'
this.form.cpsb=res.result.cpsb
this.form.cpmc=res.result.cpmc
this.form.cpxh=res.result.cpxh
this.form.dllx1=res.result.dllx1
this.form.dllx2=res.result.dllx2
this.form.txzd=res.result.txzd
this.form.cdotasj=res.result.cdotasj
this.form.cxmb=this.form.ggpc+'-'+ this.form.cpmc+'-'+this.form.cpxh
console.log(res.result);
if(res.result.dllx1 == null ){
res.result.dllx1 = undefined
}
if(res.result.dllx2 == null){
res.result.dllx2 = undefined
}
this.form.dllx1=res.result.dllx1
this.form.dllx2=res.result.dllx2
// this.changeSelect()
this.$forceUpdate()
}
})
@@ -45,6 +45,7 @@
:placeholder="$t('PleaseSelect')"
:type="'select'"
:triggerChange="false"
:dictCode="record.dictCode"
v-model="record.jszdhjb"/>
</span>
<!-- 技术参数-->
@@ -118,37 +119,38 @@ import ImportFile from '@/components/ImportFileData/index'
return {
formInline: {},
uploadName:'',
fileList:'',
url: {
exportData: '/ota/otaBaCxKsjjsmccs/exportData',
importZipUrl: '/ota/otaBaCxKsjjsmccs/importData',//导入
},
dataSource: [
{
gnmc:'前向碰撞预警(FCW)'
gnmc:'前向碰撞预警(FCW)',
},
{
gnmc:'车道偏离预警(LDW)'
gnmc:'车道偏离预警(LDW)',
},
{
gnmc:'百区监测(BSD)'
gnmc:'百区监测(BSD)',
},
{
gnmc:'驻员疲劳篮澳CDFM)'
gnmc:'驻员疲劳篮澳CDFM)',
},
{
gnmc:'自动紧急制动(AEB)'
gnmc:'自动紧急制动(AEB)',
},
{
gnmc:'自适应巡航控制(ACC)'
gnmc:'自适应巡航控制(ACC)',
},
{
gnmc:'自适应巡航控制(ACC)'
gnmc:'车道保持辅助(LKA)',
},
{
gnmc:'智能泊车辅助(IPA)'
gnmc:'智能泊车辅助(IPA)',
},
{
gnmc:'交通拥堵辅助(TJA)'
gnmc:'交通拥堵辅助(TJA)',
},
],
loading: false,
@@ -341,50 +343,53 @@ import ImportFile from '@/components/ImportFileData/index'
}
getAction('/ota/otaBaCxKsjjsmccs/queryByOtaId',{otaIdT:otaIdT,otaId:localStorage.getItem('otaId')}).then(res=>{
if(res.code==200){
if(res.result.length==0){
this.dataSource=[
{
gnmc:'前向碰撞预警(FCW)'
},
{
gnmc:'车道偏离预警(LDW)'
},
{
gnmc:'百区监测(BSD)'
},
{
gnmc:'驻员疲劳篮澳CDFM)'
},
{
gnmc:'自动紧急制动(AEB)'
},
{
gnmc:'自适应巡航控制(ACC)'
},
{
gnmc:'自适应巡航控制(ACC)'
},
{
gnmc:'智能泊车辅助(IPA)'
},
{
gnmc:'交通拥堵辅助(TJA)'
},
]
if(res.result.list.length==0){
this.dataSource=[
{
gnmc:'前向碰撞预警(FCW)'
},
{
gnmc:'车道偏离预警(LDW)'
},
{
gnmc:'百区监测(BSD)'
},
{
gnmc:'驻员疲劳篮澳CDFM)'
},
{
gnmc:'自动紧急制动(AEB)'
},
{
gnmc:'自适应巡航控制(ACC)'
},
{
gnmc:'自适应巡航控制(ACC)'
},
{
gnmc:'智能泊车辅助(IPA)'
},
{
gnmc:'交通拥堵辅助(TJA)'
},
]
}else{
res.result.forEach(item =>{
res.result.list.forEach(item =>{
item.pzqk =Number(item.pzqk)
})
res.result.forEach(item =>{
res.result.list.forEach(item =>{
item.sfksj =Number(item.sfksj)
item.jszdhjb=Number(item.jszdhjb)== 0?undefined:Number(item.jszdhjb)
})
this.dataSource=res.result
this.dataSource=res.result.list
this.fileList = res.result.fj
this.$forceUpdate()
}
}
})
},
save(){
postAction('/ota/otaBaCxKsjjsmccs/add',{otaId:localStorage.getItem('otaId'),list:this.dataSource}).then(res =>{
postAction('/ota/otaBaCxKsjjsmccs/add',{otaId:localStorage.getItem('otaId'),list:this.dataSource,fj:this.fileList}).then(res =>{
console.log(res);
})
},
@@ -397,16 +402,15 @@ import ImportFile from '@/components/ImportFileData/index'
this.$emit('beupgradedonlinedown')
},
uploadSuccess(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
this.$refs.ruleForm.clearValidate(['fileKey'])
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
this.$forceUpdate()
// /** 赋值给当前对应的表单文件 */
this.fileList = attIdList.join(',')
},
//中间加
addlineAtMid(record){
@@ -51,6 +51,9 @@ export default {
},
methods: {
getData(){
if(this.$route.query.type == 1){
return
}
let otaIdT=localStorage.getItem('otaIdT')
if(otaIdT==null){
otaIdT=''
@@ -866,6 +866,9 @@ export default {
downloadFile('ota/otaBaCxList/exportTemplate', '车型及功能备案' + '.zip', {})
},
getData(){
if(this.$route.query.type == 1){
return
}
let otaIdT=localStorage.getItem('otaIdT')
if(otaIdT==null){
otaIdT=''
@@ -887,7 +890,8 @@ export default {
this.dataSource.forEach(item=>{
for(let key in res.result.bj){
if(Number(res.result.bj[key])!=NaN &&Number(res.result.bj[key])!=0){
if(Number(res.result.bj[key])!=NaN &&Number(res.result.bj[key])!=0 && key !=id){
console.log(key);
res.result.bj[key]=Number(res.result.bj[key])
}
if(item.key==key){
@@ -27,7 +27,7 @@
@change="update"
:placeholder="$t('PleaseSelect')"
:type="'select'"
:dictCode="record.dictCode"
dictCode="driving_automation_level"
:triggerChange="false"/>
</span>
<span slot="certifyingmaterials" slot-scope="text,record">
@@ -69,6 +69,7 @@ import ImportFile from '@/components/ImportFileData/index'
{
key: '1',
zmcl:'',
info:'',
aspect: this.$t('upgradepacketprotectionmeasures'),
safetymeasure: this.$t('authenticityandintegrityprotectionmechanism'),
relevantverification: 'havemeasures',
@@ -78,6 +79,7 @@ import ImportFile from '@/components/ImportFileData/index'
{
key: '2',
zmcl:'',
info:'',
aspect: this.$t('otaupgradedsecuritymeasuresforvehicles'),
safetymeasure: this.$t('failsafmechanism'),
relevantverification: 'havemeasures',
@@ -88,6 +90,7 @@ import ImportFile from '@/components/ImportFileData/index'
key: '3',
aspect: '',
zmcl:'',
info:'',
safetymeasure: this.$t('vehiclesafetyMeasuresafterUpgradefailure'),
relevantverification: 'havemeasures',
certifyingmaterials:'',
@@ -97,6 +100,7 @@ import ImportFile from '@/components/ImportFileData/index'
key: '4',
aspect: '',
zmcl:'',
info:'',
safetymeasure: this.$t('informationsecuritymechanism'),
relevantverification: 'havemeasures',
certifyingmaterials:'',
@@ -186,6 +190,9 @@ import ImportFile from '@/components/ImportFileData/index'
downloadFile('ota/otaBaCxAqcs/exportTemplate', '车型及功能备案' + '.zip', {})
},
getData(){
if(this.$route.query.type == 1){
return
}
let otaIdT=localStorage.getItem('otaIdT')
if(otaIdT==null){
otaIdT=''
@@ -205,6 +205,9 @@ export default {
downloadFile('ota/otaBaCxZxsjyq/exportTemplate', '车型及功能备案' + '.zip', {})
},
getData(){
if(this.$route.query.type == 1){
return
}
console.log(localStorage.getItem('otaId'));
let otaIdT=localStorage.getItem('otaIdT')
if(otaIdT==null){
@@ -83,7 +83,10 @@
</span>
</a-table>
<div>
<a-button @click="clickButtonToUpload" type="primary">{{$t('uploadattachment')}}</a-button>
<a-button @click="clickButtonToUploadota(fileList)" type="primary">
{{ (fileList === 'null' || fileList === '' ||
fileList == null) ? $t('uploadattachment') : $t('viewUploadedFiles')
}}</a-button>
<p>注:附件包括测试项目清单、测试报告.测试标准或技术规范</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;支持doc/docx/pdf格式,大小50M以内</p>
@@ -94,18 +97,21 @@
<a-button type="primary" style='width: 73px' @click='next'>{{$t('next')}}</a-button>
</div>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
<uploadFileOta ref="uploadFileOta" @uploadSuccess="uploadSuccessOta"></uploadFileOta>
</div>
</template>
<script>
import { getAction, postAction, deleteAction,downloadFile } from '@/api/manage'
import ImportFile from '@/components/ImportFileData/index'
import uploadFile from '@/components/uploadFile/file'
import uploadFile from '@/components/uploadFile/file'
import uploadFileOta from '@/components/uploadFileOta/file'
export default {
name: 'upgradedonline',
components:{
uploadFile,
uploadFileOta,
ImportFile
},
data() {
@@ -114,6 +120,7 @@ import ImportFile from '@/components/ImportFileData/index'
exportData: '/ota/otaBaCxKsjxtmccs/exportData',
importZipUrl: '/ota/otaBaCxKsjxtmccs/importData',//导入
},
fileList:'',
dataSource: [
{
xtlb:'动力系统',
@@ -298,6 +305,9 @@ import ImportFile from '@/components/ImportFileData/index'
downloadFile('ota/otaBaCxKsjxtmccs/exportTemplate', '车型及功能备案' + '.zip', {})
},
getData(){
if(this.$route.query.type == 1){
return
}
let otaIdT=localStorage.getItem('otaIdT')
if(otaIdT==null){
otaIdT=''
@@ -336,6 +346,7 @@ import ImportFile from '@/components/ImportFileData/index'
item.sfksj =Number(item.sfksj)
})
this.dataSource=res.result.list
this.fileList = res.result.fj
}
}
})
@@ -390,12 +401,34 @@ import ImportFile from '@/components/ImportFileData/index'
})
this.$forceUpdate()
// /** 赋值给当前对应的表单文件 */
// this.fileList.uploadName = attIdList.join(',')
// this.fileList.certifyingmaterials = this.$t('viewFile')
},
uploadSuccessOta(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
this.$forceUpdate()
// /** 赋值给当前对应的表单文件 */
this.fileList = attIdList.join(',')
// this.fileList.certifyingmaterials = this.$t('viewFile')
},
clickButtonToUpload(current,index) {
this.type = index
console.log(current)
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = current
getAction('sys/common/getFileInfos', { id: current }).then((res) => {
if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result)
} else {
this.$refs.uploadFile.perentHandleFunc()
}
})
},
clickButtonToUploadota(current) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = current
@@ -424,7 +457,7 @@ import ImportFile from '@/components/ImportFileData/index'
this.dataSource.splice(this.dataSource.indexOf(record),1)
},
save(){
postAction('/ota/otaBaCxKsjxtmccs/add',{otaId:localStorage.getItem('otaId'),list:this.dataSource}).then(res => {
postAction('/ota/otaBaCxKsjxtmccs/add',{otaId:localStorage.getItem('otaId'),list:this.dataSource,fj:this.fileList}).then(res => {
console.log(res);
})
}
@@ -383,7 +383,9 @@ export default {
localStorage.removeItem('otaIdT')
this.$router.push({
path: '/vehicleinformation',
query: {}
query: {
type:1,
}
})
},
viewProcessClick(row) {