index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <div class="cost-audit-management">
  3. <!-- 成本审核项目列表页面 -->
  4. <div class="audit-list-container">
  5. <div class="search-section">
  6. <el-input
  7. v-model="searchQuery"
  8. placeholder="监审项目名称"
  9. style="width: 300px; margin-right: 10px"
  10. clearable
  11. />
  12. <el-button type="primary" @click="handleSearch">查询</el-button>
  13. </div>
  14. <el-table
  15. v-loading="loading"
  16. class="mb10"
  17. :data="auditProjectList"
  18. style="width: 100%"
  19. border
  20. default-expand-all
  21. row-key="id"
  22. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  23. >
  24. <el-table-column
  25. type="index"
  26. label="序号"
  27. width="80"
  28. header-align="center"
  29. align="center"
  30. >
  31. <template slot-scope="scope">
  32. <!-- 只显示父节点的序号 -->
  33. <span v-if="scope.row.children">
  34. {{ getParentNodeIndex(scope.row) }}
  35. </span>
  36. <span v-else></span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column
  40. prop="projectName"
  41. label="成本监审项目名称"
  42. show-overflow-tooltip
  43. header-align="center"
  44. align="left"
  45. />
  46. <el-table-column
  47. prop="auditObject"
  48. label="监审对象"
  49. header-align="center"
  50. align="left"
  51. />
  52. <el-table-column
  53. prop="auditPeriod"
  54. label="监审期间"
  55. header-align="center"
  56. align="center"
  57. width="120"
  58. />
  59. <el-table-column
  60. prop="source"
  61. label="立项来源"
  62. header-align="center"
  63. align="center"
  64. width="100"
  65. />
  66. <el-table-column
  67. prop="form"
  68. label="监审形式"
  69. header-align="center"
  70. align="center"
  71. width="100"
  72. />
  73. <el-table-column
  74. prop="currentNodeName"
  75. label="状态"
  76. align="center"
  77. width="80"
  78. >
  79. <template slot-scope="scope">
  80. <span v-if="!scope.row.isSubTask">
  81. {{ scope.row.currentNodeName }}
  82. </span>
  83. <span v-else>{{ scope.row.status }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="操作" align="center" width="260">
  87. <template slot-scope="scope">
  88. <span v-if="!scope.row.isSubTask" class="action-buttons">
  89. <el-button type="text" @click="handleOpenDetails(scope.row)">
  90. 任务详情
  91. </el-button>
  92. <el-button
  93. v-if="scope.row.currentNode === 'sdsh'"
  94. type="text"
  95. @click="handleOpenDetails(scope.row)"
  96. >
  97. 任务办理
  98. </el-button>
  99. <el-button type="text" @click="handleCheckRecord(scope.row)">
  100. 备忘录
  101. </el-button>
  102. </span>
  103. <span v-if="scope.row.isSubTask" class="action-buttons">
  104. <el-button
  105. v-if="
  106. scope.row.currentNode === 'clcs' &&
  107. scope.row.status === '审核中'
  108. "
  109. type="text"
  110. @click="handleOpenDetails(scope.row)"
  111. >
  112. 资料初审
  113. </el-button>
  114. <el-button
  115. v-if="
  116. scope.row.currentNode === 'sdshenhe' &&
  117. scope.row.status === '审核中'
  118. "
  119. type="text"
  120. @click="handleOpenDetails(scope.row)"
  121. >
  122. 成本审核
  123. </el-button>
  124. </span>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <el-pagination
  129. background
  130. layout="total, sizes, prev, pager, next"
  131. :current-page="currentPage"
  132. :page-sizes="[10, 20, 30, 40]"
  133. :page-size="pageSize"
  134. :total="total"
  135. @current-change="handleCurrentChange"
  136. @size-change="handleSizeChange"
  137. />
  138. </div>
  139. <!-- 详情弹窗组件 -->
  140. <details-dialog
  141. :id="selectedProject && selectedProject.id"
  142. ref="detailsRef"
  143. :visible.sync="detailsVisible"
  144. :current-node="selectedProject && selectedProject.auditNode"
  145. :current-status="selectedProject && selectedProject.auditStatus"
  146. @close="handleDetailsClose"
  147. />
  148. </div>
  149. </template>
  150. <script>
  151. import detailsDialog from './details.vue'
  152. import taskMixins from './taskMixins.js'
  153. // 成本监审任务列表API
  154. import { getReviewTaskList } from '@/api/audit/auditIndex'
  155. export default {
  156. name: 'CostAuditManagement',
  157. components: {
  158. detailsDialog,
  159. },
  160. mixins: [taskMixins],
  161. data() {
  162. return {
  163. // 分页相关
  164. currentPage: 1,
  165. pageSize: 10,
  166. total: 0,
  167. // 搜索相关
  168. searchQuery: '',
  169. // 列表数据
  170. auditProjectList: [],
  171. // 加载状态
  172. loading: false,
  173. // 详情弹窗相关
  174. detailsVisible: false,
  175. selectedProject: null,
  176. }
  177. },
  178. created() {
  179. this.loadAuditProjectList()
  180. },
  181. methods: {
  182. // 获取父节点的连续序号
  183. getParentNodeIndex(row) {
  184. // 过滤出所有父节点
  185. const parentNodes = this.auditProjectList.filter(
  186. (item) => item.children && item.children.length > 0
  187. )
  188. // 找到当前行在父节点数组中的索引
  189. const index = parentNodes.findIndex((item) => item.id === row.id)
  190. // 返回序号(索引+1)
  191. return index + 1
  192. },
  193. // 加载审核项目列表
  194. async loadAuditProjectList() {
  195. try {
  196. this.loading = true
  197. // 调用API获取数据
  198. const params = {
  199. currentPage: this.currentPage,
  200. pageSize: this.pageSize,
  201. projectName: this.searchQuery,
  202. }
  203. const response = await getReviewTaskList(params)
  204. // 根据API返回格式处理数据
  205. if (response.state && response.value) {
  206. // 获取记录列表
  207. const records = response.value.records || []
  208. // 转换数据格式,将childTasks转换为children以适应表格组件
  209. this.auditProjectList = records.map((record) => {
  210. return {
  211. id: record.id,
  212. projectName: record.projectName,
  213. auditObject: record.auditedUnitName,
  214. auditPeriod: record.auditPeriod,
  215. source: this.getSourceTypeText(record.sourceType),
  216. form: this.getAuditTypeText(record.auditType),
  217. status: this.getStatusText(record.status),
  218. isSubTask: record.pid !== '0',
  219. currentNodeName: record.currentNodeName,
  220. currentNode: record.currentNode,
  221. children: record.childTasks
  222. ? record.childTasks.map((child) => ({
  223. id: child.id,
  224. projectName: child.projectName,
  225. auditObject: child.auditedUnitName,
  226. auditPeriod: record.auditPeriod, // 子任务可能使用父任务的审核期间
  227. source: '',
  228. form: '',
  229. currentNode: child.currentNode,
  230. status: child.status,
  231. isSubTask: true,
  232. }))
  233. : [],
  234. }
  235. })
  236. // 设置总数
  237. this.total = response.value.total || 0
  238. } else {
  239. this.auditProjectList = []
  240. this.total = 0
  241. this.$message.warning('未获取到审核项目数据')
  242. }
  243. } catch (error) {
  244. this.$message.error('加载审核项目列表失败')
  245. console.error('加载审核项目列表失败:', error)
  246. } finally {
  247. this.loading = false
  248. }
  249. },
  250. // 获取来源类型文本
  251. getSourceTypeText(type) {
  252. const typeMap = {
  253. 1: '年度计划内',
  254. 2: '年度计划外',
  255. // 可根据实际需求补充其他类型
  256. }
  257. return typeMap[type] || type
  258. },
  259. // 获取审核类型文本
  260. getAuditTypeText(type) {
  261. const typeMap = {
  262. 1: '定期监审',
  263. 2: '定调价监审',
  264. // 可根据实际需求补充其他类型
  265. }
  266. return typeMap[type] || type
  267. },
  268. // 获取状态文本
  269. getStatusText(status) {
  270. const statusMap = {
  271. ccls: '资料初审',
  272. 200: '审核通过',
  273. clcs: '审核中', // 添加clcs状态映射为审核中
  274. // 可根据实际需求补充其他状态
  275. }
  276. return statusMap[status] || status
  277. },
  278. // 搜索
  279. handleSearch() {
  280. // 搜索逻辑
  281. this.loadAuditProjectList()
  282. },
  283. // 打开详情弹窗
  284. handleOpenDetails(project) {
  285. this.selectedProject = project
  286. this.detailsVisible = true
  287. },
  288. // 详情弹窗关闭处理
  289. handleDetailsClose() {
  290. this.selectedProject = null
  291. this.detailsVisible = false
  292. // 可以在这里添加刷新列表的逻辑
  293. },
  294. // 查记录
  295. handleCheckRecord(project) {
  296. // memoManage
  297. this.$router.push({
  298. name: 'memoManage',
  299. // params: { projectId: project.id }
  300. })
  301. },
  302. // 分页处理
  303. handleSizeChange(size) {
  304. this.pageSize = size
  305. this.loadAuditProjectList()
  306. },
  307. handleCurrentChange(current) {
  308. this.currentPage = current
  309. this.loadAuditProjectList()
  310. },
  311. },
  312. }
  313. </script>
  314. <style scoped>
  315. .cost-audit-management {
  316. padding: 20px;
  317. }
  318. /* 列表页面样式 */
  319. .search-section {
  320. margin-bottom: 20px;
  321. }
  322. .action-buttons {
  323. font-size: 12px;
  324. }
  325. .action-buttons a {
  326. color: #409eff;
  327. text-decoration: none;
  328. }
  329. .separator {
  330. margin: 0 5px;
  331. color: #999;
  332. }
  333. .note-section {
  334. margin-top: 20px;
  335. }
  336. .note-text {
  337. color: #f56c6c;
  338. font-size: 12px;
  339. margin: 5px 0;
  340. }
  341. /* 详情页面样式 */
  342. .audit-detail-container {
  343. margin-top: 20px;
  344. }
  345. .detail-form {
  346. margin-top: 20px;
  347. }
  348. .tab-content {
  349. padding: 20px;
  350. background-color: #f9f9f9;
  351. min-height: 200px;
  352. }
  353. /* 办理页面样式 */
  354. .audit-process-container {
  355. margin-top: 20px;
  356. }
  357. .process-actions {
  358. margin-bottom: 20px;
  359. }
  360. .process-actions .el-button {
  361. margin-right: 10px;
  362. }
  363. /* 响应式设计 */
  364. @media (max-width: 768px) {
  365. .process-steps {
  366. flex-direction: column;
  367. }
  368. .step-line {
  369. width: 2px;
  370. height: 20px;
  371. margin: 5px 0;
  372. }
  373. .documents-layout {
  374. flex-direction: column;
  375. }
  376. .documents-type-list {
  377. width: 100%;
  378. margin-right: 0;
  379. margin-bottom: 20px;
  380. }
  381. .meeting-form .el-row {
  382. flex-direction: column;
  383. }
  384. .meeting-form .el-col {
  385. width: 100%;
  386. }
  387. }
  388. </style>