1352 lines
54 KiB
Vue
1352 lines
54 KiB
Vue
<script>
|
|
import "~/assets/styles/InstanceDisks.Ca7NZxYd.css";
|
|
import { toDisplayString } from "vue";
|
|
import { onMounted } 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 { 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 { r as dict_r } from "~/lib/dict.js";
|
|
import datatable from "primevue/datatable";
|
|
import select from "primevue/select";
|
|
import inputnumber from "primevue/inputnumber";
|
|
import column from "primevue/column";
|
|
import OperationNotice from "~/components/OperationNotice.vue";
|
|
import tag from "primevue/tag";
|
|
import { i as cloud_instance_management_i } from "~/lib/cloud-instance-management.js";
|
|
import { o as cloud_instance_management_o } from "~/lib/cloud-instance-management.js";
|
|
import { r as cloud_instance_management_r } 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 ge = [`aria-busy`],
|
|
_e = {
|
|
class: `load-error`,
|
|
},
|
|
ve = {
|
|
key: 1,
|
|
role: `status`,
|
|
class: `empty`,
|
|
},
|
|
ye = {
|
|
key: 2,
|
|
role: `status`,
|
|
class: `grp-note`,
|
|
},
|
|
be = {
|
|
key: 3,
|
|
class: `grp`,
|
|
},
|
|
xe = {
|
|
class: `disk-name`,
|
|
},
|
|
Se = {
|
|
key: 4,
|
|
class: `grp`,
|
|
},
|
|
Ce = {
|
|
key: 2,
|
|
class: `grp-note`,
|
|
},
|
|
we = {
|
|
class: `disk-name`,
|
|
},
|
|
Te = {
|
|
class: `row-actions`,
|
|
},
|
|
Ee = {
|
|
key: 3,
|
|
class: `grp-note`,
|
|
},
|
|
De = {
|
|
class: `dlg`,
|
|
},
|
|
Oe = {
|
|
class: `resize-info`,
|
|
},
|
|
ke = {
|
|
class: `form-row`,
|
|
},
|
|
Ae = {
|
|
class: `quote`,
|
|
},
|
|
je = {
|
|
class: `quote-value`,
|
|
},
|
|
Me = {
|
|
key: 0,
|
|
class: `pi pi-spin pi-spinner`,
|
|
},
|
|
Ne = {
|
|
class: `dlg`,
|
|
},
|
|
Pe = {
|
|
class: `form-row`,
|
|
},
|
|
Fe = {
|
|
class: `form-row`,
|
|
},
|
|
Ie = {
|
|
class: `quote`,
|
|
},
|
|
Le = {
|
|
class: `quote-value`,
|
|
},
|
|
Re = {
|
|
key: 0,
|
|
class: `pi pi-spin pi-spinner`,
|
|
},
|
|
y = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `InstanceDisks`,
|
|
props: {
|
|
disks: {},
|
|
hostId: {},
|
|
productId: {},
|
|
module: {},
|
|
upgradeAllowed: {
|
|
type: Boolean,
|
|
default: !0,
|
|
},
|
|
loading: {
|
|
type: Boolean,
|
|
},
|
|
error: {},
|
|
loaded: {
|
|
type: Boolean,
|
|
},
|
|
},
|
|
emits: [`pay`, `refresh`],
|
|
setup(m, { emit: v }) {
|
|
let y = m,
|
|
b = v,
|
|
x = useApi(),
|
|
S = ref(``),
|
|
C = ref(``),
|
|
w = ref(!1),
|
|
T = computed(() => cloud_instance_management_i(y.module)),
|
|
ze = computed(() => y.disks.filter((e) => e.type2 === `system`)),
|
|
Be = computed(() => y.disks.filter((e) => e.type2 === `data`)),
|
|
Ve = computed(() => `/${y.module}/${y.hostId}`),
|
|
E = !1,
|
|
D = 0,
|
|
O = 0,
|
|
k = 0,
|
|
He = 0;
|
|
async function Ue(e) {
|
|
if (
|
|
E ||
|
|
w.value ||
|
|
!T.value ||
|
|
![0, 1].includes(e.status) ||
|
|
!y.disks.some((t) => t.ident === e.ident)
|
|
)
|
|
return;
|
|
let t = ++D,
|
|
n = Ve.value;
|
|
((w.value = !0), (S.value = ``), (C.value = ``));
|
|
try {
|
|
let r = e.status === 1 ? `unmount` : `mount`;
|
|
if ((await x.post(`${n}/disk/${e.ident}/${r}`), E || t !== D))
|
|
return;
|
|
((C.value = `${e.name} 已提交${r === `mount` ? `挂载` : `卸载`}`),
|
|
b(`refresh`));
|
|
} catch (e) {
|
|
!E &&
|
|
t === D &&
|
|
(S.value = e instanceof Error ? e.message : `操作失败`);
|
|
} finally {
|
|
!E && t === D && (w.value = !1);
|
|
}
|
|
}
|
|
let A = ref(!1),
|
|
j = ref(!1),
|
|
M = ref(``),
|
|
N = ref(null),
|
|
P = ref(0),
|
|
F = ref(``),
|
|
I = ref(!1),
|
|
L = ref(!1),
|
|
R = ref(!1),
|
|
z = ref(``),
|
|
B = ref(0),
|
|
V = ref(``),
|
|
H = ref(null),
|
|
U = ref([]),
|
|
W = ref(!1),
|
|
G = ref(``),
|
|
K = ref(null),
|
|
q = computed(() => U.value.find((e) => e.id === H.value)),
|
|
J = computed(
|
|
() =>
|
|
T.value &&
|
|
y.upgradeAllowed !== !1 &&
|
|
y.loaded &&
|
|
!y.loading &&
|
|
!y.error &&
|
|
!W.value &&
|
|
!G.value &&
|
|
U.value.length > 0 &&
|
|
(K.value === null || Be.value.length < K.value),
|
|
),
|
|
Y = computed(() =>
|
|
JSON.stringify([
|
|
y.hostId,
|
|
y.module,
|
|
y.upgradeAllowed,
|
|
y.disks,
|
|
A.value,
|
|
N.value?.ident,
|
|
P.value,
|
|
L.value,
|
|
H.value,
|
|
B.value,
|
|
]),
|
|
),
|
|
X = ref(``),
|
|
Z = computed(
|
|
() =>
|
|
!E &&
|
|
X.value !== `` &&
|
|
X.value === Y.value &&
|
|
!I.value &&
|
|
!R.value &&
|
|
!j.value &&
|
|
!w.value &&
|
|
y.upgradeAllowed !== !1 &&
|
|
!y.error &&
|
|
!y.loading,
|
|
);
|
|
function We() {
|
|
(k++,
|
|
(X.value = ``),
|
|
(F.value = ``),
|
|
(V.value = ``),
|
|
(I.value = !1));
|
|
}
|
|
watch(Y, We, {
|
|
flush: `sync`,
|
|
});
|
|
async function Ge() {
|
|
let e = ++O;
|
|
if (
|
|
((U.value = []),
|
|
(G.value = ``),
|
|
(K.value = null),
|
|
T.value && y.productId && y.upgradeAllowed !== !1)
|
|
) {
|
|
W.value = !0;
|
|
try {
|
|
let t = await x.get(
|
|
`/product/${y.productId}/${y.module}/order_page`,
|
|
{
|
|
scene: `custom`,
|
|
},
|
|
);
|
|
if (E || e !== O) return;
|
|
if (!Array.isArray(t.data_disk))
|
|
throw Error(`磁盘规格未返回,请重试`);
|
|
U.value = cloud_instance_management_r(t.data_disk, t.config);
|
|
let n = Number(t.config?.disk_limit_num);
|
|
t.config?.disk_limit_num != null &&
|
|
Number.isInteger(n) &&
|
|
n >= 0 &&
|
|
(K.value = n);
|
|
} catch (t) {
|
|
!E &&
|
|
e === O &&
|
|
(G.value =
|
|
t instanceof Error ? t.message : `加载磁盘规格失败`);
|
|
} finally {
|
|
!E && e === O && (W.value = !1);
|
|
}
|
|
}
|
|
}
|
|
function Ke() {
|
|
let e = N.value,
|
|
t = y.disks.find((t) => t.ident === e?.ident);
|
|
if (
|
|
!e ||
|
|
!t ||
|
|
t.type2 !== `data` ||
|
|
Number(t.raw.is_free) === 1 ||
|
|
![0, 1].includes(t.status)
|
|
)
|
|
throw Error(`当前磁盘不能扩容`);
|
|
if (!Number.isSafeInteger(P.value) || P.value <= t.size)
|
|
throw Error(`扩容容量必须大于当前容量`);
|
|
return {
|
|
resize_data_disk: [
|
|
{
|
|
id: Number(t.ident),
|
|
size: P.value,
|
|
disk_limit_id: Number(t.raw.disk_limit_id ?? 0),
|
|
},
|
|
],
|
|
};
|
|
}
|
|
function qe() {
|
|
let e = q.value;
|
|
if (
|
|
!J.value ||
|
|
!e ||
|
|
!cloud_instance_management_o(Number(B.value), e)
|
|
)
|
|
throw Error(`请选择可用的磁盘规格和容量`);
|
|
return {
|
|
add_disk: [
|
|
{
|
|
size: Number(B.value),
|
|
type: e.type,
|
|
},
|
|
],
|
|
};
|
|
}
|
|
async function Je(e) {
|
|
!T.value ||
|
|
y.upgradeAllowed === !1 ||
|
|
w.value ||
|
|
j.value ||
|
|
R.value ||
|
|
Number(e.raw.is_free) === 1 ||
|
|
![0, 1].includes(e.status) ||
|
|
((L.value = !1),
|
|
(N.value = e),
|
|
(P.value = e.size + 10),
|
|
(M.value = ``),
|
|
(A.value = !0),
|
|
await Q());
|
|
}
|
|
async function Ye() {
|
|
!J.value ||
|
|
w.value ||
|
|
R.value ||
|
|
j.value ||
|
|
((A.value = !1),
|
|
(H.value = U.value[0]?.id ?? null),
|
|
(B.value = q.value?.min ?? 0),
|
|
(z.value = ``),
|
|
(L.value = !0),
|
|
await $());
|
|
}
|
|
function Xe() {
|
|
((B.value = q.value?.min ?? 0), $());
|
|
}
|
|
async function Ze(e) {
|
|
if (
|
|
(We(),
|
|
!T.value ||
|
|
y.upgradeAllowed === !1 ||
|
|
E ||
|
|
!(e === `resize` ? A.value : L.value))
|
|
)
|
|
return;
|
|
let t = e === `resize` ? M : z;
|
|
t.value = ``;
|
|
let n;
|
|
try {
|
|
n = e === `resize` ? Ke() : qe();
|
|
} catch (e) {
|
|
t.value = e.message;
|
|
return;
|
|
}
|
|
let r = ++k,
|
|
i = Y.value;
|
|
I.value = !0;
|
|
try {
|
|
let t = await x.post(
|
|
`${Ve.value}/disk/${e === `resize` ? `resize` : `price`}`,
|
|
n,
|
|
);
|
|
if (E || r !== k || i !== Y.value) return;
|
|
let a = cloud_instance_management_t(t.price);
|
|
(e === `resize` ? (F.value = a) : (V.value = a), (X.value = i));
|
|
} catch (e) {
|
|
!E &&
|
|
r === k &&
|
|
(t.value = e instanceof Error ? e.message : `询价失败`);
|
|
} finally {
|
|
!E && r === k && (I.value = !1);
|
|
}
|
|
}
|
|
let Q = () => Ze(`resize`),
|
|
$ = () => Ze(`add`);
|
|
async function Qe(e) {
|
|
if (!Z.value || !T.value || !(e === `resize` ? A.value : L.value))
|
|
return;
|
|
let t = e === `resize` ? M : z,
|
|
n = e === `resize` ? j : R;
|
|
t.value = ``;
|
|
let r;
|
|
try {
|
|
r = e === `resize` ? Ke() : qe();
|
|
} catch (e) {
|
|
t.value = e.message;
|
|
return;
|
|
}
|
|
let i = Y.value,
|
|
a = e === `resize` ? F.value : V.value,
|
|
o = ++He;
|
|
n.value = !0;
|
|
try {
|
|
let t = await x.post(
|
|
`${Ve.value}/disk/${e === `resize` ? `resize/order` : `order`}`,
|
|
r,
|
|
);
|
|
if (E || i !== Y.value) return;
|
|
let n = cloud_instance_management_s(t.id);
|
|
((A.value = !1),
|
|
(L.value = !1),
|
|
b(`pay`, {
|
|
order_id: n,
|
|
amount: a,
|
|
}));
|
|
} catch (e) {
|
|
!E &&
|
|
i === Y.value &&
|
|
(t.value = e instanceof Error ? e.message : `下单失败`);
|
|
} finally {
|
|
!E && o === He && (n.value = !1);
|
|
}
|
|
}
|
|
let $e = () => Qe(`resize`),
|
|
et = () => Qe(`add`);
|
|
return (
|
|
watch(
|
|
() => [y.hostId, y.module, y.productId, y.upgradeAllowed],
|
|
() => {
|
|
(D++,
|
|
He++,
|
|
(w.value = !1),
|
|
(A.value = !1),
|
|
(L.value = !1),
|
|
(R.value = !1),
|
|
(j.value = !1),
|
|
Ge());
|
|
},
|
|
),
|
|
onMounted(Ge),
|
|
onBeforeUnmount(() => {
|
|
((E = !0), D++, O++, We());
|
|
}),
|
|
(t, n) => {
|
|
let r = button,
|
|
a = message,
|
|
c = OperationNotice,
|
|
_ = column,
|
|
v = datatable,
|
|
de = tag,
|
|
fe = inputnumber,
|
|
pe = dialog,
|
|
me = select;
|
|
return (
|
|
openBlock(),
|
|
createElementBlock(
|
|
`div`,
|
|
{
|
|
class: `disks`,
|
|
"aria-busy": m.loading,
|
|
},
|
|
[
|
|
y.error
|
|
? (openBlock(),
|
|
createBlock(
|
|
a,
|
|
{
|
|
key: 0,
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createElementVNode(`div`, _e, [
|
|
createElementVNode(`span`, null, [
|
|
createTextVNode(toDisplayString(y.error), 1),
|
|
m.loaded
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 0,
|
|
},
|
|
[
|
|
createTextVNode(
|
|
`;以下为上次成功加载的数据。`,
|
|
),
|
|
],
|
|
64,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `重试`,
|
|
size: `small`,
|
|
severity: `secondary`,
|
|
text: ``,
|
|
loading: m.loading,
|
|
onClick: (n[0] ||= (e) => b(`refresh`)),
|
|
},
|
|
null,
|
|
8,
|
|
[`loading`],
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
m.loading && !m.loaded
|
|
? (openBlock(),
|
|
createElementBlock(`div`, ve, `正在加载磁盘信息…`))
|
|
: m.loading
|
|
? (openBlock(),
|
|
createElementBlock(`div`, ye, `正在刷新磁盘信息…`))
|
|
: createCommentVNode(``, !0),
|
|
createVNode(
|
|
c,
|
|
{
|
|
message: unref(S),
|
|
severity: `error`,
|
|
},
|
|
null,
|
|
8,
|
|
[`message`],
|
|
),
|
|
createVNode(
|
|
c,
|
|
{
|
|
message: unref(C),
|
|
severity: `success`,
|
|
},
|
|
null,
|
|
8,
|
|
[`message`],
|
|
),
|
|
m.loaded
|
|
? (openBlock(),
|
|
createElementBlock(`section`, be, [
|
|
(n[10] ||= createElementVNode(
|
|
`div`,
|
|
{
|
|
class: `grp-title`,
|
|
},
|
|
`系统盘`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
v,
|
|
{
|
|
value: unref(ze),
|
|
size: `small`,
|
|
scrollable: ``,
|
|
},
|
|
{
|
|
empty: withCtx(() => [
|
|
...(n[8] ||= [
|
|
createElementVNode(
|
|
`div`,
|
|
{
|
|
class: `empty`,
|
|
},
|
|
`暂无系统盘信息`,
|
|
-1,
|
|
),
|
|
]),
|
|
]),
|
|
default: withCtx(() => [
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `名称`,
|
|
style: {
|
|
"min-width": `190px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createElementVNode(`div`, xe, [
|
|
(n[9] ||= createElementVNode(
|
|
`i`,
|
|
{
|
|
class: `pi pi-server`,
|
|
},
|
|
null,
|
|
-1,
|
|
)),
|
|
createElementVNode(
|
|
`span`,
|
|
null,
|
|
toDisplayString(t.name),
|
|
1,
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `容量`,
|
|
style: {
|
|
width: `110px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createTextVNode(
|
|
toDisplayString(t.size) + ` GB`,
|
|
1,
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `类型`,
|
|
style: {
|
|
width: `100px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createTextVNode(
|
|
toDisplayString(t.type),
|
|
1,
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `创建时间`,
|
|
style: {
|
|
width: `170px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: n }) => [
|
|
createTextVNode(
|
|
toDisplayString(
|
|
n.createTime
|
|
? (`formatTime` in t
|
|
? t.formatTime
|
|
: unref(dict_r))(n.createTime)
|
|
: `—`,
|
|
),
|
|
1,
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[`value`],
|
|
),
|
|
(n[11] ||= createElementVNode(
|
|
`p`,
|
|
{
|
|
class: `grp-note`,
|
|
},
|
|
`系统盘在服务器开通后不支持扩容升级。`,
|
|
-1,
|
|
)),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
m.loaded
|
|
? (openBlock(),
|
|
createElementBlock(`section`, Se, [
|
|
(n[14] ||= createElementVNode(
|
|
`div`,
|
|
{
|
|
class: `grp-title`,
|
|
},
|
|
`数据盘`,
|
|
-1,
|
|
)),
|
|
unref(T)
|
|
? (openBlock(),
|
|
createBlock(
|
|
r,
|
|
{
|
|
key: 0,
|
|
label: `购买数据盘`,
|
|
icon: `pi pi-plus`,
|
|
size: `small`,
|
|
severity: `secondary`,
|
|
outlined: ``,
|
|
loading: unref(W),
|
|
disabled:
|
|
!unref(J) ||
|
|
unref(w) ||
|
|
unref(R) ||
|
|
unref(j),
|
|
onClick: Ye,
|
|
},
|
|
null,
|
|
8,
|
|
[`loading`, `disabled`],
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
unref(G)
|
|
? (openBlock(),
|
|
createBlock(
|
|
a,
|
|
{
|
|
key: 1,
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createTextVNode(
|
|
toDisplayString(unref(G)),
|
|
1,
|
|
),
|
|
createVNode(r, {
|
|
label: `重试`,
|
|
text: ``,
|
|
size: `small`,
|
|
onClick: Ge,
|
|
}),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: unref(T) && !unref(W) && !unref(J)
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
`p`,
|
|
Ce,
|
|
toDisplayString(
|
|
m.upgradeAllowed === !1
|
|
? `当前实例不允许升降级。`
|
|
: unref(K) !== null &&
|
|
unref(Be).length >= unref(K)
|
|
? `数据盘数量已达到上限。`
|
|
: `当前商品未开放新增磁盘规格。`,
|
|
),
|
|
1,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
createVNode(
|
|
v,
|
|
{
|
|
value: unref(Be),
|
|
size: `small`,
|
|
scrollable: ``,
|
|
},
|
|
{
|
|
empty: withCtx(() => [
|
|
...(n[12] ||= [
|
|
createElementVNode(
|
|
`div`,
|
|
{
|
|
class: `empty`,
|
|
},
|
|
`暂无数据盘`,
|
|
-1,
|
|
),
|
|
]),
|
|
]),
|
|
default: withCtx(() => [
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `名称`,
|
|
style: {
|
|
"min-width": `190px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createElementVNode(`div`, we, [
|
|
(n[13] ||= createElementVNode(
|
|
`i`,
|
|
{
|
|
class: `pi pi-database`,
|
|
},
|
|
null,
|
|
-1,
|
|
)),
|
|
createElementVNode(
|
|
`span`,
|
|
null,
|
|
toDisplayString(t.name),
|
|
1,
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `容量`,
|
|
style: {
|
|
width: `110px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createTextVNode(
|
|
toDisplayString(t.size) + ` GB`,
|
|
1,
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
_,
|
|
{
|
|
header: `类型`,
|
|
style: {
|
|
width: `100px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: t }) => [
|
|
createTextVNode(
|
|
toDisplayString(t.type),
|
|
1,
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
unref(T) || m.module === `remf_finance`
|
|
? (openBlock(),
|
|
createBlock(
|
|
_,
|
|
{
|
|
key: 0,
|
|
header: `状态`,
|
|
style: {
|
|
width: `110px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: e }) => [
|
|
createVNode(
|
|
de,
|
|
{
|
|
value:
|
|
e.status === 1
|
|
? `已挂载`
|
|
: e.status === 0
|
|
? `未挂载`
|
|
: `—`,
|
|
severity:
|
|
e.status === 1
|
|
? `success`
|
|
: `secondary`,
|
|
},
|
|
null,
|
|
8,
|
|
[`value`, `severity`],
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
unref(T)
|
|
? (openBlock(),
|
|
createBlock(
|
|
_,
|
|
{
|
|
key: 1,
|
|
header: `操作`,
|
|
style: {
|
|
width: `180px`,
|
|
},
|
|
},
|
|
{
|
|
body: withCtx(({ data: e }) => [
|
|
createElementVNode(`div`, Te, [
|
|
createVNode(
|
|
r,
|
|
{
|
|
label:
|
|
e.status === 1
|
|
? `卸载`
|
|
: `挂载`,
|
|
size: `small`,
|
|
severity: `secondary`,
|
|
text: ``,
|
|
disabled:
|
|
unref(w) ||
|
|
unref(j) ||
|
|
unref(R) ||
|
|
![0, 1].includes(e.status),
|
|
onClick: (t) => Ue(e),
|
|
},
|
|
null,
|
|
8,
|
|
[`label`, `disabled`, `onClick`],
|
|
),
|
|
m.upgradeAllowed === !1
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createBlock(
|
|
r,
|
|
{
|
|
key: 0,
|
|
label: `扩容`,
|
|
size: `small`,
|
|
text: ``,
|
|
disabled:
|
|
unref(w) ||
|
|
unref(j) ||
|
|
unref(R) ||
|
|
Number(e.raw.is_free) ===
|
|
1 ||
|
|
![0, 1].includes(
|
|
e.status,
|
|
),
|
|
onClick: (t) => Je(e),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `onClick`],
|
|
)),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[`value`],
|
|
),
|
|
m.module === `kky_ecs` && m.upgradeAllowed !== !1
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
`p`,
|
|
Ee,
|
|
` 数据盘的扩容与新增请前往「计费」Tab 通过实例升级完成。 `,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
!unref(T) && m.module !== `kky_ecs`
|
|
? (openBlock(),
|
|
createBlock(
|
|
a,
|
|
{
|
|
key: 5,
|
|
severity: `info`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
...(n[15] ||= [
|
|
createTextVNode(
|
|
`当前模块暂未提供独立新增磁盘入口。`,
|
|
-1,
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
m.upgradeAllowed === !1
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createBlock(
|
|
pe,
|
|
{
|
|
key: 6,
|
|
visible: unref(A),
|
|
"onUpdate:visible": (n[3] ||= (e) =>
|
|
isRef(A) ? (A.value = e) : null),
|
|
header: `磁盘扩容`,
|
|
modal: ``,
|
|
style: {
|
|
width: `420px`,
|
|
},
|
|
draggable: !1,
|
|
closable: !unref(j),
|
|
"close-on-escape": !unref(j),
|
|
},
|
|
{
|
|
footer: withCtx(() => [
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `取消`,
|
|
severity: `secondary`,
|
|
text: ``,
|
|
disabled: unref(j),
|
|
onClick: (n[2] ||= (e) => (A.value = !1)),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `提交订单`,
|
|
loading: unref(j),
|
|
disabled: !unref(Z),
|
|
onClick: $e,
|
|
},
|
|
null,
|
|
8,
|
|
[`loading`, `disabled`],
|
|
),
|
|
]),
|
|
default: withCtx(() => [
|
|
createElementVNode(`div`, De, [
|
|
createElementVNode(`p`, Oe, [
|
|
(n[16] ||= createTextVNode(`磁盘 `, -1)),
|
|
createElementVNode(
|
|
`strong`,
|
|
null,
|
|
toDisplayString(unref(N)?.name),
|
|
1,
|
|
),
|
|
createTextVNode(
|
|
` 当前 ` +
|
|
toDisplayString(unref(N)?.size) +
|
|
` GB`,
|
|
1,
|
|
),
|
|
]),
|
|
createElementVNode(`div`, ke, [
|
|
(n[17] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`扩容至`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
fe,
|
|
{
|
|
modelValue: unref(P),
|
|
"onUpdate:modelValue": [
|
|
(n[1] ||= (e) =>
|
|
isRef(P) ? (P.value = e) : null),
|
|
Q,
|
|
],
|
|
min: (unref(N)?.size ?? 0) + 1,
|
|
disabled: unref(j),
|
|
showButtons: ``,
|
|
buttonLayout: `horizontal`,
|
|
suffix: ` GB`,
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `min`, `disabled`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, Ae, [
|
|
(n[18] ||= createElementVNode(
|
|
`span`,
|
|
null,
|
|
`应付金额`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`span`, je, [
|
|
unref(I)
|
|
? (openBlock(),
|
|
createElementBlock(`i`, Me))
|
|
: (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 1,
|
|
},
|
|
[
|
|
createTextVNode(
|
|
toDisplayString(
|
|
unref(F) ? `¥${unref(F)}` : `—`,
|
|
),
|
|
1,
|
|
),
|
|
],
|
|
64,
|
|
)),
|
|
]),
|
|
]),
|
|
unref(M)
|
|
? (openBlock(),
|
|
createBlock(
|
|
a,
|
|
{
|
|
key: 0,
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createTextVNode(
|
|
toDisplayString(unref(M)),
|
|
1,
|
|
),
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `重新报价`,
|
|
text: ``,
|
|
size: `small`,
|
|
disabled: unref(j),
|
|
onClick: Q,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
(n[19] ||= createElementVNode(
|
|
`p`,
|
|
{
|
|
class: `hint`,
|
|
},
|
|
`扩容后需在系统内扩展分区与文件系统才能生效。`,
|
|
-1,
|
|
)),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[`visible`, `closable`, `close-on-escape`],
|
|
)),
|
|
unref(T) && m.upgradeAllowed !== !1
|
|
? (openBlock(),
|
|
createBlock(
|
|
pe,
|
|
{
|
|
key: 7,
|
|
visible: unref(L),
|
|
"onUpdate:visible": (n[7] ||= (e) =>
|
|
isRef(L) ? (L.value = e) : null),
|
|
header: `购买数据盘`,
|
|
modal: ``,
|
|
style: {
|
|
width: `420px`,
|
|
},
|
|
draggable: !1,
|
|
closable: !unref(R),
|
|
"close-on-escape": !unref(R),
|
|
},
|
|
{
|
|
footer: withCtx(() => [
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `取消`,
|
|
severity: `secondary`,
|
|
text: ``,
|
|
disabled: unref(R),
|
|
onClick: (n[6] ||= (e) => (L.value = !1)),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `提交订单`,
|
|
loading: unref(R),
|
|
disabled: !unref(Z),
|
|
onClick: et,
|
|
},
|
|
null,
|
|
8,
|
|
[`loading`, `disabled`],
|
|
),
|
|
]),
|
|
default: withCtx(() => [
|
|
createElementVNode(`div`, Ne, [
|
|
createElementVNode(`div`, Pe, [
|
|
(n[20] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`磁盘规格`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
me,
|
|
{
|
|
modelValue: unref(H),
|
|
"onUpdate:modelValue": (n[4] ||= (e) =>
|
|
isRef(H) ? (H.value = e) : null),
|
|
options: unref(U),
|
|
"option-label": `label`,
|
|
"option-value": `id`,
|
|
"aria-label": `新增磁盘规格`,
|
|
disabled: unref(R),
|
|
onChange: Xe,
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `options`, `disabled`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, Fe, [
|
|
(n[21] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`容量`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
fe,
|
|
{
|
|
modelValue: unref(B),
|
|
"onUpdate:modelValue": [
|
|
(n[5] ||= (e) =>
|
|
isRef(B) ? (B.value = e) : null),
|
|
$,
|
|
],
|
|
min: unref(q)?.min,
|
|
max: unref(q)?.max,
|
|
step: unref(q)?.step || 1,
|
|
disabled:
|
|
unref(R) ||
|
|
unref(q)?.min === unref(q)?.max,
|
|
suffix: ` GB`,
|
|
showButtons: ``,
|
|
buttonLayout: `horizontal`,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`modelValue`,
|
|
`min`,
|
|
`max`,
|
|
`step`,
|
|
`disabled`,
|
|
],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, Ie, [
|
|
(n[22] ||= createElementVNode(
|
|
`span`,
|
|
null,
|
|
`应付金额`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`span`, Le, [
|
|
unref(I)
|
|
? (openBlock(),
|
|
createElementBlock(`i`, Re))
|
|
: (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 1,
|
|
},
|
|
[
|
|
createTextVNode(
|
|
toDisplayString(
|
|
unref(V) ? `¥${unref(V)}` : `—`,
|
|
),
|
|
1,
|
|
),
|
|
],
|
|
64,
|
|
)),
|
|
]),
|
|
]),
|
|
unref(z)
|
|
? (openBlock(),
|
|
createBlock(
|
|
a,
|
|
{
|
|
key: 0,
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createTextVNode(
|
|
toDisplayString(unref(z)),
|
|
1,
|
|
),
|
|
createVNode(
|
|
r,
|
|
{
|
|
label: `重新报价`,
|
|
text: ``,
|
|
size: `small`,
|
|
disabled: unref(R),
|
|
onClick: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[`visible`, `closable`, `close-on-escape`],
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
],
|
|
8,
|
|
ge,
|
|
)
|
|
);
|
|
}
|
|
);
|
|
},
|
|
}),
|
|
[[`__scopeId`, `data-v-22ec0282`]],
|
|
),
|
|
{
|
|
__name: `InstanceDisks`,
|
|
},
|
|
);
|
|
export {};
|
|
export default y;
|
|
</script>
|