materialTab.vue 12 KB

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