禅道 任务264

feature-JimuReport-1106-yjl
张同海 4 weeks ago
parent 0a7935ea0d
commit 32e7d7401e

@ -1,6 +1,39 @@
<template> <template>
<div class="ds-file"> <div class="ds-file">
<a-button v-if="show" type="primary" @click="openFileModel"></a-button> <a-form
v-if="succinct"
ref="fileForm"
:model="formData"
name="basic"
layout="vertical"
autocomplete="off"
@finishFailed="onFinishFailed"
@finish="onFinish"
>
<a-form-item name="upFileList">
<a-upload
ref="RefsUpload"
:file-list="upFileList"
:before-upload="beforeUpload"
:maxCount="maxCount"
accept=".xlsm,.xlsx,.xls,.pdf,.txt,.pms,.jpeg,.png"
:rules="[{ required: true, message: '请上传文件!' }]"
@remove="handleRemove"
@change="ChangeUpload"
:showUploadList="false"
>
<a-button>
<span
class="iconfont icon-shujushangchuan-shixin"
:style="{ fontSize: '12px', marginRight: '5px' }"
></span>
选择文件
</a-button>
</a-upload>
</a-form-item>
</a-form>
<a-button v-if="show && !succinct" type="primary" @click="openFileModel"></a-button>
<a-modal <a-modal
class="ds-form-detail" class="ds-form-detail"
v-model:visible="visible" v-model:visible="visible"
@ -38,6 +71,7 @@
</a-form-item> </a-form-item>
<a-form-item label="附件" name="upFileList"> <a-form-item label="附件" name="upFileList">
<a-upload <a-upload
ref="RefsUpload"
:file-list="upFileList" :file-list="upFileList"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:maxCount="maxCount" :maxCount="maxCount"
@ -135,6 +169,11 @@
type: Number, type: Number,
default: null, default: null,
}, },
//
succinct: {
type: Boolean,
default: false,
},
}) })
// //
const visible = ref(false) const visible = ref(false)
@ -146,12 +185,17 @@
typeName: '', typeName: '',
fileList: [], fileList: [],
}) })
const RefsUpload = ref<any>(null)
// //
const init = () => { const init = () => {
let code = props.fileType ? `${props.fileType}_file_type` : 'file_type' let code = props.fileType ? `${props.fileType}_file_type` : 'file_type'
getDictOption(code).then((res) => { getDictOption(code).then((res) => {
fileTypeList.value = res fileTypeList.value = res
visible.value = true if (!props.succinct) {
visible.value = true
} else {
RefsUpload.value.click()
}
formData.typeCode = props.dynamicDisabled formData.typeCode = props.dynamicDisabled
fileTypeList.value.forEach((e: any) => { fileTypeList.value.forEach((e: any) => {
if (e.value == props.dynamicDisabled) { if (e.value == props.dynamicDisabled) {
@ -170,6 +214,34 @@
newFileList.splice(index, 1) newFileList.splice(index, 1)
upFileList.value = newFileList upFileList.value = newFileList
} }
function ChangeUpload(e) {
const postData = new FormData()
const list = unref(upFileList)
list.forEach((item) => {
postData.append('formCollection[]', item)
})
postData.append('linkId', props.id)
postData.append('typeCode', formData.typeCode)
postData.append('typeName', formData.typeName)
loading.value = true
AddMultiFiles(postData)
.then((res) => {
loading.value = false
visible.value = false
upFileList.value = []
if (props.showFileList) {
dsFileList.value.init()
emits('handleSuccess', { id: res.data })
} else {
emits('handleSuccess')
}
createMessage.success('上传成功!')
})
.catch((res) => {
loading.value = false
createMessage.error('上传失败!')
})
}
function beforeUpload(file) { function beforeUpload(file) {
// //
if (props.maxSize) { if (props.maxSize) {
@ -206,6 +278,7 @@
} }
} }
const fileForm = ref(null) const fileForm = ref(null)
// //
const dsFileList = ref(null) const dsFileList = ref(null)
const emits = defineEmits(['handleSuccess', 'FnTriggerSave']) const emits = defineEmits(['handleSuccess', 'FnTriggerSave'])

@ -236,6 +236,30 @@ export const searchFormSchema: FormSchema[] = [
} }
}, },
}, },
{
field: 'isOnlineId',
label: '是否上线',
component: 'ApiSelect',
colProps: { span: 4 },
defaultValue: '1',
componentProps: () => {
return {
api: () => {
return new Promise((resolve) => {
getDictOption('CM_IsOnlineEnum').then((res) => {
resolve(res)
})
})
},
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{ {
field: 'CM_ctnCode', field: 'CM_ctnCode',
label: '箱型', label: '箱型',

@ -61,6 +61,7 @@
fileType="infoclient" fileType="infoclient"
:dynamicDisabled="3" :dynamicDisabled="3"
:TriggerSave="true" :TriggerSave="true"
:succinct="true"
:id="rowId" :id="rowId"
@FnTriggerSave="FnTriggerSave" @FnTriggerSave="FnTriggerSave"
@handleSuccess="handleSuccess" @handleSuccess="handleSuccess"
@ -165,6 +166,7 @@
} }
} else { } else {
setFieldsValue({ permissionIdentity: unref(2) }) setFieldsValue({ permissionIdentity: unref(2) })
rowId.value = ''
} }
setModalProps({ loading: false }) setModalProps({ loading: false })
}) })
@ -210,7 +212,6 @@
someCheck.value = false someCheck.value = false
res.data.bodyList.forEach((item) => { res.data.bodyList.forEach((item) => {
list.value.push({ ...item, selected: false }) list.value.push({ ...item, selected: false })
console.log(item.cntrno)
if (item.isOnlineId != 1) { if (item.isOnlineId != 1) {
MessageArr.push(item.cntrno) MessageArr.push(item.cntrno)
} }
@ -614,7 +615,6 @@
ApiData.jsonDataStr = JSON.stringify(ApiData.jsonDataStr) ApiData.jsonDataStr = JSON.stringify(ApiData.jsonDataStr)
ExportExcelByColumn(ApiData).then((res) => { ExportExcelByColumn(ApiData).then((res) => {
console.log(res)
const xlsUrl = window.URL.createObjectURL( const xlsUrl = window.URL.createObjectURL(
new Blob([res], { new Blob([res], {
type: 'application/vnd.ms-excel;charset=utf-8', type: 'application/vnd.ms-excel;charset=utf-8',

Loading…
Cancel
Save