train-apply.js
3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {
__name: "train-apply",
props: {
trainProjectsList: {},
examProjectsList: {},
hotelList: {},
id: {}
},
emits: ["nextFN"],
setup(__props, { emit }) {
const props = __props;
const data = common_vendor.reactive({
projectIdsArray: []
});
const examIdsArry = common_vendor.ref([]);
const { projectIdsArray } = common_vendor.toRefs(data);
common_vendor.ref([0]);
function checkTrain(item) {
if (item.isNecessary == 1) {
item.check = true;
} else {
item.check = !item.check;
}
}
function upFN() {
emit("nextFN", 0);
}
function nextFN() {
let falg = true;
let arr1 = [];
let arr2 = [];
props.examProjectsList.forEach((item) => {
if (item.check) {
arr1.push(item.id);
}
});
props.trainProjectsList.forEach((item) => {
if (item.check) {
arr2.push(item.id);
}
});
let examList = JSON.parse(JSON.stringify(props.examProjectsList));
let trainList = JSON.parse(JSON.stringify(props.trainProjectsList));
examList.concat(trainList).forEach((item) => {
if (item.isNecessary == 1 && item.check == false) {
falg = false;
}
});
if (falg) {
examIdsArry.value = arr1;
projectIdsArray.value = arr2;
if (props.hotelList.length == 0) {
let path = `/pages/train/costBreakdown/costBreakdown?id=` + props.id;
common_vendor.wx$1.navigateTo({
url: path
});
} else {
emit("nextFN", 2, projectIdsArray.value, examIdsArry.value);
}
} else {
common_vendor.index.showToast({
title: "请选择必选科目!",
duration: 2e3,
icon: "error"
});
return false;
}
}
return (_ctx, _cache) => {
return common_vendor.e({
a: props.trainProjectsList.length != 0
}, props.trainProjectsList.length != 0 ? {
b: common_vendor.f(props.trainProjectsList, (item, k0, i0) => {
return {
a: common_vendor.t(item.projectName),
b: common_vendor.t(item.isNecessary == 1 ? "必选" : "非必选"),
c: common_vendor.t(item.cost),
d: item.isNecessary == 1,
e: item.id,
f: common_vendor.o(($event) => checkTrain(item), item.id),
g: item.check,
h: item.id
};
})
} : {}, {
c: props.examProjectsList.length != 0
}, props.examProjectsList.length != 0 ? {
d: common_vendor.f(props.examProjectsList, (item, k0, i0) => {
return {
a: common_vendor.t(item.projectName),
b: common_vendor.t(item.isNecessary == 1 ? "必选" : "非必选"),
c: common_vendor.t(item.cost),
d: item.isNecessary == 1,
e: item.id,
f: common_vendor.o(($event) => checkTrain(item), item.id),
g: item.check,
h: item.id
};
})
} : {}, {
e: common_vendor.o(upFN),
f: common_vendor.o(nextFN),
g: props.examProjectsList.length == 0 && props.trainProjectsList.length == 0
}, props.examProjectsList.length == 0 && props.trainProjectsList.length == 0 ? {} : {});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-108e86d7"], ["__file", "/Users/yangyang/project/j-mini/Venue/components/train/train-apply/train-apply.vue"]]);
wx.createComponent(Component);