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({
|
const rules = reactive({
|
||||||
attachment: [{required: true, message: '请上传附件', trigger: 'blur'}],
|
attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}],
|
||||||
})
|
})
|
||||||
|
const applyForm=ref()
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
showFileList: {
|
showFileList: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -117,7 +118,7 @@ const deleteOtherFile = (row) => {
|
|||||||
deleteFile(row.fileId).then(res => {
|
deleteFile(row.fileId).then(res => {
|
||||||
if (res.code === 1000) {
|
if (res.code === 1000) {
|
||||||
ElMessage.success("删除成功");
|
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(() => {
|
}).catch(() => {
|
||||||
@@ -133,6 +134,14 @@ const handleDownload = (row) => {
|
|||||||
a.click()
|
a.click()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
defineExpose({
|
||||||
|
validate(){
|
||||||
|
return applyForm.value.validate()
|
||||||
|
},
|
||||||
|
clearValidate(){
|
||||||
|
return applyForm.value.clearValidate()
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<AttachmentUpload label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
|
||||||
@getAttachment="getAttachment"
|
@getAttachment="getAttachment"
|
||||||
@getOtherFile="getOtherFile" :showFileList="true"/>
|
@getOtherFile="getOtherFile" :showFileList="true"/>
|
||||||
<!-- <fvForm :schema="schame" @getInstance="getInstance"></fvForm>-->
|
<!-- <fvForm :schema="schame" @getInstance="getInstance"></fvForm>-->
|
||||||
@@ -227,11 +227,13 @@ const cacheStore = useCacheStore()
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const tagsViewStore = useTagsView()
|
const tagsViewStore = useTagsView()
|
||||||
const summaryForm = ref()
|
const summaryForm = ref()
|
||||||
|
const attachment = ref()
|
||||||
const deploymentId = ref()
|
const deploymentId = ref()
|
||||||
const showTable = ref(true)
|
const showTable = ref(true)
|
||||||
const otherFileList = ref([])
|
const otherFileList = ref([])
|
||||||
|
const fileList = ref([])
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
specialFund:null
|
specialFund: null
|
||||||
})
|
})
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
projectName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
projectName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
||||||
@@ -254,31 +256,66 @@ const rules = reactive({
|
|||||||
copyright: [{required: true, message: '请输入著作权', trigger: 'blur'}],
|
copyright: [{required: true, message: '请输入著作权', trigger: 'blur'}],
|
||||||
other: [{required: true, message: '请输入其他', trigger: 'blur'}],
|
other: [{required: true, message: '请输入其他', trigger: 'blur'}],
|
||||||
economicEstimate: [{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'}],
|
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) => {
|
const getAttachment = (val) => {
|
||||||
console.log('上传文件getAttachment', val)
|
console.log('上传文件getAttachment', val)
|
||||||
let fileObj = compositeParam(val)
|
let fileObj = compositeParam(val, 1)
|
||||||
// fileList.value.push(fileObj)
|
fileList.value.push(fileObj)
|
||||||
}
|
}
|
||||||
const getOtherFile = (val) => {
|
const getOtherFile = (val) => {
|
||||||
console.log('上传文件getOtherFile', val)
|
console.log('上传文件getOtherFile', val)
|
||||||
showTable.value = false
|
showTable.value = false
|
||||||
let fileObj = compositeParam(val)
|
let fileObj = compositeParam(val, 2)
|
||||||
otherFileList.value.push(fileObj)
|
otherFileList.value.push(fileObj)
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
showTable.value = true
|
showTable.value = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const getFileParam = (item) => {
|
||||||
|
return {
|
||||||
|
fileId: item.fileId,
|
||||||
|
type: item.type
|
||||||
|
}
|
||||||
|
}
|
||||||
const handleSubmit = async (instance) => {
|
const handleSubmit = async (instance) => {
|
||||||
if (!instance) return
|
if (!instance) return
|
||||||
instance.validate(async (valid, fields) => {
|
instance.validate(async (valid, fields) => {
|
||||||
|
if(fileList.value.length===0){
|
||||||
|
attachment.value.validate()
|
||||||
|
}else {
|
||||||
|
attachment.value.clearValidate()
|
||||||
|
}
|
||||||
if (!valid) return
|
if (!valid) return
|
||||||
|
let files = []
|
||||||
|
fileList.value.forEach(item => {
|
||||||
|
files.push(getFileParam(item))
|
||||||
|
})
|
||||||
|
otherFileList.value.forEach(item => {
|
||||||
|
files.push(getFileParam(item))
|
||||||
|
})
|
||||||
let params = {
|
let params = {
|
||||||
...formData.value,
|
...formData.value,
|
||||||
deploymentId: deploymentId.value
|
deploymentId: deploymentId.value,
|
||||||
|
files: files
|
||||||
}
|
}
|
||||||
let res = await requirementReported(params)
|
let res = await requirementReported(params)
|
||||||
ElNotification({
|
ElNotification({
|
||||||
@@ -317,8 +354,9 @@ const staging = async () => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-bottom: 30px;
|
padding-bottom: 30px;
|
||||||
}
|
}
|
||||||
:deep(.el-table--fit){
|
|
||||||
height: auto!important;
|
:deep(.el-table--fit) {
|
||||||
|
height: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user