更新页面
This commit is contained in:
@ -184,7 +184,4 @@ watch(()=>props.modelValue,val=>{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="form-item-box" :style="{ width: width }">
|
||||
<div class="form-item-box" :class="props.showBtn?'showBtn-upload':''" :style="{ width: width }">
|
||||
<el-upload
|
||||
v-bind="$attrs"
|
||||
:headers="headers"
|
||||
@ -7,24 +7,24 @@
|
||||
class="avatar-uploader"
|
||||
:limit="props.limit"
|
||||
:action="actionUrl"
|
||||
list-type="picture-card"
|
||||
:list-type=" props.showBtn ? '' :'picture-card'"
|
||||
:file-list="fileList"
|
||||
show-file-list
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="handlerSuccess"
|
||||
:before-upload="beforeImgUpload"
|
||||
>
|
||||
|
||||
<template #default>
|
||||
<el-icon> <Plus /> </el-icon>
|
||||
<el-button v-if="props.showBtn" size="small" type="primary">上传文件</el-button>
|
||||
<el-icon v-else> <Plus /> </el-icon>
|
||||
</template>
|
||||
<template #file="{ file }">
|
||||
<template #file="{ file }" v-if="!props.showBtn">
|
||||
<div v-if="props.isImg">
|
||||
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
|
||||
<el-icon>
|
||||
<zoom-in />
|
||||
</el-icon>
|
||||
<el-icon> <zoom-in /></el-icon>
|
||||
</span>
|
||||
<span
|
||||
v-if="!disabled"
|
||||
@ -79,13 +79,11 @@ import {
|
||||
ref,
|
||||
defineProps,
|
||||
defineEmits,
|
||||
defineExpose,
|
||||
computed,
|
||||
watch,
|
||||
onMounted
|
||||
} from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import type from "element-plus/es/components/upload/src/upload.type";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useStore } from "vuex";
|
||||
const props = defineProps({
|
||||
//获取组件传值
|
||||
@ -104,6 +102,10 @@ const props = defineProps({
|
||||
width: {
|
||||
default: COMPONENT_WIDTH,
|
||||
type: String
|
||||
},
|
||||
showBtn:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
});
|
||||
|
||||
@ -184,6 +186,8 @@ const headers = ref({
|
||||
|
||||
onMounted(() => {
|
||||
if (props.modelValue) {
|
||||
console.log(props.modelValue,'==========props.modelValue');
|
||||
console.log(fileList.value,'====键');
|
||||
fileList.value = props.modelValue.map((el) => {
|
||||
return {
|
||||
url: `/mosty-api/mosty-base/minio/image/download/` + el
|
||||
@ -191,6 +195,7 @@ onMounted(() => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const fileList = ref([]);
|
||||
const handlerSuccess = (res, file) => {
|
||||
file.url = `/mosty-api/mosty-base/minio/image/download/` + res.data;
|
||||
@ -296,4 +301,4 @@ const handleRemove = (file) => {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -4,10 +4,11 @@
|
||||
:model="listQuery"
|
||||
:label-width="props.labelWidth"
|
||||
:rules="props.rules"
|
||||
:inline="true"
|
||||
:inline="props.inline"
|
||||
label-position="right"
|
||||
>
|
||||
<el-form-item
|
||||
:class="myClass"
|
||||
v-for="item in props.formList"
|
||||
:style="item.width && { width: item.width }"
|
||||
:prop="item.prop"
|
||||
@ -63,7 +64,7 @@
|
||||
/>
|
||||
<!-- 部门department -->
|
||||
<template v-else-if="item.type === 'department'">
|
||||
<MOSTY.Department clearable v-model="listQuery[item.prop]" />
|
||||
<MOSTY.Department style="width: 100%;" clearable v-model="listQuery[item.prop]" />
|
||||
</template>
|
||||
|
||||
<!-- 上传 upload -->
|
||||
@ -183,6 +184,10 @@ const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
inline:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
}
|
||||
});
|
||||
const elform = ref();
|
||||
@ -196,6 +201,10 @@ const submit = (resfun) => {
|
||||
});
|
||||
};
|
||||
|
||||
const reset = () =>{
|
||||
elform.value.resetFields()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => listQuery.value,
|
||||
(newVal) => {
|
||||
@ -215,5 +224,5 @@ watch(
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
defineExpose({ submit });
|
||||
defineExpose({ submit,reset });
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user