index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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 === 'sdshenhe'"
  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.currentNode === 'yjfk') &&
  118. scope.row.status === '审核中'
  119. "
  120. type="text"
  121. @click="handleOpenDetails(scope.row)"
  122. >
  123. 成本审核
  124. </el-button>
  125. </span>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <el-pagination
  130. background
  131. layout="total, sizes, prev, pager, next"
  132. :current-page="currentPage"
  133. :page-sizes="[10, 20, 30, 40]"
  134. :page-size="pageSize"
  135. :total="total"
  136. @current-change="handleCurrentChange"
  137. @size-change="handleSizeChange"
  138. />
  139. </div>
  140. <!-- 详情弹窗组件 -->
  141. <details-dialog
  142. :id="selectedProject && selectedProject.id"
  143. ref="detailsRef"
  144. :visible.sync="detailsVisible"
  145. :current-node="selectedProject && selectedProject.currentNode"
  146. :current-status="selectedProject && selectedProject.status"
  147. @close="handleDetailsClose"
  148. @refresh="handleRefresh"
  149. />
  150. </div>
  151. </template>
  152. <script>
  153. import detailsDialog from './details.vue'
  154. import taskMixins from './taskMixins.js'
  155. // 成本监审任务列表API
  156. import { getReviewTaskList } from '@/api/audit/auditIndex'
  157. export default {
  158. name: 'CostAuditManagement',
  159. components: {
  160. detailsDialog,
  161. },
  162. mixins: [taskMixins],
  163. data() {
  164. return {
  165. // 分页相关
  166. currentPage: 1,
  167. pageSize: 10,
  168. total: 0,
  169. // 搜索相关
  170. searchQuery: '',
  171. // 列表数据
  172. auditProjectList: [],
  173. // 加载状态
  174. loading: false,
  175. // 详情弹窗相关
  176. detailsVisible: false,
  177. selectedProject: null,
  178. }
  179. },
  180. created() {
  181. this.loadAuditProjectList()
  182. },
  183. methods: {
  184. // 获取父节点的连续序号
  185. getParentNodeIndex(row) {
  186. // 过滤出所有父节点
  187. const parentNodes = this.auditProjectList.filter(
  188. (item) => item.children && item.children.length > 0
  189. )
  190. // 找到当前行在父节点数组中的索引
  191. const index = parentNodes.findIndex((item) => item.id === row.id)
  192. // 返回序号(索引+1)
  193. return index + 1
  194. },
  195. // 加载审核项目列表
  196. async loadAuditProjectList() {
  197. try {
  198. this.loading = true
  199. // 调用API获取数据
  200. const params = {
  201. currentPage: this.currentPage,
  202. pageSize: this.pageSize,
  203. projectName: this.searchQuery,
  204. }
  205. const response = await getReviewTaskList(params)
  206. // 根据API返回格式处理数据
  207. if (response.state && response.value) {
  208. // 获取记录列表
  209. const records = response.value.records || []
  210. // 转换数据格式,将childTasks转换为children以适应表格组件
  211. this.auditProjectList = records.map((record) => {
  212. return {
  213. id: record.id,
  214. projectName: record.projectName,
  215. auditObject: record.auditedUnitName,
  216. auditPeriod: record.auditPeriod,
  217. source: this.getSourceTypeText(record.sourceType),
  218. form: this.getAuditTypeText(record.auditType),
  219. status: this.getStatusText(record.status),
  220. isSubTask: record.pid !== '0',
  221. currentNodeName: record.currentNodeName,
  222. currentNode: record.currentNode,
  223. children: record.childTasks
  224. ? record.childTasks.map((child) => ({
  225. id: child.id,
  226. projectName: child.projectName,
  227. auditObject: child.auditedUnitName,
  228. auditPeriod: record.auditPeriod, // 子任务可能使用父任务的审核期间
  229. source: '',
  230. form: '',
  231. currentNode: child.currentNode,
  232. status: child.status,
  233. isSubTask: true,
  234. }))
  235. : [],
  236. }
  237. })
  238. // 设置总数
  239. this.total = response.value.total || 0
  240. } else {
  241. this.auditProjectList = []
  242. this.total = 0
  243. this.$message.warning('未获取到审核项目数据')
  244. }
  245. } catch (error) {
  246. this.$message.error('加载审核项目列表失败')
  247. console.error('加载审核项目列表失败:', error)
  248. } finally {
  249. this.loading = false
  250. }
  251. },
  252. // 获取来源类型文本
  253. getSourceTypeText(type) {
  254. const typeMap = {
  255. 1: '年度计划内',
  256. 2: '年度计划外',
  257. // 可根据实际需求补充其他类型
  258. }
  259. return typeMap[type] || type
  260. },
  261. // 获取审核类型文本
  262. getAuditTypeText(type) {
  263. const typeMap = {
  264. 1: '定期监审',
  265. 2: '定调价监审',
  266. // 可根据实际需求补充其他类型
  267. }
  268. return typeMap[type] || type
  269. },
  270. // 获取状态文本
  271. getStatusText(status) {
  272. const statusMap = {
  273. ccls: '资料初审',
  274. 200: '审核通过',
  275. clcs: '审核中', // 添加clcs状态映射为审核中
  276. // 可根据实际需求补充其他状态
  277. }
  278. return statusMap[status] || status
  279. },
  280. // 搜索
  281. handleSearch() {
  282. // 搜索逻辑
  283. this.loadAuditProjectList()
  284. },
  285. // 打开详情弹窗
  286. handleOpenDetails(project) {
  287. console.log('project', project)
  288. this.selectedProject = project
  289. this.detailsVisible = true
  290. },
  291. // 详情弹窗关闭处理
  292. handleDetailsClose() {
  293. this.selectedProject = null
  294. this.detailsVisible = false
  295. // 可以在这里添加刷新列表的逻辑
  296. },
  297. // 刷新表格数据
  298. handleRefresh() {
  299. // 刷新列表数据
  300. this.loadAuditProjectList()
  301. },
  302. // 查记录
  303. handleCheckRecord(project) {
  304. // memoManage
  305. this.$router.push({
  306. name: 'memoManage',
  307. // params: { projectId: project.id }
  308. })
  309. },
  310. // 分页处理
  311. handleSizeChange(size) {
  312. this.pageSize = size
  313. this.loadAuditProjectList()
  314. },
  315. handleCurrentChange(current) {
  316. this.currentPage = current
  317. this.loadAuditProjectList()
  318. },
  319. },
  320. }
  321. </script>
  322. <style scoped>
  323. .cost-audit-management {
  324. padding: 20px;
  325. }
  326. /* 列表页面样式 */
  327. .search-section {
  328. margin-bottom: 20px;
  329. }
  330. .action-buttons {
  331. font-size: 12px;
  332. }
  333. .action-buttons a {
  334. color: #409eff;
  335. text-decoration: none;
  336. }
  337. .separator {
  338. margin: 0 5px;
  339. color: #999;
  340. }
  341. .note-section {
  342. margin-top: 20px;
  343. }
  344. .note-text {
  345. color: #f56c6c;
  346. font-size: 12px;
  347. margin: 5px 0;
  348. }
  349. /* 详情页面样式 */
  350. .audit-detail-container {
  351. margin-top: 20px;
  352. }
  353. .detail-form {
  354. margin-top: 20px;
  355. }
  356. .tab-content {
  357. padding: 20px;
  358. background-color: #f9f9f9;
  359. min-height: 200px;
  360. }
  361. /* 办理页面样式 */
  362. .audit-process-container {
  363. margin-top: 20px;
  364. }
  365. .process-actions {
  366. margin-bottom: 20px;
  367. }
  368. .process-actions .el-button {
  369. margin-right: 10px;
  370. }
  371. /* 响应式设计 */
  372. @media (max-width: 768px) {
  373. .process-steps {
  374. flex-direction: column;
  375. }
  376. .step-line {
  377. width: 2px;
  378. height: 20px;
  379. margin: 5px 0;
  380. }
  381. .documents-layout {
  382. flex-direction: column;
  383. }
  384. .documents-type-list {
  385. width: 100%;
  386. margin-right: 0;
  387. margin-bottom: 20px;
  388. }
  389. .meeting-form .el-row {
  390. flex-direction: column;
  391. }
  392. .meeting-form .el-col {
  393. width: 100%;
  394. }
  395. }
  396. </style>