126 lines
4.0 KiB
Vue
126 lines
4.0 KiB
Vue
<script>
|
|
/** operations 通知组的统一展示层,最多显示三条,批量操作明细通过可展开区域呈现。 */
|
|
import "~/assets/styles/OperationToasts.DfA_b8om.css";
|
|
import { toDisplayString } from "vue";
|
|
import { renderList } from "vue";
|
|
import { normalizeClass } from "vue";
|
|
import { watch } from "vue";
|
|
import { createBlock } from "vue";
|
|
import { withCtx } from "vue";
|
|
import { createCommentVNode } from "vue";
|
|
import { createElementBlock } from "vue";
|
|
import { Fragment } from "vue";
|
|
import { createElementVNode } from "vue";
|
|
import { defineComponent } from "vue";
|
|
import { openBlock } from "vue";
|
|
import { useAuth } from "~/lib/auth.js";
|
|
import toast from "primevue/toast";
|
|
import { useToast } from "primevue/usetoast";
|
|
var h = {
|
|
class: `operation-toast-copy`,
|
|
},
|
|
g = {
|
|
key: 0,
|
|
class: `operation-toast-results`,
|
|
},
|
|
_ = Object.assign(
|
|
defineComponent({
|
|
__name: `OperationToasts`,
|
|
setup(u) {
|
|
let _ = useToast(),
|
|
v = useAuth();
|
|
watch(
|
|
// 账号改变即移除旧通知,避免下一位用户看到上一账号的操作结果。
|
|
() => v.token,
|
|
() => _.removeGroup(`operations`),
|
|
);
|
|
let y = {
|
|
success: `pi-check-circle`,
|
|
error: `pi-times-circle`,
|
|
warn: `pi-exclamation-triangle`,
|
|
info: `pi-info-circle`,
|
|
};
|
|
return (r, u) => {
|
|
let f = toast;
|
|
return (
|
|
openBlock(),
|
|
createBlock(
|
|
f,
|
|
{
|
|
group: `operations`,
|
|
position: `top-right`,
|
|
class: `operation-toasts`,
|
|
"base-z-index": 2e3,
|
|
limit: 3,
|
|
},
|
|
{
|
|
message: withCtx(({ message: r }) => [
|
|
createElementVNode(
|
|
`i`,
|
|
{
|
|
class: normalizeClass([
|
|
`pi operation-toast-icon`,
|
|
[y[r.severity || `info`], `notice-${r.severity}`],
|
|
]),
|
|
"aria-hidden": `true`,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
createElementVNode(`div`, h, [
|
|
createElementVNode(
|
|
`div`,
|
|
null,
|
|
toDisplayString(r.summary),
|
|
1,
|
|
),
|
|
r.detail?.length
|
|
? (openBlock(),
|
|
createElementBlock(`details`, g, [
|
|
(u[0] ||= createElementVNode(
|
|
`summary`,
|
|
null,
|
|
`查看处理结果`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`ul`, null, [
|
|
(openBlock(!0),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
renderList(
|
|
r.detail,
|
|
(t, n) => (
|
|
openBlock(),
|
|
createElementBlock(
|
|
`li`,
|
|
{
|
|
key: n,
|
|
},
|
|
toDisplayString(t),
|
|
1,
|
|
)
|
|
),
|
|
),
|
|
128,
|
|
)),
|
|
]),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
)
|
|
);
|
|
};
|
|
},
|
|
}),
|
|
{
|
|
__name: `OperationToasts`,
|
|
},
|
|
);
|
|
export {};
|
|
export default _;
|
|
</script>
|