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

@ -2,4 +2,9 @@ import request from '@/config/axios'
// 上传图片 // 上传图片
export const uploadImage = async (data) => { export const uploadImage = async (data) => {
return await request.post({ url: `/eam/attachment-file/upload`, 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" ref="imageFormRef"
:rules="upImageRules" :rules="upImageRules"
:schema="imageFormSchemas" :schema="imageFormSchemas"
:is-col="true"
/> />
<el-button type="primary" @click="uploadImage">点击上传</el-button> <el-button type="primary" @click="uploadImage">点击修改</el-button>
</div> </div>
<el-tabs type="border-card" class="demo-tabs" v-model="subIndex" v-if="isBasic && tabsExtend == 2" @tab-change="handleTabsChange"> <el-tabs type="border-card" class="demo-tabs" v-model="subIndex" v-if="isBasic && tabsExtend == 2" @tab-change="handleTabsChange">
<el-tab-pane <el-tab-pane
@ -68,7 +67,7 @@
:schema="fileFormSchemas" :schema="fileFormSchemas"
:is-col="true" :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-tab-pane>
</el-tabs> </el-tabs>
<!-- 单表切换tabs 展现table --> <!-- 单表切换tabs 展现table -->
@ -159,6 +158,7 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { getCurrentInstance} from 'vue' import { getCurrentInstance} from 'vue'
import { get } from 'http'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
defineOptions({ name: 'Detail' }) defineOptions({ name: 'Detail' })
@ -322,6 +322,18 @@ const props = defineProps({
required: false, required: false,
default: 'A' default: 'A'
}, },
//
getImageApi: {
type: Function,
required: false,
default: null
},
//
uploadImage: {
type: Function,
required: false,
default: null
},
}) })
const subIndex = ref(props.subIndex) const subIndex = ref(props.subIndex)
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
@ -335,16 +347,25 @@ console.log('imageFormSchemas', imageFormSchemas.value)
// Tabs // Tabs
const current = ref(0) const current = ref(0)
const imageParmas=ref({
funcCode: 'device_mould_picture', //
fileBusiType: '' //
})
const change = (item, index) => { const change = (item, index) => {
current.value = 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) emit('changeTabs', item)
} }
// //
const masterParmas = ref({ const masterParmas = ref({
number: '' //id number: '' ,//id
// number: '', //
// status: '' //
}) })
// //
@ -365,9 +386,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
if (!props.isBasic || (props.isBasic && props.tabsExtend)) { if (!props.isBasic || (props.isBasic && props.tabsExtend)) {
// id // id
masterParmas.value.number = row.number masterParmas.value.number = row.number
// masterParmas.value.number = row.number
// masterParmas.value.status = row.status
if (!props.isBasic) { if (!props.isBasic) {
tableObjectRef.value.params = { tableObjectRef.value.params = {
number: row.number number: row.number
@ -380,9 +398,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
console.log(row) console.log(row)
detailLoading.value = true detailLoading.value = true
try { try {
nextTick(() => { await getImage()
imageFormRef.value.setValues(row)
})
detailData.value = row detailData.value = row
// //
if (routeName.value.indexOf('Job') > -1) { if (routeName.value.indexOf('Job') > -1) {
@ -453,6 +469,22 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
} }
defineExpose({ openDetail }) // open 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 tableObjectRef = ref()
const tableMethodsRef = ref() const tableMethodsRef = ref()
const detailAllSchemasRef = ref() const detailAllSchemasRef = ref()
@ -556,7 +588,6 @@ const emit = defineEmits([
'detailOpenForm', 'detailOpenForm',
'tableFormButton', 'tableFormButton',
'openImage', 'openImage',
'uploadImage',
'subTabsChick', 'subTabsChick',
'uploadFile' 'uploadFile'
]) ])
@ -610,17 +641,21 @@ const openImage = (item) => {
const imageFormRef = ref() const imageFormRef = ref()
// //
const uploadImage =async () => { const uploadImage =async () => {
console.log(imageFormRef)
const elForm = unref(imageFormRef)?.getElFormRef() const elForm = unref(imageFormRef)?.getElFormRef()
// //
if (!elForm) return if (!elForm) return
const valid = await elForm.validate() const valid = await elForm.validate()
if (!valid) return if (!valid) return
emit( let data = {
'uploadImage', number:masterParmas.value.number,
masterParmas.value.number, filePathList: imageFormRef.value.formModel.filePathList.map((item) => item.url),
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 // tabs
const fileFormRef = ref() const fileFormRef = ref()

18
src/views/eam/device/deviceAccounts/index.vue

@ -72,9 +72,10 @@
:upImageRules="UpImageRules" :upImageRules="UpImageRules"
:fileFormAllSchemas="UploadFile.allSchemas" :fileFormAllSchemas="UploadFile.allSchemas"
:upFileRules="UpFileRules" :upFileRules="UpFileRules"
@uploadImage="uploadImage"
@subTabsChick="subTabsChick" @subTabsChick="subTabsChick"
@uploadFile="uploadFile" @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 fileBusiType = ref()
const subTabsChick = (e) => { const subTabsChick = (e) => {
fileBusiType.value = e fileBusiType.value = e
} }
// //
const uploadFile = (number, filePath, fileBusiType) => { const uploadFile = (number, filePath) => {
let data = { let data = {
number, number,
filePathList: filePath, filePathList: filePath,
funcCode: funcCode.value, funcCode: funcCode.value,
fileBusiType: fileBusiType ? fileBusiType : '' fileBusiType: fileBusiType.value ? fileBusiType.value : ''
} }
uploadApi.uploadImage(data).then((res) => { uploadApi.uploadImage(data).then((res) => {
console.log(res) console.log(res)

Loading…
Cancel
Save