|
|
@@ -26,6 +26,16 @@
|
|
|
<el-select
|
|
|
v-model="formData.bcLabel"
|
|
|
placeholder="请选择课程标签"
|
|
|
+ @change="()=>{
|
|
|
+ if(!formData.bcName){
|
|
|
+ const selectedDict = getStrDictOptions(DICT_TYPE.BLOCKLY_COURSE_LABEL).find(
|
|
|
+ dict => dict.value === formData.bcLabel
|
|
|
+ );
|
|
|
+ if(selectedDict){
|
|
|
+ formData.bcName = selectedDict.label;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }"
|
|
|
clearable
|
|
|
>
|
|
|
<el-option
|
|
|
@@ -596,8 +606,14 @@ const open = async (type: string, id?: number) => {
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
formType.value = type
|
|
|
resetForm()
|
|
|
+
|
|
|
+ // 新增时,绑定类型
|
|
|
+ if (type === 'create' && id) {
|
|
|
+ // 确保 bcType 为正确的 id 类型
|
|
|
+ formData.value.bcType = id ? Number(id) : undefined
|
|
|
+ }
|
|
|
// 修改时,设置数据
|
|
|
- if (id) {
|
|
|
+ if (type === 'update' && id) {
|
|
|
formLoading.value = true
|
|
|
try {
|
|
|
const blocklyData = await BlocklyApi.getBlockly(id)
|