服务指令、长者标签 调整图片显示

This commit is contained in:
1378012178@qq.com 2025-09-03 09:25:14 +08:00
parent ec1ad10bf4
commit 0a48ee233c
6 changed files with 99 additions and 38 deletions

View File

@ -29,7 +29,16 @@ export const columns: BasicColumn[] = [
title: '图标', title: '图标',
align: 'center', align: 'center',
dataIndex: 'pic', dataIndex: 'pic',
customRender: render.renderImage, customRender: ({ text, record }) => {
// 如果 text 为空或 null/undefined使用默认图片
const imageUrl = text
? text
: record.type == 'tx'
? import.meta.env.VITE_DEFAULT_ELDER_TAG_BODY_PIC
: import.meta.env.VITE_DEFAULT_ELDER_TAG_EMO_PIC;
return render.renderImage({ text: imageUrl });
},
// customRender: render.renderImage,
}, },
// { // {
// title: '排序', // title: '排序',

View File

@ -150,20 +150,28 @@ function edit(record) {
if (record.hasOwnProperty(key)) { if (record.hasOwnProperty(key)) {
tmpData[key] = record[key] tmpData[key] = record[key]
} }
}) //
// Object.assign(formData, tmpData);
Object.assign(formData, tmpData); if (props.opeType == 'dmlook') {
if (props.opeType == 'dmlook') { if (!!formData.pic) {
if (!!formData.pic) { dmlookVal.value = props.mediaApiAddress + formData.pic
dmlookVal.value = props.mediaApiAddress + formData.pic
} else {
if (formData.type == 'qx') {
dmlookVal.value = defaultEmoPic
} else { } else {
dmlookVal.value = defaultBodyPic if (formData.type == 'qx') {
dmlookVal.value = defaultEmoPic
} else {
dmlookVal.value = defaultBodyPic
}
}
} else {
if (!formData.pic) {
if (formData.type == 'qx') {
formData.pic = defaultEmoPic
} else {
formData.pic = defaultBodyPic
}
} }
} }
} })
}); });
} }
@ -201,6 +209,9 @@ async function submitForm() {
} }
} }
} }
if (model.pic == defaultBodyPic || model.pic == defaultEmoPic) {
model.pic = null
}
await saveOrUpdate(model, isUpdate.value) await saveOrUpdate(model, isUpdate.value)
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {

View File

@ -87,6 +87,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
useSearchForm: false, useSearchForm: false,
showIndexColumn: true, showIndexColumn: true,
scroll: { y: '58vh' }, scroll: { y: '58vh' },
immediate: false,
pagination: { pagination: {
current: 1, current: 1,
pageSize: 15, pageSize: 15,
@ -106,7 +107,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
params.excludeIds = excludeIds.value.join(',') params.excludeIds = excludeIds.value.join(',')
} }
params.izEnabled = '0' params.izEnabled = '0'
return Object.assign(params,queryParam) return Object.assign(params, queryParam)
}, },
}, },
}); });
@ -197,21 +198,22 @@ async function init() {
} }
let { ids } = getSelectedIds(); let { ids } = getSelectedIds();
let res = await idListByDS({ dataSourceCode: 'master' }); idListByDS({ dataSourceCode: 'master' }).then(res => {
// ID
let existingExcludeIds = res.records.map(item => item.id);
// ID // ids
let existingExcludeIds = res.records.map(item => item.id); if (ids) {
const idsToAdd = ids.split(',');
existingExcludeIds = [...existingExcludeIds, ...idsToAdd];
}
// ids // excludeIds.value
if (ids) { excludeIds.value = [...new Set(existingExcludeIds)];
const idsToAdd = ids.split(',');
existingExcludeIds = [...existingExcludeIds, ...idsToAdd];
}
// excludeIds.value reload();
excludeIds.value = [...new Set(existingExcludeIds)]; })
reload();
} }
/** /**

View File

@ -117,13 +117,23 @@ export const columns: BasicColumn[] = [
title: '服务指令图片大图', title: '服务指令图片大图',
align: 'center', align: 'center',
dataIndex: 'previewFile', dataIndex: 'previewFile',
customRender: render.renderImage, customRender: ({ text }) => {
// 如果 text 为空或 null/undefined使用默认图片
const imageUrl = text ? text : import.meta.env.VITE_DEFAULT_DIRECTIVE_PRE_PIC;
return render.renderImage({ text: imageUrl });
},
// customRender: render.renderImage,
}, },
{ {
title: '服务指令图片小图', title: '服务指令图片小图',
align: 'center', align: 'center',
dataIndex: 'previewFileSmall', dataIndex: 'previewFileSmall',
customRender: render.renderImage, customRender: ({ text }) => {
// 如果 text 为空或 null/undefined使用默认图片
const imageUrl = text ? text : import.meta.env.VITE_DEFAULT_DIRECTIVE_PRESMALL_PIC;
return render.renderImage({ text: imageUrl });
},
// customRender: render.renderImage,
}, },
{ {
title: '服务指令描述', title: '服务指令描述',
@ -147,7 +157,12 @@ export const columns: BasicColumn[] = [
title: '即时指令图标', title: '即时指令图标',
align: 'center', align: 'center',
dataIndex: 'immediateFile', dataIndex: 'immediateFile',
customRender: render.renderImage, customRender: ({ text }) => {
// 如果 text 为空或 null/undefined使用默认图片
const imageUrl = text ? text : import.meta.env.VITE_DEFAULT_DIRECTIVE_IM_PIC;
return render.renderImage({ text: imageUrl });
},
// customRender: render.renderImage,
}, },
]; ];

View File

@ -520,6 +520,17 @@ function edit(record, isEditMedia_ = false, showMedia_ = true, showExistTags = t
}) })
// //
Object.assign(formData, tmpData); Object.assign(formData, tmpData);
if (props.opeType != 'dmlook') {
if (!formData.previewFile) {
formData.previewFile = defaultPrePic
}
if (!formData.previewFileSmall) {
formData.previewFileSmall = defaultPreSmallPic
}
if (!formData.immediateFile) {
formData.immediateFile = defaultImmediatePic
}
}
}); });
} }
@ -571,6 +582,16 @@ async function submitForm() {
model.mediaFileSavePath = formComputedData.value.mediaFileSavePath model.mediaFileSavePath = formComputedData.value.mediaFileSavePath
if (model.previewFile == defaultPrePic) {
model.previewFile = null
}
if (model.previewFileSmall == defaultPreSmallPic) {
model.previewFileSmall = null
}
if (model.immediateFile == defaultImmediatePic) {
model.immediateFile = null
}
await saveOrUpdate(model, isUpdate.value) await saveOrUpdate(model, isUpdate.value)
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {

View File

@ -143,6 +143,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
useSearchForm: false, useSearchForm: false,
showIndexColumn: true, showIndexColumn: true,
scroll: { y: '58vh' }, scroll: { y: '58vh' },
immediate: false,
pagination: { pagination: {
current: 1, current: 1,
pageSize: 15, pageSize: 15,
@ -293,21 +294,23 @@ async function init() {
} }
let { ids } = getSelectedIds(); let { ids } = getSelectedIds();
let res = await idListByDS({ dataSourceCode: 'master' }); idListByDS({ dataSourceCode: 'master' }).then(res => {
// ID // ID
let existingExcludeIds = res.records.map(item => item.id); let existingExcludeIds = res.records.map(item => item.id);
// ids // ids
if (ids) { if (ids) {
const idsToAdd = ids.split(','); const idsToAdd = ids.split(',');
existingExcludeIds = [...existingExcludeIds, ...idsToAdd]; existingExcludeIds = [...existingExcludeIds, ...idsToAdd];
} }
// excludeIds.value // excludeIds.value
excludeIds.value = [...new Set(existingExcludeIds)]; excludeIds.value = [...new Set(existingExcludeIds)];
reload();
})
reload();
} }
/** /**