submitData.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <template>
  2. <div class="audit-review">
  3. <div
  4. v-for="category in materialCategories"
  5. :key="category.type"
  6. class="material-category"
  7. >
  8. <h3 class="category-title">{{ category.typeName }}</h3>
  9. <el-table
  10. v-loading="loading"
  11. :data="category.items"
  12. stripe
  13. style="width: 100%"
  14. >
  15. <el-table-column
  16. prop="orderNum"
  17. label="序号"
  18. width="80"
  19. align="center"
  20. />
  21. <el-table-column
  22. prop="informationName"
  23. label="报送资料"
  24. min-width="200"
  25. />
  26. <el-table-column label="资料类型" width="150" align="center">
  27. <template slot-scope="scope">
  28. <span
  29. v-if="
  30. Number(scope.row.formatRequired) === 2 && scope.row.templateId
  31. "
  32. class="template-tag"
  33. style="cursor: pointer"
  34. title="点击查看模板"
  35. @click="handleViewTemplate(scope.row)"
  36. >
  37. 预置模板
  38. </span>
  39. <span v-else>
  40. {{ getFormatType(scope.row.formatRequired) }}
  41. </span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="是否必项" width="100" align="center">
  45. <template slot-scope="scope">
  46. {{ scope.row.isRequired === '1' ? '是' : '否' }}
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="是否上传" width="100" align="center">
  50. <template slot-scope="scope">
  51. <span
  52. :style="{
  53. color: scope.row.isUpload === '1' ? '#67C23A' : '#F56C6C',
  54. }"
  55. >
  56. {{ scope.row.isUpload === '1' ? '已上传' : '未上传' }}
  57. </span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. prop="createTime"
  62. label="上传时间"
  63. width="150"
  64. align="center"
  65. />
  66. <el-table-column label="初审结果" width="100" align="center">
  67. <template slot-scope="scope">
  68. <span
  69. :class="{
  70. 'result-pending':
  71. !scope.row.auditedStatus || scope.row.auditedStatus === '0',
  72. 'result-pass': scope.row.auditedStatus === '1',
  73. 'result-fail': scope.row.auditedStatus === '2',
  74. }"
  75. >
  76. {{
  77. !scope.row.auditedStatus || scope.row.auditedStatus === '0'
  78. ? '未审核'
  79. : scope.row.auditedStatus === '1'
  80. ? '通过'
  81. : '不通过'
  82. }}
  83. </span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="操作" width="200" align="center">
  87. <template slot-scope="scope">
  88. <el-button
  89. v-if="
  90. scope.row.auditedStatus === '0' &&
  91. (currentStatus === 200 || currentStatus === '200') &&
  92. (currentNode === 'clcs' || currentNode === 'sdsh')
  93. "
  94. type="text"
  95. size="small"
  96. @click="handleAuditMaterial(scope.row)"
  97. >
  98. 审核
  99. </el-button>
  100. <el-button
  101. type="text"
  102. size="small"
  103. @click="handleViewDownload(scope.row)"
  104. >
  105. 查看
  106. </el-button>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </div>
  111. <!-- 资料审核弹窗 -->
  112. <el-dialog
  113. title="资料审核"
  114. :visible.sync="showAuditDialog"
  115. width="400px"
  116. center
  117. :modal="false"
  118. append-to-body
  119. >
  120. <div class="audit-material-info">
  121. <p>
  122. <strong>资料名称:</strong>
  123. {{
  124. (currentAuditMaterial && currentAuditMaterial.informationName) || ''
  125. }}
  126. </p>
  127. </div>
  128. <el-form ref="auditForm" :model="auditForm" label-width="80px">
  129. <el-form-item label="审核结果" prop="auditedStatus">
  130. <el-radio-group v-model="auditForm.auditedStatus">
  131. <el-radio label="1">审核通过</el-radio>
  132. <el-radio label="2">不通过</el-radio>
  133. </el-radio-group>
  134. </el-form-item>
  135. </el-form>
  136. <div slot="footer" class="dialog-footer">
  137. <el-button @click="showAuditDialog = false">取消</el-button>
  138. <el-button type="primary" @click="handleAuditSubmit">提交</el-button>
  139. </div>
  140. </el-dialog>
  141. <!-- 单记录弹窗 -->
  142. <survey-form-dialog
  143. :visible.sync="singleDialogVisible"
  144. :survey-data="{}"
  145. :is-view-mode="true"
  146. :audited-unit-id="
  147. (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
  148. "
  149. :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
  150. :survey-template-id="
  151. (currentTemplateRow &&
  152. (currentTemplateRow.templateId ||
  153. currentTemplateRow.surveyTemplateId)) ||
  154. ''
  155. "
  156. :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
  157. />
  158. <!-- 固定表弹窗(查看模式) -->
  159. <fixed-table-dialog
  160. :visible.sync="fixedDialogVisible"
  161. :is-view-mode="true"
  162. :audited-unit-id="
  163. (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
  164. "
  165. :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
  166. :survey-template-id="
  167. (currentTemplateRow &&
  168. (currentTemplateRow.templateId ||
  169. currentTemplateRow.surveyTemplateId)) ||
  170. ''
  171. "
  172. :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
  173. />
  174. <!-- 动态表弹窗(查看模式) -->
  175. <dynamic-table-dialog
  176. :visible.sync="dynamicDialogVisible"
  177. :is-view-mode="true"
  178. :audited-unit-id="
  179. (currentTemplateRow && currentTemplateRow.auditedUnitId) || ''
  180. "
  181. :upload-id="(currentTemplateRow && currentTemplateRow.uploadId) || ''"
  182. :survey-template-id="
  183. (currentTemplateRow &&
  184. (currentTemplateRow.templateId ||
  185. currentTemplateRow.surveyTemplateId)) ||
  186. ''
  187. "
  188. :catalog-id="(currentTemplateRow && currentTemplateRow.catalogId) || ''"
  189. />
  190. </div>
  191. </template>
  192. <style scoped>
  193. .result-pending {
  194. color: #909399;
  195. }
  196. .result-pass {
  197. color: #67c23a;
  198. }
  199. .result-fail {
  200. color: #f56c6c;
  201. }
  202. </style>
  203. <script>
  204. import {
  205. getTaskRequirementList,
  206. addOrUpdateTaskRequirement,
  207. } from '@/api/audit/auditIndex'
  208. import {
  209. getDataPreliminaryReviewButton,
  210. doProcessBtn,
  211. } from '@/api/dataPreliminaryReview'
  212. import SurveyFormDialog from '@/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue'
  213. import FixedTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue'
  214. import DynamicTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/DynamicTableDialog.vue'
  215. export default {
  216. name: 'AuditReview',
  217. components: {
  218. SurveyFormDialog,
  219. FixedTableDialog,
  220. DynamicTableDialog,
  221. },
  222. props: {
  223. id: {
  224. type: [String, Number],
  225. default: null,
  226. },
  227. currentNode: {
  228. type: String,
  229. default: '',
  230. },
  231. currentStatus: {
  232. type: String,
  233. default: '',
  234. },
  235. materials: {
  236. type: Array,
  237. default: () => [],
  238. },
  239. },
  240. data() {
  241. return {
  242. buttonData: [], //资料初审按钮数据
  243. activeTab: 'materials', // 当前激活的标签页
  244. showRejectDialog: false, // 初审退回弹窗显示状态
  245. showAbortDialog: false, // 中止监审弹窗显示状态
  246. loading: false, // 加载状态
  247. // 初审退回表单数据
  248. rejectForm: {
  249. opinion: '在初审阶段,需补充完善相关材料。',
  250. sendMethods: ['站内消息', '短信通知'],
  251. },
  252. // 中止监审表单数据
  253. abortForm: {
  254. opinion:
  255. '在初审阶段,该企业资料不符合审查要求,中止该单位成本监审资格。',
  256. sendMethods: ['站内消息', '短信通知'],
  257. },
  258. // 资料审核弹窗状态
  259. showAuditDialog: false,
  260. // 当前审核的资料
  261. currentAuditMaterial: null,
  262. // 模板查看相关
  263. currentTemplateRow: null,
  264. singleDialogVisible: false,
  265. fixedDialogVisible: false,
  266. dynamicDialogVisible: false,
  267. // 资料审核表单数据
  268. auditForm: {
  269. auditedStatus: '通过', // 默认审核通过
  270. },
  271. // 报送资料表格数据
  272. materialData: [],
  273. // 按类型分组的材料数据
  274. materialCategories: [],
  275. }
  276. },
  277. watch: {
  278. activeTab(newTab) {
  279. if (newTab === 'costSurvey') {
  280. this.loadCostSurveyData()
  281. }
  282. },
  283. materials: {
  284. handler(newList) {
  285. if (Array.isArray(newList) && newList.length > 0) {
  286. this.materialData = newList
  287. this.processMaterialData()
  288. }
  289. },
  290. deep: true,
  291. immediate: true,
  292. },
  293. },
  294. created() {
  295. if (Array.isArray(this.materials) && this.materials.length > 0) {
  296. this.materialData = this.materials
  297. this.processMaterialData()
  298. } else {
  299. this.loadMaterialData()
  300. }
  301. },
  302. mounted() {
  303. console.log(this.currentNode, '123')
  304. console.log(this.currentStatus, '222')
  305. },
  306. methods: {
  307. // 加载报送资料数据
  308. async loadMaterialData() {
  309. try {
  310. this.loading = true
  311. const response = await getTaskRequirementList(this.id)
  312. console.log('接口返回数据:', response)
  313. // 尝试多种可能的数据结构
  314. this.materialData = response.value || response.data || response || []
  315. // 确保 materialData 是数组
  316. if (!Array.isArray(this.materialData)) {
  317. this.materialData = []
  318. }
  319. this.processMaterialData()
  320. } catch (error) {
  321. console.error('获取报送资料数据失败:', error)
  322. // this.$message.error('获取报送资料数据失败')
  323. } finally {
  324. this.loading = false
  325. }
  326. },
  327. // 处理材料数据按类型分组
  328. processMaterialData() {
  329. // 确保 materialData 存在且为数组
  330. if (!this.materialData || !Array.isArray(this.materialData)) {
  331. this.materialCategories = []
  332. return
  333. }
  334. const typeMap = {
  335. 1: '综合性资料',
  336. 2: '财务会计资料',
  337. 3: '其他资料',
  338. }
  339. const groupedData = {}
  340. this.materialData.forEach((item) => {
  341. const type = item.informationType
  342. if (!groupedData[type]) {
  343. groupedData[type] = {
  344. type: type,
  345. typeName: typeMap[type] || '其他资料',
  346. items: [],
  347. }
  348. }
  349. groupedData[type].items.push(item)
  350. })
  351. // 按指定顺序排列并为每个分类下的材料重新分配序号
  352. this.materialCategories = []
  353. ;['1', '2', '3'].forEach((type) => {
  354. if (groupedData[type]) {
  355. // 为当前分类下的材料重新分配序号,从1开始递增
  356. groupedData[type].items.forEach((item, index) => {
  357. item.orderNum = index + 1
  358. })
  359. this.materialCategories.push(groupedData[type])
  360. }
  361. })
  362. },
  363. // 获取格式类型
  364. getFormatType(formatRequired) {
  365. const formatMap = {
  366. 1: '文档文件',
  367. 2: '预置模板',
  368. 3: 'Excel文件',
  369. }
  370. return formatMap[formatRequired] || '文档文件'
  371. },
  372. // 资料初审按钮点击事件
  373. handleAuditPass(row) {
  374. this.$confirm(`确定要${row.value}吗?`, '提示', {
  375. confirmButtonText: '确定',
  376. cancelButtonText: '取消',
  377. type: 'warning',
  378. })
  379. .then(() => {
  380. // 这里可以添加初审通过的API调用逻辑
  381. doProcessBtn({
  382. taskId: this.id,
  383. key: row.key,
  384. })
  385. .then((res) => {
  386. console.log('接口返回数据:', res)
  387. if (res.code === 200 && res.value) {
  388. this.$message({ type: 'success', message: res.value })
  389. } else {
  390. this.$message({ type: 'error', message: res.message })
  391. }
  392. })
  393. .catch((err) => {
  394. this.$message({ type: 'error', message: err.message })
  395. })
  396. })
  397. .catch(() => {
  398. this.$message({ type: 'info', message: '已取消操作' })
  399. })
  400. },
  401. // 查看下载文件
  402. handleViewDownload(row) {
  403. // this.$message.info(`查看下载文件:${row.name}`)
  404. // 这里可以添加查看下载文件的逻辑
  405. this.handleViewTemplate(row)
  406. },
  407. // 查看预置模板,按模板类型打开不同弹窗
  408. handleViewTemplate(row) {
  409. this.currentTemplateRow = row || null
  410. const t = String(
  411. (row && (row.templateType || row.templatetype)) || ''
  412. ).trim()
  413. if (t === '1') {
  414. this.singleDialogVisible = true
  415. } else if (t === '2') {
  416. this.fixedDialogVisible = true
  417. } else if (t === '3') {
  418. this.dynamicDialogVisible = true
  419. } else {
  420. this.$message.warning('未知的模板类型,无法打开预置模板')
  421. }
  422. },
  423. // 查看报表
  424. handleViewReport(row) {
  425. this.$message.info(`查看报表:${row.name}`)
  426. // 这里可以添加查看报表的逻辑
  427. },
  428. // 处理资料审核点击事件
  429. handleAuditMaterial(row) {
  430. this.currentAuditMaterial = { ...row } // 复制当前行数据
  431. this.auditForm = {
  432. auditedStatus:
  433. this.currentAuditMaterial.auditStatus === '1' ? '通过' : '不通过',
  434. auditOpinion: '',
  435. }
  436. this.showAuditDialog = true
  437. },
  438. // 提交资料审核结果
  439. async handleAuditSubmit() {
  440. try {
  441. this.loading = true
  442. // 更新当前审核材料的审核状态
  443. this.currentAuditMaterial.auditedStatus = this.auditForm.auditedStatus
  444. this.currentAuditMaterial.auditResult = this.auditForm.auditedStatus
  445. // 调用接口提交整个对象
  446. await addOrUpdateTaskRequirement(this.currentAuditMaterial)
  447. this.$message({ type: 'success', message: '资料审核操作已提交' })
  448. // 更新本地数据,使表格显示最新审核结果
  449. this.loadMaterialData()
  450. this.showAuditDialog = false
  451. } catch (error) {
  452. console.error('资料审核提交失败:', error)
  453. // this.$message.error('资料审核提交失败,请重试')
  454. } finally {
  455. this.loading = false
  456. }
  457. },
  458. },
  459. }
  460. </script>
  461. <style scoped>
  462. .audit-review {
  463. padding: 5px;
  464. background-color: #ffffff;
  465. }
  466. .btn-group {
  467. margin-bottom: 20px;
  468. }
  469. .btn-group .el-button {
  470. margin-right: 10px;
  471. }
  472. .material-category {
  473. margin-bottom: 30px;
  474. }
  475. .category-title {
  476. margin: 0 0 15px 0;
  477. padding: 8px 12px;
  478. background-color: #f5f7fa;
  479. border-left: 4px solid #409eff;
  480. font-size: 16px;
  481. font-weight: 600;
  482. color: #303133;
  483. }
  484. .template-tag {
  485. background-color: #e6f7ff;
  486. color: #1677ff;
  487. padding: 2px 8px;
  488. border-radius: 4px;
  489. font-size: 12px;
  490. }
  491. .result-pass {
  492. color: #67c23a;
  493. font-weight: bold;
  494. }
  495. .result-fail {
  496. color: #f56c6c;
  497. font-weight: bold;
  498. }
  499. /* 表格样式调整 */
  500. .el-table th {
  501. background-color: #fafafa;
  502. }
  503. /* 弹窗样式调整 */
  504. .el-dialog__body {
  505. padding: 20px;
  506. }
  507. .audit-material-info {
  508. margin-bottom: 15px;
  509. padding: 10px;
  510. background-color: #f5f7fa;
  511. border-radius: 4px;
  512. }
  513. .audit-material-info p {
  514. margin: 0;
  515. }
  516. </style>