|
@@ -1,13 +1,7 @@
|
|
|
<template>
|
|
|
<div class="dept">
|
|
|
<div class="tree">
|
|
|
- <treeList
|
|
|
- :data="treeListData"
|
|
|
- v-model="sourceList.pagination.tenantId"
|
|
|
- node-key="id"
|
|
|
- @change="treeChange"
|
|
|
- >
|
|
|
- </treeList>
|
|
|
+ <treeList :data="treeListData" v-model="sourceList.pagination.tenantId" node-key="id" @change="treeChange"> </treeList>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
<byTable
|
|
@@ -28,8 +22,7 @@
|
|
|
disabled: !sourceList.pagination.tenantId,
|
|
|
},
|
|
|
]"
|
|
|
- @get-list="getList"
|
|
|
- >
|
|
|
+ @get-list="getList">
|
|
|
<template #slotName="{ item }">
|
|
|
{{ item.createTime }}
|
|
|
</template>
|
|
@@ -42,132 +35,46 @@
|
|
|
:tree-props="{
|
|
|
children: 'children',
|
|
|
hasChildren: 'hasChildren',
|
|
|
- }"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- prop="deptName"
|
|
|
- label="机构名称"
|
|
|
- width="260"
|
|
|
- ></el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="orderNum"
|
|
|
- label="排序"
|
|
|
- width="100"
|
|
|
- ></el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="type"
|
|
|
- label="机构类型"
|
|
|
- width="100"
|
|
|
- :formatter="(row) => showType(row.type)"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="创建时间"
|
|
|
- align="center"
|
|
|
- prop="createTime"
|
|
|
- width="200"
|
|
|
- >
|
|
|
+ }">
|
|
|
+ <el-table-column prop="deptName" label="机构名称" width="260"></el-table-column>
|
|
|
+ <el-table-column prop="orderNum" label="排序" width="100"></el-table-column>
|
|
|
+ <el-table-column prop="type" label="机构类型" width="100" :formatter="(row) => showType(row.type)"> </el-table-column>
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- class-name="small-padding fixed-width"
|
|
|
- >
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
- <el-button
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- @click="getDtl(scope.row)"
|
|
|
-
|
|
|
- >修改</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- @click="handleAdd(scope.row)"
|
|
|
-
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- v-if="scope.row.parentId != 0"
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- @click="listDelete(scope.row)"
|
|
|
-
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
+ <el-button link type="primary" @click="getDtl(scope.row)">修改</el-button>
|
|
|
+ <el-button link type="primary" @click="handleAdd(scope.row)">新增</el-button>
|
|
|
+ <el-button v-if="scope.row.parentId != 0" link type="primary" @click="listDelete(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
- <el-dialog
|
|
|
- :title="modalType == 'add' ? '新增' : '编辑'"
|
|
|
- v-model="dialogVisible"
|
|
|
- width="500"
|
|
|
- v-loading="loading"
|
|
|
- >
|
|
|
- <byForm
|
|
|
- :formConfig="formConfig"
|
|
|
- :formOption="formOption"
|
|
|
- v-model="formData.data"
|
|
|
- :rules="rules"
|
|
|
- ref="byform"
|
|
|
- >
|
|
|
+ <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-model="dialogVisible" width="500" v-loading="loading">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
|
|
|
<template #account>
|
|
|
- <el-input
|
|
|
- style="width: 150px; margin-right: 10px"
|
|
|
- v-model="formData.data.userName"
|
|
|
- placeholder="请输入用户名"
|
|
|
- ></el-input>
|
|
|
- <el-input
|
|
|
- style="width: 150px; margin-right: 10px"
|
|
|
- v-model="formData.data.password"
|
|
|
- placeholder="密码"
|
|
|
- ></el-input>
|
|
|
- <span style="color: #409eff; cursor: pointer" @click="newPassword"
|
|
|
- >随机生成</span
|
|
|
- >
|
|
|
+ <el-input style="width: 150px; margin-right: 10px" v-model="formData.data.userName" placeholder="请输入用户名"></el-input>
|
|
|
+ <el-input style="width: 150px; margin-right: 10px" v-model="formData.data.password" placeholder="密码"></el-input>
|
|
|
+ <span style="color: #409eff; cursor: pointer" @click="newPassword">随机生成</span>
|
|
|
</template>
|
|
|
</byForm>
|
|
|
<template #footer>
|
|
|
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="submitForm('byform')"
|
|
|
- size="large"
|
|
|
- :loading="submitLoading"
|
|
|
- >
|
|
|
- 确 定
|
|
|
- </el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog
|
|
|
- title="修改密码"
|
|
|
- v-model="roomDialogVisible"
|
|
|
- width="500"
|
|
|
- :before-close="handleClose"
|
|
|
- v-loading="loading"
|
|
|
- >
|
|
|
+ <el-dialog title="修改密码" v-model="roomDialogVisible" width="500" :before-close="handleClose" v-loading="loading">
|
|
|
<template #footer>
|
|
|
- <el-button @click="roomDialogVisible = false" size="large"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="submitTree('byform')"
|
|
|
- size="large"
|
|
|
- :loading="submitLoading"
|
|
|
- >
|
|
|
- 确 定
|
|
|
- </el-button>
|
|
|
+ <el-button @click="roomDialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitTree('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<script setup>
|
|
|
/* eslint-disable vue/no-unused-components */
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
@@ -191,7 +98,7 @@ let rules = ref({
|
|
|
parentId: [{ required: true, message: "请选择上级机构", trigger: "blur" }],
|
|
|
orderNum: [{ required: true, message: "排序不能为空", trigger: "blur" }],
|
|
|
deptName: [{ required: true, message: "机构名称不能为空", trigger: "blur" }],
|
|
|
- type: [{ required: true, message: "机构类型不能为空", trigger: "blur" }],
|
|
|
+ type: [{ required: true, message: "机构类型不能为空", trigger: "change" }],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const selectConfig = computed(() => {
|
|
@@ -213,13 +120,7 @@ const config = computed(() => {
|
|
|
},
|
|
|
|
|
|
render(type) {
|
|
|
- return type == "0"
|
|
|
- ? "公司"
|
|
|
- : type == "1"
|
|
|
- ? "业务中心"
|
|
|
- : type == "2"
|
|
|
- ? "部门"
|
|
|
- : "组";
|
|
|
+ return type == 0 ? "公司" : type == 1 ? "业务中心" : type == 2 ? "部门" : "组";
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -271,7 +172,7 @@ const config = computed(() => {
|
|
|
|
|
|
let formData = reactive({
|
|
|
data: {
|
|
|
- orderNum:1,
|
|
|
+ orderNum: 1,
|
|
|
},
|
|
|
});
|
|
|
const formOption = reactive({
|
|
@@ -299,29 +200,27 @@ const formConfig = computed(() => {
|
|
|
//disabled:true,
|
|
|
itemType: "text",
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
type: "select",
|
|
|
prop: "type",
|
|
|
label: "机构类型",
|
|
|
required: true,
|
|
|
-
|
|
|
data: [
|
|
|
{
|
|
|
label: "公司",
|
|
|
- id: 0,
|
|
|
+ value: 0,
|
|
|
},
|
|
|
{
|
|
|
label: "业务中心",
|
|
|
- id: 1,
|
|
|
+ value: 1,
|
|
|
},
|
|
|
{
|
|
|
label: "部门",
|
|
|
- id: 2,
|
|
|
+ value: 2,
|
|
|
},
|
|
|
{
|
|
|
label: "组",
|
|
|
- id: 3,
|
|
|
+ value: 3,
|
|
|
},
|
|
|
],
|
|
|
},
|
|
@@ -330,14 +229,14 @@ const formConfig = computed(() => {
|
|
|
label: "负责人",
|
|
|
prop: "leaderId",
|
|
|
itemWidth: 50,
|
|
|
- data:[],
|
|
|
+ data: [],
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
label: "总监",
|
|
|
prop: "directorId",
|
|
|
itemWidth: 50,
|
|
|
- data:[],
|
|
|
+ data: [],
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
@@ -386,7 +285,7 @@ const getList = async (req) => {
|
|
|
sourceList.value.data = proxy.handleTree(message.data, "deptId");
|
|
|
console.log(sourceList.value);
|
|
|
formConfig.value[0].data = proxy.handleTree(message.data, "deptId");
|
|
|
- console.log(formConfig.value[0].data)
|
|
|
+ console.log(formConfig.value[0].data);
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
|
}, 200);
|
|
@@ -412,9 +311,9 @@ const openModal = () => {
|
|
|
dialogVisible.value = true;
|
|
|
modalType.value = "add";
|
|
|
formData.data = {
|
|
|
- orderNum:1,
|
|
|
+ orderNum: 1,
|
|
|
};
|
|
|
- getUserList()
|
|
|
+ getUserList();
|
|
|
};
|
|
|
const TreetenantId = ref("");
|
|
|
const selection = ref({
|
|
@@ -437,9 +336,7 @@ const submitForm = () => {
|
|
|
"/tenantDept",
|
|
|
{
|
|
|
...formData.data,
|
|
|
- tenantId: formData.data.tenantId
|
|
|
- ? formData.data.tenantId
|
|
|
- : sourceList.value.pagination.tenantId,
|
|
|
+ tenantId: formData.data.tenantId ? formData.data.tenantId : sourceList.value.pagination.tenantId,
|
|
|
},
|
|
|
method
|
|
|
)
|
|
@@ -484,18 +381,12 @@ const listDelete = (row) => {
|
|
|
});
|
|
|
};
|
|
|
const showType = (type) => {
|
|
|
- return type == "0"
|
|
|
- ? "公司"
|
|
|
- : type == "1"
|
|
|
- ? "业务中心"
|
|
|
- : type == "2"
|
|
|
- ? "部门"
|
|
|
- : "组";
|
|
|
+ return type == 0 ? "公司" : type == 1 ? "业务中心" : type == 2 ? "部门" : "组";
|
|
|
};
|
|
|
const getDtl = (row) => {
|
|
|
formData.data = { ...row };
|
|
|
modalType.value = "edit";
|
|
|
- getUserList()
|
|
|
+ getUserList();
|
|
|
dialogVisible.value = true;
|
|
|
};
|
|
|
|
|
@@ -513,16 +404,14 @@ const getUserList = () => {
|
|
|
});
|
|
|
formConfig.value[3].data = message.rows;
|
|
|
formConfig.value[4].data = message.rows;
|
|
|
- console.log(config)
|
|
|
+ console.log(config);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
getTreeList();
|
|
|
getList();
|
|
|
</script>
|
|
|
-
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.dept {
|
|
|
padding: 20px;
|
|
@@ -535,4 +424,4 @@ getList();
|
|
|
width: calc(100% - 320px);
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|