箱管 批量变动导入 文件上传 直接触发 保存

feature-JimuReport-1106-yjl
张同海 3 weeks ago
parent e302e691f8
commit 2435fbda7c

@ -15,21 +15,28 @@
ref="RefsUpload"
:file-list="upFileList"
:before-upload="beforeUpload"
:maxCount="maxCount"
:maxCount="1"
accept=".xlsm,.xlsx,.xls,.pdf,.txt,.pms,.jpeg,.png"
:rules="[{ required: true, message: '请上传文件!' }]"
@remove="handleRemove"
@change="ChangeUpload"
:showUploadList="false"
>
<a-button :disabled="props.id ? false : true">
<!-- <a-button :disabled="props.id ? false : true">
<span
class="iconfont icon-shujushangchuan-shixin"
:style="{ fontSize: '12px', marginRight: '5px' }"
></span>
选择文件
</a-button>
<p class="UploadText" v-if="props.id ? false : true">,</p> -->
<a-button>
<span
class="iconfont icon-shujushangchuan-shixin"
:style="{ fontSize: '12px', marginRight: '5px' }"
></span>
选择文件
</a-button>
<p class="UploadText" v-if="props.id ? false : true">,</p>
</a-upload>
</a-form-item>
</a-form>
@ -215,13 +222,16 @@
newFileList.splice(index, 1)
upFileList.value = newFileList
}
function ChangeUpload(e) {
async function ChangeUpload() {
let FnUp = (id) => {
console.log('FnUp', 1111111111)
const postData = new FormData()
const list = unref(upFileList)
list.forEach((item) => {
postData.append('formCollection[]', item)
})
postData.append('linkId', props.id)
// list.forEach((item) => {
// postData.append('formCollection[]', item)
// })
postData.append('formCollection', list[list.length - 1])
postData.append('linkId', id)
postData.append('typeCode', formData.typeCode)
postData.append('typeName', formData.typeName)
loading.value = true
@ -243,6 +253,8 @@
createMessage.error('上传失败!')
})
}
emits('FnUpload', FnUp)
}
function beforeUpload(file) {
//
if (props.maxSize) {
@ -282,7 +294,7 @@
//
const dsFileList = ref(null)
const emits = defineEmits(['handleSuccess', 'FnTriggerSave'])
const emits = defineEmits(['handleSuccess', 'FnTriggerSave', 'FnUpload'])
//
const handleOk = async () => {
const res = await fileForm.value.validateFields()

@ -64,6 +64,7 @@
:succinct="true"
:id="rowId"
@FnTriggerSave="FnTriggerSave"
@FnUpload="FnUpload"
@handleSuccess="handleSuccess"
:SetSelect="{
show: true,
@ -234,6 +235,12 @@
}
const dsFile = ref()
async function FnUpload(FnUp) {
if (!rowId.value) {
await handleSave(false)
}
FnUp(rowId.value)
}
async function FnTriggerSave() {
await handleSave(false)
if (rowId.value) {

Loading…
Cancel
Save