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

项目维护中心部门选择

parent 25facd47
......@@ -3,6 +3,7 @@ package com.zehong.web.controller.transaction;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
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.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
......@@ -15,10 +16,12 @@ import com.zehong.system.domain.TTransactionProject;
import com.zehong.system.service.ITTransactionProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.stream.Collectors;
/**
* 交易项目Controller
......@@ -45,7 +48,8 @@ public class TTransactionProjectController extends BaseController
startPage();
// 获取当前用户
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());
}
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
......@@ -119,10 +123,10 @@ public class TTransactionProjectController extends BaseController
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()) {
tTransactionProject.setDeptId(user.getDeptId());
}
}*/
return toAjax(tTransactionProjectService.insertTTransactionProject(tTransactionProject));
}
......
......@@ -146,11 +146,11 @@
<el-input v-model="form.transactionProjectName" placeholder="请输入交易项目名称" />
</el-form-item>
</el-col>
<!--<el-col :span="12">
<el-form-item label="交易细项名称" prop="transactionItemName">
<el-input v-model="form.transactionItemName" placeholder="请输入交易细项名称" />
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>
</el-form-item>
</el-col>-->
</el-col>
</el-row>
<el-form-item label="职责项明细说明" prop="dutyDetailDescribe">
......@@ -206,6 +206,11 @@
{{detailInfo.transactionProjectName}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门">
{{detailInfo.deptName}}
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
......@@ -373,6 +378,9 @@ export default {
transactionProjectName: [
{ required: true, message: "交易项目名称不能为空", trigger: "blur" }
],
deptId: [
{ required: true, message: "请选择归属部门", trigger: "change" }
],
dutyDetailDescribe: [
{ required: true, message: "职责项明细说明不能为空", trigger: "blur" }
],
......@@ -413,7 +421,7 @@ export default {
};
},
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.disabled = true;
}
......@@ -477,6 +485,7 @@ export default {
this.reset();
this.form.priceType = "1";
this.changePriceType(this.form.priceType);
this.getTreeselect();
this.open = true;
this.title = "添加交易项目";
},
......@@ -510,6 +519,7 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
const transactionProjectId = row.transactionProjectId || this.ids
getProject(transactionProjectId).then(response => {
this.form = response.data;
......@@ -521,6 +531,7 @@ export default {
/** 详情 */
handleDetail(row){
this.detailInfo = {};
this.getTreeselect();
getProject(row.transactionProjectId).then(response => {
this.detailInfo = response.data;
this.detailOpen = true;
......@@ -528,7 +539,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.form.deptId = this.$store.state.user.deptId;
//this.form.deptId = this.$store.state.user.deptId;
this.$refs["form"].validate(valid => {
if (valid) {
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