Commit 7f5a4903 authored by 耿迪迪's avatar 耿迪迪

项目维护中心部门选择

parent 25facd47
...@@ -3,6 +3,7 @@ package com.zehong.web.controller.transaction; ...@@ -3,6 +3,7 @@ package com.zehong.web.controller.transaction;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser; import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
...@@ -15,10 +16,12 @@ import com.zehong.system.domain.TTransactionProject; ...@@ -15,10 +16,12 @@ import com.zehong.system.domain.TTransactionProject;
import com.zehong.system.service.ITTransactionProjectService; import com.zehong.system.service.ITTransactionProjectService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 交易项目Controller * 交易项目Controller
...@@ -45,7 +48,8 @@ public class TTransactionProjectController extends BaseController ...@@ -45,7 +48,8 @@ public class TTransactionProjectController extends BaseController
startPage(); startPage();
// 获取当前用户 // 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser(); SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) { List<SysRole> roles =user.getRoles().stream().filter(item -> "calculator".equals(item.getRoleKey())).collect(Collectors.toList());
if (StringUtils.isNotNull(user) && !user.isAdmin() && CollectionUtils.isEmpty(roles)) {
tTransactionProject.setDeptId(user.getDeptId()); tTransactionProject.setDeptId(user.getDeptId());
} }
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject); List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
...@@ -119,10 +123,10 @@ public class TTransactionProjectController extends BaseController ...@@ -119,10 +123,10 @@ public class TTransactionProjectController extends BaseController
public AjaxResult add(@RequestBody TTransactionProject tTransactionProject) public AjaxResult add(@RequestBody TTransactionProject tTransactionProject)
{ {
// 获取当前用户 // 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser(); /* SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) { if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId()); tTransactionProject.setDeptId(user.getDeptId());
} }*/
return toAjax(tTransactionProjectService.insertTTransactionProject(tTransactionProject)); return toAjax(tTransactionProjectService.insertTTransactionProject(tTransactionProject));
} }
......
...@@ -146,11 +146,11 @@ ...@@ -146,11 +146,11 @@
<el-input v-model="form.transactionProjectName" placeholder="请输入交易项目名称" /> <el-input v-model="form.transactionProjectName" placeholder="请输入交易项目名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!--<el-col :span="12"> <el-col :span="12">
<el-form-item label="交易细项名称" prop="transactionItemName"> <el-form-item label="归属部门" prop="deptId">
<el-input v-model="form.transactionItemName" placeholder="请输入交易细项名称" /> <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>
</el-form-item> </el-form-item>
</el-col>--> </el-col>
</el-row> </el-row>
<el-form-item label="职责项明细说明" prop="dutyDetailDescribe"> <el-form-item label="职责项明细说明" prop="dutyDetailDescribe">
...@@ -206,6 +206,11 @@ ...@@ -206,6 +206,11 @@
{{detailInfo.transactionProjectName}} {{detailInfo.transactionProjectName}}
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="归属部门">
{{detailInfo.deptName}}
</el-form-item>
</el-col>
</el-row> </el-row>
<el-divider></el-divider> <el-divider></el-divider>
<el-row> <el-row>
...@@ -373,6 +378,9 @@ export default { ...@@ -373,6 +378,9 @@ export default {
transactionProjectName: [ transactionProjectName: [
{ required: true, message: "交易项目名称不能为空", trigger: "blur" } { required: true, message: "交易项目名称不能为空", trigger: "blur" }
], ],
deptId: [
{ required: true, message: "请选择归属部门", trigger: "change" }
],
dutyDetailDescribe: [ dutyDetailDescribe: [
{ required: true, message: "职责项明细说明不能为空", trigger: "blur" } { required: true, message: "职责项明细说明不能为空", trigger: "blur" }
], ],
...@@ -413,7 +421,7 @@ export default { ...@@ -413,7 +421,7 @@ export default {
}; };
}, },
created() { created() {
if(this.$store.state.user.userId != 1){ if(this.$store.state.user.userId != 1 && this.$store.state.user.roles.findIndex(item => "calculator" == item) == -1){
this.queryParams.deptId = this.$store.state.user.deptId; this.queryParams.deptId = this.$store.state.user.deptId;
this.disabled = true; this.disabled = true;
} }
...@@ -477,6 +485,7 @@ export default { ...@@ -477,6 +485,7 @@ export default {
this.reset(); this.reset();
this.form.priceType = "1"; this.form.priceType = "1";
this.changePriceType(this.form.priceType); this.changePriceType(this.form.priceType);
this.getTreeselect();
this.open = true; this.open = true;
this.title = "添加交易项目"; this.title = "添加交易项目";
}, },
...@@ -510,6 +519,7 @@ export default { ...@@ -510,6 +519,7 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.getTreeselect();
const transactionProjectId = row.transactionProjectId || this.ids const transactionProjectId = row.transactionProjectId || this.ids
getProject(transactionProjectId).then(response => { getProject(transactionProjectId).then(response => {
this.form = response.data; this.form = response.data;
...@@ -521,6 +531,7 @@ export default { ...@@ -521,6 +531,7 @@ export default {
/** 详情 */ /** 详情 */
handleDetail(row){ handleDetail(row){
this.detailInfo = {}; this.detailInfo = {};
this.getTreeselect();
getProject(row.transactionProjectId).then(response => { getProject(row.transactionProjectId).then(response => {
this.detailInfo = response.data; this.detailInfo = response.data;
this.detailOpen = true; this.detailOpen = true;
...@@ -528,7 +539,7 @@ export default { ...@@ -528,7 +539,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.form.deptId = this.$store.state.user.deptId; //this.form.deptId = this.$store.state.user.deptId;
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.transactionProjectId != null) { if (this.form.transactionProjectId != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment