1374 lines
50 KiB
Vue
1374 lines
50 KiB
Vue
<script>
|
||
// 统一备份/快照面板,兼容云模块与财务模块的列表格式、磁盘来源及数量额度升级。
|
||
import "~/assets/styles/MfCloudBackupPanel.BTlEe-fy.css";
|
||
import { toDisplayString } from "vue";
|
||
import { onMounted } from "vue";
|
||
import { useId } from "vue";
|
||
import { onBeforeUnmount } from "vue";
|
||
import { watch } from "vue";
|
||
import { createBlock } from "vue";
|
||
import { ref } from "vue";
|
||
import { withCtx } from "vue";
|
||
import { createCommentVNode } from "vue";
|
||
import { computed } from "vue";
|
||
import { reactive } from "vue";
|
||
import { isRef } from "vue";
|
||
import { createElementBlock } from "vue";
|
||
import { Fragment } from "vue";
|
||
import { createElementVNode } from "vue";
|
||
import { createTextVNode } from "vue";
|
||
import { unref } from "vue";
|
||
import { defineComponent } from "vue";
|
||
import { createVNode } from "vue";
|
||
import { openBlock } from "vue";
|
||
import { useApi } from "~/lib/auth.js";
|
||
import dialog from "primevue/dialog";
|
||
import button from "primevue/button";
|
||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||
import message from "primevue/message";
|
||
import inputtext from "primevue/inputtext";
|
||
import { r as dict_r } from "~/lib/dict.js";
|
||
import datatable from "primevue/datatable";
|
||
import select from "primevue/select";
|
||
import column from "primevue/column";
|
||
import OperationNotice from "~/components/OperationNotice.vue";
|
||
import tag from "primevue/tag";
|
||
import { i as instance_data_i } from "~/lib/instance-data.js";
|
||
import { l as instance_data_l } from "~/lib/instance-data.js";
|
||
import { s as instance_data_s } from "~/lib/instance-data.js";
|
||
import { t as instance_data_t } from "~/lib/instance-data.js";
|
||
import { u as instance_data_u } from "~/lib/instance-data.js";
|
||
import { i as cloud_instance_management_i } from "~/lib/cloud-instance-management.js";
|
||
import { s as cloud_instance_management_s } from "~/lib/cloud-instance-management.js";
|
||
import { t as cloud_instance_management_t } from "~/lib/cloud-instance-management.js";
|
||
var Se = {
|
||
class: `bs-panel`,
|
||
},
|
||
Ce = {
|
||
key: 0,
|
||
class: `bs-guide`,
|
||
},
|
||
we = {
|
||
class: `bs-guide-title`,
|
||
},
|
||
Te = {
|
||
class: `bs-guide-desc`,
|
||
},
|
||
Ee = {
|
||
key: 1,
|
||
class: `bs-head`,
|
||
},
|
||
De = {
|
||
class: `bs-title`,
|
||
},
|
||
Oe = {
|
||
key: 0,
|
||
class: `bs-count`,
|
||
},
|
||
ke = {
|
||
key: 4,
|
||
class: `bs-guide-desc`,
|
||
},
|
||
Ae = {
|
||
class: `bs-empty`,
|
||
},
|
||
je = {
|
||
class: `bs-actions`,
|
||
},
|
||
Me = {
|
||
class: `dlg-body`,
|
||
},
|
||
Ne = {
|
||
class: `form-row`,
|
||
},
|
||
Pe = [`for`],
|
||
Fe = {
|
||
class: `form-row`,
|
||
},
|
||
Ie = [`id`],
|
||
Le = {
|
||
class: `confirm-text`,
|
||
},
|
||
Re = {
|
||
class: `confirm-text`,
|
||
},
|
||
ze = {
|
||
class: `dlg-body`,
|
||
},
|
||
Be = {
|
||
class: `guide-text`,
|
||
},
|
||
Ve = {
|
||
class: `form-row`,
|
||
},
|
||
He = [`for`],
|
||
Ue = {
|
||
class: `quote`,
|
||
},
|
||
We = {
|
||
class: `quote-value`,
|
||
},
|
||
Ge = {
|
||
key: 0,
|
||
class: `pi pi-spin pi-spinner`,
|
||
},
|
||
v = Object.assign(
|
||
_plugin_vue_export_helper_t(
|
||
defineComponent({
|
||
__name: `MfCloudBackupPanel`,
|
||
props: {
|
||
hostId: {},
|
||
productId: {},
|
||
kind: {},
|
||
limit: {},
|
||
backupMode: {},
|
||
module: {
|
||
default: `mf_cloud`,
|
||
},
|
||
upgradeAllowed: {
|
||
type: Boolean,
|
||
default: !0,
|
||
},
|
||
},
|
||
emits: [`pay`],
|
||
setup(m, { emit: oe }) {
|
||
let v = m,
|
||
Ke = oe,
|
||
y = useApi(),
|
||
b = computed(() => cloud_instance_management_i(v.module)),
|
||
x = useId(),
|
||
S = computed(() => v.kind === `backup`),
|
||
C = computed(() => (S.value ? `备份` : `快照`)),
|
||
w = computed(() => S.value && v.backupMode === `space`),
|
||
qe = computed(() => (S.value ? `backup` : `snap`)),
|
||
Je = computed(() =>
|
||
S.value
|
||
? `备份会创建指定硬盘数据的完整副本,适用于长期存档和灾难恢复,建议在服务器关闭状态下进行以保证数据一致性。`
|
||
: `快照能迅速保存云服务器的当前硬盘数据,适用于快速恢复,即使服务器活跃也能执行。`,
|
||
),
|
||
T = ref([]),
|
||
E = ref(!1),
|
||
D = ref(!1),
|
||
Ye = ref(!1),
|
||
O = ref(!1),
|
||
k = ref(``),
|
||
A = ref(``),
|
||
j = ref(``),
|
||
M = ref([]),
|
||
N = ref(!1),
|
||
P = reactive({
|
||
name: ``,
|
||
disk_id: null,
|
||
}),
|
||
F = ref(null),
|
||
I = ref(null),
|
||
Xe = ref(null),
|
||
L = ref(null),
|
||
R = computed(() => `/${v.module}/${v.hostId}/${v.kind}`),
|
||
z = computed(() =>
|
||
v.module === `remf_finance`
|
||
? Xe.value !== !1
|
||
: !b.value || !!v.limit || w.value,
|
||
),
|
||
Ze = computed(() =>
|
||
v.module === `remf_finance`
|
||
? L.value !== null && L.value >= 0 && T.value.length >= L.value
|
||
: b.value && (!v.limit || T.value.length >= v.limit),
|
||
),
|
||
Qe = computed(
|
||
() =>
|
||
w.value ||
|
||
E.value ||
|
||
Ye.value ||
|
||
O.value ||
|
||
!z.value ||
|
||
Ze.value ||
|
||
(v.module === `remf_finance` && !D.value),
|
||
),
|
||
$e = computed(() =>
|
||
v.module === `remf_finance` && L.value !== null
|
||
? `${T.value.length}/${L.value === -1 ? `不限` : L.value}`
|
||
: b.value && v.limit
|
||
? `${T.value.length}/${v.limit}`
|
||
: T.value.length
|
||
? String(T.value.length)
|
||
: ``,
|
||
),
|
||
B = 0,
|
||
V = 0,
|
||
et = null,
|
||
H = !1,
|
||
U = 0;
|
||
function tt() {
|
||
et &&= (clearTimeout(et), null);
|
||
}
|
||
// 列表中仍有未完成任务时每两秒复查;卸载时停止调度并使请求失效。
|
||
function nt() {
|
||
(tt(),
|
||
!H &&
|
||
T.value.some((e) => e.status !== 1) &&
|
||
(et = setTimeout(() => {
|
||
((et = null), H || W());
|
||
}, 2e3)));
|
||
}
|
||
function rt(e) {
|
||
M.value = instance_data_t(e).map((e) => ({
|
||
id: Number(e.ident),
|
||
name: `${e.name} (${e.size} GB)`,
|
||
size: e.size,
|
||
}));
|
||
}
|
||
// 规范化历史字段及任务状态;财务模块需另读支持标记、额度和可选磁盘。
|
||
function it(e) {
|
||
let t = instance_data_l(e),
|
||
n = [`list`, v.kind, `${v.kind}s`].find((e) =>
|
||
Object.prototype.hasOwnProperty.call(t, e),
|
||
),
|
||
r = n ? t[n] : void 0;
|
||
if (typeof r == `string`)
|
||
try {
|
||
r = JSON.parse(r);
|
||
} catch {
|
||
r = void 0;
|
||
}
|
||
let i = instance_data_i(
|
||
v.module === `remf_finance`
|
||
? r
|
||
: (t.list ?? t[v.kind] ?? t[`${v.kind}s`]),
|
||
);
|
||
if (v.module === `remf_finance`) {
|
||
if (r !== null && !Array.isArray(r))
|
||
throw Error(`上游未返回有效的${C.value}列表,请稍后重试`);
|
||
i.some((e) => e.type === `snap` || e.type === `backup`) &&
|
||
(i = i.filter((e) => e.type === qe.value));
|
||
let n = t[S.value ? `support_backup` : `support_snap`];
|
||
Xe.value = [!0, 1, `1`, `true`].includes(n)
|
||
? !0
|
||
: ![!1, 0, `0`, `false`].includes(n) && null;
|
||
let a = instance_data_s(t[S.value ? `backup_num` : `snap_num`]);
|
||
((L.value =
|
||
a !== null && Number.isInteger(a) && a >= -1 ? a : null),
|
||
rt(e));
|
||
}
|
||
((T.value = i.map((e) => ({
|
||
...e,
|
||
id: Number(e.id ?? e[`${v.kind}_id`]),
|
||
name: String(e.name ?? e[`${v.kind}_name`] ?? e.notes ?? `—`),
|
||
create_time:
|
||
instance_data_u(e.create_time ?? e.created_at ?? e.time) ?? ``,
|
||
status: [
|
||
`1`,
|
||
`success`,
|
||
`completed`,
|
||
`available`,
|
||
`active`,
|
||
].includes(String(e.status).toLowerCase())
|
||
? 1
|
||
: Number(e.status) || 0,
|
||
notes: String(e.notes || e.remarks || e.description || ``),
|
||
}))),
|
||
(D.value = !0),
|
||
nt());
|
||
}
|
||
async function W() {
|
||
let e = ++B;
|
||
((E.value = !0), (k.value = ``));
|
||
try {
|
||
if (b.value && !z.value) {
|
||
((T.value = []), (D.value = !0));
|
||
return;
|
||
}
|
||
let t = await y.get(R.value);
|
||
if (e !== B) return;
|
||
it(t);
|
||
} catch (t) {
|
||
if (e !== B) return;
|
||
((T.value = []),
|
||
(D.value = !1),
|
||
(k.value = t instanceof Error ? t.message : `加载失败`));
|
||
} finally {
|
||
e === B && (E.value = !1);
|
||
}
|
||
}
|
||
// 按当前额度限制创建入口并加载磁盘;财务模块额外回读额度,实例切换会清空磁盘选项。
|
||
async function at() {
|
||
if (Qe.value) return;
|
||
let e = ++V,
|
||
t = R.value;
|
||
((Ye.value = !0),
|
||
Object.assign(P, {
|
||
name: ``,
|
||
disk_id: null,
|
||
}),
|
||
(k.value = ``));
|
||
try {
|
||
if (b.value) {
|
||
let t = await y.get(`/${v.module}/${v.hostId}/disk`);
|
||
if (e !== V) return;
|
||
M.value = t.list ?? [];
|
||
} else {
|
||
let n = await y.get(t);
|
||
if (e !== V || (it(n), !z.value || Ze.value)) return;
|
||
if (!M.value.length) {
|
||
let t = await y.get(
|
||
`/${v.module}/${v.hostId}/${S.value ? `snapshot` : `backup`}`,
|
||
);
|
||
if (e !== V) return;
|
||
rt(t);
|
||
}
|
||
}
|
||
if (!M.value.length)
|
||
throw Error(
|
||
`当前没有可创建` +
|
||
C.value +
|
||
`的磁盘,请刷新实例硬盘信息后重试`,
|
||
);
|
||
((P.disk_id = M.value[0]?.id ?? null), (N.value = !0));
|
||
} catch (t) {
|
||
if (e !== V) return;
|
||
k.value = t instanceof Error ? t.message : `加载磁盘列表失败`;
|
||
} finally {
|
||
e === V && (Ye.value = !1);
|
||
}
|
||
}
|
||
// 创建接口只代表任务已提交,随后刷新列表跟踪状态,不直接宣称备份已完成。
|
||
async function ot() {
|
||
if (!O.value) {
|
||
if (!P.name.trim()) {
|
||
k.value = `请输入${C.value}名称`;
|
||
return;
|
||
}
|
||
if (!P.disk_id) {
|
||
k.value = `请选择磁盘`;
|
||
return;
|
||
}
|
||
if (!M.value.some((e) => e.id === P.disk_id)) {
|
||
k.value = `所选磁盘已不可用,请重新选择`;
|
||
return;
|
||
}
|
||
((O.value = !0), (k.value = ``), (A.value = ``), (j.value = ``));
|
||
try {
|
||
(await y.post(R.value, {
|
||
id: v.hostId,
|
||
name: P.name.trim(),
|
||
disk_id: P.disk_id,
|
||
}),
|
||
(N.value = !1),
|
||
(j.value = `${C.value}创建任务已提交,创建期间请勿重复操作`),
|
||
setTimeout(() => (j.value = ``), 4e3),
|
||
await W());
|
||
} catch (e) {
|
||
A.value = e instanceof Error ? e.message : `创建失败`;
|
||
} finally {
|
||
O.value = !1;
|
||
}
|
||
}
|
||
}
|
||
// 还原使用已确认的目标记录,并按 backup/snapshot 类型传递对应 ID 字段。
|
||
async function st() {
|
||
let e = F.value;
|
||
if (e) {
|
||
((O.value = !0), (k.value = ``), (A.value = ``), (j.value = ``));
|
||
try {
|
||
(await y.post(`${R.value}/restore`, {
|
||
id: v.hostId,
|
||
[`${v.kind}_id`]: e.id,
|
||
}),
|
||
(j.value = `还原任务已提交`),
|
||
setTimeout(() => (j.value = ``), 4e3),
|
||
(F.value = null),
|
||
await W());
|
||
} catch (e) {
|
||
A.value = e instanceof Error ? e.message : `还原失败`;
|
||
} finally {
|
||
O.value = !1;
|
||
}
|
||
}
|
||
}
|
||
async function ct() {
|
||
let e = I.value;
|
||
if (e) {
|
||
((O.value = !0), (k.value = ``), (A.value = ``), (j.value = ``));
|
||
try {
|
||
(await y.del(`${R.value}/${e.id}`),
|
||
(I.value = null),
|
||
await W());
|
||
} catch (e) {
|
||
A.value = e instanceof Error ? e.message : `删除失败`;
|
||
} finally {
|
||
O.value = !1;
|
||
}
|
||
}
|
||
}
|
||
(watch(
|
||
() => [v.hostId, v.module, v.kind],
|
||
() => {
|
||
(V++,
|
||
(Ye.value = !1),
|
||
(D.value = !1),
|
||
(T.value = []),
|
||
(M.value = []),
|
||
(Xe.value = null),
|
||
(L.value = null),
|
||
(N.value = !1),
|
||
W());
|
||
},
|
||
{
|
||
flush: `sync`,
|
||
},
|
||
),
|
||
onBeforeUnmount(() => {
|
||
((H = !0), tt(), B++, V++, U++, X++);
|
||
}),
|
||
onMounted(W));
|
||
let G = ref(!1),
|
||
K = ref(!1),
|
||
q = ref(``),
|
||
J = ref(1),
|
||
Y = ref(``),
|
||
lt = ref(!1),
|
||
ut = ref(``),
|
||
dt = ref([]),
|
||
ft = ref(!1),
|
||
pt = ref(``),
|
||
X = 0,
|
||
mt = 0,
|
||
Z = computed(() =>
|
||
dt.value
|
||
.filter(
|
||
(e) => e >= T.value.length && e !== Number(v.limit || 0),
|
||
)
|
||
.map((e) => ({
|
||
value: e,
|
||
label: `${e} 个`,
|
||
})),
|
||
),
|
||
Q = computed(
|
||
() =>
|
||
b.value &&
|
||
!w.value &&
|
||
v.upgradeAllowed !== !1 &&
|
||
D.value &&
|
||
!E.value &&
|
||
!k.value &&
|
||
!ft.value &&
|
||
!pt.value &&
|
||
Z.value.length > 0,
|
||
),
|
||
$ = computed(() =>
|
||
JSON.stringify([
|
||
v.hostId,
|
||
v.module,
|
||
v.kind,
|
||
v.limit,
|
||
v.upgradeAllowed,
|
||
v.backupMode,
|
||
G.value,
|
||
J.value,
|
||
T.value.length,
|
||
]),
|
||
),
|
||
ht = computed(
|
||
() =>
|
||
Q.value &&
|
||
G.value &&
|
||
!!ut.value &&
|
||
ut.value === $.value &&
|
||
!lt.value &&
|
||
!K.value &&
|
||
Z.value.some((e) => e.value === J.value),
|
||
);
|
||
function gt() {
|
||
(U++, (ut.value = ``), (Y.value = ``), (lt.value = !1));
|
||
}
|
||
watch($, gt, {
|
||
flush: `sync`,
|
||
});
|
||
// 额度升级规格来自商品订单页;空间计费或禁止升级时不提供数量升级入口。
|
||
async function _t() {
|
||
let e = ++X;
|
||
if (
|
||
((dt.value = []),
|
||
(pt.value = ``),
|
||
b.value && v.productId && !w.value && v.upgradeAllowed !== !1)
|
||
) {
|
||
ft.value = !0;
|
||
try {
|
||
let t = await y.get(
|
||
`/product/${v.productId}/${v.module}/order_page`,
|
||
{
|
||
scene: `custom`,
|
||
},
|
||
);
|
||
if (
|
||
H ||
|
||
e !== X ||
|
||
Number(
|
||
t.config?.[S.value ? `backup_enable` : `snap_enable`],
|
||
) !== 1
|
||
)
|
||
return;
|
||
let n = t[S.value ? `backup_config` : `snap_config`];
|
||
if (!Array.isArray(n)) throw Error(`额度规格未返回,请重试`);
|
||
dt.value = [
|
||
...new Set(
|
||
n
|
||
.map((e) => Number(e.num))
|
||
.filter((e) => Number.isInteger(e) && e >= 0),
|
||
),
|
||
].sort((e, t) => e - t);
|
||
} catch (t) {
|
||
!H &&
|
||
e === X &&
|
||
(pt.value =
|
||
t instanceof Error ? t.message : `额度规格加载失败`);
|
||
} finally {
|
||
!H && e === X && (ft.value = !1);
|
||
}
|
||
}
|
||
}
|
||
async function vt() {
|
||
!Q.value ||
|
||
K.value ||
|
||
O.value ||
|
||
((J.value =
|
||
Z.value.find((e) => e.value > Number(v.limit || 0))?.value ??
|
||
Z.value[0].value),
|
||
(q.value = ``),
|
||
(G.value = !0),
|
||
await yt());
|
||
}
|
||
// 报价绑定实例、类型、当前数量及目标额度,任一条件变化都会废弃旧报价。
|
||
async function yt() {
|
||
if (
|
||
(gt(),
|
||
!Q.value || !G.value || !Z.value.some((e) => e.value === J.value))
|
||
)
|
||
return;
|
||
let e = ++U,
|
||
t = $.value;
|
||
((lt.value = !0), (q.value = ``));
|
||
try {
|
||
let n = await y.get(`/${v.module}/${v.hostId}/backup_config`, {
|
||
type: qe.value,
|
||
num: J.value,
|
||
});
|
||
if (H || e !== U || t !== $.value) return;
|
||
((Y.value = cloud_instance_management_t(n.price)),
|
||
(ut.value = t));
|
||
} catch (t) {
|
||
!H &&
|
||
e === U &&
|
||
(q.value = t instanceof Error ? t.message : `询价失败`);
|
||
} finally {
|
||
!H && e === U && (lt.value = !1);
|
||
}
|
||
}
|
||
// 仅提交有效快照下的额度订单,校验订单 ID 后再交给父级支付流程。
|
||
async function bt() {
|
||
if (!ht.value || O.value || H) return;
|
||
let e = $.value,
|
||
t = Y.value,
|
||
n = ++mt;
|
||
((K.value = !0), (q.value = ``), (A.value = ``), (j.value = ``));
|
||
try {
|
||
let n = await y.post(
|
||
`/${v.module}/${v.hostId}/backup_config/order`,
|
||
{
|
||
type: qe.value,
|
||
num: J.value,
|
||
},
|
||
);
|
||
if (H || e !== $.value) return;
|
||
let r = cloud_instance_management_s(n.id);
|
||
((G.value = !1),
|
||
Ke(`pay`, {
|
||
order_id: r,
|
||
amount: t,
|
||
}));
|
||
} catch (t) {
|
||
!H &&
|
||
e === $.value &&
|
||
(q.value = t instanceof Error ? t.message : `下单失败`);
|
||
} finally {
|
||
!H && n === mt && (K.value = !1);
|
||
}
|
||
}
|
||
return (
|
||
watch(
|
||
() => [
|
||
v.hostId,
|
||
v.module,
|
||
v.kind,
|
||
v.productId,
|
||
v.upgradeAllowed,
|
||
v.backupMode,
|
||
],
|
||
() => {
|
||
(mt++, (G.value = !1), (K.value = !1), _t());
|
||
},
|
||
),
|
||
watch(
|
||
() => v.limit,
|
||
() => {
|
||
W();
|
||
},
|
||
),
|
||
onMounted(_t),
|
||
(t, n) => {
|
||
let r = OperationNotice,
|
||
i = button,
|
||
o = message,
|
||
l = column,
|
||
ee = tag,
|
||
re = datatable,
|
||
oe = inputtext,
|
||
he = select,
|
||
_ = dialog;
|
||
return (
|
||
openBlock(),
|
||
createElementBlock(`div`, Se, [
|
||
createVNode(
|
||
r,
|
||
{
|
||
message: unref(A),
|
||
severity: `error`,
|
||
},
|
||
null,
|
||
8,
|
||
[`message`],
|
||
),
|
||
!m.limit && !unref(w) && unref(b)
|
||
? (openBlock(),
|
||
createElementBlock(`div`, Ce, [
|
||
createElementVNode(
|
||
`h5`,
|
||
we,
|
||
toDisplayString(unref(C)),
|
||
1,
|
||
),
|
||
createElementVNode(
|
||
`p`,
|
||
Te,
|
||
toDisplayString(unref(Je)),
|
||
1,
|
||
),
|
||
m.upgradeAllowed === !1
|
||
? createCommentVNode(``, !0)
|
||
: (openBlock(),
|
||
createBlock(
|
||
i,
|
||
{
|
||
key: 0,
|
||
label: `启用${unref(C)}服务`,
|
||
loading: unref(ft),
|
||
disabled: !unref(Q) || unref(K),
|
||
onClick: vt,
|
||
},
|
||
null,
|
||
8,
|
||
[`label`, `loading`, `disabled`],
|
||
)),
|
||
]))
|
||
: createCommentVNode(``, !0),
|
||
unref(z)
|
||
? (openBlock(),
|
||
createElementBlock(`div`, Ee, [
|
||
createElementVNode(`div`, De, [
|
||
createTextVNode(
|
||
toDisplayString(unref(C)) + `列表 `,
|
||
1,
|
||
),
|
||
unref($e)
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`span`,
|
||
Oe,
|
||
`(` + toDisplayString(unref($e)) + `)`,
|
||
1,
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
]),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `创建${unref(C)}`,
|
||
size: `small`,
|
||
icon: `pi pi-plus`,
|
||
disabled: unref(Qe),
|
||
onClick: at,
|
||
},
|
||
null,
|
||
8,
|
||
[`label`, `disabled`],
|
||
),
|
||
unref(b) && !unref(w)
|
||
? (openBlock(),
|
||
createBlock(
|
||
i,
|
||
{
|
||
key: 0,
|
||
label: `调整${unref(C)}额度`,
|
||
size: `small`,
|
||
severity: `secondary`,
|
||
outlined: ``,
|
||
disabled: !unref(Q) || unref(K) || unref(O),
|
||
onClick: vt,
|
||
},
|
||
null,
|
||
8,
|
||
[`label`, `disabled`],
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
]))
|
||
: createCommentVNode(``, !0),
|
||
unref(w)
|
||
? (openBlock(),
|
||
createBlock(
|
||
o,
|
||
{
|
||
key: 2,
|
||
severity: `warn`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
...(n[11] ||= [
|
||
createTextVNode(
|
||
` 当前实例为「按备份空间」计费模式,该模式需服务端安装备份空间插件后使用,本站暂不支持。 `,
|
||
-1,
|
||
),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
unref(pt)
|
||
? (openBlock(),
|
||
createBlock(
|
||
o,
|
||
{
|
||
key: 3,
|
||
severity: `error`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(toDisplayString(unref(pt)), 1),
|
||
createVNode(i, {
|
||
label: `重试额度规格`,
|
||
text: ``,
|
||
size: `small`,
|
||
onClick: _t,
|
||
}),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: unref(b) && !unref(w) && !unref(ft) && !unref(dt).length
|
||
? (openBlock(),
|
||
createElementBlock(
|
||
`p`,
|
||
ke,
|
||
`当前商品未开放` +
|
||
toDisplayString(unref(C)) +
|
||
`额度调整。`,
|
||
1,
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
m.module === `remf_finance` && unref(Xe) === !1 && !unref(k)
|
||
? (openBlock(),
|
||
createBlock(
|
||
o,
|
||
{
|
||
key: 5,
|
||
severity: `info`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(
|
||
`当前实例不支持` +
|
||
toDisplayString(unref(C)) +
|
||
`。`,
|
||
1,
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
unref(k)
|
||
? (openBlock(),
|
||
createBlock(
|
||
o,
|
||
{
|
||
key: 6,
|
||
severity: `error`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(toDisplayString(unref(k)), 1),
|
||
createVNode(i, {
|
||
label: `重试`,
|
||
severity: `secondary`,
|
||
text: ``,
|
||
onClick: W,
|
||
}),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
createVNode(
|
||
r,
|
||
{
|
||
message: unref(j),
|
||
severity: `success`,
|
||
},
|
||
null,
|
||
8,
|
||
[`message`],
|
||
),
|
||
unref(z) && !unref(k)
|
||
? (openBlock(),
|
||
createBlock(
|
||
re,
|
||
{
|
||
key: 7,
|
||
value: unref(T),
|
||
loading: unref(E),
|
||
size: `small`,
|
||
stripedRows: ``,
|
||
scrollable: ``,
|
||
class: `info-table`,
|
||
},
|
||
{
|
||
empty: withCtx(() => [
|
||
createElementVNode(
|
||
`div`,
|
||
Ae,
|
||
`暂无` + toDisplayString(unref(C)),
|
||
1,
|
||
),
|
||
]),
|
||
default: withCtx(() => [
|
||
createVNode(
|
||
l,
|
||
{
|
||
field: `name`,
|
||
header: `${unref(C)}名称`,
|
||
style: {
|
||
"min-width": `180px`,
|
||
},
|
||
},
|
||
null,
|
||
8,
|
||
[`header`],
|
||
),
|
||
createVNode(
|
||
l,
|
||
{
|
||
header: `创建时间`,
|
||
style: {
|
||
"min-width": `170px`,
|
||
},
|
||
},
|
||
{
|
||
body: withCtx(({ data: n }) => [
|
||
createTextVNode(
|
||
toDisplayString(
|
||
n.create_time
|
||
? (`formatTime` in t
|
||
? t.formatTime
|
||
: unref(dict_r))(n.create_time)
|
||
: `—`,
|
||
),
|
||
1,
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
),
|
||
createVNode(
|
||
l,
|
||
{
|
||
field: `notes`,
|
||
header: `备注`,
|
||
style: {
|
||
"min-width": `200px`,
|
||
},
|
||
},
|
||
{
|
||
body: withCtx(({ data: t }) => [
|
||
createTextVNode(
|
||
toDisplayString(t.notes || `--`),
|
||
1,
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
),
|
||
createVNode(
|
||
l,
|
||
{
|
||
header: `状态`,
|
||
style: {
|
||
width: `110px`,
|
||
},
|
||
},
|
||
{
|
||
body: withCtx(({ data: e }) => [
|
||
createVNode(
|
||
ee,
|
||
{
|
||
value: e.status === 1 ? `可用` : `创建中`,
|
||
severity:
|
||
e.status === 1 ? `success` : `warn`,
|
||
},
|
||
null,
|
||
8,
|
||
[`value`, `severity`],
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
),
|
||
createVNode(
|
||
l,
|
||
{
|
||
header: `操作`,
|
||
style: {
|
||
width: `170px`,
|
||
},
|
||
},
|
||
{
|
||
body: withCtx(({ data: e }) => [
|
||
createElementVNode(`div`, je, [
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `还原`,
|
||
size: `small`,
|
||
text: ``,
|
||
disabled: e.status !== 1 || unref(O),
|
||
onClick: (t) => (F.value = e),
|
||
},
|
||
null,
|
||
8,
|
||
[`disabled`, `onClick`],
|
||
),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `删除`,
|
||
size: `small`,
|
||
text: ``,
|
||
severity: `danger`,
|
||
disabled: e.status !== 1 || unref(O),
|
||
onClick: (t) => (I.value = e),
|
||
},
|
||
null,
|
||
8,
|
||
[`disabled`, `onClick`],
|
||
),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`value`, `loading`],
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
createVNode(
|
||
_,
|
||
{
|
||
visible: unref(N),
|
||
"onUpdate:visible": (n[3] ||= (e) =>
|
||
isRef(N) ? (N.value = e) : null),
|
||
header: `创建${unref(C)}`,
|
||
modal: ``,
|
||
style: {
|
||
width: `460px`,
|
||
},
|
||
draggable: !1,
|
||
},
|
||
{
|
||
footer: withCtx(() => [
|
||
createVNode(i, {
|
||
label: `取消`,
|
||
severity: `secondary`,
|
||
text: ``,
|
||
onClick: (n[2] ||= (e) => (N.value = !1)),
|
||
}),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `创建${unref(C)}`,
|
||
loading: unref(O),
|
||
onClick: ot,
|
||
},
|
||
null,
|
||
8,
|
||
[`label`, `loading`],
|
||
),
|
||
]),
|
||
default: withCtx(() => [
|
||
createElementVNode(`div`, Me, [
|
||
createElementVNode(`div`, Ne, [
|
||
createElementVNode(
|
||
`label`,
|
||
{
|
||
for: `${unref(x)}-name`,
|
||
},
|
||
toDisplayString(unref(C)) + `名称`,
|
||
9,
|
||
Pe,
|
||
),
|
||
createVNode(
|
||
oe,
|
||
{
|
||
id: `${unref(x)}-name`,
|
||
modelValue: unref(P).name,
|
||
"onUpdate:modelValue": (n[0] ||= (e) =>
|
||
(unref(P).name = e)),
|
||
class: `grow`,
|
||
maxlength: 50,
|
||
placeholder: `请输入名称`,
|
||
},
|
||
null,
|
||
8,
|
||
[`id`, `modelValue`],
|
||
),
|
||
]),
|
||
createElementVNode(`div`, Fe, [
|
||
createElementVNode(
|
||
`span`,
|
||
{
|
||
id: `${unref(x)}-disk-label`,
|
||
class: `form-label`,
|
||
},
|
||
`磁盘`,
|
||
8,
|
||
Ie,
|
||
),
|
||
createVNode(
|
||
he,
|
||
{
|
||
"input-id": `${unref(x)}-disk`,
|
||
"aria-labelledby": `${unref(x)}-disk-label`,
|
||
modelValue: unref(P).disk_id,
|
||
"onUpdate:modelValue": (n[1] ||= (e) =>
|
||
(unref(P).disk_id = e)),
|
||
options: unref(M),
|
||
optionLabel: `name`,
|
||
optionValue: `id`,
|
||
class: `grow`,
|
||
placeholder: `请选择磁盘`,
|
||
},
|
||
null,
|
||
8,
|
||
[
|
||
`input-id`,
|
||
`aria-labelledby`,
|
||
`modelValue`,
|
||
`options`,
|
||
],
|
||
),
|
||
]),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`visible`, `header`],
|
||
),
|
||
createVNode(
|
||
_,
|
||
{
|
||
visible: !!unref(F),
|
||
header: `还原${unref(C)}`,
|
||
modal: ``,
|
||
style: {
|
||
width: `420px`,
|
||
},
|
||
draggable: !1,
|
||
"onUpdate:visible": (n[5] ||= (e) => (F.value = null)),
|
||
},
|
||
{
|
||
footer: withCtx(() => [
|
||
createVNode(i, {
|
||
label: `取消`,
|
||
severity: `secondary`,
|
||
text: ``,
|
||
onClick: (n[4] ||= (e) => (F.value = null)),
|
||
}),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `确定还原`,
|
||
severity: `danger`,
|
||
loading: unref(O),
|
||
onClick: st,
|
||
},
|
||
null,
|
||
8,
|
||
[`loading`],
|
||
),
|
||
]),
|
||
default: withCtx(() => [
|
||
createElementVNode(`p`, Le, [
|
||
(n[12] ||= createTextVNode(
|
||
` 确定要将实例还原到 `,
|
||
-1,
|
||
)),
|
||
createElementVNode(
|
||
`strong`,
|
||
null,
|
||
toDisplayString(unref(F)?.name),
|
||
1,
|
||
),
|
||
(n[13] ||= createTextVNode(
|
||
` 吗?还原会覆盖当前数据且不可撤销。 `,
|
||
-1,
|
||
)),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`visible`, `header`],
|
||
),
|
||
createVNode(
|
||
_,
|
||
{
|
||
visible: !!unref(I),
|
||
header: `删除${unref(C)}`,
|
||
modal: ``,
|
||
style: {
|
||
width: `420px`,
|
||
},
|
||
draggable: !1,
|
||
"onUpdate:visible": (n[7] ||= (e) => (I.value = null)),
|
||
},
|
||
{
|
||
footer: withCtx(() => [
|
||
createVNode(i, {
|
||
label: `取消`,
|
||
severity: `secondary`,
|
||
text: ``,
|
||
onClick: (n[6] ||= (e) => (I.value = null)),
|
||
}),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `确定删除`,
|
||
severity: `danger`,
|
||
loading: unref(O),
|
||
onClick: ct,
|
||
},
|
||
null,
|
||
8,
|
||
[`loading`],
|
||
),
|
||
]),
|
||
default: withCtx(() => [
|
||
createElementVNode(`p`, Re, [
|
||
(n[14] ||= createTextVNode(` 确定要删除 `, -1)),
|
||
createElementVNode(
|
||
`strong`,
|
||
null,
|
||
toDisplayString(unref(I)?.name),
|
||
1,
|
||
),
|
||
(n[15] ||= createTextVNode(
|
||
` 吗?删除后不可恢复。 `,
|
||
-1,
|
||
)),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`visible`, `header`],
|
||
),
|
||
m.upgradeAllowed === !1
|
||
? createCommentVNode(``, !0)
|
||
: (openBlock(),
|
||
createBlock(
|
||
_,
|
||
{
|
||
key: 8,
|
||
visible: unref(G),
|
||
"onUpdate:visible": (n[10] ||= (e) =>
|
||
isRef(G) ? (G.value = e) : null),
|
||
header: `调整${unref(C)}额度`,
|
||
modal: ``,
|
||
style: {
|
||
width: `440px`,
|
||
},
|
||
draggable: !1,
|
||
closable: !unref(K),
|
||
"close-on-escape": !unref(K),
|
||
},
|
||
{
|
||
footer: withCtx(() => [
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `取消`,
|
||
severity: `secondary`,
|
||
text: ``,
|
||
disabled: unref(K),
|
||
onClick: (n[9] ||= (e) => (G.value = !1)),
|
||
},
|
||
null,
|
||
8,
|
||
[`disabled`],
|
||
),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `提交订单`,
|
||
loading: unref(K),
|
||
disabled: !unref(ht),
|
||
onClick: bt,
|
||
},
|
||
null,
|
||
8,
|
||
[`loading`, `disabled`],
|
||
),
|
||
]),
|
||
default: withCtx(() => [
|
||
createElementVNode(`div`, ze, [
|
||
createElementVNode(
|
||
`p`,
|
||
Be,
|
||
toDisplayString(unref(Je)),
|
||
1,
|
||
),
|
||
createElementVNode(`div`, Ve, [
|
||
createElementVNode(
|
||
`label`,
|
||
{
|
||
for: `${unref(x)}-count`,
|
||
},
|
||
toDisplayString(unref(C)) + `数量`,
|
||
9,
|
||
He,
|
||
),
|
||
createVNode(
|
||
he,
|
||
{
|
||
"input-id": `${unref(x)}-count`,
|
||
modelValue: unref(J),
|
||
"onUpdate:modelValue": [
|
||
(n[8] ||= (e) =>
|
||
isRef(J) ? (J.value = e) : null),
|
||
yt,
|
||
],
|
||
options: unref(Z),
|
||
"option-label": `label`,
|
||
"option-value": `value`,
|
||
disabled: unref(K),
|
||
},
|
||
null,
|
||
8,
|
||
[
|
||
`input-id`,
|
||
`modelValue`,
|
||
`options`,
|
||
`disabled`,
|
||
],
|
||
),
|
||
]),
|
||
createElementVNode(`div`, Ue, [
|
||
(n[16] ||= createElementVNode(
|
||
`span`,
|
||
null,
|
||
`应付金额`,
|
||
-1,
|
||
)),
|
||
createElementVNode(`span`, We, [
|
||
unref(lt)
|
||
? (openBlock(), createElementBlock(`i`, Ge))
|
||
: (openBlock(),
|
||
createElementBlock(
|
||
Fragment,
|
||
{
|
||
key: 1,
|
||
},
|
||
[
|
||
createTextVNode(
|
||
toDisplayString(
|
||
unref(Y) ? `¥${unref(Y)}` : `—`,
|
||
),
|
||
1,
|
||
),
|
||
],
|
||
64,
|
||
)),
|
||
]),
|
||
]),
|
||
unref(q)
|
||
? (openBlock(),
|
||
createBlock(
|
||
o,
|
||
{
|
||
key: 0,
|
||
severity: `error`,
|
||
closable: !1,
|
||
},
|
||
{
|
||
default: withCtx(() => [
|
||
createTextVNode(
|
||
toDisplayString(unref(q)),
|
||
1,
|
||
),
|
||
createVNode(
|
||
i,
|
||
{
|
||
label: `重新报价`,
|
||
text: ``,
|
||
size: `small`,
|
||
disabled: unref(K),
|
||
onClick: yt,
|
||
},
|
||
null,
|
||
8,
|
||
[`disabled`],
|
||
),
|
||
]),
|
||
_: 1,
|
||
},
|
||
))
|
||
: createCommentVNode(``, !0),
|
||
]),
|
||
]),
|
||
_: 1,
|
||
},
|
||
8,
|
||
[`visible`, `header`, `closable`, `close-on-escape`],
|
||
)),
|
||
])
|
||
);
|
||
}
|
||
);
|
||
},
|
||
}),
|
||
[[`__scopeId`, `data-v-a7ffe460`]],
|
||
),
|
||
{
|
||
__name: `MfCloudBackupPanel`,
|
||
},
|
||
);
|
||
export {};
|
||
export default v;
|
||
</script>
|