Browse Source

点播配置修改所属部门参数明

liupeng 4 weeks ago
parent
commit
6b08d78b53
1 changed files with 21 additions and 2 deletions
  1. 21 2
      src/views/course/coursePlaySourceConfig/index.vue

+ 21 - 2
src/views/course/coursePlaySourceConfig/index.vue

@@ -205,8 +205,8 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="所属部门" prop="deptId">
-          <treeselect v-model="form.deptId" :options="deptOptions" :normalizer="normalizer"  placeholder="选择上级部门"   :disabled="(username !== 'admin' && title === '修改小程序配置')"  />
+        <el-form-item label="所属部门" prop="createDeptId">
+          <treeselect v-model="form.createDeptId" :options="deptOptions" :normalizer="normalizer"  placeholder="选择上级部门"   :disabled="(username !== 'admin' && title === '修改小程序配置')"  />
         </el-form-item>
         <el-form-item label="是否是互医/商城小程序" prop="isMall">
           <el-select
@@ -383,6 +383,13 @@ export default {
     },
     /** 转换部门数据结构 */
     normalizer(node) {
+      if (node.hasOwnProperty('id') && !node.hasOwnProperty('deptId')) {
+        return {
+          id: node.id,
+          label: this.getDeptNameById(node.id) || '未知部门',
+          children: node.children || []
+        };
+      }
       if (node.children && !node.children.length) {
         delete node.children;
       }
@@ -392,6 +399,18 @@ export default {
         children: node.children
       };
     },
+    getDeptNameById(targetId) {
+      const deptOptions =this.deptOptions
+      console.log("text:"+JSON.stringify(deptOptions))
+      for (let i = 0; i < deptOptions.length; i++) {
+        const dept = deptOptions[i];
+        if (dept.deptId === targetId) {
+          return dept.deptName;
+        }
+      }
+      return '未知部门';
+    },
+
     // 处理开关配置
     handleSwitchConfig(row) {
       this.switchForm.appId = row.appid;