mirror of https://github.com/jeecgboot/jeecg-boot
【issues/3656】popupdict回显
parent
61a8904e52
commit
f332758179
|
@ -12,6 +12,8 @@
|
|||
@register="regModal"
|
||||
:code="code"
|
||||
:multi="multi"
|
||||
:selected="selected"
|
||||
:rowkey="valueFiled"
|
||||
:sorter="sorter"
|
||||
:groupId="''"
|
||||
:param="param"
|
||||
|
@ -72,6 +74,7 @@
|
|||
const code = props.dictCode.split(',')[0];
|
||||
const labelFiled = props.dictCode.split(',')[1];
|
||||
const valueFiled = props.dictCode.split(',')[2];
|
||||
const selected = ref([]);
|
||||
if (!code || !valueFiled || !labelFiled) {
|
||||
createMessage.error('popupDict参数未正确配置!');
|
||||
}
|
||||
|
@ -159,6 +162,7 @@
|
|||
options.value = data.records.map((item) => {
|
||||
return { value: item[valueFiled], text: item[labelFiled] };
|
||||
});
|
||||
selected.value = data.records;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -200,6 +204,8 @@
|
|||
code,
|
||||
options,
|
||||
loading,
|
||||
selected,
|
||||
valueFiled,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
:canResize="false"
|
||||
:bordered="true"
|
||||
:loading="loading"
|
||||
:rowKey="combineRowKey"
|
||||
:rowKey="rowkey ? rowkey : combineRowKey"
|
||||
:columns="columns"
|
||||
:showIndexColumn="false"
|
||||
:dataSource="dataSource"
|
||||
|
@ -90,7 +90,7 @@
|
|||
loading: true,
|
||||
}),
|
||||
},
|
||||
props: ['multi', 'code', 'sorter', 'groupId', 'param','showAdvancedButton', 'getFormValues'],
|
||||
props: ['multi', 'code', 'sorter', 'groupId', 'param','showAdvancedButton', 'getFormValues', 'selected', 'rowkey'],
|
||||
emits: ['ok', 'register'],
|
||||
setup(props, { emit }) {
|
||||
const { createMessage } = useMessage();
|
||||
|
@ -284,7 +284,15 @@
|
|||
createImgPreview({ imageList: imgList });
|
||||
}
|
||||
}
|
||||
|
||||
// update-begin--author:liaozhiyang---date:20250415--for:【issues/3656】popupdict回显
|
||||
watchEffect(() => {
|
||||
if (props.selected && props.rowkey) {
|
||||
const selected = props.multi ? props.selected : [props.selected];
|
||||
checkedKeys!.value = selected.map((item) => item[props.rowkey]);
|
||||
selectRows!.value = selected;
|
||||
}
|
||||
});
|
||||
// update-end--author:liaozhiyang---date:20250415--for:【issues/3656】popupdict回显
|
||||
return {
|
||||
attrs,
|
||||
register,
|
||||
|
|
|
@ -179,10 +179,16 @@ export function usePopBiz(ob, tableRef?) {
|
|||
*/
|
||||
function combineRowKey(record) {
|
||||
let res = record?.id || '';
|
||||
Object.keys(record).forEach((key) => {
|
||||
res = key == 'rowIndex' ? record[key] + res : res + record[key];
|
||||
});
|
||||
res = res.length > 50 ? res.substring(0, 50) : res;
|
||||
if (props?.rowkey) {
|
||||
// update-begin--author:liaozhiyang---date:20250415--for:【issues/3656】popupdict回显
|
||||
res = record[props.rowkey];
|
||||
// update-end--author:liaozhiyang---date:20250415--for:【issues/3656】popupdict回显
|
||||
} else {
|
||||
Object.keys(record).forEach((key) => {
|
||||
res = key == 'rowIndex' ? record[key] + res : res + record[key];
|
||||
});
|
||||
res = res.length > 50 ? res.substring(0, 50) : res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue