mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-07-09 00:00:04 +08:00
优化一波生成,加载组件等
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
detail: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
primaryField: {
|
||||
type: String,
|
||||
default: 'id'
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['reload'])
|
||||
@@ -87,7 +91,7 @@
|
||||
d.hideLoading()
|
||||
proxy.$notify({
|
||||
title: '成功',
|
||||
message: (!formData.value.id ? '创建' : '修改') + '成功',
|
||||
message: (!formData.value[props.primaryField] ? '创建' : '修改') + '成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
@@ -102,8 +106,8 @@
|
||||
}
|
||||
|
||||
function getDetail(id) {
|
||||
formData.value.id = id
|
||||
proxy.$get(props.detail.request.url, { id: id }).then(res => {
|
||||
formData.value[props.primaryField] = id
|
||||
proxy.$get(props.detail.request.url, { [props.primaryField]: id }).then(res => {
|
||||
const { data } = res
|
||||
for (var t in formData.value) {
|
||||
if (data[t] && (!props.detail.excludeAssign || props.detail.excludeAssign.indexOf(t) === -1)) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
:append-to-body="true"
|
||||
draggable
|
||||
@open="$emit('open')"
|
||||
@opened="opened"
|
||||
@close="$emit('close')"
|
||||
>
|
||||
<slot name="content" />
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['confirm-click', 'open', 'close'],
|
||||
emits: ['confirm-click', 'open', 'opened', 'close'],
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
@@ -53,7 +54,8 @@ export default {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
confirmLoading: false,
|
||||
customClass: 'mbDialog' + this.$common.uuid()
|
||||
customClass: 'mbDialog' + this.$common.uuid(),
|
||||
isOpen: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -69,6 +71,10 @@ export default {
|
||||
this.addStyle()
|
||||
},
|
||||
methods: {
|
||||
opened(){
|
||||
this.$emit('opened')
|
||||
this.isOpen = true
|
||||
},
|
||||
confirmClick() {
|
||||
this.$emit('confirm-click', this)
|
||||
},
|
||||
@@ -78,8 +84,17 @@ export default {
|
||||
hideLoading(){
|
||||
this.confirmLoading = false
|
||||
},
|
||||
show() {
|
||||
show(callback) {
|
||||
this.dialogVisible = true
|
||||
if(callback){
|
||||
var callbackInterval = setInterval(() => {
|
||||
if(this.isOpen){
|
||||
this.isOpen = false
|
||||
clearInterval(callbackInterval)
|
||||
callback()
|
||||
}
|
||||
},1)
|
||||
}
|
||||
},
|
||||
hide() {
|
||||
this.dialogVisible = false
|
||||
|
||||
@@ -70,7 +70,7 @@ export default {
|
||||
video: 'avi,flv,mp4,mpeg,mov'
|
||||
},
|
||||
imageUrl: '',
|
||||
action: import.meta.env.VITE_APP_BASE_API + 'file/upload',
|
||||
action: import.meta.env.VITE_APP_BASE_API + '/system/file/upload',
|
||||
headers: {
|
||||
token: getToken()
|
||||
},
|
||||
@@ -137,7 +137,7 @@ export default {
|
||||
this.$emit('update:modelValue', '')
|
||||
this.$emit('change', '')
|
||||
}
|
||||
this.$delete('file/delete', { url: encodeURI(url) })
|
||||
this.$delete('/system/file/delete', { url: encodeURI(url) })
|
||||
},
|
||||
handlePreview(file) {
|
||||
window.open(this.$global.baseApi + file.response.data.url)
|
||||
|
||||
@@ -127,7 +127,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
action: import.meta.env.VITE_APP_BASE_API + 'file/upload',
|
||||
action: import.meta.env.VITE_APP_BASE_API + '/system/file/upload',
|
||||
headers: {
|
||||
token: getToken()
|
||||
},
|
||||
@@ -179,7 +179,7 @@ export default {
|
||||
this.fileList.splice(i, 1)
|
||||
}
|
||||
})
|
||||
this.$delete('file/delete', { url: encodeURI(url) })
|
||||
this.$delete('/system/file/delete', { url: encodeURI(url) })
|
||||
if (this.multiple) {
|
||||
this.$emit('update:modelValue', this.urls)
|
||||
this.$emit('change', this.urls)
|
||||
|
||||
Reference in New Issue
Block a user