禅道bug修复
This commit is contained in:
parent
8521290ee4
commit
261c091754
|
|
@ -200,6 +200,11 @@
|
||||||
"
|
"
|
||||||
:link="action.link !== false"
|
:link="action.link !== false"
|
||||||
:plain="action.plain"
|
:plain="action.plain"
|
||||||
|
:disabled="
|
||||||
|
typeof action.disabled === 'function'
|
||||||
|
? action.disabled(row)
|
||||||
|
: action.disabled
|
||||||
|
"
|
||||||
@click="handleAction(action, row, $index)"
|
@click="handleAction(action, row, $index)"
|
||||||
v-hasPermi="action.permission"
|
v-hasPermi="action.permission"
|
||||||
>
|
>
|
||||||
|
|
@ -218,6 +223,11 @@
|
||||||
"
|
"
|
||||||
:link="action.link !== false"
|
:link="action.link !== false"
|
||||||
:plain="action.plain"
|
:plain="action.plain"
|
||||||
|
:disabled="
|
||||||
|
typeof action.disabled === 'function'
|
||||||
|
? action.disabled(row)
|
||||||
|
: action.disabled
|
||||||
|
"
|
||||||
@click="handleAction(action, row, $index)"
|
@click="handleAction(action, row, $index)"
|
||||||
>
|
>
|
||||||
{{ action.label }}
|
{{ action.label }}
|
||||||
|
|
@ -243,6 +253,11 @@
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="action.permission"
|
v-if="action.permission"
|
||||||
:command="{ action, row, index: $index }"
|
:command="{ action, row, index: $index }"
|
||||||
|
:disabled="
|
||||||
|
typeof action.disabled === 'function'
|
||||||
|
? action.disabled(row)
|
||||||
|
: action.disabled
|
||||||
|
"
|
||||||
v-hasPermi="action.permission"
|
v-hasPermi="action.permission"
|
||||||
>
|
>
|
||||||
{{ action.label }}
|
{{ action.label }}
|
||||||
|
|
@ -251,6 +266,11 @@
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-else
|
v-else
|
||||||
:command="{ action, row, index: $index }"
|
:command="{ action, row, index: $index }"
|
||||||
|
:disabled="
|
||||||
|
typeof action.disabled === 'function'
|
||||||
|
? action.disabled(row)
|
||||||
|
: action.disabled
|
||||||
|
"
|
||||||
>
|
>
|
||||||
{{ action.label }}
|
{{ action.label }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|
@ -507,6 +527,12 @@ const handlePaginationChange = (pagination) => {
|
||||||
|
|
||||||
// 操作按钮点击
|
// 操作按钮点击
|
||||||
const handleAction = (action, row, index) => {
|
const handleAction = (action, row, index) => {
|
||||||
|
// 如果按钮被禁用,则不执行操作
|
||||||
|
const isDisabled =
|
||||||
|
typeof action.disabled === 'function' ? action.disabled(row) : action.disabled
|
||||||
|
if (isDisabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (action.handler && typeof action.handler === 'function') {
|
if (action.handler && typeof action.handler === 'function') {
|
||||||
action.handler(row, index)
|
action.handler(row, index)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,14 @@ const initTableColumns = computed(() => {
|
||||||
if (tableType.value !== '0') return [...tableColumns.value, ...processedTableColumns_2.value]
|
if (tableType.value !== '0') return [...tableColumns.value, ...processedTableColumns_2.value]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 判断日期是否为今天之前
|
||||||
|
const isBeforeToday = (dayPlan) => {
|
||||||
|
if (!dayPlan) return false
|
||||||
|
const planDate = dayjs(dayPlan)
|
||||||
|
const today = dayjs().startOf('day')
|
||||||
|
return planDate.isBefore(today)
|
||||||
|
}
|
||||||
|
|
||||||
// 操作列
|
// 操作列
|
||||||
const actionColumns = computed(() => [
|
const actionColumns = computed(() => [
|
||||||
{
|
{
|
||||||
|
|
@ -202,6 +210,7 @@ const actionColumns = computed(() => [
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
link: true,
|
link: true,
|
||||||
permission: ['plan:dailyPlan:edit'], // 权限控制:使用 v-hasPermi 指令控制按钮显示
|
permission: ['plan:dailyPlan:edit'], // 权限控制:使用 v-hasPermi 指令控制按钮显示
|
||||||
|
disabled: (row) => isBeforeToday(row.dayPlan), // 当日期为今天之前时禁用
|
||||||
handler: (row) => {
|
handler: (row) => {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/plan/dailyPlanEdit/index',
|
path: '/plan/dailyPlanEdit/index',
|
||||||
|
|
@ -222,6 +231,7 @@ const actionColumns = computed(() => [
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
link: true,
|
link: true,
|
||||||
permission: ['plan:dailyPlan:remove'], // 权限控制:使用 v-hasPermi 指令控制按钮显示
|
permission: ['plan:dailyPlan:remove'], // 权限控制:使用 v-hasPermi 指令控制按钮显示
|
||||||
|
disabled: (row) => isBeforeToday(row.dayPlan), // 当日期为今天之前时禁用
|
||||||
handler: (row) => {
|
handler: (row) => {
|
||||||
proxy.$modal.confirm('是否确认删除该日计划?').then(async () => {
|
proxy.$modal.confirm('是否确认删除该日计划?').then(async () => {
|
||||||
const result = await delDailyPlanAPI({ dayPlanId: row.dayPlanId })
|
const result = await delDailyPlanAPI({ dayPlanId: row.dayPlanId })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue