阅行客电子档案
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.

516 lines
15 KiB

  1. <template>
  2. <div class="archive-search-main">
  3. <div class="search-main">
  4. <span class="bg_icon1" />
  5. <span class="bg_icon2" />
  6. <span class="bg_icon3" />
  7. <span class="bg_icon4" />
  8. <div class="search-content">
  9. <h2>{{ isCommon ? '档案检索': '高级检索' }}</h2>
  10. <div v-if="isCommon" class="common-search">
  11. <div class="search-input">
  12. <!-- @keyup.enter.native="dimSearch" -->
  13. <el-input v-model="keywords" placeholder="请输入检索关键字" class="input-with-select">
  14. <!-- <el-select slot="prepend" v-model="select" placeholder="请选择">
  15. <el-option
  16. v-for="item in options"
  17. :key="item.value"
  18. :label="item.label"
  19. :value="item.value"
  20. />
  21. </el-select> -->
  22. </el-input>
  23. <el-button slot="append" @click="handleSearch"><i class="iconfont icon-sousuo" />搜索</el-button>
  24. <div class="advanced-search-btn" @click="isCommon=!isCommon">高级检索</div>
  25. </div>
  26. <div class="search-tab">
  27. <span class="active">全部</span>
  28. <span>项目</span>
  29. <span>案卷</span>
  30. <span>文件</span>
  31. <span>原文</span>
  32. </div>
  33. <div class="history-keyword">
  34. <h4>历史检索</h4>
  35. <div class="history-tag">
  36. <span>合同</span>
  37. <span>科技</span>
  38. <span>教育</span>
  39. </div>
  40. </div>
  41. </div>
  42. <div v-else class="advanced-search">
  43. <div class="advanced-search-main">
  44. <el-form ref="form" inline :model="form" :rules="rules" size="small" label-width="70px">
  45. <el-form-item label="字段名" prop="field">
  46. <el-select v-model="form.field" value-key="id">
  47. <el-option v-for="item in fieldOptions" :key="item.id" :label="item.label" :value="item" />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="运算符" prop="symbol">
  51. <el-select v-model="form.symbol" value-key="value" placeholder="请选择">
  52. <el-option
  53. v-for="item in symbolOptions"
  54. :key="item.value"
  55. :label="item.label"
  56. :value="item"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="检索值" prop="keyWord" :rules="getKeywordRules">
  61. <el-input v-model="form.keyWord" />
  62. </el-form-item>
  63. </el-form>
  64. <div class="advanced-btn">
  65. <el-button size="mini" @click="addConditionData"><i class="iconfont icon-xinzeng" />新增</el-button>
  66. <el-button class="filter-refresh" size="mini" icon="el-icon-refresh-left">重置</el-button>
  67. </div>
  68. <div class="search-condition">
  69. <h4> 检索条件</h4>
  70. <div class="condition-main">
  71. <div class="condition-left">
  72. <el-button size="mini" :disabled="currentIndex===null"><i class="iconfont icon-shanchu" />删除</el-button>
  73. <el-button size="mini" icon="el-icon-top" :disabled="currentIndex === 0" @click="moveUp(currentIndex)">上移</el-button>
  74. <el-button size="mini" icon="el-icon-bottom" :disabled="currentIndex === conditionData.length - 1" @click="moveDown(currentIndex)">下移</el-button>
  75. </div>
  76. <ul class="condition-content">
  77. <li v-for="(item, index) in conditionData" :key="index" :class="currentIndex===index ? 'active': ''" @click="selectCurrent(index)">
  78. {{ item }}
  79. </li>
  80. </ul>
  81. <div class="condition-right">
  82. <el-button v-for="(item,index) in connectorList" :key="index" type="primary" size="mini" @click="addConnector(item)">{{ item }}</el-button>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="adv-bottom">
  88. <el-button slot="append" @click="handleAdvancedSearch"><i class="iconfont icon-sousuo" />搜索</el-button>
  89. <div class="advanced-search-btn" @click="isCommon=!isCommon">普通检索</div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script >
  97. import { FetchFindGroupType } from '@/api/system/field'
  98. export default {
  99. name: 'ArchiveSearch',
  100. data() {
  101. return {
  102. isCommon: true,
  103. keywords: '',
  104. form: {
  105. field: null,
  106. symbol: null,
  107. keyWord: null
  108. },
  109. fieldOptions: [],
  110. symbolOptions: [
  111. {
  112. label: '包含',
  113. value: 'like'
  114. },
  115. {
  116. label: '不包含',
  117. value: 'not like'
  118. },
  119. {
  120. label: '等于',
  121. value: '='
  122. },
  123. {
  124. label: '不等于',
  125. value: '!='
  126. },
  127. {
  128. label: '为空',
  129. value: 'is null'
  130. },
  131. {
  132. label: '不为空',
  133. value: 'is not null'
  134. },
  135. {
  136. label: '大于',
  137. value: '>'
  138. },
  139. {
  140. label: '大于等于',
  141. value: '>='
  142. },
  143. {
  144. label: '小于',
  145. value: '<'
  146. },
  147. {
  148. label: '小于等于',
  149. value: '<='
  150. }
  151. ],
  152. rules: {
  153. field: [
  154. { required: true, message: '请选择字段名', trigger: 'change' }
  155. ],
  156. symbol: [
  157. { required: true, message: '请选择运算符', trigger: 'change' }
  158. ]
  159. },
  160. conditionData: [],
  161. currentIndex: null,
  162. connectorList: ['并且', '或者', '(', ')']
  163. }
  164. },
  165. computed: {
  166. getKeywordRules() {
  167. console.log(this.form.symbol)
  168. if ((this.form.symbol && this.form.symbol.label === '为空') || (this.form.symbol && this.form.symbol.label === '不为空')) {
  169. console.log('2222')
  170. return []
  171. } else {
  172. return [{ required: true, message: '请输入检索值', trigger: 'blur' }]
  173. }
  174. }
  175. },
  176. mounted() {
  177. this.getFieldCommon()
  178. },
  179. methods: {
  180. addConditionData() {
  181. this.$refs.form.validate((valid) => {
  182. if (valid) {
  183. let str = ''
  184. if ((this.form.symbol && this.form.symbol.label === '包含') || (this.form.symbol && this.form.symbol.label === '不包含')) {
  185. str = `<span style="color:blue">${this.form.field.label}</span> <span style="color:green">${this.form.symbol.label}</span> "%" + <span style="color:red">${this.form.keyWord}</span> + "%"`
  186. // str = this.form.field.label + ' ' + this.form.symbol.label + " '%" + this.form.keyWord + "%'"
  187. } else {
  188. str = `<span style="color:blue">${this.form.field.label}</span> <span style="color:green">${this.form.symbol.label}</span> <span style="color:red">${this.form.keyWord}</span>`
  189. // str = this.form.field.label + ' ' + this.form.symbol.label + ' ' + this.form.keyWord
  190. }
  191. this.conditionData.push(str)
  192. }
  193. })
  194. },
  195. moveUp(index) {
  196. if (index > 0) {
  197. // [this.conditionData[index], this.conditionData[index - 1]] = [this.conditionData[index - 1], this.conditionData[index]]
  198. const temp = this.conditionData[index]
  199. this.conditionData[index] = this.conditionData[index - 1]
  200. this.conditionData[index - 1] = temp
  201. this.currentIndex = index - 1
  202. }
  203. },
  204. moveDown(index) {
  205. if (index < this.conditionData.length - 1) {
  206. // [this.conditionData[index], this.conditionData[index + 1]] = [this.conditionData[index + 1], this.conditionData[index]]
  207. const temp = this.conditionData[index]
  208. this.conditionData[index] = this.conditionData[index + 1]
  209. this.conditionData[index + 1] = temp
  210. this.currentIndex = index + 1
  211. }
  212. },
  213. selectCurrent(index) {
  214. if (this.currentIndex === index) {
  215. this.currentIndex = null
  216. } else {
  217. this.currentIndex = index
  218. }
  219. },
  220. addConnector(item) {
  221. this.conditionData.push(item)
  222. },
  223. getFieldCommon() {
  224. FetchFindGroupType({ isType: 2 }).then((res) => {
  225. if (res.length !== 0) {
  226. this.fieldOptions = res.map((item, index) => {
  227. const json = {}
  228. json.id = item.id
  229. json.label = item.fieldCnName
  230. json.value = item.fieldName
  231. return json
  232. })
  233. }
  234. })
  235. },
  236. handleAdvancedSearch() {
  237. },
  238. dimSearch() {
  239. },
  240. handleSearch() {
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang='scss' scoped>
  246. .archive-search-main{
  247. padding: 0 20px 20px 20px;
  248. .search-main{
  249. position: relative;
  250. width: 100%;
  251. height: calc(100vh - 140px);
  252. background: url('~@/assets/images/archives/bg.png') no-repeat;
  253. background-size: 100% 100%;
  254. & span{
  255. display: block;
  256. }
  257. .bg_icon1{
  258. position: absolute;
  259. left: 110px;
  260. top: 400px;
  261. width: 236px;
  262. height: 116px;
  263. background: url('~@/assets/images/archives/ys1.png') no-repeat;
  264. background-size: 100% 100%;
  265. }
  266. .bg_icon2{
  267. position: absolute;
  268. left: 50%;
  269. bottom: 60px;
  270. width: 472px;
  271. height: 377px;
  272. margin-left: -236px;
  273. background: url('~@/assets/images/archives/ys2.png') no-repeat;
  274. background-size: 100% 100%;
  275. }
  276. .bg_icon3{
  277. position: absolute;
  278. right: 240px;
  279. bottom: 40px;
  280. width: 136px;
  281. height: 152px;
  282. background: url('~@/assets/images/archives/ys3.png') no-repeat;
  283. background-size: 100% 100%;
  284. }
  285. .bg_icon4{
  286. position: absolute;
  287. right: 110px;
  288. top: 50%;
  289. width: 170px;
  290. height: 136px;
  291. margin-top: -58px;
  292. background: url('~@/assets/images/archives/ys4.png') no-repeat;
  293. background-size: 100% 100%;
  294. }
  295. }
  296. .search-content{
  297. padding-top: 120px;
  298. h2{
  299. font-size: 40px;
  300. text-align: center;
  301. color: #1C1C1C;
  302. margin-bottom: 40px;
  303. }
  304. }
  305. .common-search{
  306. width: 800px;
  307. margin: 0 auto;
  308. .search-input{
  309. position: relative;
  310. display: flex;
  311. justify-content: space-between;
  312. width: 800px;
  313. height: 54px;
  314. background-color: #fff;
  315. border-radius: 3px;
  316. .input-with-select{
  317. ::v-deep .el-input__inner{
  318. width: 664px;
  319. height: 54px !important;
  320. font-size: 14px;
  321. padding: 0 20px;
  322. border: none;
  323. }
  324. }
  325. .el-button{
  326. width: 136px;
  327. background-color: #0348F3;
  328. font-size: 16px;
  329. color: #fff;
  330. border-radius: 0 3px 3px 0;
  331. }
  332. .advanced-search-btn{
  333. position: absolute;
  334. right: -80px;
  335. top: 50%;
  336. transform: translateY(-50%);
  337. font-size: 16px;
  338. color: #0348F3;
  339. cursor:default;
  340. }
  341. }
  342. .search-tab{
  343. display: flex;
  344. justify-content: space-around;
  345. width: 240px;
  346. padding: 15px 0 30px 0;
  347. margin: 0 auto;
  348. color: #545B65;
  349. span{
  350. font-size: 14px;
  351. // padding: 0 12px;
  352. }
  353. span.active{
  354. color: #0348F3;
  355. }
  356. }
  357. .history-keyword{
  358. width: 800px;
  359. height: 280px;
  360. padding: 10px 18px;
  361. background: #F6F9FD;
  362. box-shadow: 0px 4px 19px 0px rgba(0,0,0,0.06);
  363. border-radius: 3px;
  364. opacity: 0.8;
  365. border: 2px solid #FFFFFF;
  366. h4{
  367. font-size: 16px;
  368. height: 40px;
  369. margin-bottom: 10px;
  370. line-height: 33px;
  371. padding-left: 35px;
  372. color: #0C0E1E;
  373. background: url('~@/assets/images/archives/icon-ls.png') no-repeat left center;
  374. background-size: 32px 33px;
  375. }
  376. .history-tag{
  377. display: flex;
  378. justify-content: flex-start;
  379. flex-wrap: wrap;
  380. height: 200px;
  381. overflow: hidden;
  382. overflow-y: scroll;
  383. span{
  384. display: block;
  385. height: 24px;
  386. line-height: 24px;
  387. font-size: 14px;
  388. padding: 0 12px;
  389. margin: 0 0 10px 10px;
  390. color: #545B65;
  391. background: #E6E8ED;
  392. border-radius: 3px;
  393. cursor:default;
  394. }
  395. }
  396. }
  397. }
  398. .advanced-search-main{
  399. position: relative;
  400. width: 1010px;
  401. // height: 350px;
  402. margin: 0 auto;
  403. padding: 30px 40px;
  404. background-color: #fff;
  405. border-radius: 3px;
  406. z-index: 9999;
  407. ::v-deep .el-form--inline .el-form-item{
  408. margin-right: 40px !important;
  409. }
  410. .advanced-btn{
  411. display: flex;
  412. justify-content: center;
  413. text-align: center;
  414. .el-button{
  415. margin-top: 0;
  416. }
  417. }
  418. .search-condition{
  419. padding: 18px 0 24px 0;
  420. margin-top: 20px;
  421. background: #F6F9FF;
  422. border-radius: 3px;
  423. opacity: 1;
  424. border: 1px dashed #DCDFE6;
  425. h4{
  426. width: 480px;
  427. margin: 0 auto 17px auto;
  428. padding-left: 33px;
  429. color: #0C0E1E;
  430. background: url('~@/assets/images/archives/icon-js.png') no-repeat left center;
  431. background-size: 33px 28px;
  432. }
  433. }
  434. .condition-main{
  435. display: flex;
  436. justify-content: center;
  437. flex-wrap: nowrap;
  438. .condition-left{
  439. display: flex;
  440. flex-direction: column;
  441. justify-content: center;
  442. .el-button{
  443. width: 76px;
  444. margin: 5px 0;
  445. ::v-deep i.el-icon-top,
  446. ::v-deep i.el-icon-bottom{
  447. font-size: 16px;
  448. font-weight: bold;
  449. }
  450. }
  451. }
  452. .condition-content{
  453. width: 480px;
  454. height: 160px;
  455. margin: 0 10px;
  456. background: #E6E8ED;
  457. overflow: hidden;
  458. overflow-y: scroll;
  459. li{
  460. height: 32px;
  461. line-height: 32px;
  462. font-size: 14px;
  463. text-align: center;
  464. background-color: #fff;
  465. border-bottom: 1px solid #E6E8ED;
  466. cursor: default;
  467. &:hover,
  468. &:focus,
  469. &.active{
  470. background-color: #E8F2FF;
  471. }
  472. }
  473. }
  474. .condition-right{
  475. display: flex;
  476. flex-direction: column;
  477. justify-content: center;
  478. .el-button{
  479. width: 64px;
  480. margin: 5px 0;
  481. background-color: #0348F3;
  482. color: #fff;
  483. }
  484. }
  485. }
  486. }
  487. }
  488. .adv-bottom{
  489. position: relative;
  490. display: flex;
  491. flex-direction: column;
  492. align-items: center;
  493. margin: 31px auto 0 auto;
  494. width: 96px;
  495. z-index: 999999;
  496. .el-button{
  497. font-size: 16px;
  498. background-color: #0348F3;
  499. color: #fff;
  500. }
  501. .advanced-search-btn{
  502. padding-top: 7px;
  503. font-size: 14px;
  504. color: #0348F3;
  505. cursor: default;
  506. }
  507. }
  508. </style>