RetrievalView.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <div class="containe">
  3. <div class="picture">
  4. <img src="../../assets/img/Group 467.png" alt="" />
  5. </div>
  6. <div class="search">
  7. <!-- <el-select v-model="type">
  8. <el-option value="1" label="公共文档">公共文档</el-option>
  9. <el-option value="2" label="部门文档">部门文档</el-option>
  10. <el-option value="3" label="个人文档">个人文档</el-option>
  11. </el-select> -->
  12. <el-input
  13. auto-complete="on"
  14. type="text"
  15. name="content"
  16. placeholder="请输入查询关键字"
  17. v-model="input"
  18. @keyup.enter.native="searchPre"
  19. ></el-input>
  20. <span class="cen—top-span" @click="searchPre">快速搜索</span>
  21. <img
  22. src="../../assets/img/ri:search-2-line@2x.png"
  23. class="cen—top-img"
  24. />
  25. </div>
  26. <div class="main1">
  27. <div class="range">
  28. <p class="range-p">文档范围:</p>
  29. <el-radio-group v-model="type" size="small" class="range-ul" fill="#2E8AECFF" text-color="#fff">
  30. <el-radio-button label="1">公共文档</el-radio-button>
  31. <el-radio-button label="2">部门文档</el-radio-button>
  32. <el-radio-button label="3">个人文档</el-radio-button>
  33. </el-radio-group>
  34. </div>
  35. <!-- <div class="category">
  36. <p class="range-p">文档分类:</p>
  37. <ul class="range-ul">
  38. <li>公共文档</li>
  39. <li>部门文档</li>
  40. <li>个人文档</li>
  41. </ul>
  42. </div> -->
  43. <!-- <div class="time">
  44. <span>时间选择:</span>
  45. <el-checkbox-group v-model="checkList">
  46. <el-checkbox label="不限"></el-checkbox>
  47. <el-checkbox label="30天"></el-checkbox>
  48. <el-checkbox label="7天"></el-checkbox>
  49. <el-checkbox label="1天"></el-checkbox>
  50. <el-date-picker
  51. v-model="value1"
  52. type="daterange"
  53. range-separator="至"
  54. start-placeholder="开始日期"
  55. end-placeholder="结束日期"
  56. >
  57. </el-date-picker>
  58. </el-checkbox-group>
  59. </div> -->
  60. </div>
  61. <div class="mains" @scroll="handleScroll" v-if="mains_data2">
  62. <div v-for="item in count" :key="item.id" class="main-main">
  63. <div class="one" @click="docName(item.id, item.content.info)">
  64. {{ item.content.info.docName }}
  65. </div>
  66. <div class="two">
  67. <div class="two1">
  68. <img src="../../assets/img/UserCircle.png" />
  69. {{ item.content.info.createBy }}
  70. </div>
  71. <div>
  72. <img src="../../assets/img/Clock.png" />
  73. {{ item.content.info.createTime }}
  74. </div>
  75. </div>
  76. <div
  77. class="three"
  78. v-for="highlightFieldsContentItem in item.highlightFields.content"
  79. :key="highlightFieldsContentItem.id"
  80. v-html="highlightFieldsContentItem"
  81. style="white-space: normal"
  82. ></div>
  83. <ul class="four">
  84. <li v-for="tagName in item.content.info.tagList" :key="tagName.id">
  85. {{ tagName.tagName }}
  86. </li>
  87. </ul>
  88. </div>
  89. </div>
  90. <div class="mains_prompt" v-if="mains_data2">
  91. <span>滚动显示更多内容</span>
  92. <img src="../../assets/img/chevrons-down.png" alt="" />
  93. </div>
  94. <div class="empty" v-if="mains_data">
  95. <img src="../../assets/img/Empty.png" alt="" />
  96. <p>您搜索的内容暂无数据,建议更换关键词</p>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. import { ret } from "@/api/doc/share1.js";
  102. export default {
  103. data() {
  104. return {
  105. //搜索框绑定
  106. input: "",
  107. type: "",
  108. //搜索出来的数据
  109. count: [],
  110. page: 0,
  111. size: 3,
  112. mains_data: false,
  113. mains_data2: false,
  114. checkList: [],
  115. value1: "",
  116. };
  117. },
  118. created() {
  119. this.input = this.$route.query.datas;
  120. if (this.input) {
  121. this.type = this.$route.query.data2;
  122. this.searchs();
  123. }else{
  124. this.type="1"
  125. }
  126. },
  127. watch: {
  128. $route: {
  129. handler(val, oldval) {
  130. this.input = this.$route.query.datas;
  131. this.count = [];
  132. if (this.input != "") {
  133. this.searchs();
  134. } else {
  135. this.mains_data = true;
  136. this.mains_data2 = false;
  137. }
  138. },
  139. // 深度观察监听
  140. deep: true,
  141. },
  142. },
  143. mounted() {
  144. //添加滚动条事件
  145. window.addEventListener("scroll", this.handleScroll, true);
  146. },
  147. methods: {
  148. // 点击搜索调用的方法
  149. searchPre() {
  150. this.$router.push({
  151. path: "/home/retrieval",
  152. query: { datas: this.input, data2: this.type },
  153. });
  154. },
  155. handleScroll() {
  156. const container = document.querySelector(".mains");
  157. const { scrollTop, scrollHeight, clientHeight } = container;
  158. // console.log('scrollHeight',scrollHeight);
  159. // console.log('clientHeight',clientHeight);
  160. // console.log(scrollTop);
  161. // 是否达到页面底部
  162. if (scrollTop + clientHeight >= scrollHeight) {
  163. // console.log('滚动到底部了!')
  164. this.page += 1;
  165. // 执行加载
  166. this.searchs();
  167. }
  168. },
  169. //查找返回的数据
  170. searchs() {
  171. ret({
  172. content: this.input,
  173. type: this.type,
  174. page: this.page,
  175. size: this.size,
  176. }).then((item) => {
  177. // console.log('item=',item)
  178. if (item.length > 0) {
  179. this.count.push(...item);
  180. this.mains_data = false;
  181. this.mains_data2 = true;
  182. } else {
  183. this.input = "";
  184. this.mains_data = true;
  185. this.mains_data2 = false;
  186. }
  187. });
  188. },
  189. //预览界面
  190. docName(curentDocId, value) {
  191. // this.$tab.openPage(
  192. // window.open('/individual/Pre/user/' + row.docId + "?row=" + JSON.stringify(row),
  193. // '_blank'),
  194. // // window.open("/individual/Pre/user/" + row.docId +"/title/"+ row.docName, '_blank'),
  195. // );
  196. this.$tab.openPage(
  197. // window.open("/individual/Pre/user/" + curentDocId, "_blank"),
  198. window.open(
  199. "/individual/Pre/user/" +
  200. curentDocId +
  201. "?row=" +
  202. JSON.stringify(value),
  203. "_blank"
  204. )
  205. );
  206. },
  207. },
  208. };
  209. </script>
  210. <style lang='scss'>
  211. .three {
  212. margin-bottom: calc(100vw * (10 / 1920));
  213. em {
  214. color: #f00 !important;
  215. }
  216. }
  217. </style>
  218. <style scoped lang='scss'>
  219. .containe {
  220. color: #7ea4c8;
  221. font-size: 0.14rem;
  222. font-family: PingFang SC-Medium, PingFang SC;
  223. font-weight: 500;
  224. }
  225. .picture {
  226. width: calc(100vw * (220 / 1920));
  227. height: calc(100vh * (57 / 1080));
  228. margin-left: calc(100vw * (860 / 1920));
  229. margin-top: calc(100vh * (100 / 1080));
  230. margin-bottom: calc(100vh * (40 / 1080));
  231. img {
  232. width: 100%;
  233. height: 100%;
  234. display: block;
  235. }
  236. }
  237. .search {
  238. width: calc(100vw * (864 / 1920));
  239. height: calc(100vh * (50 / 1080));
  240. margin-left: calc(100vw * (528 / 1920));
  241. margin-bottom: calc(100vh * (50 / 1080));
  242. position: relative;
  243. // background: salmon;
  244. }
  245. .main1 {
  246. width: calc(100vw * (1100 / 1920));
  247. height: calc(100vh * (100 / 1080));
  248. // background: seagreen;
  249. margin-left: calc(100vw * (528 / 1920));
  250. margin-bottom: calc(100vh * (20 / 1080));
  251. .range,
  252. .category {
  253. width: calc(100vw * (480 / 1920));
  254. height: calc(100vh * (36 / 1080));
  255. // margin-left: calc(100vw * (528 / 1920));
  256. margin-bottom: calc(100vh * (30 / 1080));
  257. line-height: calc(100vh * (36 / 1080));
  258. display: flex;
  259. .range-ul {
  260. display: flex;
  261. list-style: none;
  262. padding: 0;
  263. ::v-deep .el-radio-button__inner {
  264. background: transparent;
  265. color: #7EA4C8FF;
  266. border: none;
  267. }
  268. }
  269. }
  270. .time {
  271. width: calc(100vw * (1333 / 1920));
  272. height: calc(100vh * (36 / 1080));
  273. // margin-left: calc(100vw * (528 / 1920));
  274. display: flex;
  275. align-items: center;
  276. .el-checkbox-group {
  277. .el-checkbox {
  278. margin-right: calc(100vw * (40 / 1920));
  279. }
  280. .el-date-picker {
  281. height: calc(100vh * (36 / 1080));
  282. }
  283. }
  284. }
  285. }
  286. .cen—top-img {
  287. width: calc(100vw * (24 / 1920));
  288. height: calc(100vh * (24 / 1080));
  289. position: absolute;
  290. left: calc(100vw * (15 / 1920));
  291. top: calc(100vh * (15 / 1080));
  292. }
  293. .el-input {
  294. width: calc(100vw * (750 / 1920));
  295. height: calc(100vh * (50 / 1080));
  296. margin-right: calc(100vw * (14 / 1920));
  297. }
  298. .cen—top-span {
  299. display: inline-block;
  300. width: calc(100vw * (100 / 1920));
  301. height: calc(100vh * (50 / 1080));
  302. background: #2e8aecff;
  303. color: #ffffffcc;
  304. text-align: center;
  305. line-height: calc(100vh * (50 / 1080));
  306. &:hover {
  307. cursor: pointer;
  308. }
  309. }
  310. .mains {
  311. width: calc(100vw * (1450 / 1920));
  312. height: calc(100vh * (500 / 1080));
  313. // background: seagreen;
  314. margin-left: calc(100vw * (300 / 1920));
  315. overflow: auto;
  316. }
  317. .mains_prompt {
  318. display: flex;
  319. align-items: center;
  320. margin-left: calc(100vw * (900 / 1920));
  321. margin-top: calc(100vh * (20 / 1080));
  322. }
  323. .empty {
  324. width: 100%;
  325. display: flex;
  326. flex-direction: column;
  327. justify-content: center;
  328. align-items: center;
  329. img {
  330. width: calc(100vw * (160 / 1920));
  331. height: calc(100vh * (160 / 1080));
  332. margin-top: calc(100vh * (150 / 1080));
  333. }
  334. }
  335. .main-main {
  336. width: calc(100vw * (1430 / 1920));
  337. // height: calc(100vh * (220 / 1080));
  338. padding: calc(100vh * (20 / 1080));
  339. border-bottom: 1px dashed #083b61ff;
  340. }
  341. .one {
  342. margin-bottom: calc(100vw * (10 / 1920));
  343. color: #2e8aecff;
  344. font-size: 14px;
  345. text-decoration: underline;
  346. }
  347. .two {
  348. margin-bottom: calc(100vh * (10 / 1080));
  349. display: flex;
  350. .two1 {
  351. margin-right: calc(100vw * (30 / 1920));
  352. }
  353. img {
  354. vertical-align: middle;
  355. }
  356. }
  357. .four {
  358. display: flex;
  359. list-style: none;
  360. padding: 0;
  361. li {
  362. // width: calc(100vw * (62 / 1920));
  363. // height: calc(100vh * (24 / 1080));
  364. border: 1px solid #ff9839ff;
  365. background: #bba99240;
  366. padding: 0 5px;
  367. margin-right: calc(100vw * (5 / 1920));
  368. }
  369. }
  370. //滚动条样式
  371. ::-webkit-scrollbar {
  372. width: 3.5px;
  373. }
  374. ::-webkit-scrollbar-track {
  375. background-color: rgba(0, 0, 0, 0);
  376. }
  377. ::-webkit-scrollbar-thumb {
  378. background: #2e8aec;
  379. border-radius: 3px;
  380. }
  381. ::-webkit-scrollbar-thumb:hover {
  382. background: #2e8aec;
  383. }
  384. ::v-deep .el-input--medium .el-input__inner {
  385. padding-left: calc(100vw * (50 / 1920));
  386. background: #14265e80;
  387. border: 1px solid #01d1ffff;
  388. color: #7ea4c8ff;
  389. }
  390. </style>