diff --git a/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java b/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java
index 635aca0..a21e778 100644
--- a/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java
+++ b/yanzhu-manage/src/main/java/com/yanzhu/base/controller/BaseAssetsTypeController.java
@@ -5,8 +5,12 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletResponse;
import com.yanzhu.common.constant.Constants;
+import com.yanzhu.common.core.domain.entity.SysDept;
import com.yanzhu.common.core.domain.entity.SysUser;
import com.yanzhu.common.core.redis.RedisCache;
+import com.yanzhu.system.service.ISysDeptService;
+
+
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -38,7 +42,8 @@ public class BaseAssetsTypeController extends BaseController
{
@Autowired
private IBaseAssetsTypeService baseAssetsTypeService;
-
+ @Autowired
+ private ISysDeptService sysDeptService;
@Autowired
private RedisCache redisCache;
@@ -97,9 +102,30 @@ public class BaseAssetsTypeController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody BaseAssetsType baseAssetsType)
{
+ updateDeptUnit(baseAssetsType);
return toAjax(baseAssetsTypeService.insertBaseAssetsType(baseAssetsType));
}
+ void updateDeptUnit(BaseAssetsType baseAssetsType){
+ long deptId= baseAssetsType.getDeptId();
+ String unit=baseAssetsType.getUnit();
+ if(unit==null || unit.trim().length()==0){
+ unit="";
+ }
+ String[] tmps= unit.split("[|]");
+ baseAssetsType.setUnit("");
+ if(tmps.length>0){
+ baseAssetsType.setUnit(tmps[0]);
+ }
+ if(tmps.length>1){
+ SysDept dept= sysDeptService.selectDeptById(deptId);
+ if(dept!=null){
+ dept.setUnit(tmps[1]);
+ sysDeptService.updateDept(dept);
+ }
+ }
+ }
+
/**
* 修改物资类型
*/
@@ -108,6 +134,7 @@ public class BaseAssetsTypeController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody BaseAssetsType baseAssetsType)
{
+ updateDeptUnit(baseAssetsType);
return toAjax(baseAssetsTypeService.updateBaseAssetsType(baseAssetsType));
}
diff --git a/yanzhu-ui/src/views/base/assetsType/index.vue b/yanzhu-ui/src/views/base/assetsType/index.vue
index c11125e..5516c25 100644
--- a/yanzhu-ui/src/views/base/assetsType/index.vue
+++ b/yanzhu-ui/src/views/base/assetsType/index.vue
@@ -8,8 +8,8 @@
-
-
+
+
@@ -53,7 +53,7 @@
-
+
@@ -69,10 +69,10 @@
- 修改
- 删除
+ 修改
+ 删除
@@ -82,15 +82,15 @@
@pagination="getList" />
-
+
-
+
-
+
-
+
@@ -98,16 +98,22 @@
-
+
-
-
-
+
+
+
+
+
+
+ {{ it.text }}
+
+