瀏覽代碼

装置信息 - “新增”操作默认带出本装置

wangggziwen 8 月之前
父節點
當前提交
0bf330ebc7

+ 9 - 0
rc-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -53,6 +53,15 @@ public class SysUserController extends BaseController
     @Autowired
     private ISysPostService postService;
 
+    /**
+     * 获取用户部门编号
+     */
+    @GetMapping("/userDeptId")
+    public AjaxResult getUserDeptId()
+    {
+        return success(getLoginUser().getDeptId());
+    }
+
     /**
      * 获取全部用户列表
      */

+ 8 - 0
ruoyi-ui/src/api/system/user.js

@@ -1,6 +1,14 @@
 import request from '@/utils/request'
 import { parseStrEmpty } from "@/utils/ruoyi";
 
+// 获取用户部门编号
+export function getUserDeptId() {
+  return request({
+    url: '/system/user/userDeptId',
+    method: 'get'
+  })
+}
+
 // 查询全部用户列表
 export function listAllUser(query) {
   return request({

+ 7 - 3
ruoyi-ui/src/views/rc/deptinfo/index.vue

@@ -206,6 +206,7 @@
 <script>
 import { listDeptinfo, getDeptinfo, delDeptinfo, addDeptinfo, updateDeptinfo } from "@/api/rc/deptinfo";
 import { listDept } from "@/api/system/dept";
+import { getUserDeptId } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 import { addCommonfile, allFileList, delCommonfile, updateCommonfile } from "@/api/rc/commonfile";
 
@@ -397,9 +398,12 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加装置信息";
+      getUserDeptId().then(response => {
+        this.reset();
+        this.form.deptId = response.data + "";
+        this.open = true;
+        this.title = "添加装置信息";
+      });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {