ArchiveInduction.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613
  1. <template>
  2. <div style="padding: 20px; background-color: #f9f9f9; border-radius: 4px">
  3. <div
  4. style="
  5. display: flex;
  6. justify-content: space-between;
  7. align-items: center;
  8. margin-bottom: 20px;
  9. "
  10. >
  11. <div style="font-size: 16px; font-weight: 500">资料归纳</div>
  12. <div style="display: flex; align-items: center">
  13. <el-button
  14. plain
  15. type="success"
  16. icon="iconfont-5039297 icon-zengjia1"
  17. style="margin-right: 10px"
  18. size="mini"
  19. @click="openAddMaterialDialog"
  20. >
  21. 添加资料
  22. </el-button>
  23. <el-button type="primary" size="mini" @click="handleNextStep">
  24. 下一步
  25. </el-button>
  26. </div>
  27. </div>
  28. <div
  29. style="
  30. margin-top: 20px;
  31. padding: 10px;
  32. background-color: #fff;
  33. border-radius: 4px;
  34. font-size: 14px;
  35. "
  36. >
  37. <span style="color: #606266">总资料页数:</span>
  38. <span style="color: #f56c6c; font-weight: 500">{{ totalPageCount }}</span>
  39. </div>
  40. <!-- 资料列表表格 -->
  41. <el-table
  42. v-loading="loading"
  43. :data="archiveData"
  44. border
  45. style="width: 100%"
  46. >
  47. <el-table-column type="index" label="序号" width="60" align="center" />
  48. <el-table-column
  49. prop="materialName"
  50. label="资料名称"
  51. min-width="300"
  52. align="left"
  53. />
  54. <el-table-column
  55. prop="totalPageCount"
  56. label="资料页数"
  57. width="130"
  58. align="center"
  59. >
  60. <template slot-scope="{ row }">
  61. {{ row.totalPageCount || 0 }}
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. prop="updateTime"
  66. label="最后修改时间"
  67. width="200"
  68. align="center"
  69. />
  70. <el-table-column label="操作" width="200" align="center" fixed="right">
  71. <template slot-scope="{ row }">
  72. <el-button type="text" size="small" @click="handleEditMaterial(row)">
  73. 修改
  74. </el-button>
  75. <el-button type="text" size="small" @click="handleDelete(row)">
  76. 删除
  77. </el-button>
  78. <el-button type="text" size="small" @click="handleViewFiles(row)">
  79. 文件列表
  80. </el-button>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="排序" width="100" align="center" fixed="right">
  84. <template slot-scope="{ row, $index }">
  85. <el-button
  86. v-if="$index !== 0"
  87. type="text"
  88. size="small"
  89. @click="handleMoveUp(row, $index)"
  90. >
  91. 上移
  92. </el-button>
  93. <el-button
  94. v-if="$index !== archiveData.length - 1"
  95. type="text"
  96. size="small"
  97. @click="handleMoveDown(row, $index)"
  98. >
  99. 下移
  100. </el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. <!-- 添加资料弹窗 -->
  105. <CostAuditDialog
  106. :visible.sync="dataDialogVisible"
  107. :title="dataDialogTitle"
  108. :show-confirm-btn="false"
  109. :show-footer="false"
  110. width="80%"
  111. @cancel="handleCancel"
  112. >
  113. <div :class="{ 'view-mode-container': isViewMode }">
  114. <el-form
  115. ref="dataDialogForm"
  116. :model="dataDialogForm"
  117. :rules="dataDialogRules"
  118. style="width: 100%"
  119. >
  120. <el-row :gutter="20">
  121. <el-col :span="8">
  122. <el-form-item label="资料名称" prop="materialName">
  123. <el-input
  124. v-model="dataDialogForm.materialName"
  125. placeholder="请输入资料名称"
  126. clearable
  127. :disabled="isViewMode"
  128. @input="handleMaterialNameInput"
  129. ></el-input>
  130. </el-form-item>
  131. </el-col>
  132. <el-col :span="8">
  133. <el-form-item label="序号" prop="materialOrderNum">
  134. <el-input-number
  135. v-model="dataDialogForm.materialOrderNum"
  136. :min="1"
  137. placeholder="请输入序号"
  138. :disabled="isViewMode"
  139. style="width: 100%"
  140. ></el-input-number>
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. </el-form>
  145. <!-- 查询结果列表 -->
  146. <div v-if="materialQueryList.length > 0" style="margin-top: 20px">
  147. <div style="margin-bottom: 10px; font-weight: 500">
  148. 查询结果列表(点击行添加)
  149. </div>
  150. <el-table
  151. v-loading="dataDialogLoading"
  152. :data="materialQueryList"
  153. border
  154. style="width: 100%"
  155. :row-style="{ cursor: isViewMode ? 'default' : 'pointer' }"
  156. @row-click="!isViewMode && handleAddFileFromList"
  157. >
  158. <el-table-column
  159. type="index"
  160. label="序号"
  161. width="60"
  162. align="center"
  163. />
  164. <el-table-column
  165. prop="materialOrderNum"
  166. label="序号"
  167. width="100"
  168. align="center"
  169. />
  170. <el-table-column
  171. prop="materialName"
  172. label="资料名称"
  173. min-width="200"
  174. align="left"
  175. />
  176. <el-table-column
  177. prop="documentName"
  178. label="文书名称"
  179. min-width="200"
  180. align="left"
  181. />
  182. <el-table-column
  183. prop="documentNo"
  184. label="文号"
  185. width="150"
  186. align="center"
  187. />
  188. <el-table-column
  189. prop="auditedUnit"
  190. label="被监审单位"
  191. min-width="150"
  192. align="left"
  193. />
  194. <el-table-column
  195. prop="generateTime"
  196. label="生成(上传)时间"
  197. width="180"
  198. align="center"
  199. />
  200. <el-table-column
  201. prop="fileSource"
  202. label="文件来源"
  203. width="120"
  204. align="center"
  205. />
  206. <el-table-column
  207. label="操作"
  208. width="100"
  209. align="center"
  210. fixed="right"
  211. >
  212. <template slot-scope="{ row }">
  213. <el-button
  214. v-if="!isViewMode"
  215. type="text"
  216. size="small"
  217. style="color: #409eff"
  218. @click.stop="handleAddFileFromList(row)"
  219. >
  220. 添加
  221. </el-button>
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. </div>
  226. <!-- 已添加列表 -->
  227. <div style="margin-top: 20px">
  228. <div style="margin-bottom: 10px; font-weight: 500">
  229. 已添加列表(共 {{ selectedFileList.length }} 条)
  230. </div>
  231. <el-table :data="selectedFileList" border style="width: 100%">
  232. <el-table-column
  233. prop="materialOrderNum"
  234. label="序号"
  235. width="100"
  236. align="center"
  237. >
  238. <template slot-scope="{ row }">
  239. <el-input-number
  240. v-model="row.materialOrderNum"
  241. :min="1"
  242. size="mini"
  243. :disabled="isViewMode"
  244. style="width: 100%"
  245. @change="handleOrderNumChange"
  246. />
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. prop="documentName"
  251. label="文书名称"
  252. min-width="200"
  253. align="left"
  254. >
  255. <template slot-scope="{ row }">
  256. <el-input
  257. v-model="row.documentName"
  258. size="mini"
  259. placeholder="请输入文书名称"
  260. :disabled="isViewMode"
  261. />
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. prop="documentNo"
  266. label="文号"
  267. width="150"
  268. align="center"
  269. >
  270. <template slot-scope="{ row }">
  271. <el-input
  272. v-model="row.documentNo"
  273. size="mini"
  274. placeholder="请输入文号"
  275. :disabled="isViewMode"
  276. />
  277. </template>
  278. </el-table-column>
  279. <el-table-column
  280. prop="auditedUnit"
  281. label="被监审单位"
  282. min-width="150"
  283. align="left"
  284. >
  285. <template slot-scope="{ row }">
  286. <el-select
  287. v-model="row.auditedUnit"
  288. size="mini"
  289. style="width: 100%"
  290. placeholder="请选择被监审单位"
  291. :disabled="isViewMode"
  292. clearable
  293. filterable
  294. multiple
  295. collapse-tags
  296. >
  297. <el-option
  298. v-for="item in allUnits"
  299. :key="item.unitId"
  300. :label="item.unitName"
  301. :value="item.unitId"
  302. ></el-option>
  303. </el-select>
  304. </template>
  305. </el-table-column>
  306. <el-table-column
  307. prop="generateTime"
  308. label="生成(上传)时间"
  309. width="180"
  310. align="center"
  311. >
  312. <template slot-scope="{ row }">
  313. <el-date-picker
  314. v-model="row.generateTime"
  315. type="datetime"
  316. size="mini"
  317. style="width: 100%"
  318. format="yyyy-MM-dd HH:mm"
  319. value-format="yyyy-MM-dd HH:mm"
  320. placeholder="选择时间"
  321. :disabled="isViewMode"
  322. />
  323. </template>
  324. </el-table-column>
  325. <el-table-column
  326. prop="fileSource"
  327. label="文件来源"
  328. width="120"
  329. align="center"
  330. >
  331. <template slot-scope="{ row }">
  332. <el-select
  333. v-model="row.fileSource"
  334. size="mini"
  335. style="width: 100%"
  336. placeholder="请选择文件来源"
  337. :disabled="isViewMode"
  338. clearable
  339. filterable
  340. allow-create
  341. default-first-option
  342. >
  343. <el-option
  344. label="系统生成电子文书"
  345. value="系统生成电子文书"
  346. />
  347. <el-option
  348. label="监审单位反馈文件"
  349. value="监审单位反馈文件"
  350. />
  351. <el-option
  352. label="监管主体上传文件"
  353. value="监管主体上传文件"
  354. />
  355. </el-select>
  356. </template>
  357. </el-table-column>
  358. <el-table-column
  359. v-if="!isViewMode"
  360. label="操作"
  361. width="100"
  362. align="center"
  363. fixed="right"
  364. >
  365. <template slot-scope="{ row, $index }">
  366. <el-button
  367. type="text"
  368. size="small"
  369. style="color: #f56c6c"
  370. @click="handleDeleteFile(row, $index)"
  371. >
  372. 删除
  373. </el-button>
  374. </template>
  375. </el-table-column>
  376. </el-table>
  377. </div>
  378. <div slot="footer" style="text-align: right; margin-top: 10px">
  379. <el-button
  380. v-if="!isViewMode"
  381. type="primary"
  382. @click="openAddFileDialog"
  383. >
  384. 添加文件
  385. </el-button>
  386. <el-button
  387. v-if="!isViewMode"
  388. type="primary"
  389. @click="handleSaveDataDialog"
  390. >
  391. 保存
  392. </el-button>
  393. <el-button v-if="!isViewMode" @click="handleCancel">取消</el-button>
  394. </div>
  395. </div>
  396. </CostAuditDialog>
  397. <!-- 添加/修改资料弹窗 -->
  398. <CostAuditDialog
  399. :visible.sync="materialDialogVisible"
  400. title="添加/修改资料"
  401. :show-confirm-btn="false"
  402. :show-footer="true"
  403. width="40%"
  404. @cancel="materialDialogVisible = false"
  405. >
  406. <el-form
  407. ref="materialForm"
  408. :model="materialForm"
  409. :rules="materialRules"
  410. label-width="100px"
  411. >
  412. <el-form-item label="资料名称" prop="materialName">
  413. <el-input
  414. v-model="materialForm.materialName"
  415. placeholder="请输入资料名称"
  416. clearable
  417. ></el-input>
  418. </el-form-item>
  419. <el-form-item label="资料序号" prop="materialOrderNum">
  420. <el-input-number
  421. v-model="materialForm.materialOrderNum"
  422. :min="1"
  423. placeholder="请输入资料序号"
  424. style="width: 100%"
  425. ></el-input-number>
  426. </el-form-item>
  427. </el-form>
  428. <div slot="footer" style="text-align: right">
  429. <el-button @click="materialDialogVisible = false">取消</el-button>
  430. <el-button type="primary" @click="handleSaveMaterial">确定</el-button>
  431. </div>
  432. </CostAuditDialog>
  433. <!-- 文件列表弹窗(使用添加文件弹窗) -->
  434. <CostAuditDialog
  435. :visible.sync="addFileDialogVisible"
  436. title="文件列表"
  437. :show-confirm-btn="false"
  438. :show-footer="true"
  439. width="60%"
  440. @cancel="addFileDialogVisible = false"
  441. >
  442. <el-form
  443. ref="addFileForm"
  444. :model="addFileForm"
  445. :rules="addFileRules"
  446. label-width="120px"
  447. >
  448. <el-form-item label="文书名称" prop="documentName">
  449. <el-input
  450. v-model="addFileForm.documentName"
  451. placeholder="请输入文书名称"
  452. clearable
  453. ></el-input>
  454. </el-form-item>
  455. <el-form-item label="文号" prop="documentNumber">
  456. <el-input
  457. v-model="addFileForm.documentNumber"
  458. placeholder="请输入文号"
  459. clearable
  460. ></el-input>
  461. </el-form-item>
  462. <el-form-item label="被监审单位" prop="auditedUnitName">
  463. <el-select
  464. v-model="addFileForm.auditedUnitName"
  465. placeholder="请选择被监审单位"
  466. clearable
  467. filterable
  468. >
  469. <el-option
  470. v-for="item in allUnits"
  471. :key="item.unitId"
  472. :label="item.unitName"
  473. :value="item.unitId"
  474. ></el-option>
  475. </el-select>
  476. </el-form-item>
  477. <el-form-item label="文件来源" prop="fileSource">
  478. <el-select
  479. v-model="addFileForm.fileSource"
  480. placeholder="请选择文件来源"
  481. clearable
  482. filterable
  483. >
  484. <el-option label="系统生成电子文书" value="系统生成电子文书" />
  485. <el-option label="监审单位反馈文件" value="监审单位反馈文件" />
  486. <el-option label="监管主体上传文件" value="监管主体上传文件" />
  487. </el-select>
  488. </el-form-item>
  489. <el-form-item label="上传文件" prop="attachmentUrl">
  490. <el-upload
  491. action="/api/upload"
  492. :on-success="handleUploadSuccess"
  493. :auto-upload="true"
  494. :limit="1"
  495. >
  496. <el-button slot="trigger" type="primary">选择文件</el-button>
  497. <div
  498. slot="tip"
  499. style="color: #909399; font-size: 12px; margin-top: 10px"
  500. >
  501. {{
  502. addFileForm.attachmentUrl
  503. ? '已选择文件: ' + addFileForm.attachmentUrl
  504. : '请选择要上传的文件'
  505. }}
  506. </div>
  507. </el-upload>
  508. </el-form-item>
  509. </el-form>
  510. <div slot="footer" style="text-align: right">
  511. <el-button @click="addFileDialogVisible = false">取消</el-button>
  512. <el-button type="primary" @click="handleAddFile">确定</el-button>
  513. </div>
  514. </CostAuditDialog>
  515. <!-- 文件列表弹窗 -->
  516. <CostAuditDialog
  517. :visible.sync="fileListDialogVisible"
  518. title="文件列表"
  519. :show-confirm-btn="false"
  520. :show-footer="false"
  521. width="80%"
  522. @cancel="fileListDialogVisible = false"
  523. >
  524. <!-- 资料信息展示 -->
  525. <div
  526. v-if="currentEditingMaterial"
  527. style="
  528. margin-bottom: 20px;
  529. padding: 15px;
  530. background-color: #f5f7fa;
  531. border-radius: 4px;
  532. "
  533. >
  534. <el-row :gutter="20">
  535. <el-col :span="12">
  536. <span style="color: #606266; font-size: 14px; margin-right: 10px">
  537. 资料名称:
  538. </span>
  539. <span style="font-weight: 500; font-size: 16px">
  540. {{ currentEditingMaterial.materialName }}
  541. </span>
  542. </el-col>
  543. <el-col :span="12">
  544. <span style="color: #606266; font-size: 14px; margin-right: 10px">
  545. 资料序号:
  546. </span>
  547. <span style="font-weight: 500; font-size: 16px">
  548. {{
  549. currentEditingMaterial.materialOrderNum ||
  550. currentEditingMaterial.orderNum
  551. }}
  552. </span>
  553. </el-col>
  554. </el-row>
  555. </div>
  556. <!-- 新增文件按钮 -->
  557. <div style="text-align: right; margin-bottom: 15px">
  558. <el-button type="primary" plain @click="handleAddNewFile">
  559. 新增文件
  560. </el-button>
  561. </div>
  562. <!-- 文件列表 -->
  563. <draggable
  564. v-model="fileListData"
  565. :options="{ animation: 200, handle: '.drag-handle' }"
  566. tag="div"
  567. class="file-list-draggable"
  568. @change="handleSortFiles"
  569. >
  570. <div
  571. v-for="(row, index) in fileListData"
  572. :key="row.id"
  573. class="file-list-item"
  574. style="
  575. padding: 15px;
  576. border: 1px solid #dcdfe6;
  577. margin-bottom: 10px;
  578. border-radius: 4px;
  579. background-color: #fff;
  580. cursor: move;
  581. "
  582. >
  583. <el-row :gutter="20">
  584. <el-col :span="2">
  585. <div style="text-align: center">
  586. <span
  587. class="drag-handle"
  588. style="cursor: move; color: #909399; font-size: 18px"
  589. >
  590. </span>
  591. <div style="font-size: 12px; margin-top: 5px">
  592. {{ index + 1 }}
  593. </div>
  594. </div>
  595. </el-col>
  596. <el-col :span="6">
  597. <div style="font-size: 14px; font-weight: 500">
  598. {{ row.documentName }}
  599. </div>
  600. <div style="font-size: 12px; color: #909399; margin-top: 5px">
  601. 文书名称
  602. </div>
  603. </el-col>
  604. <el-col :span="4">
  605. <div style="font-size: 14px">{{ row.documentNumber }}</div>
  606. <div style="font-size: 12px; color: #909399; margin-top: 5px">
  607. 文号
  608. </div>
  609. </el-col>
  610. <el-col :span="5">
  611. <div style="font-size: 14px">{{ row.auditedUnitName }}</div>
  612. <div style="font-size: 12px; color: #909399; margin-top: 5px">
  613. 被监审单位
  614. </div>
  615. </el-col>
  616. <el-col :span="3">
  617. <div style="font-size: 14px">{{ row.fileSource }}</div>
  618. <div style="font-size: 12px; color: #909399; margin-top: 5px">
  619. 文件来源
  620. </div>
  621. </el-col>
  622. <el-col :span="2">
  623. <div style="font-size: 14px">{{ row.pageCount || 0 }}</div>
  624. <div style="font-size: 12px; color: #909399; margin-top: 5px">
  625. 页数
  626. </div>
  627. </el-col>
  628. <el-col :span="2" style="text-align: right">
  629. <el-button
  630. type="text"
  631. size="small"
  632. style="margin-right: 5px"
  633. @click="handleEditFile(row)"
  634. >
  635. 修改
  636. </el-button>
  637. <el-button
  638. type="text"
  639. size="small"
  640. @click="handleDeleteDetailFile(row)"
  641. >
  642. 删除
  643. </el-button>
  644. </el-col>
  645. </el-row>
  646. </div>
  647. <div
  648. v-if="fileListData.length === 0"
  649. style="text-align: center; padding: 40px 0; color: #909399"
  650. >
  651. 暂无数据
  652. </div>
  653. </draggable>
  654. <div slot="footer" style="text-align: right; margin-top: 20px">
  655. <el-button @click="fileListDialogVisible = false">关闭</el-button>
  656. </div>
  657. </CostAuditDialog>
  658. <!-- 新增文件弹窗 -->
  659. <CostAuditDialog
  660. :visible.sync="newFileDialogVisible"
  661. :title="isEditingFile ? '修改文件' : '新增文件'"
  662. :show-confirm-btn="false"
  663. :show-footer="true"
  664. width="50%"
  665. @cancel="newFileDialogVisible = false"
  666. >
  667. <el-form
  668. ref="newFileForm"
  669. :model="newFileForm"
  670. :rules="newFileRules"
  671. label-width="100px"
  672. >
  673. <el-row :gutter="20">
  674. <el-col :span="12">
  675. <el-form-item label="文书名称" prop="documentName">
  676. <el-input
  677. v-model="newFileForm.documentName"
  678. placeholder="请输入文书名称"
  679. clearable
  680. ></el-input>
  681. </el-form-item>
  682. </el-col>
  683. <el-col :span="12">
  684. <el-form-item label="文号" prop="documentNumber">
  685. <el-input
  686. v-model="newFileForm.documentNumber"
  687. placeholder="请输入文号"
  688. clearable
  689. ></el-input>
  690. </el-form-item>
  691. </el-col>
  692. </el-row>
  693. <el-row :gutter="20">
  694. <el-col :span="12">
  695. <el-form-item label="被监审单位" prop="auditedUnitName">
  696. <el-select
  697. v-model="newFileForm.auditedUnitName"
  698. placeholder="请选择被监审单位"
  699. clearable
  700. filterable
  701. style="width: 100%"
  702. >
  703. <el-option
  704. v-for="item in allUnits"
  705. :key="item.unitId"
  706. :label="item.unitName"
  707. :value="item.unitId"
  708. ></el-option>
  709. </el-select>
  710. </el-form-item>
  711. </el-col>
  712. <el-col :span="12">
  713. <el-form-item label="文件来源" prop="fileSource">
  714. <el-select
  715. v-model="newFileForm.fileSource"
  716. placeholder="请选择文件来源"
  717. clearable
  718. filterable
  719. style="width: 100%"
  720. >
  721. <el-option label="系统生成电子文书" value="系统生成电子文书" />
  722. <el-option label="监审单位反馈文件" value="监审单位反馈文件" />
  723. <el-option label="监管主体上传文件" value="监管主体上传文件" />
  724. </el-select>
  725. </el-form-item>
  726. </el-col>
  727. </el-row>
  728. <el-row :gutter="20">
  729. <el-col :span="24">
  730. <el-form-item label="上传文件" prop="attachmentUrl">
  731. <UploadComponent
  732. :upload-mode="'single'"
  733. :max-size="50 * 1024 * 1024"
  734. :allowed-types="['xlsx', 'xls', 'doc', 'docx', 'pdf']"
  735. :files-list="newFilesList"
  736. @saveFiles="handleNewFileSaveFiles"
  737. @removeFile="handleNewFileRemoveFile"
  738. />
  739. </el-form-item>
  740. </el-col>
  741. </el-row>
  742. </el-form>
  743. <div slot="footer" style="text-align: right">
  744. <el-button @click="newFileDialogVisible = false">取消</el-button>
  745. <el-button type="primary" @click="handleSaveNewFile">
  746. {{ isEditingFile ? '修改' : '新增' }}
  747. </el-button>
  748. </div>
  749. </CostAuditDialog>
  750. </div>
  751. </template>
  752. <script>
  753. import CostAuditDialog from '@/components/costAudit/CostAuditDialog.vue'
  754. import UploadComponent from '@/components/costAudit/UploadComponent.vue'
  755. import draggable from 'vuedraggable'
  756. import {
  757. addDataInductionList,
  758. saveDataInductionWithDetails,
  759. saveDataInductionFile,
  760. saveDetailInfo,
  761. deleteDetailInfo,
  762. getDetailListByMasterList,
  763. getDataInductionList,
  764. moveDataInductionWithDetails,
  765. deleteDataInductionWithDetails,
  766. } from '@/api/audit/dataInduction'
  767. import { getAllUnitList } from '@/api/auditEntityManage'
  768. export default {
  769. name: 'ArchiveInduction',
  770. components: {
  771. CostAuditDialog,
  772. UploadComponent,
  773. draggable,
  774. },
  775. filters: {
  776. formatDate(value) {
  777. if (!value) return ''
  778. const date = new Date(value)
  779. const year = date.getFullYear()
  780. const month = String(date.getMonth() + 1).padStart(2, '0')
  781. const day = String(date.getDate()).padStart(2, '0')
  782. const hours = String(date.getHours()).padStart(2, '0')
  783. const minutes = String(date.getMinutes()).padStart(2, '0')
  784. return `${year}-${month}-${day} ${hours}:${minutes}`
  785. },
  786. },
  787. props: {
  788. taskId: {
  789. type: String,
  790. default: '',
  791. },
  792. },
  793. data() {
  794. return {
  795. loading: false,
  796. archiveData: [],
  797. totalPageCount: 0,
  798. allUnits: [],
  799. dataDialogTitle: '添加资料',
  800. dataDialogVisible: false,
  801. dataDialogLoading: false,
  802. dataDialogForm: { materialName: '', materialOrderNum: 1 },
  803. dataDialogRules: {
  804. materialName: [
  805. { required: true, message: '请输入资料名称', trigger: 'blur' },
  806. ],
  807. materialOrderNum: [
  808. { required: true, message: '请输入序号', trigger: 'blur' },
  809. ],
  810. },
  811. materialQueryList: [],
  812. selectedFileList: [],
  813. isEditingDataDialog: false,
  814. isViewMode: false,
  815. currentEditMaterialId: null,
  816. materialNameSearchTimer: null,
  817. addFileDialogVisible: false,
  818. addFileForm: {
  819. documentName: '',
  820. documentNumber: '',
  821. auditedUnitName: '',
  822. fileSource: '监管主体上传文件',
  823. attachmentUrl: '',
  824. },
  825. addFileRules: {
  826. documentName: [
  827. { required: true, message: '请输入文书名称', trigger: 'blur' },
  828. ],
  829. documentNumber: [
  830. { required: true, message: '请输入文号', trigger: 'blur' },
  831. ],
  832. auditedUnitName: [
  833. { required: true, message: '请选择被监审单位', trigger: 'change' },
  834. ],
  835. attachmentUrl: [
  836. { required: true, message: '请上传文件', trigger: 'change' },
  837. ],
  838. },
  839. materialDialogVisible: false,
  840. materialForm: {
  841. materialName: '',
  842. materialOrderNum: 1,
  843. },
  844. materialRules: {
  845. materialName: [
  846. { required: true, message: '请输入资料名称', trigger: 'blur' },
  847. ],
  848. materialOrderNum: [
  849. { required: true, message: '请输入资料序号', trigger: 'blur' },
  850. ],
  851. },
  852. currentEditingMaterial: null,
  853. // 文件列表相关
  854. fileListDialogVisible: false,
  855. fileListData: [],
  856. fileListLoading: false,
  857. newFileDialogVisible: false,
  858. newFileForm: {
  859. documentName: '',
  860. documentNumber: '',
  861. auditedUnitName: '',
  862. fileSource: '监管主体上传文件',
  863. attachmentUrl: '',
  864. },
  865. newFileRules: {
  866. documentName: [
  867. { required: true, message: '请输入文书名称', trigger: 'blur' },
  868. ],
  869. documentNumber: [
  870. { required: true, message: '请输入文号', trigger: 'blur' },
  871. ],
  872. auditedUnitName: [
  873. { required: true, message: '请选择被监审单位', trigger: 'change' },
  874. ],
  875. attachmentUrl: [
  876. { required: true, message: '请上传文件', trigger: 'change' },
  877. ],
  878. },
  879. newFilesList: [],
  880. isEditingFile: false,
  881. editingFileId: null,
  882. }
  883. },
  884. watch: {
  885. taskId: {
  886. handler(newVal) {
  887. if (newVal) {
  888. this.loadArchiveData()
  889. }
  890. },
  891. },
  892. },
  893. created() {
  894. this.loadAllUnits()
  895. this.loadArchiveData()
  896. },
  897. methods: {
  898. openAddDataDialog() {
  899. this.dataDialogForm = { materialName: '', materialOrderNum: 1 }
  900. this.materialQueryList = []
  901. this.selectedFileList = []
  902. this.isEditingDataDialog = false
  903. this.isViewMode = false
  904. this.currentEditMaterialId = null
  905. this.dataDialogTitle = '添加资料'
  906. this.dataDialogVisible = true
  907. },
  908. handleMaterialNameInput() {
  909. if (this.materialNameSearchTimer)
  910. clearTimeout(this.materialNameSearchTimer)
  911. this.materialNameSearchTimer = setTimeout(() => {
  912. this.queryMaterialList()
  913. }, 500)
  914. },
  915. async queryMaterialList() {
  916. if (
  917. !this.dataDialogForm.materialName ||
  918. !this.dataDialogForm.materialName.trim()
  919. ) {
  920. this.materialQueryList = []
  921. return
  922. }
  923. if (!this.taskId) {
  924. this.$message.warning('缺少任务信息')
  925. return
  926. }
  927. try {
  928. this.dataDialogLoading = true
  929. const response = await addDataInductionList({
  930. taskId: this.taskId,
  931. materialName: this.dataDialogForm.materialName.trim(),
  932. })
  933. if (response && response.value) {
  934. const list = Array.isArray(response.value)
  935. ? response.value
  936. : response.value.list || []
  937. this.materialQueryList = list.map((item) => ({
  938. id: item.id,
  939. materialOrderNum:
  940. item.materialOrderNum ||
  941. item.orderNum ||
  942. this.dataDialogForm.materialOrderNum,
  943. materialName:
  944. item.materialName || this.dataDialogForm.materialName,
  945. documentName: item.documentName || item.name || '',
  946. documentNo: item.documentNo || item.number || '',
  947. auditedUnit: item.auditedUnit || item.auditedUnitName || '',
  948. generateTime:
  949. item.generateTime || item.createTime || item.updateTime || '',
  950. fileSource: item.fileSource || item.source || '',
  951. originalData: item,
  952. }))
  953. } else {
  954. this.materialQueryList = []
  955. }
  956. } catch (error) {
  957. console.error('查询资料列表失败:', error)
  958. this.materialQueryList = []
  959. } finally {
  960. this.dataDialogLoading = false
  961. }
  962. },
  963. handleAddFileFromList(row) {
  964. const newOrderNum =
  965. this.selectedFileList.length > 0
  966. ? Math.max(
  967. ...this.selectedFileList.map(
  968. (item) => item.materialOrderNum || 0
  969. )
  970. ) + 1
  971. : 1
  972. let auditedUnitArray = []
  973. if (row.auditedUnit) {
  974. if (Array.isArray(row.auditedUnit)) {
  975. auditedUnitArray = row.auditedUnit
  976. } else if (typeof row.auditedUnit === 'string') {
  977. const unitItem = this.allUnits.find(
  978. (unit) =>
  979. unit.unitId === row.auditedUnit ||
  980. unit.unitId === String(row.auditedUnit) ||
  981. unit.unitName === row.auditedUnit
  982. )
  983. if (unitItem) auditedUnitArray = [unitItem.unitId]
  984. }
  985. }
  986. this.selectedFileList.push({
  987. ...row,
  988. materialOrderNum: newOrderNum,
  989. auditedUnit: auditedUnitArray,
  990. })
  991. this.$message.success('添加成功')
  992. },
  993. openAddMaterialDialog() {
  994. this.currentEditingMaterial = null
  995. this.materialForm = {
  996. materialName: '',
  997. materialOrderNum: 1,
  998. }
  999. this.materialDialogVisible = true
  1000. },
  1001. handleEditMaterial(row) {
  1002. this.currentEditingMaterial = row
  1003. this.materialForm = {
  1004. materialName: row.materialName || '',
  1005. materialOrderNum: row.materialOrderNum || row.orderNum || 1,
  1006. }
  1007. this.materialDialogVisible = true
  1008. },
  1009. async handleSaveMaterial() {
  1010. this.$refs.materialForm.validate(async (valid) => {
  1011. if (!valid) return false
  1012. try {
  1013. let params = {
  1014. taskId: this.taskId,
  1015. materialName: this.materialForm.materialName,
  1016. materialOrderNum: this.materialForm.materialOrderNum,
  1017. }
  1018. if (this.currentEditingMaterial) {
  1019. params.id = this.currentEditingMaterial.id
  1020. }
  1021. const response = await saveDataInductionFile(params)
  1022. if (response && response.success !== false) {
  1023. this.$message.success(response.message || '保存成功')
  1024. this.materialDialogVisible = false
  1025. this.handleRefreshData()
  1026. } else {
  1027. this.$message.error(response.message || '保存失败')
  1028. }
  1029. } catch (error) {
  1030. console.error('保存资料失败:', error)
  1031. this.$message.error('保存失败')
  1032. }
  1033. })
  1034. },
  1035. handleViewFiles(row) {
  1036. this.currentEditingMaterial = row
  1037. this.fileListDialogVisible = true
  1038. this.loadFileList(row.id)
  1039. },
  1040. async loadFileList(masterId) {
  1041. try {
  1042. this.fileListLoading = true
  1043. const response = await getDetailListByMasterList(masterId)
  1044. if (response && response.value) {
  1045. this.fileListData = Array.isArray(response.value)
  1046. ? response.value
  1047. : response.value.list || []
  1048. } else {
  1049. this.fileListData = []
  1050. }
  1051. } catch (error) {
  1052. console.error('加载文件列表失败:', error)
  1053. this.fileListData = []
  1054. } finally {
  1055. this.fileListLoading = false
  1056. }
  1057. },
  1058. handleAddNewFile() {
  1059. this.isEditingFile = false
  1060. this.editingFileId = null
  1061. this.newFileForm = {
  1062. documentName: '',
  1063. documentNumber: '',
  1064. auditedUnitName: '',
  1065. fileSource: '监管主体上传文件',
  1066. attachmentUrl: '',
  1067. }
  1068. this.newFilesList = []
  1069. this.newFileDialogVisible = true
  1070. },
  1071. handleNewFileSaveFiles(files) {
  1072. if (files && files.length > 0) {
  1073. const fileInfo = files[0]
  1074. this.newFileForm.attachmentUrl =
  1075. fileInfo.savePath || fileInfo.url || fileInfo.fileUrl
  1076. }
  1077. },
  1078. handleNewFileRemoveFile(index) {
  1079. this.newFilesList.splice(index, 1)
  1080. this.newFileForm.attachmentUrl = ''
  1081. },
  1082. async handleSaveNewFile() {
  1083. this.$refs.newFileForm.validate(async (valid) => {
  1084. if (!valid) return false
  1085. try {
  1086. const params = {
  1087. masterId: this.currentEditingMaterial.id,
  1088. taskId: this.taskId,
  1089. documentName: this.newFileForm.documentName,
  1090. documentNumber: this.newFileForm.documentNumber,
  1091. auditedUnitName: this.newFileForm.auditedUnitName,
  1092. fileSource: this.newFileForm.fileSource,
  1093. attachmentUrl: this.newFileForm.attachmentUrl,
  1094. }
  1095. if (this.isEditingFile) {
  1096. params.id = this.editingFileId
  1097. }
  1098. const response = await saveDetailInfo(params)
  1099. if (response && response.success !== false) {
  1100. this.$message.success(
  1101. response.message ||
  1102. (this.isEditingFile ? '文件修改成功' : '文件添加成功')
  1103. )
  1104. this.newFileDialogVisible = false
  1105. this.loadFileList(this.currentEditingMaterial.id)
  1106. } else {
  1107. this.$message.error(response.message || '保存失败')
  1108. }
  1109. } catch (error) {
  1110. console.error('保存文件失败:', error)
  1111. this.$message.error('保存失败')
  1112. }
  1113. })
  1114. },
  1115. handleEditFile(row) {
  1116. this.isEditingFile = true
  1117. this.editingFileId = row.id
  1118. this.newFileForm = {
  1119. documentName: row.documentName || '',
  1120. documentNumber: row.documentNumber || row.documentNo || '',
  1121. auditedUnitName: row.auditedUnitName || '',
  1122. fileSource: row.fileSource || '监管主体上传文件',
  1123. attachmentUrl: row.attachmentUrl || '',
  1124. }
  1125. this.newFilesList = row.attachmentUrl
  1126. ? [{ url: row.attachmentUrl }]
  1127. : []
  1128. this.newFileDialogVisible = true
  1129. },
  1130. async handleDeleteDetailFile(row) {
  1131. this.$confirm('确定要删除此文件吗?', '提示', {
  1132. confirmButtonText: '确定',
  1133. cancelButtonText: '取消',
  1134. type: 'warning',
  1135. })
  1136. .then(async () => {
  1137. try {
  1138. const response = await deleteDetailInfo(row.id)
  1139. if (response && response.success !== false) {
  1140. this.$message.success(response.message || '删除成功')
  1141. // 从数组中直接删除,然后执行排序保存
  1142. const index = this.fileListData.findIndex(
  1143. (item) => item.id === row.id
  1144. )
  1145. if (index > -1) {
  1146. this.fileListData.splice(index, 1)
  1147. // 删除后重新排序
  1148. await this.handleSortFiles()
  1149. }
  1150. } else {
  1151. this.$message.error(response.message || '删除失败')
  1152. }
  1153. } catch (error) {
  1154. console.error('删除文件失败:', error)
  1155. this.$message.error('删除失败')
  1156. }
  1157. })
  1158. .catch(() => {})
  1159. },
  1160. handleUploadNewFileSuccess(response, file) {
  1161. // 此方法已经被 handleNewFileSaveFiles 指代
  1162. },
  1163. async handleSortFiles() {
  1164. try {
  1165. if (!this.fileListData || this.fileListData.length === 0) {
  1166. return
  1167. }
  1168. // 一次性保存所有文件的orderNum
  1169. const savePromises = this.fileListData.map((row, index) => {
  1170. const params = {
  1171. id: row.id,
  1172. orderNum: index + 1,
  1173. masterId: this.currentEditingMaterial.id,
  1174. taskId: this.taskId,
  1175. }
  1176. return saveDetailInfo(params)
  1177. })
  1178. await Promise.all(savePromises)
  1179. // 排序成功,不显示提示信息
  1180. // 不需要重新加载,应为fileListData已经是排序后的结果
  1181. } catch (error) {
  1182. console.error('排序失败:', error)
  1183. this.$message.error('排序失败,请重试')
  1184. // 失败时重新加载文件列表
  1185. this.loadFileList(this.currentEditingMaterial.id)
  1186. }
  1187. },
  1188. openAddFileDialog() {
  1189. this.addFileForm = {
  1190. documentName: '',
  1191. documentNumber: '',
  1192. auditedUnitName: '',
  1193. fileSource: '监管主体上传文件',
  1194. attachmentUrl: '',
  1195. }
  1196. this.addFileDialogVisible = true
  1197. },
  1198. handleAddFile() {
  1199. this.$refs.addFileForm.validate(async (valid) => {
  1200. if (!valid) return false
  1201. try {
  1202. const params = {
  1203. masterId: this.currentEditingMaterial.id,
  1204. taskId: this.taskId,
  1205. documentName: this.addFileForm.documentName,
  1206. documentNumber: this.addFileForm.documentNumber,
  1207. auditedUnitName: this.addFileForm.auditedUnitName,
  1208. fileSource: this.addFileForm.fileSource,
  1209. attachmentUrl: this.addFileForm.attachmentUrl,
  1210. }
  1211. const response = await saveDataInductionFile(params)
  1212. if (response && response.success !== false) {
  1213. this.$message.success(response.message || '文件添加成功')
  1214. this.addFileDialogVisible = false
  1215. this.handleRefreshData()
  1216. } else {
  1217. this.$message.error(response.message || '添加失败')
  1218. }
  1219. } catch (error) {
  1220. console.error('添加文件失败:', error)
  1221. this.$message.error('添加失败')
  1222. }
  1223. })
  1224. },
  1225. handleUploadSuccess(response, file) {
  1226. if (response && response.url) {
  1227. this.addFileForm.attachmentUrl = response.url
  1228. }
  1229. },
  1230. handleDeleteFile(row, index) {
  1231. this.$confirm('确定要删除该文件吗?', '提示', {
  1232. confirmButtonText: '确定',
  1233. cancelButtonText: '取消',
  1234. type: 'warning',
  1235. })
  1236. .then(() => {
  1237. this.selectedFileList.splice(index, 1)
  1238. this.$message.success('删除成功')
  1239. })
  1240. .catch(() => {
  1241. this.$message.info('已取消删除')
  1242. })
  1243. },
  1244. async handleSaveDataDialog() {
  1245. if (!this.selectedFileList || this.selectedFileList.length === 0) {
  1246. this.$message.warning('请先添加文件')
  1247. return
  1248. }
  1249. if (!this.taskId) {
  1250. this.$message.warning('缺少任务信息')
  1251. return
  1252. }
  1253. if (
  1254. !this.dataDialogForm.materialName ||
  1255. !this.dataDialogForm.materialName.trim()
  1256. ) {
  1257. this.$message.warning('请输入资料名称')
  1258. return
  1259. }
  1260. try {
  1261. this.dataDialogLoading = true
  1262. const hasMainId =
  1263. this.currentEditMaterialId !== null &&
  1264. this.currentEditMaterialId !== undefined
  1265. const detailList = this.selectedFileList.map((item) => {
  1266. let generateTimeFormatted = item.generateTime || ''
  1267. if (generateTimeFormatted) {
  1268. try {
  1269. if (typeof generateTimeFormatted === 'string') {
  1270. if (
  1271. /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(
  1272. generateTimeFormatted
  1273. )
  1274. ) {
  1275. } else if (
  1276. /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(
  1277. generateTimeFormatted
  1278. )
  1279. ) {
  1280. generateTimeFormatted = generateTimeFormatted.substring(
  1281. 0,
  1282. 16
  1283. )
  1284. } else if (generateTimeFormatted.includes('T')) {
  1285. generateTimeFormatted = generateTimeFormatted
  1286. .replace('T', ' ')
  1287. .replace(/\.\d{3}Z?$/, '')
  1288. .substring(0, 16)
  1289. } else {
  1290. const date = new Date(generateTimeFormatted)
  1291. if (!isNaN(date.getTime())) {
  1292. const year = date.getFullYear()
  1293. const month = String(date.getMonth() + 1).padStart(2, '0')
  1294. const day = String(date.getDate()).padStart(2, '0')
  1295. const hours = String(date.getHours()).padStart(2, '0')
  1296. const minutes = String(date.getMinutes()).padStart(2, '0')
  1297. generateTimeFormatted = `${year}-${month}-${day} ${hours}:${minutes}`
  1298. }
  1299. }
  1300. } else if (generateTimeFormatted instanceof Date) {
  1301. const year = generateTimeFormatted.getFullYear()
  1302. const month = String(
  1303. generateTimeFormatted.getMonth() + 1
  1304. ).padStart(2, '0')
  1305. const day = String(generateTimeFormatted.getDate()).padStart(
  1306. 2,
  1307. '0'
  1308. )
  1309. const hours = String(
  1310. generateTimeFormatted.getHours()
  1311. ).padStart(2, '0')
  1312. const minutes = String(
  1313. generateTimeFormatted.getMinutes()
  1314. ).padStart(2, '0')
  1315. generateTimeFormatted = `${year}-${month}-${day} ${hours}:${minutes}`
  1316. }
  1317. } catch (error) {
  1318. console.warn('时间格式转换失败:', error)
  1319. generateTimeFormatted = ''
  1320. }
  1321. }
  1322. let auditedUnitName = ''
  1323. if (
  1324. item.auditedUnit &&
  1325. Array.isArray(item.auditedUnit) &&
  1326. item.auditedUnit.length > 0
  1327. ) {
  1328. const unitNames = item.auditedUnit
  1329. .map((unitId) => {
  1330. const unitItem = this.allUnits.find(
  1331. (unit) =>
  1332. unit.unitId === unitId || unit.unitId === String(unitId)
  1333. )
  1334. return unitItem ? unitItem.unitName : ''
  1335. })
  1336. .filter((name) => name)
  1337. auditedUnitName = unitNames.join(',')
  1338. } else if (item.auditedUnit && !Array.isArray(item.auditedUnit)) {
  1339. const unitItem = this.allUnits.find(
  1340. (unit) =>
  1341. unit.unitId === item.auditedUnit ||
  1342. unit.unitId === String(item.auditedUnit)
  1343. )
  1344. if (unitItem) auditedUnitName = unitItem.unitName
  1345. }
  1346. const detailItem = {
  1347. documentName: item.documentName || '',
  1348. documentNumber: item.documentNo || '',
  1349. auditedUnitName: auditedUnitName,
  1350. generateTime: generateTimeFormatted,
  1351. fileSource: item.fileSource || '',
  1352. pageCount: item.pageCount || item.originalData?.pageCount || null,
  1353. attachmentId:
  1354. item.attachmentId || item.originalData?.attachmentId || null,
  1355. orderNum: item.materialOrderNum || null,
  1356. }
  1357. if (item.id && hasMainId) detailItem.id = item.id
  1358. return detailItem
  1359. })
  1360. const params = {
  1361. taskId: this.taskId,
  1362. materialName: this.dataDialogForm.materialName.trim(),
  1363. detailList: detailList,
  1364. }
  1365. if (!hasMainId) {
  1366. if (this.dataDialogForm.materialOrderNum)
  1367. params.materialOrderNum = this.dataDialogForm.materialOrderNum
  1368. } else {
  1369. params.id = this.currentEditMaterialId
  1370. }
  1371. const response = await saveDataInductionWithDetails(params)
  1372. if (response && response.success !== false) {
  1373. this.$message.success(response.message || '保存成功')
  1374. this.handleCancel()
  1375. this.handleRefreshData()
  1376. } else {
  1377. this.$message.error(response.message || '保存失败')
  1378. }
  1379. } catch (error) {
  1380. console.error('保存资料失败:', error)
  1381. } finally {
  1382. this.dataDialogLoading = false
  1383. }
  1384. },
  1385. handleCancel() {
  1386. this.dataDialogVisible = false
  1387. this.$nextTick(() => {
  1388. if (this.$refs.dataDialogForm) this.$refs.dataDialogForm.resetFields()
  1389. this.dataDialogForm = { materialName: '', materialOrderNum: 1 }
  1390. this.materialQueryList = []
  1391. this.selectedFileList = []
  1392. this.isEditingDataDialog = false
  1393. this.isViewMode = false
  1394. this.currentEditMaterialId = null
  1395. this.dataDialogTitle = '添加资料'
  1396. if (this.materialNameSearchTimer) {
  1397. clearTimeout(this.materialNameSearchTimer)
  1398. this.materialNameSearchTimer = null
  1399. }
  1400. })
  1401. },
  1402. async loadAllUnits() {
  1403. try {
  1404. const response = await getAllUnitList()
  1405. if (response && response.value) {
  1406. const list = Array.isArray(response.value)
  1407. ? response.value
  1408. : response.value.list || []
  1409. this.allUnits = list.map((item) => ({
  1410. unitId: item.unitId || item.id,
  1411. unitName: item.unitName || item.name || '',
  1412. }))
  1413. } else {
  1414. this.allUnits = []
  1415. }
  1416. } catch (error) {
  1417. console.error('加载被监审单位列表失败:', error)
  1418. this.allUnits = []
  1419. }
  1420. },
  1421. handleDelete(row) {
  1422. this.$confirm(`确定要删除资料"${row.materialName}"吗?`, '提示', {
  1423. confirmButtonText: '确定',
  1424. cancelButtonText: '取消',
  1425. type: 'warning',
  1426. })
  1427. .then(() => {
  1428. // this.archiveData.splice(index, 1)
  1429. deleteDataInductionWithDetails({ id: row.id })
  1430. .then((response) => {
  1431. if (response && response.success !== false) {
  1432. this.$message.success(response.message || '删除成功')
  1433. this.loadArchiveData()
  1434. } else {
  1435. this.$message.error(response.message || '删除失败')
  1436. }
  1437. })
  1438. .catch((error) => {
  1439. // this.$message.error('删除失败')
  1440. console.error('删除资料失败:', error)
  1441. })
  1442. })
  1443. .catch(() => {
  1444. this.$message.info('已取消删除')
  1445. })
  1446. },
  1447. // 上移按钮点击事件
  1448. async handleMoveUp(row, index) {
  1449. if (!row) {
  1450. this.$message.warning('缺少数据信息')
  1451. return
  1452. }
  1453. const materialId = row.id || (row.originalData && row.originalData.id)
  1454. if (!materialId) {
  1455. this.$message.warning('缺少资料ID')
  1456. return
  1457. }
  1458. try {
  1459. const params = {
  1460. id: materialId,
  1461. direction: 'up',
  1462. }
  1463. const response = await moveDataInductionWithDetails(params)
  1464. if (response && response.success !== false) {
  1465. this.$message.success(response.message || '上移成功')
  1466. // 刷新列表
  1467. this.loadArchiveData()
  1468. } else {
  1469. this.$message.error(response.message || '上移失败')
  1470. }
  1471. } catch (error) {
  1472. // this.$message.error('上移失败')
  1473. console.error('上移资料失败:', error)
  1474. }
  1475. },
  1476. // 下移按钮点击事件
  1477. async handleMoveDown(row, index) {
  1478. if (!row) {
  1479. this.$message.warning('缺少数据信息')
  1480. return
  1481. }
  1482. const materialId = row.id || (row.originalData && row.originalData.id)
  1483. if (!materialId) {
  1484. this.$message.warning('缺少资料ID')
  1485. return
  1486. }
  1487. try {
  1488. const params = {
  1489. id: materialId,
  1490. direction: 'down',
  1491. }
  1492. const response = await moveDataInductionWithDetails(params)
  1493. if (response && response.success !== false) {
  1494. this.$message.success(response.message || '下移成功')
  1495. // 刷新列表
  1496. this.loadArchiveData()
  1497. } else {
  1498. this.$message.error(response.message || '下移失败')
  1499. }
  1500. } catch (error) {
  1501. // this.$message.error('下移失败')
  1502. console.error('下移资料失败:', error)
  1503. }
  1504. },
  1505. handleRefreshData() {
  1506. // 刷新数据
  1507. this.loadArchiveData()
  1508. },
  1509. async loadArchiveData() {
  1510. if (!this.taskId) return
  1511. this.loading = true
  1512. try {
  1513. const response = await getDataInductionList({ taskId: this.taskId })
  1514. if (response && response.value) {
  1515. this.archiveData = response.value
  1516. this.totalPageCount = (
  1517. Array.isArray(response.value)
  1518. ? response.value
  1519. : response.value.list || []
  1520. ).reduce(
  1521. (total, item) =>
  1522. total +
  1523. parseInt(
  1524. item.totalPageCount || item.pageCount || item.pageNum || 0
  1525. ),
  1526. 0
  1527. )
  1528. this.archiveData.sort(
  1529. (a, b) => (a.sortOrder || 0) - (b.sortOrder || 0)
  1530. )
  1531. } else {
  1532. this.archiveData = []
  1533. }
  1534. } catch (error) {
  1535. console.error('加载资料归纳列表失败:', error)
  1536. this.archiveData = []
  1537. } finally {
  1538. this.loading = false
  1539. }
  1540. },
  1541. handleNextStep() {
  1542. // 处理下一步操作
  1543. this.$emit('next-step')
  1544. },
  1545. },
  1546. }
  1547. </script>
  1548. <style scoped lang="scss">
  1549. .view-mode-container {
  1550. pointer-events: none;
  1551. .el-input,
  1552. .el-input-number,
  1553. .el-select,
  1554. .el-date-picker,
  1555. .el-textarea {
  1556. pointer-events: none;
  1557. }
  1558. .el-input__inner,
  1559. .el-input-number__input-inner,
  1560. .el-select__input,
  1561. .el-textarea__inner {
  1562. background-color: #f5f7fa;
  1563. border-color: #e4e7ed;
  1564. color: #909399;
  1565. cursor: not-allowed;
  1566. }
  1567. .el-select .el-input.is-disabled .el-input__inner {
  1568. background-color: #f5f7fa;
  1569. border-color: #e4e7ed;
  1570. color: #909399;
  1571. cursor: not-allowed;
  1572. }
  1573. .el-date-editor.el-input {
  1574. .el-input__inner {
  1575. background-color: #f5f7fa;
  1576. border-color: #e4e7ed;
  1577. color: #909399;
  1578. cursor: not-allowed;
  1579. }
  1580. }
  1581. .el-input-number.is-disabled .el-input__inner {
  1582. background-color: #f5f7fa;
  1583. border-color: #e4e7ed;
  1584. color: #909399;
  1585. cursor: not-allowed;
  1586. }
  1587. }
  1588. </style>