submitData.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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. header-align="center"
  26. align="left"
  27. />
  28. <el-table-column label="资料类型" width="200" align="center">
  29. <template slot-scope="scope">
  30. <span
  31. v-if="
  32. Number(scope.row.formatRequired) === 3 && scope.row.templateId
  33. "
  34. style="cursor: pointer"
  35. :title="'点击查看模板'"
  36. >
  37. {{ `预置模板(${getTemplateTypeName(scope.row.templateType)})` }}
  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 === '0' ? '是' : '否' }}
  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="uploadTime"
  62. label="上传时间"
  63. width="150"
  64. align="center"
  65. >
  66. <template slot-scope="scope">
  67. {{ scope.row.uploadTime ? scope.row.uploadTime : '--' }}
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="初审结果" width="100" align="center">
  71. <template slot-scope="scope">
  72. <span
  73. :class="{
  74. 'result-pending':
  75. !scope.row.auditedStatus || scope.row.auditedStatus === '0',
  76. 'result-pass': scope.row.auditedStatus === '1',
  77. 'result-fail': scope.row.auditedStatus === '2',
  78. }"
  79. >
  80. {{
  81. !scope.row.auditedStatus || scope.row.auditedStatus === '0'
  82. ? '未审核'
  83. : scope.row.auditedStatus === '1'
  84. ? '通过'
  85. : '不通过'
  86. }}
  87. </span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="操作" width="200" align="center">
  91. <template slot-scope="scope">
  92. <!-- <el-button
  93. v-if="
  94. scope.row.isUpload === '1' &&
  95. ((scope.row.auditedStatus === '0' &&
  96. (currentStatus === 200 || currentStatus === '200') &&
  97. (currentNode === 'clcs' || currentNode === 'sdsh')) ||
  98. (scope.row.taskNode === 'jtsy' &&
  99. scope.row.auditedStatus === '0') ||
  100. (scope.row.taskNode === 'yjgz' &&
  101. scope.row.auditedStatus === '0'))
  102. "
  103. type="text"
  104. size="small"
  105. @click="handleAuditMaterial(scope.row)"
  106. >
  107. 审核
  108. </el-button> -->
  109. <el-button
  110. v-if="
  111. scope.row.isUpload === '1' && scope.row.auditedStatus === '0'
  112. "
  113. type="text"
  114. size="small"
  115. @click="handleAuditMaterial(scope.row)"
  116. >
  117. 审核
  118. </el-button>
  119. <el-button
  120. type="text"
  121. size="small"
  122. @click="handleViewDownload(scope.row)"
  123. >
  124. 查看
  125. </el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. </div>
  130. <!-- 资料审核弹窗 -->
  131. <el-dialog
  132. title="资料审核"
  133. :visible.sync="showAuditDialog"
  134. width="400px"
  135. center
  136. append-to-body
  137. >
  138. <div class="audit-material-info">
  139. <div class="audit-material-row">
  140. <div class="audit-material-label">资料名称:</div>
  141. <div class="audit-material-value">
  142. {{
  143. (currentAuditMaterial && currentAuditMaterial.informationName) ||
  144. ''
  145. }}
  146. </div>
  147. </div>
  148. </div>
  149. <el-form ref="auditForm" :model="auditForm" label-width="84px">
  150. <el-form-item label="审核结果:" prop="auditedStatus">
  151. <el-radio-group v-model="auditForm.auditedStatus">
  152. <el-radio label="1">审核通过</el-radio>
  153. <el-radio label="2">不通过</el-radio>
  154. </el-radio-group>
  155. </el-form-item>
  156. </el-form>
  157. <div slot="footer" class="dialog-footer">
  158. <el-button type="primary" @click="handleAuditSubmit">提交</el-button>
  159. <el-button @click="showAuditDialog = false">取消</el-button>
  160. </div>
  161. </el-dialog>
  162. <survey-form-dialog
  163. :visible.sync="singleDialogVisible"
  164. :survey-data="{ ...(currentTemplateRow || {}), ...surveyDetailData }"
  165. :is-view-mode="true"
  166. :request-type="2"
  167. :audited-unit-id="
  168. auditedUnitId ||
  169. (currentTemplateRow && currentTemplateRow.auditedUnitId) ||
  170. ''
  171. "
  172. :upload-id="
  173. (currentTemplateRow &&
  174. (currentTemplateRow.uploadId || currentTemplateRow.id)) ||
  175. ''
  176. "
  177. :survey-template-id="
  178. (currentTemplateRow &&
  179. (currentTemplateRow.templateId ||
  180. currentTemplateRow.surveyTemplateId)) ||
  181. ''
  182. "
  183. :catalog-id="
  184. catalogId || (currentTemplateRow && currentTemplateRow.catalogId) || ''
  185. "
  186. />
  187. <fixed-table-dialog
  188. :visible.sync="fixedDialogVisible"
  189. :is-view-mode="true"
  190. :request-type="2"
  191. :project-id="projectId"
  192. :audited-unit-id="
  193. auditedUnitId ||
  194. (currentTemplateRow && currentTemplateRow.auditedUnitId) ||
  195. ''
  196. "
  197. :upload-id="
  198. (currentTemplateRow &&
  199. (currentTemplateRow.uploadId || currentTemplateRow.id)) ||
  200. ''
  201. "
  202. :survey-template-id="
  203. (currentTemplateRow &&
  204. (currentTemplateRow.templateId ||
  205. currentTemplateRow.surveyTemplateId)) ||
  206. ''
  207. "
  208. :catalog-id="
  209. catalogId || (currentTemplateRow && currentTemplateRow.catalogId) || ''
  210. "
  211. :project-audit-periods="projectAuditPeriods"
  212. :project-audit-period="projectAuditPeriod"
  213. :audit-periods="auditPeriods"
  214. :fixed-fields="fixedFields || ''"
  215. :fixed-fieldids="fixedFieldids || ''"
  216. :table-items="tableItems"
  217. />
  218. <dynamic-table-dialog
  219. :visible.sync="dynamicDialogVisible"
  220. :is-view-mode="true"
  221. :request-type="2"
  222. :audited-unit-id="
  223. auditedUnitId ||
  224. (currentTemplateRow && currentTemplateRow.auditedUnitId) ||
  225. ''
  226. "
  227. :upload-id="
  228. (currentTemplateRow &&
  229. (currentTemplateRow.uploadId || currentTemplateRow.id)) ||
  230. ''
  231. "
  232. :survey-template-id="
  233. (currentTemplateRow &&
  234. (currentTemplateRow.templateId ||
  235. currentTemplateRow.surveyTemplateId)) ||
  236. ''
  237. "
  238. :catalog-id="
  239. catalogId || (currentTemplateRow && currentTemplateRow.catalogId) || ''
  240. "
  241. :table-data="dynamicTableData"
  242. :table-items="tableItems"
  243. />
  244. </div>
  245. </template>
  246. <style scoped>
  247. .result-pending {
  248. color: #909399;
  249. }
  250. .result-pass {
  251. color: #67c23a;
  252. }
  253. .result-fail {
  254. color: #f56c6c;
  255. }
  256. </style>
  257. <script>
  258. import {
  259. getTaskRequirementList,
  260. addOrUpdateTaskRequirement,
  261. } from '@/api/audit/auditIndex'
  262. import {
  263. getDataPreliminaryReviewButton,
  264. doProcessBtn,
  265. } from '@/api/dataPreliminaryReview'
  266. import SurveyFormDialog from '@/views/EntDeclaration/auditTaskManagement/components/SurveyFormDialog.vue'
  267. import FixedTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/FixedTableDialog.vue'
  268. import DynamicTableDialog from '@/views/EntDeclaration/auditTaskManagement/components/DynamicTableDialog.vue'
  269. import { getSingleRecordSurveyList } from '@/api/audit/survey'
  270. import { getDynamicTableData } from '@/api/audit/survey'
  271. import { getProjectInformationInfo } from '@/api/auditTaskProcessing'
  272. import { getSurveyDetail } from '@/api/audit/survey'
  273. export default {
  274. name: 'AuditReview',
  275. components: {
  276. SurveyFormDialog,
  277. FixedTableDialog,
  278. DynamicTableDialog,
  279. },
  280. props: {
  281. id: {
  282. type: [String, Number],
  283. default: null,
  284. },
  285. currentNode: {
  286. type: String,
  287. default: '',
  288. },
  289. currentStatus: {
  290. type: String,
  291. default: '',
  292. },
  293. materials: {
  294. type: Array,
  295. default: () => [],
  296. },
  297. auditedUnitId: {
  298. type: [String, Number],
  299. default: '',
  300. },
  301. catalogId: {
  302. type: [String, Number],
  303. default: '',
  304. },
  305. // 任务ID,用于在缺少 uploadId 时回退查询详情
  306. taskId: {
  307. type: [String, Number],
  308. default: '',
  309. },
  310. // 立项信息ID(用于获取监审期间)
  311. projectId: {
  312. type: [String, Number],
  313. default: '',
  314. },
  315. },
  316. data() {
  317. return {
  318. buttonData: [], //资料初审按钮数据
  319. activeTab: 'materials', // 当前激活的标签页
  320. showRejectDialog: false, // 初审退回弹窗显示状态
  321. showAbortDialog: false, // 中止监审弹窗显示状态
  322. loading: false, // 加载状态
  323. // 初审退回表单数据
  324. rejectForm: {
  325. opinion: '在初审阶段,需补充完善相关材料。',
  326. sendMethods: ['站内消息', '短信通知'],
  327. },
  328. // 中止监审表单数据
  329. abortForm: {
  330. opinion:
  331. '在初审阶段,该企业资料不符合审查要求,中止该单位成本监审资格。',
  332. sendMethods: ['站内消息', '短信通知'],
  333. },
  334. // 资料审核弹窗状态
  335. showAuditDialog: false,
  336. // 当前审核的资料
  337. currentAuditMaterial: null,
  338. // 模板查看相关
  339. currentTemplateRow: null,
  340. singleDialogVisible: false,
  341. fixedDialogVisible: false,
  342. dynamicDialogVisible: false,
  343. // 固定表/动态表所需的配置与数据(用于弹窗透传)
  344. fixedFields: '',
  345. fixedFieldids: '',
  346. tableItems: [],
  347. dynamicTableData: [],
  348. // 立项信息监审期间
  349. projectAuditPeriods: [],
  350. projectAuditPeriod: '',
  351. auditPeriods: [],
  352. // 详情回显数据(供单记录弹窗 survey-data 绑定使用)
  353. surveyDetailData: {},
  354. // 资料审核表单数据
  355. auditForm: {
  356. auditedStatus: '1', // 默认审核通过(与单选框label保持一致:'1'/'2')
  357. auditOpinion: '',
  358. },
  359. // 报送资料表格数据
  360. materialData: [],
  361. // 按类型分组的材料数据
  362. materialCategories: [],
  363. }
  364. },
  365. watch: {
  366. activeTab(newTab) {
  367. if (newTab === 'costSurvey') {
  368. this.loadCostSurveyData()
  369. }
  370. },
  371. materials: {
  372. handler(newList) {
  373. if (Array.isArray(newList) && newList.length > 0) {
  374. this.materialData = newList
  375. this.processMaterialData()
  376. }
  377. },
  378. deep: true,
  379. immediate: true,
  380. },
  381. },
  382. created() {
  383. if (Array.isArray(this.materials) && this.materials.length > 0) {
  384. this.materialData = this.materials
  385. this.processMaterialData()
  386. } else {
  387. this.loadMaterialData()
  388. }
  389. },
  390. mounted() {
  391. console.log(this.currentNode, '123')
  392. console.log(this.currentStatus, '222')
  393. },
  394. methods: {
  395. // 加载报送资料数据
  396. async loadMaterialData() {
  397. try {
  398. this.loading = true
  399. const response = await getTaskRequirementList(this.id)
  400. console.log('接口返回数据:', response)
  401. // 尝试多种可能的数据结构
  402. this.materialData = response.value || response.data || response || []
  403. // 确保 materialData 是数组
  404. if (!Array.isArray(this.materialData)) {
  405. this.materialData = []
  406. }
  407. this.processMaterialData()
  408. } catch (error) {
  409. console.error('获取报送资料数据失败:', error)
  410. // this.$message.error('获取报送资料数据失败')
  411. } finally {
  412. this.loading = false
  413. }
  414. },
  415. // 处理材料数据按类型分组
  416. processMaterialData() {
  417. // 确保 materialData 存在且为数组
  418. if (!this.materialData || !Array.isArray(this.materialData)) {
  419. this.materialCategories = []
  420. return
  421. }
  422. const typeMap = {
  423. 1: '综合性资料',
  424. 2: '财务会计资料',
  425. 3: '其他资料',
  426. }
  427. const groupedData = {}
  428. this.materialData.forEach((item) => {
  429. const type = item.informationType
  430. if (!groupedData[type]) {
  431. groupedData[type] = {
  432. type: type,
  433. typeName: typeMap[type] || '其他资料',
  434. items: [],
  435. }
  436. }
  437. groupedData[type].items.push(item)
  438. })
  439. // 按指定顺序排列并为每个分类下的材料重新分配序号
  440. this.materialCategories = []
  441. ;['1', '2', '3'].forEach((type) => {
  442. if (groupedData[type]) {
  443. // 为当前分类下的材料重新分配序号,从1开始递增
  444. groupedData[type].items.forEach((item, index) => {
  445. item.orderNum = index + 1
  446. })
  447. this.materialCategories.push(groupedData[type])
  448. }
  449. })
  450. },
  451. // 获取格式类型
  452. getFormatType(formatRequired) {
  453. const map = {
  454. 1: '文档文件',
  455. 2: 'excel',
  456. 3: '预置模板',
  457. }
  458. const k = Number(formatRequired)
  459. return map[k] || '文档文件'
  460. },
  461. getTemplateTypeName(t) {
  462. const map = {
  463. 1: '单记录',
  464. 2: '固定表',
  465. 3: '动态表',
  466. }
  467. const k = String(t || '').trim()
  468. return map[k] || map[Number(k)] || ''
  469. },
  470. // 资料初审按钮点击事件
  471. handleAuditPass(row) {
  472. this.$confirm(`确定要${row.value}吗?`, '提示', {
  473. confirmButtonText: '确定',
  474. cancelButtonText: '取消',
  475. type: 'warning',
  476. })
  477. .then(() => {
  478. // 这里可以添加初审通过的API调用逻辑
  479. doProcessBtn({
  480. taskId: this.id,
  481. key: row.key,
  482. })
  483. .then((res) => {
  484. console.log('接口返回数据:', res)
  485. if (res.code === 200 && res.value) {
  486. this.$message({ type: 'success', message: res.value })
  487. } else {
  488. this.$message({ type: 'error', message: res.message })
  489. }
  490. })
  491. .catch((err) => {
  492. this.$message({ type: 'error', message: err.message })
  493. })
  494. })
  495. .catch(() => {
  496. this.$message({ type: 'info', message: '已取消操作' })
  497. })
  498. },
  499. // 查看下载文件
  500. handleViewDownload(row) {
  501. // this.$message.info(`查看下载文件:${row.name}`)
  502. // 这里可以添加查看下载文件的逻辑
  503. if (row.fileUrl !== null) {
  504. this.handleFileView(row)
  505. } else {
  506. this.handleViewTemplate(row)
  507. }
  508. },
  509. handleFileView(row) {
  510. console.log(row, '这一行数据')
  511. try {
  512. const filePath =
  513. row?.filePath ||
  514. row?.filepath ||
  515. row?.fileUrl ||
  516. row?.url ||
  517. row?.path ||
  518. ''
  519. if (!filePath) {
  520. this.$message &&
  521. this.$message.warning &&
  522. this.$message.warning('未找到可预览的文件路径')
  523. return
  524. }
  525. const encodedUrl = encodeURIComponent(
  526. Base64.encode((window.context && window.context.form) + filePath)
  527. )
  528. window.open(`${host}:8012/onlinePreview?url=${encodedUrl}`)
  529. // 兼容保留:通知父组件
  530. this.$emit('handleFileView', row)
  531. } catch (e) {
  532. console.error('文件预览失败: ', e)
  533. // this.$message &&
  534. // this.$message.error &&
  535. // this.$message.error('文件预览失败')
  536. }
  537. },
  538. // 查看预置模板,按模板类型打开不同弹窗
  539. async handleViewTemplate(row) {
  540. this.currentTemplateRow = row || null
  541. const t = String(
  542. (row && (row.templateType || row.templatetype)) || ''
  543. ).trim()
  544. if (t === '1') {
  545. // 单记录:清理并预取详情(type=2),与 costSurvey 实现保持一致的回显逻辑
  546. this.surveyDetailData = {}
  547. await this.loadSingleRecordDetail()
  548. this.singleDialogVisible = true
  549. } else if (t === '2') {
  550. // 与 components 版本一致:先拉取固定表表头与项配置
  551. const surveyTemplateId =
  552. (row && (row.surveyTemplateId || row.templateId)) || ''
  553. Promise.all([
  554. this.initFixedTableData(surveyTemplateId),
  555. this.fetchProjectAuditPeriods(),
  556. ]).then(() => {
  557. this.fixedDialogVisible = true
  558. })
  559. } else if (t === '3') {
  560. await this.initDynamicTableData()
  561. this.dynamicDialogVisible = true
  562. } else {
  563. this.$message.warning('未知的模板类型,无法打开预置模板')
  564. }
  565. },
  566. // 预取动态表数据(type=2),与 costSurvey 一致的参数拼装,但本页使用 type=2
  567. async initDynamicTableData() {
  568. this.dynamicTableData = []
  569. const row = this.currentTemplateRow || {}
  570. const uploadId = row.uploadId || row.id || ''
  571. const auditedUnitId = row.auditedUnitId || this.auditedUnitId || ''
  572. const catalogId = row.catalogId || this.catalogId || ''
  573. const surveyTemplateId = row.templateId || row.surveyTemplateId || ''
  574. if (!uploadId) return
  575. try {
  576. const params = {
  577. uploadId,
  578. ...(auditedUnitId ? { auditedUnitId } : {}),
  579. catalogId,
  580. surveyTemplateId,
  581. type: 2,
  582. }
  583. const res = await getDynamicTableData(params)
  584. if (res && res.code === 200) {
  585. const records =
  586. (res.value && (res.value.records || res.value)) || []
  587. this.dynamicTableData = Array.isArray(records) ? records : []
  588. }
  589. } catch (e) {
  590. this.dynamicTableData = []
  591. }
  592. },
  593. // 获取立项信息监审期间,供固定表年份优先回显
  594. async fetchProjectAuditPeriods() {
  595. try {
  596. this.projectAuditPeriods = []
  597. this.projectAuditPeriod = ''
  598. const pid = this.projectId
  599. if (!pid) return
  600. const res = await getProjectInformationInfo(pid)
  601. const periodStr =
  602. (res &&
  603. res.value &&
  604. (res.value.auditPeriod || res.value.auditperiod)) ||
  605. ''
  606. if (typeof periodStr === 'string' && periodStr.trim()) {
  607. const arr = periodStr
  608. .split(',')
  609. .map((y) => String(y).trim())
  610. .filter((y) => /^(19|20)\d{2}$/.test(y))
  611. this.projectAuditPeriods = arr
  612. this.projectAuditPeriod = arr.join(',')
  613. }
  614. } catch (e) {
  615. console.error('获取立项信息监审期间失败', e)
  616. this.projectAuditPeriods = []
  617. this.projectAuditPeriod = ''
  618. }
  619. },
  620. // 预取单记录详情(type=2),将数组结果映射为 { rowid: rvalue } 的对象,供弹窗回显
  621. async loadSingleRecordDetail() {
  622. this.surveyDetailData = {}
  623. const row = this.currentTemplateRow || {}
  624. const uploadId = row.uploadId || row.id || ''
  625. const auditedUnitId = row.auditedUnitId || this.auditedUnitId || ''
  626. const hasUpload = Boolean(uploadId)
  627. const hasTask = Boolean(this.taskId)
  628. if (!hasUpload && !hasTask) return
  629. try {
  630. const params = hasUpload
  631. ? { uploadId, type: 2, ...(auditedUnitId ? { auditedUnitId } : {}) }
  632. : { taskId: this.taskId, type: 2 }
  633. const res = await getSurveyDetail(params)
  634. if (res && res.code === 200 && res.value) {
  635. const detail = {}
  636. const val = res.value
  637. if (Array.isArray(val)) {
  638. val.forEach((item) => {
  639. if (!item || typeof item !== 'object') return
  640. const key =
  641. item.rowid !== undefined
  642. ? item.rowid
  643. : item.rowId !== undefined
  644. ? item.rowId
  645. : item.id !== undefined
  646. ? item.id
  647. : undefined
  648. const value =
  649. item.rvalue !== undefined
  650. ? item.rvalue
  651. : item.rValue !== undefined
  652. ? item.rValue
  653. : item.value !== undefined
  654. ? item.value
  655. : item.val !== undefined
  656. ? item.val
  657. : ''
  658. if (key !== undefined) detail[key] = value
  659. })
  660. } else if (val && typeof val === 'object') {
  661. Object.assign(detail, val)
  662. }
  663. this.surveyDetailData = detail
  664. }
  665. } catch (e) {
  666. this.surveyDetailData = {}
  667. }
  668. },
  669. // 获取固定表配置(表头与项),与 components/task/components/submitData.vue 保持一致
  670. async initFixedTableData(surveyTemplateId) {
  671. try {
  672. this.fixedFields = ''
  673. this.fixedFieldids = ''
  674. this.tableItems = []
  675. if (!surveyTemplateId) return
  676. const params = { surveyTemplateId, type: 2 }
  677. const res = await getSingleRecordSurveyList(params)
  678. if (res && res.code === 200 && res.value) {
  679. this.fixedFields = res.value.fixedFields || ''
  680. this.fixedFieldids = res.value.fixedFieldids || ''
  681. const { itemlist } = res.value || {}
  682. if (Array.isArray(itemlist) && itemlist.length > 0) {
  683. this.tableItems = itemlist.map((item) => ({
  684. id: item.id || item.itemId || '',
  685. rowid: item.rowid || item.id || item.itemId || '',
  686. seq: item.序号,
  687. itemName: item.项目 || item.itemName || '',
  688. unit: item.unit || '',
  689. isCategory: item.isCategory || false,
  690. categorySeq: item.categorySeq || '',
  691. categoryId: item.categoryId || '',
  692. parentid:
  693. item.parentid !== undefined
  694. ? item.parentid
  695. : item.parentId !== undefined
  696. ? item.parentId
  697. : '-1',
  698. validateRules: item.validateRules || {},
  699. linkageRules: item.linkageRules || {},
  700. children: item.children || [],
  701. ...item,
  702. }))
  703. }
  704. }
  705. } catch (e) {
  706. console.error('获取固定表配置失败:', e)
  707. this.tableItems = []
  708. }
  709. },
  710. // 查看报表
  711. handleViewReport(row) {
  712. this.$message.info(`查看报表:${row.name}`)
  713. // 这里可以添加查看报表的逻辑
  714. },
  715. // 处理资料审核点击事件
  716. handleAuditMaterial(row) {
  717. this.currentAuditMaterial = { ...row } // 复制当前行数据
  718. // 弹窗默认选中“审核通过”
  719. this.auditForm = {
  720. auditedStatus: '1',
  721. auditOpinion: '',
  722. }
  723. this.showAuditDialog = true
  724. },
  725. // 提交资料审核结果
  726. async handleAuditSubmit() {
  727. try {
  728. this.loading = true
  729. // 更新当前审核材料的审核状态
  730. this.currentAuditMaterial.auditedStatus = this.auditForm.auditedStatus
  731. this.currentAuditMaterial.auditResult = this.auditForm.auditedStatus
  732. // 调用接口提交整个对象
  733. await addOrUpdateTaskRequirement(this.currentAuditMaterial)
  734. this.$message({ type: 'success', message: '资料审核完成' })
  735. // 更新本地数据,使表格显示最新审核结果
  736. this.loadMaterialData()
  737. this.showAuditDialog = false
  738. } catch (error) {
  739. console.error('资料审核提交失败:', error)
  740. // this.$message.error('资料审核提交失败,请重试')
  741. } finally {
  742. this.loading = false
  743. }
  744. },
  745. },
  746. }
  747. </script>
  748. <style scoped>
  749. .audit-review {
  750. padding: 5px;
  751. background-color: #ffffff;
  752. }
  753. .btn-group {
  754. margin-bottom: 20px;
  755. }
  756. .btn-group .el-button {
  757. margin-right: 10px;
  758. }
  759. .material-category {
  760. margin-bottom: 30px;
  761. }
  762. .category-title {
  763. margin: 0 0 15px 0;
  764. padding: 8px 12px;
  765. background-color: #f5f7fa;
  766. border-left: 4px solid #409eff;
  767. font-size: 16px;
  768. font-weight: 600;
  769. color: #303133;
  770. }
  771. .template-tag {
  772. background-color: #e6f7ff;
  773. color: #1677ff;
  774. padding: 2px 8px;
  775. border-radius: 4px;
  776. font-size: 12px;
  777. }
  778. .result-pass {
  779. color: #67c23a;
  780. font-weight: bold;
  781. }
  782. .result-fail {
  783. color: #f56c6c;
  784. font-weight: bold;
  785. }
  786. /* 表格样式调整 */
  787. .el-table th {
  788. background-color: #fafafa;
  789. }
  790. /* 弹窗样式调整 */
  791. .el-dialog__body {
  792. padding: 20px;
  793. }
  794. .audit-material-info {
  795. margin-bottom: 15px;
  796. padding: 10px;
  797. background-color: #f5f7fa;
  798. border-radius: 4px;
  799. font-size: 14px;
  800. font-weight: 400;
  801. color: #303133;
  802. }
  803. .audit-material-row {
  804. display: flex;
  805. align-items: flex-start;
  806. gap: 8px;
  807. }
  808. .audit-material-label {
  809. flex: 0 0 auto;
  810. white-space: nowrap;
  811. font-weight: 400;
  812. color: #606266;
  813. line-height: 22px;
  814. }
  815. .audit-material-value {
  816. flex: 1 1 auto;
  817. min-width: 0;
  818. font-weight: 400;
  819. color: #303133;
  820. line-height: 22px;
  821. word-break: break-word;
  822. }
  823. ::v-deep .el-dialog--center .el-dialog__footer {
  824. text-align: right;
  825. }
  826. </style>