若依 2.1

This commit is contained in:
RuoYi
2020-02-24 09:28:16 +08:00
parent 46a1695292
commit cb0a4b78ee
61 changed files with 4144 additions and 60 deletions

View File

@ -88,7 +88,7 @@
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" placeholder="选择上级部门" />
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -138,7 +138,7 @@
</template>
<script>
import { listDept, getDept, treeselect, delDept, addDept, updateDept } from "@/api/system/dept";
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -205,14 +205,25 @@ export default {
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = response.data;
this.deptList = this.handleTree(response.data, "deptId");
this.loading = false;
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children
};
},
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
},
// 字典状态字典翻译

View File

@ -82,6 +82,7 @@
<treeselect
v-model="form.parentId"
:options="menuOptions"
:normalizer="normalizer"
:show-count="true"
placeholder="选择上级菜单"
/>
@ -173,7 +174,7 @@
</template>
<script>
import { listMenu, getMenu, treeselect, delMenu, addMenu, updateMenu } from "@/api/system/menu";
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
@ -228,16 +229,27 @@ export default {
getList() {
this.loading = true;
listMenu(this.queryParams).then(response => {
this.menuList = response.data;
this.menuList = this.handleTree(response.data, "menuId");
this.loading = false;
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.menuId,
label: node.menuName,
children: node.children
};
},
/** 查询菜单下拉树结构 */
getTreeselect() {
treeselect().then(response => {
listMenu().then(response => {
this.menuOptions = [];
const menu = { id: 0, label: '主类目', children: [] };
menu.children = response.data;
const menu = { menuId: 0, menuName: '主类目', children: [] };
menu.children = this.handleTree(response.data, "menuId");
this.menuOptions.push(menu);
});
},