|
@@ -179,26 +179,29 @@
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
<el-input v-model="form.name" placeholder="请输入名称" />
|
|
|
</el-form-item>
|
|
|
+<!-- <el-form-item label="所属公司" prop="companyId">-->
|
|
|
+<!-- <el-select-->
|
|
|
+<!-- v-model="form.companyId"-->
|
|
|
+<!-- filterable-->
|
|
|
+<!-- remote-->
|
|
|
+<!-- reserve-keyword-->
|
|
|
+<!-- placeholder="请输入公司名称搜索"-->
|
|
|
+<!-- :remote-method="searchCompanies"-->
|
|
|
+<!-- :loading="companySearchLoading"-->
|
|
|
+<!-- style="width: 220px"-->
|
|
|
+<!-- clearable-->
|
|
|
+<!-- size="small"-->
|
|
|
+<!-- >-->
|
|
|
+<!-- <el-option-->
|
|
|
+<!-- v-for="item in companyOptions"-->
|
|
|
+<!-- :key="item.dictValue"-->
|
|
|
+<!-- :label="item.dictLabel"-->
|
|
|
+<!-- :value="item.dictValue"-->
|
|
|
+<!-- />-->
|
|
|
+<!-- </el-select>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
<el-form-item label="所属公司" prop="companyId">
|
|
|
- <el-select
|
|
|
- v-model="form.companyId"
|
|
|
- filterable
|
|
|
- remote
|
|
|
- reserve-keyword
|
|
|
- placeholder="请输入公司名称搜索"
|
|
|
- :remote-method="searchCompanies"
|
|
|
- :loading="companySearchLoading"
|
|
|
- style="width: 220px"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in companyOptions"
|
|
|
- :key="item.dictValue"
|
|
|
- :label="item.dictLabel"
|
|
|
- :value="item.dictValue"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <treeselect v-model="form.companyId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="图标" prop="img">
|
|
|
<image-upload v-model="form.img" :file-type='["png", "jpg", "jpeg"]' :limit="1"/>
|
|
@@ -248,11 +251,16 @@ import {list, get, update, add, del} from '@/api/course/coursePlaySourceConfig'
|
|
|
import {updateIsTownOn} from "@/api/system/config";
|
|
|
import { allList } from '@/api/company/company'
|
|
|
import { resetForm } from '@/utils/common'
|
|
|
-
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import {listDept} from "@/api/system/dept";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
export default {
|
|
|
name: 'CoursePlaySourceConfig',
|
|
|
+ components: {Treeselect},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 部门树选项
|
|
|
+ deptOptions: [],
|
|
|
switchDialogVisible: false,
|
|
|
// 公司搜索相关
|
|
|
companySearchLoading: false,
|
|
@@ -326,6 +334,9 @@ export default {
|
|
|
this.formatterCompanyOptions = e.rows;
|
|
|
});
|
|
|
this.getList();
|
|
|
+ listDept().then(response => {
|
|
|
+ this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
resetForm,
|
|
@@ -334,8 +345,17 @@ export default {
|
|
|
this.companyOptions = [];
|
|
|
this.open = false;
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
+ /** 转换部门数据结构 */
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.deptId,
|
|
|
+ label: node.deptName,
|
|
|
+ children: node.children
|
|
|
+ };
|
|
|
+ },
|
|
|
// 处理开关配置
|
|
|
handleSwitchConfig(row) {
|
|
|
this.switchForm.appId = row.appid;
|
|
@@ -360,9 +380,24 @@ export default {
|
|
|
this.companySearchLoading = false;
|
|
|
});
|
|
|
},
|
|
|
- companyNameFormatter(row){
|
|
|
- let company = this.formatterCompanyOptions.filter(item => item.dictValue === row.companyId)[0];
|
|
|
- return company ? company.dictLabel : '';
|
|
|
+ companyNameFormatter(row) {
|
|
|
+ // 递归查找树形结构中的部门
|
|
|
+ const findDept = (depts, targetId) => {
|
|
|
+ for (const dept of depts) {
|
|
|
+ // 先检查当前节点
|
|
|
+ if (String(dept.deptId) === String(row.companyId)) {
|
|
|
+ return dept;
|
|
|
+ }
|
|
|
+ // 如果有子节点,递归查找
|
|
|
+ if (dept.children && dept.children.length > 0) {
|
|
|
+ const found = findDept(dept.children, targetId);
|
|
|
+ if (found) return found;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
+ const company = findDept(this.deptOptions, row.companyId);
|
|
|
+ return company?.deptName || '';
|
|
|
},
|
|
|
|
|
|
// 获取开关配置
|
|
@@ -493,7 +528,7 @@ export default {
|
|
|
secret: null,
|
|
|
img: null,
|
|
|
originalId: null,
|
|
|
- token: 'cbnd7lJvkripVOpyTFAna6NAWCxCrvC',
|
|
|
+ token: 'Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC',
|
|
|
aesKey: 'HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E',
|
|
|
msgDataFormat: 'JSON',
|
|
|
type: '1'
|