|
@@ -212,6 +212,9 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <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>
|
|
|
<el-form-item label="状态">
|
|
<el-form-item label="状态">
|
|
|
<el-radio-group v-model="form.status">
|
|
<el-radio-group v-model="form.status">
|
|
@@ -235,8 +238,13 @@
|
|
|
import { listQwCompany, getQwCompany, delQwCompany, addQwCompany, updateQwCompany, exportQwCompany } from "@/api/qw/qwCompany";
|
|
import { listQwCompany, getQwCompany, delQwCompany, addQwCompany, updateQwCompany, exportQwCompany } from "@/api/qw/qwCompany";
|
|
|
import { getCompanyList } from "@/api/company/company";
|
|
import { getCompanyList } from "@/api/company/company";
|
|
|
import { listAll } from '@/api/course/coursePlaySourceConfig'
|
|
import { listAll } from '@/api/course/coursePlaySourceConfig'
|
|
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
+import { getUserProfile } from '@/api/system/user'
|
|
|
|
|
+import { listDept } from '@/api/system/dept'
|
|
|
export default {
|
|
export default {
|
|
|
name: "QwCompany",
|
|
name: "QwCompany",
|
|
|
|
|
+ components: {Treeselect},
|
|
|
watch: {
|
|
watch: {
|
|
|
'form.realmNameUrl': function(newVal) {
|
|
'form.realmNameUrl': function(newVal) {
|
|
|
if(newVal==null){
|
|
if(newVal==null){
|
|
@@ -254,6 +262,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ // 部门树选项
|
|
|
|
|
+ deptOptions: [],
|
|
|
|
|
+ username:null,
|
|
|
// 遮罩层
|
|
// 遮罩层
|
|
|
loading: true,
|
|
loading: true,
|
|
|
// 导出遮罩层
|
|
// 导出遮罩层
|
|
@@ -319,7 +330,13 @@ export default {
|
|
|
});
|
|
});
|
|
|
getCompanyList().then(response => {
|
|
getCompanyList().then(response => {
|
|
|
this.companys = response.data;
|
|
this.companys = response.data;
|
|
|
-
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ listDept().then(response => {
|
|
|
|
|
+ this.deptOptions = this.handleTree(response.data, "deptId");
|
|
|
|
|
+ });
|
|
|
|
|
+ getUserProfile().then(response => {
|
|
|
|
|
+ const data = response.data;
|
|
|
|
|
+ this.username = data.userName;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -471,7 +488,39 @@ export default {
|
|
|
this.download(response.msg);
|
|
this.download(response.msg);
|
|
|
this.exportLoading = false;
|
|
this.exportLoading = false;
|
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 转换部门数据结构 */
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: node.deptId,
|
|
|
|
|
+ label: node.deptName,
|
|
|
|
|
+ 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 '未知部门';
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+
|
|
|
|
|
+</style>
|