Browse Source

设备台账详情

master
zhang_li 10 months ago
parent
commit
c88e0214b6
  1. 5
      src/api/eam/upload/index.ts
  2. 73
      src/components/Detail/src/DetailDeviceLedger.vue
  3. 18
      src/views/eam/device/deviceAccounts/index.vue

5
src/api/eam/upload/index.ts

@ -3,3 +3,8 @@ 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 })
}

73
src/components/Detail/src/DetailDeviceLedger.vue

@ -51,9 +51,8 @@
ref="imageFormRef"
:rules="upImageRules"
:schema="imageFormSchemas"
:is-col="true"
/>
<el-button type="primary" @click="uploadImage">点击上传</el-button>
<el-button type="primary" @click="uploadImage">点击修改</el-button>
</div>
<el-tabs type="border-card" class="demo-tabs" v-model="subIndex" v-if="isBasic && tabsExtend == 2" @tab-change="handleTabsChange">
<el-tab-pane
@ -68,7 +67,7 @@
:schema="fileFormSchemas"
:is-col="true"
/>
<el-button type="primary" @click="uploadFile(index)">点击上传</el-button>
<el-button type="primary" @click="uploadFile(index)">点击修改</el-button>
</el-tab-pane>
</el-tabs>
<!-- 单表切换tabs 展现table -->
@ -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()

18
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)

Loading…
Cancel
Save