| | |
| | | :expand-on-click-node="false"
|
| | | :filter-node-method="filterNode"
|
| | | ref="deptTreeRef"
|
| | | node-key="id"
|
| | | highlight-current
|
| | | default-expand-all
|
| | | @node-click="handleNodeClick"
|
| | | />
|
| | |
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="归属部门" prop="deptId">
|
| | | <tree-select
|
| | | v-model:value="form.deptId"
|
| | | :options="deptOptions"
|
| | | <el-tree-select
|
| | | v-model="form.deptId"
|
| | | :data="deptOptions"
|
| | | :props="{ value: 'id', label: 'label', children: 'children' }"
|
| | | value-key="id"
|
| | | placeholder="请选择归属部门"
|
| | | :objMap="{ value: 'id', label: 'label', children: 'children' }"
|
| | | check-strictly
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | |
| | |
|
| | | <script setup name="User">
|
| | | import { getToken } from "@/utils/auth";
|
| | | import { treeselect } from "@/api/system/dept";
|
| | | import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser } from "@/api/system/user";
|
| | | import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
|
| | |
|
| | | const router = useRouter();
|
| | | const { proxy } = getCurrentInstance();
|
| | |
| | | proxy.$refs["deptTreeRef"].filter(val);
|
| | | });
|
| | | /** 查询部门下拉树结构 */
|
| | | function getTreeselect() {
|
| | | treeselect().then(response => {
|
| | | function getDeptTree() {
|
| | | deptTreeSelect().then(response => {
|
| | | deptOptions.value = response.data;
|
| | | });
|
| | | };
|
| | |
| | | function resetQuery() {
|
| | | dateRange.value = [];
|
| | | proxy.resetForm("queryRef");
|
| | | queryParams.value.deptId = undefined;
|
| | | proxy.$refs.tree.setCurrentKey(null);
|
| | | handleQuery();
|
| | | };
|
| | | /** 删除按钮操作 */
|
| | |
| | | const handleFileSuccess = (response, file, fileList) => {
|
| | | upload.open = false;
|
| | | upload.isUploading = false;
|
| | | proxy.$refs["uploadRef"].clearFiles();
|
| | | proxy.$refs["uploadRef"].handleRemove(file);
|
| | | proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
| | | getList();
|
| | | };
|
| | | /** 提交上传文件 */
|
| | | function submitFileForm() {
|
| | | proxy.$refs["uploadRef"].submit();
|
| | | };
|
| | | /** 初始化部门数据 */
|
| | | function initTreeData() {
|
| | | // 判断部门的数据是否存在,存在不获取,不存在则获取
|
| | | if (deptOptions.value === undefined) {
|
| | | treeselect().then(response => {
|
| | | deptOptions.value = response.data;
|
| | | });
|
| | | }
|
| | | };
|
| | | /** 重置操作表单 */
|
| | | function reset() {
|
| | |
| | | /** 新增按钮操作 */
|
| | | function handleAdd() {
|
| | | reset();
|
| | | initTreeData();
|
| | | getUser().then(response => {
|
| | | postOptions.value = response.posts;
|
| | | roleOptions.value = response.roles;
|
| | |
| | | /** 修改按钮操作 */
|
| | | function handleUpdate(row) {
|
| | | reset();
|
| | | initTreeData();
|
| | | const userId = row.userId || ids.value;
|
| | | getUser(userId).then(response => {
|
| | | form.value = response.data;
|
| | |
| | | });
|
| | | };
|
| | |
|
| | | getTreeselect();
|
| | | getDeptTree();
|
| | | getList();
|
| | | </script>
|