Files
education/frontend/node_modules/.cache/vue-loader/94280b86c0a9cdf31e5ce5414d39c4e3.json
T

1 line
17 KiB
JSON

{"remainingRequest":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\Admin\\Desktop\\education\\frontend\\src\\views\\system\\dept\\index.vue?vue&type=style&index=0&id=e6913484&scoped=true&lang=css","dependencies":[{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\src\\views\\system\\dept\\index.vue","mtime":1787567871655},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\css-loader\\dist\\cjs.js","mtime":1787309792478},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1787309794547},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\postcss-loader\\src\\index.js","mtime":1787309793084},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1787309791955},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\index.js","mtime":1787309793790}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.vue","sourceRoot":"src/views/system/dept","sourcesContent":["<template>\r\n <div class=\"app-container system-dept\">\r\n <el-form :model=\"queryParams\" ref=\"queryForm\" size=\"small\" :inline=\"true\" v-show=\"showSearch\">\r\n <el-form-item label=\"部门名称\" prop=\"deptName\">\r\n <el-input\r\n v-model=\"queryParams.deptName\"\r\n placeholder=\"请输入部门名称\"\r\n clearable\r\n @keyup.enter.native=\"handleQuery\"\r\n />\r\n </el-form-item>\r\n <el-form-item label=\"状态\" prop=\"status\">\r\n <el-select v-model=\"queryParams.status\" placeholder=\"部门状态\" clearable>\r\n <el-option\r\n v-for=\"dict in dict.type.sys_normal_disable\"\r\n :key=\"dict.value\"\r\n :label=\"dict.label\"\r\n :value=\"dict.value\"\r\n />\r\n </el-select>\r\n </el-form-item>\r\n <el-form-item>\r\n <el-button type=\"primary\" icon=\"el-icon-search\" size=\"mini\" @click=\"handleQuery\">搜索</el-button>\r\n <el-button icon=\"el-icon-refresh\" size=\"mini\" @click=\"resetQuery\">重置</el-button>\r\n </el-form-item>\r\n </el-form>\r\n\r\n <el-row :gutter=\"10\" class=\"mb8\">\r\n <el-col :span=\"1.5\">\r\n <el-button\r\n type=\"primary\"\r\n plain\r\n icon=\"el-icon-plus\"\r\n size=\"mini\"\r\n @click=\"handleAdd\"\r\n v-hasPermi=\"['system:dept:add']\"\r\n >新增</el-button>\r\n </el-col>\r\n <el-col :span=\"1.5\">\r\n <el-button\r\n type=\"warning\"\r\n plain\r\n icon=\"el-icon-check\"\r\n size=\"mini\"\r\n @click=\"handleSaveSort\"\r\n v-hasPermi=\"['system:dept:edit']\"\r\n >保存排序</el-button>\r\n </el-col>\r\n <el-col :span=\"1.5\">\r\n <el-button\r\n type=\"info\"\r\n plain\r\n icon=\"el-icon-sort\"\r\n size=\"mini\"\r\n @click=\"toggleExpandAll\"\r\n >展开/折叠</el-button>\r\n </el-col>\r\n <right-toolbar :showSearch.sync=\"showSearch\" @queryTable=\"getList\"></right-toolbar>\r\n </el-row>\r\n\r\n <el-table\r\n v-if=\"refreshTable\"\r\n v-loading=\"loading\"\r\n :data=\"deptList\"\r\n :height=\"tableHeight\"\r\n row-key=\"deptId\"\r\n :default-expand-all=\"isExpandAll\"\r\n :tree-props=\"{children: 'children', hasChildren: 'hasChildren'}\"\r\n >\r\n <el-table-column prop=\"deptName\" label=\"部门名称\" width=\"260\"></el-table-column>\r\n <el-table-column prop=\"orderNum\" label=\"排序\" width=\"200\">\r\n <template slot-scope=\"scope\">\r\n <el-input-number v-model=\"scope.row.orderNum\" controls-position=\"right\" :min=\"0\" size=\"mini\" style=\"width: 88px\" />\r\n </template>\r\n </el-table-column>\r\n <el-table-column prop=\"status\" label=\"状态\" width=\"100\">\r\n <template slot-scope=\"scope\">\r\n <dict-tag :options=\"dict.type.sys_normal_disable\" :value=\"scope.row.status\"/>\r\n </template>\r\n </el-table-column>\r\n <el-table-column label=\"创建时间\" align=\"center\" prop=\"createTime\" width=\"200\">\r\n <template slot-scope=\"scope\">\r\n <span>{{ parseTime(scope.row.createTime) }}</span>\r\n </template>\r\n </el-table-column>\r\n <el-table-column label=\"操作\" align=\"center\" class-name=\"small-padding fixed-width\">\r\n <template slot-scope=\"scope\">\r\n <el-button\r\n size=\"mini\"\r\n type=\"text\"\r\n icon=\"el-icon-edit\"\r\n @click=\"handleUpdate(scope.row)\"\r\n v-hasPermi=\"['system:dept:edit']\"\r\n >修改</el-button>\r\n <el-button\r\n size=\"mini\"\r\n type=\"text\"\r\n icon=\"el-icon-plus\"\r\n @click=\"handleAdd(scope.row)\"\r\n v-hasPermi=\"['system:dept:add']\"\r\n >新增</el-button>\r\n <el-button\r\n v-if=\"scope.row.parentId != 0\"\r\n size=\"mini\"\r\n type=\"text\"\r\n icon=\"el-icon-delete\"\r\n @click=\"handleDelete(scope.row)\"\r\n v-hasPermi=\"['system:dept:remove']\"\r\n >删除</el-button>\r\n </template>\r\n </el-table-column>\r\n </el-table>\r\n\r\n <!-- 添加或修改部门对话框 -->\r\n <el-dialog :title=\"title\" :visible.sync=\"open\" width=\"600px\" append-to-body>\r\n <el-form ref=\"form\" :model=\"form\" :rules=\"rules\" label-width=\"80px\">\r\n <el-row>\r\n <el-col :span=\"24\" v-if=\"form.parentId !== 0\">\r\n <el-form-item label=\"上级部门\" prop=\"parentId\">\r\n <treeselect v-model=\"form.parentId\" :options=\"deptOptions\" :normalizer=\"normalizer\" placeholder=\"选择上级部门\" />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"部门名称\" prop=\"deptName\">\r\n <el-input v-model=\"form.deptName\" placeholder=\"请输入部门名称\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"显示排序\" prop=\"orderNum\">\r\n <el-input-number v-model=\"form.orderNum\" controls-position=\"right\" :min=\"0\" />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"负责人\" prop=\"leader\">\r\n <el-input v-model=\"form.leader\" placeholder=\"请输入负责人\" maxlength=\"20\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"联系电话\" prop=\"phone\">\r\n <el-input v-model=\"form.phone\" placeholder=\"请输入联系电话\" maxlength=\"11\" />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"邮箱\" prop=\"email\">\r\n <el-input v-model=\"form.email\" placeholder=\"请输入邮箱\" maxlength=\"50\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"部门状态\">\r\n <el-radio-group v-model=\"form.status\">\r\n <el-radio\r\n v-for=\"dict in dict.type.sys_normal_disable\"\r\n :key=\"dict.value\"\r\n :label=\"dict.value\"\r\n >{{dict.label}}</el-radio>\r\n </el-radio-group>\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n </el-form>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button type=\"primary\" @click=\"submitForm\">确 定</el-button>\r\n <el-button @click=\"cancel\">取 消</el-button>\r\n </div>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { listDept, getDept, delDept, addDept, updateDept, updateDeptSort, listDeptExcludeChild } from \"@/api/system/dept\"\r\nimport Treeselect from \"@riophae/vue-treeselect\"\r\nimport \"@riophae/vue-treeselect/dist/vue-treeselect.css\"\r\n\r\nexport default {\r\n name: \"Dept\",\r\n dicts: ['sys_normal_disable'],\r\n components: { Treeselect },\r\n data() {\r\n return {\r\n // 遮罩层\r\n loading: true,\r\n // 显示搜索条件\r\n showSearch: true,\r\n // 表格高度\r\n tableHeight: window.innerHeight - 240,\r\n // 表格树数据\r\n deptList: [],\r\n // 部门树选项\r\n deptOptions: [],\r\n // 弹出层标题\r\n title: \"\",\r\n // 是否显示弹出层\r\n open: false,\r\n // 是否展开,默认全部展开\r\n isExpandAll: true,\r\n // 重新渲染表格状态\r\n refreshTable: true,\r\n // 记录原始排序,用于对比变更\r\n originalOrders: {},\r\n // 查询参数\r\n queryParams: {\r\n deptName: undefined,\r\n status: undefined\r\n },\r\n // 表单参数\r\n form: {},\r\n // 表单校验\r\n rules: {\r\n parentId: [\r\n { required: true, message: \"上级部门不能为空\", trigger: \"blur\" }\r\n ],\r\n deptName: [\r\n { required: true, message: \"部门名称不能为空\", trigger: \"blur\" }\r\n ],\r\n orderNum: [\r\n { required: true, message: \"显示排序不能为空\", trigger: \"blur\" }\r\n ],\r\n email: [\r\n {\r\n type: \"email\",\r\n message: \"请输入正确的邮箱地址\",\r\n trigger: [\"blur\", \"change\"]\r\n }\r\n ],\r\n phone: [\r\n {\r\n pattern: /^1[3|4|5|6|7|8|9][0-9]\\d{8}$/,\r\n message: \"请输入正确的手机号码\",\r\n trigger: \"blur\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n created() {\r\n this.getList()\r\n },\r\n mounted() {\r\n this.getTableHeight()\r\n window.addEventListener('resize', this.getTableHeight)\r\n },\r\n beforeDestroy() {\r\n window.removeEventListener('resize', this.getTableHeight)\r\n },\r\n watch: {\r\n showSearch() {\r\n this.$nextTick(() => {\r\n this.getTableHeight()\r\n })\r\n }\r\n },\r\n methods: {\r\n getTableHeight() {\r\n const offset = this.showSearch ? 240 : 190\r\n this.tableHeight = window.innerHeight - offset\r\n },\r\n /** 查询部门列表 */\r\n getList() {\r\n this.loading = true\r\n listDept(this.queryParams).then(response => {\r\n this.deptList = this.handleTree(response.data, \"deptId\")\r\n // 记录原始排序值\r\n this.recordOriginalOrders(this.deptList)\r\n this.loading = false\r\n })\r\n },\r\n /** 转换部门数据结构 */\r\n normalizer(node) {\r\n if (node.children && !node.children.length) {\r\n delete node.children\r\n }\r\n return {\r\n id: node.deptId,\r\n label: node.deptName,\r\n children: node.children\r\n }\r\n },\r\n // 取消按钮\r\n cancel() {\r\n this.open = false\r\n this.reset()\r\n },\r\n // 表单重置\r\n reset() {\r\n this.form = {\r\n deptId: undefined,\r\n parentId: undefined,\r\n deptName: undefined,\r\n orderNum: undefined,\r\n leader: undefined,\r\n phone: undefined,\r\n email: undefined,\r\n status: \"0\"\r\n }\r\n this.resetForm(\"form\")\r\n },\r\n /** 搜索按钮操作 */\r\n handleQuery() {\r\n this.getList()\r\n },\r\n /** 重置按钮操作 */\r\n resetQuery() {\r\n this.resetForm(\"queryForm\")\r\n this.handleQuery()\r\n },\r\n /** 新增按钮操作 */\r\n handleAdd(row) {\r\n this.reset()\r\n if (row != undefined) {\r\n this.form.parentId = row.deptId\r\n }\r\n this.open = true\r\n this.title = \"添加部门\"\r\n listDept().then(response => {\r\n this.deptOptions = this.handleTree(response.data, \"deptId\")\r\n })\r\n },\r\n /** 展开/折叠操作 */\r\n toggleExpandAll() {\r\n this.refreshTable = false\r\n this.isExpandAll = !this.isExpandAll\r\n this.$nextTick(() => {\r\n this.refreshTable = true\r\n })\r\n },\r\n /** 修改按钮操作 */\r\n handleUpdate(row) {\r\n this.reset()\r\n getDept(row.deptId).then(response => {\r\n this.form = response.data\r\n this.open = true\r\n this.title = \"修改部门\"\r\n listDeptExcludeChild(row.deptId).then(response => {\r\n this.deptOptions = this.handleTree(response.data, \"deptId\")\r\n if (this.deptOptions.length == 0) {\r\n const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] }\r\n this.deptOptions.push(noResultsOptions)\r\n }\r\n })\r\n })\r\n },\r\n /** 提交按钮 */\r\n submitForm() {\r\n this.$refs[\"form\"].validate(valid => {\r\n if (valid) {\r\n if (this.form.deptId != undefined) {\r\n updateDept(this.form).then(() => {\r\n this.$modal.msgSuccess(\"修改成功\")\r\n this.open = false\r\n this.getList()\r\n })\r\n } else {\r\n addDept(this.form).then(() => {\r\n this.$modal.msgSuccess(\"新增成功\")\r\n this.open = false\r\n this.getList()\r\n })\r\n }\r\n }\r\n })\r\n },\r\n /** 递归记录原始排序 */\r\n recordOriginalOrders(list) {\r\n list.forEach(item => {\r\n this.originalOrders[item.deptId] = item.orderNum\r\n if (item.children && item.children.length) {\r\n this.recordOriginalOrders(item.children)\r\n }\r\n })\r\n },\r\n /** 保存排序 */\r\n handleSaveSort() {\r\n const changedDeptIds = []\r\n const changedOrderNums = []\r\n const collectChanged = (list) => {\r\n list.forEach(item => {\r\n if (String(this.originalOrders[item.deptId]) !== String(item.orderNum)) {\r\n changedDeptIds.push(item.deptId)\r\n changedOrderNums.push(item.orderNum)\r\n }\r\n if (item.children && item.children.length) {\r\n collectChanged(item.children)\r\n }\r\n })\r\n }\r\n collectChanged(this.deptList)\r\n if (changedDeptIds.length === 0) {\r\n this.$modal.msgWarning(\"未检测到排序修改\")\r\n return\r\n }\r\n updateDeptSort({ deptIds: changedDeptIds.join(\",\"), orderNums: changedOrderNums.join(\",\") }).then(() => {\r\n this.$modal.msgSuccess(\"排序保存成功\")\r\n this.recordOriginalOrders(this.deptList)\r\n })\r\n },\r\n /** 删除按钮操作 */\r\n handleDelete(row) {\r\n this.$modal.confirm('是否确认删除名称为\"' + row.deptName + '\"的数据项?').then(function() {\r\n return delDept(row.deptId)\r\n }).then(() => {\r\n this.getList()\r\n this.$modal.msgSuccess(\"删除成功\")\r\n }).catch(() => {})\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.system-dept ::v-deep .el-table ::-webkit-scrollbar {\r\n display: none;\r\n}\r\n.system-dept ::v-deep .el-table {\r\n scrollbar-width: none;\r\n -ms-overflow-style: none;\r\n}\r\n.system-dept ::v-deep .el-table__body-wrapper::-webkit-scrollbar {\r\n display: none;\r\n}\r\n.system-dept ::v-deep .el-table__body-wrapper {\r\n scrollbar-width: none;\r\n -ms-overflow-style: none;\r\n}\r\n</style>\r\n"]}]}