archiveList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div class="archive-list">
  3. <div v-if="activeTab == 'list'">
  4. <!-- 搜索表单 -->
  5. <div class="search-panel">
  6. <el-form :inline="true" :model="searchForm" class="search-form">
  7. <el-form-item label="年度:" prop="projectYear">
  8. <el-date-picker
  9. v-model="searchForm.projectYear"
  10. type="year"
  11. placeholder="选择年"
  12. format="yyyy"
  13. value-format="yyyy"
  14. ></el-date-picker>
  15. </el-form-item>
  16. <el-form-item label="地区:" prop="areaCode">
  17. <el-cascader
  18. v-model="searchForm.areaCode"
  19. :options="districtTree"
  20. :props="districtTreeCascaderProps"
  21. :show-all-levels="false"
  22. clearable
  23. placeholder="请选择地区"
  24. style="width: 200px"
  25. ></el-cascader>
  26. </el-form-item>
  27. <el-form-item label="卷宗号:" prop="archiveNo">
  28. <el-input
  29. v-model="searchForm.archiveNo"
  30. placeholder="请输入卷宗号"
  31. clearable
  32. style="width: 200px"
  33. ></el-input>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button
  37. type="primary"
  38. icon="el-icon-search"
  39. @click="handleSearch"
  40. >
  41. 查询
  42. </el-button>
  43. <el-button
  44. plain
  45. type="primary"
  46. icon="el-icon-refresh"
  47. @click="handleReset"
  48. >
  49. 重置
  50. </el-button>
  51. </el-form-item>
  52. </el-form>
  53. </div>
  54. <!-- 数据表格 -->
  55. <el-table
  56. v-loading="loading"
  57. :data="tableData"
  58. style="width: 100%"
  59. border
  60. row-key="id"
  61. >
  62. <el-table-column
  63. type="index"
  64. label="序号"
  65. width="60"
  66. header-align="center"
  67. align="center"
  68. />
  69. <el-table-column
  70. prop="year"
  71. label="立项年度"
  72. width="100"
  73. header-align="center"
  74. align="center"
  75. />
  76. <el-table-column
  77. prop="areaName"
  78. label="立项地区"
  79. width="100"
  80. header-align="center"
  81. align="center"
  82. ></el-table-column>
  83. <el-table-column
  84. prop="archiveNo"
  85. label="卷宗号"
  86. width="150"
  87. header-align="center"
  88. align="center"
  89. show-overflow-tooltip
  90. />
  91. <el-table-column
  92. prop="projectName"
  93. label="成本监审项目名称"
  94. show-overflow-tooltip
  95. header-align="center"
  96. align="left"
  97. min-width="170"
  98. >
  99. <template slot-scope="scope">
  100. <div class="cell-content cell-content--left">
  101. <span class="project-link" @click="handleDetail(scope.row)">
  102. {{ scope.row.projectName }}
  103. </span>
  104. </div>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. prop="auditedUnitName"
  109. label="监审对象"
  110. header-align="center"
  111. align="left"
  112. min-width="150"
  113. />
  114. <el-table-column
  115. prop="auditPeriod"
  116. label="监审期间"
  117. header-align="center"
  118. align="center"
  119. width="150"
  120. />
  121. <el-table-column
  122. prop="archiveUser"
  123. label="归档人"
  124. width="100"
  125. header-align="center"
  126. align="center"
  127. />
  128. <el-table-column label="操作" align="center" width="250" fixed="right">
  129. <template slot-scope="scope">
  130. <span class="action-buttons">
  131. <el-button
  132. type="text"
  133. size="small"
  134. @click="handleView(scope.row)"
  135. >
  136. 任务详情
  137. </el-button>
  138. <el-button
  139. type="text"
  140. size="small"
  141. @click="handleArchivePreview(scope.row)"
  142. >
  143. 档案详情
  144. </el-button>
  145. <el-button
  146. type="text"
  147. size="small"
  148. @click="handleDownload(scope.row)"
  149. >
  150. 下载
  151. </el-button>
  152. </span>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <el-pagination
  157. style="margin-top: 10px"
  158. background
  159. layout="total, sizes, prev, pager, next"
  160. :current-page="pagination.currentPage"
  161. :page-sizes="[10, 20, 30, 40]"
  162. :page-size="pagination.pageSize"
  163. :total="pagination.total"
  164. @current-change="handleCurrentChange"
  165. @size-change="handleSizeChange"
  166. />
  167. </div>
  168. <!-- 任务详情弹窗 -->
  169. <taskDetail ref="taskDetail" />
  170. <!-- 档案详情预览弹窗 -->
  171. <el-dialog
  172. :visible.sync="previewDialogVisible"
  173. width="65%"
  174. title="档案详情预览"
  175. :close-on-click-modal="false"
  176. >
  177. <div class="preview-container">
  178. <iframe
  179. v-if="previewUrl"
  180. :src="previewUrl"
  181. frameborder="0"
  182. class="preview-iframe"
  183. ></iframe>
  184. </div>
  185. </el-dialog>
  186. </div>
  187. </template>
  188. <script>
  189. import taskDetail from '@/components/task/taskDetail.vue'
  190. import { getArchiveList } from '@/api/audit/archive'
  191. import { getSysPropertiesAlias } from '@/api/properties'
  192. import { regionMixin } from '@/mixins/useDict'
  193. export default {
  194. name: 'ArchiveList',
  195. components: {
  196. taskDetail,
  197. },
  198. mixins: [regionMixin],
  199. data() {
  200. return {
  201. searchForm: {
  202. projectYear: '2025',
  203. areaCode: [],
  204. archiveNo: '',
  205. },
  206. loading: false,
  207. tableData: [],
  208. // 分页配置
  209. pagination: {
  210. currentPage: 1,
  211. pageSize: 10,
  212. total: 0,
  213. },
  214. activeTab: 'list',
  215. // 系统属性值
  216. sysKkUrl: '',
  217. // 预览对话框
  218. previewDialogVisible: false,
  219. previewUrl:
  220. 'http://1.71.9.215:8012/onlinePreview?url=aHR0cDovLzEuNzEuOS4yMTU6ODAxMi9kZW1vL%2BWNt%2BWul18xOTk5MzA5NDM3MzY2NTQyMzM2XzIwMjUxMjEyMTQwNjI4XzM5MygxKS5kb2N4',
  221. }
  222. },
  223. created() {
  224. this.fetchData()
  225. this.getSysKkUrl()
  226. },
  227. methods: {
  228. // 获取数据
  229. async fetchData() {
  230. try {
  231. this.loading = true
  232. const params = {
  233. currentPage: this.pagination.currentPage,
  234. pageSize: this.pagination.pageSize,
  235. projectYear: this.searchForm.projectYear,
  236. areaCode:
  237. this.searchForm.areaCode && this.searchForm.areaCode.length > 0
  238. ? this.searchForm.areaCode[this.searchForm.areaCode.length - 1]
  239. : '',
  240. archiveNo: this.searchForm.archiveNo,
  241. isGd: 1, // 已归档
  242. }
  243. const response = await getArchiveList(params)
  244. // 根据API返回格式处理数据
  245. if (response && response.value) {
  246. // 获取记录列表
  247. const records = response.value.records || []
  248. // 转换数据格式
  249. this.tableData = records
  250. // 设置总数
  251. this.pagination.total = response.value.total || 0
  252. // 批量获取区域名称
  253. this.fetchRegionNames(this.tableData, 'region')
  254. } else {
  255. this.tableData = []
  256. this.pagination.total = 0
  257. }
  258. } catch (error) {
  259. // this.$message.error('加载列表失败')
  260. console.error('加载列表失败:', error)
  261. this.tableData = []
  262. this.pagination.total = 0
  263. } finally {
  264. this.loading = false
  265. }
  266. },
  267. handleSearch() {
  268. this.pagination.currentPage = 1
  269. this.fetchData()
  270. },
  271. handleReset() {
  272. this.searchForm = {
  273. projectYear: '2025',
  274. areaCode: [],
  275. archiveNo: '',
  276. }
  277. this.pagination.currentPage = 1
  278. this.fetchData()
  279. },
  280. // 处理分页变化
  281. handleCurrentChange(current) {
  282. this.pagination.currentPage = current
  283. this.fetchData()
  284. },
  285. handleSizeChange(size) {
  286. this.pagination.pageSize = size
  287. this.pagination.currentPage = 1
  288. this.fetchData()
  289. },
  290. handleDetail(row) {
  291. // 打开任务详情弹窗
  292. this.$refs.taskDetail.open(row, 'chengben')
  293. },
  294. // 获取系统属性值 sys.kk.url
  295. async getSysKkUrl() {
  296. try {
  297. const response = await getSysPropertiesAlias('sys_kk_url')
  298. if (response) {
  299. this.sysKkUrl = response
  300. }
  301. } catch (error) {
  302. console.error('获取系统属性值失败:', error)
  303. }
  304. },
  305. handleView(row) {
  306. // 打开任务详情弹窗
  307. this.$refs.taskDetail.open(row, 'chengben')
  308. },
  309. handleDownload(row) {
  310. // 下载操作
  311. if (!row.archiveUrl) {
  312. this.$message.error('文件下载地址不存在')
  313. return
  314. }
  315. try {
  316. // 创建a标签进行下载
  317. const link = document.createElement('a')
  318. link.style.display = 'none'
  319. link.href = row.archiveUrl
  320. // 从URL中提取文件名或使用默认文件名
  321. const fileName =
  322. row.archiveUrl.split('/').pop() || `archive_${new Date().getTime()}`
  323. link.download = fileName
  324. document.body.appendChild(link)
  325. link.click()
  326. // 移除a标签
  327. document.body.removeChild(link)
  328. this.$message.success('文件下载成功')
  329. } catch (error) {
  330. console.error('下载失败:', error)
  331. this.$message.error('文件下载失败')
  332. }
  333. },
  334. // 档案详情预览
  335. handleArchivePreview(row) {
  336. if (!row.archiveUrl) {
  337. this.$message.error('文件预览地址不存在')
  338. return
  339. }
  340. console.log('http://1.71.9.215:9506' + row.archiveUrl)
  341. // 拼接预览URL
  342. this.previewUrl =
  343. this.sysKkUrl +
  344. encodeURIComponent(
  345. Base64.encode(
  346. 'http://1.71.9.215:9506/profile/upload/20251211/1111、中止定价成本监审通知书_20251211091528_49.docx'
  347. )
  348. )
  349. alert(this.previewUrl)
  350. // 打开预览弹窗
  351. this.previewDialogVisible = true
  352. },
  353. backToList() {
  354. this.activeTab = 'list'
  355. },
  356. },
  357. }
  358. </script>
  359. <style scoped lang="scss">
  360. .archive-list {
  361. padding: 20px;
  362. }
  363. .action-buttons {
  364. display: inline-flex;
  365. gap: 8px;
  366. }
  367. .action-link {
  368. color: #409eff;
  369. cursor: pointer;
  370. text-decoration: none;
  371. transition: color 0.3s;
  372. &:hover {
  373. color: #66b1ff;
  374. text-decoration: underline;
  375. }
  376. }
  377. .project-link {
  378. color: #409eff;
  379. cursor: pointer;
  380. text-decoration: none;
  381. transition: color 0.3s;
  382. &:hover {
  383. color: #66b1ff;
  384. text-decoration: underline;
  385. }
  386. }
  387. .preview-container {
  388. width: 100%;
  389. height: 600px;
  390. }
  391. .preview-iframe {
  392. width: 100%;
  393. height: 100%;
  394. }
  395. </style>