Merge pull request 'fix : 修复需求上报功能' (#205) from dj into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/205
This commit is contained in:
@@ -72,8 +72,9 @@ const tableConfig = reactive({
|
||||
]
|
||||
})
|
||||
const rules = reactive({
|
||||
attachment: [{required: true, message: '请上传附件', trigger: 'blur'}],
|
||||
attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}],
|
||||
})
|
||||
const applyForm=ref()
|
||||
const props = defineProps({
|
||||
showFileList: {
|
||||
type: Boolean,
|
||||
@@ -117,7 +118,7 @@ const deleteOtherFile = (row) => {
|
||||
deleteFile(row.fileId).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success("删除成功");
|
||||
otherFileList.value.splice(otherFileList.value.findIndex((item) => item.id === row.fileId), 1);
|
||||
props.otherFileList.splice(props.otherFileList.findIndex((item) => item.id === row.fileId), 1);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
@@ -133,6 +134,14 @@ const handleDownload = (row) => {
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
validate(){
|
||||
return applyForm.value.validate()
|
||||
},
|
||||
clearValidate(){
|
||||
return applyForm.value.clearValidate()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<AttachmentUpload label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||
@getAttachment="getAttachment"
|
||||
@getOtherFile="getOtherFile" :showFileList="true"/>
|
||||
<!-- <fvForm :schema="schame" @getInstance="getInstance"></fvForm>-->
|
||||
@@ -227,9 +227,11 @@ const cacheStore = useCacheStore()
|
||||
const router = useRouter()
|
||||
const tagsViewStore = useTagsView()
|
||||
const summaryForm = ref()
|
||||
const attachment = ref()
|
||||
const deploymentId = ref()
|
||||
const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
const fileList = ref([])
|
||||
const formData = ref({
|
||||
specialFund: null
|
||||
})
|
||||
@@ -254,31 +256,66 @@ const rules = reactive({
|
||||
copyright: [{required: true, message: '请输入著作权', trigger: 'blur'}],
|
||||
other: [{required: true, message: '请输入其他', trigger: 'blur'}],
|
||||
economicEstimate: [{required: true, message: '请输入经济概算', trigger: 'blur'}],
|
||||
specialFundAmount: [{required: true, message: '请输入专项资金', trigger: 'blur'}],
|
||||
// specialFundAmount: [{required: true, message: '请输入专项资金', trigger: 'blur'}],
|
||||
serviceDescription: [{required: true, message: '请输入现有业务描述', trigger: 'blur'}],
|
||||
contentDescription: [{required: true, message: '请输入研发项目关键内容描述', trigger: 'blur'}],
|
||||
contentDescription: [{required: true, message: '请输入研发项目关键内容描述', trigger: 'blur'}]
|
||||
})
|
||||
const compositeParam = (item, type) => {
|
||||
let tag = ''
|
||||
if (router.currentRoute.value.name === 'Summary/add') {
|
||||
tag = '需求汇总'
|
||||
}
|
||||
return {
|
||||
fileId: item.id,
|
||||
size: item.size,
|
||||
type: type,
|
||||
originalFileName: item.originalFilename,
|
||||
fileType: item.fileType,
|
||||
url: item.url,
|
||||
processNodeTag: null,
|
||||
tag: tag
|
||||
}
|
||||
}
|
||||
const getAttachment = (val) => {
|
||||
console.log('上传文件getAttachment', val)
|
||||
let fileObj = compositeParam(val)
|
||||
// fileList.value.push(fileObj)
|
||||
let fileObj = compositeParam(val, 1)
|
||||
fileList.value.push(fileObj)
|
||||
}
|
||||
const getOtherFile = (val) => {
|
||||
console.log('上传文件getOtherFile', val)
|
||||
showTable.value = false
|
||||
let fileObj = compositeParam(val)
|
||||
let fileObj = compositeParam(val, 2)
|
||||
otherFileList.value.push(fileObj)
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}
|
||||
const getFileParam = (item) => {
|
||||
return {
|
||||
fileId: item.fileId,
|
||||
type: item.type
|
||||
}
|
||||
}
|
||||
const handleSubmit = async (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid, fields) => {
|
||||
if(fileList.value.length===0){
|
||||
attachment.value.validate()
|
||||
}else {
|
||||
attachment.value.clearValidate()
|
||||
}
|
||||
if (!valid) return
|
||||
let files = []
|
||||
fileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
otherFileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
let params = {
|
||||
...formData.value,
|
||||
deploymentId: deploymentId.value
|
||||
deploymentId: deploymentId.value,
|
||||
files: files
|
||||
}
|
||||
let res = await requirementReported(params)
|
||||
ElNotification({
|
||||
@@ -317,6 +354,7 @@ const staging = async () => {
|
||||
overflow: hidden;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
:deep(.el-table--fit) {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user