This commit is contained in:
@@ -20,6 +20,9 @@
|
|||||||
<img alt="" :src="previewImageUrl" width="100%" />
|
<img alt="" :src="previewImageUrl" width="100%" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item v-if="hasType" label="类型">
|
||||||
|
<el-input v-model.trim="type" placeholder="请输入类型" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="是否启用">
|
<el-form-item label="是否启用">
|
||||||
<el-switch v-model="isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
<el-switch v-model="isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -41,11 +44,16 @@
|
|||||||
type: Function,
|
type: Function,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
hasType: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
|
type: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
fileList: [],
|
fileList: [],
|
||||||
previewVisible: false,
|
previewVisible: false,
|
||||||
@@ -71,6 +79,7 @@
|
|||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.isEnabled = true
|
this.isEnabled = true
|
||||||
|
this.type = ''
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.fileList = []
|
this.fileList = []
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
@@ -102,13 +111,17 @@
|
|||||||
try {
|
try {
|
||||||
let successCount = 0
|
let successCount = 0
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
await this.doAdd({ imageUrl: url, isEnabled: this.isEnabled })
|
const data = { imageUrl: url, isEnabled: this.isEnabled }
|
||||||
|
if (this.hasType) {
|
||||||
|
data.type = this.type
|
||||||
|
}
|
||||||
|
await this.doAdd(data)
|
||||||
successCount++
|
successCount++
|
||||||
}
|
}
|
||||||
this.$baseMessage(`成功添加 ${successCount} 条数据`, 'success')
|
|
||||||
this.$emit('fetch-data')
|
this.$emit('fetch-data')
|
||||||
this.close()
|
this.close()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('批量添加失败:', error)
|
||||||
this.$baseMessage('部分或全部添加失败', 'error')
|
this.$baseMessage('部分或全部添加失败', 'error')
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="类型" prop="type">
|
||||||
|
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="挂饰图片" prop="imageUrl">
|
<el-form-item label="挂饰图片" prop="imageUrl">
|
||||||
<single-upload
|
<single-upload
|
||||||
v-model="form.imageUrl"
|
v-model="form.imageUrl"
|
||||||
@@ -33,6 +36,7 @@
|
|||||||
id: '',
|
id: '',
|
||||||
form: {
|
form: {
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
type: '',
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
@@ -60,6 +64,7 @@
|
|||||||
this.title = '编辑'
|
this.title = '编辑'
|
||||||
this.form = {
|
this.form = {
|
||||||
imageUrl: row.imageUrl,
|
imageUrl: row.imageUrl,
|
||||||
|
type: row.type,
|
||||||
isEnabled: row.isEnabled,
|
isEnabled: row.isEnabled,
|
||||||
}
|
}
|
||||||
this.id = row.id
|
this.id = row.id
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||||
|
|
||||||
<el-table-column align="center" label="挂饰" width="100">
|
<el-table-column align="center" label="挂饰" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
/>
|
/>
|
||||||
<edit ref="edit" @fetch-data="fetchData" />
|
<edit ref="edit" @fetch-data="fetchData" />
|
||||||
<batch-image-add ref="batchAdd" :do-add="doAdd" @fetch-data="fetchData" />
|
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||||
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
|
||||||
|
<el-form-item label="类型" prop="type">
|
||||||
|
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="头像框" prop="imageUrl">
|
<el-form-item label="头像框" prop="imageUrl">
|
||||||
<single-upload
|
<single-upload
|
||||||
v-model="form.imageUrl"
|
v-model="form.imageUrl"
|
||||||
@@ -33,6 +36,7 @@
|
|||||||
id: '',
|
id: '',
|
||||||
form: {
|
form: {
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
type: '',
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
@@ -60,6 +64,7 @@
|
|||||||
this.title = '编辑'
|
this.title = '编辑'
|
||||||
this.form = {
|
this.form = {
|
||||||
imageUrl: row.imageUrl,
|
imageUrl: row.imageUrl,
|
||||||
|
type: row.type,
|
||||||
isEnabled: row.isEnabled,
|
isEnabled: row.isEnabled,
|
||||||
}
|
}
|
||||||
this.id = row.id
|
this.id = row.id
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||||
|
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||||
|
|
||||||
<el-table-column align="center" label="头像框" width="100">
|
<el-table-column align="center" label="头像框" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
/>
|
/>
|
||||||
<edit ref="edit" @fetch-data="fetchData" />
|
<edit ref="edit" @fetch-data="fetchData" />
|
||||||
<batch-image-add ref="batchAdd" :do-add="doAdd" @fetch-data="fetchData" />
|
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
@upload-success="handleUploadSuccess"
|
@upload-success="handleUploadSuccess"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="类型" prop="type">
|
||||||
|
<el-input v-model.trim="form.type" placeholder="请输入类型" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="是否启用" prop="isEnabled">
|
<el-form-item label="是否启用" prop="isEnabled">
|
||||||
<el-switch v-model="form.isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
<el-switch v-model="form.isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -33,6 +36,7 @@
|
|||||||
id: '',
|
id: '',
|
||||||
form: {
|
form: {
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
type: '',
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
@@ -60,6 +64,7 @@
|
|||||||
this.title = '编辑'
|
this.title = '编辑'
|
||||||
this.form = {
|
this.form = {
|
||||||
imageUrl: row.imageUrl,
|
imageUrl: row.imageUrl,
|
||||||
|
type: row.type,
|
||||||
isEnabled: row.isEnabled,
|
isEnabled: row.isEnabled,
|
||||||
}
|
}
|
||||||
this.id = row.id
|
this.id = row.id
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
|
||||||
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
<el-table-column align="center" label="排序" prop="sort" show-overflow-tooltip />
|
||||||
|
|
||||||
|
<el-table-column align="center" label="类型" prop="type" show-overflow-tooltip />
|
||||||
<el-table-column align="center" label="头像" width="100">
|
<el-table-column align="center" label="头像" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
/>
|
/>
|
||||||
<edit ref="edit" @fetch-data="fetchData" />
|
<edit ref="edit" @fetch-data="fetchData" />
|
||||||
<batch-image-add ref="batchAdd" :do-add="doAdd" @fetch-data="fetchData" />
|
<batch-image-add ref="batchAdd" :do-add="doAdd" has-type @fetch-data="fetchData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user