materialTab.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <div class="material-tab-container">
  3. <!-- 综合性资料 -->
  4. <div v-if="materialGroups.comprehensive.length > 0" class="material-group">
  5. <h4 class="group-title">综合性资料</h4>
  6. <el-table
  7. v-loading="loading"
  8. :data="materialGroups.comprehensive"
  9. style="width: 100%"
  10. border
  11. >
  12. <el-table-column prop="orderNum" label="序号" width="80" align="center">
  13. <template slot-scope="scope">
  14. {{ scope.$index + 1 }}
  15. </template>
  16. </el-table-column>
  17. <el-table-column
  18. prop="informationName"
  19. label="报送资料"
  20. header-align="center"
  21. align="left"
  22. min-width="200"
  23. />
  24. <el-table-column
  25. prop="informationTypeName"
  26. label="资料类型"
  27. min-width="150"
  28. align="center"
  29. />
  30. <el-table-column
  31. prop="isRequired"
  32. label="是否必项"
  33. min-width="120"
  34. align="center"
  35. >
  36. <template slot-scope="scope">
  37. {{
  38. scope.row.isRequired === '1' || scope.row.isRequired === 1
  39. ? '是'
  40. : '否'
  41. }}
  42. </template>
  43. </el-table-column>
  44. <el-table-column
  45. prop="isUpload"
  46. label="是否上传"
  47. min-width="120"
  48. align="center"
  49. >
  50. <template slot-scope="scope">
  51. <span
  52. :class="
  53. scope.row.isUpload === '1' || scope.row.isUpload === 1
  54. ? 'status-uploaded'
  55. : 'status-not-uploaded'
  56. "
  57. >
  58. {{
  59. scope.row.isUpload === '1' || scope.row.isUpload === 1
  60. ? '已上传'
  61. : '未上传'
  62. }}
  63. </span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="uploadTime"
  68. label="上传时间"
  69. width="150"
  70. align="center"
  71. >
  72. <template slot-scope="scope">
  73. {{ scope.row.uploadTime ? scope.row.uploadTime : '--' }}
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. prop="auditedStatus"
  78. label="初审结果"
  79. min-width="120"
  80. align="center"
  81. >
  82. <template slot-scope="scope">
  83. {{ formatAuditStatus(scope.row.auditedStatus) }}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="操作" width="100" align="center" fixed="right">
  87. <template slot-scope="scope">
  88. <el-button
  89. type="text"
  90. size="small"
  91. @click="handleViewDetail(scope.row)"
  92. >
  93. 查看
  94. </el-button>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. </div>
  99. <!-- 财务会计资料 -->
  100. <div v-if="materialGroups.financial.length > 0" class="material-group">
  101. <h4 class="group-title">财务会计资料</h4>
  102. <el-table
  103. v-loading="loading"
  104. :data="materialGroups.financial"
  105. style="width: 100%"
  106. border
  107. >
  108. <el-table-column prop="orderNum" label="序号" width="80" align="center">
  109. <template slot-scope="scope">
  110. {{ scope.$index + 1 }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column
  114. prop="informationName"
  115. label="报送资料"
  116. header-align="center"
  117. align="left"
  118. min-width="200"
  119. />
  120. <el-table-column
  121. prop="informationTypeName"
  122. label="资料类型"
  123. min-width="150"
  124. align="center"
  125. />
  126. <el-table-column
  127. prop="isRequired"
  128. label="是否必项"
  129. min-width="120"
  130. align="center"
  131. >
  132. <template slot-scope="scope">
  133. {{
  134. scope.row.isRequired === '1' || scope.row.isRequired === 1
  135. ? '是'
  136. : '否'
  137. }}
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. prop="isUpload"
  142. label="是否上传"
  143. min-width="120"
  144. align="center"
  145. >
  146. <template slot-scope="scope">
  147. <span
  148. :class="
  149. scope.row.isUpload === '1' || scope.row.isUpload === 1
  150. ? 'status-uploaded'
  151. : 'status-not-uploaded'
  152. "
  153. >
  154. {{
  155. scope.row.isUpload === '1' || scope.row.isUpload === 1
  156. ? '已上传'
  157. : '未上传'
  158. }}
  159. </span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. prop="uploadTime"
  164. label="上传时间"
  165. width="150"
  166. align="center"
  167. >
  168. <template slot-scope="scope">
  169. {{ scope.row.uploadTime ? scope.row.uploadTime : '--' }}
  170. </template>
  171. </el-table-column>
  172. <el-table-column
  173. prop="auditedStatus"
  174. label="初审结果"
  175. min-width="120"
  176. align="center"
  177. >
  178. <template slot-scope="scope">
  179. {{ formatAuditStatus(scope.row.auditedStatus) }}
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="操作" width="100" align="center" fixed="right">
  183. <template slot-scope="scope">
  184. <el-button
  185. type="text"
  186. size="small"
  187. @click="handleViewDetail(scope.row)"
  188. >
  189. 查看
  190. </el-button>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. </div>
  195. <!-- 其他资料 -->
  196. <div v-if="materialGroups.other.length > 0" class="material-group">
  197. <h4 class="group-title">其他资料</h4>
  198. <el-table
  199. v-loading="loading"
  200. :data="materialGroups.other"
  201. style="width: 100%"
  202. border
  203. >
  204. <el-table-column prop="orderNum" label="序号" width="80" align="center">
  205. <template slot-scope="scope">
  206. {{ scope.$index + 1 }}
  207. </template>
  208. </el-table-column>
  209. <el-table-column
  210. prop="informationName"
  211. label="报送资料"
  212. header-align="center"
  213. align="left"
  214. min-width="200"
  215. />
  216. <el-table-column
  217. prop="informationTypeName"
  218. label="资料类型"
  219. min-width="150"
  220. align="center"
  221. />
  222. <el-table-column
  223. prop="isRequired"
  224. label="是否必项"
  225. min-width="120"
  226. align="center"
  227. >
  228. <template slot-scope="scope">
  229. {{
  230. scope.row.isRequired === '1' || scope.row.isRequired === 1
  231. ? '是'
  232. : '否'
  233. }}
  234. </template>
  235. </el-table-column>
  236. <el-table-column
  237. prop="isUpload"
  238. label="是否上传"
  239. min-width="120"
  240. align="center"
  241. >
  242. <template slot-scope="scope">
  243. <span
  244. :class="
  245. scope.row.isUpload === '1' || scope.row.isUpload === 1
  246. ? 'status-uploaded'
  247. : 'status-not-uploaded'
  248. "
  249. >
  250. {{
  251. scope.row.isUpload === '1' || scope.row.isUpload === 1
  252. ? '已上传'
  253. : '未上传'
  254. }}
  255. </span>
  256. </template>
  257. </el-table-column>
  258. <el-table-column
  259. prop="uploadTime"
  260. label="上传时间"
  261. width="150"
  262. align="center"
  263. >
  264. <template slot-scope="scope">
  265. {{ scope.row.uploadTime ? scope.row.uploadTime : '--' }}
  266. </template>
  267. </el-table-column>
  268. <el-table-column
  269. prop="auditedStatus"
  270. label="初审结果"
  271. min-width="120"
  272. align="center"
  273. >
  274. <template slot-scope="scope">
  275. {{ formatAuditStatus(scope.row.auditedStatus) }}
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="操作" width="100" align="center" fixed="right">
  279. <template slot-scope="scope">
  280. <el-button
  281. type="text"
  282. size="small"
  283. @click="handleViewDetail(scope.row)"
  284. >
  285. 查看
  286. </el-button>
  287. </template>
  288. </el-table-column>
  289. </el-table>
  290. </div>
  291. <!-- 无数据提示 -->
  292. <div
  293. v-if="
  294. materialGroups.comprehensive.length === 0 &&
  295. materialGroups.financial.length === 0 &&
  296. materialGroups.other.length === 0 &&
  297. !loading
  298. "
  299. class="no-data-tip"
  300. >
  301. <p>暂无报送资料数据</p>
  302. </div>
  303. </div>
  304. </template>
  305. <script>
  306. import { getMaterialByTaskId } from '@/api/home'
  307. export default {
  308. name: 'MaterialTab',
  309. props: {
  310. project: {
  311. type: Object,
  312. default: () => ({}),
  313. },
  314. isView: {
  315. type: Boolean,
  316. default: false,
  317. },
  318. },
  319. data() {
  320. return {
  321. loading: false,
  322. materialData: [],
  323. materialGroups: {
  324. comprehensive: [], // 综合性资料
  325. financial: [], // 财务会计资料
  326. other: [], // 其他资料
  327. },
  328. }
  329. },
  330. watch: {
  331. project: {
  332. handler(newVal) {
  333. if (newVal && newVal.taskId) {
  334. this.loadMaterialData()
  335. }
  336. },
  337. deep: true,
  338. immediate: true,
  339. },
  340. },
  341. methods: {
  342. // 加载报送资料数据
  343. async loadMaterialData() {
  344. if (!this.project || !this.project.taskId) {
  345. return
  346. }
  347. try {
  348. this.loading = true
  349. const res = await getMaterialByTaskId({
  350. taskId: this.project.taskId,
  351. })
  352. if (res && res.state && res.value) {
  353. // 根据接口返回的数据结构进行处理
  354. // 如果返回是数组,直接使用;否则获取 records 或 data
  355. const materialList = Array.isArray(res.value)
  356. ? res.value
  357. : res.value.records || res.value.data || []
  358. this.materialData = materialList
  359. // 按资料类型分组
  360. this.groupMaterialData(materialList)
  361. } else {
  362. this.materialData = []
  363. this.resetMaterialGroups()
  364. }
  365. } catch (error) {
  366. console.error('加载报送资料失败:', error)
  367. this.materialData = []
  368. this.resetMaterialGroups()
  369. } finally {
  370. this.loading = false
  371. }
  372. },
  373. // 按资料类型分组
  374. groupMaterialData(data) {
  375. this.materialGroups.comprehensive = []
  376. this.materialGroups.financial = []
  377. this.materialGroups.other = []
  378. data.forEach((item, index) => {
  379. const typeName = item.informationTypeName || ''
  380. // 根据资料类型名称分类
  381. if (
  382. typeName.includes('财务') ||
  383. typeName.includes('会计') ||
  384. typeName.includes('金融')
  385. ) {
  386. this.materialGroups.financial.push(item)
  387. } else if (
  388. typeName.includes('综合') ||
  389. typeName.includes('基本') ||
  390. typeName.includes('一般')
  391. ) {
  392. this.materialGroups.comprehensive.push(item)
  393. } else {
  394. this.materialGroups.other.push(item)
  395. }
  396. })
  397. },
  398. // 重置分组数据
  399. resetMaterialGroups() {
  400. this.materialGroups.comprehensive = []
  401. this.materialGroups.financial = []
  402. this.materialGroups.other = []
  403. },
  404. // 查看详情
  405. handleViewDetail(row) {
  406. this.$message.info(`查看资料:${row.informationName}`)
  407. // 可在此处添加打开详情弹窗的逻辑
  408. },
  409. // 格式化审核状态
  410. formatAuditStatus(status) {
  411. const statusMap = {
  412. 0: '未审核',
  413. 1: '已审核',
  414. 2: '审核通过',
  415. 3: '审核不通过',
  416. }
  417. return statusMap[status] || '未知'
  418. },
  419. },
  420. }
  421. </script>
  422. <style lang="scss" scoped>
  423. .material-tab-container {
  424. padding: 20px 0;
  425. }
  426. .material-group {
  427. margin-bottom: 30px;
  428. .group-title {
  429. font-size: 14px;
  430. font-weight: 600;
  431. color: #333;
  432. margin: 0 0 15px 0;
  433. padding-left: 10px;
  434. border-left: 4px solid #409eff;
  435. background-color: #f5f7fa;
  436. padding: 10px 15px;
  437. margin-left: -20px;
  438. margin-right: -20px;
  439. padding-left: 26px;
  440. }
  441. }
  442. .no-data-tip {
  443. text-align: center;
  444. padding: 40px 20px;
  445. color: #909399;
  446. font-size: 14px;
  447. }
  448. .status-uploaded {
  449. color: #67c23a;
  450. font-weight: 500;
  451. }
  452. .status-not-uploaded {
  453. color: #f56c6c;
  454. font-weight: 500;
  455. }
  456. </style>