Browse Source

文件回显

master
zhang_li 9 months ago
parent
commit
87a6d28214
  1. 2
      src/components/BasicForm/src/BasicForm.vue
  2. 1
      src/components/Detail/src/DetailDeviceLedger.vue
  3. 20
      src/components/UploadFile/src/UploadFile.vue
  4. 7
      src/views/eam/device/problemSolving/index.vue
  5. 1
      src/views/eam/device/problemSolving/problemSolving.data.ts

2
src/components/BasicForm/src/BasicForm.vue

@ -380,8 +380,10 @@ const open = async (type: string, row?: any, masterParmas?: any) => {
formLoading.value = true
try {
nextTick(() => {
console.log('row11',row)
formRef.value.setValues(row)
})
} finally {
formLoading.value = false
}

1
src/components/Detail/src/DetailDeviceLedger.vue

@ -594,6 +594,7 @@ const getImage = () => {
if (imageParmas.value.funcCode == 'device_mould_picture') {
imageFormData.value.filePathList = res
} else {
console.log(444,res)
fileFormData.value.filePathList = res
formKey.value += 1
}

20
src/components/UploadFile/src/UploadFile.vue

@ -6,7 +6,7 @@
name="file"
v-model="valueRef"
v-model:file-list="fileList"
:show-file-list="true"
:show-file-list="isShowFileList"
:auto-upload="autoUpload"
:action="updateUrl"
:headers="uploadHeaders"
@ -28,6 +28,7 @@
<div style="font-size: 8px;line-height: initial;">
格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b> 的文件
</div>
<Preview1 :fileList="fileList" v-if="!isShowFile"/>
</template>
<template v-if="!isShowFile" #file >
<div>
@ -42,6 +43,7 @@ import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { getAccessToken, getTenantId } from '@/utils/auth'
import type { UploadInstance, UploadUserFile, UploadProps, UploadRawFile } from 'element-plus'
import Preview1 from '@/components/UploadFile/src/Preview.vue'
defineOptions({ name: 'UploadFile' })
@ -63,19 +65,25 @@ const props = defineProps({
drag: propTypes.bool.def(false), //
isShowTip: propTypes.bool.def(true), //
isShowFile: propTypes.bool.def(true), //
// isShowFileList: propTypes.bool.def(true), //
})
// ========== ==========
// setTimeout(()=>{
// console.log('props.modelValue',props.modelValue)
// },2000)
const valueRef = ref(props.modelValue)
const uploadRef = ref<UploadInstance>()
const uploadList = ref<UploadUserFile[]>([])
console.log('88',props.modelValue)
const fileList = props.modelValue && props.modelValue.length > 0 ? ref<UploadUserFile[]>(props.modelValue) : ref<UploadUserFile[]>([])
const uploadNumber = ref<number>(0)
const uploadHeaders = ref({
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
})
//
const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
if (fileList.value.length >= props.limit) {
@ -149,6 +157,14 @@ const listToString = (list: UploadUserFile[], separator?: string) => {
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''
}
watch(
() => props.modelValue,
(val) => {
// if (val === unref(colorVal)) return
valueRef.value = val
fileList.value = val && val.length > 0 ?val:[]
}
)
</script>
<style scoped lang="scss">
.upload-file-uploader {

7
src/views/eam/device/problemSolving/index.vue

@ -126,6 +126,13 @@
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type : string, row ?: any) => {
// console.log(99,row)
row.filePathListView = row.filePathList.map(item=>{
return {
name:item,
url:item
}
})
basicFormRef.value.open(type, row)
}

1
src/views/eam/device/problemSolving/problemSolving.data.ts

@ -45,7 +45,6 @@ export const ProblemSolving = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'UploadFile',
componentProps: {
}
}
},

Loading…
Cancel
Save