|
|
|
@ -8,6 +8,7 @@ |
|
|
|
collapse-tags |
|
|
|
placeholder="请选择所属全宗" |
|
|
|
style="width: 320px;" |
|
|
|
@change="getPageReports" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in fondsOptions" |
|
|
|
@ -22,6 +23,7 @@ |
|
|
|
collapse-tags |
|
|
|
placeholder="请选择年份" |
|
|
|
style="width: 150px;" |
|
|
|
@change="getPageReports" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in yearsOptions" |
|
|
|
@ -30,7 +32,7 @@ |
|
|
|
:value="item.id" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="getTotalStatistics">查询</el-button> |
|
|
|
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="getPageReports">查询</el-button> |
|
|
|
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button> |
|
|
|
</div> |
|
|
|
<el-button size="mini" :loading="addLoading" @click="toAdd"> |
|
|
|
@ -39,21 +41,28 @@ |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<el-table v-loading="loading" class="archives-table" :data="allData" style="width: 100%;"> |
|
|
|
<el-table-column prop="year" label="年度" align="center" /> |
|
|
|
<el-table-column prop="archivesCount" label="填报单位" /> |
|
|
|
<el-table-column prop="username" label="创建人" align="center" /> |
|
|
|
<el-table-column prop="createTime" label="创建时间" align="center"> |
|
|
|
<el-table-column prop="reportingYear" label="年度" align="center" width="100" /> |
|
|
|
<el-table-column prop="fondsName" label="填报单位" /> |
|
|
|
<el-table-column prop="createBy" label="创建人" /> |
|
|
|
<el-table-column prop="createdAt" label="创建时间"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div>{{ scope.row.createTime | parseTime }}</div> |
|
|
|
<div>{{ scope.row.createdAt | parseTime }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="modelName" label="统计模板" /> |
|
|
|
<el-table-column prop="handle" label="操作"> |
|
|
|
<el-table-column prop="templateName" label="统计模板" /> |
|
|
|
<el-table-column prop="handle" label="操作" width="200"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button size="mini" @click="handleDetail(scope.row)">查看详情</el-button> |
|
|
|
<el-button size="mini" @click="handleEdit(scope.row)">编辑</el-button> |
|
|
|
<el-button size="mini" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
<!-- <el-button :loading="btnLoading" class="packing-handle-btn iconfont" @click="handleCartoning(scope.row)"><svg-icon icon-class="zhuanghe" class="svg-arc-style" />装盒</el-button> --> |
|
|
|
<el-tooltip class="item" effect="dark" content="查看详情" placement="top"> |
|
|
|
<el-button class="hanle-btn" size="mini" :loading="getRowLoading(scope.row, 'detail')" @click="handleDetail(scope.row)"> |
|
|
|
<i class="iconfont icon-sulan" /> |
|
|
|
</el-button> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="编辑" placement="top"> |
|
|
|
<el-button class="hanle-btn" size="mini" :loading="getRowLoading(scope.row, 'edit')" @click="handleEdit(scope.row)"><i class="iconfont icon-Group" /></el-button> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="删除" placement="top"> |
|
|
|
<el-button class="hanle-btn" size="mini" :loading="getRowLoading(scope.row, 'delete')" @click="handleDelete(scope.row)"><i class="iconfont icon-shanchu-" /></el-button> |
|
|
|
</el-tooltip> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -73,9 +82,9 @@ |
|
|
|
<span class="dialog-left-bottom" /> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<el-form ref="form" :model="form" :rules="formRules" label-width="90px"> |
|
|
|
<el-form-item label="全宗" prop="fondsId"> |
|
|
|
<el-form-item label="全宗" prop="unitId"> |
|
|
|
<!-- :disabled="isEdit" --> |
|
|
|
<el-select v-model="form.fondsId" placeholder="请选择全宗" style="width: 100%;"> |
|
|
|
<el-select v-model="form.unitId" :disabled="isEdit" placeholder="请选择全宗" style="width: 100%;"> |
|
|
|
<el-option |
|
|
|
v-for="item in fondsOptions" |
|
|
|
:key="item.id" |
|
|
|
@ -84,22 +93,22 @@ |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="年度" prop="year"> |
|
|
|
<!-- :disabled="isEdit" --> |
|
|
|
<el-date-picker v-model="form.year" type="year" value-format="yyyy" placeholder="请选择年度" style="width: 100%;" /> |
|
|
|
<el-form-item label="年度" prop="reportingYear"> |
|
|
|
<!-- --> |
|
|
|
<el-date-picker v-model="form.reportingYear" :disabled="isEdit" type="year" value-format="yyyy" placeholder="请选择年度" style="width: 100%;" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="统计模板" prop="modelId"> |
|
|
|
<el-select v-model="form.modelId" :disabled="isEdit" placeholder="请选择统计模板" style="width: 100%;"> |
|
|
|
<el-form-item label="统计模板" prop="templateId"> |
|
|
|
<el-select v-model="form.templateId" :disabled="isEdit" placeholder="请选择统计模板" style="width: 100%;"> |
|
|
|
<el-option |
|
|
|
v-for="item in modelOptions" |
|
|
|
:key="item.id" |
|
|
|
:label="item.name" |
|
|
|
:value="item.id" |
|
|
|
:key="item.templateId" |
|
|
|
:label="item.formTitle" |
|
|
|
:value="item.templateId" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="备注" prop="remarks"> |
|
|
|
<el-input v-model="form.remarks" type="textarea" :rows="3" placeholder="请输入备注" /> |
|
|
|
<el-form-item label="备注" prop="remark"> |
|
|
|
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
@ -114,12 +123,12 @@ |
|
|
|
<span class="dialog-right-top" /> |
|
|
|
<span class="dialog-left-bottom" /> |
|
|
|
<div class="setting-dialog detail-content"> |
|
|
|
<div class="detail-item"><span class="detail-label">统计年度:</span>{{ detailData.year }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报单位:</span>{{ detailData.archivesCount }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报人:</span>{{ detailData.username }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报时间:</span>{{ detailData.createTime | parseTime }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">备注:</span>{{ detailData.remarks || '-' }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">统计模板:</span>{{ detailData.modelName }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">统计年度:</span>{{ detailData.reportingYear }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报单位:</span>{{ detailData.fondsName }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报人:</span>{{ detailData.createBy }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">填报时间:</span>{{ detailData.createdAt | parseTime }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">备注:</span>{{ detailData.remark || '-' }}</div> |
|
|
|
<div class="detail-item"><span class="detail-label">统计模板:</span>{{ detailData.templateName }}</div> |
|
|
|
</div> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" :loading="reportDetailLoading" @click="handleReportDetail">报表详情</el-button> |
|
|
|
@ -131,7 +140,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchFondsAll } from '@/api/system/fonds' |
|
|
|
import { FetchTotalStatistics, FetchArchivedAllYear, FetchInitStatisticsTemplate } from '@/api/statistics/statistics' |
|
|
|
import { FetchPageReports, FetchArchivedAllYear, FetchInitStatisticsTemplate, FetchSaveArchivesReport, FetchFindArchivesReportById, FetchAnnualStatisticalTemplateAll, FetchDeleteArchivesReport } from '@/api/statistics/statistics' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
|
|
|
|
export default { |
|
|
|
@ -150,17 +159,19 @@ export default { |
|
|
|
submitLoading: false, |
|
|
|
form: { |
|
|
|
id: null, |
|
|
|
fondsId: null, |
|
|
|
year: String(new Date().getFullYear()), |
|
|
|
modelId: null, |
|
|
|
remarks: null |
|
|
|
unitId: null, |
|
|
|
reportingYear: String(new Date().getFullYear()), |
|
|
|
templateId: null, |
|
|
|
remark: null |
|
|
|
}, |
|
|
|
formRules: { |
|
|
|
fondsId: [{ required: true, message: '请选择全宗', trigger: 'change' }], |
|
|
|
year: [{ required: true, message: '请选择年度', trigger: 'change' }], |
|
|
|
modelId: [{ required: true, message: '请选择统计模板', trigger: 'change' }] |
|
|
|
unitId: [{ required: true, message: '请选择全宗', trigger: 'change' }], |
|
|
|
reportingYear: [{ required: true, message: '请选择年度', trigger: 'change' }], |
|
|
|
templateId: [{ required: true, message: '请选择统计模板', trigger: 'change' }] |
|
|
|
}, |
|
|
|
addLoading: false, |
|
|
|
// 行级按钮 loading:{ [reportId]: { detail, edit, delete } } |
|
|
|
rowLoading: {}, |
|
|
|
// 详情弹框 |
|
|
|
detailVisible: false, |
|
|
|
detailData: {}, |
|
|
|
@ -191,89 +202,145 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.getAnnualStatisticalTemplateAll() |
|
|
|
this.getFondsDatas() |
|
|
|
this.getArchivedAllYearDatas() |
|
|
|
this.getTotalStatistics() |
|
|
|
|
|
|
|
this.getPageReports() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 读取行级按钮 loading |
|
|
|
getRowLoading(row, action) { |
|
|
|
const r = this.rowLoading[row.reportId] |
|
|
|
return r ? !!r[action] : false |
|
|
|
}, |
|
|
|
// 设置行级按钮 loading |
|
|
|
setRowLoading(row, action, val) { |
|
|
|
const id = row.reportId |
|
|
|
if (!this.rowLoading[id]) { |
|
|
|
this.$set(this.rowLoading, id, { detail: false, edit: false, delete: false }) |
|
|
|
} |
|
|
|
this.$set(this.rowLoading[id], action, val) |
|
|
|
}, |
|
|
|
// 分页查询年报数据 |
|
|
|
async getPageReports() { |
|
|
|
this.loading = true |
|
|
|
try { |
|
|
|
const res = await FetchPageReports({ |
|
|
|
page: this.page.page - 1, |
|
|
|
size: this.page.size, |
|
|
|
reportingYearList: this.years, // 查询年份 |
|
|
|
unitIdList: this.fondsIds // 全宗id |
|
|
|
}) |
|
|
|
if (res.code !== 500) { |
|
|
|
this.allData = res.records |
|
|
|
this.page.total = res.total |
|
|
|
} else { |
|
|
|
this.$message.error(res.message) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error(error.message) |
|
|
|
} finally { |
|
|
|
this.loading = false |
|
|
|
} |
|
|
|
}, |
|
|
|
// 年度统计模板 |
|
|
|
async getAnnualStatisticalTemplateAll() { |
|
|
|
try { |
|
|
|
const res = await FetchAnnualStatisticalTemplateAll() |
|
|
|
if (res.code !== 500) { |
|
|
|
this.modelOptions = res |
|
|
|
} else { |
|
|
|
this.$message.error(res.message) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error(error.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
toAdd() { |
|
|
|
this.dialogMode = 'add' |
|
|
|
this.form = { |
|
|
|
id: null, |
|
|
|
fondsId: null, |
|
|
|
year: String(new Date().getFullYear()), |
|
|
|
modelId: null, |
|
|
|
remarks: null |
|
|
|
reportId: null, |
|
|
|
unitId: null, |
|
|
|
reportingYear: String(new Date().getFullYear()), |
|
|
|
templateId: null, |
|
|
|
remark: null |
|
|
|
} |
|
|
|
this.formVisible = true |
|
|
|
}, |
|
|
|
handleEdit(row) { |
|
|
|
async handleEdit(row) { |
|
|
|
this.dialogMode = 'edit' |
|
|
|
const modelItem = this.modelOptions.find(m => m.name === row.modelName) |
|
|
|
const fondsItem = this.fondsOptions.find(f => f.fondsName === row.archivesCount) |
|
|
|
this.form = { |
|
|
|
id: row.id, |
|
|
|
fondsId: fondsItem ? fondsItem.id : null, |
|
|
|
year: row.year, |
|
|
|
modelId: modelItem ? modelItem.id : null, |
|
|
|
remarks: row.remarks |
|
|
|
// const modelItem = this.modelOptions.find(m => m.id === row.templateId) |
|
|
|
// const fondsItem = this.fondsOptions.find(f => f.id === row.unitId) |
|
|
|
|
|
|
|
// 查询年度报表详情 |
|
|
|
this.setRowLoading(row, 'edit', true) |
|
|
|
try { |
|
|
|
const params = { |
|
|
|
id: row.reportId |
|
|
|
} |
|
|
|
const res = await FetchFindArchivesReportById(params) |
|
|
|
if (res.code !== 500) { |
|
|
|
this.form = { ...res } |
|
|
|
this.form.reportingYear = String(res.reportingYear) |
|
|
|
this.formVisible = true |
|
|
|
} else { |
|
|
|
this.$message.error(res.message) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error(error.message) |
|
|
|
} finally { |
|
|
|
this.setRowLoading(row, 'edit', false) |
|
|
|
} |
|
|
|
}, |
|
|
|
closeFormDialog() { |
|
|
|
this.formVisible = false |
|
|
|
this.$refs.form.resetFields() |
|
|
|
}, |
|
|
|
handleSubmit() { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
this.$refs.form.validate(async(valid) => { |
|
|
|
if (valid) { |
|
|
|
this.submitLoading = true |
|
|
|
if (this.isEdit) { |
|
|
|
// TODO: 替换为实际编辑接口 |
|
|
|
const index = this.allData.findIndex(item => item.id === this.form.id) |
|
|
|
if (index !== -1) { |
|
|
|
this.allData[index].remarks = this.form.remarks |
|
|
|
} |
|
|
|
this.$message({ message: '编辑成功', type: 'success', offset: 8 }) |
|
|
|
try { |
|
|
|
const res = await FetchSaveArchivesReport(this.form) |
|
|
|
if (res.code !== 500) { |
|
|
|
this.$message({ message: this.isEdit ? '编辑成功' : '新增成功', type: 'success', offset: 8 }) |
|
|
|
this.closeFormDialog() |
|
|
|
this.getPageReports() |
|
|
|
} else { |
|
|
|
// TODO: 替换为实际新增接口 |
|
|
|
const modelName = this.modelOptions.find(item => item.id === this.form.modelId)?.name |
|
|
|
const fondsName = this.fondsOptions.find(item => item.id === this.form.fondsId)?.fondsName |
|
|
|
const newRow = { |
|
|
|
id: Date.now(), |
|
|
|
year: this.form.year, |
|
|
|
archivesCount: fondsName, |
|
|
|
username: this.user?.username || '', |
|
|
|
createTime: new Date().getTime(), |
|
|
|
modelName: modelName, |
|
|
|
remarks: this.form.remarks |
|
|
|
} |
|
|
|
this.allData.unshift(newRow) |
|
|
|
this.$message({ message: '新增成功', type: 'success', offset: 8 }) |
|
|
|
this.$message.error(res.message) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error(error.message) |
|
|
|
} finally { |
|
|
|
this.submitLoading = false |
|
|
|
this.closeFormDialog() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleEditDetail() { |
|
|
|
this.checkAndOpenReport('edit', { |
|
|
|
reportingYear: this.form.year, |
|
|
|
unitId: this.form.fondsId, |
|
|
|
templateId: Number(this.form.modelId) || 1 |
|
|
|
reportingYear: this.form.reportingYear, |
|
|
|
unitId: this.form.unitId, |
|
|
|
templateId: Number(this.form.templateId) || 1 |
|
|
|
}, 'editDetailLoading') |
|
|
|
}, |
|
|
|
handleSizeChange(val) { |
|
|
|
this.page.size = val |
|
|
|
this.getTotalStatistics() |
|
|
|
this.getPageReports() |
|
|
|
}, |
|
|
|
handleCurrentPage(val) { |
|
|
|
this.page.page = val |
|
|
|
this.getTotalStatistics() |
|
|
|
this.getPageReports() |
|
|
|
}, |
|
|
|
handleDetail(row) { |
|
|
|
this.setRowLoading(row, 'detail', true) |
|
|
|
try { |
|
|
|
this.detailData = { ...row } |
|
|
|
this.detailVisible = true |
|
|
|
} finally { |
|
|
|
this.setRowLoading(row, 'detail', false) |
|
|
|
} |
|
|
|
}, |
|
|
|
closeDetailDialog() { |
|
|
|
this.detailVisible = false |
|
|
|
@ -281,12 +348,12 @@ export default { |
|
|
|
}, |
|
|
|
handleReportDetail() { |
|
|
|
// 行数据无全宗 id 时,按填报单位名称匹配 |
|
|
|
const fondsItem = this.fondsOptions.find(f => f.fondsName === this.detailData.archivesCount) |
|
|
|
const unitId = this.detailData.unitId || this.detailData.fondsId || (fondsItem && fondsItem.id) |
|
|
|
// const fondsItem = this.fondsOptions.find(f => f.fondsName === this.detailData.archivesCount) |
|
|
|
const unitId = this.detailData.unitId |
|
|
|
this.checkAndOpenReport('view', { |
|
|
|
reportingYear: this.detailData.year, |
|
|
|
reportingYear: this.detailData.reportingYear, |
|
|
|
unitId, |
|
|
|
templateId: 1 |
|
|
|
templateId: Number(this.detailData.templateId) || 1 |
|
|
|
}, 'reportDetailLoading') |
|
|
|
}, |
|
|
|
// 跳转报表前先调初始化接口预检:有数据才打开新页,否则提示且不跳转 |
|
|
|
@ -299,8 +366,13 @@ export default { |
|
|
|
const win = window.open('', '_blank') |
|
|
|
this[loadingKey] = true |
|
|
|
FetchInitStatisticsTemplate(params).then(res => { |
|
|
|
console.log('FetchInitStatisticsTemplate', res) |
|
|
|
// 接口正常且模板行有数据才放行 |
|
|
|
if (res && Array.isArray(res.rows) && res.rows.length) { |
|
|
|
// 预检结果缓存到 sessionStorage,Da3Report 直接读取避免重复调接口 |
|
|
|
try { |
|
|
|
sessionStorage.setItem('da3_report_cache_' + params.reportingYear + '_' + params.unitId, JSON.stringify(res)) |
|
|
|
} catch (e) { /* 存储满则忽略 */ } |
|
|
|
const route = this.$router.resolve({ |
|
|
|
path: '/da3Report', |
|
|
|
query: { mode, ...params } |
|
|
|
@ -318,14 +390,24 @@ export default { |
|
|
|
this[loadingKey] = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleDelete() { |
|
|
|
handleDelete(row) { |
|
|
|
this.$confirm('此操作将删除当前数据' + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
confirmButtonText: '继续', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}).then(() => { |
|
|
|
console.log('确认删除') |
|
|
|
this.setRowLoading(row, 'delete', true) |
|
|
|
FetchDeleteArchivesReport(row.reportId).then(res => { |
|
|
|
if (res.code !== 500) { |
|
|
|
this.$message({ message: '删除成功', type: 'success', offset: 8 }) |
|
|
|
this.getPageReports() |
|
|
|
} else { |
|
|
|
this.$message.error(res.message) |
|
|
|
} |
|
|
|
}).catch(() => {}).finally(() => { |
|
|
|
this.setRowLoading(row, 'delete', false) |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
console.log('取消') |
|
|
|
}) |
|
|
|
@ -333,7 +415,7 @@ export default { |
|
|
|
resetQuery() { |
|
|
|
this.fondsIds = [] |
|
|
|
this.years = [] |
|
|
|
this.getTotalStatistics() |
|
|
|
this.getPageReports() |
|
|
|
}, |
|
|
|
getFondsDatas() { |
|
|
|
FetchFondsAll().then(res => { |
|
|
|
@ -357,18 +439,8 @@ export default { |
|
|
|
checkAndQuery() { |
|
|
|
// 当两个数据都加载完成后才执行查询 |
|
|
|
if (this.fondsOptions.length > 0 && this.yearsOptions.length > 0) { |
|
|
|
this.getTotalStatistics() |
|
|
|
this.getPageReports() |
|
|
|
} |
|
|
|
}, |
|
|
|
getTotalStatistics() { |
|
|
|
this.loading = true |
|
|
|
FetchTotalStatistics({ |
|
|
|
fondsIds: this.fondsIds, |
|
|
|
years: this.years |
|
|
|
}).then(res => { |
|
|
|
this.allData = res |
|
|
|
this.loading = false |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -416,4 +488,14 @@ export default { |
|
|
|
padding: 20px 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep .hanle-btn{ |
|
|
|
padding: 7px; |
|
|
|
.icon-sulan{ |
|
|
|
font-size: 18px; |
|
|
|
} |
|
|
|
.iconfont::before{ |
|
|
|
margin-right: 0 !important; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |