【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
8.8 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="search-main">
  3. <div class="head-container">
  4. <h2 v-if="this.$route.path.indexOf('dashboard') === -1">模糊检索</h2>
  5. <div class="search-input">
  6. <el-input v-model="keywords" placeholder="请输入内容" class="input-with-select" style="width:50%;" @keyup.enter.native="dimSearch">
  7. <el-select slot="prepend" v-model="select" placeholder="请选择">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value"
  13. />
  14. </el-select>
  15. <el-button slot="append" icon="el-icon-search" @click="handleSearch" />
  16. </el-input>
  17. </div>
  18. </div>
  19. <div v-if="this.$route.path.indexOf('dashboard') === -1" class="search-result">
  20. <div v-show="isShow" class="search-title">
  21. <p>检索结果</p>
  22. <p>本次检索结果共计{{ resNum }}条数据</p>
  23. </div>
  24. <div v-show="resNum > 0">
  25. <el-table
  26. ref="table"
  27. v-loading="loading"
  28. :data="tableData"
  29. style="width: 100%;"
  30. height="calc(100vh - 493px)"
  31. @row-dblclick="handleDbClick"
  32. >
  33. <!-- <el-table-column type="selection" width="55" align="center" /> -->
  34. <el-table-column type="index" label="序号" width="90" align="center" />
  35. <el-table-column prop="child" label="子条数目" align="center" min-width="150" />
  36. <el-table-column prop="category_type" label="门类级别" align="center" min-width="100">
  37. <template slot-scope="scope">
  38. <!-- 门类级别 -->
  39. <span v-if="scope.row.category_type === 5" style="width:56px">文件级</span>
  40. <span v-if="scope.row.category_type === 4" style="width:56px">卷内级</span>
  41. <span v-if="scope.row.category_type === 3" style="width:56px">案卷级</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="case_name" label="门类名称" align="center" min-width="150" />
  45. <el-table-column prop="fonds_no" label="全宗号" align="center" min-width="180" />
  46. <el-table-column prop="archive_no" label="档号" align="center" min-width="180" />
  47. <el-table-column prop="archive_year" label="归档年度" align="center" min-width="100" />
  48. <el-table-column prop="maintitle" label="题名" align="center" min-width="180" />
  49. <el-table-column prop="security_class" label="保密程度" align="center" min-width="100" />
  50. <el-table-column prop="department" label="部门" align="center" min-width="100" />
  51. <el-table-column prop="case_name" label="盒名称" align="center" min-width="180" />
  52. <el-table-column prop="folder_location_details" label="所在位置" align="center" min-width="180" />
  53. <el-table-column prop="create_time" label="创建时间" align="center" min-width="180">
  54. <template slot-scope="scope">
  55. <div>{{ scope.row.create_time | parseTime }}</div>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <el-pagination :page-size.sync="page.size" :total="page.total" :current-page.sync="page.page" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChangeHandler($event)" @current-change="pageChangeHandler" />
  60. </div>
  61. <!-- 详情 -->
  62. <detailDialog ref="detailDom" />
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import detailDialog from './module/detailDialog.vue'
  68. import { queryVagueArchives, FetchArchivesDetails, FetchArchivesMetadata } from '@/api/archivesManage/archivesList'
  69. export default {
  70. name: 'ArchivesSearch',
  71. components: { detailDialog },
  72. data() {
  73. return {
  74. loading: false,
  75. tableData: [],
  76. keywords: '',
  77. select: 'maintitle',
  78. options: [
  79. { value: 'maintitle', label: '题名' },
  80. { value: 'archive_no', label: '档号' },
  81. { value: 'archive_year', label: '年度' },
  82. { value: 'security_class', label: '密级' },
  83. { value: 'case_name', label: '盒名称' },
  84. { value: 'retention', label: '保管期限' },
  85. { value: 'department', label: '部门名称' }
  86. ],
  87. page: {
  88. total: 0,
  89. size: 10,
  90. page: 1
  91. },
  92. resNum: 0,
  93. isShow: false,
  94. params: {
  95. criteria: null,
  96. query: null,
  97. page: null,
  98. size: null
  99. },
  100. homeSearchWords: '',
  101. homeSearchSelect: ''
  102. }
  103. },
  104. mounted() {
  105. if (localStorage.getItem('homeSearchWords') !== null) {
  106. this.keywords = localStorage.getItem('homeSearchWords')
  107. this.select = localStorage.getItem('homeSearchSelect')
  108. this.dimSearch()
  109. }
  110. },
  111. methods: {
  112. // 双击详情
  113. handleDbClick(row) {
  114. const params = {
  115. 'categoryId': row.category_id,
  116. 'archivesId': row.archives_id
  117. }
  118. FetchArchivesDetails(params).then(res => {
  119. if (res) {
  120. const rowData = {}
  121. res.forEach(item => {
  122. rowData[item.fieldName] = item.context
  123. })
  124. this.$refs.detailDom.rowData = rowData
  125. // 元数据
  126. FetchArchivesMetadata(params).then(res => {
  127. this.$refs.detailDom.xmlStr = res
  128. })
  129. this.$refs.detailDom.detailVisible = true
  130. }
  131. })
  132. },
  133. // 首页 / 搜索页切换操作
  134. handleSearch() {
  135. if (this.$route.path.indexOf('dashboard') !== -1) {
  136. this.$router.push('/archivesManage/archivesSearch')
  137. localStorage.setItem('homeSearchWords', this.keywords)
  138. localStorage.setItem('homeSearchSelect', this.select)
  139. } else {
  140. this.dimSearch()
  141. }
  142. },
  143. // 搜索
  144. dimSearch() {
  145. this.loading = true
  146. const arr = this.keywords.trim() // 去空格
  147. if (arr.length === 0) { // 无关键词时无数据
  148. this.tableData = []
  149. this.resNum = 0
  150. this.isShow = false
  151. this.page.total = 0
  152. this.page.size = 10
  153. this.page.page = 1
  154. localStorage.removeItem('homeSearchWords')
  155. localStorage.removeItem('homeSearchSelect')
  156. } else {
  157. this.params.criteria = this.select
  158. this.params.query = this.keywords.replace(/\s+/ig, ' ')
  159. this.params.page = this.page.page - 1
  160. this.params.size = this.page.size
  161. this.doQuery(this.params)
  162. }
  163. this.loading = false
  164. },
  165. // 调用搜索接口
  166. doQuery(params) {
  167. queryVagueArchives(params).then(res => {
  168. this.tableData = res.content
  169. this.page.total = res.totalElements
  170. this.resNum = res.totalElements
  171. this.isShow = true
  172. localStorage.removeItem('homeSearchWords')
  173. localStorage.removeItem('homeSearchSelect')
  174. })
  175. },
  176. // 每页条数改变
  177. sizeChangeHandler(e) {
  178. this.loading = true
  179. this.page.size = e
  180. this.page.page = 1
  181. this.params.size = e
  182. this.params.page = 0
  183. this.doQuery(this.params)
  184. this.loading = false
  185. },
  186. // 当前页改变
  187. pageChangeHandler(e) {
  188. this.loading = true
  189. this.page.page = e
  190. this.params.page = e - 1
  191. this.doQuery(this.params)
  192. this.loading = false
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .search-main{
  199. width: 100%;
  200. }
  201. .head-container{
  202. padding: 100px 0 30px 0;
  203. text-align: center;
  204. h2{
  205. color: #fff;
  206. margin-bottom: 30px;
  207. }
  208. }
  209. .search-area {
  210. height: 100%;
  211. margin: 0;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. & .search-input {
  216. & .el-select .el-input {
  217. width: 130px;
  218. }
  219. }
  220. }
  221. // 补充不生效
  222. ::v-deep .el-input-group {
  223. height: 42px;
  224. & > input {
  225. height: 42px;
  226. border: 1px solid #339cff;
  227. background-color: #021941;
  228. &::placeholder {
  229. color: #fff;
  230. }
  231. }
  232. }
  233. ::v-deep .el-input-group__prepend {
  234. width: 125px;
  235. background-color: #339cff;
  236. border: 1px solid #339cff;
  237. border-radius: 34px 0 0 34px;
  238. border-right: 0;
  239. }
  240. ::v-deep .el-input__inner {
  241. color: #fff;
  242. }
  243. ::v-deep .el-input-group__prepend div.el-select .el-input__inner{
  244. color: #fff;
  245. text-align: center;
  246. }
  247. ::v-deep .el-input-group__append {
  248. width: 72px;
  249. left: -20px;
  250. text-align: center;
  251. background-color: #339cff;
  252. border: 1px solid #339cff;
  253. border-radius: 34px;
  254. & i {
  255. font-size: 25px;
  256. color: #fff;
  257. }
  258. }
  259. //检索结果
  260. .search-result{
  261. padding: 0 20px;
  262. color: #fff;
  263. .search-title{
  264. padding:0 30px;
  265. display: flex;
  266. justify-content: space-between;
  267. margin-bottom: 20px;
  268. }
  269. }
  270. ::v-deep ::-webkit-scrollbar-corner{
  271. background: transparent;
  272. }
  273. </style>