参数模板管理-参数列表-新增-附件控件上传附件模板的文件类型

This commit is contained in:
范强强
2023-03-27 15:02:32 +08:00
parent 32cd717501
commit 79ffc2ba35
2 changed files with 173 additions and 164 deletions
@@ -9,7 +9,7 @@
name="file" name="file"
:file-list="myfileList" :file-list="myfileList"
:multiple="true" :multiple="true"
:action="uploadAction+'?state='+2+'&cut='+cut" :action="actionUrl"
:headers="headers" :headers="headers"
@preview="preview" @preview="preview"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@@ -26,15 +26,15 @@
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction, downFile, downloadFile } from '@/api/manage' import { getAction, postAction, downFile, downloadFile } from '@/api/manage'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'file', name: 'file',
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile','detailDate','accept'], props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'detailDate', 'accept', 'isParameter'],
data() { data() {
return { return {
visible: false, visible: false,
@@ -50,6 +50,15 @@ export default {
cut: '' cut: ''
} }
}, },
computed: {
actionUrl() {
if (this.isParameter) {
return this.uploadAction + '?state=' + 3 + '&cut=' + this.cut
} else {
return this.uploadAction + '?state=' + 2 + '&cut=' + this.cut
}
}
},
created() { created() {
const token = Vue.ls.get(ACCESS_TOKEN) const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token } this.headers = { 'X-Access-Token': token }
@@ -110,7 +119,7 @@ export default {
window.open(url, '_blank') window.open(url, '_blank')
}, },
handleChange(info) { handleChange(info) {
if(info.fileList.length > 1) { if (info.fileList.length > 1) {
this.$message.warning(this.$t('onlyOnefileUploaded')) this.$message.warning(this.$t('onlyOnefileUploaded'))
return return
} }
@@ -201,20 +210,20 @@ export default {
// } // }
} }
} }
} }
</script> </script>
<style> <style>
.ant-upload-list-item-name { .ant-upload-list-item-name {
color: rgba(0, 0, 0, 0.65) !important; color: rgba(0, 0, 0, 0.65) !important;
} }
.action-upload { .action-upload {
font-size: 67px; font-size: 67px;
color: #c0c4cc; color: #c0c4cc;
} }
.uploadFile { .uploadFile {
} }
</style> </style>
@@ -317,7 +317,7 @@
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button> <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div> </div>
</a-drawer> </a-drawer>
<uploadFileChange ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFileChange> <uploadFileChange :isParameter="true" ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFileChange>
</div> </div>
</template> </template>