mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-08-16 00:00:34 +08:00
代码优化等
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :fullscreen="fullscreen" :width="width" :title="title" v-model="dialogVisible" :close-on-click-modal="false" :append-to-body="true" draggable @opened="opened">
|
||||
<el-dialog :fullscreen="fullscreen" :width="width" :title="title" v-model="dialogVisible" :close-on-click-modal="false" :key="dialogKey" :append-to-body="true" draggable @opened="opened">
|
||||
<slot name="content" />
|
||||
<template #footer>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -36,12 +36,17 @@ export default {
|
||||
opened: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
autoKey: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
confirmLoading: false
|
||||
confirmLoading: false,
|
||||
dialogKey: 'mbDialog',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -66,6 +71,9 @@ export default {
|
||||
this.confirmLoading = false
|
||||
},
|
||||
show() {
|
||||
if(this.autoKey){
|
||||
this.dialogKey = Math.random()
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
hide() {
|
||||
|
||||
@@ -49,16 +49,16 @@ export default {
|
||||
this.tableOptions.cols.push({
|
||||
type: 'dynamic',
|
||||
field: col.field,
|
||||
title: col.title
|
||||
label: col.label
|
||||
})
|
||||
}
|
||||
this.tableOptions.cols.push({
|
||||
title: '操作',
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 85,
|
||||
fixed: 'right',
|
||||
btns: [{
|
||||
title: '删除',
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
click: (row, index) => {
|
||||
this.tableOptions.data.splice(index, 1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-input v-model="modelValue" :type="type" :value="value" :placeholder="placeholder || (label && '请输入' + label)" v-bind="props.props" />
|
||||
<el-input v-model="modelValue" :type="type" :placeholder="placeholder || (label && '请输入' + label)" v-bind="props.props" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -9,7 +9,6 @@
|
||||
modelValue: String,
|
||||
label: String,
|
||||
placeholder: String,
|
||||
value: String,
|
||||
type: String,
|
||||
props: Object
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-table-column
|
||||
:key="col.field"
|
||||
:label="col.title"
|
||||
:label="col.label"
|
||||
:prop="col.field"
|
||||
:align="col.align || 'center'"
|
||||
:width="col.width"
|
||||
@@ -23,8 +23,8 @@
|
||||
/>
|
||||
<div v-else-if="col.type == 'btns'">
|
||||
<template v-for="btn in col.btns">
|
||||
<el-button v-if="btn.if === undefined ? true : btn.if(scope.row)" :icon="btn.icon" :key="btn.title" v-permission="btn.permission" :type="btn.type" :size="btn.size || 'small'" :class="btn.class" @click="btn.click(scope.row, scope.$index)">
|
||||
{{ btn.title }}
|
||||
<el-button v-if="btn.if === undefined ? true : btn.if(scope.row)" :icon="btn.icon" :key="btn.label" v-permission="btn.permission" :type="btn.type" :size="btn.size || 'small'" :class="btn.class" @click="btn.click(scope.row, scope.$index)">
|
||||
{{ btn.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from "vue";
|
||||
import { ref, getCurrentInstance, watch } from "vue"
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@@ -20,6 +21,10 @@
|
||||
props: Object
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, (value) => {
|
||||
emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
const options = ref([])
|
||||
|
||||
proxy.$get(props.url).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user