mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-01-31 17:12:49 +08:00
组件优化
This commit is contained in:
parent
ea9ef20c96
commit
fb66f0c105
@ -10,18 +10,17 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'mb-icon'
|
default: 'mb-icon'
|
||||||
},
|
},
|
||||||
icon: String,
|
icon: String
|
||||||
size: String,
|
|
||||||
});
|
});
|
||||||
const symbolId = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon : `#${props.prefix}-${props.icon}`)
|
const symbolId = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon : `#${props.prefix}-${props.icon}`)
|
||||||
const className = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon.substring(1) : `${props.prefix}-${props.icon}`)
|
const className = computed(() => props.icon&&props.icon.startsWith('#') ? props.icon.substring(1) : `${props.prefix}-${props.icon}`)
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
svg {
|
svg {
|
||||||
width: 1.3em;
|
width: 1.3em;
|
||||||
height: 1.3em;
|
height: 1.3em;
|
||||||
vertical-align: -0.25em;
|
vertical-align: -0.25em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
fill: var(--mb-main-icon-color)
|
fill: var(--mb-main-icon-color)
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -29,7 +29,7 @@ import { watch, ref, reactive, defineExpose, nextTick, getCurrentInstance, onBef
|
|||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'check-change', 'node-click', 'mounted'])
|
const emit = defineEmits(['update:modelValue', 'check-change', 'node-click'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
url: {
|
url: {
|
||||||
|
@ -85,6 +85,10 @@ export default {
|
|||||||
showRemoveTip: {
|
showRemoveTip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => true
|
default: () => true
|
||||||
|
},
|
||||||
|
join: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -172,8 +176,13 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.$emit('update:modelValue', this.urls)
|
if(this.join){
|
||||||
this.$emit('change', this.urls)
|
this.$emit('update:modelValue', this.urls.join(','))
|
||||||
|
this.$emit('change', this.urls.join(','))
|
||||||
|
}else{
|
||||||
|
this.$emit('update:modelValue', this.urls)
|
||||||
|
this.$emit('change', this.urls)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].removeAttribute('disabled')
|
document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].removeAttribute('disabled')
|
||||||
this.$emit('update:modelValue', '')
|
this.$emit('update:modelValue', '')
|
||||||
@ -196,10 +205,15 @@ export default {
|
|||||||
handleAvatarSuccess(res, file, fileList) {
|
handleAvatarSuccess(res, file, fileList) {
|
||||||
this.uploadLoading = false
|
this.uploadLoading = false
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
this.urls.push(res.data.url)
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.urls.push(res.data.url)
|
if(this.join){
|
||||||
this.$emit('update:modelValue', this.urls)
|
this.$emit('update:modelValue', this.urls.join(','))
|
||||||
this.$emit('change', this.urls)
|
this.$emit('change', this.urls.join(','))
|
||||||
|
}else{
|
||||||
|
this.$emit('update:modelValue', this.urls)
|
||||||
|
this.$emit('change', this.urls)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].setAttribute('disabled', '')
|
document.getElementById(this.uploadDomId).getElementsByClassName('el-upload__input')[0].setAttribute('disabled', '')
|
||||||
this.$emit('update:modelValue', res.data.url)
|
this.$emit('update:modelValue', res.data.url)
|
||||||
|
@ -133,6 +133,10 @@ export default {
|
|||||||
tipColor: {
|
tipColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
join: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -200,8 +204,13 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$delete('/system/file/delete', { url: encodeURI(url) })
|
this.$delete('/system/file/delete', { url: encodeURI(url) })
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.$emit('update:modelValue', this.urls)
|
if(this.join){
|
||||||
this.$emit('change', this.urls)
|
this.$emit('update:modelValue', this.urls.join(','))
|
||||||
|
this.$emit('change', this.urls.join(','))
|
||||||
|
}else{
|
||||||
|
this.$emit('update:modelValue', this.urls)
|
||||||
|
this.$emit('change', this.urls)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$emit('update:modelValue', '')
|
this.$emit('update:modelValue', '')
|
||||||
this.$emit('change', '')
|
this.$emit('change', '')
|
||||||
@ -221,8 +230,13 @@ export default {
|
|||||||
this.urls.push(res.data.url)
|
this.urls.push(res.data.url)
|
||||||
// console.log(this.urls)
|
// console.log(this.urls)
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.$emit('update:modelValue', this.urls)
|
if(this.join){
|
||||||
this.$emit('change', this.urls)
|
this.$emit('update:modelValue', this.urls.join(','))
|
||||||
|
this.$emit('change', this.urls.join(','))
|
||||||
|
}else{
|
||||||
|
this.$emit('update:modelValue', this.urls)
|
||||||
|
this.$emit('change', this.urls)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$emit('update:modelValue', res.data.url)
|
this.$emit('update:modelValue', res.data.url)
|
||||||
this.$emit('change', res.data.url)
|
this.$emit('change', res.data.url)
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
<el-button v-if="it.type == 'add'" v-permission="it.permission" class="filter-item" type="primary" icon="ElIconPlus" @click="it.click">
|
<el-button v-if="it.type == 'add'" v-permission="it.permission" class="filter-item" type="primary" icon="ElIconPlus" @click="it.click">
|
||||||
{{ it.label || '添加' }}
|
{{ it.label || '添加' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<mb-button v-if="it.type == 'delete'" v-permission="it.permission" :plain="true" :request-url="it.url" :btn-type="'delete'" :request-data="{ id: ids }" :after-handler="reload" />
|
<mb-button v-else-if="it.type == 'delete'" v-permission="it.permission" :plain="true" :request-url="it.url" :btn-type="'delete'" :request-data="{ id: ids }" :after-handler="reload" />
|
||||||
|
<el-button v-else :icon="it.icon" :key="it.label" v-permission="it.permission" :type="it.type" :size="it.size" :class="it.class" @click="it.click(ids)">
|
||||||
|
{{ it.label }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
@ -123,11 +123,20 @@ const formOptions = reactive({
|
|||||||
component: 'upload-image',
|
component: 'upload-image',
|
||||||
label: '头像',
|
label: '头像',
|
||||||
rules: [{ required: true, message: '请选择头像', trigger: 'change' }]
|
rules: [{ required: true, message: '请选择头像', trigger: 'change' }]
|
||||||
|
},{
|
||||||
|
span: 12,
|
||||||
|
name: 'heads',
|
||||||
|
component: 'upload-image',
|
||||||
|
label: '多头像',
|
||||||
|
props: {
|
||||||
|
multiple: true
|
||||||
|
},
|
||||||
|
rules: [{ required: true, message: '请选择头像', trigger: 'change' }]
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
function getFormData(){
|
function getFormData(){
|
||||||
console.log(magicForm.value.getFormData().select)
|
console.log(magicForm.value.getFormData())
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<h2>上传文件(单文件)</h2>
|
<h2>上传文件(单文件)</h2>
|
||||||
<mb-upload-file v-model="fileUrl" @change="fileChange" />
|
<mb-upload-file v-model="fileUrl" @change="fileChange" />
|
||||||
<h2>上传文件(多文件)</h2>
|
<h2>上传文件(多文件)</h2>
|
||||||
<mb-upload-file v-model="fileUrls" @change="fileChange" multiple />
|
<mb-upload-file v-model="fileUrls" @change="multipleFileChange" multiple />
|
||||||
<h2>上传图片(id)</h2>
|
<h2>上传图片(id)</h2>
|
||||||
<mb-upload-image :external-id="externalId" multiple :external-type="externalType" />
|
<mb-upload-image :external-id="externalId" multiple :external-type="externalType" />
|
||||||
<h2>上传图片(url、单图)</h2>
|
<h2>上传图片(url、单图)</h2>
|
||||||
@ -22,7 +22,7 @@ export default {
|
|||||||
externalId: this.$common.uuid(),
|
externalId: this.$common.uuid(),
|
||||||
externalType: '营业执照',
|
externalType: '营业执照',
|
||||||
imgUrl: '',
|
imgUrl: '',
|
||||||
multipleImgUrl: ['userfiles/2022-05-13/6be62f3203904410a92530f8e300e233/QQ图片20220505165410.jpg'],
|
multipleImgUrl: '',
|
||||||
fileUrl: '',
|
fileUrl: '',
|
||||||
fileUrls: ''
|
fileUrls: ''
|
||||||
}
|
}
|
||||||
@ -31,11 +31,14 @@ export default {
|
|||||||
fileChange() {
|
fileChange() {
|
||||||
console.log(this.fileUrl)
|
console.log(this.fileUrl)
|
||||||
},
|
},
|
||||||
|
multipleFileChange() {
|
||||||
|
console.log(this.fileUrls)
|
||||||
|
},
|
||||||
imgChange() {
|
imgChange() {
|
||||||
console.log(this.imgUrl)
|
console.log(this.imgUrl)
|
||||||
},
|
},
|
||||||
multipleImgChange() {
|
multipleImgChange() {
|
||||||
// console.log(this.multipleImgUrl)
|
console.log(this.multipleImgUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,13 +202,13 @@ function reloadTable(){
|
|||||||
|
|
||||||
function expand(){
|
function expand(){
|
||||||
refreshTable.value = false
|
refreshTable.value = false
|
||||||
tableOptions.el["default-expand-all"] = !tableOptions.el["default-expand-all"]
|
tableOptions.props["default-expand-all"] = !tableOptions.props["default-expand-all"]
|
||||||
nextTick(() => refreshTable.value = true)
|
nextTick(() => refreshTable.value = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchMenu() {
|
function searchMenu() {
|
||||||
refreshTable.value = false
|
refreshTable.value = false
|
||||||
tableOptions.el["default-expand-all"] = true
|
tableOptions.props["default-expand-all"] = true
|
||||||
nextTick(() => refreshTable.value = true)
|
nextTick(() => refreshTable.value = true)
|
||||||
clearTimeout(searchTimeout)
|
clearTimeout(searchTimeout)
|
||||||
searchTimeout = setTimeout(() => {
|
searchTimeout = setTimeout(() => {
|
||||||
|
@ -234,7 +234,7 @@ watch(officeData, () => {
|
|||||||
|
|
||||||
function expand(){
|
function expand(){
|
||||||
refreshTable.value = false
|
refreshTable.value = false
|
||||||
tableOptions.el["default-expand-all"] = !tableOptions.el["default-expand-all"]
|
tableOptions.props["default-expand-all"] = !tableOptions.props["default-expand-all"]
|
||||||
nextTick(() => refreshTable.value = true)
|
nextTick(() => refreshTable.value = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class Global {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${upload.dir:D:/psyduck/}")
|
@Value("${upload.dir:D:/mb/}")
|
||||||
public void setDir(String dir) {
|
public void setDir(String dir) {
|
||||||
this.dir = dir;
|
this.dir = dir;
|
||||||
}
|
}
|
||||||
|
@ -59,19 +59,11 @@ spring:
|
|||||||
url-pattern: /*
|
url-pattern: /*
|
||||||
# 忽略过滤格式
|
# 忽略过滤格式
|
||||||
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
|
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
|
||||||
|
# 上传路径
|
||||||
upload:
|
upload:
|
||||||
# oss,disk(磁盘)
|
|
||||||
type: disk
|
|
||||||
dir: D:/mb/
|
dir: D:/mb/
|
||||||
oss:
|
|
||||||
endpoint:
|
|
||||||
access-key-id:
|
|
||||||
access-key-secret:
|
|
||||||
bucket-name:
|
|
||||||
# https,http
|
|
||||||
transport-protocol:
|
|
||||||
|
|
||||||
|
# 是否开启“验证码”验证
|
||||||
verification-code:
|
verification-code:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user