[update] 国标,企标过程稿件不能上传doc文件
This commit is contained in:
@@ -396,7 +396,7 @@ export default {
|
||||
}
|
||||
// 扩展 beforeUpload 验证
|
||||
if (typeof this.beforeUpload === 'function') {
|
||||
return this.beforeUpload(file)
|
||||
return this.beforeUpload(file, this.fileType)
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<a-form-model :model="formInline" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
|
||||
<div v-for="(val,index) in dataList" :key="index">
|
||||
<div v-if="val && val.length > 0" class="header-text">{{ index }}</div>
|
||||
<div v-for="(val,showAreaIndex) in dataList" :key="showAreaIndex">
|
||||
<div v-if="val && val.length > 0" class="header-text">{{ showAreaIndex }}</div>
|
||||
<div v-if="val && val.length > 0" class="form-flex-box">
|
||||
<template v-for="(item, index) in val">
|
||||
<div :key="index"
|
||||
@@ -67,7 +67,7 @@
|
||||
:treeOpera="true" />
|
||||
<!-- 8, 上传文件 -->
|
||||
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" class="button-text"
|
||||
@click="clickButtonToUpload(item)">
|
||||
@click="clickButtonToUpload(item, showAreaIndex)">
|
||||
{{
|
||||
(formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === ''
|
||||
|| formInline[item.dbFieldName] === null || formInline[item.dbFieldName] === undefined)
|
||||
@@ -145,7 +145,7 @@
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"></upload-file>
|
||||
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false" :file-type="uploadFileType" :before-upload="beforeUpload"></upload-file>
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</template>
|
||||
@@ -174,6 +174,11 @@ import TreeSelection from '../selection/TreeSelection'
|
||||
import { getStandardGradeClassification } from '../../api/enterpriseStandardLibraryApi'
|
||||
import STreeSelect from '../STreeSelect'
|
||||
|
||||
// 本系统限制可以上传的文件格式
|
||||
const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,rar,zip,jpg,jpeg,png,avi,wmv,mov,rm,mp4,cad'
|
||||
// 本系统限制可以上传的文件格式,除掉doc
|
||||
const CAN_UPLOAD_FILE_TYPE_NO_DOC = 'pdf,docx,xlsx,xls,ppt,pptx,rar,zip,jpg,jpeg,png,avi,wmv,mov,rm,mp4,cad'
|
||||
|
||||
export default {
|
||||
name: 'AddForm',
|
||||
components: {
|
||||
@@ -301,6 +306,12 @@ export default {
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
// 过程稿件文件是否允许上传doc类型文件的字段
|
||||
processIsAllowUploadDoc: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -333,7 +344,8 @@ export default {
|
||||
departSelectRange: [], // 选择部门的选择范围,传了就只能从这些里面选,不传就都能选
|
||||
isEditSetData: false, // 正在编辑回显数据
|
||||
oldMainDraftingUnit: '', // 上一次的主起草单位
|
||||
dictNotCodes: ['name_code'] // 用到字典的字段不传dictCode的字段
|
||||
dictNotCodes: ['name_code'], // 用到字典的字段不传dictCode的字段
|
||||
uploadFileType: CAN_UPLOAD_FILE_TYPE // 可以上传的文件类型
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -698,7 +710,13 @@ export default {
|
||||
})
|
||||
},
|
||||
// 点击点击上传按钮
|
||||
clickButtonToUpload (item) {
|
||||
clickButtonToUpload (item, showArea) {
|
||||
console.log(item, showArea)
|
||||
if (!this.processIsAllowUploadDoc && showArea === '过程稿件') {
|
||||
this.uploadFileType = CAN_UPLOAD_FILE_TYPE_NO_DOC
|
||||
} else {
|
||||
this.uploadFileType = CAN_UPLOAD_FILE_TYPE
|
||||
}
|
||||
this.$refs.uploadFile.open(this.formInline[item.dbFieldName])
|
||||
this.uploadName = item.dbFieldName
|
||||
},
|
||||
@@ -721,6 +739,16 @@ export default {
|
||||
this.formInline[this.uploadName + '_dictText'] = attNameList.join(',')
|
||||
this.formInline = { ...this.formInline }
|
||||
},
|
||||
// 上传文件的上传前判断
|
||||
beforeUpload (file, fileType) {
|
||||
const fileSuffix = (file.name ? file.name.split('.')[file.name.split('.').length - 1] : '').toLowerCase()
|
||||
if (!fileType.split(',').includes(fileSuffix)) {
|
||||
this.$message.warning(this.$t('uploadFile.pleaseUpload') + `${fileType}` + this.$t('uploadFile.file'))
|
||||
this.uploadGoOn = false
|
||||
file.uploadGoOn = false
|
||||
return false
|
||||
}
|
||||
},
|
||||
// 标准选择变化
|
||||
standardSelectionChange (value, id) {
|
||||
// this.formInline[value + '_by'] = id
|
||||
|
||||
Reference in New Issue
Block a user