Browse Source

feat: 修改上传附件

ops-management-platform-frontend-dev
wbc 1 month ago
parent
commit
a277f16dc9
  1. 20
      src/views/project/contractManage/addModal.vue

20
src/views/project/contractManage/addModal.vue

@ -120,8 +120,10 @@
<a-col :span="24">
<a-form-item label="附件" name="attachment">
<a-upload
v-model:file-list="form.attachment"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:before-upload="beforeUpload"
@change="importChange"
:file-list="filelists"
:maxCount="1"
>
<a-button type="primary"> 上传 </a-button>
</a-upload>
@ -142,6 +144,7 @@
const title = ref('新增');
const formRef = ref();
const visible = ref(false);
const filelists = ref([]);
let form = reactive({
contractName: '',
contractCode: '',
@ -189,7 +192,15 @@
form.attachment = data.attachment ? data.attachment : [];
}
};
const beforeUpload = async (file) => {
console.log(file);
form.attachment = file;
return false;
};
const importChange = ({ fileList }) => {
filelists.value = fileList;
console.log(fileList);
};
const handleOk = () => {
formRef.value.validate().then((valid) => {
if (valid) {
@ -232,6 +243,9 @@
projectNameOptions,
formRef,
closeModal,
beforeUpload,
importChange,
filelists,
};
},
};

Loading…
Cancel
Save