| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- <template>
- <div class="material-tab-container">
- <!-- 综合性资料 -->
- <div v-if="materialGroups.comprehensive.length > 0" class="material-group">
- <h4 class="group-title">综合性资料</h4>
- <el-table
- v-loading="loading"
- :data="materialGroups.comprehensive"
- style="width: 100%"
- border
- >
- <el-table-column prop="orderNum" label="序号" width="80" align="center">
- <template slot-scope="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column
- prop="informationName"
- label="报送资料"
- min-width="200"
- />
- <el-table-column
- prop="informationTypeName"
- label="资料类型"
- min-width="150"
- align="center"
- />
- <el-table-column
- prop="isRequired"
- label="是否必项"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{
- scope.row.isRequired === '1' || scope.row.isRequired === 1
- ? '是'
- : '否'
- }}
- </template>
- </el-table-column>
- <el-table-column
- prop="isUpload"
- label="是否上传"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- <span
- :class="
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? 'status-uploaded'
- : 'status-not-uploaded'
- "
- >
- {{
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? '已上传'
- : '未上传'
- }}
- </span>
- </template>
- </el-table-column>
- <el-table-column
- prop="updateTime"
- label="上传时间"
- min-width="180"
- align="center"
- />
- <el-table-column
- prop="auditedStatus"
- label="初审结果"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{ formatAuditStatus(scope.row.auditedStatus) }}
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100" align="center" fixed="right">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="small"
- @click="handleViewDetail(scope.row)"
- >
- 查看
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 财务会计资料 -->
- <div v-if="materialGroups.financial.length > 0" class="material-group">
- <h4 class="group-title">财务会计资料</h4>
- <el-table
- v-loading="loading"
- :data="materialGroups.financial"
- style="width: 100%"
- border
- >
- <el-table-column prop="orderNum" label="序号" width="80" align="center">
- <template slot-scope="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column
- prop="informationName"
- label="报送资料"
- min-width="200"
- />
- <el-table-column
- prop="informationTypeName"
- label="资料类型"
- min-width="150"
- align="center"
- />
- <el-table-column
- prop="isRequired"
- label="是否必项"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{
- scope.row.isRequired === '1' || scope.row.isRequired === 1
- ? '是'
- : '否'
- }}
- </template>
- </el-table-column>
- <el-table-column
- prop="isUpload"
- label="是否上传"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- <span
- :class="
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? 'status-uploaded'
- : 'status-not-uploaded'
- "
- >
- {{
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? '已上传'
- : '未上传'
- }}
- </span>
- </template>
- </el-table-column>
- <el-table-column
- prop="updateTime"
- label="上传时间"
- min-width="180"
- align="center"
- />
- <el-table-column
- prop="auditedStatus"
- label="初审结果"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{ formatAuditStatus(scope.row.auditedStatus) }}
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100" align="center" fixed="right">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="small"
- @click="handleViewDetail(scope.row)"
- >
- 查看
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 其他资料 -->
- <div v-if="materialGroups.other.length > 0" class="material-group">
- <h4 class="group-title">其他资料</h4>
- <el-table
- v-loading="loading"
- :data="materialGroups.other"
- style="width: 100%"
- border
- >
- <el-table-column prop="orderNum" label="序号" width="80" align="center">
- <template slot-scope="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column
- prop="informationName"
- label="报送资料"
- min-width="200"
- />
- <el-table-column
- prop="informationTypeName"
- label="资料类型"
- min-width="150"
- align="center"
- />
- <el-table-column
- prop="isRequired"
- label="是否必项"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{
- scope.row.isRequired === '1' || scope.row.isRequired === 1
- ? '是'
- : '否'
- }}
- </template>
- </el-table-column>
- <el-table-column
- prop="isUpload"
- label="是否上传"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- <span
- :class="
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? 'status-uploaded'
- : 'status-not-uploaded'
- "
- >
- {{
- scope.row.isUpload === '1' || scope.row.isUpload === 1
- ? '已上传'
- : '未上传'
- }}
- </span>
- </template>
- </el-table-column>
- <el-table-column
- prop="updateTime"
- label="上传时间"
- min-width="180"
- align="center"
- />
- <el-table-column
- prop="auditedStatus"
- label="初审结果"
- min-width="120"
- align="center"
- >
- <template slot-scope="scope">
- {{ formatAuditStatus(scope.row.auditedStatus) }}
- </template>
- </el-table-column>
- <el-table-column label="操作" width="100" align="center" fixed="right">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="small"
- @click="handleViewDetail(scope.row)"
- >
- 查看
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 无数据提示 -->
- <div
- v-if="
- materialGroups.comprehensive.length === 0 &&
- materialGroups.financial.length === 0 &&
- materialGroups.other.length === 0 &&
- !loading
- "
- class="no-data-tip"
- >
- <p>暂无报送资料数据</p>
- </div>
- </div>
- </template>
- <script>
- import { getMaterialByTaskId } from '@/api/home'
- export default {
- name: 'MaterialTab',
- props: {
- project: {
- type: Object,
- default: () => ({}),
- },
- isView: {
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {
- loading: false,
- materialData: [],
- materialGroups: {
- comprehensive: [], // 综合性资料
- financial: [], // 财务会计资料
- other: [], // 其他资料
- },
- }
- },
- watch: {
- project: {
- handler(newVal) {
- if (newVal && newVal.taskId) {
- this.loadMaterialData()
- }
- },
- deep: true,
- immediate: true,
- },
- },
- methods: {
- // 加载报送资料数据
- async loadMaterialData() {
- if (!this.project || !this.project.taskId) {
- return
- }
- try {
- this.loading = true
- const res = await getMaterialByTaskId({
- taskId: this.project.taskId,
- })
- if (res && res.state && res.value) {
- // 根据接口返回的数据结构进行处理
- // 如果返回是数组,直接使用;否则获取 records 或 data
- const materialList = Array.isArray(res.value)
- ? res.value
- : res.value.records || res.value.data || []
- this.materialData = materialList
- // 按资料类型分组
- this.groupMaterialData(materialList)
- } else {
- this.materialData = []
- this.resetMaterialGroups()
- }
- } catch (error) {
- console.error('加载报送资料失败:', error)
- this.materialData = []
- this.resetMaterialGroups()
- } finally {
- this.loading = false
- }
- },
- // 按资料类型分组
- groupMaterialData(data) {
- this.materialGroups.comprehensive = []
- this.materialGroups.financial = []
- this.materialGroups.other = []
- data.forEach((item, index) => {
- const typeName = item.informationTypeName || ''
- // 根据资料类型名称分类
- if (
- typeName.includes('财务') ||
- typeName.includes('会计') ||
- typeName.includes('金融')
- ) {
- this.materialGroups.financial.push(item)
- } else if (
- typeName.includes('综合') ||
- typeName.includes('基本') ||
- typeName.includes('一般')
- ) {
- this.materialGroups.comprehensive.push(item)
- } else {
- this.materialGroups.other.push(item)
- }
- })
- },
- // 重置分组数据
- resetMaterialGroups() {
- this.materialGroups.comprehensive = []
- this.materialGroups.financial = []
- this.materialGroups.other = []
- },
- // 查看详情
- handleViewDetail(row) {
- this.$message.info(`查看资料:${row.informationName}`)
- // 可在此处添加打开详情弹窗的逻辑
- },
- // 格式化审核状态
- formatAuditStatus(status) {
- const statusMap = {
- 0: '未审核',
- 1: '已审核',
- 2: '审核通过',
- 3: '审核不通过',
- }
- return statusMap[status] || '未知'
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .material-tab-container {
- padding: 20px 0;
- }
- .material-group {
- margin-bottom: 30px;
- .group-title {
- font-size: 14px;
- font-weight: 600;
- color: #333;
- margin: 0 0 15px 0;
- padding-left: 10px;
- border-left: 4px solid #409eff;
- background-color: #f5f7fa;
- padding: 10px 15px;
- margin-left: -20px;
- margin-right: -20px;
- padding-left: 26px;
- }
- }
- .no-data-tip {
- text-align: center;
- padding: 40px 20px;
- color: #909399;
- font-size: 14px;
- }
- .status-uploaded {
- color: #67c23a;
- font-weight: 500;
- }
- .status-not-uploaded {
- color: #f56c6c;
- font-weight: 500;
- }
- </style>
|