| | |
| | | <el-button size="small" icon="el-icon-upload2">点击上传</el-button> |
| | | </el-upload> |
| | | <div v-else> |
| | | <div v-for="file in item.data.fileList" :key="file.uid" class="file-list-item"> |
| | | {{ file.name }} |
| | | <div v-for="file in item.data.fileList" :key="file.uid" class="file-list-item" > |
| | | <span style="color: #409EFF; cursor: pointer;" @click="downloadFileByUrl(file.url, file.name)">{{ file.name }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import addTableData from "./addTableData.vue"; |
| | | import apiConfig from '../../utils/baseurl' |
| | | import { getFullUrl } from '@/utils/utils' |
| | | import { downloadFileByUrl } from '@/utils/utils' |
| | | |
| | | export default { |
| | | name: "DynamicComponent", |
| | |
| | | break; |
| | | case 'fileUpload': |
| | | componentData = { fileList: component.data }; |
| | | console.log('component.data component.data',component.data) |
| | | break; |
| | | case 'imageUpload': |
| | | componentData = { imageList: component.data }; |
| | | componentData = { imageList: component.data.map(item=>{ |
| | | return { |
| | | ...item, |
| | | url: getFullUrl(item.url), |
| | | } |
| | | }) }; |
| | | break; |
| | | } |
| | | return { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | getFullUrl, |
| | | downloadFileByUrl, |
| | | getUserDisplayText(fieldName, rowData) { |
| | | // 检查是否有对应的userInfo数据 |
| | | const userInfoKey = `${fieldName}_userInfo`; |
| | |
| | | break; |
| | | case 'fileUpload': |
| | | componentData = component.data.fileList.map(file => { |
| | | console.log('fileUpload fileUpload fileUpload',file) |
| | | if (file.url && file.url.startsWith(prefix)) { |
| | | return { ...file, url: file.url.substring(prefix.length) }; |
| | | } |
| | |
| | | const processedData = { ...formData }; |
| | | |
| | | // 调试输出 |
| | | console.log('添加/编辑行数据:', processedData, 'isEdit', isEdit); |
| | | |
| | | if (isEdit) { |
| | | // Vue无法检测到对象或数组深层属性的变化,使用Vue.set来确保响应式 |
| | | this.$set( |
| | |
| | | updateTime: new Date().toLocaleString() |
| | | }); |
| | | } |
| | | console.log('this.components', this.components); |
| | | |
| | | // 手动触发组件更新 |
| | | this.$forceUpdate(); |
| | |
| | | const updatedComponents = JSON.parse(JSON.stringify(this.components)); |
| | | this.$emit('update:dataSource', updatedComponents); |
| | | }, |
| | | getFullUrl, |
| | | }, |
| | | computed: { |
| | | }, |