优化年报修改授权功能

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>
<el-form-item label="允许次数" prop="allowTime"> <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>
<el-form-item> <el-form-item>
<span v-if="title==='添加'"> <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> <el-button @click="resetForm('ruleForm')">重置</el-button>
</span> </span>
<span v-else> <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> <el-button @click="dialogVisible = false">取消</el-button>
</span> </span>
</el-form-item> </el-form-item>
@ -57,6 +64,7 @@ import { anModifyUpdata, anModifySave, anModifyGet } from '@/api/年报授权修
export default { export default {
data() { data() {
return { return {
isSubmitting: false, //
dataId: '', dataId: '',
title: '', title: '',
dialogVisible: false, dialogVisible: false,
@ -98,24 +106,41 @@ export default {
}, },
methods: { methods: {
submitForm(formName) { submitForm(formName) {
//
if (this.isSubmitting) {
this.$message.warning('正在提交中,请勿重复点击!')
return
}
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
this.isSubmitting = true //
const api = this.title === '添加' ? anModifySave : anModifyUpdata const api = this.title === '添加' ? anModifySave : anModifyUpdata
const submitForm = { const submitForm = {
...this.ruleForm, ...this.ruleForm,
begintime: this.ruleForm.timeStamp[0], begintime: this.ruleForm.timeStamp[0],
endtime: this.ruleForm.timeStamp[1] endtime: this.ruleForm.timeStamp[1]
} }
api(submitForm).then(res => {
if (res.code === 0) { api(submitForm)
this.dialogVisible = false .then(res => {
this.$message({ if (res.code === 0) {
message: this.title + '成功!', this.dialogVisible = false
type: 'success' this.$message({
}) message: this.title + '成功!',
this.$emit('refreshList') type: 'success'
} })
}) this.$emit('refreshList')
}
})
.catch(err => {
console.error('提交失败:', err)
this.$message.error('提交失败,请稍后重试!')
})
.finally(() => {
this.isSubmitting = false //
})
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
@ -125,10 +150,21 @@ export default {
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields() 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 = [] 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 + '年' }) this.ancheyearOptions.push({ value: year, label: year + '年' })
} }
}, },

View File

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