宣传物料管理页面调试完成

This commit is contained in:
BianLzhaoMin 2025-09-11 18:28:33 +08:00
parent 2b3e1ea66d
commit de3dcb59ef
4 changed files with 75 additions and 11 deletions

View File

@ -22,7 +22,7 @@ export function addProMaterialsAPI(data) {
// 编辑产品中心
export function editProductCenterAPI(data) {
return request_formdata({
url: '//material/edit',
url: '/material/edit',
method: 'POST',
data,
})

View File

@ -107,6 +107,10 @@ export default {
// }
// }
this.$emit('update:fileList', fileList)
if (file.id) {
this.$emit('onSelectDeleteFileId', file.id)
}
},
//
@ -195,6 +199,7 @@ export default {
// )
// return false
// }
//
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {

View File

@ -49,6 +49,7 @@
:file-type="[]"
:file-list.sync="addAndEditForm.file"
:is-uploaded="addAndEditForm.file.length >= 1"
@onSelectDeleteFileId="handleSelectDeleteFileId"
/>
</el-form-item>
</el-col>
@ -61,6 +62,7 @@
:file-type="['png', 'jpg', 'jpeg']"
:file-list.sync="addAndEditForm.cover"
:is-uploaded="addAndEditForm.cover.length >= 1"
@onSelectDeleteFileId="handleSelectDeleteFileId"
/>
</el-form-item>
</el-col>
@ -155,6 +157,7 @@ export default {
return {
currentTab: '1', // Tab
productList: [],
deleteFileId: [],
//
addAndEditForm: {
name: '', //
@ -208,7 +211,6 @@ export default {
handleCancel() {
//
this.$refs.addAndEditForm?.resetFields()
this.$emit('closeDialog', false)
},
//
@ -234,7 +236,10 @@ export default {
typeId, //
version, //
typeName, //
productName, //
productName: productName.substring(
0,
productName.length - 1,
), //
description,
productId: productId.join(','),
}
@ -255,19 +260,30 @@ export default {
}
})
if (this.formType === 2) {
params.id = this.detailsId
if (this.deleteFileId.length > 0) {
params.delIds = this.deleteFileId.join(',')
}
}
formData.append('fileMsg', JSON.stringify(fileMsg))
formData.append('params', JSON.stringify(params))
const res = await addProMaterialsAPI(formData)
const API =
this.formType === 2
? editProductCenterAPI
: addProMaterialsAPI
const res = await API(formData)
console.log(res, 'res')
if (res.code === 200) {
this.$message.success('保存成功')
this.$modal.msgSuccess(
this.formType === 2 ? '编辑成功' : '新增成功',
)
this.$emit('closeDialog', true)
}
// this.$message.success('')
// this.$emit('closeDialog', true)
} catch (error) {
//
// this.$message.error('')
@ -295,7 +311,8 @@ export default {
{
value.forEach((item) => {
this.addAndEditForm.productName +=
this.productList.find((j) => item == j.value).label
this.productList.find((j) => item == j.id).name +
','
})
}
}
@ -305,7 +322,49 @@ export default {
async getProductCenterDetail() {
const res = await getProductCenterDetailAPI(this.detailsId)
console.log(res, '宣传物料详情')
const {
name,
typeId,
files,
version,
typeName,
productIds,
description,
productName,
} = res.data
this.addAndEditForm = {
name,
typeId: typeId + '',
version,
typeName,
productId: productIds.map((e) => e * 1),
description,
productName,
file: files
.filter((e) => e.typeId === 1)
.map((item) => ({
id: item.id,
url: item.filePath,
name: item.originalName,
})),
cover: files
.filter((e) => e.typeId === 2)
.map((item) => ({
id: item.id,
url: item.filePath,
name: item.originalName,
})),
}
// this.addAndEditForm.productId.forEach((item) => {
// this.addAndEditForm.productName +=
// this.productList.find((j) => item == j.id).name + ','
// })
},
// ID
handleSelectDeleteFileId(id) {
this.deleteFileId.push(id)
},
},

View File

@ -199,7 +199,7 @@ export default {
label: '描述',
},
{
prop: 'createUser',
prop: 'createUserName',
label: '创建人',
},
{