From ece2dfeb926d728b10db38038e4d12e9e9851c24 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期五, 06 六月 2025 17:38:10 +0800 Subject: [PATCH] 分页修改 --- src/views/system/dept/index.vue | 133 ++++++++++++++++++++++++------------------- 1 files changed, 74 insertions(+), 59 deletions(-) diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index af51c50..e5c888f 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -89,7 +89,6 @@ value-key="deptId" placeholder="閫夋嫨涓婄骇閮ㄩ棬" check-strictly - :render-after-expand="false" /> </el-form-item> </el-col> @@ -124,11 +123,16 @@ <el-radio v-for="dict in sys_normal_disable" :key="dict.value" - :label="dict.value" + :value="dict.value" >{{ dict.label }}</el-radio> </el-radio-group> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="閮ㄩ棬缂栧彿" prop="deptNick"> + <el-input v-model="form.deptNick" placeholder="璇疯緭鍏ラ儴闂ㄧ紪鍙�" maxlength="50" /> + </el-form-item> + </el-col> </el-row> </el-form> <template #footer> @@ -142,19 +146,19 @@ </template> <script setup name="Dept"> -import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; +import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const deptList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const title = ref(""); -const deptOptions = ref([]); -const isExpandAll = ref(true); -const refreshTable = ref(true); +const deptList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const title = ref("") +const deptOptions = ref([]) +const isExpandAll = ref(true) +const refreshTable = ref(true) const data = reactive({ form: {}, @@ -167,25 +171,28 @@ deptName: [{ required: true, message: "閮ㄩ棬鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }], orderNum: [{ required: true, message: "鏄剧ず鎺掑簭涓嶈兘涓虹┖", trigger: "blur" }], email: [{ type: "email", message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], - phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] + phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }], + deptNick: [{ required: true, message: "閮ㄩ棬缂栧彿涓嶈兘涓虹┖", trigger: "blur" }], }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ閮ㄩ棬鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listDept(queryParams.value).then(response => { - deptList.value = proxy.handleTree(response.data, "deptId"); - loading.value = false; - }); + deptList.value = proxy.handleTree(response.data, "deptId") + loading.value = false + }) } + /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } + /** 琛ㄥ崟閲嶇疆 */ function reset() { form.value = { @@ -196,80 +203,88 @@ leader: undefined, phone: undefined, email: undefined, - status: "0" - }; - proxy.resetForm("deptRef"); + status: "0", + deptNick: undefined, + } + proxy.resetForm("deptRef") } + /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - getList(); + getList() } + /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } + /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd(row) { - reset(); + reset() listDept().then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); - }); + deptOptions.value = proxy.handleTree(response.data, "deptId") + }) if (row != undefined) { - form.value.parentId = row.deptId; + form.value.parentId = row.deptId } - open.value = true; - title.value = "娣诲姞閮ㄩ棬"; + open.value = true + title.value = "娣诲姞閮ㄩ棬" } + /** 灞曞紑/鎶樺彔鎿嶄綔 */ function toggleExpandAll() { - refreshTable.value = false; - isExpandAll.value = !isExpandAll.value; + refreshTable.value = false + isExpandAll.value = !isExpandAll.value nextTick(() => { - refreshTable.value = true; - }); + refreshTable.value = true + }) } + /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); + reset() listDeptExcludeChild(row.deptId).then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); - }); + deptOptions.value = proxy.handleTree(response.data, "deptId") + }) getDept(row.deptId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼閮ㄩ棬"; - }); + form.value = response.data + open.value = true + title.value = "淇敼閮ㄩ棬" + }) } + /** 鎻愪氦鎸夐挳 */ function submitForm() { proxy.$refs["deptRef"].validate(valid => { if (valid) { if (form.value.deptId != undefined) { updateDept(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addDept(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { proxy.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」?').then(function() { - return delDept(row.deptId); + return delDept(row.deptId) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> -- Gitblit v1.9.3