|
@@ -98,8 +98,8 @@
|
|
|
<el-button text type="primary" size="small" v-if="hasPermission('admin:del') && isJyAdmin" @click="del(scope.row.id)">删除</el-button>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
- <el-button size="small" text type="primary" v-if="hasPermission('monthly:edit') &&scope.row.createById === $store.state.user.id" @click="edit(scope.row)">修改</el-button>
|
|
|
- <el-button text type="primary" size="small" v-if="hasPermission('monthly:del') &&scope.row.createById === $store.state.user.id" @click="del(scope.row.id)">删除</el-button>
|
|
|
+ <el-button size="small" text type="primary" v-if="hasPermission('monthly:edit') &&scope.row.createById === $store.state.user.id && !scope.row.isDisabled" @click="edit(scope.row)">修改</el-button>
|
|
|
+ <el-button text type="primary" size="small" v-if="hasPermission('monthly:del') &&scope.row.createById === $store.state.user.id && !scope.row.isDisabled" @click="del(scope.row.id)">删除</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
@@ -186,7 +186,7 @@
|
|
|
user () {
|
|
|
this.createName = this.$store.state.user.name
|
|
|
return this.$store.state.user
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
mounted () {
|
|
|
this.$nextTick(() => {
|
|
@@ -243,6 +243,7 @@
|
|
|
this.dataList = data.records
|
|
|
this.tablePage.total = data.total
|
|
|
this.tableKey = Math.random()
|
|
|
+ this.updateDisplayedList();
|
|
|
this.loading = false
|
|
|
})
|
|
|
this.checkIsAdmin()
|
|
@@ -254,6 +255,34 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ updateDisplayedList() {
|
|
|
+ this.dataList = this.itemsWithDisabledButtons();
|
|
|
+ },
|
|
|
+ itemsWithDisabledButtons() {
|
|
|
+ const today = new Date();
|
|
|
+ const currentMonth = new Date(today.getFullYear(), today.getMonth(), 1); // 本月第一天
|
|
|
+ const currentMonthEnd = new Date(today.getFullYear(), today.getMonth() + 1, 0); // 本月最后一天
|
|
|
+ const isAfter25th = today.getDate() > 25; // 当前日期是否在本月25号之后
|
|
|
+
|
|
|
+ return this.dataList.map(item => {
|
|
|
+ let formattedMonthDate = item.monthDate.replace(/年|月/g, '') // 替换'年'和'月'为'-'
|
|
|
+ .padStart(6, '0'); // 确保是8位数字,前面用0填充
|
|
|
+
|
|
|
+ const monthDate = new Date(formattedMonthDate.slice(0, 4) + '-' + formattedMonthDate.slice(4, 6) + '-' + '01'); // 解析为Date对象,并设置为该月的第一天
|
|
|
+
|
|
|
+ // 判断是否需要禁用按钮
|
|
|
+ const isDisabled = (
|
|
|
+ monthDate < currentMonth // 在本月之前
|
|
|
+ || (monthDate.getFullYear() === currentMonth.getFullYear() && monthDate.getMonth() === currentMonth.getMonth() && isAfter25th) // 本月但当前日期在25号之后
|
|
|
+ );
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isDisabled,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
//判断当前登陆人是否是admin
|
|
|
checkIsJyAdmin(){
|
|
|
userService.checkIsJyAdmin().then((data)=>{
|