优化年报修改授权功能

This commit is contained in:
zhouxy 2026-01-29 21:09:23 +08:00
parent e1b2488c51
commit 2082e8832a
2 changed files with 86 additions and 24 deletions

View File

@ -35,15 +35,22 @@
/>
</el-form-item>
<el-form-item label="允许次数" prop="allowTime">
<el-input-number v-model="ruleForm.allowTime" style="width:100%" placeholder="请输入允许次数" :controls="false" />
<el-input-number
v-model="ruleForm.allowTime"
style="width:100%"
:controls="false"
:min="1"
:max="1"
disabled
/>
</el-form-item>
<el-form-item>
<span v-if="title==='添加'">
<el-button type="primary" @click="submitForm('ruleForm')">添加</el-button>
<el-button type="primary" :disabled="isSubmitting" @click="submitForm('ruleForm')">添加</el-button>
<el-button @click="resetForm('ruleForm')">重置</el-button>
</span>
<span v-else>
<el-button type="primary" @click="submitForm('ruleForm')">修改</el-button>
<el-button type="primary" :disabled="isSubmitting" @click="submitForm('ruleForm')">修改</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</span>
</el-form-item>
@ -57,6 +64,7 @@ import { anModifyUpdata, anModifySave, anModifyGet } from '@/api/年报授权修
export default {
data() {
return {
isSubmitting: false, //
dataId: '',
title: '',
dialogVisible: false,
@ -98,24 +106,41 @@ export default {
},
methods: {
submitForm(formName) {
//
if (this.isSubmitting) {
this.$message.warning('正在提交中,请勿重复点击!')
return
}
this.$refs[formName].validate((valid) => {
if (valid) {
this.isSubmitting = true //
const api = this.title === '添加' ? anModifySave : anModifyUpdata
const submitForm = {
...this.ruleForm,
begintime: this.ruleForm.timeStamp[0],
endtime: this.ruleForm.timeStamp[1]
}
api(submitForm).then(res => {
if (res.code === 0) {
this.dialogVisible = false
this.$message({
message: this.title + '成功!',
type: 'success'
})
this.$emit('refreshList')
}
})
api(submitForm)
.then(res => {
if (res.code === 0) {
this.dialogVisible = false
this.$message({
message: this.title + '成功!',
type: 'success'
})
this.$emit('refreshList')
}
})
.catch(err => {
console.error('提交失败:', err)
this.$message.error('提交失败,请稍后重试!')
})
.finally(() => {
this.isSubmitting = false //
})
} else {
console.log('error submit!!')
return false
@ -125,10 +150,21 @@ export default {
resetForm(formName) {
this.$refs[formName].resetFields()
},
generateYearList(endYear = new Date().getFullYear()) {
generateYearList() {
const currentDate = new Date()
const currentYear = currentDate.getFullYear()
const currentMonth = currentDate.getMonth() + 1 // 0 1
this.ancheyearOptions = []
const startYear = 2013
for (let year = startYear; year <= endYear; year++) {
//
const includeCurrentYear = currentMonth >= 7
//
const startYear = currentYear - 2
//
for (let year = startYear; year <= currentYear; year++) {
if ((year >= currentYear - 1) && !includeCurrentYear) {
continue //
}
this.ancheyearOptions.push({ value: year, label: year + '年' })
}
},

View File

@ -2,7 +2,7 @@
<div class="main-content m20">
<div class="content-header body">
<el-row style="margin-bottom:10px">
<el-col :span="8">
<el-col :span="16">
<el-row>
<label class="label-name_1">注册号/统一社会信用代码</label>
<div class="search-input-box_1">
@ -10,7 +10,7 @@
</div>
</el-row>
</el-col>
<el-col :span="1" :offset="3">
<el-col :span="1" :offset="2">
<div class="btn-box" style="font-size: 14px;float:right;">
<el-button type="primary" :loading="loading" @click="loadPage()">查询</el-button>
</div>
@ -23,9 +23,7 @@
<el-button
type="primary"
:loading="loading"
@click="()=>{
this.$refs.AddOrEditAuthorizateAnnualReport?.openDialog()
}"
@click="handleAddClick"
>添加</el-button>
</el-col>
</el-row>
@ -54,7 +52,7 @@
<el-table-column prop="allowTime" :show-overflow-tooltip="true" label="允许次数" min-width="80" align="left" />
<el-table-column :show-overflow-tooltip="true" label="操作" align="left">
<template #default="scope">
<el-button type="text" size="mini" @click="updateDialog(scope.row)">修改</el-button>
<el-button type="text" size="mini" @click="handleUpdateClick(scope.row)">修改</el-button>
<el-button type="text" size="mini" @click="deleteItem(scope.row)">删除</el-button>
</template>
</el-table-column>
@ -83,6 +81,7 @@
<script>
import AddOrEditAuthorizateAnnualReport from '@/views/comprehensive/components/添加或修改年报修改授权.vue'
import { anModifyList, anModifyDelete } from '@/api/年报授权修改.js'
import { getIsUserProp } from '@/api/force'
export default {
components: {
@ -91,7 +90,6 @@ export default {
data() {
return {
loading: false,
user: JSON.parse(sessionStorage.getItem('user')),
searchForm: {
paramMap: {
uniscid: undefined
@ -105,14 +103,42 @@ export default {
current: 1,
total: 0,
size: 10
}
},
userProp: 0
}
},
computed: {},
mounted() {
this.loadPage()
this.getIsUserProp()
},
methods: {
//
getIsUserProp() {
getIsUserProp().then(res => {
this.userProp = res.userProp
})
},
handleAddClick() {
if (this.userProp && this.userProp <= 2) {
this.$refs.AddOrEditAuthorizateAnnualReport?.openDialog()
} else {
this.$message({
type: 'warning',
message: '只能由管理员进行年报修改授权'
})
}
},
handleUpdateClick(row) {
if (this.userProp && this.userProp <= 2) {
this.$refs.AddOrEditAuthorizateAnnualReport.updateDialog(row.id)
} else {
this.$message({
type: 'warning',
message: '只能由管理员进行年报修改授权'
})
}
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 1) {
return 'warning-row'