|
|
@ -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() |
|
|
|