代码生成、优化

This commit is contained in:
吕金泽
2022-03-27 22:44:48 +08:00
parent 43976afbee
commit 178e024cf8
115 changed files with 1140 additions and 302 deletions
@@ -44,7 +44,7 @@
})
function reload(){
tableRef.value.reloadList()
tableRef.value.reload()
}
function selectionChange(columns) {
@@ -1,6 +1,6 @@
<template>
<div>
<el-row style="margin-bottom: 6px">
<el-row style="margin-bottom: 6px" v-if="toolbar">
<el-button type="primary" @click="addRow">添加一行</el-button>
</el-row>
<mb-table ref="magicTable" v-bind="tableOptions">
@@ -22,7 +22,7 @@
<script setup>
import { reactive, ref, watch } from 'vue'
import { reactive, ref, watch, nextTick } from 'vue'
const emit = defineEmits(['update:modelValue', 'change'])
@@ -47,6 +47,10 @@ const props = defineProps({
page: {
type: Boolean,
default: false
},
toolbar: {
type: Boolean,
default: true
}
})
@@ -90,7 +94,6 @@ watch(() => props.modelValue, (value) => {
function addRow(){
tableOptions.data.push({})
magicTable.value.reloadList()
}
function dataChange() {
@@ -145,14 +145,14 @@ function sortChange(column) {
order = null
}
newWhere.orderBy = order
reloadList()
reload()
}
function selectionChange(columns) {
emit('selection-change', columns)
}
function reloadList() {
function reload() {
if (props.url) {
newWhere.current = 1
listCurrent.value = 1
@@ -207,7 +207,7 @@ function keyup(){
watch(() => props.data, () => {
listCurrent.value = 1
handlerData()
})
},{ deep: true })
watch(() => props.where,() => {
renderWhere()
@@ -225,7 +225,7 @@ onMounted(() => {
}
})
defineExpose({ reloadList })
defineExpose({ reload })
</script>
@@ -140,7 +140,7 @@ export default {
this.$delete('file/delete', { url: encodeURI(url) })
},
handlePreview(file) {
window.open(this.$global.filePrefix + file.response.data.url)
window.open(this.$global.baseApi + file.response.data.url)
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
@@ -13,8 +13,8 @@
:style="{ width: width.replace('px', '') + 'px', height: height.replace('px', '') + 'px' }"
>
<el-image
:src="$global.filePrefix + element"
:preview-src-list="[$global.filePrefix + element]"
:src="$global.baseApi + element"
:preview-src-list="[$global.baseApi + element]"
/>
<div class="tools">
<div class="shadow" @click="handleRemove(element)">
@@ -227,7 +227,7 @@ export default {
})
},
beforeCropper(url) {
this.cropperOption.img = this.$global.filePrefix + url
this.cropperOption.img = this.$global.baseApi + url
this.cropperOption.relativeImg = url
this.$refs.cropperDialog.show()
},