@fewangsit/wangsvue-fats 1.0.1-alpha.51 → 1.0.1-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/disposalreport/index.d.ts +62 -0
- package/disposalreport/index.es.js +17 -14
- package/disposalreportbulkaction/index.es.js +18 -15
- package/disposalreportdialogselectasset/index.es.js +238 -0
- package/disposalreporttable/index.es.js +257 -137
- package/disposalreporttablefilter/index.es.js +17 -45
- package/icon/index.d.ts +1 -0
- package/package.json +1 -1
- package/stats.html +1 -1
- package/style.css +1 -1
- package/wangsvue-fats.esm.browser.js +8967 -8648
- package/wangsvue-fats.system.js +65 -65
|
@@ -3,11 +3,73 @@ import { DisposalReason } from '@tagsamurai/fats-api-services/src/types/disposal
|
|
|
3
3
|
|
|
4
4
|
import { ClassComponent } from '../ts-helpers';
|
|
5
5
|
|
|
6
|
+
type Option = {
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
6
11
|
export interface DisposalReportProps {
|
|
7
12
|
router: Router;
|
|
8
13
|
reason: DisposalReason;
|
|
14
|
+
from: 'damage' | 'missing';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Type of the selected data, it refers to data response from Asset API.
|
|
19
|
+
*/
|
|
20
|
+
export interface Asset {
|
|
21
|
+
_id?: string;
|
|
22
|
+
asset?: string;
|
|
23
|
+
name?: {
|
|
24
|
+
_id: string;
|
|
25
|
+
nameWithSequence: string;
|
|
26
|
+
name: string;
|
|
27
|
+
key: number;
|
|
28
|
+
};
|
|
29
|
+
assetName?: {
|
|
30
|
+
_id: string;
|
|
31
|
+
nameWithSequence: string;
|
|
32
|
+
name: string;
|
|
33
|
+
key: number;
|
|
34
|
+
};
|
|
35
|
+
tagType?: string;
|
|
36
|
+
status?: string;
|
|
37
|
+
category?: {
|
|
38
|
+
_id?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
key?: number;
|
|
41
|
+
};
|
|
42
|
+
group?: {
|
|
43
|
+
_id?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
key?: number;
|
|
46
|
+
};
|
|
47
|
+
assetGroup?: {
|
|
48
|
+
_id?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
key?: number;
|
|
51
|
+
};
|
|
52
|
+
assetBrand?: {
|
|
53
|
+
_id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
key: number;
|
|
56
|
+
};
|
|
57
|
+
assetModel?: {
|
|
58
|
+
_id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
key: number;
|
|
61
|
+
};
|
|
62
|
+
assetImage?: string;
|
|
63
|
+
damageImage?: string;
|
|
9
64
|
}
|
|
10
65
|
|
|
66
|
+
export type FilterOptions = {
|
|
67
|
+
assetNameOptions?: Option[];
|
|
68
|
+
assetBrandOptions?: Option[];
|
|
69
|
+
assetModelOptions?: Option[];
|
|
70
|
+
assetGroupOptions?: Option[];
|
|
71
|
+
};
|
|
72
|
+
|
|
11
73
|
export default class DisposalReport extends ClassComponent<
|
|
12
74
|
DisposalReportProps,
|
|
13
75
|
unknown,
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
1
|
+
import { defineComponent as r, createBlock as a, openBlock as n, withCtx as p, createElementVNode as o, createVNode as i, toDisplayString as l, unref as e, normalizeProps as c, guardReactiveProps as m } from "vue";
|
|
2
|
+
import { u as _ } from "../plugins/basei18n.es.js";
|
|
3
|
+
import { a as f } from "../utils/role.util.es.js";
|
|
4
|
+
import "../event-bus/index.es.js";
|
|
3
5
|
import { _ as d } from "../card/index.es.js";
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
6
|
+
import { _ as u } from "../disposalreporttable/index.es.js";
|
|
7
|
+
const g = {
|
|
6
8
|
class: "flex flex-col gap-3",
|
|
7
9
|
"data-ts-name": "disposalreport"
|
|
8
|
-
},
|
|
10
|
+
}, x = {
|
|
9
11
|
class: "text-general-800 font-bold text-base leading-[21.86px] tracking-[0.02em]",
|
|
10
12
|
"data-ts-section": "pagetitle"
|
|
11
|
-
}, v = /* @__PURE__ */
|
|
13
|
+
}, v = /* @__PURE__ */ r({
|
|
12
14
|
__name: "DisposalReport",
|
|
13
15
|
props: {
|
|
14
16
|
router: {},
|
|
15
|
-
reason: {}
|
|
17
|
+
reason: {},
|
|
18
|
+
from: {}
|
|
16
19
|
},
|
|
17
|
-
setup(
|
|
18
|
-
const { t } =
|
|
19
|
-
return (
|
|
20
|
-
content:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
setup(h) {
|
|
21
|
+
const { t } = _();
|
|
22
|
+
return (s, D) => (n(), a(d, null, {
|
|
23
|
+
content: p(() => [
|
|
24
|
+
o("div", g, [
|
|
25
|
+
o("h2", x, l(e(f)() === "Basic" ? e(t)("Report Disposal") : e(t)("Asset Disposal")), 1),
|
|
26
|
+
i(u, c(m(s.$props)), null, 16)
|
|
24
27
|
])
|
|
25
28
|
]),
|
|
26
29
|
_: 1
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as _, ref as
|
|
2
|
-
import { e as
|
|
1
|
+
import { defineComponent as _, ref as x, shallowRef as u, createElementBlock as h, openBlock as d, Fragment as w, createVNode as v, mergeProps as R, withCtx as k, createBlock as B, createCommentVNode as V, unref as l } from "vue";
|
|
2
|
+
import { e as p } from "../event-bus/index.es.js";
|
|
3
3
|
import { u as y } from "../plugins/basei18n.es.js";
|
|
4
4
|
import { _ as A } from "../buttonbulkaction/index.es.js";
|
|
5
5
|
import { _ as C } from "../dialogconfirm/index.es.js";
|
|
@@ -10,14 +10,14 @@ const S = /* @__PURE__ */ _({
|
|
|
10
10
|
tableName: {}
|
|
11
11
|
},
|
|
12
12
|
emits: ["noted", "removed"],
|
|
13
|
-
setup(
|
|
14
|
-
const { t: e } = y(), r =
|
|
13
|
+
setup(c, { emit: b }) {
|
|
14
|
+
const { t: e } = y(), r = c, s = b, o = x([]), n = u(!1), m = u(), f = [
|
|
15
15
|
{
|
|
16
16
|
label: e("Note"),
|
|
17
17
|
icon: "note",
|
|
18
18
|
useAdditionSlot: !0,
|
|
19
19
|
command: () => {
|
|
20
|
-
s("noted", o.value, m.value),
|
|
20
|
+
s("noted", o.value, m.value), p.emit("data-table:clear-selected-data", {
|
|
21
21
|
tableName: r.tableName
|
|
22
22
|
}), m.value = void 0;
|
|
23
23
|
}
|
|
@@ -30,13 +30,13 @@ const S = /* @__PURE__ */ _({
|
|
|
30
30
|
n.value = !0;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
],
|
|
34
|
-
s("removed", o.value),
|
|
33
|
+
], g = () => {
|
|
34
|
+
s("removed", o.value), p.emit("data-table:clear-selected-data", {
|
|
35
35
|
tableName: r.tableName
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
return (i, t) => (d(),
|
|
39
|
-
v(A,
|
|
38
|
+
return (i, t) => (d(), h(w, null, [
|
|
39
|
+
v(A, R({
|
|
40
40
|
"selected-data": o.value,
|
|
41
41
|
"onUpdate:selectedData": t[1] || (t[1] = (a) => o.value = a)
|
|
42
42
|
}, i.$attrs, {
|
|
@@ -44,11 +44,13 @@ const S = /* @__PURE__ */ _({
|
|
|
44
44
|
"table-name": i.tableName,
|
|
45
45
|
naming: "Asset(s)"
|
|
46
46
|
}), {
|
|
47
|
-
addition:
|
|
48
|
-
(a == null ? void 0 : a.label) === l(e)("Note") ? (d(),
|
|
47
|
+
addition: k(({ selectedOption: a }) => [
|
|
48
|
+
(a == null ? void 0 : a.label) === l(e)("Note") ? (d(), B(D, {
|
|
49
49
|
key: 0,
|
|
50
50
|
modelValue: m.value,
|
|
51
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
51
|
+
"onUpdate:modelValue": t[0] || (t[0] = (N) => m.value = N),
|
|
52
|
+
"max-input": 30,
|
|
53
|
+
maxlength: 30,
|
|
52
54
|
placeholder: l(e)("Enter note"),
|
|
53
55
|
rows: 1,
|
|
54
56
|
"textarea-pt": {
|
|
@@ -56,8 +58,9 @@ const S = /* @__PURE__ */ _({
|
|
|
56
58
|
maxlength: 30
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
|
-
class: "!max-w-[250px]"
|
|
60
|
-
|
|
61
|
+
class: "!max-w-[250px]",
|
|
62
|
+
"prevent-input-on-max-length": ""
|
|
63
|
+
}, null, 8, ["modelValue", "placeholder"])) : V("", !0)
|
|
61
64
|
]),
|
|
62
65
|
_: 1
|
|
63
66
|
}, 16, ["selected-data", "table-name"]),
|
|
@@ -68,7 +71,7 @@ const S = /* @__PURE__ */ _({
|
|
|
68
71
|
header: l(e)("Remove from List"),
|
|
69
72
|
list: o.value,
|
|
70
73
|
message: l(e)("Are you sure you want to remove it?"),
|
|
71
|
-
onConfirm:
|
|
74
|
+
onConfirm: g,
|
|
72
75
|
"list-label": "name.nameWithSequence",
|
|
73
76
|
severity: "danger"
|
|
74
77
|
}, null, 8, ["visible", "confirm-label", "header", "list", "message"])
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { defineComponent as M, mergeModels as b, useModel as $, shallowRef as v, ref as I, computed as d, createBlock as z, openBlock as G, withCtx as h, createElementVNode as l, createVNode as o, toDisplayString as T, withDirectives as J, vShow as j } from "vue";
|
|
2
|
+
import { AssetServices as y } from "@tagsamurai/fats-api-services";
|
|
3
|
+
import { e as R } from "../event-bus/index.es.js";
|
|
4
|
+
import "../utils/role.util.es.js";
|
|
5
|
+
import { u as V } from "../utils/toast.util.es.js";
|
|
6
|
+
import { _ as m } from "../badge/index.es.js";
|
|
7
|
+
import { _ as g } from "../button/index.es.js";
|
|
8
|
+
import { _ as E } from "../buttonfilter/index.es.js";
|
|
9
|
+
import { _ as P } from "../buttonsearch/index.es.js";
|
|
10
|
+
import { D as U } from "../datatable/index.es.js";
|
|
11
|
+
import { _ as q } from "../dialog/index.es.js";
|
|
12
|
+
import { _ as H } from "../image/index.es.js";
|
|
13
|
+
import { _ as K } from "../filtercontainer/index.es.js";
|
|
14
|
+
const L = { class: "flex justify-between items-center" }, W = {
|
|
15
|
+
class: "flex gap-1 items-center justify-end",
|
|
16
|
+
"data-ts-section": "button-group"
|
|
17
|
+
}, Y = { class: "flex flex-col gap-1" }, Q = {
|
|
18
|
+
class: "text-xs text-red-600",
|
|
19
|
+
"data-ts-section": "message-validator"
|
|
20
|
+
}, X = { class: "flex items-center justify-end gap-1" }, me = /* @__PURE__ */ M({
|
|
21
|
+
__name: "DisposalReportDialogSelectAsset",
|
|
22
|
+
props: /* @__PURE__ */ b({
|
|
23
|
+
selectedAssets: {},
|
|
24
|
+
excludedKey: {},
|
|
25
|
+
header: {},
|
|
26
|
+
size: {},
|
|
27
|
+
assetStatus: {},
|
|
28
|
+
fetchFunction: { type: Function },
|
|
29
|
+
fetchOptionFunction: { type: Function }
|
|
30
|
+
}, {
|
|
31
|
+
visible: { type: Boolean, default: !1 },
|
|
32
|
+
visibleModifiers: {}
|
|
33
|
+
}),
|
|
34
|
+
emits: /* @__PURE__ */ b(["select"], ["update:visible"]),
|
|
35
|
+
setup(p, { emit: _ }) {
|
|
36
|
+
const t = p, O = _, r = $(p, "visible"), S = V(), n = v("select-asset-table"), c = v(!1), i = I([]), x = d(() => [
|
|
37
|
+
{
|
|
38
|
+
field: "assetImage",
|
|
39
|
+
header: "Photo",
|
|
40
|
+
style: "min-width: 72px",
|
|
41
|
+
bodyComponent: (s) => ({
|
|
42
|
+
component: H,
|
|
43
|
+
props: {
|
|
44
|
+
src: s.assetImage ?? s.damageImage,
|
|
45
|
+
size: "small"
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
field: "assetName.nameWithSequence",
|
|
51
|
+
header: "Name",
|
|
52
|
+
sortable: !0
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
field: "assetId",
|
|
56
|
+
header: "Asset ID",
|
|
57
|
+
sortable: !0
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
field: "assetBrand.name",
|
|
61
|
+
header: "Brand",
|
|
62
|
+
sortable: !0,
|
|
63
|
+
bodyComponent: (s) => {
|
|
64
|
+
var e;
|
|
65
|
+
return {
|
|
66
|
+
component: m,
|
|
67
|
+
props: {
|
|
68
|
+
label: (e = s.assetBrand) == null ? void 0 : e.name,
|
|
69
|
+
severity: "dark"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
field: "assetModel.name",
|
|
76
|
+
header: "Model/Type",
|
|
77
|
+
sortable: !0,
|
|
78
|
+
bodyComponent: (s) => {
|
|
79
|
+
var e;
|
|
80
|
+
return {
|
|
81
|
+
component: m,
|
|
82
|
+
props: {
|
|
83
|
+
label: (e = s.assetModel) == null ? void 0 : e.name,
|
|
84
|
+
severity: "dark"
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
field: "assetGroup.name",
|
|
91
|
+
header: "Group",
|
|
92
|
+
sortable: !0,
|
|
93
|
+
bodyComponent: (s) => {
|
|
94
|
+
var e;
|
|
95
|
+
return {
|
|
96
|
+
component: m,
|
|
97
|
+
props: {
|
|
98
|
+
label: (e = s.assetGroup) == null ? void 0 : e.name
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]), A = d(() => [
|
|
104
|
+
{
|
|
105
|
+
label: "Name",
|
|
106
|
+
field: "assetName",
|
|
107
|
+
placeholder: "Select name",
|
|
108
|
+
type: "multiselect",
|
|
109
|
+
fetchOptionFn: () => t.fetchOptionFunction ? t.fetchOptionFunction("assetNameOptions") : u("nameOptions")
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "Brand",
|
|
113
|
+
field: "assetBrand",
|
|
114
|
+
placeholder: "Select brand",
|
|
115
|
+
type: "multiselect",
|
|
116
|
+
fetchOptionFn: () => t.fetchOptionFunction ? t.fetchOptionFunction("assetBrandOptions") : u("brandOptions")
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: "Model/Type",
|
|
120
|
+
field: "assetModel",
|
|
121
|
+
placeholder: "Select model/type",
|
|
122
|
+
type: "multiselect",
|
|
123
|
+
fetchOptionFn: () => t.fetchOptionFunction ? t.fetchOptionFunction("assetModelOptions") : u("modelOptions")
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: "Group",
|
|
127
|
+
field: "assetGroup",
|
|
128
|
+
type: "group"
|
|
129
|
+
}
|
|
130
|
+
]), F = d(() => {
|
|
131
|
+
switch (t.size) {
|
|
132
|
+
case "large":
|
|
133
|
+
return "1000px";
|
|
134
|
+
case "small":
|
|
135
|
+
return "600px";
|
|
136
|
+
default:
|
|
137
|
+
return "800px";
|
|
138
|
+
}
|
|
139
|
+
}), w = d(() => t.header ?? "Select Asset"), u = async (s) => {
|
|
140
|
+
var f;
|
|
141
|
+
const e = JSON.stringify(t.selectedAssets ?? []), a = {
|
|
142
|
+
[s]: !0,
|
|
143
|
+
excludeId: e,
|
|
144
|
+
status: JSON.stringify(t.assetStatus ?? ["Available"])
|
|
145
|
+
}, { data: C } = await y.getAllAssetsOptions(a);
|
|
146
|
+
return ((f = C.data) == null ? void 0 : f[s]) ?? [];
|
|
147
|
+
}, N = async (s) => {
|
|
148
|
+
const e = JSON.stringify(t.selectedAssets ?? []);
|
|
149
|
+
try {
|
|
150
|
+
const { data: a } = await y.getAllAssets({
|
|
151
|
+
excludeId: e,
|
|
152
|
+
status: JSON.stringify(t.assetStatus ?? ["Available"]),
|
|
153
|
+
...s
|
|
154
|
+
});
|
|
155
|
+
return a;
|
|
156
|
+
} catch (a) {
|
|
157
|
+
console.error(a), S.add({
|
|
158
|
+
error: a,
|
|
159
|
+
message: "Error, failed to get asset list."
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, D = () => {
|
|
163
|
+
i.value.length === 0 ? c.value = !0 : B();
|
|
164
|
+
}, B = () => {
|
|
165
|
+
O("select", i.value), c.value = !1, r.value = !1;
|
|
166
|
+
}, k = () => {
|
|
167
|
+
i.value = [], R.emit("data-table:clear-selected-data", {
|
|
168
|
+
tableName: n.value
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
return (s, e) => (G(), z(q, {
|
|
172
|
+
visible: r.value,
|
|
173
|
+
"onUpdate:visible": e[3] || (e[3] = (a) => r.value = a),
|
|
174
|
+
header: w.value,
|
|
175
|
+
pt: { root: { style: { width: F.value } } },
|
|
176
|
+
onHide: k,
|
|
177
|
+
closable: "",
|
|
178
|
+
"data-ts-section": "dialogselectasset",
|
|
179
|
+
modal: ""
|
|
180
|
+
}, {
|
|
181
|
+
footer: h(() => [
|
|
182
|
+
l("div", Y, [
|
|
183
|
+
J(l("small", Q, " You must pick an asset ", 512), [
|
|
184
|
+
[j, c.value]
|
|
185
|
+
]),
|
|
186
|
+
l("div", X, [
|
|
187
|
+
o(g, {
|
|
188
|
+
onClick: e[2] || (e[2] = (a) => r.value = !1),
|
|
189
|
+
"data-ts-section": "button-cancel",
|
|
190
|
+
label: "Cancel",
|
|
191
|
+
severity: "secondary",
|
|
192
|
+
text: ""
|
|
193
|
+
}),
|
|
194
|
+
o(g, {
|
|
195
|
+
onClick: D,
|
|
196
|
+
"data-ts-section": "button-select",
|
|
197
|
+
label: "Select",
|
|
198
|
+
severity: "success"
|
|
199
|
+
})
|
|
200
|
+
])
|
|
201
|
+
])
|
|
202
|
+
]),
|
|
203
|
+
default: h(() => [
|
|
204
|
+
l("div", L, [
|
|
205
|
+
e[4] || (e[4] = l("span", null, "Select asset(s) to be disposed.", -1)),
|
|
206
|
+
l("div", W, [
|
|
207
|
+
o(P, { "table-name": n.value }, null, 8, ["table-name"]),
|
|
208
|
+
o(E, { "table-name": n.value }, null, 8, ["table-name"])
|
|
209
|
+
])
|
|
210
|
+
]),
|
|
211
|
+
o(K, {
|
|
212
|
+
fields: A.value,
|
|
213
|
+
"table-name": n.value
|
|
214
|
+
}, null, 8, ["fields", "table-name"]),
|
|
215
|
+
o(U, {
|
|
216
|
+
"selected-data": i.value,
|
|
217
|
+
"onUpdate:selectedData": e[0] || (e[0] = (a) => i.value = a),
|
|
218
|
+
columns: x.value,
|
|
219
|
+
"fetch-function": t.fetchFunction ?? N,
|
|
220
|
+
rows: 10,
|
|
221
|
+
"table-name": n.value,
|
|
222
|
+
"use-option": !1,
|
|
223
|
+
onRowSelect: e[1] || (e[1] = (a) => c.value = !1),
|
|
224
|
+
"data-key": "_id",
|
|
225
|
+
"data-ts-section": "dialog-select-asset-table",
|
|
226
|
+
lazy: "",
|
|
227
|
+
"selection-type": "checkbox",
|
|
228
|
+
"use-paginator": ""
|
|
229
|
+
}, null, 8, ["selected-data", "columns", "fetch-function", "table-name"]),
|
|
230
|
+
l("pre", null, T(t.selectedAssets), 1)
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["visible", "header", "pt"]));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
export {
|
|
237
|
+
me as _
|
|
238
|
+
};
|