|
|
@@ -20,7 +20,7 @@
|
|
|
<el-col :md="6" :sm="12">
|
|
|
<el-form-item label="类别属性">
|
|
|
<el-select v-model="table.where.attr_type" placeholder="请选择类别属性" clearable>
|
|
|
- <el-option v-for="(label, key) in attrTypeOptions" :key="key" :label="label"
|
|
|
+ <el-option v-for="(label, key) in searchAttrTypeOptions" :key="key" :label="label"
|
|
|
:value="key" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -77,7 +77,7 @@
|
|
|
<el-table-column prop="attr_type" label="类别属性" width="120" v-if="showAttrTypeColumn">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-tag type="success" v-if="row.attr_type">{{ attrTypeOptions[row.attr_type] || '未知'
|
|
|
- }}</el-tag>
|
|
|
+ }}</el-tag>
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -120,7 +120,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类别属性" prop="attr_type" v-if="showAttrTypeField">
|
|
|
<el-select v-model="formData.attr_type" placeholder="请选择类别属性" clearable>
|
|
|
- <el-option v-for="(label, key) in attrTypeOptions" :key="key" :label="label"
|
|
|
+ <el-option v-for="(label, key) in currentAttrTypeOptions" :key="key" :label="label"
|
|
|
:value="Number(key)" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -155,7 +155,7 @@ export default {
|
|
|
where: { keyword: "", type: null, attr_type: null, status: null }
|
|
|
},
|
|
|
choose: [],
|
|
|
- formData: { id: null, subject_name: "", type: 1, attr_type: null, description: "", icon: "", sort: 0, status: 1 },
|
|
|
+ formData: { id: null, subject_name: "", type: 1, attr_type: 3, description: "", icon: "", sort: 0, status: 1 },
|
|
|
isEdit: false,
|
|
|
formVisible: false,
|
|
|
formRules: {
|
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
type: [{ required: true, message: "请选择所属栏目", trigger: "change" }]
|
|
|
},
|
|
|
typeOptions: { 1: "单招", 2: "对口", 3: "专升本" },
|
|
|
- attrTypeOptions: { 1: "文化基础", 2: '19专业大类' },
|
|
|
+ attrTypeOptions: { 1: "文化基础", 2: '19专业大类', 3: '职业适应性测试视频课' },
|
|
|
permissionMap: {
|
|
|
delete: "sys:subject:delete",
|
|
|
edit: "sys:subject:edit",
|
|
|
@@ -174,23 +174,48 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["permission"]),
|
|
|
- // 是否显示类别属性列(只有对口和专升本才显示)
|
|
|
+ // 是否显示类别属性列
|
|
|
showAttrTypeColumn() {
|
|
|
- return this.table.where.type === 2 || this.table.where.type === 3;
|
|
|
+ // 所有类型都显示类别属性列
|
|
|
+ return this.table.where.type === 1 || this.table.where.type === 2 || this.table.where.type === 3;
|
|
|
},
|
|
|
- // 是否显示类别属性字段(只有对口和专升本才显示)
|
|
|
+ // 是否显示类别属性字段
|
|
|
showAttrTypeField() {
|
|
|
- return this.formData.type === 2 || this.formData.type === 3;
|
|
|
+ // 所有类型都显示类别属性字段
|
|
|
+ return this.formData.type === 1 || this.formData.type === 2 || this.formData.type === 3;
|
|
|
+ },
|
|
|
+ // 根据当前表单类型动态获取类别属性选项
|
|
|
+ currentAttrTypeOptions() {
|
|
|
+ if (this.formData.type === 1) {
|
|
|
+ // 单招:只显示职业适应性测试视频课
|
|
|
+ return { 3: '职业适应性测试视频课' };
|
|
|
+ } else if (this.formData.type === 2 || this.formData.type === 3) {
|
|
|
+ // 对口和专升本:显示文化基础和19专业大类
|
|
|
+ return { 1: "文化基础", 2: '19专业大类' };
|
|
|
+ }
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ // 搜索表单的类别属性选项(根据搜索的类型)
|
|
|
+ searchAttrTypeOptions() {
|
|
|
+ if (this.table.where.type === 1) {
|
|
|
+ // 单招:只显示职业适应性测试视频课
|
|
|
+ return { 3: '职业适应性测试视频课' };
|
|
|
+ } else if (this.table.where.type === 2 || this.table.where.type === 3) {
|
|
|
+ // 对口和专升本:显示文化基础和19专业大类
|
|
|
+ return { 1: "文化基础", 2: '19专业大类' };
|
|
|
+ }
|
|
|
+ // 未选择类型时显示所有
|
|
|
+ return this.attrTypeOptions;
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
// 监听类型变化,自动设置 attr_type
|
|
|
'formData.type'(newType) {
|
|
|
if (newType === 1) {
|
|
|
- // 单招时设置为0
|
|
|
- this.formData.attr_type = 0;
|
|
|
+ // 单招时默认设置为职业适应性测试视频课
|
|
|
+ this.formData.attr_type = 3;
|
|
|
} else if (newType === 2 || newType === 3) {
|
|
|
- // 对口和专升本时设置为null(可选)
|
|
|
+ // 对口和专升本时清空,让用户自己选择
|
|
|
this.formData.attr_type = null;
|
|
|
}
|
|
|
}
|
|
|
@@ -206,13 +231,13 @@ export default {
|
|
|
this.formData = {
|
|
|
...row,
|
|
|
type: Number(row.type),
|
|
|
- attr_type: row.attr_type ? Number(row.attr_type) : (Number(row.type) === 1 ? 0 : null),
|
|
|
+ attr_type: row.attr_type ? Number(row.attr_type) : (Number(row.type) === 1 ? 3 : null),
|
|
|
description: row.description || "",
|
|
|
icon: row.icon || ""
|
|
|
}; // 转成数字
|
|
|
} else {
|
|
|
this.isEdit = false;
|
|
|
- this.formData = { id: null, subject_name: "", type: 1, attr_type: 0, description: "", icon: "", sort: 0, status: 1 };
|
|
|
+ this.formData = { id: null, subject_name: "", type: 1, attr_type: 3, description: "", icon: "", sort: 0, status: 1 };
|
|
|
}
|
|
|
this.formVisible = true;
|
|
|
},
|