diff --git a/src/api/eam/upload/index.ts b/src/api/eam/upload/index.ts
index 8bf3ee9..ac7d070 100644
--- a/src/api/eam/upload/index.ts
+++ b/src/api/eam/upload/index.ts
@@ -2,4 +2,9 @@ import request from '@/config/axios'
// 上传图片
export const uploadImage = async (data) => {
return await request.post({ url: `/eam/attachment-file/upload`, data })
+}
+
+// 查询图片
+export const getImage = async (data) => {
+ return await request.post({ url: `/eam/attachment-file/listNoPage`, data })
}
\ No newline at end of file
diff --git a/src/components/Detail/src/DetailDeviceLedger.vue b/src/components/Detail/src/DetailDeviceLedger.vue
index e1df0c0..c16e5ee 100644
--- a/src/components/Detail/src/DetailDeviceLedger.vue
+++ b/src/components/Detail/src/DetailDeviceLedger.vue
@@ -51,9 +51,8 @@
ref="imageFormRef"
:rules="upImageRules"
:schema="imageFormSchemas"
- :is-col="true"
/>
- 点击上传
+ 点击修改
- 点击上传
+ 点击修改
@@ -159,6 +158,7 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { getCurrentInstance} from 'vue'
+import { get } from 'http'
const { proxy } = getCurrentInstance()
defineOptions({ name: 'Detail' })
@@ -322,6 +322,18 @@ const props = defineProps({
required: false,
default: 'A'
},
+ // 获取图片详情方法
+ getImageApi: {
+ type: Function,
+ required: false,
+ default: null
+ },
+ // 上传图片方法
+ uploadImage: {
+ type: Function,
+ required: false,
+ default: null
+ },
})
const subIndex = ref(props.subIndex)
const isShowDrawer = ref(false)
@@ -335,16 +347,25 @@ console.log('imageFormSchemas', imageFormSchemas.value)
// Tabs当前选择
const current = ref(0)
+const imageParmas=ref({
+ funcCode: 'device_mould_picture', //获取图片详情参数
+ fileBusiType: '' //获取图片详情参数
+})
const change = (item, index) => {
current.value = index
+ if (item.prop == 'Image') {
+ imageParmas.value.funcCode = 'device_mould_picture'
+ } else if (item.prop == 'Word') {
+ imageParmas.value.funcCode = 'device_mould_attachment'
+ } else{
+ imageParmas.value.funcCode = ''
+ }
emit('changeTabs', item)
}
//主表所需的参数
const masterParmas = ref({
- number: '' //主表id
- // number: '', //主表单据号
- // status: '' //主表状态 用于控制子表新增编辑按钮显示情况
+ number: '' ,//主表id
})
// 列表头部按钮
@@ -365,9 +386,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
if (!props.isBasic || (props.isBasic && props.tabsExtend)) {
// 设置主表id
masterParmas.value.number = row.number
- // masterParmas.value.number = row.number
- // masterParmas.value.status = row.status
-
if (!props.isBasic) {
tableObjectRef.value.params = {
number: row.number
@@ -380,9 +398,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
console.log(row)
detailLoading.value = true
try {
- nextTick(() => {
- imageFormRef.value.setValues(row)
- })
+ await getImage()
detailData.value = row
// 判断详情新增按钮是否显示
if (routeName.value.indexOf('Job') > -1) {
@@ -453,6 +469,22 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗
+// 获取图片详情
+const getImage=()=>{
+ props.getImageApi({
+ number:masterParmas.value.number,
+ funcCode:imageParmas.value.funcCode,
+ fileBusiType:imageParmas.value.fileBusiType
+ }).then((res)=>{
+ console.log(res)
+ nextTick(() => {
+ imageFormRef.value.setValues({
+ filePathList:res
+ })
+ })
+ })
+}
+
const tableObjectRef = ref()
const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
@@ -556,7 +588,6 @@ const emit = defineEmits([
'detailOpenForm',
'tableFormButton',
'openImage',
- 'uploadImage',
'subTabsChick',
'uploadFile'
])
@@ -610,17 +641,21 @@ const openImage = (item) => {
const imageFormRef = ref()
// 上传图片
const uploadImage =async () => {
- console.log(imageFormRef)
const elForm = unref(imageFormRef)?.getElFormRef()
// 校验表单
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
- emit(
- 'uploadImage',
- masterParmas.value.number,
- imageFormRef.value.formModel.filePathList.map((item) => item.url)
- )
+ let data = {
+ number:masterParmas.value.number,
+ filePathList: imageFormRef.value.formModel.filePathList.map((item) => item.url),
+ funcCode: imageParmas.value.funcCode,
+ fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : ''
+ }
+ props.uploadImage(data).then((res) => {
+ message.success('修改成功')
+ getImage()
+ })
}
// 选择二级tabs
const fileFormRef = ref()
diff --git a/src/views/eam/device/deviceAccounts/index.vue b/src/views/eam/device/deviceAccounts/index.vue
index e36ec73..b159b0e 100644
--- a/src/views/eam/device/deviceAccounts/index.vue
+++ b/src/views/eam/device/deviceAccounts/index.vue
@@ -72,9 +72,10 @@
:upImageRules="UpImageRules"
:fileFormAllSchemas="UploadFile.allSchemas"
:upFileRules="UpFileRules"
- @uploadImage="uploadImage"
@subTabsChick="subTabsChick"
@uploadFile="uploadFile"
+ :getImageApi="uploadApi.getImage"
+ :uploadImage="uploadApi.uploadImage"
/>
@@ -345,29 +346,18 @@ const changeTabs = (item) => {
}
]
}
-const uploadImage = (number, filePath, fileBusiType) => {
- let data = {
- number,
- filePathList: filePath,
- funcCode: funcCode.value,
- fileBusiType: fileBusiType ? fileBusiType : ''
- }
- uploadApi.uploadImage(data).then((res) => {
- console.log(res)
- })
-}
// 二级切换事件
const fileBusiType = ref()
const subTabsChick = (e) => {
fileBusiType.value = e
}
// 上传文件
-const uploadFile = (number, filePath, fileBusiType) => {
+const uploadFile = (number, filePath) => {
let data = {
number,
filePathList: filePath,
funcCode: funcCode.value,
- fileBusiType: fileBusiType ? fileBusiType : ''
+ fileBusiType: fileBusiType.value ? fileBusiType.value : ''
}
uploadApi.uploadImage(data).then((res) => {
console.log(res)