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