This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
<img alt="" :src="previewImageUrl" width="100%" />
|
||||
</el-dialog>
|
||||
</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-switch v-model="isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
@@ -41,11 +44,16 @@
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
hasType: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
isEnabled: true,
|
||||
type: '',
|
||||
loading: false,
|
||||
fileList: [],
|
||||
previewVisible: false,
|
||||
@@ -71,6 +79,7 @@
|
||||
},
|
||||
close() {
|
||||
this.isEnabled = true
|
||||
this.type = ''
|
||||
this.loading = false
|
||||
this.fileList = []
|
||||
this.dialogVisible = false
|
||||
@@ -102,13 +111,17 @@
|
||||
try {
|
||||
let successCount = 0
|
||||
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++
|
||||
}
|
||||
this.$baseMessage(`成功添加 ${successCount} 条数据`, 'success')
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
} catch (error) {
|
||||
console.error('批量添加失败:', error)
|
||||
this.$baseMessage('部分或全部添加失败', 'error')
|
||||
} finally {
|
||||
this.loading = false
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||
<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">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
@@ -33,6 +36,7 @@
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
@@ -60,6 +64,7 @@
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<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="type" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="挂饰" width="100">
|
||||
<template slot-scope="scope">
|
||||
@@ -55,7 +56,7 @@
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
|
||||
<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">
|
||||
<single-upload
|
||||
v-model="form.imageUrl"
|
||||
@@ -33,6 +36,7 @@
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
@@ -60,6 +64,7 @@
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<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="type" show-overflow-tooltip />
|
||||
|
||||
<el-table-column align="center" label="头像框" width="100">
|
||||
<template slot-scope="scope">
|
||||
@@ -55,7 +56,7 @@
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
@upload-success="handleUploadSuccess"
|
||||
/>
|
||||
</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-switch v-model="form.isEnabled" active-text="启用" :active-value="true" inactive-text="禁用" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
@@ -33,6 +36,7 @@
|
||||
id: '',
|
||||
form: {
|
||||
imageUrl: '',
|
||||
type: '',
|
||||
isEnabled: true,
|
||||
},
|
||||
rules: {
|
||||
@@ -60,6 +64,7 @@
|
||||
this.title = '编辑'
|
||||
this.form = {
|
||||
imageUrl: row.imageUrl,
|
||||
type: row.type,
|
||||
isEnabled: row.isEnabled,
|
||||
}
|
||||
this.id = row.id
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<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="type" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="头像" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip class="item" :content="scope.row.id" effect="dark" placement="top">
|
||||
@@ -55,7 +56,7 @@
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user