|
@@ -178,6 +178,91 @@ let state = ref({
|
|
"showDetails": false,
|
|
"showDetails": false,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+// 父子级的学校到班级的数据参数
|
|
|
|
+let options = [
|
|
|
|
+ // {
|
|
|
|
+ // id: 1,
|
|
|
|
+ // name: 'Asia',
|
|
|
|
+ // children: [
|
|
|
|
+ // {
|
|
|
|
+ // id: 2,
|
|
|
|
+ // name: 'China',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 3, name: 'Beijing' },
|
|
|
|
+ // { id: 4, name: 'Shanghai' },
|
|
|
|
+ // { id: 5, name: 'Hangzhou' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 6,
|
|
|
|
+ // name: 'Japan',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 7, name: 'Tokyo' },
|
|
|
|
+ // { id: 8, name: 'Osaka' },
|
|
|
|
+ // { id: 9, name: 'Kyoto' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 10,
|
|
|
|
+ // name: 'Korea',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 11, name: 'Seoul' },
|
|
|
|
+ // { id: 12, name: 'Busan' },
|
|
|
|
+ // { id: 13, name: 'Taegu' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 14,
|
|
|
|
+ // name: 'Europe',
|
|
|
|
+ // children: [
|
|
|
|
+ // {
|
|
|
|
+ // id: 15,
|
|
|
|
+ // name: 'France',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 16, name: 'Paris' },
|
|
|
|
+ // { id: 17, name: 'Marseille' },
|
|
|
|
+ // { id: 18, name: 'Lyon' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 19,
|
|
|
|
+ // name: 'UK',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 20, name: 'London' },
|
|
|
|
+ // { id: 21, name: 'Birmingham' },
|
|
|
|
+ // { id: 22, name: 'Manchester' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 23,
|
|
|
|
+ // name: 'North America',
|
|
|
|
+ // children: [
|
|
|
|
+ // {
|
|
|
|
+ // id: 24,
|
|
|
|
+ // name: 'US',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 25, name: 'New York' },
|
|
|
|
+ // { id: 26, name: 'Los Angeles' },
|
|
|
|
+ // { id: 27, name: 'Washington' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // id: 28,
|
|
|
|
+ // name: 'Canada',
|
|
|
|
+ // children: [
|
|
|
|
+ // { id: 29, name: 'Toronto' },
|
|
|
|
+ // { id: 30, name: 'Montreal' },
|
|
|
|
+ // { id: 31, name: 'Ottawa' },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+]
|
|
|
|
+
|
|
// 用于表单验证规则必须要的对象
|
|
// 用于表单验证规则必须要的对象
|
|
let ruleFormRef = ref();
|
|
let ruleFormRef = ref();
|
|
|
|
|
|
@@ -480,8 +565,77 @@ const btnDetail = (res) => {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 获取父子级的树形结构数据
|
|
|
|
+ */
|
|
|
|
+const optionsUpdate = () => {
|
|
|
|
+
|
|
|
|
+ // 先获取所有最顶级的数据
|
|
|
|
+ let submit = {
|
|
|
|
+ // 默认优先去顶级所有,传 0 。 否则你要看到 学院, 专业 ,班级 的列表,这里固定就传 学院这个的id值
|
|
|
|
+ "schoolId" : 0,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ schoolTree(submit)
|
|
|
|
+ .then(response => {
|
|
|
|
+
|
|
|
|
+ options = [];
|
|
|
|
+
|
|
|
|
+ let data = response?.data?.data;
|
|
|
|
+
|
|
|
|
+ options = data;
|
|
|
|
+ // console.log(
|
|
|
|
+ // "schoolTreeEvent response", response, data
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ for (let i = 0; i < options.length; i++) {
|
|
|
|
+
|
|
|
|
+ let thisOptions = options[i];
|
|
|
|
+ // console.log(
|
|
|
|
+ // "thisOptions", thisOptions
|
|
|
|
+ // );
|
|
|
|
+ optionsChildrenUpdate(i, thisOptions.id);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }).catch(error => {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 将对应子级的数据获取
|
|
|
|
+ * optionsIndex options 对应的数组下标
|
|
|
|
+ * id 当前父级 的id值
|
|
|
|
+ */
|
|
|
|
+const optionsChildrenUpdate = (optionsIndex, id) => {
|
|
|
|
+
|
|
|
|
+ let submit = {
|
|
|
|
+ // 默认优先去顶级所有,传 0 。 否则你要看到 学院, 专业 ,班级 的列表,这里固定就传 学院这个的id值
|
|
|
|
+ "schoolId" : id,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ schoolTree(submit)
|
|
|
|
+ .then(response => {
|
|
|
|
+
|
|
|
|
+ let data = response?.data?.data;
|
|
|
|
+
|
|
|
|
+ // console.log(
|
|
|
|
+ // "optionsChildrenUpdate response", data
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ options[optionsIndex] = data[0];
|
|
|
|
+
|
|
|
|
+ }).catch(error => {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(function() {
|
|
onMounted(function() {
|
|
pageUpdateEvent();
|
|
pageUpdateEvent();
|
|
|
|
+ optionsUpdate();
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
</script>
|
|
@@ -595,6 +749,20 @@ onMounted(function() {
|
|
<el-option v-for="item in state.optionUserType" :key="item.value" :label="item.name" :value="item.value" />
|
|
<el-option v-for="item in state.optionUserType" :key="item.value" :label="item.name" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="班级" prop="classInfo">
|
|
|
|
+ <el-cascader v-model="addParams.classInfo"
|
|
|
|
+ :options="options"
|
|
|
|
+ :props="{
|
|
|
|
+ children: 'children',
|
|
|
|
+ label: 'name',
|
|
|
|
+ value: 'id',
|
|
|
|
+ checkStrictly: false,
|
|
|
|
+ expandTrigger: 'hover',
|
|
|
|
+ emitPath: false,
|
|
|
|
+ multiple: true,
|
|
|
|
+ }"
|
|
|
|
+ clearable placeholder="请选择班级" />
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="密码" prop="password">
|
|
<el-form-item label="密码" prop="password">
|
|
<el-input v-model="addParams.password" clearable placeholder="请填写密码"></el-input>
|
|
<el-input v-model="addParams.password" clearable placeholder="请填写密码"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|