|
@ -39,37 +39,30 @@ |
|
|
@searchFormClick="searchFormClick" |
|
|
@searchFormClick="searchFormClick" |
|
|
:allSchemas="detailAllSchemas" |
|
|
:allSchemas="detailAllSchemas" |
|
|
/> |
|
|
/> |
|
|
<!-- 默认单表展现 --> |
|
|
|
|
|
<!-- <Descriptions |
|
|
|
|
|
v-if="isBasic && !tabsExtend" |
|
|
|
|
|
:data="detailData" |
|
|
|
|
|
:schema="allSchemas.detailSchema" |
|
|
|
|
|
:columns="2" |
|
|
|
|
|
/> --> |
|
|
|
|
|
<div v-if="isBasic && tabsExtend == 1"> |
|
|
<div v-if="isBasic && tabsExtend == 1"> |
|
|
<Form |
|
|
<el-form ref="imageFormRef" :model="imageFormData" :key="formKey"> |
|
|
ref="imageFormRef" |
|
|
<el-form-item label="文件上传"> |
|
|
:rules="upImageRules" |
|
|
<UploadImgs v-model="imageFormData.filePathList" /> |
|
|
:schema="imageFormSchemas" |
|
|
</el-form-item> |
|
|
/> |
|
|
</el-form> |
|
|
<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"> |
|
|
<div v-if="isBasic && tabsExtend == 2"> |
|
|
|
|
|
<el-tabs class="demo-tabs" v-model="imageParmas.fileBusiType" @tab-change="handleTabsChange"> |
|
|
<el-tab-pane |
|
|
<el-tab-pane |
|
|
v-for="(item,index) in subTabsList" |
|
|
v-for="item in subTabsList" |
|
|
:key="item.value" |
|
|
:key="item.value" |
|
|
:label="item.label" |
|
|
:label="item.label" |
|
|
:name="item.value" |
|
|
:name="item.value" |
|
|
> |
|
|
|
|
|
<Form |
|
|
|
|
|
:ref="'fileFormRef'" |
|
|
|
|
|
:rules="upFileRules" |
|
|
|
|
|
:schema="fileFormSchemas" |
|
|
|
|
|
:is-col="true" |
|
|
|
|
|
/> |
|
|
/> |
|
|
<el-button type="primary" @click="uploadFile(index)">点击修改</el-button> |
|
|
|
|
|
</el-tab-pane> |
|
|
|
|
|
</el-tabs> |
|
|
</el-tabs> |
|
|
|
|
|
<el-form ref="fileFormRef" :model="fileFormData" :key="formKey"> |
|
|
|
|
|
<el-form-item label="文件上传"> |
|
|
|
|
|
<UploadFile v-model="fileFormData.filePathList" :limit="20" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
<el-button type="primary" @click="uploadFile">点击修改</el-button> |
|
|
|
|
|
</div> |
|
|
<!-- 单表切换tabs 展现table --> |
|
|
<!-- 单表切换tabs 展现table --> |
|
|
<Table |
|
|
<Table |
|
|
v-if="isBasic && tabsExtend == 3" |
|
|
v-if="isBasic && tabsExtend == 3" |
|
@ -159,7 +152,9 @@ 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' |
|
|
import { get } from 'http' |
|
|
|
|
|
import { findIndex } from '@/utils' |
|
|
const { proxy } = getCurrentInstance() |
|
|
const { proxy } = getCurrentInstance() |
|
|
|
|
|
const changeFile = () => {} |
|
|
|
|
|
|
|
|
defineOptions({ name: 'Detail' }) |
|
|
defineOptions({ name: 'Detail' }) |
|
|
|
|
|
|
|
@ -295,33 +290,12 @@ const props = defineProps({ |
|
|
required: false, |
|
|
required: false, |
|
|
default: false |
|
|
default: false |
|
|
}, |
|
|
}, |
|
|
// 详情上传图片 |
|
|
|
|
|
upImageRules: { |
|
|
|
|
|
type: Array, |
|
|
|
|
|
required: false, |
|
|
|
|
|
default: null |
|
|
|
|
|
}, |
|
|
|
|
|
imageFormAllSchemas: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
required: true, |
|
|
|
|
|
default: null |
|
|
|
|
|
}, |
|
|
|
|
|
// 详情上传文件 |
|
|
// 详情上传文件 |
|
|
upFileRules: { |
|
|
upFileRules: { |
|
|
type: Array, |
|
|
type: Array, |
|
|
required: false, |
|
|
required: false, |
|
|
default: null |
|
|
default: null |
|
|
}, |
|
|
}, |
|
|
fileFormAllSchemas: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
required: true, |
|
|
|
|
|
default: null |
|
|
|
|
|
}, |
|
|
|
|
|
subIndex: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
required: false, |
|
|
|
|
|
default: 'A' |
|
|
|
|
|
}, |
|
|
|
|
|
// 获取图片详情方法 |
|
|
// 获取图片详情方法 |
|
|
getImageApi: { |
|
|
getImageApi: { |
|
|
type: Function, |
|
|
type: Function, |
|
@ -333,17 +307,20 @@ const props = defineProps({ |
|
|
type: Function, |
|
|
type: Function, |
|
|
required: false, |
|
|
required: false, |
|
|
default: null |
|
|
default: null |
|
|
}, |
|
|
} |
|
|
}) |
|
|
}) |
|
|
const subIndex = ref(props.subIndex) |
|
|
const imageFormData = ref({ |
|
|
|
|
|
filePathList: [] |
|
|
|
|
|
}) |
|
|
|
|
|
const fileFormData = ref({ |
|
|
|
|
|
filePathList: [] |
|
|
|
|
|
}) |
|
|
|
|
|
const subIndex = ref('A') |
|
|
const isShowDrawer = ref(false) |
|
|
const isShowDrawer = ref(false) |
|
|
const detailLoading = ref(false) |
|
|
const detailLoading = ref(false) |
|
|
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|
|
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|
|
const subTabsList = ref(JSON.parse(JSON.stringify(props.subTabs ? props.subTabs : ''))) |
|
|
const subTabsList = ref(JSON.parse(JSON.stringify(props.subTabs ? props.subTabs : ''))) |
|
|
|
|
|
|
|
|
const imageFormSchemas = ref(props.imageFormAllSchemas?.formSchema) |
|
|
|
|
|
const fileFormSchemas = ref(props.fileFormAllSchemas?.formSchema) |
|
|
|
|
|
console.log('imageFormSchemas', imageFormSchemas.value) |
|
|
|
|
|
|
|
|
|
|
|
// Tabs当前选择 |
|
|
// Tabs当前选择 |
|
|
const current = ref(0) |
|
|
const current = ref(0) |
|
@ -355,17 +332,24 @@ const change = (item, index) => { |
|
|
current.value = index |
|
|
current.value = index |
|
|
if (item.prop == 'Image') { |
|
|
if (item.prop == 'Image') { |
|
|
imageParmas.value.funcCode = 'device_mould_picture' |
|
|
imageParmas.value.funcCode = 'device_mould_picture' |
|
|
|
|
|
imageParmas.value.fileBusiType = '' |
|
|
|
|
|
getImage() |
|
|
} else if (item.prop == 'Word') { |
|
|
} else if (item.prop == 'Word') { |
|
|
imageParmas.value.funcCode = 'device_mould_attachment' |
|
|
imageParmas.value.funcCode = 'device_mould_attachment' |
|
|
|
|
|
imageParmas.value.fileBusiType = 'A' |
|
|
|
|
|
subIndex.value = 'A' |
|
|
|
|
|
formKey.value += 1 |
|
|
|
|
|
getImage() |
|
|
} else { |
|
|
} else { |
|
|
imageParmas.value.funcCode = '' |
|
|
imageParmas.value.funcCode = '' |
|
|
|
|
|
imageParmas.value.fileBusiType = '' |
|
|
} |
|
|
} |
|
|
emit('changeTabs', item) |
|
|
emit('changeTabs', item) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//主表所需的参数 |
|
|
//主表所需的参数 |
|
|
const masterParmas = ref({ |
|
|
const masterParmas = ref({ |
|
|
number: '' ,//主表id |
|
|
number: '' //主表id |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
@ -394,8 +378,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
isShowDrawer.value = true |
|
|
isShowDrawer.value = true |
|
|
|
|
|
|
|
|
|
|
|
imageParmas.value.funcCode = 'device_mould_picture' |
|
|
|
|
|
|
|
|
if (row) { |
|
|
if (row) { |
|
|
console.log(row) |
|
|
|
|
|
detailLoading.value = true |
|
|
detailLoading.value = true |
|
|
try { |
|
|
try { |
|
|
await getImage() |
|
|
await getImage() |
|
@ -470,17 +456,22 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: |
|
|
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗 |
|
|
defineExpose({ openDetail }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
|
// 获取图片详情 |
|
|
// 获取图片详情 |
|
|
|
|
|
const formKey = ref(0) |
|
|
const getImage = () => { |
|
|
const getImage = () => { |
|
|
props.getImageApi({ |
|
|
props |
|
|
|
|
|
.getImageApi({ |
|
|
number: masterParmas.value.number, |
|
|
number: masterParmas.value.number, |
|
|
funcCode: imageParmas.value.funcCode, |
|
|
funcCode: imageParmas.value.funcCode, |
|
|
fileBusiType: imageParmas.value.fileBusiType |
|
|
fileBusiType: imageParmas.value.fileBusiType |
|
|
}).then((res)=>{ |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
imageFormRef.value.setValues({ |
|
|
|
|
|
filePathList:res |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
if (imageParmas.value.funcCode == 'device_mould_picture') { |
|
|
|
|
|
imageFormData.value.filePathList = res |
|
|
|
|
|
} else { |
|
|
|
|
|
fileFormData.value.filePathList = res |
|
|
|
|
|
formKey.value += 1 |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
@ -588,8 +579,7 @@ const emit = defineEmits([ |
|
|
'detailOpenForm', |
|
|
'detailOpenForm', |
|
|
'tableFormButton', |
|
|
'tableFormButton', |
|
|
'openImage', |
|
|
'openImage', |
|
|
'subTabsChick', |
|
|
'subTabsChick' |
|
|
'uploadFile' |
|
|
|
|
|
]) |
|
|
]) |
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
|
const handleDelete = async (id: number) => { |
|
|
const handleDelete = async (id: number) => { |
|
@ -641,14 +631,15 @@ const openImage = (item) => { |
|
|
const imageFormRef = ref() |
|
|
const imageFormRef = ref() |
|
|
// 上传图片 |
|
|
// 上传图片 |
|
|
const uploadImage = async () => { |
|
|
const uploadImage = async () => { |
|
|
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 |
|
|
|
|
|
imageFormData |
|
|
let data = { |
|
|
let data = { |
|
|
number: masterParmas.value.number, |
|
|
number: masterParmas.value.number, |
|
|
filePathList: imageFormRef.value.formModel.filePathList.map((item) => item.url), |
|
|
filePathList: imageFormData.value.filePathList.map((item) => item.url), |
|
|
funcCode: imageParmas.value.funcCode, |
|
|
funcCode: imageParmas.value.funcCode, |
|
|
fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' |
|
|
fileBusiType: imageParmas.value.fileBusiType ? imageParmas.value.fileBusiType : '' |
|
|
} |
|
|
} |
|
@ -660,22 +651,28 @@ const uploadImage =async () => { |
|
|
// 选择二级tabs |
|
|
// 选择二级tabs |
|
|
const fileFormRef = ref() |
|
|
const fileFormRef = ref() |
|
|
const handleTabsChange = (e) => { |
|
|
const handleTabsChange = (e) => { |
|
|
emit('subTabsChick',e) |
|
|
imageParmas.value.fileBusiType = e |
|
|
|
|
|
getImage() |
|
|
} |
|
|
} |
|
|
// 上传文件 |
|
|
// 上传文件 |
|
|
const uploadFile=async(index)=>{ |
|
|
const uploadFile = async () => { |
|
|
let _lists = fileFormRef.value?.map(v => unref(v)?.getElFormRef()) |
|
|
console.log(fileFormData.value.filePathList) |
|
|
const elForm = _lists[index] |
|
|
// const elForm = unref(fileFormRef)?.getElFormRef() |
|
|
// 校验表单 |
|
|
// // 校验表单 |
|
|
if (!elForm) return |
|
|
// if (!elForm) return |
|
|
const valid = await elForm.validate() |
|
|
// const valid = await elForm.validate() |
|
|
if (!valid) return |
|
|
// if (!valid) return |
|
|
console.log(fileFormRef.value.formModel) |
|
|
// console.log(fileFormRef.value?.formModel.filePathList) |
|
|
emit( |
|
|
let data = { |
|
|
'uploadFile', |
|
|
number: masterParmas.value.number, |
|
|
masterParmas.value.number, |
|
|
filePathList: fileFormData.value.filePathList.map((item) => item.url), |
|
|
fileFormRef.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() |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
//监视属性 |
|
|
//监视属性 |
|
|
watch( |
|
|
watch( |
|
|