Merge pull request 'dd' (#418) from dd into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/418
This commit is contained in:
2024-06-29 05:43:24 +00:00
4 changed files with 60 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-form :model="formData" ref="applyForm" :rules="rules" :label-position="labelPosition"> <el-form :model="formData" ref="applyForm" :rules="rules" :label-position="labelPosition">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item :label="label" prop="attachment" label-width="125"> <el-form-item :label="label" prop="attachment" label-width="125">
@@ -12,29 +12,29 @@
</template> </template>
<template <template
v-else-if="!preview||JSON.stringify(singleFile) == '{}'||singleFile==null||formData.singleFile==null"> v-else-if="!preview||JSON.stringify(singleFile) == '{}'||singleFile==null||formData.singleFile==null">
<file-upload @getFile="getAttachment" :multiple="false" :maxSize="1" :showFileList="showFileList" @delete="deleteAttachment" <file-upload @getFile="getAttachment" :multiple="false"
:disabled="isSingleFile" /> :disabled="isSingleFile" ref="fileUploadRef"/>
<!-- --> <!-- :showFileList="showFileList" @delete="deleteAttachment"-->
<!-- <fvTable style="width: 100%;max-height: 80px;" v-if="showSingleTable" :tableConfig="singleTableConfig"--> <fvTable style="width: 100%;max-height: 80px;" v-if="showSingleTable" :tableConfig="singleTableConfig"
<!-- :data="singleFileList" :isSettingCol="false" :pagination="false">--> :data="singleFileList" :isSettingCol="false" :pagination="false">
<!-- <template #empty>--> <template #empty>
<!-- <el-empty :image-size="90" description="暂无数据" style="padding: 0"/>--> <el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
<!-- </template>--> </template>
<!-- </fvTable>--> </fvTable>
</template> </template>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="其他文件" label-width="125"> <el-form-item label="其他文件" label-width="125">
<file-upload @getFile="getOtherFile"/> <file-upload @getFile="getOtherFile"/>
<!-- <el-card style="width: 100%;box-shadow: none">--> <!-- <el-card style="width: 100%;box-shadow: none">-->
<fvTable style="width: 100%;max-height: 300px;" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 300px;" v-if="showTable" :tableConfig="tableConfig"
:data="allFileList" :isSettingCol="false" :pagination="false"> :data="allFileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/> <el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template> </template>
</fvTable> </fvTable>
<!-- </el-card>--> <!-- </el-card>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -81,7 +81,7 @@ const props = defineProps({
}, },
labelPosition: { labelPosition: {
type: String, type: String,
default:'' default: ''
} }
}) })
const emit = defineEmits(["getAttachment", "getOtherFile"]) const emit = defineEmits(["getAttachment", "getOtherFile"])
@@ -209,6 +209,7 @@ const singleTableConfig = reactive({
} }
] ]
}) })
const fileUploadRef=ref()
const rules = reactive({ const rules = reactive({
attachment: [{required: true, message: '请上传附件', trigger: ['blur', 'change']}], attachment: [{required: true, message: '请上传附件', trigger: ['blur', 'change']}],
}) })
@@ -216,8 +217,9 @@ const applyForm = ref()
const singleFile = ref(props.formData.singleFile) const singleFile = ref(props.formData.singleFile)
const isSingleFile = ref(false) const isSingleFile = ref(false)
const allFileList = ref([]) const allFileList = ref([])
const deleteFileVal = ref({})
const singleFileList = ref([]) const singleFileList = ref([])
if(props.formData.fileList !== null && props.formData.fileList?.length > 0){ if (props.formData.fileList !== null && props.formData.fileList?.length > 0) {
allFileList.value = props.formData.fileList allFileList.value = props.formData.fileList
} }
watch(() => props.showTable, (newVal) => { watch(() => props.showTable, (newVal) => {
@@ -259,7 +261,7 @@ watch(() => props.formData.singleFile, (newVal) => {
watch(() => isSingleFile.value, (newVal) => { watch(() => isSingleFile.value, (newVal) => {
isSingleFile.value = newVal isSingleFile.value = newVal
}, {deep: true}) }, {deep: true})
const handleDelete = (row,type) => { const handleDelete = (row, type) => {
deleteFile(row.fileId).then(res => { deleteFile(row.fileId).then(res => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -267,21 +269,24 @@ const handleDelete = (row,type) => {
type: res.code === 1000 ? 'success' : 'error' type: res.code === 1000 ? 'success' : 'error'
}) })
if (res.code === 1000) { if (res.code === 1000) {
if(type==='single'){ if (type === 'single') {
singleFileList.value.splice(singleFileList.value.findIndex((item) => item.id === row.fileId), 1); singleFileList.value.splice(singleFileList.value.findIndex((item) => item.id === row.fileId), 1);
isSingleFile.value = false isSingleFile.value = false
}else { } else {
allFileList.value.splice(allFileList.value.findIndex((item) => item.id === row.fileId), 1); allFileList.value.splice(allFileList.value.findIndex((item) => item.id === row.fileId), 1);
} }
} }
}); });
} }
const handleSingleDelete = (row) => { const handleSingleDelete = (row) => {
handleDelete(row,'single') console.log('row',row)
// fileUploadRef.value.handleRemove(deleteFileVal.value.id)
handleDelete(row, 'single')
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('getAttachment',val) console.log('getAttachment', val)
isSingleFile.value = true isSingleFile.value = true
// deleteFileVal.value=val
emit('getAttachment', val) emit('getAttachment', val)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {

View File

@@ -168,26 +168,26 @@ const show = () => {
getList() getList()
}; };
const updateTreeCheck = (item, flag) => { const updateTreeCheck = (list, flag) => {
// list.forEach(item => { list.forEach(item => {
tree.value.setChecked(item, flag) if (item.value !== -1) {
if (item.children !== undefined) { tree.value.setChecked(item, flag)
updateTreeCheck(item.children, flag) if (item.children !== undefined) {
updateTreeCheck(item.children, flag)
}
} }
// }) })
} }
const handleChange = (data, checked) => { const handleChange = (data, checked) => {
if (data.value == -1) { if (data.value == -1) {
if(checked){ if(checked){
for (const item of dataList.value) { updateTreeCheck(dataList.value, false)
if (item.value !== -1) {
console.log('item',item)
updateTreeCheck(item, false)
}
}
tree.value.setChecked(data,true); tree.value.setChecked(data,true);
} }
} }
if(tree.value.getCheckedKeys().length>1&&tree.value.getCheckedKeys().indexOf(-1)!==-1){
tree.value.setChecked(-1,false);
}
// 左侧有选择框 + 多选 // 左侧有选择框 + 多选
if (props.multiple) { if (props.multiple) {
//不添加重复的数据到右边 //不添加重复的数据到右边

View File

@@ -44,10 +44,12 @@ const props = defineProps({
showFileList: { showFileList: {
type: Boolean, type: Boolean,
default: false default: false
}, disabled: { },
disabled: {
type: Boolean, type: Boolean,
default: false default: false
}, multiple: { },
multiple: {
type: Boolean, type: Boolean,
default: true default: true
} }
@@ -98,7 +100,9 @@ const uploadError = () => {
type: 'error' type: 'error'
}) })
} }
defineExpose({
handleRemove
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -35,14 +35,14 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="是否专项资金" prop="isSpecialFund"> <el-form-item label="是否专项资金" prop="isSpecialFund">
<el-select v-model="formData.isSpecialFund" placeholder="是否专项资金" clearable filterable> <el-select v-model="formData.isSpecialFund" placeholder="是否专项资金" clearable filterable>
<el-option value="true" label="是"></el-option> <el-option :value="true" label="是"></el-option>
<el-option value="false" label="否"></el-option> <el-option :value="false" label="否"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="专项资金名称" prop="specialFundId"> <el-form-item label="专项资金名称" prop="specialFundId">
<el-select v-model="formData.specialFundId" placeholder="请选择专项资金名称" clearable filterable :disabled="formData.isSpecialFund==='false'"> <el-select v-model="formData.specialFundId" placeholder="请选择专项资金名称" clearable filterable :disabled="!formData.isSpecialFund">
<el-option <el-option
v-for="item in specialFundOption" v-for="item in specialFundOption"
:key="item.value" :key="item.value"
@@ -52,7 +52,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" style="margin-bottom: -18px"> <el-col :span="24" style="margin-bottom: -25px">
<el-form-item label="征集公司" prop="companyIds" class="tree-select" label-width="96"> <el-form-item label="征集公司" prop="companyIds" class="tree-select" label-width="96">
<div style="width: 100%"> <div style="width: 100%">
<el-button color="#DED0B2" @click="showCompany">{{ selectedCompanyList.length === 0 ? '请选择征集公司' : '更改' }} <el-button color="#DED0B2" @click="showCompany">{{ selectedCompanyList.length === 0 ? '请选择征集公司' : '更改' }}
@@ -149,15 +149,13 @@ const formData = ref({
deadline: '', deadline: '',
collectExplain: '', collectExplain: '',
fileList: [], fileList: [],
isSpecialFund: 'false' isSpecialFund: false
}) })
const showTinymce = ref(true)
const routerName = ref(router.currentRoute.value.name) const routerName = ref(router.currentRoute.value.name)
const processDiagramViewer = ref(false) const processDiagramViewer = ref(false)
const companyOption = ref([]) const companyOption = ref([])
const specialFundOption = ref([]) const specialFundOption = ref([])
const form = ref(null) const form = ref(null)
const expendClass = ref()
const fileList = ref([]) const fileList = ref([])
const loading = ref(false) const loading = ref(false)
const showTable = ref(false) const showTable = ref(false)
@@ -423,12 +421,12 @@ const getDetailInfo = async () => {
if (res.code === 1000) { if (res.code === 1000) {
selectedCompanyList.value = getCompanyOptionItem(res.data.companyIds) selectedCompanyList.value = getCompanyOptionItem(res.data.companyIds)
formData.value = res.data formData.value = res.data
showTinymce.value = false if(res.data.fileList.length!==0){
showTable.value = false showTable.value = false
nextTick(() => { nextTick(() => {
showTinymce.value = true showTable.value = true
showTable.value = true })
}) }
} else { } else {
ElNotification({ ElNotification({
title: '提示', title: '提示',