项目预算权限

This commit is contained in:
chen 2024-07-24 14:11:54 +08:00
parent cf5351273e
commit eb58367a5b
2 changed files with 26 additions and 6 deletions

View File

@ -53,7 +53,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" @click="showById(scope.row.id)">查看工作量</el-button> <el-button type="text" size="mini" @click="showById(scope.row.id)">查看工作量</el-button>
<el-button type="text" size="mini" @click="updateById(scope.row.id)">修改</el-button> <el-button type="text" size="mini" @click="updateById(scope.row.id)">修改</el-button>
<el-button type="text" size="mini" @click="summary(scope.row.id)">汇总</el-button> <el-button type="text" size="mini" @click="summary(scope.row)" :disabled="scope.row.summarized">
{{ scope.row.summarized ? '已汇总' : '汇总' }}
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -123,6 +125,8 @@
showDelete: false, showDelete: false,
showCheck: true, showCheck: true,
}, },
sum: false,
buttonText: '汇总',
searchForm: { searchForm: {
projectName: '', projectName: '',
week: '' week: ''
@ -280,15 +284,14 @@
params: {id} params: {id}
}) })
}, },
summary (id) { summary (row) {
Api.ProjectManagements.insertPermission(id).then(result => { Api.ProjectManagements.insertPermission(row.id).then(result => {
if (result.status === 0) { if (result.status === 0) {
this.$message.success(result.data) this.$message.success(result.data)
this.$router.push({name: 'DepartmentWeeklyList'}) this.$router.push({name: 'DepartmentWeeklyList'})
} else {
this.$message.error(result.data)
} }
}) })
row.summarized = true;
}, },
updateWorkload (id) { updateWorkload (id) {
this.$router.push({ this.$router.push({
@ -313,4 +316,9 @@
.page-content { .page-content {
padding: 15px; padding: 15px;
} }
.el-table .summarized-row {
background-color: #f0f9eb; /* 修改行背景色 */
color: #67c23a; /* 修改行文本颜色 */
}
</style> </style>

View File

@ -76,7 +76,7 @@
<el-form-item> <el-form-item>
<div style="float: right"> <div style="float: right">
<el-button @click="cancel()" type="default">取消</el-button> <el-button @click="cancel()" type="default">取消</el-button>
<el-button @click="save('formName')" type="primary" :disabled="!isSave">保存</el-button> <el-button @click="save('formName')" type="primary" :disabled="shouldDisable()">保存</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -108,6 +108,7 @@ export default {
thisWeek: '', thisWeek: '',
nextWeek: '', nextWeek: '',
userId: '', userId: '',
roleUserId: [],
workload: '', workload: '',
projectName: '', projectName: '',
week: '', week: '',
@ -118,6 +119,7 @@ export default {
reimburseId: '', reimburseId: '',
actionUrl: `${baseUrl}/api/common/file-upload`, // actionUrl: `${baseUrl}/api/common/file-upload`, //
baseUrl: baseUrl, baseUrl: baseUrl,
formAll: [],
formModel: { formModel: {
userInfoId: '', userInfoId: '',
witness: '', witness: '',
@ -238,7 +240,9 @@ export default {
this.pageLoading = false this.pageLoading = false
console.log('预算执行率', result) console.log('预算执行率', result)
if (result.status === 0) { if (result.status === 0) {
let dataAll = result.data
let dataList = result.data.ls[0] let dataList = result.data.ls[0]
this.formAll = dataAll
this.formModel = dataList this.formModel = dataList
// this.tableRowsData.push({ // this.tableRowsData.push({
// id: dataList.id, // id: dataList.id,
@ -412,6 +416,14 @@ export default {
cancel () { cancel () {
this.$router.go(-1) this.$router.go(-1)
}, },
shouldDisable () {
const roleUserIds = this.formAll.roleUserId;
const userId = this.formAll.userId
for (let i = 0; i < roleUserIds.length; i++) {
this.isSave = roleUserIds[i] !== userId;
}
return this.isSave
},
save (formName) { save (formName) {
console.log('formName', formName) console.log('formName', formName)
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {